fix(libSceNgs2): support listener transforms in sceNgs2GeomCalcListener #5810
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5810"
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 mohammad-alosta on 2026-10-14T11:54:36Z.
What
Restore world-to-listener matrix construction in
sceNgs2GeomCalcListener(core/libs/prx/libSceNgs2.native/src/Geom.cpp). The previous implementation rejected non-default listener orientation, listener translation, and listener coordinate flags. That rejection stopped Dead Cells (PPSA15552) after its custom sampler rack startup because the title uses a non-default listener orientation.This change computes an orthonormal row-major world-to-listener matrix from
position,orient_frontandorient_up, applies the right-handed axis flip for flag 1, stores translation in the matrix, and preserves finite velocity and positive finite sound speed. Unknown flags, invalid or non-finite input, non-unit orientation axes, and unrepresentable translation still throw without changing the output. Source attenuation, panning and Doppler insceNgs2GeomApplyremain unimplemented.Updated
docs/dev/debt/libSceNgs2.native.mdandcore/libs/prx/libSceNgs2.native/tests/Ngs2Geom.cppto match the restored behavior.Tested
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ONcmake --build build --target ngs2_geom_testsctest --test-dir build -R '^ngs2_geom$' --output-on-failureTest #760: ngs2_geompassed (100% tests passed, 0 failures)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 orishamir on 2026-10-14T13:56:41Z.
Windows run: Windows 11, WinLibs GCC 15.2.0 r7, Release, this head (3918d43f0) merged onto
main28b6f1987.ngs2_geompasses 5 of 5, and the fullctesthas 0 failures out of 1184.core/libs/prx/libSceNgs2.native/src/Geom.cpptaken back tomain,ngs2_geomfails withNGS2: listener translation is unsupported.AI-assisted: yes (Claude Code Opus 5.5)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:09:52Z.
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.
main)core/libs/prx/libSceNgs2.native/src/Geom.cppL1-2, L7-8docs/dev/debt/libSceNgs2.native.mdL27-28Some 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.
docs/dev/debt/libSceNgs2.native.mdImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:04:57Z.
Checked the transform against PS5PCEM's
calcListener(rows right/up/front, translation-dot(axis, position), flag 1 = right-handed) and ranngs2_geomwith and without theGeom.cppchange (it fails without). Thanks to @orishamir for the Windows run.Pushed one docs-only commit on top (
docs/dev/debt/libSceNgs2.native.md):.mdthat doesn't exist at that SHA; it now points tosrc/hle/ngs2_geom.zig.sound_speedthrows where PS5PCEM and KytyPS5 default it to 343, and that KytyPS5 only ever writes the identity, so the matrix convention rests on PS5PCEM alone.Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by Matheuswells on 2026-10-15T18:25:28Z.
I tested this PR's
sceNgs2GeomCalcListenerwith Dead Cells (PPSA15552), combined with a localsceNgs2GeomApplyand filter type 0 support so the game would reach it. The only change to this PR's code was a debug print of the arguments.Test environment:
Dead Cells aborts after 2,682 listener calls:
Front and up are parallel on that call, so their cross product is zero and
Unit(...)throws.Over a separate run of about 60 s, the listener calls (about 3,700) were almost all flags 0 with distinct vectors:
When I replaced up with a perpendicular reference in the parallel case (up = +Y, or +Z when front is closer to the Y axis), the game did not crash. Whether the console does the same is unknown, so it would need a documented assumption in the debt entry.
For reference, the fallback adapted to this PR's helpers (my tested version used different helper names; this form compiles standalone and gives the expected axes for the cases above):
Results of that snippet for the cases above (front, up → right, up, front):
Two smaller points: the tests dropped the exhaustive non-finite checks and the default-listener
-0.0case, andReadVector(param->velocity);is called only for its validation.AI-assisted: yes.