feat(libSceNgs2.native): keep a registry of report handlers #6680

Merged
011010 merged 1 commit from upstream-pr/6680 into main 2026-10-19 23:50:59 +00:00
011010 commented 2026-10-16 04:17:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-16T04:17:29Z.


What

sceNgs2ReportRegisterHandler and sceNgs2ReportUnregisterHandler stop being throwing stubs and keep a registry of report handlers, so a title that imports them can register a handler and later drop it.

  • Register rejects a null handler with an invalid argument and returns INVALID_OUT_ADDRESS for a null out handle, then stores the report type, the handler and the user data under a freshly allocated opaque handle.
  • Unregister removes and frees the matching record, and throws for a handle that is not registered.
  • The signatures (report type, handler, user data, out handle) and (report handle) follow SharpProspero and shadPS4's ngs2_report.h, and the 24-byte Ngs2ReportDataHeader passed to a handler is its OrbisNgs2ReportDataHeader.
  • No report is produced yet, so no registered handler is ever invoked. PPSA04540 imports both and registers a CPU load handler (type 5), and still receives none.

The two stubs in src/Unimplemented.cpp are gone and the file is removed from the library.

This pull request now carries only the report-handler registry. The sceNgs2GeomApply implementation and its geometry fixtures were dropped, so main's pass-through from #5974 stands untouched; main's sceNgs2GeomApply debt row is left as it is and only the report entries are touched here.

Tested

Linux (Ubuntu 24.04.5, x86-64, GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), on this branch rebased onto current main:

  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON, then the build of the NGS2 test binaries. Configure and build both return 0.
  • ctest --test-dir build -R "^ngs2" --output-on-failure → 13/13 passed, including ngs2_report and ngs2_geom.
  • python3 tools/check_conventions.py --base origin/main → all conventions checks passed.
  • python3 tools/pr_overlap.py --branch feat/libSceNgs2-geom-report → only this pull request itself.

