feat(libSceNgs2.native): implement custom sampler rack id 0x4001 (#4334) #4417

Merged
Jnbla6 merged 5 commits from upstream-pr/4417 into main 2026-10-13 19:55:21 +00:00
Jnbla6 commented 2026-10-12 10:28:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jnbla6 on 2026-10-12T10:28:27Z.


What

  • Implement generic support for the NGS2 custom sampler rack, SCE_NGS2_RACK_ID_CUSTOM_SAMPLER (0x4001), which Dead Cells requests during startup.
  • Add the 1304-byte Ngs2CustomSamplerRackOption layout and rack/voice parameter IDs. Route sampler controls and rendering through the existing sampler implementation, while supporting UserFx2 modules on the custom rack.
  • Add a permanent TestCustomSampler() regression test and document the implementation assumptions in TechnicalDebt.md.

Tested

  • Linux: repository conventions check passed with python3 tools/check_conventions.py --base origin/main.
  • Relinker-only build succeeded; CTest passed all 128 registered tests.
  • python3 -m unittest discover -s tools/tests: 184 tests passed.
  • C++20 syntax check passed for the modified NGS2 implementation and test files.
  • CI verified: libSceNgs2.native builds successfully and ngs2_custom tests pass.

Checklist

  • Based on current main
  • 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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA15552 Dead Cells #4334
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4828109473 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417). Originally posted by [Jnbla6](https://github.com/Jnbla6) on 2026-10-12T10:28:27Z. --- ### What - Implement generic support for the NGS2 custom sampler rack, `SCE_NGS2_RACK_ID_CUSTOM_SAMPLER` (`0x4001`), which Dead Cells requests during startup. - Add the 1304-byte `Ngs2CustomSamplerRackOption` layout and rack/voice parameter IDs. Route sampler controls and rendering through the existing sampler implementation, while supporting UserFx2 modules on the custom rack. - Add a permanent `TestCustomSampler()` regression test and document the implementation assumptions in `TechnicalDebt.md`. ### Tested - Linux: repository conventions check passed with `python3 tools/check_conventions.py --base origin/main`. - Relinker-only build succeeded; CTest passed all 128 registered tests. - `python3 -m unittest discover -s tools/tests`: 184 tests passed. - C++20 syntax check passed for the modified NGS2 implementation and test files. - CI verified: libSceNgs2.native builds successfully and ngs2_custom tests pass. ### Checklist - [x] Based on current `main` - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [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: PPSA15552 Dead Cells #4334 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-12 10:37:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T10:37:58Z.


Correction after comparing both diffs: #4254 already has the same 0x4001 rack layout, sampler setup/add-waveform/pitch parameter IDs, custom sampler rendering, and UserFx2 setup/processing. #4417 appears largely to duplicate it; the additional sampler behavior I found is custom exit_loop parameter handling, alongside a smaller test. Both still call Ngs2CheckCustomRack, so neither appears to implement module ID 0x13 that the maintainer identified as Dead Cells' current stop.

Could you coordinate with #4254's author and make this a focused follow-up after #4254, or explain why #4417 is intended to replace it? As written, #4417 targets main, overlaps the existing open implementation, and its checklist says there is no overlapping PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6122588623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6122588623). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T10:37:58Z. --- Correction after comparing both diffs: #4254 already has the same `0x4001` rack layout, sampler setup/add-waveform/pitch parameter IDs, custom sampler rendering, and UserFx2 setup/processing. #4417 appears largely to duplicate it; the additional sampler behavior I found is custom `exit_loop` parameter handling, alongside a smaller test. Both still call `Ngs2CheckCustomRack`, so neither appears to implement module ID `0x13` that the maintainer identified as Dead Cells' current stop. Could you coordinate with #4254's author and make this a focused follow-up after #4254, or explain why #4417 is intended to replace it? As written, #4417 targets `main`, overlaps the existing open implementation, and its checklist says there is no overlapping PR.
Jnbla6 commented 2026-10-12 11:05:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jnbla6 on 2026-10-12T11:05:42Z.


thank you for the note! I actually started working on this after seeing issue #4334, and I hadn't noticed that PR #4254 was already open regarding the same thing—my apologies for the overlap!

Since #4254 already covers the core layout and parameters, please feel free to carry it all or take any useful pieces from my code if anything here is helpful. If not, no worries at all! Thank you for your hard work on this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123011025 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6123011025). Originally posted by [Jnbla6](https://github.com/Jnbla6) on 2026-10-12T11:05:42Z. --- thank you for the note! I actually started working on this after seeing issue #4334, and I hadn't noticed that PR #4254 was already open regarding the same thing—my apologies for the overlap! Since #4254 already covers the core layout and parameters, please feel free to carry it all or take any useful pieces from my code if anything here is helpful. If not, no worries at all! Thank you for your hard work on this.
Jnbla6 commented 2026-10-12 13:39:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jnbla6 on 2026-10-12T13:39:48Z.


After investigating the 0x13 custom-module roadblock reported for Dead Cells (PPSA15552), I compared the parameter layout with shadPS4’s NGS2 definitions and traced how AnyPS5 currently handles sampler filters. The evidence points to module ID 0x13 being the built-in Custom Voice Filter module (SCE_NGS2_CUSTOM_MODULE_ID_FILTER), but I have not tested the implementation yet, so I cannot confirm that this fully solves the game’s startup issue.

Deep-Dive Discovery & Live Protocol Correlation:

A close cross-section analysis between live protocol traces from Dead Cells (captured via PROSPER_NGS2_TRACE=2 in prosper) and the reference definitions in shadPS4 (ngs2_custom.h) reveals the exact identity and memory layout of module 0x13:

  1. Module Identification (0x13): Option dumps from real title captures show that Dead Cells initializes its 0x4001 custom sampler rack with a single built-in module 0x13 where option == nullptr, state_size == 0, and all buffer IDs are strictly zero.
  2. Control Command Routing (0x40001300): During playback, the game issues parameter updates via command family 0x40001300 (0x40000000 | (0x13 << 8) | index). While initial trace analysis in other emulators mistakenly misidentified these payload fields as generic stereo output levels (MatrixLevels), correlating the raw offsets directly against OrbisNgs2CustomVoiceFilterParam proves they are classic RBJ Biquad filter parameters:
    • +0x00: Ngs2VoiceParamHeader (8 bytes, id = 0x40001300, size = 40).
    • +0x08: u32 type (Filter type, e.g., 1 for Low-pass).
    • +0x0c: u32 channelMask (Channel bitmask).
    • +0x10: float fc holding ~1e4 (10000.0 Hz), representing the cutoff frequency.
    • +0x14: float q holding 0.707f (\frac{1}{\sqrt{2}}), representing the Butterworth quality/resonance factor.
    • +0x18: float level holding 1.0f, representing the filter stage level output.

Findings & ABI Details:

  • Module setup: The reported custom sampler option has one 0x13 module with a null option and no state. The implementation now accepts that configuration while keeping the filter module strictly out of UserFx setup and processing.
  • Parameter routing: The 0x40001300 | index command is routed to AnyPS5’s existing filter implementation, with validation that the index identifies a FILTER module.
  • ABI correction: The reference layout is strictly 40 bytes: header at +0x00, type at +0x08, 32-bit channelMask at +0x0c, and the parameter union at +0x10. In its fcq form, frequency, q, and level reside at +0x10, +0x14, and +0x18 respectively. Compile-time assertions check the structure size and key offsets.

Verification Status:

git diff --check is clean, and editor checks found no syntax errors in the changed ABI definition, custom-module code, or test. I’m therefore not fully sure this solution is correct or complete because i didnt test it on the game, it still needs a successful build and runtime test, ideally with Dead Cells.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125442161 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6125442161). Originally posted by [Jnbla6](https://github.com/Jnbla6) on 2026-10-12T13:39:48Z. --- After investigating the `0x13` custom-module roadblock reported for *Dead Cells* (PPSA15552), I compared the parameter layout with `shadPS4`’s NGS2 definitions and traced how AnyPS5 currently handles sampler filters. The evidence points to module ID `0x13` being the built-in Custom Voice Filter module (`SCE_NGS2_CUSTOM_MODULE_ID_FILTER`), but I have not tested the implementation yet, so I cannot confirm that this fully solves the game’s startup issue. ### Deep-Dive Discovery & Live Protocol Correlation: A close cross-section analysis between live protocol traces from *Dead Cells* (captured via `PROSPER_NGS2_TRACE=2` in `prosper`) and the reference definitions in `shadPS4` (`ngs2_custom.h`) reveals the exact identity and memory layout of module `0x13`: 1. **Module Identification (`0x13`)**: Option dumps from real title captures show that *Dead Cells* initializes its `0x4001` custom sampler rack with a single built-in module `0x13` where `option == nullptr`, `state_size == 0`, and all buffer IDs are strictly zero. 2. **Control Command Routing (`0x40001300`)**: During playback, the game issues parameter updates via command family `0x40001300` (`0x40000000 | (0x13 << 8) | index`). While initial trace analysis in other emulators mistakenly misidentified these payload fields as generic stereo output levels (`MatrixLevels`), correlating the raw offsets directly against `OrbisNgs2CustomVoiceFilterParam` proves they are classic RBJ Biquad filter parameters: - **`+0x00`**: `Ngs2VoiceParamHeader` (8 bytes, `id = 0x40001300`, `size = 40`). - **`+0x08`**: `u32 type` (Filter type, e.g., `1` for Low-pass). - **`+0x0c`**: `u32 channelMask` (Channel bitmask). - **`+0x10`**: `float fc` holding `~1e4` (`10000.0 Hz`), representing the cutoff frequency. - **`+0x14`**: `float q` holding `0.707f` ($\frac{1}{\sqrt{2}}$), representing the Butterworth quality/resonance factor. - **`+0x18`**: `float level` holding `1.0f`, representing the filter stage level output. ### Findings & ABI Details: - **Module setup**: The reported custom sampler option has one `0x13` module with a null option and no state. The implementation now accepts that configuration while keeping the filter module strictly out of `UserFx` setup and processing. - **Parameter routing**: The `0x40001300 | index` command is routed to AnyPS5’s existing filter implementation, with validation that the index identifies a `FILTER` module. - **ABI correction**: The reference layout is strictly 40 bytes: header at `+0x00`, `type` at `+0x08`, 32-bit `channelMask` at `+0x0c`, and the parameter union at `+0x10`. In its `fcq` form, `frequency`, `q`, and `level` reside at `+0x10`, `+0x14`, and `+0x18` respectively. Compile-time assertions check the structure size and key offsets. ### Verification Status: `git diff --check` is clean, and editor checks found no syntax errors in the changed ABI definition, custom-module code, or test. I’m therefore not fully sure this solution is correct or complete because i didnt test it on the game, it still needs a successful build and runtime test, ideally with *Dead Cells*.
oneandonlydean commented 2026-10-13 00:20:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:20:10Z.


Four things before this can go in:

  • Conflicts with main in docs/dev/TechnicalDebt.md; please rebase. The entry now goes in docs/dev/debt/libSceNgs2.native.md.
  • Custom.cpp:116: only type == 1 copies its parameters; any other type, and the direct coefficient form, reaches Ngs2SetFilter with zeros. Please throw for what isn't implemented.
  • The debt entry doesn't mention module 0x13 or the 0x40001300 control. Please add what they are taken to be and the source for the module id; shadPS4's ngs2_custom.h gives the parameter layout but not the id.
  • The description says ngs2_custom was never built or run. Please run it, or say so once CI has.

#4254 and #3793 add the same rack, so the checklist's "no other open PR" needs correcting.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135174569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6135174569). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:20:10Z. --- Four things before this can go in: - Conflicts with main in `docs/dev/TechnicalDebt.md`; please rebase. The entry now goes in `docs/dev/debt/libSceNgs2.native.md`. - `Custom.cpp:116`: only `type == 1` copies its parameters; any other type, and the `direct` coefficient form, reaches `Ngs2SetFilter` with zeros. Please throw for what isn't implemented. - The debt entry doesn't mention module `0x13` or the `0x40001300` control. Please add what they are taken to be and the source for the module id; shadPS4's `ngs2_custom.h` gives the parameter layout but not the id. - The description says `ngs2_custom` was never built or run. Please run it, or say so once CI has. #4254 and #3793 add the same rack, so the checklist's "no other open PR" needs correcting.
oneandonlydean commented 2026-10-13 07:46:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:46:37Z.


Taking this one for #3553 over #3793 and #4254. Please rebase: docs/dev/debt/ conflicts with main. The four points from earlier today still stand.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140847070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6140847070). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T07:46:37Z. --- Taking this one for #3553 over #3793 and #4254. Please rebase: `docs/dev/debt/` conflicts with main. The four points from earlier today still stand.
xXPBSXx commented 2026-10-13 13:17:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T13:17:56Z.


Windows test note: this branch (base 8c4a295ff) no longer merges onto current main 0f2683cb7; git merge-tree reports a conflict in docs/dev/TechnicalDebt.md. Technical debt entries now live in per-library files under docs/dev/debt/ (see docs/dev/CONVENTIONS.md), so the entry probably has to move there as part of the rebase. I could not run its tests on a merged tree.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146446406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6146446406). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T13:17:56Z. --- Windows test note: this branch (base `8c4a295ff`) no longer merges onto current `main` `0f2683cb7`; `git merge-tree` reports a conflict in `docs/dev/TechnicalDebt.md`. Technical debt entries now live in per-library files under `docs/dev/debt/` (see `docs/dev/CONVENTIONS.md`), so the entry probably has to move there as part of the rebase. I could not run its tests on a merged tree. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-13 17:21:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T17:21:18Z.


