Skip to content

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

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
ymatrix1:feat/hmd2-missing-exports
Oct 20, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
ymatrix1:feat/hmd2-missing-exports

Conversation

@ymatrix1

@ymatrix1 ymatrix1 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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

@blawesom

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Collaborator

@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

Copy link
Copy Markdown
Contributor Author

@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.

@oneandonlydean
oneandonlydean merged commit 02b5a8e into boykopovar:main Oct 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants