fix(libSceNgs2): implement a minimal sceNgs2GeomApply pass-through #5974

Merged
mohammad-alosta merged 2 commits from upstream-pr/5974 into main 2026-10-16 22:52:38 +00:00
mohammad-alosta commented 2026-10-14 17:40:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mohammad-alosta on 2026-10-14T17:40:58Z.


What

sceNgs2GeomApply was an unimplemented throwing stub (NotImplemented_nid_no_patch) and was blocking Dead Cells (PPSA15552), where the missing function surfaced as:
terminate called after throwing an instance of 'std::runtime_error' what(): sceNgs2GeomApply not implemented Aborted

This change implements a minimal pass-through in Geom.cpp under default visibility. It validates null listener/source/output arguments, clears the output attribute, and returns:

  • pitch_ratio = 1.0f
  • a3d_attrib.position from the source position
  • a3d_attrib.volume as max(min_level, max_level)
  • diagonal level entries set to max_level, or 1.0f when max_level <= 0.0f

It handles the source channel count through matrix_format, capped at 8, with matrix format 0 treated as two channels. It does not implement source attenuation, distance rolloff, panning or Doppler, matching the existing technical debt status.

Unimplemented.cpp no longer defines the stub.

Tested

  • Linux
  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
  • cmake --build build --target ngs2_geom_tests libs
  • ctest --test-dir build -R '^ngs2_geom$' --output-on-failure
  • Result: ngs2_geom passed (100% tests passed, 0 failures)
  • Patched library check: nm -D build/core/libs/libs/libSceNgs2.native.prx shows eF8yRCC6W64
  • Runtime check: patched library rebuilt and symbol available for the game.
  • Real title check: Dead Cells progressed past sceNgs2GeomApply not implemented.

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: #5810 #5898
  • Unblocks: PPSA15552
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4861967792 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974). Originally posted by [mohammad-alosta](https://github.com/mohammad-alosta) on 2026-10-14T17:40:58Z. --- ### What `sceNgs2GeomApply` was an unimplemented throwing stub (`NotImplemented_nid_no_patch`) and was blocking Dead Cells (PPSA15552), where the missing function surfaced as: terminate called after throwing an instance of 'std::runtime_error' what(): sceNgs2GeomApply not implemented Aborted This change implements a minimal pass-through in `Geom.cpp` under default visibility. It validates null listener/source/output arguments, clears the output attribute, and returns: - `pitch_ratio = 1.0f` - `a3d_attrib.position` from the source position - `a3d_attrib.volume` as `max(min_level, max_level)` - diagonal level entries set to `max_level`, or `1.0f` when `max_level <= 0.0f` It handles the source channel count through `matrix_format`, capped at 8, with matrix format 0 treated as two channels. It does not implement source attenuation, distance rolloff, panning or Doppler, matching the existing technical debt status. `Unimplemented.cpp` no longer defines the stub. ### Tested - Linux - `cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON` - `cmake --build build --target ngs2_geom_tests libs` - `ctest --test-dir build -R '^ngs2_geom$' --output-on-failure` - Result: `ngs2_geom` passed (`100% tests passed, 0 failures`) - Patched library check: `nm -D build/core/libs/libs/libSceNgs2.native.prx` shows `eF8yRCC6W64` - Runtime check: patched library rebuilt and symbol available for the game. - Real title check: Dead Cells progressed past `sceNgs2GeomApply not implemented`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #5810 #5898 - [x] Unblocks: PPSA15552 - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-14 17:41:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T17:41:46Z.


Progress report (ea4cc11 → 0129876)

📈 System libraries: 89.02% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceNgs2.native sceNgs2GeomApply
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174545961 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6174545961). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T17:41:46Z. --- <!-- progress-report --> ### Progress report (ea4cc11 → 0129876) 📈 **System libraries**: 89.02% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceNgs2.native | `sceNgs2GeomApply` | </details>
fma-rc commented 2026-10-14 18:49:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-14T18:49:42Z.