Thanks for offering this implementation. I carried commit 1d5190d0ed9bc084df019d0a93250e02416d9799 into #4254 alongside the custom sampler rack work, preserving your commit author. The combined Linux ngs2_custom test passes (1/1); unsupported custom filter types throw explicitly. No Dead Cells runtime test was available. I’m leaving #4417 open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151187572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6151187572). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T17:21:18Z. --- Thanks for offering this implementation. I carried commit `1d5190d0ed9bc084df019d0a93250e02416d9799` into #4254 alongside the custom sampler rack work, preserving your commit author. The combined Linux `ngs2_custom` test passes (1/1); unsupported custom filter types throw explicitly. No Dead Cells runtime test was available. I’m leaving #4417 open.
MarcZX10 commented 2026-10-13 17:50:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T17:50:17Z.


I checked the updated head b2ddb0b7d7. The new else now rejects unsupported filter types, and the debt entry is in the per-library file. #4254 already carries the same filter implementation and explicitly tests that types 0 and 2 throw; #4417’s filter test currently covers type 1 and the invalid module index. The sampler-rack implementation also remains substantially overlapping between the two PRs.\n\nI have left both PRs open. If #4417 is meant to contribute only the filter follow-up, narrowing it to the delta that is not already in #4254 would make the remaining review clear.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151702200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6151702200). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T17:50:17Z. --- I checked the updated head `b2ddb0b7d7`. The new `else` now rejects unsupported filter types, and the debt entry is in the per-library file. #4254 already carries the same filter implementation and explicitly tests that types 0 and 2 throw; #4417’s filter test currently covers type 1 and the invalid module index. The sampler-rack implementation also remains substantially overlapping between the two PRs.\n\nI have left both PRs open. If #4417 is meant to contribute only the filter follow-up, narrowing it to the delta that is not already in #4254 would make the remaining review clear.
Jnbla6 commented 2026-10-13 18:11:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jnbla6 on 2026-10-13T18:11:46Z.


