feat(libSceNgs2.native): keep a registry of report handlers #6680
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6680"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-16T04:17:29Z.
What
sceNgs2ReportRegisterHandlerandsceNgs2ReportUnregisterHandlerstop being throwing stubs and keep a registry of report handlers, so a title that imports them can register a handler and later drop it.INVALID_OUT_ADDRESSfor a null out handle, then stores the report type, the handler and the user data under a freshly allocated opaque handle.ngs2_report.h, and the 24-byteNgs2ReportDataHeaderpassed to a handler is itsOrbisNgs2ReportDataHeader.The two stubs in
src/Unimplemented.cppare gone and the file is removed from the library.This pull request now carries only the report-handler registry. The
sceNgs2GeomApplyimplementation and its geometry fixtures were dropped, somain's pass-through from #5974 stands untouched;main'ssceNgs2GeomApplydebt 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, includingngs2_reportandngs2_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
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)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
sceNgs2ReportRegisterHandlersceNgs2ReportUnregisterHandlerImported 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.
core/libs/prx/libSceNgs2.native/Ngs2Library.cmakecore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppcore/libs/prx/libSceNgs2.native/src/System.cppcore/libs/prx/libSceNgs2.native/Ngs2Library.cmakecore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppdocs/dev/debt/libSceNgs2.native.mdImported 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.
BUILD_TESTING=ON, full tree.c5c55fa41, on top ofmain5d9dcc42d(fast-forward, no merge needed).Results:
libSceNgs2.native.nm -Don the library showssceNgs2GeomApply,sceNgs2ReportRegisterHandlerandsceNgs2ReportUnregisterHandlerdefined.ctest -R "^ngs2": 10/10 pass, including the extendedngs2_geomand the rewrittenngs2_report.ctest -E "^agc|gpu|vulkan|video_out"): 648/650, the same asmain5d9dcc42d. The two failures on both arefile_writer_binaryandfile_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
mainI applied only this PR'stests/andinclude/Ngs2Types.hpp(the header is needed because the tests useNgs2ReportDataHeader/Ngs2ReportHandler). Both tests then abort on the old stubs:With the full PR they pass.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
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 asceNgs2GeomApplyimplementation 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 reportsngs210/10 passing on Linux, which fills the test gap in the description. I have not run those tests myself.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:
source.positionunchanged and writesvolume = max(min_level, max_level)and a diagonal matrix, so it ignores the listener transform, rolloff, cone, Doppler and panning.ngs2_geom.zigapply.While reconciling, I also fixed the
flagshandling. 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 wayNgs2GeomApplyFlagsnames 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 outside0x1f. 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.
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 geometricNgs2GeomApplyreplacesmain's simpler version inGeom.cpp; the auto-merge had duplicated theVoice.cppABI wrapper (removed); your report-handler declarations and geometric tests are layered ontomain's newer test suite.The finding:
mainaddedTestGeomApplytoNgs2Geom.cppafter your branch point, asserting the old stub's level-matrix outputs (level[18] == 0.5fetc. for a diagonal fill). Your geometric implementation produces different gains for that fixture, so that one test fails (ngs2_geomaborts at its line 163) — your ownTestApplyStereo/TestApplySurround/TestApplyDistanceConeDopplerall pass. The test's expectations need reconciling with the new geometry (yours to update or argue for, sincemainwrote them deliberately). Everything else passes (1337/1339: this plus the knownmainregressionagc_driver_tessellation, #4727); conventions are green.To pick it up:
Head is
2a3d761b7(amended to complete the second commit and clean the debt-entry merge).Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-17T16:24:28Z.
This PR supersedes behaviour
mainmerged deliberately, so I need the call before touching code again.mainmerged #5974 (@mohammad-alosta) on 2026-10-16, a minimal pass-through forsceNgs2GeomApplythat unblocks Dead Cells (PPSA15552), and itsTestGeomApplyasserts exactly that behaviour. #5974 was opened on 2026-10-14, this PR on 2026-10-16, somain'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)ngs2_geom.zigapply)positiona3d_attrib.volumemax(min_level, max_level)clamp(distance rolloff × cone, min(min_level, max_level), max_level)levelmax_levelovermatrix_formatchannelspitch_ratioflags(void)flagsThe collision is structural, not a bug. On the fixture
mainwrote for itself (identity listener matrix, source at (1,2,3),max_level0.5,flags0), this implementation computes the volume from the distance rolloff and the cone, soa3d_attrib.volumecannot bemax_level, andlevelis pan weights, solevel[1]is not 0. @blawesom's rebase run reports 1337/1339 with this as the single failure,ngs2_geomaborting atNgs2Geom.cpp:163(thea3d_attrib.volume == 0.5fline) — the other failure is themainregressionagc_driver_tessellation(#4727). This PR's own fixtures (TestApplyStereo,TestApplySurround,TestApplyDistanceConeDoppler) pass.Why I am not settling it myself: the fixture encodes behaviour
mainaccepted 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 recordsmain's gap in as many words ("The listener andflagsare 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 thesrc/Geom.cppreplacement and the geometry fixtures from this PR and keep what is a pure addition: the report-handler registry inSystem.cppwith its rewrittenNgs2Report.cpptests. Theflagsbitmask belongs to the dropped part, so it goes with it.mainand updateTestGeomApplyto 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.#6447still carries a thirdsceNgs2GeomApplyand 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
volumeandlevelvalues 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.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 thesrc/Geom.cppreplacement, theVoice.cppwrapper, the geometry fixtures intests/Ngs2Geom.cppand theflagsbitmask that goes with them.main's behaviour follows KytyPS5 (our primary reference for PS5 HLE) and is covered byTestGeomApply. 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 onmain's version.System.cpp,Ngs2ReportDataHeader/Ngs2ReportHandler, theNgs2Report.cpptests) and the removal of the two report stubs fromUnimplemented.cpp. Indocs/dev/debt/libSceNgs2.native.mdleavemain'ssceNgs2GeomApplyrow as it is and only touch the report entries.main(the PR conflicts) and rerunngs2_geomandngs2_report.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-19T16:35:06Z.
Rebased onto current
mainand reduced to the option you picked.Dropped, following your call that
main's pass-through from #5974 stands:src/Geom.cppreplacement, somain's minimalsceNgs2GeomApplyand itsTestGeomApplyare untouched,Voice.cppwrapper,tests/Ngs2Geom.cpp,flagsbitmask that went with them.Kept, as a pure addition:
src/System.cpp, withNgs2ReportDataHeaderandNgs2ReportHandlerininclude/Ngs2Types.hpp,tests/Ngs2Report.cpp,src/Unimplemented.cppis gone and the library no longer lists it.In
docs/dev/debt/libSceNgs2.native.mdI leftmain'ssceNgs2GeomApplyrow alone and touched only the report entry, which now points atsrc/System.cppand 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_geomincluded, now againstmain's own fixture andmain'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.
#6447still carries a thirdsceNgs2GeomApply; this pull request no longer touches that function, so there is nothing left to reconcile between the two.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T23:55:59Z.
Checked the interdiff against our last comment: the
sceNgs2GeomApplyreplacement,Voice.cppwrapper, geometry fixtures andflagsbitmask 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, andngs2_reportpins register/unregister/double-unregister; merged.