feat(ngs2): support custom submixer rack UserFx module 0x1d #5139

Merged
Kikoarl merged 1 commit from upstream-pr/5139 into main 2026-10-15 02:34:23 +00:00
Kikoarl commented 2026-10-13 12:39:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-13T12:39:41Z.


What

Supports SCE_NGS2_CUSTOM_MODULE_ID_USER_FX (0x1d) on custom submixer racks alongside UserFx2 (0x1f). Custom submixer voice parameter SCE_NGS2_CUSTOM_VOICE_PARAM_USER_FX (0x40001d00 | module index) installs legacy UserFx process callbacks and user data per voice.

During voice rendering, custom UserFx callbacks are executed with planar mixed samples, honoring initial/continuation flags and updating sample presence.

Crash Log (Rule 4B):

  • Game: Void Terrarium (PPSA03061)
  • Console log (origin/main):
[libc] unhandled exception 'St13runtime_error' thrown from 00007ffaaae172ea
terminate called after throwing an instance of 'std::runtime_error'
  what(): NGS2: custom module id 0x1d is not implemented
FATAL: abort() (SIGABRT)

Closes #5055

Tested

  • Linux x86_64, GCC 15: built libSceNgs2.native.prx and all tests in RAM (/tmp/anyps5_build).
  • Added TestCustomLegacyUserFx unit test in core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp with pinned values.
  • Ran all 10 libSceNgs2.native unit tests: 100% passed.
  • python3 tools/check_conventions.py passed with 0 errors.

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
  • Unblocks: PPSA03061 #5055
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4843353155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-13T12:39:41Z. --- ### What Supports `SCE_NGS2_CUSTOM_MODULE_ID_USER_FX` (`0x1d`) on custom submixer racks alongside `UserFx2` (`0x1f`). Custom submixer voice parameter `SCE_NGS2_CUSTOM_VOICE_PARAM_USER_FX` (`0x40001d00 | module index`) installs legacy UserFx process callbacks and user data per voice. During voice rendering, custom UserFx callbacks are executed with planar mixed samples, honoring initial/continuation flags and updating sample presence. **Crash Log (Rule 4B)**: - Game: Void Terrarium (`PPSA03061`) - Console log (`origin/main`): ```text [libc] unhandled exception 'St13runtime_error' thrown from 00007ffaaae172ea terminate called after throwing an instance of 'std::runtime_error' what(): NGS2: custom module id 0x1d is not implemented FATAL: abort() (SIGABRT) ``` Closes #5055 ### Tested - Linux x86_64, GCC 15: built `libSceNgs2.native.prx` and all tests in RAM (`/tmp/anyps5_build`). - Added `TestCustomLegacyUserFx` unit test in `core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp` with pinned values. - Ran all 10 `libSceNgs2.native` unit tests: 100% passed. - `python3 tools/check_conventions.py` passed with 0 errors. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA03061 #5055 - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 15:35:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T15:35:44Z.


Windows test: head merged on its own onto current main c35bc4b92 (clean merge; it conflicts with #5140, which adds the same module, so only one of the two can land). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: build of the Ngs2 tests 0 errors; ctest ngs2_custom and ngs2_userfx passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149220520 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6149220520). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T15:35:44Z. --- Windows test: head merged on its own onto current `main` `c35bc4b92` (clean merge; it conflicts with #5140, which adds the same module, so only one of the two can land). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j2`: build of the Ngs2 tests 0 errors; ctest `ngs2_custom` and `ngs2_userfx` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
Kikoarl commented 2026-10-13 17:38:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-13T17:38:44Z.


Thanks @xXPBSXx for the Windows test verification and confirming clean compilation with MinGW.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151496913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6151496913). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-13T17:38:44Z. --- Thanks @xXPBSXx for the Windows test verification and confirming clean compilation with MinGW.
p3n1cillin commented 2026-10-13 20:04:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T20:04:43Z.


Void Terrarium (PPSA03061) passes a 20-byte UserFx (0x1d) module option (00000014 00000000 00000004 447a0000 00000000). This PR only accepts 4 bytes or the UserFx2 size, so the game stops on Ngs2CheckCustomRack: invalid argument; #5140 lets it through. Details in https://github.com/boykopovar/AnyPS5/issues/5055#issuecomment-6154121860

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154123967 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6154123967). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T20:04:43Z. --- Void Terrarium (PPSA03061) passes a 20-byte UserFx (`0x1d`) module option (`00000014 00000000 00000004 447a0000 00000000`). This PR only accepts 4 bytes or the UserFx2 size, so the game stops on `Ngs2CheckCustomRack: invalid argument`; #5140 lets it through. Details in https://github.com/boykopovar/AnyPS5/issues/5055#issuecomment-6154121860
Kikoarl commented 2026-10-13 21:26:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-13T21:26:13Z.


