Files
Gary Riches f892ca2f64 Doom 3 BFG for the PS5: RBDoom3BFG on RADV
A PS5 homebrew port of RBDOOM-3-BFG (Robert Beckebans), title PPSA99313,
running at 3840x2160 on Vulkan through RADV with the BFG Edition's data.

- The engine as a submodule at upstream ea29c006, with the console's changes
  as ps5/patches/rbdoom3bfg.patch: Vulkan from RADV's entry point, title paths,
  start-up arguments (gamepad on, no log), a restart through the system, a pad
  opened when it arrives late, and PS5 frame timings (com_ps5Speeds).
- SDL2 with the console's video, audio and pad drivers; openal-soft on SDL2.
- Shaders compiled ahead of time with ShaderMake and DXC (built from source
  for an arm64 host); the ISPC kernel compiled on macOS.
- A material fix for the flashlight beam's dust, title art, README and
  licensing notes.

Claude-Session: https://claude.ai/code/session_016xMYBaR9GfxtETyVf6er1P
2026-10-14 21:08:17 +01:00

30 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Doom 3 BFG for the PlayStation 5 - compile with an init array (a compiler launcher).
#
# cc-init-array.sh COMPILER ARGUMENT...
#
# Clang's PS5 target writes constructors to .ctors, last to first, for a
# start-up that walks them backwards, and its driver refuses -fuse-init-array.
# PS5_Vulkan's CRT walks the merged array forwards, so a unit's initialisers
# ran in reverse: tables built by one initialiser each (the later
# built from the earlier) read a std::map that was not constructed yet.
#
# The switch is the driver's alone: it passes -fno-use-init-array to the
# compiler proper. This asks the driver for that command (-###), drops the
# flag and runs it, which gives .init_array in the order the source has.
# Anything that is not one compile (-c) runs unchanged.
#
# SPDX-License-Identifier: MIT
case " $* " in
*" -c "*) ;;
*) exec "$@" ;;
esac
jobs=$("$@" '-###' 2>&1 | grep -- '^ *"') || exec "$@"
# one job, the compiler proper: a .S file is two (the preprocessor, then the assembler)
[ "$(printf '%s\n' "$jobs" | wc -l)" -eq 1 ] || exec "$@"
job=$(printf '%s\n' "$jobs" | grep -- ' "-cc1" ') || exec "$@"
case $job in
*'$'* | *'`'*) exec "$@" ;; # nothing the shell would expand
esac
eval "exec $(printf '%s' "$job" | sed 's/ "-fno-use-init-array"//')"