fix(libSceNgs2): return INVALID_GEOM_FLAG and the listener-address error from sceNgs2GeomCalcListener #8692
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8692"
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 JAB-dev on 2026-10-20T21:12:51Z.
What
sceNgs2GeomCalcListenerthrew (and the process aborted) when a title passed a flags value above 1 or a null listener parameter. On the console it returns an error code and leaves the output untouched, so a title that checks the result now gets that code instead of a crash.sceNgs2GeomCalcListener(param, outWork, flags)now returns0x804A8461(SCE_NGS2_ERROR_INVALID_GEOM_LISTENER_ADDRESS) for a nullparam,0x804A8010(INVALID_OUT_ADDRESS, as before) for a nulloutWork, and0x804A8463(SCE_NGS2_ERROR_INVALID_GEOM_FLAG) for anyflagsvalue above 1. The checks run in that order and nothing is written tooutWorkon any of them. Flags 0 and 1 and the matrix computation are unchanged; the meaning of flag bit 0 is not touched here. The other throws in the function (zero or non-finite vectors, a non-positive sound speed, an unrepresentable translation) stay.Source: the PS5 SDK defines
SCE_NGS2_ERROR_INVALID_GEOM_LISTENER_ADDRESSas 0x804A8461 andSCE_NGS2_ERROR_INVALID_GEOM_FLAGas 0x804A8463 (ngs2_errors.h) and documents only bit 0 of the flags,SCE_NGS2_GEOM_LISTENER_CALC_FLAG_COORIDINATE_LH(ngs2_geom.h). FirmwarelibSceNgs2.native.sprx(NID1WsleK-MTkE), PS5 3.20 (function at 0x24d0) and 4.03 (0x2660): nullparamreturns 0x804A8461, nulloutWorkreturns 0x804A8010, thenflags > 1returns 0x804A8463 straight to aretbefore any store; the guards are identical in both. This is read from the disassembly, not measured on a console. No firmware bytes are in the repository.The debt entry for
sceNgs2GeomCalcListenerdrops "Unknown flags" from the list of cases that still throw.Tested
Windows 11 x64, Release build, MinGW GCC 15.2.0 (WinLibs r7),
-DBUILD_TESTING=ON, onmain73b6a4cc7. Linux not tested.ngs2_geom: with the work buffer pre-filled with 0x5a,sceNgs2GeomCalcListener(nullptr, &work, 0)and(nullptr, &work, 2)and(nullptr, nullptr, 0)return 0x804A8461;(¶m, &work, 2),(¶m, &work, 0x80000000)and(¶m, &work, 0xffffffff)return 0x804A8463;(¶m, nullptr, 2)returns 0x804A8010; the buffer is byte-identical afterwards. The old throw-based assertions for a null parameter and for flags 2 and 0xffffffff are replaced by these.Geom.cppfrommain,ngs2_geomaborts (uncaught exception, exit code 0xc0000409). With the change it passes.python tools/check_conventions.py --base origin/mainpasses andgit diff --checkis clean.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T21:30:53Z.
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/include/Ngs2Types.hppL19core/libs/prx/libSceNgs2.native/include/Ngs2Types.hppL19core/libs/prx/libSceNgs2.native/include/Ngs2Types.hppL19Some 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/include/Ngs2Types.hppcore/libs/prx/libSceNgs2.native/include/Ngs2Types.hppdocs/dev/debt/libSceNgs2.native.md