The library already has a place for this. sceNgs2GeomCalcListener, sceNgs2GeomResetListenerParam and sceNgs2GeomResetSourceParam are one-line wrappers inside the existing visibility push(default) block in Voice.cpp (around line 513), and their bodies live in Geom.cpp as Ngs2GeomCalcListener and friends, declared in Ngs2Internal.hpp. Putting the body in Geom.cpp as Ngs2GeomApply with a wrapper next to those three needs no new pragma, passes check_conventions.py (it only looks at added lines), and leaves Unimplemented.cpp for stubs.

Separately, the maintainers have asked for exact behaviour or a throw. The levels written here (the larger of min and max level as volume, max level on the diagonal, matrix format 0 treated as two channels) aren't from the PS5 library or a title capture, so a reviewer will likely ask where they come from. A test in tests/Ngs2Geom.cpp that fails without the change would also help.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175823644 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6175823644). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-14T18:49:42Z. --- The library already has a place for this. `sceNgs2GeomCalcListener`, `sceNgs2GeomResetListenerParam` and `sceNgs2GeomResetSourceParam` are one-line wrappers inside the existing `visibility push(default)` block in `Voice.cpp` (around line 513), and their bodies live in `Geom.cpp` as `Ngs2GeomCalcListener` and friends, declared in `Ngs2Internal.hpp`. Putting the body in `Geom.cpp` as `Ngs2GeomApply` with a wrapper next to those three needs no new pragma, passes `check_conventions.py` (it only looks at added lines), and leaves `Unimplemented.cpp` for stubs. Separately, the maintainers have asked for exact behaviour or a throw. The levels written here (the larger of min and max level as volume, max level on the diagonal, matrix format 0 treated as two channels) aren't from the PS5 library or a title capture, so a reviewer will likely ask where they come from. A test in `tests/Ngs2Geom.cpp` that fails without the change would also help.
mohammad-alosta commented 2026-10-14 19:16:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mohammad-alosta on 2026-10-14T19:16:58Z.


Done: the implementation now follows the existing layout.

  • Ngs2GeomApply is implemented in Geom.cpp
  • sceNgs2GeomApply is a one-line wrapper in the existing visibility push(default) block next to sceNgs2GeomResetListenerParam / sceNgs2GeomCalcListener
  • Unimplemented.cpp no longer defines the stub
  • Ngs2GeomApply is declared in Ngs2Internal.hpp
  • tests/Ngs2Geom.cpp now has a test that fails without the change

On the behavior question: the returned values are intentionally a minimal, documented pass-through rather than PS5-measured geometry, because sceNgs2GeomApply is documented as unsupported/source-attenuation still unimplemented. They match the KytyPS5-style baseline that was used for the earlier listener matrix: identity channel gain, pitch 1.0, source position/volume, and matrix format 0 treated as two channels. The debt note was updated to say this is a minimal pass-through and not exact console behaviour; full distance rolloff, panning and Doppler remain unimplemented. A test now checks the accepted null/error paths and the current output shape.

