fix(ngs2): return the voice-index error from sceNgs2RackGetVoiceHandle #5916
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5916"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JosepBove on 2026-10-14T15:33:44Z.
What
Heretic + Hexen (PPSA26525 01.003.000, #5912) stops 1.5 s after start on
main69e7138ac, 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 onmain84b01f9cd, 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 onmain84b01f9cd.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)Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-14T16:12:52Z.
I checked the value against the PS5 module. In
libSceNgs2.native.sprxfrom PS5 firmware 10.01 (exportMwmHz8pAdAoat 0x11f10) and 12.70 (at 0x12130), an index at or past the rack's voice count returns 0x804A8305. The value goes through the same error helper that returns 0x804A8010 for a null output, and the output handle is written only on success. The constant is in this export in all 41 firmware modules from 1.00 to 12.70 that I could read, so the debt entry can cite a PS5 source instead of prosper and shadPS4.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.
mainchecks the output first and returns 0x804A0261 for a bad rack, and 0x804A0261 does not appear in this export in any of those modules. That could be a separate PR.On
maine34c47921with this PR (17f8bb521),ctest -R ngs2_passes 11 of 11 on Linux, includingngs2_voiceindex.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:36Z.
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.
core/libs/prx/libSceNgs2.native/CMakeLists.txtcore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppcore/libs/prx/libSceNgs2.native/src/Rack.cppcore/libs/prx/libSceNgs2.native/CMakeLists.txtcore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppdocs/dev/debt/libSceNgs2.native.mddocs/dev/debt/libSceNgs2.native.mdcore/libs/prx/libSceNgs2.native/CMakeLists.txtdocs/dev/debt/libSceNgs2.native.mddocs/dev/debt/libSceNgs2.native.mdcore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppdocs/dev/debt/libSceNgs2.native.mdImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T19:12:44Z.
Review: COMMENTED
Linux run: head
9926c6b76merged ontomain44df21632(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).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.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.
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-15T20:09:57Z.
Additional title confirmation: Quake II (PPSA09477), content version 01.003.000.
On current main
44df21632125dbe3113a19173e7ebb879da53003, with the common validator-teardown build repair from #6476, the first native startup aborts atsceNgs2RackGetVoiceHandle: invalid argumentbefore a window appears (exit 134).Adding exactly this PR’s three commits, preserving their authorship, removes that stop. The title logs three
InitReverbVoicesfailures with0x804a8305, continues through shader loading and reaches renderer initialization. It then exits with SIGSEGV after about four seconds; this is a startup-blocker confirmation, not a playable-title claim. No game input was injected.Full
libsbuild succeeded. After rebuilding all NGS2 test executables, all 11 NGS2 CTests passed, 0 skipped (0.42 s). An earlier run against stale test executables failed three tests and is excluded from the final test result.Environment: Arch Linux, Ryzen 9 7950X, Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1. Local validation head:
86322c5668718c31ebc0b6bae4b504f3bf3c30c7= current main + #6476 + this PR. No additional production changes, title-specific bypasses, or audio-quality/performance claim. AI-assisted validation.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.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T18:40:48Z.
Checked build and the NGS2 ctest scope on current main (10/10 pass,
ngs2_voiceindexincluded). The return value0x804A8305and the "output written only on success" behaviour match the PS5libSceNgs2.native.sprxexportMwmHz8pAdAoas read by @fma-rc, and the Linux runs by @jotitadev and @johnohhh1 show the new test aborting on main'sRack.cppand passing here. The technical-debt entry covers the differing rack-handle/output check order. Merging once CI is green.