fix(ngs2): use PS5 system and rack handle errors #6348

Merged
JJenkx merged 2 commits from upstream-pr/6348 into main 2026-10-17 13:04:35 +00:00
JJenkx commented 2026-10-15 12:47:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-15T12:47:09Z.


What

NGS2 currently returns 0x804A0230 for an invalid system handle and 0x804A0261 for an invalid rack. Use the PS5 handle-type errors 0x804A8201 and 0x804A8202. These shared constants cover the existing system/rack validation paths in both libSceNgs2 builds.

Also validate the rack before the output pointer in sceNgs2RackGetVoiceHandle: an unknown, wrong-kind or retired rack with null output must return the rack error. A live rack with null output still returns 0x804A8010; successful voice lookup is unchanged.

The values follow the handle-type helper in prosper's PS5 module analysis. The lookup order/rack value are independently reported from the native export across firmware 1.00–12.70 in the #5916 review, which explicitly left this correction for a separate PR. This is source-analysis evidence, not a fresh hardware execution test by me. Other exports retain their existing validation order; full invalid-input precedence remains debt.

#5916 is now merged. This branch contains only the two follow-up commits for handle-code/precedence corrections and their tests, rebased onto main ea4cc112a04e6144740756bcd6494bbab5377331. Published head b4a93cd91bcb953c96a20820e80a77675596449e. A merge-tree check against newer main 9e9d86f81c70d5dcd58fee01c4837c18ddd8d0c8 is clean. No remaining prerequisite.

Tested

Rebase validation report, CTest log.

Linux x86-64, GCC, Ryzen 9 7950X:

  • Full libs and all twelve NGS2 test executables build successfully.
  • Final ctest -R '^ngs2_': 12/12 pass, zero skips, 0.41 seconds, including render tests against both libSceNgs2 and libSceNgs2.native, ATRAC9, filters, custom samplers, parsing, streaming, UserFx, reports, geometry and the parent's voice-index regression.
  • New ngs2_handleerrors checks literal PS5 error values for unknown handles, wrong-kind handles, destroyed racks/systems, rack-before-null-output precedence, preserved output sentinels and successful lookup afterwards.
  • Three independent negative controls: restore the old system code; restore the old rack code; restore null-output-first lookup. Each rebuilt native library makes the same unchanged regression executable fail at its matching diagnostic. Its SHA256 stays f7af53442cfd48caebc3477f7a09548c0a6b5496c6bf72d7b5f4ae9274085305. All faults were removed, full libraries/tests rebuilt and the final twelve-test result obtained afterwards.
  • Conventions and whitespace checks pass.

The fresh rebase builds full libs and all twelve NGS2 test executables using main’s published dependency pins. The final twelve-test run passes with no skips in 0.41 seconds. Earlier negative-control results above were obtained before this rebase and were not repeated; no private dependency pin is required for the current build. No Windows execution, full CTest suite, FPS gain or additional title unblock is claimed for this follow-up. The parent #5916 is what removes DOOM's audio initialization stop.

Native integration smoke test

After restoring all faults and rebuilding, a controller-driven DOOM + DOOM II PPSA21444 run entered E1M1: Hangar with the level/weapon/status bar rendered. It completed the planned 140-second watchdog (124), restored the temporary kernel setting and left no native process. Host imports remained enabled. #5916 is what removes the initialization exception; this follow-up claims no additional compatibility or FPS gain. Movement/firing and audible quality were not checked. Exact revisions, settings, limitations and completed/interrupted run accounting.

