feat(libSceNgs2.native): reverb rack following the PS4 libSceNgs2 reverb #2336
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2336"
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-09T15:49:02Z.
What
sceNgs2RackCreatethrows for rack id0x2001(reverb). This adds the rack, with the reverb the console library renders.SceNgs2ReverbRackOption(rack option,max_channels,reverb_size). The defaults come from KytyPS5: 8 channels andreverb_size1.0x20010000setup takes input and output channel counts and flags. It accepts 1, 2, 6 or 8 channels; other counts are invalid arguments. Non-zero flags and differing input and output counts throw.0x20010001takesSceNgs2ReverbI3DL2Param(88 bytes). The layout of both params, and of the voice state, matches shadPS4'sngs2_reverb.h. Values are clamped to the library's ranges, as it does; NaN throws.sceNgs2VoiceGetStatereturns the common voice state.density.diffusion.hf_reference, then the wet and dry levels. The LFE channel passes dry.densityandreflection_patternare used.reverb_sizeof 1 is handled, with its 14400-sample buffer; other sizes throw.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 reverb was read from its disassembly, and the test values are its output.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_renderTestReverbuses 8 cases with the PS4 library's output, to 2e-7 + 1e-5 of each value:Channel 3 is skipped: the PS4 mastering voice low-passes the LFE channel, and AnyPS5's doesn't yet.
TestReverbSetup: 3, 4, 5 and 7 channels are rejected; channel conversion, flags and NaN throw; the setup defaults render a non-zero level below 1e-8; rendering at 7000 Hz throws, and rack options withreverb_size0 or 2 throw.On
mainthe tests fail, because rack 0x2001 throws. 25 mutations ofReverb.cpp, and removing either new throw, each make them fail.Full ctest merged with
maind70b8998, together with #959, #964 and #2337: 507/507.Seen in PPSA22520 (Animal Well): it creates the rack with default options, sets up a 2-in, 2-out voice, loads I3DL2 preset 9 ("cave" in the standard preset order) and patches it to its mastering voice. Played with #959 and #964 on
main: the jump reverb is the one compared with the PS5 recording above, the game runs at 59 FPS, and there are no NGS2 errors.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 Kikoarl on 2026-10-09T17:52:49Z.
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
473ca04b:/tmp/anyps5_build) with zero warnings/errors.python3 tools/check_conventions.py --base origin/main --head HEAD-> PASS (0 errors).libSceNgs2.native. All audio pipeline tests pass cleanly.LGTM!