If you prefer this case to throw until a console-captured result exists instead of using this pass-through, I can change it to that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176355675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6176355675). Originally posted by [mohammad-alosta](https://github.com/mohammad-alosta) on 2026-10-14T19:16:58Z. --- Done: the implementation now follows the existing layout. - `Ngs2GeomApply` is implemented in `Geom.cpp` - `sceNgs2GeomApply` is a one-line wrapper in the existing `visibility push(default)` block next to `sceNgs2GeomResetListenerParam` / `sceNgs2GeomCalcListener` - `Unimplemented.cpp` no longer defines the stub - `Ngs2GeomApply` is declared in `Ngs2Internal.hpp` - `tests/Ngs2Geom.cpp` now has a test that fails without the change On the behavior question: the returned values are intentionally a minimal, documented pass-through rather than PS5-measured geometry, because `sceNgs2GeomApply` is documented as unsupported/source-attenuation still unimplemented. They match the KytyPS5-style baseline that was used for the earlier listener matrix: identity channel gain, pitch 1.0, source position/volume, and matrix format 0 treated as two channels. The debt note was updated to say this is a minimal pass-through and not exact console behaviour; full distance rolloff, panning and Doppler remain unimplemented. A test now checks the accepted null/error paths and the current output shape. If you prefer this case to throw until a console-captured result exists instead of using this pass-through, I can change it to that.
github-actions[bot] commented 2026-10-15 12:12:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:12:35Z.


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
PR 6447 sceNgs2GeomApply
PR 6680 sceNgs2GeomApply

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1384 core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
PR 5797 core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
docs/dev/debt/libSceNgs2.native.md
PR 6447 core/libs/prx/libSceNgs2.native/src/Geom.cpp
core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Unimplemented.cpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Test.hpp
docs/dev/debt/libSceNgs2.native.md
PR 6594 core/libs/prx/libSceNgs2.native/src/Geom.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp
docs/dev/debt/libSceNgs2.native.md
PR 6680 core/libs/prx/libSceNgs2.native/src/Geom.cpp
core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp
core/libs/prx/libSceNgs2.native/src/Unimplemented.cpp
core/libs/prx/libSceNgs2.native/src/Voice.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp
core/libs/prx/libSceNgs2.native/tests/Ngs2Test.hpp
docs/dev/debt/libSceNgs2.native.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191757069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6191757069). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:12:35Z. --- <!-- 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 | |---|---|---|---| | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | | `sceNgs2GeomApply` | | | [PR 6680](https://www.github.com/boykopovar/AnyPS5/pull/6680) | | `sceNgs2GeomApply` | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1384](https://www.github.com/boykopovar/AnyPS5/pull/1384) | `core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp`<br>`core/libs/prx/libSceNgs2.native/src/Voice.cpp` | | [PR 5797](https://www.github.com/boykopovar/AnyPS5/pull/5797) | `core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp`<br>`core/libs/prx/libSceNgs2.native/src/Voice.cpp`<br>`docs/dev/debt/libSceNgs2.native.md` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libSceNgs2.native/src/Geom.cpp`<br>`core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp`<br>`core/libs/prx/libSceNgs2.native/src/Unimplemented.cpp`<br>`core/libs/prx/libSceNgs2.native/src/Voice.cpp`<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp`<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Test.hpp`<br>`docs/dev/debt/libSceNgs2.native.md` | | [PR 6594](https://www.github.com/boykopovar/AnyPS5/pull/6594) | `core/libs/prx/libSceNgs2.native/src/Geom.cpp`<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp`<br>`docs/dev/debt/libSceNgs2.native.md` | | [PR 6680](https://www.github.com/boykopovar/AnyPS5/pull/6680) | `core/libs/prx/libSceNgs2.native/src/Geom.cpp`<br>`core/libs/prx/libSceNgs2.native/src/Ngs2Internal.hpp`<br>`core/libs/prx/libSceNgs2.native/src/Unimplemented.cpp`<br>`core/libs/prx/libSceNgs2.native/src/Voice.cpp`<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cpp`<br>`core/libs/prx/libSceNgs2.native/tests/Ngs2Test.hpp`<br>`docs/dev/debt/libSceNgs2.native.md` |
notaxeltv commented 2026-10-15 20:38:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-15T20:38:09Z.


Verified needed for PPSA15552 (Dead Cells) after #5898 + current main (#5810): the title stops on sceNgs2GeomApply not implemented. Stacking this should be the next unblock after filter type 0.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6201786468 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6201786468). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-15T20:38:09Z. --- Verified needed for PPSA15552 (Dead Cells) after #5898 + current main (#5810): the title stops on `sceNgs2GeomApply not implemented`. Stacking this should be the next unblock after filter type 0.
notaxeltv commented 2026-10-15 20:56:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-15T20:56:23Z.


Follow-up after stacking #5898 + this on current main (#5810): PPSA15552 reaches Unit: invalid argument inside sceNgs2GeomCalcListener (zero or parallel orient_front/orient_up). That matches the existing reject tests / PS5PCEM InvalidOrientation; not claiming a console error code yet — leaving it for a separate measured fix rather than folding into this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202104290 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6202104290). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-15T20:56:23Z. --- Follow-up after stacking #5898 + this on current main (#5810): PPSA15552 reaches `Unit: invalid argument` inside `sceNgs2GeomCalcListener` (zero or parallel `orient_front`/`orient_up`). That matches the existing reject tests / PS5PCEM `InvalidOrientation`; not claiming a console error code yet — leaving it for a separate measured fix rather than folding into this PR.
notaxeltv commented 2026-10-15 21:08:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-15T21:08:33Z.


Confirmed after stacking #5898 + this on current main: PPSA15552 reaches Unit: invalid argument in sceNgs2GeomCalcListener. Captured guest args: orient_front={0,0,1} orient_up={0,-0,1} flags=0 — parallel front/up so the right-axis cross product is zero. Matches existing reject tests / PS5PCEM InvalidOrientation; still no console error-code measurement, so not folding a soft fallback into this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202314055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6202314055). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-15T21:08:33Z. --- Confirmed after stacking #5898 + this on current main: PPSA15552 reaches `Unit: invalid argument` in `sceNgs2GeomCalcListener`. Captured guest args: `orient_front={0,0,1}` `orient_up={0,-0,1}` `flags=0` — parallel front/up so the right-axis cross product is zero. Matches existing reject tests / PS5PCEM `InvalidOrientation`; still no console error-code measurement, so not folding a soft fallback into this PR.
mohammad-alosta commented 2026-10-15 22:46:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mohammad-alosta on 2026-10-15T22:46:46Z.


Rebased onto current main. Tests and convention checks still pass.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6203858376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6203858376). Originally posted by [mohammad-alosta](https://github.com/mohammad-alosta) on 2026-10-15T22:46:46Z. --- Rebased onto current main. Tests and convention checks still pass. AI-assisted: yes
adriadam10 commented 2026-10-16 19:45:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T19:45:24Z.


Checked against KytyPS5's Ngs2GeomApply (same pitch, position, volume and per-channel diagonal; shadPS4 stubs it): matches. ngs2_geom fails without the change and the 9 Ngs2 tests pass on the rebased tree.

Added one commit on your branch: the sceNgs2GeomApply line in docs/dev/debt/libSceNgs2.native.md now names KytyPS5 as the only source, says the listener and flags are ignored, and that it is unmeasured on a PS5.

Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223384735 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6223384735). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T19:45:24Z. --- Checked against KytyPS5's `Ngs2GeomApply` (same pitch, position, volume and per-channel diagonal; shadPS4 stubs it): matches. `ngs2_geom` fails without the change and the 9 Ngs2 tests pass on the rebased tree. Added one commit on your branch: the `sceNgs2GeomApply` line in `docs/dev/debt/libSceNgs2.native.md` now names KytyPS5 as the only source, says the listener and `flags` are ignored, and that it is unmeasured on a PS5. Merging.
adriadam10 commented 2026-10-16 20:01:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:01:54Z.


Rebased onto current main (only conflict: the custom sampler rack line in docs/dev/debt/libSceNgs2.native.md; kept main's text). Diff unchanged, the 10 Ngs2 tests pass on the rebased tree.

Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223649272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5974#issuecomment-6223649272). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T20:01:54Z. --- Rebased onto current `main` (only conflict: the custom sampler rack line in `docs/dev/debt/libSceNgs2.native.md`; kept main's text). Diff unchanged, the 10 Ngs2 tests pass on the rebased tree. Merging.
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!5974
No description provided.