fix(ngs2): correct UserFx ids and preserve Delay compatibility #9337
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9337"
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 Th3EvilGod on 2026-10-21T18:45:49Z.
What
Separate UserFx (
0x19,0x40001900 | index) from Delay (0x1d,0x40001dxx). Reuse the existing 40-byte UserFx callback parameter under the corrected IDs, reject non-zero UserFx module state withINVALID_STATE_SIZE, and reject non-null UserFx options and custom-sampler UserFx until their unsupported contracts are established.Preserve the existing Delay audio pass-through as requested by the maintainer. A one-buffer custom submixer with eight ports, no module state and option
20, 0, 4, 1000.0f, 0now passes creation, preserving the rack shape reported for Void Terrarium (PPSA03061) in #5055. The path handles the general supported option family, without a title ID or those specific values in production code: type 0/1, 1..8 taps, finite length 1..20000 and reserved 0. Unknown options, module state and custom-sampler Delay throw. Every0x40001dxxparameter throws an explicit Delay-not-implemented error before any callback or parameter state is changed.Evidence: fma-rc's PS5 firmware 12.70 module reading, parameter dispatch
0x25ec4, rack creation0x13b68, identifies UserFx and Delay, the 40-byte UserFx parameter (8-byte header, handler, three user-data words), and the Delay option layout/ranges. The earlier reading identifies UserFx as having no option or module state. These are attributed findings, not disassembly or hardware measurements I performed.Delay processing/defaults remain unverified; this deliberately preserves existing host behavior and does not claim a working delay effect. The existing UserFx callback context, flags, null-handler behavior and callback-error model also remain unverified on console. Both limits are recorded in separate debt entries. Multi-buffer racks and other custom DSP modules remain outside this change; no title is claimed unblocked.
Rebased on #9233 at
3e00103497(including its #8609 prerequisite), with main1a745ae38emerged. This PR's own change is the single commitb553950ef, affecting four files relative to the combined prerequisite base154ca3754e; Gain code, its ramp tests and its debt entry are retained. The main-targeting diff includes the prerequisite until it lands.Tested
Windows 11 Pro, supported WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full-runtime configuration with
BUILD_TESTING=ON.068856ef5),ngs2_customaborts at rack creation withcustom module id 0x1d is not implemented.libsbuild and both NID-patched NGS2 libraries: pass.ctest --test-dir build/windows-cnd -R '^ngs2_' -V: 13/13 pass, 3.63 seconds.0x1dand the 20-byte option. It compares every stereo PCM sample over consecutive grains, silence before input and after stop, and unchanged output after rejected parameters. It covers 1, 2 and 24 Delay modules, both option types and range endpoints, all 2560x40001dxxIDs, and confirms no legacy UserFx callback runs. Null/wrong options, invalid option fields, NaN/infinity, module state/offset and custom-sampler Delay are rejected.0x19/0x40001900 | index, verify PCM and callback state at positions 0, 1 and 23, and retain invalid-state, parameter-size/index and custom-sampler rejection checks. Gain regressions remain enabled.tools/check_conventions.py --base origin/main: passes with no findings; whitespace check passes.No actual title, console-hardware or Linux run, no full repository test-suite run, and no performance claim. The synthetic Delay regression establishes preservation of existing PCM behavior, not console equivalence or game compatibility.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by KernelPanicNT on 2026-10-21T19:03:23Z.
Thanks for picking this up so quickly, it's good to see
0x19used as fma-rc read it. The move to0x19/0x40001900 | index,INVALID_STATE_SIZEfor a non-zero state and the throw for an option all line up with his two readings in #8039.Two things worth a look before it goes in:
0x1dno longer matches any branch inNgs2CheckCustomRack, so it hits the unknown-module throw (Custom.cpp:62-63), and the tests attests/Ngs2Custom.cpp:470and:584-588expect that. Void Terrarium creates exactly that rack: one0x1dmodule with the option20, 0, 4, 1000.0f, 0, one buffer, no state (#5055 has a 150 s run reaching the title screen with sound). Today it gets through because main still accepts that option through the #5139 path.Throwing for a Delay we can't process yet is within the rules, so I'm not asking you to change the behaviour. It would just help to mention PPSA03061 in the PR body as a known regression and keep the title in the debt entry, so the maintainers can make that call knowingly. The other route is to keep main's
0x1dpath under a Delay name until fma-rc tells us what Delay writes before any parameter is set (question 1 here). Either is fine by me.0x19on the custom sampler rack does nothing.Ngs2CheckCustomRackalso runs for0x4001(Rack.cpp:106) and accepts0x19there, but0x400019xxis only accepted on0x4002(Custom.cpp:202), so the handler can never be set and the audio passes through silently. To be fair, main has the same gap for0x1d. fma-rc says the index is one higher on0x4001, so it could either throw at creation there, as #9233 does for Gain, or route the parameter withindex - 1. Main's Filter handling on0x4001can stay as it is, since Dead Cells sends0x40001300and that's still an open question (question 5).For what it's worth, the merge of #8609 in your branch is unchanged, so there's no conflict with mine, and the conflicts with #9233 are only textual, as your merge-order note already says.
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T09:07:25Z.
Title data point: BLUE REFLECTION Quartet (PPSA33655). Its racks are listed in #8851:
MixerB: 0x19;ReverbB: 0x15 Gain + 0x1b Reverb (12-byte option);DuckingCompSB: 0x19 ×2, 2 buffers.The stop moves forward with each PR. Same scripted runs, natively on Linux 7.2.9, Radeon RX 6650 XT, RADV Mesa 26.2.4, GCC Release:
maind6eafa54d0NGS2: custom module id 0x19 is not implementedd6eafa54d0+ #9337ea6fc50b30NGS2: the custom Gain module is not implementedd6eafa54d0+ #9337 + #92338f6f1eac86NGS2: the custom Reverb module is not implementedSo:
MixerBpass creation as UserFx;ReverbBpasses;DuckingCompSB, which needs 2-buffer racks.No audio was produced or checked; this only shows rack creation getting further. Combining the two PRs conflicted in
Ngs2Types.hpp: I kept bothSCE_NGS2_CUSTOM_VOICE_PARAM_GAINand #9337's UserFx id0x40001900. It also conflicted in the test and debt files, where I kept #9337's side; those are not built in this test.