feat(libSceHmd2): answer four reprojection calls without a session as the console does #8645
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8645"
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 nikowolf123 on 2026-10-20T20:03:55Z.
What
sceHmd2ReprojectionBeginFrame, sceHmd2ReprojectionDisableMirroring, sceHmd2ReprojectionDisableVrMode and sceHmd2ReprojectionSetMirroringOption threw for every caller. Without a reprojection session each now returns REPROJECTION_NOT_INITIALIZED (0x8a72000b) without checking or writing an argument; inside a session they still throw, because the answers there are unmeasured.
A retail PS5 (firmware 13.60, no PS VR2 headset) gave that answer to all four from a homebrew payload before sceHmd2Initialize, with every argument null and with every argument pointing at a zeroed buffer: https://github.com/boykopovar/AnyPS5/pull/7798#issuecomment-6262489180 On firmware 13.40, inside a retail game process whose sceHmd2Initialize and sceHmd2ReprojectionInitialize had failed, BeginFrame and SetMirroringOption gave the same answer with non-zero arguments: https://github.com/boykopovar/AnyPS5/pull/8645#issuecomment-6307024384
Rebased onto the reprojection session main has since grown: the calls are gated on it as sceHmd2ReprojectionEnableMirroring is, and keep the signatures main declares in Api.hpp. sceHmd2ReprojectionGetStatus, the fifth call of this change, is already implemented on main and is left as it is. The debt entry is added through a fragment.
guest_hmd2 calls BeginFrame with 0, 1, 0x123456789, -1 and INT64_MAX, the two disable calls and SetMirroringOption with a null and a filled option, before sceHmd2Initialize, after its failure and after sceHmd2ReprojectionTerminate, and expects 0x8a72000b every time with the option left unwritten; inside a session it expects none of the four to answer as without one.
Rebased onto current
mainand adapted to the declarations, test layout and debt fragments it has now.Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 (ucrt, posix, seh), full build of this branch on current
main.ctestpasses for guest_hmd2. Not run on a console or with a 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 frankea on 2026-10-21T03:07:12Z.
A second console reading for three of the five, from a retail game process rather than a payload, on a different firmware. On a PS5 (firmware 13.40, 2026-10-19), inside MLB The Show 25 (PPSA23479, not a PS VR2 title, no headset connected), I called the exports with libSceHmd2 loaded into the game. The calls were ptrace remote calls from an elfldr payload.
sceHmd2Initializewith a zeroed 0x40-byte parameter had failed first (0x8A72001F).SetMirroringOptionran next.GetStatusandBeginFrameran after asceHmd2ReprojectionInitializethat also failed with 0x8A72001F, so no session was open for any of the three:sceHmd2ReprojectionBeginFrame(2, 2, zeroed buffer)sceHmd2ReprojectionGetStatus(&status)sceHmd2ReprojectionSetMirroringOption(zeroed buffer, 0, 1)So these three give
REPROJECTION_NOT_INITIALIZEDwithout a session on 13.40 as well, even with non-zero arguments, which fits this PR answering it for every argument. I didn't record whetherGetStatuswrote its buffer.DisableMirroringandDisableVrModewere not called. In the same runEnableMirroring,SetRenderConfig,EnableVrMode,SetParamandGetPredictedDisplayTimealso returned 0x8A72000B, which may help whoever implements those next.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T03:16:10Z.
Thanks, that covers the case the debt entry had only assumed, that a game process answers like the payload. I rebased onto
maincd700fe9e(#7826 had merged meanwhile) and cited your reading in the commit message and in thedocs/dev/debt/libSceHmd2.mdentry:BeginFrame,GetStatusandSetMirroringOptionare now recorded as measured in a game process on 13.40 with non-zero arguments.DisableMirroringandDisableVrModeare still recorded as assumed.GetStatuswrites its argument is recorded as not observed.guest_hmd2passes on the new head (310de514a).Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T06:58:31Z.
Windows run of 310de514ab merged onto
mainec7eacc62d(af2870261b, clean), the build the description lists as not done. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release,BUILD_TESTING=ON.Built
libSceHmd2andguest_hmd2_testswith no errors or warnings;ctest --repeat until-fail:2onguest_hmd2: passes on both repeats. Not run: the negative control againstmain's library, a title.Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-21T18:45:06Z.
@nikowolf123, frankea's reading above also covers four more calls on the same no-session path:
EnableMirroring,SetRenderConfig,EnableVrModeandGetPredictedDisplayTimereturned 0x8A72000B inside MLB with no session open. T3cm0's payload log on #7798 has the same answer for each, with null and with zeroed arguments, beforesceHmd2Initializeon 13.60:They'd take the same shape as your five: 0x8A72000B without a session, throwing while one exists. Would you like to add them here, or should I open a follow-up on top of this PR? I'd leave
SetParamout either way. With null arguments the payload got VideoOut codes (0x80290002, and 0x8029000a with zeroed buffers), so it checks its arguments before the session, and which arguments MLB passed isn't recorded.Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:32:42Z.
Review: COMMENTED
Checked against main
b607bfdc8band T3cm0's #7798 log (entries 239, 249, 256, 257, 258, 264), plustools/nid.py:sceHmd2ReprojectionInitialize(entry 239). With frankea's and BunnyFl's readings, the no-session answer looks well supported.git merge-treeshows conflicts inExport.cpp,Hmd2.hpp,GuestHmd2.cppanddocs/dev/debt/libSceHmd2.md.03e14bd74c,d47b4d729d):sceHmd2ReprojectionBeginFrame(std::uint64_t frameId)(Export.cpp:356),sceHmd2ReprojectionGetStatus(Hmd2::ReprojectionStatus*)(:250) andsceHmd2ReprojectionSetMirroringOption(const Hmd2::MirroringOption*)(:413). Could the rebase keep those and only replace the bodies, rather than going back toint64_t flipArgand()?GetStatuswrites its argument was not recorded" point for the no-session case.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.