Repository navigation
fix(ngs2): return the voice-index error from sceNgs2RackGetVoiceHandle - #5916
Conversation
An index at or beyond the rack's voice count returned through APS5_INVALID_ARG_EX, which throws and ends the process. Heretic + Hexen (PPSA26525) creates a one-voice reverb rack, takes voice 0 and asks for voice 1 at start-up, so it stopped at 1.5 s on "sceNgs2RackGetVoiceHandle: invalid argument". Return 0x804A8305 and leave the output handle untouched, after the existing null-output and rack-handle checks. The value follows prosper's analysis of libSceNgs2.native.sprx; shadPS4 lists 0x804A0302 for the PS4 library. Neither is a PS5 measurement, recorded in the technical debt. ngs2_voiceindex creates one-voice sampler, submixer, mastering and reverb racks and a default sampler rack, and checks the error, the untouched output, the null-output and invalid-rack codes and that the last valid index still resolves afterwards. It aborts on main's library with the throw above and passes with this change.
|
I checked the value against the PS5 module. In One thing outside this change: the same export validates the rack handle first and returns 0x804A8202 for a bad one, before it looks at the output pointer. On |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
jotitadev
left a comment
There was a problem hiding this comment.
Linux run: head 9926c6b76 merged onto main 44df21632 (clean merge). Adds a Linux run to the Windows one in the description.
Machine: Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests (Release, BUILD_TESTING=ON).
- Build: full build passes.
- Ngs2 tests: all 11
ngs2_*tests pass with the PR,ngs2_voiceindexincluded. Withmain'sRack.cppand the PR's test,ngs2_voiceindexaborts with "sceNgs2RackGetVoiceHandle: invalid argument", the line from the title logs. - Non-GPU suite (
ctest -E "^agc"): no regressions; the only failures arefile_writer_binaryandfile_writer_text, which fail onmainon this machine too.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Additional title confirmation: Quake II (PPSA09477), content version 01.003.000. On current main Adding exactly this PR’s three commits, preserving their authorship, removes that stop. The title logs three Full Environment: Arch Linux, Ryzen 9 7950X, Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1. Local validation head: Follow-up: Quake II bring-up #6554 records the later startup failure. A logging-only diagnostic build reached a 3D scene, presented at least 4,254 frames and closed normally after 83.78 seconds. Normal Release startup remains unreliable; no additional functional fix, input validation or playable-title claim is implied. |
|
Checked build and the NGS2 ctest scope on current main (10/10 pass, |
What
Heretic + Hexen (PPSA26525 01.003.000, #5912) stops 1.5 s after start on
main69e7138, before its first frame:The title creates a one-voice reverb rack (
0x2001,max_voices = 1), takes voice 0 and asks for voice 1;sceNgs2RackGetVoiceHandlewent throughAPS5_INVALID_ARG_EXfor an index at or beyond the rack's voice count, which throws and ends the process (exit0xC0000409; the title redirects stderr toapp0/stderr.txt, so the message only shows under gdb). DOOM + DOOM II (PPSA21444 03.000.000, #5921) stops on the same line onmain84b01f9, measured here with the identical call sequence (voices 1 to 3 after voice 0), and STAR WARS: Dark Forces Remaster (PPSA19728, #4310) is reported with it; all three run Nightdive's KEX engine.The index check now returns
0x804A8305and leaves the output handle untouched. The null-output and rack-handle checks keep their order and codes. The value is the one the PS5libSceNgs2.native.sprxexportMwmHz8pAdAoreturns for an index at or past the rack's voice count (firmware 10.01 at0x11f10, 12.70 at0x12130, and every module from 1.00 to 12.70 read in this comment), through the same error helper that answers0x804A8010for a null output, with the output handle written only on success. The technical-debt entry cites that module and notes that the export checks the rack handle before the output pointer and returns0x804A8202for a bad one, which this change leaves as it is onmain.#4788 proposed the same return value for Dark Forces and was closed on 2026-10-14 without a stated reason after twice conflicting with
main. This change is rebased on currentmain, names two more titles that stop on it, and adds the regression asngs2_voiceindexin the existing NGS2 suite.Tested
Windows 11 Home (26200), AMD Ryzen 9 9950X3D, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, bundled dependencies. Branch onmain84b01f9.ngs2_voiceindexcreates one-voice sampler, submixer, mastering and reverb racks throughsceNgs2RackCreatewith an explicit option, as the title does, and a default 256-voice sampler rack. For each it checks that the last valid index resolves, that the voice count, the count plus one andUINT32_MAXreturn0x804A8305with the output left at its sentinel, that a null output still returnsINVALID_OUT_ADDRESS, that the last valid index resolves to the same handle afterwards, and that an unknown rack handle returnsINVALID_RACK_HANDLE. The identical executable aborts againstmain'slibSceNgs2.native.prxwith the throw above and passes with this change.ctest -R ngs2_: 11 of 11 pass.ctest --parallel 8 --timeout 120: 1193 of 1194 pass on the rebuilt tree. The one failure,conventions_blob_reads, is atools/test new onmainwhose fixture'sgit tagfails on this machine because its git configuration signs tags; it fails the same way without this change.python tools/check_conventions.py --base origin/main --head HEADpasses;git diff --checkis clean.--windows --registry(itssce_module/andprx/modules converted),ANYPS5_GPU='RTX 5090', 90 s with no input: onmainit exits at 1.5 s as above; with this change it shows the logos, the Heretic episode menu at 30 s and the attract demo in game at 75 s at 120 FPS on the window counter, loads a level, plays the demo and writes a quick save. Audio and input were not checked. DOOM + DOOM II, same conversion, 120 s with no input: onmainit exits during audio set-up on the same throw; with this change it logskexAudioNgs2::InitReverbVoices: sceNgs2RackGetVoiceHandle failed (0x804a8305)four times, reaches the attract demo in game at 30 s and its main menu at 110 s at 120 FPS. Dark Forces was not run here.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)