feat(libSceHmd2): export missing firmware HMD2 interfaces #8028

Merged
ymatrix1 merged 3 commits from upstream-pr/8028 into main 2026-10-20 12:24:38 +00:00
ymatrix1 commented 2026-10-19 18:10:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ymatrix1 on 2026-10-19T18:10:02Z.


What

Declare 19 libSceHmd2 exports that exist in the firmware library and were missing here, as throwing stubs (NotImplemented_nid_no_patch(__func__)). The export list comes from the firmware libSceHmd2 dynamic function symbols, names from the verified NID database; every name recomputes to its NID. Signatures are unknown, so each is declared without parameters and listed under Unknown function info in docs/dev/debt/libSceHmd2.md.

Left out: sceHmd2ReprojectionClearEventGpuEnd, sceHmd2ReprojectionClearEventGpuStart and sceHmd2GazeGetEnabledEye (names not in the project's pinned aerolib). The NIDs that open PR #7798 already covers with APS5_EXPORT, and those declared by #7805 and #7826, are not declared here, so no function is defined twice.

Tested

Not built and not run: the Windows MinGW toolchain here cannot assemble the exception-using ms_abi code, so the full build and ctest were not run. Checked tools/check_conventions.py --base origin/main --head HEAD (passes), g++ -std=c++20 -fsyntax-only on libSceHmd2/Export.cpp (clean), no duplicate definitions, no name defined elsewhere in core/ or added by an open PR, and tools/pr_overlap.py (it lists open PRs 7690, 7798, 7805 and 7826 as sharing the files without comparing them, so I compared their added NIDs and function names against these stubs and removed every overlap; branch merged with current main).

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
  • 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:4925305592 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8028). Originally posted by [ymatrix1](https://github.com/ymatrix1) on 2026-10-19T18:10:02Z. --- ### What Declare 19 libSceHmd2 exports that exist in the firmware library and were missing here, as throwing stubs (`NotImplemented_nid_no_patch(__func__)`). The export list comes from the firmware libSceHmd2 dynamic function symbols, names from the verified NID database; every name recomputes to its NID. Signatures are unknown, so each is declared without parameters and listed under Unknown function info in `docs/dev/debt/libSceHmd2.md`. Left out: `sceHmd2ReprojectionClearEventGpuEnd`, `sceHmd2ReprojectionClearEventGpuStart` and `sceHmd2GazeGetEnabledEye` (names not in the project's pinned aerolib). The NIDs that open PR #7798 already covers with `APS5_EXPORT`, and those declared by #7805 and #7826, are not declared here, so no function is defined twice. ### Tested Not built and not run: the Windows MinGW toolchain here cannot assemble the exception-using ms_abi code, so the full build and ctest were not run. Checked `tools/check_conventions.py --base origin/main --head HEAD` (passes), `g++ -std=c++20 -fsyntax-only` on `libSceHmd2/Export.cpp` (clean), no duplicate definitions, no name defined elsewhere in `core/` or added by an open PR, and `tools/pr_overlap.py` (it lists open PRs 7690, 7798, 7805 and 7826 as sharing the files without comparing them, so I compared their added NIDs and function names against these stubs and removed every overlap; branch merged with current `main`). ### Checklist - [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) - [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
github-actions[bot] commented 2026-10-19 18:10:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T18:10:51Z.


Progress report (8a7ba4b → 0ef3bed)

📉 System libraries: 64.98% (-0.19%, +19 declared functions)

🆕 19 declared as stubs
Library Name
libSceHmd2 sceHmd2InternalDfuSend
libSceHmd2 sceHmd2InternalGetDeviceId
libSceHmd2 sceHmd2InternalGetVr2dData
libSceHmd2 sceHmd2InternalImageCloseBySlot
libSceHmd2 sceHmd2InternalImageOpenBySlot
libSceHmd2 sceHmd2InternalImageStartBySlot
libSceHmd2 sceHmd2InternalImageStopBySlot
libSceHmd2 sceHmd2InternalLedDetectorCloseBySlot
libSceHmd2 sceHmd2InternalLedDetectorOpenBySlot
libSceHmd2 sceHmd2InternalLedDetectorStartBySlot
libSceHmd2 sceHmd2InternalLedDetectorStopBySlot
libSceHmd2 sceHmd2InternalSetBrightness
libSceHmd2 sceHmd2InternalSetCameraSeeThroughMode
libSceHmd2 sceHmd2InternalSetDeviceConnection
libSceHmd2 sceHmd2InternalSetFakeLensSeparationDistance
libSceHmd2 sceHmd2InternalSetPortConnection
libSceHmd2 sceHmd2InternalSetPortStatus
libSceHmd2 sceHmd2InternalSetSidetone
libSceHmd2 sceHmd2InternalSetVibrationMode
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273994998 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8028#issuecomment-6273994998). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T18:10:51Z. --- <!-- progress-report --> ### Progress report (8a7ba4b → 0ef3bed) 📉 **System libraries**: 64.98% (-0.19%, +19 declared functions) <details> <summary>🆕 19 declared as stubs</summary> | Library | Name | | - | - | | libSceHmd2 | `sceHmd2InternalDfuSend` | | libSceHmd2 | `sceHmd2InternalGetDeviceId` | | libSceHmd2 | `sceHmd2InternalGetVr2dData` | | libSceHmd2 | `sceHmd2InternalImageCloseBySlot` | | libSceHmd2 | `sceHmd2InternalImageOpenBySlot` | | libSceHmd2 | `sceHmd2InternalImageStartBySlot` | | libSceHmd2 | `sceHmd2InternalImageStopBySlot` | | libSceHmd2 | `sceHmd2InternalLedDetectorCloseBySlot` | | libSceHmd2 | `sceHmd2InternalLedDetectorOpenBySlot` | | libSceHmd2 | `sceHmd2InternalLedDetectorStartBySlot` | | libSceHmd2 | `sceHmd2InternalLedDetectorStopBySlot` | | libSceHmd2 | `sceHmd2InternalSetBrightness` | | libSceHmd2 | `sceHmd2InternalSetCameraSeeThroughMode` | | libSceHmd2 | `sceHmd2InternalSetDeviceConnection` | | libSceHmd2 | `sceHmd2InternalSetFakeLensSeparationDistance` | | libSceHmd2 | `sceHmd2InternalSetPortConnection` | | libSceHmd2 | `sceHmd2InternalSetPortStatus` | | libSceHmd2 | `sceHmd2InternalSetSidetone` | | libSceHmd2 | `sceHmd2InternalSetVibrationMode` | </details>
blawesom commented 2026-10-19 19:01:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T19:01:22Z.


Cross-referencing an interaction with #7826 (T3cm0's measured pre-init sweep, opened this morning) that I don't think either thread knows about yet.

The overlap: this PR's named stubs register their NIDs by symbol name (the NID is computed from the function name at patch time — SHA1 over the name plus a fixed suffix), while #7826 registers literal NIDs through APS5_EXPORT to its measured handlers. I computed the NIDs for this PR's 99 new sceHmd2*/sceHmd2Internal* stubs against #7826's 205 registered NIDs: 75 of the 99 collide — e.g. sceHmd2InternalDecryptData computes to RRy9WmqZfgU, which #7826 binds to Hmd2BeforeInitializeParameterNull (measured 0x8a720009 before sceHmd2Initialize on a PS5, FW 13.60). Spot-checked several others in the Internal family; all land inside #7826's registered set.

If both merged as-is, those 75 NIDs would be double-registered — and nothing at build time catches it: the symbols coexist in the binary, the duplicate only shows at guest patch time. (Same mechanism, for what it's worth, let 7 of main's 05bdd6aeb stubs coexist silently with #7826's registrations until an NID audit caught them — noted on #7826's rebase handoff.)

The two PRs answer the same exports differently (this one: NotImplemented placeholders with debt entries; #7826: console-measured pre-init values that throw once sceHmd2Initialize succeeds). Which behaviour owns these NIDs is a call for the maintainers — but one of the two will need to drop the overlapping 75 either way, so the authors may want to coordinate before review goes deep.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274956015 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8028#issuecomment-6274956015). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-19T19:01:22Z. --- Cross-referencing an interaction with #7826 (T3cm0's measured pre-init sweep, opened this morning) that I don't think either thread knows about yet. **The overlap:** this PR's named stubs register their NIDs by symbol name (the NID is computed from the function name at patch time — SHA1 over the name plus a fixed suffix), while #7826 registers literal NIDs through `APS5_EXPORT` to its measured handlers. I computed the NIDs for this PR's 99 new `sceHmd2*`/`sceHmd2Internal*` stubs against #7826's 205 registered NIDs: **75 of the 99 collide** — e.g. `sceHmd2InternalDecryptData` computes to `RRy9WmqZfgU`, which #7826 binds to `Hmd2BeforeInitializeParameterNull` (measured `0x8a720009` before `sceHmd2Initialize` on a PS5, FW 13.60). Spot-checked several others in the Internal family; all land inside #7826's registered set. If both merged as-is, those 75 NIDs would be double-registered — and nothing at build time catches it: the symbols coexist in the binary, the duplicate only shows at guest patch time. (Same mechanism, for what it's worth, let 7 of `main`'s `05bdd6aeb` stubs coexist silently with #7826's registrations until an NID audit caught them — noted on #7826's rebase handoff.) The two PRs answer the same exports differently (this one: `NotImplemented` placeholders with debt entries; #7826: console-measured pre-init values that throw once `sceHmd2Initialize` succeeds). Which behaviour owns these NIDs is a call for the maintainers — but one of the two will need to drop the overlapping 75 either way, so the authors may want to coordinate before review goes deep.
oneandonlydean commented 2026-10-20 04:30:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T04:30:53Z.


@ymatrix1 thanks. Most names check out against the pinned aerolib, but these don't appear in it: in #8021 sceAudioOut2LoPortSetAttributesEx, sceAudioOut2LoPortGetAttributes, sceAudioOut2LoPortCreateEx, sceAudioOut2LoContextQueryMemoryEx, sceAudioOut2LoContextGetAttributes, sceAudioOut2LoContextCreateEx, sceAudioOut2SetTvCorrectionInfo, sceAudioOut2GetSystemDebugState, sceAudioOut2SetSpeakerInfo, sceAudioOut2PortSetAttributesEx, sceAudioOut2SetHrtfIdForCronos, and in #8028 sceHmd2ReprojectionClearEventGpuEnd, sceHmd2ReprojectionClearEventGpuStart and sceHmd2GazeGetEnabledEye. Which database did these names come from? Also, #7798 already answers 54 of #8028's Hmd2 NIDs before initialization; whichever of the two lands second will need to drop its copy of those.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6283418859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8028#issuecomment-6283418859). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T04:30:53Z. --- @ymatrix1 thanks. Most names check out against the pinned aerolib, but these don't appear in it: in #8021 sceAudioOut2LoPortSetAttributesEx, sceAudioOut2LoPortGetAttributes, sceAudioOut2LoPortCreateEx, sceAudioOut2LoContextQueryMemoryEx, sceAudioOut2LoContextGetAttributes, sceAudioOut2LoContextCreateEx, sceAudioOut2SetTvCorrectionInfo, sceAudioOut2GetSystemDebugState, sceAudioOut2SetSpeakerInfo, sceAudioOut2PortSetAttributesEx, sceAudioOut2SetHrtfIdForCronos, and in #8028 sceHmd2ReprojectionClearEventGpuEnd, sceHmd2ReprojectionClearEventGpuStart and sceHmd2GazeGetEnabledEye. Which database did these names come from? Also, #7798 already answers 54 of #8028's Hmd2 NIDs before initialization; whichever of the two lands second will need to drop its copy of those.
ymatrix1 commented 2026-10-20 10:04:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ymatrix1 on 2026-10-20T10:04:39Z.


@oneandonlydean thanks. The names came from a local NID name database built from aerolib plus extra name lists (not just the pinned file). Each name hashes to an NID that the console's own library exports, which is how I matched them, but I can't show where the extra names originate, so I removed every name that is not in the pinned aerolib: the three you listed are gone. I also dropped the stubs that #7798 already covers, and the PR is now 19 stubs.

@blawesom thanks for the cross-reference. I compared the remaining 19 names (as NIDs) with the NIDs registered in #7826 (205) and #7798 (125) and none collides.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288461786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8028#issuecomment-6288461786). Originally posted by [ymatrix1](https://github.com/ymatrix1) on 2026-10-20T10:04:39Z. --- @oneandonlydean thanks. The names came from a local NID name database built from aerolib plus extra name lists (not just the pinned file). Each name hashes to an NID that the console's own library exports, which is how I matched them, but I can't show where the extra names originate, so I removed every name that is not in the pinned aerolib: the three you listed are gone. I also dropped the stubs that #7798 already covers, and the PR is now 19 stubs. @blawesom thanks for the cross-reference. I compared the remaining 19 names (as NIDs) with the NIDs registered in #7826 (205) and #7798 (125) and none collides.
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!8028
No description provided.