libSceNgs2: Dead Cells (PPSA15552) crashes at startup — 'NGS2: rack id 0x4001 is not implemented' #4334

Closed
opened 2026-10-12 06:55:34 +00:00 by KingDarkHN · 3 comments
KingDarkHN commented 2026-10-12 06:55:34 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by KingDarkHN on 2026-10-12T06:55:34Z.


Game: Dead Cells 01.005 (PPSA15552)
Host: Linux (Hyprland/Wayland), AnyPS5 @ main 2ccbd376
Vulkan: swapchain created 1536x864

Steps to reproduce:

  1. Relink with relinker source/input.elf app.elf (input: eboot.bin.esbak + sce_module/libc.prx)
  2. Copy build/core/libs/libs/*.prx to libs/, game resources to app0/
  3. Run ./app.elf

Result: Vulkan device and swapchain initialize, 1192 shaders load, then the process aborts:

[libc] unhandled exception 'St13runtime_error' thrown from 0x7d6d054cfab5
terminate called after throwing an instance of 'std::runtime_error'
  what():  NGS2: rack id 0x4001 is not implemented
bash: line 1: 40008 Aborted (core dumped) ./app.elf

Source location: core/libs/prx/libSceNgs2.native/src/Rack.cpp:30 (RackOptionSize switch default).

Currently implemented rack ids:

SCE_NGS2_RACK_ID_SAMPLER        = 0x1000
SCE_NGS2_RACK_ID_SUBMIXER       = 0x2000
SCE_NGS2_RACK_ID_REVERB         = 0x2001
SCE_NGS2_RACK_ID_MASTERING      = 0x3000
SCE_NGS2_RACK_ID_CUSTOM_SUBMIXER= 0x4002

Dead Cells requests rack id 0x4001, which is not handled, so the title exits during startup (audio rack creation).

Full startup log:

[libc] unhandled exception 'St13runtime_error' thrown from 0x7d6d054cfab5
terminate called after throwing an instance of 'std::runtime_error'
  what():  NGS2: rack id 0x4001 is not implemented
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5809632677 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4334). Originally posted by [KingDarkHN](https://github.com/KingDarkHN) on 2026-10-12T06:55:34Z. --- Game: Dead Cells 01.005 (PPSA15552) Host: Linux (Hyprland/Wayland), AnyPS5 @ main 2ccbd376 Vulkan: swapchain created 1536x864 Steps to reproduce: 1. Relink with `relinker source/input.elf app.elf` (input: eboot.bin.esbak + sce_module/libc.prx) 2. Copy `build/core/libs/libs/*.prx` to `libs/`, game resources to `app0/` 3. Run `./app.elf` Result: Vulkan device and swapchain initialize, 1192 shaders load, then the process aborts: ``` [libc] unhandled exception 'St13runtime_error' thrown from 0x7d6d054cfab5 terminate called after throwing an instance of 'std::runtime_error' what(): NGS2: rack id 0x4001 is not implemented bash: line 1: 40008 Aborted (core dumped) ./app.elf ``` Source location: `core/libs/prx/libSceNgs2.native/src/Rack.cpp:30` (`RackOptionSize` switch default). Currently implemented rack ids: ``` SCE_NGS2_RACK_ID_SAMPLER = 0x1000 SCE_NGS2_RACK_ID_SUBMIXER = 0x2000 SCE_NGS2_RACK_ID_REVERB = 0x2001 SCE_NGS2_RACK_ID_MASTERING = 0x3000 SCE_NGS2_RACK_ID_CUSTOM_SUBMIXER= 0x4002 ``` Dead Cells requests rack id **0x4001**, which is not handled, so the title exits during startup (audio rack creation). Full startup log: ``` [libc] unhandled exception 'St13runtime_error' thrown from 0x7d6d054cfab5 terminate called after throwing an instance of 'std::runtime_error' what(): NGS2: rack id 0x4001 is not implemented ```
Jnbla6 commented 2026-10-12 10:43:56 +00:00 (Migrated from github.com)
Author
Contributor

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


I implemented a fix for the crash caused by missing NGS2 custom sampler rack support.

Root cause

During startup, rack ID 0x4001 (SCE_NGS2_RACK_ID_CUSTOM_SAMPLER). Since RackOptionSize() did not recognize this ID, the buffer-size query failed with NGS2: rack id 0x4001 is not implemented, causing the game to abort.

Fix

I implemented custom sampler rack support in commit faf788e98 on branch fix/ngs2-rack-4001.

The changes include:

  • Adding rack ID 0x4001, sampler voice parameter IDs, and the 1304-byte Ngs2CustomSamplerRackOption layout.
  • Updating rack option sizing and validation, initializing UserFx2 modules, and reporting the channel-work limit.
  • Handling sampler setup, waveform blocks, pitch, and loop-exit parameters through the existing sampler controls.
  • Reusing the standard sampler rendering path rather than introducing a separate renderer.
  • Supporting UserFx2 parameter updates for both custom rack types, 0x4001 and 0x4002.

I also added a permanent TestCustomSampler() regression test covering rack buffer-size queries and creation, rack info, PCM waveform setup, pitch and loop controls, and rendering through a UserFx2 module chain.

Verification

The following checks passed:

  • Repository conventions check
  • Dependency-light CTest suite: 128 tests
  • Python tool tests: 184 tests
  • C++20 syntax check of the modified NGS2 sources and test

I can’t open a PR myself, so I’m sharing the commit here for review and carry. Could a maintainer review the rack layout, parameter handling, and rendering integration, run the dedicated test in CI, and carry the change into the upstream repository if everything looks good?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6122680228 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4334#issuecomment-6122680228). Originally posted by [Jnbla6](https://github.com/Jnbla6) on 2026-10-12T10:43:56Z. --- I implemented a fix for the crash caused by missing NGS2 custom sampler rack support. ### Root cause During startup, rack ID `0x4001` (`SCE_NGS2_RACK_ID_CUSTOM_SAMPLER`). Since `RackOptionSize()` did not recognize this ID, the buffer-size query failed with `NGS2: rack id 0x4001 is not implemented`, causing the game to abort. ### Fix I implemented custom sampler rack support in commit [`faf788e98`](https://github.com/Jnbla6/AnyPS5/commit/faf788e98) on branch `fix/ngs2-rack-4001`. The changes include: - Adding rack ID `0x4001`, sampler voice parameter IDs, and the 1304-byte `Ngs2CustomSamplerRackOption` layout. - Updating rack option sizing and validation, initializing UserFx2 modules, and reporting the channel-work limit. - Handling sampler setup, waveform blocks, pitch, and loop-exit parameters through the existing sampler controls. - Reusing the standard sampler rendering path rather than introducing a separate renderer. - Supporting UserFx2 parameter updates for both custom rack types, `0x4001` and `0x4002`. I also added a permanent `TestCustomSampler()` regression test covering rack buffer-size queries and creation, rack info, PCM waveform setup, pitch and loop controls, and rendering through a UserFx2 module chain. ### Verification The following checks passed: - Repository conventions check - Dependency-light CTest suite: 128 tests - Python tool tests: 184 tests - C++20 syntax check of the modified NGS2 sources and test I can’t open a PR myself, so I’m sharing the commit here for review and carry. Could a maintainer review the rack layout, parameter handling, and rendering integration, run the dedicated test in CI, and carry the change into the upstream repository if everything looks good?
KingDarkHN commented 2026-10-12 13:19:48 +00:00 (Migrated from github.com)
Author
Contributor

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


AnyPS5 — Dead Cells (PPSA15552) on libSceNgs2: status and patch

Result

Dead Cells boots and no longer aborts on NGS2. With the patch applied the game runs at a stable ~60 fps (59.94 per the window-title counter) for 4+ minutes with no crash. The only remaining blocker was patching a voice to a rack handle, which this work resolves in Patch().

Background (chain of errors fixed)

  1. NGS2: rack id 0x4001 is not implemented (Rack.cpp) → addressed by PR #3793 (custom sampler + custom mastering racks).
  2. NGS2: custom module id 0x13 is not implemented (Custom.cpp) → addressed by #3793 (accepts and skips built-in modules; logs [NGS2] built-in custom module 0x13 is not emulated).
  3. sceNgs2GeomCalcListener not implemented → addressed by PR #1021 (Geom family, 4 functions).
  4. Patch: invalid argument → remaining blocker, resolved here.

The final blocker

  • voice patched with dest_handle = a rack handle (not a voice): the game routes the custom sampler rack 0x4001 voices (and the submixer rack 0x2000) into the mastering rack 0x3000 handle.
  • Ngs2FindVoice() does not resolve rack handles → dest == nullptr → APS5_INVALID_ARG_EX in Voice.cpp (~line 113).

Changes applied

Cherry-picks from upstream (existing PRs)

Commit Source Content
2f89a01aa PR #3793 (7da823449ff2f80a4c0e583f7d0c0f56474dcdb8) custom sampler + custom mastering racks; accepts/skips built-in modules
917e0ec52 PR #1021 (941344f04c31a7256435fa3abfd76287d5599e79) Geom family

Our own fix

Commit d713835f7 — core/libs/prx/libSceNgs2.native/src/Voice.cpp, Patch():

  • If dest_handle is not a voice, try to resolve it as a rack (Ngs2FindRack()).
  • If it is a non-sampler rack with voices, route to its bus voice (rack->voices.front()), preserving the system check and the sampler-rack rejection (samplers do not accept inputs).
  • The rejection of dest_input_id != 0 is kept.
  • Logging is deduplicated per (srcRack → dstRack) pair.
static void Patch(Ngs2Voice& voice, const Ngs2VoicePatchParam& patch) {
    auto& port = PortAt(voice, patch.port);
    if (patch.dest_handle == 0) {
        if (patch.dest_input_id != 0) throw std::runtime_error("NGS2: voice input " + std::to_string(patch.dest_input_id) + " is not implemented");
        port.dest = nullptr;
        return;
    }
    auto* dest = Ngs2FindVoice(patch.dest_handle);
    if (dest == nullptr) {
        if (auto* rack = Ngs2FindRack(patch.dest_handle); rack != nullptr) {
            if (rack->kind != SCE_NGS2_RACK_ID_SAMPLER && !rack->voices.empty()) dest = &rack->voices.front();
        }
    }
    if (dest == nullptr || dest->rack->system != voice.rack->system || dest->rack->kind == SCE_NGS2_RACK_ID_SAMPLER) APS5_INVALID_ARG_EX;
    port.dest = dest;
}

Run evidence

[NGS2] built-in custom module 0x13 is not emulated
[NGS2] patch srcRack=16385 port=0 dst=0x2001de700 is rack id=0x3000 kind=0x3000 voices=1 input=0   (0x4001 -> 0x3000)
[NGS2] patch srcRack=8193  port=0 dst=0x2001de700 is rack id=0x3000 kind=0x3000 voices=1 input=0   (0x2000 -> 0x3000)
[NGS2] control 0x40001300 of a built-in custom module is ignored
  • 0x4001 = custom sampler, 0x2000 = submixer, 0x3000 = mastering.
  • After the patch: no NGS2 exceptions; runs of 90 s, 240 s and 600 s stopped only by timeout (no abort). Stable ~59.94 fps.

Remaining / proposal for upstream

  • Implement dest_input_id != 0 (routing by rack input index) for titles using multiple inputs.
  • Confirm the exact hardware semantics: pick the proper bus voice of the destination rack (currently voices.front()).
  • Optional: add automated tests for Patch() with a rack destination.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125105483 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4334#issuecomment-6125105483). Originally posted by [KingDarkHN](https://github.com/KingDarkHN) on 2026-10-12T13:19:48Z. --- # AnyPS5 — Dead Cells (PPSA15552) on libSceNgs2: status and patch ## Result Dead Cells boots and **no longer aborts on NGS2**. With the patch applied the game **runs at a stable ~60 fps** (59.94 per the window-title counter) for 4+ minutes with no crash. The only remaining blocker was patching a voice to a **rack handle**, which this work resolves in `Patch()`. ## Background (chain of errors fixed) 1. `NGS2: rack id 0x4001 is not implemented` (`Rack.cpp`) → addressed by PR **#3793** (custom sampler + custom mastering racks). 2. `NGS2: custom module id 0x13 is not implemented` (`Custom.cpp`) → addressed by #3793 (accepts and skips built-in modules; logs `[NGS2] built-in custom module 0x13 is not emulated`). 3. `sceNgs2GeomCalcListener not implemented` → addressed by PR **#1021** (Geom family, 4 functions). 4. `Patch: invalid argument` → **remaining blocker**, resolved here. ## The final blocker - `voice` patched with `dest_handle` = a **rack** handle (not a voice): the game routes the custom sampler rack `0x4001` voices (and the submixer rack `0x2000`) into the **mastering rack `0x3000`** handle. - `Ngs2FindVoice()` does not resolve rack handles → `dest == nullptr` → `APS5_INVALID_ARG_EX` in `Voice.cpp` (~line 113). ## Changes applied ### Cherry-picks from upstream (existing PRs) | Commit | Source | Content | |---|---|---| | `2f89a01aa` | PR #3793 (`7da823449ff2f80a4c0e583f7d0c0f56474dcdb8`) | custom sampler + custom mastering racks; accepts/skips built-in modules | | `917e0ec52` | PR #1021 (`941344f04c31a7256435fa3abfd76287d5599e79`) | Geom family | ### Our own fix Commit `d713835f7` — `core/libs/prx/libSceNgs2.native/src/Voice.cpp`, `Patch()`: - If `dest_handle` is not a voice, try to resolve it as a **rack** (`Ngs2FindRack()`). - If it is a non-sampler rack with voices, route to its bus voice (`rack->voices.front()`), preserving the `system` check and the sampler-rack rejection (samplers do not accept inputs). - The rejection of `dest_input_id != 0` is kept. - Logging is deduplicated per (srcRack → dstRack) pair. ```cpp static void Patch(Ngs2Voice& voice, const Ngs2VoicePatchParam& patch) { auto& port = PortAt(voice, patch.port); if (patch.dest_handle == 0) { if (patch.dest_input_id != 0) throw std::runtime_error("NGS2: voice input " + std::to_string(patch.dest_input_id) + " is not implemented"); port.dest = nullptr; return; } auto* dest = Ngs2FindVoice(patch.dest_handle); if (dest == nullptr) { if (auto* rack = Ngs2FindRack(patch.dest_handle); rack != nullptr) { if (rack->kind != SCE_NGS2_RACK_ID_SAMPLER && !rack->voices.empty()) dest = &rack->voices.front(); } } if (dest == nullptr || dest->rack->system != voice.rack->system || dest->rack->kind == SCE_NGS2_RACK_ID_SAMPLER) APS5_INVALID_ARG_EX; port.dest = dest; } ``` ## Run evidence ``` [NGS2] built-in custom module 0x13 is not emulated [NGS2] patch srcRack=16385 port=0 dst=0x2001de700 is rack id=0x3000 kind=0x3000 voices=1 input=0 (0x4001 -> 0x3000) [NGS2] patch srcRack=8193 port=0 dst=0x2001de700 is rack id=0x3000 kind=0x3000 voices=1 input=0 (0x2000 -> 0x3000) [NGS2] control 0x40001300 of a built-in custom module is ignored ``` - `0x4001` = custom sampler, `0x2000` = submixer, `0x3000` = mastering. - After the patch: no NGS2 exceptions; runs of 90 s, 240 s and 600 s stopped only by timeout (no abort). Stable ~59.94 fps. ## Remaining / proposal for upstream - Implement `dest_input_id != 0` (routing by rack input index) for titles using multiple inputs. - Confirm the exact hardware semantics: pick the proper bus voice of the destination rack (currently `voices.front()`). - Optional: add automated tests for `Patch()` with a rack destination.
oneandonlydean commented 2026-10-13 02:08:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:08:24Z.


Closing: duplicate of #3553, same title and same stop (NGS2: rack id 0x4001 is not implemented). The open PRs for it are #3793, #4254 and #4417; the listener stop that followed is fixed by #4598.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136626386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4334#issuecomment-6136626386). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T02:08:24Z. --- Closing: duplicate of #3553, same title and same stop (`NGS2: rack id 0x4001 is not implemented`). The open PRs for it are #3793, #4254 and #4417; the listener stop that followed is fixed by #4598.
Sign in to join this conversation.
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#4334
No description provided.