Skip to content

feat(libSceNgs2): implement sceNgs2VoiceGetMatrixInfo and sceNgs2CustomRackGetModuleInfo - #10024

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
ags-arnab:feat/ngs2-matrix-module-info
Oct 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
ags-arnab:feat/ngs2-matrix-module-info

Conversation

@ags-arnab

Copy link
Copy Markdown
Contributor

What

sceNgs2VoiceGetMatrixInfo and sceNgs2CustomRackGetModuleInfo were throwing stubs in libSceNgs2/PendingExports.cpp. They now read back state the library already keeps, and live in the shared libSceNgs2.native sources, as sceNgs2VoiceGetOwner does; the PS5 3.20 export inventory lists both in libSceNgs2 and libSceNgs2.native.

  • sceNgs2VoiceGetMatrixInfo(voice, matrixId, info, infoSize) reports the levels stored for one of the voice's matrices: a count and up to 64 levels, the 260-byte layout of shadPS4's OrbisNgs2VoiceMatrixInfo. A matrix whose levels were never set reports 0 levels.
  • sceNgs2CustomRackGetModuleInfo(rack, moduleIndex, info, infoSize) reports one module of a custom rack as it was given at creation: module id, the three buffer ids, state offset and state size, with both reserved words 0. The 32-byte layout is shadPS4's OrbisNgs2CustomModuleInfo and SharpProspero's SceNgs2CustomModuleInfo. The rack now keeps that info next to the module ids it already kept.

Errors follow the neighbouring getters: a null info gives INVALID_OUT_ADDRESS, an unknown handle INVALID_VOICE_HANDLE or INVALID_RACK_HANDLE, and a matrix info size other than 260 bytes INVALID_OUT_SIZE, as in sceNgs2VoiceGetPortInfo. Cases whose PS5 error code is unknown throw: a matrix id past the rack's matrices, a module index past the rack's modules (so any index on a rack that is not custom), and a module info size under 32 bytes. shadPS4 gives these separate PS4 codes (INVALID_MATRIX_INDEX, INVALID_MODULE_INDEX, INVALID_MODULE_INFO_SIZE), and AnyPS5's PS5 codes do not map onto its PS4 ones. A module info size over 32 bytes throws too, because shadPS4 has longer per-module info (reverb, envelope) whose extra fields are not kept. Both are recorded in docs/dev/debt/libSceNgs2.native.md, and the two names leave the pending list in docs/dev/debt/libSceNgs2.md.

shadPS4 and KytyPlus only log these calls, so no reference gives their behaviour beyond the layouts; none of this was measured on a console.

tools/progress.py --compare: +2 implemented in libSceNgs2.native, the same 2 removed from the libSceNgs2 pending list.

tools/pr_overlap.py --branch reports no overlap. #1384, #5548 and #5797 could not be compared because they conflict with main; they share files but none touches these functions, customModules or the new structures.

Tested

  • Linux x86-64, Ubuntu 26.04 container, GCC 15.2.0, Release, full build on main 9d6adeb: all 13 NGS2 tests pass (ngs2_core_render and the 12 ngs2_* tests). The host is Apple silicon and Rosetta has no AVX2, so they ran under qemu-x86_64 -cpu max (QEMU 10.2.1).
  • New checks: ngs2_voicehandles covers unset, partial, clamped and full 64-level matrices, every error above, a rack without matrices and a destroyed rack; ngs2_custom covers two modules of different kinds, reserved words, every error above, a non-custom rack and a destroyed rack. Five mutations (no level copy, reserved words copied, always module 0, larger module info accepted, matrix info size ignored) each make a test fail.
  • Windows: not built or run (WinLibs GCC 15.2.0 unavailable); the changed files compile with MinGW GCC 16 -fsyntax-only -Wall -Wextra with no new warnings against main.
  • No title was run.
  • python3 tools/check_conventions.py --base origin/main passes.

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: none
  • GPUs tested: n/a
  • AI-assisted: yes

Copilot AI balanced review requested due to automatic review settings October 23, 2026 04:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

Progress report (9d6adeb → 1f1ddc9)

📈 System libraries: 45.18% (+0.01%, +2 implemented, -2 removed functions)

✅ 2 implemented
Library Name
libSceNgs2.native sceNgs2CustomRackGetModuleInfo
libSceNgs2.native sceNgs2VoiceGetMatrixInfo
🗑️ 2 removed
Library Name
libSceNgs2 sceNgs2CustomRackGetModuleInfo
libSceNgs2 sceNgs2VoiceGetMatrixInfo

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 1f1ddc9. The two exported getters match the new ABI layouts (260-byte matrix info, 32-byte custom module info), use the existing lock/handle lookup patterns, validate output sizes and bounds, and only write output on success. The added tests cover unset and populated matrices (including the 64-level cap/clamping), invalid matrix/voice/rack/module indices, destroyed handles, and metadata for UserFx2 and filter modules. I also ran and All conventions checks passed.; both passed. I attempted CMake configuration with BUILD_TESTING=ON, but generation stopped because this checkout is missing ; therefore I could not execute the new native tests locally. Hosted product jobs are skipped, so runtime behavior remains supported by the author's reported 13/13 QEMU tests, not by a test run in this review environment. The ABI/layout claims are based on the cited compatibility references and are documented as unverified against PS5 hardware.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to clarify the review evidence for head 1f1ddc9: the exported getters match the new ABI layouts (260-byte matrix info, 32-byte custom module info), use existing lock and handle lookup patterns, validate output sizes and bounds, and only write output on success. The added tests cover unset and populated matrices (including the 64-level cap and clamping), invalid matrix/voice/rack/module indices, destroyed handles, and metadata for UserFx2 and filter modules.

I ran git diff --check upstream/main...upstream/pr-10024 and python3 tools/check_conventions.py --base upstream/main --head upstream/pr-10024; both passed. I attempted CMake configuration with BUILD_TESTING=ON, but generation stopped because this checkout is missing 3rdparty/vgmstream/src/coding/libs/atrac9_dec.c. I could not execute the new native tests locally. Hosted product jobs are skipped, so runtime behavior remains supported by the author's reported 13/13 QEMU tests, not by a test run in this review environment. The ABI/layout claims are based on the cited compatibility references and are documented as unverified against PS5 hardware.

@ags-arnab

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks for the review. The missing file is from the vgmstream submodule, it was added to main last week for the AJM ATRAC9 decoder, so running git submodule update --init --recursive like in BUILD.md should get the CMake step through.

@github-actions

github-actions Bot commented Oct 23, 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/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Rack.cpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
PR 5548 core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
docs/dev/debt/libSceNgs2.native.md
PR 5797 core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
docs/dev/debt/libSceNgs2.native.md

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 1fc3071 into boykopovar:main Oct 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants