feat(libSceNgs2.native): implement sceNgs2PanInit and sceNgs2PanGetVolumeMatrix #959
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/959"
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 JAB-dev on 2026-10-06T20:25:11Z.
What
Both functions threw
NotImplemented. They now pan as the console library does.SceNgs2PanParam(16 bytes: angle, distance, full-band level, LFE level) andSceNgs2PanWork(40 bytes: up to 8 speaker angles, unit angle, speaker count) replace the reserved arrays. The layouts are from SharpProspero and match the PS4 library.sceNgs2PanInit(work, angles, unit_angle, num_speakers)takes 2, 4, 5 or 7 speakers:sceNgs2PanGetVolumeMatrix(work, params, num_params, format, out)writes the matrix for formats 1, 2, 6 and 8, laid out by destination channel (out[channel * num_params + param]), for up to 8 params:fbw_level, andlfe_levelgoes to the LFE channel;num_params0 returns at once and a null output returnsINVALID_OUT_ADDRESS, as in the PS4 library.TechnicalDebt records the details and the PS4 source.
Reference
libSceNgs2.sprx, dumped and decrypted from a console. It was loaded on Windows with a small test loader and called directly; neither the loader nor the library is part of this PR. The panning code was read from its disassembly, and the test values are its own results.libSceNgs2.sprx(the module titles import aslibSceNgs2): its readable ELF headers match the PS4 library: the same.eh_frame_hdrsize (3,460 bytes, 431 functions) and code plus read-only data within 1% (321,328 bytes against 323,432). A decrypted PS5 SELF was not used; anyone with a decrypted PS5libSceNgs2.sprxcan help confirm this.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release.
ngs2_renderTestPanuses 15 cases with the PS4 library's output, to 1e-6:It also checks the init layout, the wrap-around entry and the throws: unknown formats, 9 params, NaN, null work or params, 0, 1, 3, 6 or 8 speakers, a speaker angle equal to the unit angle, angles of ±1e30 and an infinite speaker angle in the work, and a work whose unit angle was overwritten. A NaN in the second param leaves the output untouched.
A separate fuzz run compared this implementation with the PS4 library on 200,000 random cases. All matched bit for bit.
On
mainthe test fails, because both functions throwNotImplemented. Sixteen mutations ofPan.cppeach make the test fail.Full ctest merged with
maind70b8998, together with #964, #2336 and #2337: 507/507.Seen in PPSA22520 (Animal Well):
sceNgs2PanInit(work, NULL, 360, 2), then onesceNgs2PanGetVolumeMatrix(work, ¶m, 1, 2, out)per sound withangle = fmodf(pan * 180 + 270, 360)and distance 1. Its positional sounds pan by ear.Linux not tested.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-06T21:28:47Z.
Converted to draft: the panning itself (equal power between the two neighbouring speakers, rear angles mirrored to the front for two speakers) is assumed, not taken from the console, which is the same gap as #960. I'm checking it against the output of the console's own NGS2 library and will mark it ready with that.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T05:17:17Z.
Progress report (
7331a12→00e13ec)📈 System libraries: 85.55% (+0.06%, +2 implemented functions)
✅ 2 implemented
sceNgs2PanGetVolumeMatrixsceNgs2PanInitImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T00:19:56Z.
Checked build + ctest on Linux for
libSceNgs2.native(7/7,ngs2_renderpasses; without the change the test doesn't compile), conventions and TechnicalDebt placement; no problems found in the code.@oneandonlydean this PR carries #964 as its first three commits, and you asked for #964 to go first so you can run the full build on it. Merging this one now would land #964 untested on your side. Could you merge #964 and then this one, in that order? Once #964 is on
mainthis is a single commit and nothing else needs changing.Not verified here: the PS4 11.00 library values (the author's own dump; KytyPS5/shadPS4 only give the signature), the match with the PS5 library, and real titles.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T05:42:35Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)sceNgs2PanGetVolumeMatrixsceNgs2PanInitcore/libs/prx/libSceNgs2.native/src/Pan.cpp