Checklist

  • Based on current main; prerequisite #5916 merged, no duplicate handle-error implementation found
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none (#5916 merged)
  • Unblocks: none beyond the merged parent's PPSA21444 #5921 / PPSA26525 #5912 / PPSA19728 #4310 fixes
  • GPUs tested: n/a; CPU NGS2 tests
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4873484684 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6348). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-15T12:47:09Z. --- ### What NGS2 currently returns `0x804A0230` for an invalid system handle and `0x804A0261` for an invalid rack. Use the PS5 handle-type errors `0x804A8201` and `0x804A8202`. These shared constants cover the existing system/rack validation paths in both libSceNgs2 builds. Also validate the rack before the output pointer in `sceNgs2RackGetVoiceHandle`: an unknown, wrong-kind or retired rack with null output must return the rack error. A live rack with null output still returns `0x804A8010`; successful voice lookup is unchanged. The values follow the handle-type helper in [prosper's PS5 module analysis](https://github.com/mattias800/prosper/blob/d61eb2c0ad2de879ef74df9c4aa050c512804a18/prosper/src/hle/audio/hle_audio.cpp). The lookup order/rack value are independently reported from the native export across firmware 1.00–12.70 in [the #5916 review](https://github.com/boykopovar/AnyPS5/pull/5916#issuecomment-6172832590), which explicitly left this correction for a separate PR. This is source-analysis evidence, not a fresh hardware execution test by me. Other exports retain their existing validation order; full invalid-input precedence remains debt. #5916 is now merged. This branch contains only the two follow-up commits for handle-code/precedence corrections and their tests, rebased onto main `ea4cc112a04e6144740756bcd6494bbab5377331`. Published head `b4a93cd91bcb953c96a20820e80a77675596449e`. A merge-tree check against newer main `9e9d86f81c70d5dcd58fee01c4837c18ddd8d0c8` is clean. No remaining prerequisite. ### Tested [Rebase validation report](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/pr6348-mainea4-validation-public.json), [CTest log](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/pr6348-mainea4-tests.log). Linux x86-64, GCC, Ryzen 9 7950X: - Full `libs` and all twelve NGS2 test executables build successfully. - Final `ctest -R '^ngs2_'`: **12/12 pass**, zero skips, 0.41 seconds, including render tests against both libSceNgs2 and libSceNgs2.native, ATRAC9, filters, custom samplers, parsing, streaming, UserFx, reports, geometry and the parent's voice-index regression. - New `ngs2_handleerrors` checks literal PS5 error values for unknown handles, wrong-kind handles, destroyed racks/systems, rack-before-null-output precedence, preserved output sentinels and successful lookup afterwards. - Three independent negative controls: restore the old system code; restore the old rack code; restore null-output-first lookup. Each rebuilt native library makes the same unchanged regression executable fail at its matching diagnostic. Its SHA256 stays `f7af53442cfd48caebc3477f7a09548c0a6b5496c6bf72d7b5f4ae9274085305`. All faults were removed, full libraries/tests rebuilt and the final twelve-test result obtained afterwards. - Conventions and whitespace checks pass. The fresh rebase builds full `libs` and all twelve NGS2 test executables using main’s published dependency pins. The final twelve-test run passes with no skips in 0.41 seconds. Earlier negative-control results above were obtained before this rebase and were not repeated; no private dependency pin is required for the current build. No Windows execution, full CTest suite, FPS gain or additional title unblock is claimed for this follow-up. The parent #5916 is what removes DOOM's audio initialization stop. ### Native integration smoke test After restoring all faults and rebuilding, a controller-driven DOOM + DOOM II PPSA21444 run entered E1M1: Hangar with the level/weapon/status bar rendered. It completed the planned 140-second watchdog (124), restored the temporary kernel setting and left no native process. Host imports remained enabled. #5916 is what removes the initialization exception; this follow-up claims no additional compatibility or FPS gain. Movement/firing and audible quality were not checked. [Exact revisions, settings, limitations and completed/interrupted run accounting](https://github.com/boykopovar/AnyPS5/discussions/5921#discussioncomment-18949462). ### Checklist - [x] Based on current `main`; prerequisite #5916 merged, no duplicate handle-error implementation found - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#5916 merged) - [x] Unblocks: none beyond the merged parent's PPSA21444 #5921 / PPSA26525 #5912 / PPSA19728 #4310 fixes - [x] GPUs tested: n/a; CPU NGS2 tests - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 12:52:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:52:02Z.


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.

Pull request Shared files not compared
PR 1384 core/libs/prx/libSceNgs2.native/CMakeLists.txt
core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/Rack.cpp
PR 5797 core/libs/prx/libSceNgs2.native/CMakeLists.txt
core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
docs/dev/debt/libSceNgs2.native.md
PR 6044 core/libs/prx/libSceNgs2.native/CMakeLists.txt
PR 6447 docs/dev/debt/libSceNgs2.native.md
PR 6594 docs/dev/debt/libSceNgs2.native.md
PR 6680 core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
docs/dev/debt/libSceNgs2.native.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6192498390 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6348#issuecomment-6192498390). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:52:02Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 1384](https://www.github.com/boykopovar/AnyPS5/pull/1384) | `core/libs/prx/libSceNgs2.native/CMakeLists.txt`<br>`core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp`<br>`core/libs/prx/libSceNgs2.native/src/Rack.cpp` | | [PR 5797](https://www.github.com/boykopovar/AnyPS5/pull/5797) | `core/libs/prx/libSceNgs2.native/CMakeLists.txt`<br>`core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp`<br>`docs/dev/debt/libSceNgs2.native.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceNgs2.native/CMakeLists.txt` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `docs/dev/debt/libSceNgs2.native.md` | | [PR 6594](https://www.github.com/boykopovar/AnyPS5/pull/6594) | `docs/dev/debt/libSceNgs2.native.md` | | [PR 6680](https://www.github.com/boykopovar/AnyPS5/pull/6680) | `core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp`<br>`docs/dev/debt/libSceNgs2.native.md` |
JJenkx commented 2026-10-16 04:39:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-16T04:39:23Z.


Reviewed the new #6680 overlap at head c5c55fa41512 against this PR. The reported direct conflict is additive debt documentation: #6680 adds sceNgs2GeomApply notes at the end of docs/dev/debt/libSceNgs2.native.md; this branch adds the separate rack voice-index Functional entry there. Both entries should be retained when resolving the document.

The shared source edits are separate: #6680 adds report data types/registration and implements geometry application; this branch changes system/rack/voice handle-error checks. #6680 does not implement those error corrections, and this PR does not build on #6680. Existing declared dependencies are unchanged. GitHub currently marks this branch MERGEABLE against main 5d9dcc42d; this is an overlap review, not an additional build or combined-tree test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208211377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6348#issuecomment-6208211377). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-16T04:39:23Z. --- Reviewed the new #6680 overlap at head `c5c55fa41512` against this PR. The reported direct conflict is additive debt documentation: #6680 adds `sceNgs2GeomApply` notes at the end of `docs/dev/debt/libSceNgs2.native.md`; this branch adds the separate rack voice-index Functional entry there. Both entries should be retained when resolving the document. The shared source edits are separate: #6680 adds report data types/registration and implements geometry application; this branch changes system/rack/voice handle-error checks. #6680 does not implement those error corrections, and this PR does not build on #6680. Existing declared dependencies are unchanged. GitHub currently marks this branch MERGEABLE against `main` `5d9dcc42d`; this is an overlap review, not an additional build or combined-tree test.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6348
No description provided.