Skip to content

fix(ngs2): return PS5 errors for invalid voice handles - #6369

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/ngs2-voice-handle-errors
Oct 18, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/ngs2-voice-handle-errors

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Six implemented NGS2 voice APIs throw NGS2: invalid voice handle instead of returning the PS5 type-4 handle error. Return 0x804A8203 for rejected voice handles in Control, RunCommands, GetState, GetPortInfo, QueryInfo and GetStateFlags. Failed lookups leave output storage untouched.

Control checks a null parameter list first and returns 0x804A8360. GetState resolves the voice before output validation, then checks the eight-byte minimum before the output pointer. Rack-specific exact state sizes and supported output layouts are unchanged. Other validation orders, including GetStateFlags' output-first check, retain the existing policy.

The handle error follows prosper's PS5 module analysis; the Control null-list result/order and GetState order/minimum have explicit native-export annotations here. These are source-analysis results, not new console measurements. The reference's GetStateFlags order is not independently annotated as native behavior, so it is not adopted here. Full invalid-argument precedence, arbitrary-sized state copies and remaining unsupported formats/layouts stay documented debt.

Rebased as one topic commit on main e1041f6a57; prerequisites #6348 and #5916 are merged and are no longer included in the diff.

Tested

Linux x86-64, GCC 16.2.1 Release, Ryzen 9 7950X. Fresh validation of b17406a33a on main e1041f6a57:

Earlier validation on the old head included ten negative controls: the original Voice.cpp fails all six API cases, and four independent argument-order/minimum-size faults fail their corresponding regression checks. Those controls were not rerun on this rebase. The earlier DOOM + DOOM II PPSA21444 smoke/control reached the collection menu on both trees and reproduced corrupted menu text on both; that was startup evidence, not clean rendering or full gameplay.

No new native title run, console measurement, Windows run or full project CTest run performed by me for this refresh. No FPS gain claimed. No game assets or raw title logs attached.

External title validation: klosixgaming-arch reports PPSA17217 (Jurassic Park Classic Games Collection) on main f1af6c5 with #6878. Without this PR it aborts around six seconds in with NGS2: invalid voice handle, traced to handle 0 passed to sceNgs2VoiceRunCommands. With both PRs applied, the reporter ran through menus and games without a stop; ngs2_voicehandles and guest_directory_rewind pass on that Windows 11 / MinGW-w64 / RTX 5090 / NVIDIA 617.42 build. The title also requires Noto Sans files in anyps5-fonts (#7370). This is the contributor's evidence, not an independently reproduced run here.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA17217 (Jurassic Park Classic Games Collection), contributor-tested with fix(libkernel): support SEEK_END on directory descriptors #6878 and the font setup above; no game discussion linked by the reporter
  • GPUs tested: n/a (CPU audio API changes)
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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/Voice.cpp
PR 5797 core/libs/prx/libSceNgs2.native/CMakeLists.txt
core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
docs/dev/debt/libSceNgs2.native.md
PR 6044 core/libs/prx/libSceNgs2.native/CMakeLists.txt
PR 6447 core/libs/prx/libSceNgs2.native/src/Voice.cpp
PR 6594 docs/dev/debt/libSceNgs2.native.md
PR 6680 core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
docs/dev/debt/libSceNgs2.native.md

@JJenkx

JJenkx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

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.

@JJenkx

JJenkx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Temporarily closing to stay within the 20-open-PR limit while prioritizing a newly reproduced and tested Vulkan vertex/index buffer usage fix. This change remains valid and is preserved on fix/ngs2-voice-handle-errors at 41ca241; its pending #6348 dependency is unchanged. Reopen when a slot is available. No branch is deleted.

@JJenkx JJenkx closed this Oct 16, 2026
@klosixgaming-arch

Copy link
Copy Markdown
Contributor

A title that stops on the throw this PR replaces: PPSA17217 (Jurassic Park Classic Games Collection). On main f1af6c5 with the SEEK_END fix from #6878 applied, it aborts about 6 s after start:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  NGS2: invalid voice handle
FATAL: abort() (SIGABRT) on thread 34128

A local trace of the NGS2 voice calls showed the title passing handle 0 to sceNgs2VoiceRunCommands (the two handles it took from sceNgs2RackGetVoiceHandle were valid). With this PR and #6878 both merged on f1af6c5 the call returns an error, the title carries on, and it runs through its menus and games without a stop. ngs2_voicehandles and guest_directory_rewind pass on the same Windows build (MinGW-w64, Windows 11, RTX 5090, NVIDIA 617.42). The title also needs Noto Sans files in anyps5-fonts (#7370).

If it fits, "Unblocks" could list PPSA17217.

AI-assisted: yes. Written with AI assistance and reviewed by me.

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 18, 2026
@adriadam10
adriadam10 merged commit 56ea17e into boykopovar:main Oct 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants