feat(libSceHmd2): answer 18 slot and output-writing exports before initialization as the console does #7826
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7826"
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 T3cm0 on 2026-10-19T09:09:52Z.
What
Third and last follow-up to the
libSceHmd2sweeps (#7798, #7805). Those left 19 exports that either write into their arguments or take a slot number rather than a pointer first. A third probe (hmd2x) called the 7 writers with zero-filled and with 0xAA-filled buffers, dumping every byte that changed, and the 12 slot exports with a first argument of 0, 1, 2, 3, 4, 5, 8, 16, 255 and -1 while the other arguments pointed at zeroed buffers. BeforesceHmd2Initialize:omimgG5itSs02 00 00 00 00, returns 06PeHcAaKYg80x2000and0x100through its two arguments, returns 0yur+xPdWPAgRnieDDp5ge4,jM3NEJA11yw0x8a720003b0H-n-tUk0U0x8a720003MXhloJ6Iw3w0x8a72000919wrIIiqFgM,Z389vAm47Ys0x8a721002cDcrvEG8j8k,tuqJO6O6cb4,fd4fu1cziaIUxMg7iL4nRs,K1GELwlaaGcRFn39VCHjGY0x8a721002FRoSjceDv100x8a721003wQ44gBwBw440x8a72002cwiv8+7ogrq00x8a72100fEvery slot export answers
0x8a720009for slots above its range, including 255 and -1. Where the per-argument null test of #7805 showed a pointer argument checked before the slot (0x8a720008with an invalid slot), the handler checks it too; the arguments whose null answer could not be separated from the slot check are not looked at, which the debt entries say. The 18 exports are bound by NID to 14 handlers that return the measured value while the library is not initialized and throw ifsceHmd2Initializeever succeeds.Error100Fis a placeholder name.Left unimplemented:
FBUEhH9tQ1A, whose answer depends on the contents of an in-out structure (writes 9 and returns 0 over zeroed memory, returns0x8a720001over 0xAA bytes); described in the debt file.Measurement: probe
hmd2x(134 calls), payload process, firmware 13.60, no headset connected; log attached as a comment.Tested
maineaae7e069dplus #7798 and #7805:libs,guest_hmd2_testsandpatched_libraries_testsbuilt;ctest -R "guest_hmd2|patched_libraries"2/2 passed. The test exercises every handler's null, slot and written-byte cases beforesceHmd2Initializeand after its failed call.maindb7763d836plus #7798 and #7805: same targets built, same two tests passed.tools/check_conventions.pyclean againstmainand against #7805's branch;tools/pr_overlap.py: the same five PRs share files (#6844 declares none of these 18 by name; #7658 and #7690 shareHmd2.hppand the debt file only). No title was run: no known title calls these exports before initialization.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-19T09:10:31Z.
Progress report (
926ed2e→289fd5d)📉 System libraries: 62.69% (-0.2%, +44 declared, -22 removed functions)
🆕 44 declared as stubs
Hmd2BeforeInitializeError0004Hmd2BeforeInitializeError002CHmd2BeforeInitializeError1002Hmd2BeforeInitializeError1003Hmd2BeforeInitializeMinusOneHmd2BeforeInitializeNotInitializedHmd2BeforeInitializeParameterInvalidHmd2BeforeInitializeParameterNullHmd2BeforeInitializeReprojectionNotInitializedHmd2BeforeInitializeValue0400Hmd2BeforeInitializeValue20000Hmd2BeforeInitializeZeroHmd2CheckAllSixThenZeroHmd2CheckFirstAndThirdThenError1003Hmd2CheckFirstAndThirdThenZeroHmd2CheckFirstThenError0004Hmd2CheckFirstThenError1002Hmd2CheckFirstThenError1003Hmd2CheckFirstThenError1010Hmd2CheckFirstThenError800d0203Hmd2CheckFirstThenMinusOneHmd2CheckFirstThenParameterInvalidHmd2CheckFirstThenZeroHmd2CheckFirstTwoThenError1002Hmd2CheckFirstTwoThenError1003Hmd2CheckFirstTwoThenParameterInvalidHmd2CheckSecondThenError002CHmd2CheckSecondThenError1002Hmd2CheckSecondThenInvalidHandleHmd2CheckSecondThenParameterInvalidHmd2IndexZeroCheckSecondThenZeroHmd2SlotUpTo1CheckSecondThenError1002Hmd2SlotUpTo1ThenError1002Hmd2SlotUpTo1ThenMinusOneHmd2SlotUpTo2CheckSecondThenError002CHmd2SlotUpTo2ThenError1002Hmd2SlotUpTo2ThenError1003Hmd2SlotUpTo2ThenMinusOneHmd2SlotUpTo3CheckSecondThirdThenZeroHmd2WriteFourConstantsHmd2WriteSixHalvesThenInvalidHandleHmd2WriteSize0x2000Align0x100Hmd2WriteStateTwoHmd2WriteTwelveHalvesThenInvalidHandle🗑️ 22 removed
sceHmd2GazeActivateGazeTrackingsceHmd2GazeGetCalibrationDatasceHmd2GazeGetCalibrationDataMaxSizesceHmd2GazeGetDeviceStatussceHmd2GazeGetUserCalibrationStatussceHmd2GazeInsertRawDataWithHandlesceHmd2GazeObjectSelectionGetSelectedObjectsceHmd2GazeObjectSelectionInitializesceHmd2GazeObjectSelectionQueryMemorysceHmd2GazeObjectSelectionTerminatesceHmd2GazeSetEnabledEyesceHmd2GazeSetUserCalibrationDatasceHmd2GazeSetUserCalibrationPointsceHmd2GazeStartUserCalibrationsceHmd2GazeStopUserCalibrationsceHmd2ReprojectionClearUserEventEndsceHmd2ReprojectionClearUserEventStartsceHmd2ReprojectionGetCurrentOutputsceHmd2ReprojectionSetUserEventEndsceHmd2ReprojectionSetUserEventStartsceHmd2SetFieldOfViewsceHmd2SetIpdOffsetImported from boykopovar/AnyPS5. Originally posted by T3cm0 on 2026-10-19T09:12:03Z.
Console log behind the table in the description: probe hmd2x, the 7 writing and 12 slot-taking libSceHmd2 NIDs left by the hmd2s and hmd2n sweeps, called before sceHmd2Initialize with zero- and 0xAA-filled buffers and with first arguments 0 to 5, 8, 16, 255 and -1; payload process, firmware 13.60, no headset connected.
19-hmd2x-console.txt
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T09:30:13Z.
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/libSceHmd2/Export.cppL20core/libs/prx/libSceHmd2/Hmd2.hppL16core/libs/tests/GuestHmd2.cppL81-102docs/dev/debt/libSceHmd2.mdL13-14core/libs/prx/libSceHmd2/Hmd2.hppL16core/libs/tests/GuestHmd2.cppL81-102Some 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/tests/GuestHmd2.cppImported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T19:00:24Z.
Rebase handoff, with one thing you'll want to know about — rebased onto current
main(585075cb7, all three commits, authorship unchanged).The overlap: while this PR was open,
maingrew05bdd6aeb("export missing firmware functions from database", Oct 16), which stubs 32 libSceHmd2 exports asNotImplemented. 22 of those 32 NIDs are also registered by this PR's measured handlers — 15 of them collide with the 125-export commit (textual conflict, resolved in favour of your handlers), and 7 more collide with the 62-pointer commit without any textual conflict — they only double-register the NID, so no merge conflict ever showed them. I dropped the 22 superseded stubs and their throw-assertions, keptmain's 10 non-overlapping stubs, and trimmedmain's debt entry to those 10 (your own entries already carry the superseded NIDs with their aerolib names).I verified the NID audit on the result: 205 literal registrations, all unique, and zero overlap between the remaining named stubs' computed NIDs and the registered ones. Worth knowing: the NID of a named stub is computed from its symbol name (SHA1 over name + fixed suffix), so a stub and an
APS5_EXPORTliteral for the same NID can silently coexist in the binary — nothing at build time catches it.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds;guest_hmd2passes; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR; conventions pass with 5[debt-length]findings inlibSceHmd2.md(three are this PR's own new entries listing every NID —mainalready carries two of its own; warnings only, the gate stays green).To pick it up:
Head is
415d41eb2.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T19:01:23Z.
One more thing since the rebase handoff above: #8028 (opened after it) stubs 99 more Hmd2 exports as
NotImplemented, and 75 of those 99 compute to NIDs this PR already registers to your measured handlers (mostly thesceHmd2Internal*family — e.g.sceHmd2InternalDecryptDatais yourRRy9WmqZfgU→ParameterNullregistration). Same silent-double-registration mechanism as the 7 from05bdd6aebthat the NID audit caught in the rebase. Whichever direction the maintainers pick, one of the two PRs will need to drop the overlapping 75.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T12:44:50Z.
Thanks for folding the stack into this one. After #8028 merged, the only conflict is in
docs/dev/debt/libSceHmd2.md. The code merges cleanly, and the export collisions from the earlier rebase are gone: none of this PR's NIDs matches a named export on main any more, and main's new exports from #8028 are all kept.To resolve it, keep your version of the "libSceHmd2 gaze and reprojection exports" bullet, and keep the 19
sceHmd2Internal… - unknown signaturelines that #8028 added next to it. This PR doesn't implement any of those 19, so they stay listed.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-20T19:01:48Z.
Rebase handoff onto the post-#8028
main— your rewritten three-commit series (60b26aef1→515953cb6), rebased ontoa9cfea22fwith the resolution oneandonlydean specified above:main's 19sceHmd2Internalunknown-signature entries from #8028 preserved below it.main's #8028sceHmd2Internalstubs and your handler thunks now sit side by side (textual union — no drops needed).APS5_EXPORTregistrations, all unique, and zero overlap with the computed NIDs of the 60 named stubs — independently confirming the maintainer's "no NID matches a named export onmain" above.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds;guest_hmd2passes; 1717/1720 — green apart from the three known current-mainfailures on this stack (#7784 guest-memory, tessellation pending Mesa 26.2.6, andimage_array_window_past_layer_limit— the newly-arrived red flagged on #6772), none from this PR; conventions pass with five[debt-length]warnings on this PR's own entries (maincarries similar ones; warnings only).To pick it up:
Head is
39c89d076.