Not tested on Windows or macOS, and not tested on a PS5 title.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4883408414 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680). Originally posted by [011010](https://github.com/011010) on 2026-10-16T04:17:29Z. --- ### What `sceNgs2ReportRegisterHandler` and `sceNgs2ReportUnregisterHandler` stop being throwing stubs and keep a registry of report handlers, so a title that imports them can register a handler and later drop it. - Register rejects a null handler with an invalid argument and returns `INVALID_OUT_ADDRESS` for a null out handle, then stores the report type, the handler and the user data under a freshly allocated opaque handle. - Unregister removes and frees the matching record, and throws for a handle that is not registered. - The signatures (report type, handler, user data, out handle) and (report handle) follow [SharpProspero](https://github.com/SvenGDK/SharpProspero) and [shadPS4](https://github.com/shadps4-emu/shadPS4)'s `ngs2_report.h`, and the 24-byte `Ngs2ReportDataHeader` passed to a handler is its `OrbisNgs2ReportDataHeader`. - No report is produced yet, so no registered handler is ever invoked. PPSA04540 imports both and registers a CPU load handler (type 5), and still receives none. The two stubs in `src/Unimplemented.cpp` are gone and the file is removed from the library. This pull request now carries only the report-handler registry. The `sceNgs2GeomApply` implementation and its geometry fixtures were dropped, so `main`'s pass-through from #5974 stands untouched; `main`'s `sceNgs2GeomApply` debt row is left as it is and only the report entries are touched here. ### Tested Linux (Ubuntu 24.04.5, x86-64, GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), on this branch rebased onto current `main`: - `cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON`, then the build of the NGS2 test binaries. Configure and build both return 0. - `ctest --test-dir build -R "^ngs2" --output-on-failure` → **13/13 passed**, including `ngs2_report` and `ngs2_geom`. - `python3 tools/check_conventions.py --base origin/main` → all conventions checks passed. - `python3 tools/pr_overlap.py --branch feat/libSceNgs2-geom-report` → only this pull request itself. Not tested on Windows or macOS, and not tested on a PS5 title. ### 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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-16 04:18:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T04:18:14Z.


Progress report (dbac9fa → 6d72ebe)

📈 System libraries: 79.84% (+0.03%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceNgs2.native sceNgs2ReportRegisterHandler
libSceNgs2.native sceNgs2ReportUnregisterHandler
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6207972822 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6207972822). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T04:18:14Z. --- <!-- progress-report --> ### Progress report (dbac9fa → 6d72ebe) 📈 **System libraries**: 79.84% (+0.03%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceNgs2.native | `sceNgs2ReportRegisterHandler` | | libSceNgs2.native | `sceNgs2ReportUnregisterHandler` | </details>
github-actions[bot] commented 2026-10-16 04:35:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T04:35:03Z.


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/Ngs2Library.cmake
core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
core/libs/prx/libSceNgs2.native/src/System.cpp
PR 5797 core/libs/prx/libSceNgs2.native/Ngs2Library.cmake
core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp
docs/dev/debt/libSceNgs2.native.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208163728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6208163728). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T04:35:03Z. --- <!-- pr-overlap --> 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/Ngs2Library.cmake`<br>`core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp`<br>`core/libs/prx/libSceNgs2.native/src/System.cpp` | | [PR 5797](https://www.github.com/boykopovar/AnyPS5/pull/5797) | `core/libs/prx/libSceNgs2.native/Ngs2Library.cmake`<br>`core/libs/prx/libSceNgs2.native/include/Ngs2Types.hpp`<br>`docs/dev/debt/libSceNgs2.native.md` |
jotitadev commented 2026-10-16 04:36:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T04:36:06Z.

Review: COMMENTED


Built and ran the project's own tests for this PR on Linux, since the description says they were not built.

  • Machine: Ubuntu 26.04, x86_64 (i7-8700), GCC 15.2.0, CMake 4.2.3 + Ninja, Release, BUILD_TESTING=ON, full tree.
  • Head: c5c55fa41, on top of main 5d9dcc42d (fast-forward, no merge needed).

Results:

  • Full build: clean, no warnings in libSceNgs2.native. nm -D on the library shows sceNgs2GeomApply, sceNgs2ReportRegisterHandler and sceNgs2ReportUnregisterHandler defined.
  • ctest -R "^ngs2": 10/10 pass, including the extended ngs2_geom and the rewritten ngs2_report.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): 648/650, the same as main 5d9dcc42d. The two failures on both are file_writer_binary and file_writer_text, which fail on this machine's coreutils and are not related to this PR.
  • tools/check_conventions.py: passes.

Check that the new tests catch the missing implementation: on main I applied only this PR's tests/ and include/Ngs2Types.hpp (the header is needed because the tests use Ngs2ReportDataHeader/Ngs2ReportHandler). Both tests then abort on the old stubs:

ngs2_report  Subprocess aborted   what():  sceNgs2ReportRegisterHandler not implemented
ngs2_geom    Subprocess aborted   what():  sceNgs2GeomApply not implemented

With the full PR they pass.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5543120898 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#pullrequestreview-5543120898). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T04:36:06Z. **Review:** COMMENTED --- Built and ran the project's own tests for this PR on Linux, since the description says they were not built. - Machine: Ubuntu 26.04, x86_64 (i7-8700), GCC 15.2.0, CMake 4.2.3 + Ninja, Release, `BUILD_TESTING=ON`, full tree. - Head: `c5c55fa41`, on top of `main` `5d9dcc42d` (fast-forward, no merge needed). Results: - Full build: clean, no warnings in `libSceNgs2.native`. `nm -D` on the library shows `sceNgs2GeomApply`, `sceNgs2ReportRegisterHandler` and `sceNgs2ReportUnregisterHandler` defined. - `ctest -R "^ngs2"`: 10/10 pass, including the extended `ngs2_geom` and the rewritten `ngs2_report`. - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out"`): 648/650, the same as `main` `5d9dcc42d`. The two failures on both are `file_writer_binary` and `file_writer_text`, which fail on this machine's coreutils and are not related to this PR. - `tools/check_conventions.py`: passes. Check that the new tests catch the missing implementation: on `main` I applied only this PR's `tests/` and `include/Ngs2Types.hpp` (the header is needed because the tests use `Ngs2ReportDataHeader`/`Ngs2ReportHandler`). Both tests then abort on the old stubs: ``` ngs2_report Subprocess aborted what(): sceNgs2ReportRegisterHandler not implemented ngs2_geom Subprocess aborted what(): sceNgs2GeomApply not implemented ``` With the full PR they pass. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-16 04:44:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T04:44:36Z.


