feat(libSceHmd2): answer four reprojection calls without a session as the console does #8645

Merged
nikowolf123 merged 1 commit from upstream-pr/8645 into main 2026-11-20 09:54:35 +00:00
nikowolf123 commented 2026-10-20 20:03:55 +00:00 (Migrated from github.com)

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 main and 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. ctest passes for guest_hmd2. Not run on a console or with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4941730768 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645). Originally posted by [nikowolf123](https://github.com/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 `main` and adapted to the declarations, test layout and debt fragments it has now. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, WinLibs MinGW-w64 GCC 15.2.0 (ucrt, posix, seh), full build of this branch on current `main`. `ctest` passes for guest_hmd2. Not run on a console or with a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
frankea commented 2026-10-21 03:07:12 +00:00 (Migrated from github.com)

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. sceHmd2Initialize with a zeroed 0x40-byte parameter had failed first (0x8A72001F). SetMirroringOption ran next. GetStatus and BeginFrame ran after a sceHmd2ReprojectionInitialize that also failed with 0x8A72001F, so no session was open for any of the three:

call (arguments as passed) result
sceHmd2ReprojectionBeginFrame(2, 2, zeroed buffer) 0x8A72000B
sceHmd2ReprojectionGetStatus(&status) 0x8A72000B
sceHmd2ReprojectionSetMirroringOption(zeroed buffer, 0, 1) 0x8A72000B

So these three give REPROJECTION_NOT_INITIALIZED without 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 whether GetStatus wrote its buffer. DisableMirroring and DisableVrMode were not called. In the same run EnableMirroring, SetRenderConfig, EnableVrMode, SetParam and GetPredictedDisplayTime also returned 0x8A72000B, which may help whoever implements those next.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307024384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645#issuecomment-6307024384). Originally posted by [frankea](https://github.com/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. `sceHmd2Initialize` with a zeroed 0x40-byte parameter had failed first (0x8A72001F). `SetMirroringOption` ran next. `GetStatus` and `BeginFrame` ran after a `sceHmd2ReprojectionInitialize` that also failed with 0x8A72001F, so no session was open for any of the three: | call (arguments as passed) | result | |---|---| | `sceHmd2ReprojectionBeginFrame(2, 2, zeroed buffer)` | 0x8A72000B | | `sceHmd2ReprojectionGetStatus(&status)` | 0x8A72000B | | `sceHmd2ReprojectionSetMirroringOption(zeroed buffer, 0, 1)` | 0x8A72000B | So these three give `REPROJECTION_NOT_INITIALIZED` without 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 whether `GetStatus` wrote its buffer. `DisableMirroring` and `DisableVrMode` were not called. In the same run `EnableMirroring`, `SetRenderConfig`, `EnableVrMode`, `SetParam` and `GetPredictedDisplayTime` also returned 0x8A72000B, which may help whoever implements those next. AI-assisted: yes (Claude Code).
nikowolf123 commented 2026-10-21 03:16:10 +00:00 (Migrated from github.com)

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 main cd700fe9e (#7826 had merged meanwhile) and cited your reading in the commit message and in the docs/dev/debt/libSceHmd2.md entry:

  • BeginFrame, GetStatus and SetMirroringOption are now recorded as measured in a game process on 13.40 with non-zero arguments.
  • DisableMirroring and DisableVrMode are still recorded as assumed.
  • Whether GetStatus writes its argument is recorded as not observed.

guest_hmd2 passes on the new head (310de514a).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307141201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645#issuecomment-6307141201). Originally posted by [nikowolf123](https://github.com/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 `main` cd700fe9e (#7826 had merged meanwhile) and cited your reading in the commit message and in the `docs/dev/debt/libSceHmd2.md` entry: - `BeginFrame`, `GetStatus` and `SetMirroringOption` are now recorded as measured in a game process on 13.40 with non-zero arguments. - `DisableMirroring` and `DisableVrMode` are still recorded as assumed. - Whether `GetStatus` writes its argument is recorded as not observed. `guest_hmd2` passes on the new head (310de514a).
ycbuzi commented 2026-10-21 06:58:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T06:58:31Z.


Windows run of 310de514ab merged onto main ec7eacc62d (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 libSceHmd2 and guest_hmd2_tests with no errors or warnings; ctest --repeat until-fail:2 on guest_hmd2: passes on both repeats. Not run: the negative control against main's library, a title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310061651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645#issuecomment-6310061651). Originally posted by [ycbuzi](https://github.com/ycbuzi) on 2026-10-21T06:58:31Z. --- Windows run of 310de514ab merged onto `main` ec7eacc62d (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 `libSceHmd2` and `guest_hmd2_tests` with no errors or warnings; `ctest --repeat until-fail:2` on `guest_hmd2`: passes on both repeats. Not run: the negative control against `main`'s library, a title.
rooklz commented 2026-10-21 18:45:06 +00:00 (Migrated from github.com)

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, EnableVrMode and GetPredictedDisplayTime returned 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, before sceHmd2Initialize on 13.60:

250 SVEG+1D7qHA libSceHmd2 nulls -> 0x8a72000b    (GetPredictedDisplayTime)
250 SVEG+1D7qHA libSceHmd2 buffers -> 0x8a72000b
252 hA9LshbSkzw libSceHmd2 nulls -> 0x8a72000b    (SetRenderConfig)
252 hA9LshbSkzw libSceHmd2 buffers -> 0x8a72000b
255 VVvFh51o20s libSceHmd2 nulls -> 0x8a72000b    (EnableVrMode)
255 VVvFh51o20s libSceHmd2 buffers -> 0x8a72000b
263 Qx7SkcgAzok libSceHmd2 nulls -> 0x8a72000b    (EnableMirroring)
263 Qx7SkcgAzok libSceHmd2 buffers -> 0x8a72000b

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 SetParam out 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323806367 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645#issuecomment-6323806367). Originally posted by [rooklz](https://github.com/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`, `EnableVrMode` and `GetPredictedDisplayTime` returned 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, before `sceHmd2Initialize` on 13.60: ``` 250 SVEG+1D7qHA libSceHmd2 nulls -> 0x8a72000b (GetPredictedDisplayTime) 250 SVEG+1D7qHA libSceHmd2 buffers -> 0x8a72000b 252 hA9LshbSkzw libSceHmd2 nulls -> 0x8a72000b (SetRenderConfig) 252 hA9LshbSkzw libSceHmd2 buffers -> 0x8a72000b 255 VVvFh51o20s libSceHmd2 nulls -> 0x8a72000b (EnableVrMode) 255 VVvFh51o20s libSceHmd2 buffers -> 0x8a72000b 263 Qx7SkcgAzok libSceHmd2 nulls -> 0x8a72000b (EnableMirroring) 263 Qx7SkcgAzok libSceHmd2 buffers -> 0x8a72000b ``` 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 `SetParam` out 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.
harisibrar1 commented 2026-10-24 15:32:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:32:42Z.

Review: COMMENTED


Checked against main b607bfdc8b and T3cm0's #7798 log (entries 239, 249, 256, 257, 258, 264), plus tools/nid.py:

  • The cited log entries match: all five NIDs return 0x8a72000b with nulls and with zeroed buffers, after a failed sceHmd2ReprojectionInitialize (entry 239). With frankea's and BunnyFl's readings, the no-session answer looks well supported.
  • The branch no longer merges into main: the 3-way git merge-tree shows conflicts in Export.cpp, Hmd2.hpp, GuestHmd2.cpp and docs/dev/debt/libSceHmd2.md.
  • Main has since restored the signatures of these exports (03e14bd74c, d47b4d729d): sceHmd2ReprojectionBeginFrame(std::uint64_t frameId) (Export.cpp:356), sceHmd2ReprojectionGetStatus(Hmd2::ReprojectionStatus*) (:250) and sceHmd2ReprojectionSetMirroringOption(const Hmd2::MirroringOption*) (:413). Could the rebase keep those and only replace the bodies, rather than going back to int64_t flipArg and ()?
  • The debt changes need re-basing too: the PPSA09030 and PPSA15878 entries this PR edits are gone on main, main's Silent stubs line says reprojection operations "retain their throwing bodies", and the new entry's "the other four are declared without parameters, signatures unknown" no longer holds for GetStatus and SetMirroringOption. BunnyFl's run also answers the "whether GetStatus writes its argument was not recorded" point for the no-session case.
  • Small optional point: since this is a measured error answer rather than a success, the Silent stubs entry may not be needed alongside the Functional one.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638795984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8645#pullrequestreview-5638795984). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T15:32:42Z. **Review:** COMMENTED --- Checked against main b607bfdc8b and T3cm0's #7798 log (entries 239, 249, 256, 257, 258, 264), plus `tools/nid.py`: - The cited log entries match: all five NIDs return 0x8a72000b with nulls and with zeroed buffers, after a failed `sceHmd2ReprojectionInitialize` (entry 239). With frankea's and BunnyFl's readings, the no-session answer looks well supported. - The branch no longer merges into main: the 3-way `git merge-tree` shows conflicts in `Export.cpp`, `Hmd2.hpp`, `GuestHmd2.cpp` and `docs/dev/debt/libSceHmd2.md`. - Main has since restored the signatures of these exports (03e14bd74c, d47b4d729d): `sceHmd2ReprojectionBeginFrame(std::uint64_t frameId)` (Export.cpp:356), `sceHmd2ReprojectionGetStatus(Hmd2::ReprojectionStatus*)` (:250) and `sceHmd2ReprojectionSetMirroringOption(const Hmd2::MirroringOption*)` (:413). Could the rebase keep those and only replace the bodies, rather than going back to `int64_t flipArg` and `()`? - The debt changes need re-basing too: the PPSA09030 and PPSA15878 entries this PR edits are gone on main, main's Silent stubs line says reprojection operations "retain their throwing bodies", and the new entry's "the other four are declared without parameters, signatures unknown" no longer holds for GetStatus and SetMirroringOption. BunnyFl's run also answers the "whether `GetStatus` writes its argument was not recorded" point for the no-session case. - Small optional point: since this is a measured error answer rather than a success, the Silent stubs entry may not be needed alongside the Functional one. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8645
No description provided.