Thanks @p3n1cillin for reporting this and providing the hex dump! I've updated the PR to accept any option with size >= sizeof(Ngs2CustomModuleOption) (handling the 20-byte extended option structure as well as null pointers), and added a unit test covering the 20-byte option layout with pinned values.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155543067 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6155543067). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-13T21:26:13Z. --- Thanks @p3n1cillin for reporting this and providing the hex dump! I've updated the PR to accept any option with `size >= sizeof(Ngs2CustomModuleOption)` (handling the 20-byte extended option structure as well as null pointers), and added a unit test covering the 20-byte option layout with pinned values.
oneandonlydean commented 2026-10-14 02:34:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:34:00Z.


Can you drop the branch that reads a 0x1d option as a UserFx2 module when its size is 24? Nothing shows 0x1d takes that layout, and picking it by size is a guess; the size check and the 20-byte case are enough for PPSA03061.
@p3n1cillin could you rerun PPSA03061 with this head in place of #5140? The 20-byte option is accepted now.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159599982 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6159599982). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:34:00Z. --- Can you drop the branch that reads a 0x1d option as a UserFx2 module when its size is 24? Nothing shows 0x1d takes that layout, and picking it by size is a guess; the size check and the 20-byte case are enough for PPSA03061. @p3n1cillin could you rerun PPSA03061 with this head in place of #5140? The 20-byte option is accepted now.
Kikoarl commented 2026-10-14 08:19:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-14T08:19:21Z.


Done @oneandonlydean. Dropped the 24-byte UserFx2 branch for module 0x1d as requested; 0x1d options are now strictly handled as UserFx (accepting null or size >= 4, which covers the 20-byte case for PPSA03061). Rebased cleanly onto latest origin/main (d1670009f) and verified all NGS2 tests pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164051223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6164051223). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-14T08:19:21Z. --- Done @oneandonlydean. Dropped the 24-byte UserFx2 branch for module 0x1d as requested; 0x1d options are now strictly handled as UserFx (accepting null or size >= 4, which covers the 20-byte case for PPSA03061). Rebased cleanly onto latest `origin/main` (`d1670009f`) and verified all NGS2 tests pass.
screamm commented 2026-10-15 01:46:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T01:46:45Z.


Windows run of this head alone, merged onto main 6239ceffc (clean merge; it also merges cleanly onto the newer 2559e9623, not built).

  • Head 40e201975, base 6239ceffc.
  • Host: Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, NVIDIA RTX 4070.
  • Build: the full build and libs pass with 0 errors and no warnings in libSceNgs2.native.
  • Tests, --repeat until-fail:3, all 10 passed 3/3 (30/30 runs): ngs2_core_render, ngs2_render, ngs2_atrac9, ngs2_filter, ngs2_custom, ngs2_parse, ngs2_stream, ngs2_userfx, ngs2_report, ngs2_geom. ngs2_custom includes TestCustomLegacyUserFx, which covers the 20-byte 0x1d option (size 20, channels 4, 1000.0f) and the null option.
  • Non-GPU suite (ctest -j8 --timeout 120 -E '^agc_driver_|^video_out_flip'): 804/808. conventions_function_bodies, hardware_oracle_compare and tls_function_coverage_register_address_loads timed out while the host was busy and passed when rerun one at a time. check_main_sync fails the same way on plain main here (console code page).
  • Title: PPSA03061 is commercial, so I did not run it. The PPSA03061 rerun requested from @p3n1cillin is still needed.

Verdict: the build, all Ngs2 tests including the 20-byte UserFx option, and the non-GPU suite pass on Windows on top of current main.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182498151 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5139#issuecomment-6182498151). Originally posted by [screamm](https://github.com/screamm) on 2026-10-15T01:46:45Z. --- Windows run of this head alone, merged onto `main` `6239ceffc` (clean merge; it also merges cleanly onto the newer `2559e9623`, not built). - Head `40e201975`, base `6239ceffc`. - Host: Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, NVIDIA RTX 4070. - Build: the full build and `libs` pass with 0 errors and no warnings in libSceNgs2.native. - Tests, `--repeat until-fail:3`, all 10 passed 3/3 (30/30 runs): `ngs2_core_render`, `ngs2_render`, `ngs2_atrac9`, `ngs2_filter`, `ngs2_custom`, `ngs2_parse`, `ngs2_stream`, `ngs2_userfx`, `ngs2_report`, `ngs2_geom`. `ngs2_custom` includes `TestCustomLegacyUserFx`, which covers the 20-byte `0x1d` option (`size 20, channels 4, 1000.0f`) and the null option. - Non-GPU suite (`ctest -j8 --timeout 120 -E '^agc_driver_|^video_out_flip'`): 804/808. `conventions_function_bodies`, `hardware_oracle_compare` and `tls_function_coverage_register_address_loads` timed out while the host was busy and passed when rerun one at a time. `check_main_sync` fails the same way on plain `main` here (console code page). - Title: PPSA03061 is commercial, so I did not run it. The PPSA03061 rerun requested from @p3n1cillin is still needed. Verdict: the build, all Ngs2 tests including the 20-byte UserFx option, and the non-GPU suite pass on Windows on top of current `main`. AI-assisted (Claude Code).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5139
No description provided.