I checked the overlap against the related open work. This PR implements sceNgs2GeomApply, which is also explicitly part of open PR #5974 (same exported NID, with an alternative minimal pass-through), and PR #6447 also contains a sceNgs2GeomApply implementation inside its broad compatibility batch. The implementation in this PR is materially different from #5974, so the overlap needs an explicit maintainer decision about which behavior is intended; please list the dependency/coordination in the PR body and reconcile the competing export before merge. The checks currently pass for eligibility, conventions, intake and report; platform/build jobs are skipped. A reviewer independently built this PR head and reports ngs2 10/10 passing on Linux, which fills the test gap in the description. I have not run those tests myself.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208270195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6208270195). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T04:44:36Z. --- I checked the overlap against the related open work. This PR implements `sceNgs2GeomApply`, which is also explicitly part of open PR #5974 (same exported NID, with an alternative minimal pass-through), and PR #6447 also contains a `sceNgs2GeomApply` implementation inside its broad compatibility batch. The implementation in this PR is materially different from #5974, so the overlap needs an explicit maintainer decision about which behavior is intended; please list the dependency/coordination in the PR body and reconcile the competing export before merge. The checks currently pass for eligibility, conventions, intake and report; platform/build jobs are skipped. A reviewer independently built this PR head and reports `ngs2` 10/10 passing on Linux, which fills the test gap in the description. I have not run those tests myself.
011010 commented 2026-10-16 05:25:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-16T05:25:16Z.


Thanks for the review, and I've updated the PR body with the overlap. My earlier check only skimmed PR titles, so it missed #5974 and #6447 — both do implement sceNgs2GeomApply.

For reference, the three implementations differ like this:

  • #5974 — minimal pass-through: it copies source.position unchanged and writes volume = max(min_level, max_level) and a diagonal matrix, so it ignores the listener transform, rolloff, cone, Doppler and panning.
  • #6447 — a full implementation, but inside a broad compatibility batch.
  • this PR — a full implementation plus the report handlers; the arithmetic is ported from PS5PCEM's ngs2_geom.zig apply.

While reconciling, I also fixed the flags handling. It was treated as "must be zero" and threw otherwise, which would break a caller passing the default set. It now reads the bit set the way Ngs2GeomApplyFlags names it (source angle 1, Doppler 2, volume matrix 4, A3D attribute 8, ambisonics 16), treats zero as the default (1|2|4|8), and only throws on bits outside 0x1f. That is the same interpretation #6447 uses, so the two now agree on behaviour.

Which one to keep is a maintainer call — I'm fine dropping this PR if #6447 is the preferred home, or moving the report registry out. Also, thanks @jotitadev for building it on Linux and confirming the tests fail without the implementation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208742332 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6208742332). Originally posted by [011010](https://github.com/011010) on 2026-10-16T05:25:16Z. --- Thanks for the review, and I've updated the PR body with the overlap. My earlier check only skimmed PR titles, so it missed #5974 and #6447 — both do implement `sceNgs2GeomApply`. For reference, the three implementations differ like this: - #5974 — minimal pass-through: it copies `source.position` unchanged and writes `volume = max(min_level, max_level)` and a diagonal matrix, so it ignores the listener transform, rolloff, cone, Doppler and panning. - #6447 — a full implementation, but inside a broad compatibility batch. - this PR — a full implementation plus the report handlers; the arithmetic is ported from PS5PCEM's `ngs2_geom.zig` `apply`. While reconciling, I also fixed the `flags` handling. It was treated as "must be zero" and threw otherwise, which would break a caller passing the default set. It now reads the bit set the way `Ngs2GeomApplyFlags` names it (source angle 1, Doppler 2, volume matrix 4, A3D attribute 8, ambisonics 16), treats zero as the default (1|2|4|8), and only throws on bits outside `0x1f`. That is the same interpretation #6447 uses, so the two now agree on behaviour. Which one to keep is a maintainer call — I'm fine dropping this PR if #6447 is the preferred home, or moving the report registry out. Also, thanks @jotitadev for building it on Linux and confirming the tests fail without the implementation.
blawesom commented 2026-10-17 10:56:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T10:56:39Z.


