Commit Graph
11 Commits
Author SHA1 Message Date
al3w0f205 67b16acd53 test(libSceHmd): cover distortion work memory query aliases 2026-10-25 22:37:19 -05:00
al3w0f205 aa1581d59f test(libSceHmd): cover distortion work memory query aliases 2026-10-25 19:28:58 -05:00
Yunus Shaikh 32a95a35dd fix(hmd): answer handle 0 before sceHmdInitialize only below SDK 4.50
BunnyFl's firmware 13.42 check shows that the distortion, wide-near and
2D VR command queries give NOT_INITIALIZED for handle 0 before
sceHmdInitialize only when the title's compiled SDK version is below
4.50. From 4.50 the library first checks state it sets up when it
starts, which isn't measured, so handle 0 before initialization now
throws there, as it does after initialization and as all six queries
do on main. The SDK version is read from the process parameters, as
libSceHmd2 does.

guest_hmd checks handle 0 before initialization at SDK 0x044fffff and
0x04500000.

Source: https://github.com/boykopovar/AnyPS5/pull/9577#issuecomment-6343495321 (BunnyFl)
2026-10-22 08:19:34 -07:00
Yunus Shaikh 030ef8f772 fix(hmd): check the command queries' handle and 2D VR arguments in libSceHmd's order
BunnyFl ran firmware 13.42's libSceHmd exports under an emulator. The
distortion and wide-near correction queries look the handle up before
checking initialization: a handle other than the one sceHmdOpen stored,
which stays 0 without a headset, returns HANDLE_INVALID even before
sceHmdInitialize. sceHmdGet2dVrCommand checks its arguments first:
PARAMETER_NULL for a null descriptor or command buffer or a null
pointer at descriptor offset 0, 8 or 0x20, and PARAMETER_INVALID for a
non-zero field at 0x34 or 0x38.

The queries and their sceHmdDistortion* aliases now answer in that
order. What handle 0 gets after initialization isn't measured, so it
throws NotImplemented_nid_no_patch instead of returning HANDLE_INVALID.
2026-10-22 02:38:45 -07:00
Yunus Shaikh a644459114 feat(hmd): report no VR2D session without a headset
Nothing runs in VR2D without a headset, so sceHmdInternalIsGameVr2d,
IsMiniAppVr2d, IsCommonDlgVr2d and IsCommonDlgMiniAppVr2d return false,
the answer the console gives to the same four queries in libSceHmd2.
2026-10-22 01:34:36 +00:00
Yunus Shaikh 8e462a6bcc feat(hmd): refuse distortion and 2D VR command queries without a headset
sceHmdOpen never issues a handle without a headset, so the distortion
correction, wide-near correction and 2D VR command queries, and their
sceHmdDistortion* export aliases, answer as the other handle queries:
NOT_INITIALIZED before sceHmdInitialize and HANDLE_INVALID after it,
leaving the command buffer unwritten.
2026-10-22 01:33:53 +00:00
boykopovar dfe41f1f45 fix: align merged hmd declarations and webapi tests 2026-10-21 21:56:08 +03:00
Yossi Yadgar a569d075ec feat(libSceHmd): report the headset disconnected from sceHmdGetAssyError 2026-10-20 10:13:11 +03:00
Yossi Yadgar fe6aba89a8 feat(libSceHmd): refuse the field of view, eye offset and sensor queries without a headset
No handle is ever open, as sceHmdOpen reports the headset disconnected, so they return HANDLE_INVALID after initialization and NOT_INITIALIZED before it, without writing their outputs.
2026-10-20 10:13:11 +03:00
Yossi Yadgar fa916ae7bc feat(libSceHmd): return the distortion and reprojection buffer sizes and alignments 2026-10-20 10:13:11 +03:00
julienlgy 0c4dace39e feat(libSceHmd): add a disconnected-headset HLE stub 2026-10-01 14:18:10 +02:00