Repository navigation
feat(libSceVrTracker2): validate initialization and pass through the Hmd2 tracking result - #10566
Conversation
…Hmd2 tracking result sceVrTracker2Initialize follows the order read from firmware 13.60 libSceVrTracker2.sprx (disassembly, not measured on a console). It rejects with 0x8A740006, in order: a null record or a size other than 72; a mode other than 0, 1000 or 1001; a null work memory; a size below the mode's 32 MiB, 7 MiB or 3 MiB; an alignment below 0x10000; a non-zero reserved byte at 0x3a..0x47; a thread priority outside 256..767; an affinity mask outside bits 0..12 in mode 0 or outside 0xEA00 in modes 1000 and 1001. It then moves the module state from 0 to 1 and returns 0x8A740002 if it was not 0. From there every failure undoes what the call opened and resets the state to 0. Mode 0 clears the first 32 MiB of work memory first. The application attribute checks on the sceKernelGetAppInfo2 record (0x8A74001E, 0x8A740020) are skipped: the host has none, and a zeroed record passes them. The signed option at 0x39 accepts -1 and 0, and 1 only for titles compiled with SDK 7.00 or later. Modes 0 and 1000 then call libSceHmd2 TrackingOpen, TrackingStart, LedDetectorOpen and LedDetectorStart and return the first non-zero result unchanged. Without a headset main's libSceHmd2 answers 0 and -1 (its measured pre-initialization answers), so Initialize returns -1 and every other export keeps answering 0x8A740001. Modes 1000 and 1001 need the application category, which the host does not have, and a fully successful Hmd2 sequence would need the tracker runtime; both throw. The eight tracking and LED-detector exports become named functions in libSceHmd2 so that libSceVrTracker2 can import them by name; their answers are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Progress report (811ffe1 → 83043ee)📉 System libraries: 49.26% (-0.04%, +8 declared functions) 🆕 8 declared as stubs
Changed libraries (implemented exports)
|
|
One test coverage gap: |
Scan every byte of the 32 MiB tracker range and the tail after it, so a shorter clear or one that stops before the boundary fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@MarcZX10 good catch. Done in 16c9c31: Assisted With AI: Yes But all test done locally on actual hardware |
MarcZX10
left a comment
There was a problem hiding this comment.
The follow-up closes the coverage gap I raised: WorkMemoryCleared now checks every byte of the 32 MiB clear region and the entire sentinel tail, so the start, end, and boundary are covered. I reviewed the current implementation and test diff, including ordered validation, the state transition and rollback on Hmd2 failures, retry behavior, and the documented host-only limitation. The author reports the focused vr|hmd suite passing 8/8 on Linux and under Wine/MinGW; the latest hosted eligibility, conventions, labels, and report checks pass, while platform build jobs were skipped by the eligibility gate. I did not rerun those test suites locally.
|
Some 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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head refs/review/pr-10566 ($(git rev-parse refs/review/pr-10566)). The recovered parameter checks precede the state transition and work-memory clearing; initialization claims the state atomically, tracks successful Hmd2 open/start operations, rolls them back in reverse order, and restores the uninitialized state before returning the downstream result or throwing for the still-unsupported system modes. The tests cover validation boundaries, memory clearing, retry after failed start, and SDK-gated option mode. git diff --check is clean; hosted eligibility, conventions, labels, and report pass. All hosted platform build jobs are skipped, so this approval relies on source review and the contributor’s reported local tests; no local build was run.
…tialize Resolved Export.cpp and GuestVrTracker2.cpp keeping main's header layout; the new sceHmd2Internal exports are declared in the libSceHmd2 header and the test uses the library headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@hypermoist Please drop the new system-mode throw cases in GuestVrTracker2.cpp:96-101; those modes intentionally remain unimplemented and the test should not pin that limitation. Keep the invalid-argument, full memory-clear/tail, SDK-option and failure/retry checks. EnterApplicationRoot also removes a predictable PID-based temporary path before creating it, so PID reuse can delete an earlier run's files. Please allocate a fresh directory atomically and clean up only the directory this run created, preserving pre-existing paths. Then rerun guest_vr_tracker2 and guest_hmd2 on Linux and Windows. |
Remove the system-mode throw cases in GuestVrTracker2.cpp that tested modes 1000 and 1001 throwing. Allocate a fresh temporary directory atomically in EnterApplicationRoot without clobbering existing paths. Update the debt entry without citing a source. Assisted-by: Antigravity:gemini-3.8-flash-medium
|
@oneandonlydean thanks, addressed in 83043ee:
Assisted With AI: Yes But all test done locally on actual hardware |
What
Implements
sceVrTracker2Initializein place of itsNotImplementedstub. The behaviour is not measured on a console.0x8A740006: null record or size other than 72; mode other than 0, 1000 or 1001; null work memory; work memory below 32 MiB (mode 0), 7 MiB (1000) or 3 MiB (1001); alignment below 0x10000 (only a minimum, not a power of two); any reserved byte at 0x3a..0x47 set; either thread priority outside 256..767; affinity masks outside bits 0..12 (mode 0) or outside 0xEA00 (1000/1001). Then the module state moves from 0 to 1, else0x8A740002.sceKernelGetAppInfo2record (0x8A74001E,0x8A740020) are skipped: the host has no such record, and a zeroed one passes them. The signed option at 0x39 accepts -1 and 0, and 1 only for titles compiled with SDK 7.00 or later.TrackingOpen,TrackingStart,LedDetectorOpenandLedDetectorStartand return the first non-zero result as is. With no headset main's libSceHmd2 answers 0 and -1 (its measured pre-initialization answers,docs/dev/debt/libSceHmd2.md), so Initialize returns -1, the module stays uninitialized and every other export keeps answering0x8A740001.Tested
Linux (CachyOS, GCC, Release):
ctest --test-dir build -R 'guest_vr_tracker2|guest_hmd2$' --output-on-failure2/2 passed.Windows (MinGW-w64 GCC 15.2.0 winlibs cross build, run under Wine):
ctest --test-dir build-win15 -R 'guest_vr_tracker2|guest_hmd2$' --timeout 120 --output-on-failure2/2 passed. The NID-patchedlibSceVrTracker2.prximportsB0b8DeIUGes,1oPZizn0SNAand the other six fromlibSceHmd2.prx, which exports them, on both platforms.guest_vr_tracker2covers each validation error in order, the -1 pass-through, the 32 MiB clearing in mode 0 (and that a validation failure writes nothing), a retry after the failure,sceVrTracker2Finalizeand an uninitialized export still answering0x8A740001, the late coordinate-system check coming after the Hmd2 error, and the 0x39 option against SDK 6.xx and 7.00.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)sceVrTracker2Initializeis reached with feat(libSceVrTracker2): answer as the console's module before initialization #7463, feat(libSceHmd2): return the console's display and mirroring buffer sizes #7690 and feat(libs): the Hmd2 reprojection session #7658 applied)Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console.