Rebase handoff + one behavior-collision finding — rebased onto current main (authorship unchanged). Resolutions: your geometric Ngs2GeomApply replaces main's simpler version in Geom.cpp; the auto-merge had duplicated the Voice.cpp ABI wrapper (removed); your report-handler declarations and geometric tests are layered onto main's newer test suite.

The finding: main added TestGeomApply to Ngs2Geom.cpp after your branch point, asserting the old stub's level-matrix outputs (level[18] == 0.5f etc. for a diagonal fill). Your geometric implementation produces different gains for that fixture, so that one test fails (ngs2_geom aborts at its line 163) — your own TestApplyStereo/TestApplySurround/TestApplyDistanceConeDoppler all pass. The test's expectations need reconciling with the new geometry (yours to update or argue for, since main wrote them deliberately). Everything else passes (1337/1339: this plus the known main regression agc_driver_tessellation, #4727); conventions are green.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6680
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 2a3d761b7 (amended to complete the second commit and clean the debt-entry merge).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233079039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6233079039). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T10:56:39Z. --- **Rebase handoff + one behavior-collision finding** — rebased onto current `main` (authorship unchanged). Resolutions: your geometric `Ngs2GeomApply` replaces `main`'s simpler version in `Geom.cpp`; the auto-merge had duplicated the `Voice.cpp` ABI wrapper (removed); your report-handler declarations and geometric tests are layered onto `main`'s newer test suite. **The finding:** `main` added `TestGeomApply` to `Ngs2Geom.cpp` after your branch point, asserting the **old stub's** level-matrix outputs (`level[18] == 0.5f` etc. for a diagonal fill). Your geometric implementation produces different gains for that fixture, so that one test fails (`ngs2_geom` aborts at its line 163) — your own `TestApplyStereo`/`TestApplySurround`/`TestApplyDistanceConeDoppler` all pass. The test's expectations need reconciling with the new geometry (yours to update or argue for, since `main` wrote them deliberately). Everything else passes (**1337/1339**: this plus the known `main` regression `agc_driver_tessellation`, #4727); conventions are green. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6680 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `2a3d761b7` (amended to complete the second commit and clean the debt-entry merge).
011010 commented 2026-10-17 16:24:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-17T16:24:28Z.


This PR supersedes behaviour main merged deliberately, so I need the call before touching code again.

main merged #5974 (@mohammad-alosta) on 2026-10-16, a minimal pass-through for sceNgs2GeomApply that unblocks Dead Cells (PPSA15552), and its TestGeomApply asserts exactly that behaviour. #5974 was opened on 2026-10-14, this PR on 2026-10-16, so main's behaviour is the established one and this PR is the supersede, not the other way round.

The two behaviours, both replacing the same function in src/Geom.cpp:

main (#5974, 106-line file) this PR (331-line file, PS5PCEM's ngs2_geom.zig apply)
position copied from the source parameter the source transformed into listener space
a3d_attrib.volume max(min_level, max_level) clamp(distance rolloff × cone, min(min_level, max_level), max_level)
level a diagonal of max_level over matrix_format channels constant-power pan weights per speaker layout, times the level, LFE on its channel
pitch_ratio always 1 Doppler from the listener and source velocities and the sound speed
flags (void)flags bitmask (source angle 1, Doppler 2, volume matrix 4, A3D attribute 8, ambisonics 16; 0 means the default 1|2|4|8, unknown bits throw)
rolloff, cone, panning, Doppler documented as unimplemented implemented for every input

The collision is structural, not a bug. On the fixture main wrote for itself (identity listener matrix, source at (1,2,3), max_level 0.5, flags 0), this implementation computes the volume from the distance rolloff and the cone, so a3d_attrib.volume cannot be max_level, and level is pan weights, so level[1] is not 0. @blawesom's rebase run reports 1337/1339 with this as the single failure, ngs2_geom aborting at Ngs2Geom.cpp:163 (the a3d_attrib.volume == 0.5f line) — the other failure is the main regression agc_driver_tessellation (#4727). This PR's own fixtures (TestApplyStereo, TestApplySurround, TestApplyDistanceConeDoppler) pass.

Why I am not settling it myself: the fixture encodes behaviour main accepted on purpose for a title that was blocked on this call, and replacing it changes the gains Dead Cells hears. Neither side is measured on hardware — #5974 follows KytyPS5 and this follows PS5PCEM — so this is a behaviour choice, not a correctness proof, and the debt row records main's gap in as many words ("The listener and flags are ignored, so source attenuation, distance rolloff, panning and Doppler stay unimplemented").

So, @adriadam10, @mohammad-alosta, @MarcZX100 raised this in his review as needing an explicit maintainer decision. Which behaviour is intended?

  • main's minimal pass-through stands — I will drop the src/Geom.cpp replacement and the geometry fixtures from this PR and keep what is a pure addition: the report-handler registry in System.cpp with its rewritten Ngs2Report.cpp tests. The flags bitmask belongs to the dropped part, so it goes with it.
  • This PR's geometry is intended — I will rebase onto current main and update TestGeomApply to assert what the new implementation writes for that same fixture, with every expected value written from the implementation and the debt row updated, so the fixture documents the new behaviour instead of the placeholder. #6447 still carries a third sceNgs2GeomApply and would then reconcile to the same one.

No code changes until you pick, and no hurry from my side. If it helps the decision I can build this branch and post the exact volume and level values the fixture produces, and the same values for a source at a listener-relative distance that Dead Cells would use, so the audible difference is on the table rather than described.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6236577937 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6236577937). Originally posted by [011010](https://github.com/011010) on 2026-10-17T16:24:28Z. --- **This PR supersedes behaviour `main` merged deliberately, so I need the call before touching code again.** `main` merged #5974 (@mohammad-alosta) on 2026-10-16, a *minimal pass-through* for `sceNgs2GeomApply` that unblocks Dead Cells (PPSA15552), and its `TestGeomApply` asserts exactly that behaviour. #5974 was opened on 2026-10-14, this PR on 2026-10-16, so `main`'s behaviour is the established one and this PR is the supersede, not the other way round. The two behaviours, both replacing the same function in `src/Geom.cpp`: | | `main` (#5974, 106-line file) | this PR (331-line file, PS5PCEM's `ngs2_geom.zig` `apply`) | |---|---|---| | `position` | copied from the source parameter | the source transformed into listener space | | `a3d_attrib.volume` | `max(min_level, max_level)` | `clamp(distance rolloff × cone, min(min_level, max_level), max_level)` | | `level` | a diagonal of `max_level` over `matrix_format` channels | constant-power pan weights per speaker layout, times the level, LFE on its channel | | `pitch_ratio` | always 1 | Doppler from the listener and source velocities and the sound speed | | `flags` | `(void)flags` | bitmask (source angle 1, Doppler 2, volume matrix 4, A3D attribute 8, ambisonics 16; 0 means the default 1\|2\|4\|8, unknown bits throw) | | rolloff, cone, panning, Doppler | documented as unimplemented | implemented for every input | The collision is structural, not a bug. On the fixture `main` wrote for itself (identity listener matrix, source at (1,2,3), `max_level` 0.5, `flags` 0), this implementation computes the volume from the distance rolloff and the cone, so `a3d_attrib.volume` cannot be `max_level`, and `level` is pan weights, so `level[1]` is not 0. @blawesom's rebase run reports 1337/1339 with this as the single failure, `ngs2_geom` aborting at `Ngs2Geom.cpp:163` (the `a3d_attrib.volume == 0.5f` line) — the other failure is the `main` regression `agc_driver_tessellation` (#4727). This PR's own fixtures (`TestApplyStereo`, `TestApplySurround`, `TestApplyDistanceConeDoppler`) pass. Why I am not settling it myself: the fixture encodes behaviour `main` accepted on purpose for a title that was blocked on this call, and replacing it changes the gains Dead Cells hears. Neither side is measured on hardware — #5974 follows KytyPS5 and this follows PS5PCEM — so this is a behaviour choice, not a correctness proof, and the debt row records `main`'s gap in as many words ("The listener and `flags` are ignored, so source attenuation, distance rolloff, panning and Doppler stay unimplemented"). So, @adriadam10, @mohammad-alosta, @MarcZX100 raised this in his review as needing an explicit maintainer decision. Which behaviour is intended? - **`main`'s minimal pass-through stands** — I will drop the `src/Geom.cpp` replacement and the geometry fixtures from this PR and keep what is a pure addition: the report-handler registry in `System.cpp` with its rewritten `Ngs2Report.cpp` tests. The `flags` bitmask belongs to the dropped part, so it goes with it. - **This PR's geometry is intended** — I will rebase onto current `main` and update `TestGeomApply` to assert what the new implementation writes for that same fixture, with every expected value written from the implementation and the debt row updated, so the fixture documents the new behaviour instead of the placeholder. `#6447` still carries a third `sceNgs2GeomApply` and would then reconcile to the same one. No code changes until you pick, and no hurry from my side. If it helps the decision I can build this branch and post the exact `volume` and `level` values the fixture produces, and the same values for a source at a listener-relative distance that Dead Cells would use, so the audible difference is on the table rather than described.
adriadam10 commented 2026-10-19 07:49:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T07:49:53Z.

Review: CHANGES_REQUESTED


Thanks for laying the choice out clearly. Our call: main's pass-through from #5974 stands, so please take the first option from your comment.

  • sceNgs2GeomApply: drop the src/Geom.cpp replacement, the Voice.cpp wrapper, the geometry fixtures in tests/Ngs2Geom.cpp and the flags bitmask that goes with them. main's behaviour follows KytyPS5 (our primary reference for PS5 HLE) and is covered by TestGeomApply. The replacement follows PS5PCEM only, and neither side can be measured on hardware, so we won't change the gains for a title that is already unblocked. If someone later has hardware or title evidence for rolloff/cone/panning/Doppler, a separate PR can build on main's version.
  • Keep the report-handler registry (System.cpp, Ngs2ReportDataHeader/Ngs2ReportHandler, the Ngs2Report.cpp tests) and the removal of the two report stubs from Unimplemented.cpp. In docs/dev/debt/libSceNgs2.native.md leave main's sceNgs2GeomApply row as it is and only touch the report entries.
  • Rebase onto current main (the PR conflicts) and rerun ngs2_geom and ngs2_report.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5568426106 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#pullrequestreview-5568426106). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T07:49:53Z. **Review:** CHANGES_REQUESTED --- Thanks for laying the choice out clearly. Our call: **`main`'s pass-through from #5974 stands**, so please take the first option from your comment. - `sceNgs2GeomApply`: drop the `src/Geom.cpp` replacement, the `Voice.cpp` wrapper, the geometry fixtures in `tests/Ngs2Geom.cpp` and the `flags` bitmask that goes with them. `main`'s behaviour follows KytyPS5 (our primary reference for PS5 HLE) and is covered by `TestGeomApply`. The replacement follows PS5PCEM only, and neither side can be measured on hardware, so we won't change the gains for a title that is already unblocked. If someone later has hardware or title evidence for rolloff/cone/panning/Doppler, a separate PR can build on `main`'s version. - Keep the report-handler registry (`System.cpp`, `Ngs2ReportDataHeader`/`Ngs2ReportHandler`, the `Ngs2Report.cpp` tests) and the removal of the two report stubs from `Unimplemented.cpp`. In `docs/dev/debt/libSceNgs2.native.md` leave `main`'s `sceNgs2GeomApply` row as it is and only touch the report entries. - Rebase onto current `main` (the PR conflicts) and rerun `ngs2_geom` and `ngs2_report`.
011010 commented 2026-10-19 16:35:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-19T16:35:06Z.


Rebased onto current main and reduced to the option you picked.

Dropped, following your call that main's pass-through from #5974 stands:

  • the src/Geom.cpp replacement, so main's minimal sceNgs2GeomApply and its TestGeomApply are untouched,
  • the Voice.cpp wrapper,
  • the geometry fixtures in tests/Ngs2Geom.cpp,
  • the flags bitmask that went with them.

Kept, as a pure addition:

  • the report-handler registry in src/System.cpp, with Ngs2ReportDataHeader and Ngs2ReportHandler in include/Ngs2Types.hpp,
  • the rewritten tests/Ngs2Report.cpp,
  • the removal of the two report stubs, so src/Unimplemented.cpp is gone and the library no longer lists it.

In docs/dev/debt/libSceNgs2.native.md I left main's sceNgs2GeomApply row alone and touched only the report entry, which now points at src/System.cpp and records that a handler is registered but never invoked.

Re-verified at this head on Linux (Ubuntu 24.04.5, x86-64, GCC 13.3.0):

  • ctest --test-dir build -R "^ngs2" --output-on-failure → 13/13 passed, ngs2_geom included, now against main's own fixture and main's own implementation.
  • python3 tools/check_conventions.py --base origin/main → all conventions checks passed.
  • python3 tools/pr_overlap.py --branch feat/libSceNgs2-geom-report → only this PR itself.

One thing worth flagging for the future: the handle is the address of the registration record, the same convention the library already uses for system, rack and voice handles. It also means a stale handle can name a later registration that reuses the address, and unregister would drop that one instead. I kept the convention rather than introducing a second handle scheme for one call, but a counter would close that hole for the whole library if you want it as a separate change.

#6447 still carries a third sceNgs2GeomApply; this pull request no longer touches that function, so there is nothing left to reconcile between the two.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272136213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6272136213). Originally posted by [011010](https://github.com/011010) on 2026-10-19T16:35:06Z. --- Rebased onto current `main` and reduced to the option you picked. **Dropped**, following your call that `main`'s pass-through from #5974 stands: - the `src/Geom.cpp` replacement, so `main`'s minimal `sceNgs2GeomApply` and its `TestGeomApply` are untouched, - the `Voice.cpp` wrapper, - the geometry fixtures in `tests/Ngs2Geom.cpp`, - the `flags` bitmask that went with them. **Kept**, as a pure addition: - the report-handler registry in `src/System.cpp`, with `Ngs2ReportDataHeader` and `Ngs2ReportHandler` in `include/Ngs2Types.hpp`, - the rewritten `tests/Ngs2Report.cpp`, - the removal of the two report stubs, so `src/Unimplemented.cpp` is gone and the library no longer lists it. In `docs/dev/debt/libSceNgs2.native.md` I left `main`'s `sceNgs2GeomApply` row alone and touched only the report entry, which now points at `src/System.cpp` and records that a handler is registered but never invoked. Re-verified at this head on Linux (Ubuntu 24.04.5, x86-64, GCC 13.3.0): - `ctest --test-dir build -R "^ngs2" --output-on-failure` → **13/13 passed**, `ngs2_geom` included, now against `main`'s own fixture and `main`'s own implementation. - `python3 tools/check_conventions.py --base origin/main` → all conventions checks passed. - `python3 tools/pr_overlap.py --branch feat/libSceNgs2-geom-report` → only this PR itself. One thing worth flagging for the future: the handle is the address of the registration record, the same convention the library already uses for system, rack and voice handles. It also means a stale handle can name a later registration that reuses the address, and unregister would drop that one instead. I kept the convention rather than introducing a second handle scheme for one call, but a counter would close that hole for the whole library if you want it as a separate change. `#6447` still carries a third `sceNgs2GeomApply`; this pull request no longer touches that function, so there is nothing left to reconcile between the two.
adriadam10 commented 2026-10-19 23:55:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T23:55:59Z.


Checked the interdiff against our last comment: the sceNgs2GeomApply replacement, Voice.cpp wrapper, geometry fixtures and flags bitmask are gone, main's pass-through is untouched, and only the report entries of the debt file changed. The registry is locked, unregister only compares the pointer and throws for an unknown handle, and ngs2_report pins register/unregister/double-unregister; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6279977470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6680#issuecomment-6279977470). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T23:55:59Z. --- Checked the interdiff against our last comment: the `sceNgs2GeomApply` replacement, `Voice.cpp` wrapper, geometry fixtures and `flags` bitmask are gone, `main`'s pass-through is untouched, and only the report entries of the debt file changed. The registry is locked, unregister only compares the pointer and throws for an unknown handle, and `ngs2_report` pins register/unregister/double-unregister; merged.
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!6680
No description provided.