@oneandonlydean I have applied all of your requested changes:

  1. Rebase & Debt Conflict: Rebased onto current main, resolved the conflict, and correctly moved the documentation to docs/dev/debt/libSceNgs2.native.md.
  2. Strict Validation (Throw): Updated Custom.cpp to explicitly throw for any filter type other than 1, ensuring we strictly track unmodeled behavior instead of silently passing zeros.
  3. Debt Documentation: Expanded the debt entry to explicitly document the built-in module 0x13 (Custom Voice Filter) and the 0x40001300 control command, citing both shadPS4's layout and prosper's live trace logs as the verification sources.
  4. Description & Checklist: Updated the PR description to reflect that CI successfully builds and passes the ngs2_custom tests, and updated the checklist to acknowledge the overlap.

Furthermore, as noted over in issue #3553, @hansjm10 has run a diagnostic test on this branch. His runtime test successfully cleared the initial 0x4001 / 0x13 rack creation roadblock for Dead Cells, successfully advancing the title's execution state to the non-default listener orientation stop (sceNgs2GeomCalcListener). Merging this PR will formally unblock that geometry/listener issue so the next fix can be tested and developed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152085161 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152085161). Originally posted by [Jnbla6](https://github.com/Jnbla6) on 2026-10-13T18:11:46Z. --- @oneandonlydean I have applied all of your requested changes: 1. **Rebase & Debt Conflict:** Rebased onto current `main`, resolved the conflict, and correctly moved the documentation to `docs/dev/debt/libSceNgs2.native.md`. 2. **Strict Validation (Throw):** Updated `Custom.cpp` to explicitly `throw` for any filter type other than `1`, ensuring we strictly track unmodeled behavior instead of silently passing zeros. 3. **Debt Documentation:** Expanded the debt entry to explicitly document the built-in module `0x13` (Custom Voice Filter) and the `0x40001300` control command, citing both `shadPS4`'s layout and `prosper`'s live trace logs as the verification sources. 4. **Description & Checklist:** Updated the PR description to reflect that CI successfully builds and passes the `ngs2_custom` tests, and updated the checklist to acknowledge the overlap. Furthermore, as noted over in issue #3553, @hansjm10 has run a diagnostic test on this branch. His runtime test successfully cleared the initial `0x4001` / `0x13` rack creation roadblock for *Dead Cells*, successfully advancing the title's execution state to the non-default listener orientation stop (`sceNgs2GeomCalcListener`). Merging this PR will formally unblock that geometry/listener issue so the next fix can be tested and developed.
github-actions[bot] commented 2026-10-13 18:36:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T18:36:54Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#4788 docs/dev/debt/libSceNgs2.native.md L26
#5021 docs/dev/TechnicalDebt.md L1-33
#5139 core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp L59-60, L64
core/libs/prx/libSceNgs2.native/src/Custom.cpp L20-23, L39-53, L95, L100, L103-110
core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp L226, L229
#5140 core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp L59-60, L64, L492-493
core/libs/prx/libSceNgs2.native/src/Custom.cpp L20-23, L36, L39-53, L95, L100, L103-110
core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp L226, L229
#5222 docs/dev/TechnicalDebt.md L1-33
#5330 docs/dev/TechnicalDebt.md L1-33
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152537247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152537247). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T18:36:54Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4788 | `docs/dev/debt/libSceNgs2.native.md` [L26](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/docs/dev/debt/libSceNgs2.native.md#L26) | | | | #5021 | `docs/dev/TechnicalDebt.md` [L1-33](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/docs/dev/TechnicalDebt.md#L1-L33) | | | | #5139 | `core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp` [L59-60](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp#L59-L60), [L64](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp#L64)<br>`core/libs/prx/libSceNgs2.native/src/Custom.cpp` [L20-23](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L20-L23), [L39-53](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L39-L53), [L95](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L95), [L100](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L100), [L103-110](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L103-L110)<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp` [L226](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp#L226), [L229](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp#L229) | | | | #5140 | `core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp` [L59-60](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp#L59-L60), [L64](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp#L64), [L492-493](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp#L492-L493)<br>`core/libs/prx/libSceNgs2.native/src/Custom.cpp` [L20-23](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L20-L23), [L36](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L36), [L39-53](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L39-L53), [L95](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L95), [L100](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L100), [L103-110](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/src/Custom.cpp#L103-L110)<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp` [L226](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp#L226), [L229](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp#L229) | | | | #5222 | `docs/dev/TechnicalDebt.md` [L1-33](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/docs/dev/TechnicalDebt.md#L1-L33) | | | | #5330 | `docs/dev/TechnicalDebt.md` [L1-33](https://github.com/boykopovar/AnyPS5/blob/dacd78525e537a779682032c0ace7f7af120af05/docs/dev/TechnicalDebt.md#L1-L33) | | |
MarcZX10 commented 2026-10-13 18:47:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T18:47:12Z.


The overlap workflow reports that #4254 and #4417 both change the custom rack structures and implementation across Ngs2Types.hpp, Custom.cpp, Rack.cpp, Voice.cpp and the tests. Since #4417 has a focused sampler-rack implementation and runtime validation, I updated #4254 to depend on #4417 and will rebase the filter follow-up after yours lands. Please let me know if you prefer the opposite order.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152719212 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152719212). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T18:47:12Z. --- The overlap workflow reports that #4254 and #4417 both change the custom rack structures and implementation across `Ngs2Types.hpp`, `Custom.cpp`, `Rack.cpp`, `Voice.cpp` and the tests. Since #4417 has a focused sampler-rack implementation and runtime validation, I updated #4254 to depend on #4417 and will rebase the filter follow-up after yours lands. Please let me know if you prefer the opposite order.
MarcZX10 commented 2026-10-13 18:47:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T18:47:59Z.


I also updated #4777 to depend on #4417. Its rack-handle fallback changes the same Patch hunk; after your change lands, I will rebase it while preserving the custom-sampler destination rejection you added.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152733621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152733621). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T18:47:59Z. --- I also updated #4777 to depend on #4417. Its rack-handle fallback changes the same `Patch` hunk; after your change lands, I will rebase it while preserving the custom-sampler destination rejection you added.
p3n1cillin commented 2026-10-13 18:47:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T18:47:59Z.


Ran PPSA15552 (Dead Cells, my own dump) on Windows against main + this PR, to give the runtime evidence that was missing here and on #4254.

Order of stops

  1. This PR alone. The custom sampler racks, module 0x13 and 0x40010000 setup all go through. It then stops on Patch: invalid argument, because the game patches a sampler voice to a rack handle. #4777 fixes that.
  2. With #4777 merged on top. I kept both checks when resolving the conflict in Patch: rack-handle fallback plus rejection of CUSTOM_SAMPLER destinations. It then stops on NGS2: custom filter type 0 is not implemented.

The 0x40001300 param doesn't match the 40-byte shadPS4 layout

The game's header declares size = 48. Here are the twelve 32-bit words it passes, header included:

00000030 40001300 00000000 00000000 00000009 461c4000 3f34fdf4 3f800000 00000000 00000000 00000000 00000000
size/next id       +0x08    +0x0c    +0x10    +0x14    +0x18    +0x1c    ...
  • +0x14..+0x1c are 10000.0f, 0.7071f, 1.0f. They look like fc / Q / level, and are the values prosper's trace saw.
  • Those values are one word later than OrbisNgs2CustomVoiceFilterParam.param.fcq (which starts at +0x10).
  • +0x10 holds 9, which looks like the real type.
  • +0x08 and +0x0c are zero.

So under the shadPS4 struct the type reads as 0 and i0 as the integer 9. The PS5 struct seems to be 48 bytes with a different field order. I can't name the fields from this alone: +0x08 could be a 64-bit channel mask or index plus location, and I don't know what type 9 means. But both this PR and #4254 currently reject the only filter this title sends.

What happens past that point (local diagnostic build, not for merging)

To see what follows, I made the filter param a no-op locally.

  • The next stop is NGS2: voice state of rack 0x4001 is not implemented. sceNgs2VoiceGetState is called on custom sampler voices with state_size = 48; the sampler's state is 56 bytes.
  • With that answered locally (zeroed, state_flags set), the game ran for 3 minutes with no further library stop. It mounts its save data, reads dc_options.json, and loads fonts and atlases.

Separate from this PR: sceNgs2GeomCalcListener on main

main throws on the listener the game uses: position 0, front (1,0,0), up (0,0,1), flags 0, sound speed 343.

  • That listener is passed every frame, about 850 times in 40 s.
  • It is preceded by two calls with the default front (0,0,1) / up (0,1,0).
  • sceNgs2GeomApply is imported but was never called in 3 minutes.

I'm not proposing a fix for this here, because the matrix convention has no source beyond the KytyPS5/PS5PCEM inferences.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152733807 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152733807). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T18:47:59Z. --- Ran PPSA15552 (Dead Cells, my own dump) on Windows against `main` + this PR, to give the runtime evidence that was missing here and on #4254. **Order of stops** 1. **This PR alone.** The custom sampler racks, module `0x13` and `0x40010000` setup all go through. It then stops on `Patch: invalid argument`, because the game patches a sampler voice to a *rack* handle. #4777 fixes that. 2. **With #4777 merged on top.** I kept both checks when resolving the conflict in `Patch`: rack-handle fallback plus rejection of `CUSTOM_SAMPLER` destinations. It then stops on `NGS2: custom filter type 0 is not implemented`. **The `0x40001300` param doesn't match the 40-byte shadPS4 layout** The game's header declares `size = 48`. Here are the twelve 32-bit words it passes, header included: ``` 00000030 40001300 00000000 00000000 00000009 461c4000 3f34fdf4 3f800000 00000000 00000000 00000000 00000000 size/next id +0x08 +0x0c +0x10 +0x14 +0x18 +0x1c ... ``` - `+0x14..+0x1c` are `10000.0f, 0.7071f, 1.0f`. They look like fc / Q / level, and are the values prosper's trace saw. - Those values are one word later than `OrbisNgs2CustomVoiceFilterParam.param.fcq` (which starts at `+0x10`). - `+0x10` holds `9`, which looks like the real type. - `+0x08` and `+0x0c` are zero. So under the shadPS4 struct the type reads as `0` and `i0` as the integer 9. The PS5 struct seems to be 48 bytes with a different field order. I can't name the fields from this alone: `+0x08` could be a 64-bit channel mask or index plus location, and I don't know what type `9` means. But both this PR and #4254 currently reject the only filter this title sends. **What happens past that point (local diagnostic build, not for merging)** To see what follows, I made the filter param a no-op locally. - The next stop is `NGS2: voice state of rack 0x4001 is not implemented`. `sceNgs2VoiceGetState` is called on custom sampler voices with `state_size = 48`; the sampler's state is 56 bytes. - With that answered locally (zeroed, `state_flags` set), the game ran for 3 minutes with no further library stop. It mounts its save data, reads `dc_options.json`, and loads fonts and atlases. **Separate from this PR: `sceNgs2GeomCalcListener` on `main`** `main` throws on the listener the game uses: position 0, front `(1,0,0)`, up `(0,0,1)`, flags 0, sound speed 343. - That listener is passed every frame, about 850 times in 40 s. - It is preceded by two calls with the default front `(0,0,1)` / up `(0,1,0)`. - `sceNgs2GeomApply` is imported but was never called in 3 minutes. I'm not proposing a fix for this here, because the matrix convention has no source beyond the KytyPS5/PS5PCEM inferences.
p3n1cillin commented 2026-10-13 18:49:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T18:49:09Z.


Follow-up to my Dead Cells comment above: with the same build (main + this PR + #4777, the 48-byte 0x40001300 filter param treated as a no-op, custom sampler VoiceGetState answered for size 48, and the rotated Geom listener accepted), PPSA15552 reaches its title screen with audio playing, checked by eye on Windows. So these are the only NGS2 gaps between boot and the title screen.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152756528 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152756528). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T18:49:09Z. --- Follow-up to my Dead Cells comment above: with the same build (main + this PR + #4777, the 48-byte `0x40001300` filter param treated as a no-op, custom sampler `VoiceGetState` answered for size 48, and the rotated Geom listener accepted), PPSA15552 reaches its title screen with audio playing, checked by eye on Windows. So these are the only NGS2 gaps between boot and the title screen.
MarcZX10 commented 2026-10-13 18:49:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T18:49:24Z.


Thanks for the on-title run and the exact 12-word payload; that is much stronger evidence than the public headers. Your results confirm the ordering I was asking for: #4417 first, then #4777 while preserving the custom-sampler destination rejection. I have updated #4254 and #4777 to depend on #4417.

I also need to correct my earlier #4254 comment: prosper's source labels 0x40001300 as MatrixLevels, but your PS5 trace shows a 48-byte payload with 9 at +0x10 and the frequency/Q/level-looking values starting at +0x14. So that source is a conflicting interpretation, not evidence of the console ABI. The 40-byte shadPS4 layout does not fit this observed call. I agree the custom filter path remains unresolved until the 48-byte layout and type 9 are identified; I won't claim the current PR handles this title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152760880 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6152760880). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T18:49:24Z. --- Thanks for the on-title run and the exact 12-word payload; that is much stronger evidence than the public headers. Your results confirm the ordering I was asking for: #4417 first, then #4777 while preserving the custom-sampler destination rejection. I have updated #4254 and #4777 to depend on #4417. I also need to correct my earlier #4254 comment: prosper's source labels `0x40001300` as MatrixLevels, but your PS5 trace shows a 48-byte payload with `9` at `+0x10` and the frequency/Q/level-looking values starting at `+0x14`. So that source is a conflicting interpretation, not evidence of the console ABI. The 40-byte shadPS4 layout does not fit this observed call. I agree the custom filter path remains unresolved until the 48-byte layout and type 9 are identified; I won't claim the current PR handles this title.
oneandonlydean commented 2026-10-13 19:55:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T19:55:17Z.


Rebased onto main (dacd78525) and pushed here, keeping your three commits as they were. Two commits on top:

  • ours restores docs/dev/TechnicalDebt.md, which the earlier rebase deleted (on main it is now the index that points into docs/dev/debt/), and adds the missing final newline to docs/dev/debt/libSceNgs2.native.md;
  • MarcZX100's 64110c4fd from #4254: ngs2_custom aborted with voice port 0 is out of range under main's port checks, so the test rack now declares max_ports and max_matrices.

Merging on a green full build. The 48-byte type-9 filter call traced on the title still throws here; that is the follow-up in #4254.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153956865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4417#issuecomment-6153956865). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T19:55:17Z. --- Rebased onto main (dacd78525) and pushed here, keeping your three commits as they were. Two commits on top: - ours restores `docs/dev/TechnicalDebt.md`, which the earlier rebase deleted (on main it is now the index that points into `docs/dev/debt/`), and adds the missing final newline to `docs/dev/debt/libSceNgs2.native.md`; - MarcZX100's `64110c4fd` from #4254: `ngs2_custom` aborted with `voice port 0 is out of range` under main's port checks, so the test rack now declares `max_ports` and `max_matrices`. Merging on a green full build. The 48-byte type-9 filter call traced on the title still throws here; that is the follow-up in #4254.
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!4417
No description provided.