Skip to content

docs(debt): note how a title calls sceHmd2Open and sceHmd2Initialize - #10109

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
xXPBSXx:docs/debt-hmd2-open-initialize-title
Oct 26, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
xXPBSXx:docs/debt-hmd2-open-initialize-title

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

The changed entry now reads:

sceHmd2Open (libSceHmd2) - the handle is the value the console's driver returned to the first open; titles built with an SDK before 7.00 may open for any user, and the firmware's sceMbusAddHandleByUserId result for a user other than the initial one is unknown, so that case throws. 0x8a720006 for a second open is named AlreadyOpened from its use. One title (PPSA29866) disassembled for this entry calls it once (0x2d1e2e) with a user ID from a variable of the title whose origin was not read, type 0, index 0 and a null parameter, stores the result in a field of its own object and tests it for a negative value. Which user it opens for is not shown.

sceHmd2Initialize (libSceHmd2) - the firmware also fails with 0x8a72001f when sceKernelGetAppInfo fails and with 0x8a72000a for some applications, depending on app info fields at 0x2c, 0x4b and 0x4d whose meaning is unknown, and then calls sceMbusInit; none of this is modelled. One title (PPSA29866) disassembled for this entry calls it once (0x2d2f6c) with the address of a zeroed 16-byte local block and hands the result straight to another function; a branch on the result was not read.

Changed: docs/dev/debt/libSceHmd2.md. No code change.

Method: Ghidra 12.1.4 headless on the unwrapped executable of the title named; the addresses are the call sites in that executable as Ghidra maps it, read from the instruction listing (static reading only, nothing run on a console). The listing and decompiled code are game code and are not attached.

Fixes: #10108

Tested

Documentation only. tools/check_conventions.py --base upstream/main passes; git merge-tree against main is clean. Every number in the sentence was recounted against the instruction listing. Not built, not run, no title run.

Overlap: #7658 (primesoul-web, DIRTY) goes first and this PR depends on it (Depends on: #7658). #8645 (nikowolf123, DIRTY) edits the same file and also the Hmd2 implementation and tests: whichever lands second keeps both call-site notes. Pair merge preview on main 36df54b: this head x #7658 reports a conflict in docs/dev/debt/libSceHmd2.md; this head x #8645 reports conflicts in docs/dev/debt/libSceHmd2.md, core/libs/prx/libSceHmd2/Export.cpp, core/libs/prx/libSceHmd2/Hmd2.hpp and core/libs/tests/GuestHmd2.cpp; both of those PRs are themselves not mergeable into current main, so these conflicts may come from their state. This head merges cleanly into current main.

Checklist

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 8645 docs/dev/debt/libSceHmd2.md

@github-actions github-actions Bot added docs fix error Closes an issue (Fixes #N) labels Oct 23, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation-only change keeps the title call-site facts bounded: it says what arguments and result flow are visible, then explicitly leaves the user ID's origin and the result branch unknown. The exact-head conventions check and git diff --check pass; hosted eligibility, intake, conventions and labels pass. Runtime tests do not apply.

Please refresh from current main before merge and resolve the overlap coordination. The exact-head sync check reports 0 ahead/681 behind. A pairwise merge with #7658 conflicts in docs/dev/debt/libSceHmd2.md; the overlap report also lists #8645 as an uncomparable shared-file PR, and a pairwise merge of those heads conflicts in the Hmd2 implementation, tests and debt file. Please agree with the relevant author(s) which change lands first, declare the order in Depends on where required, refresh the debt wording against the landed/current entry, and update the checklist's current-main claim. I have not approved while the branch is this stale and the debt-file order remains unresolved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx
xXPBSXx force-pushed the docs/debt-hmd2-open-initialize-title branch from 07dfce2 to 79b6e97 Compare October 23, 2026 10:51
@xXPBSXx

xXPBSXx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks. This PR changes one sentence in docs/dev/debt/libSceHmd2.md and does not depend on #7658 or #8645 (Depends on: none stays). Order: it does not need to go first; if #7658 or #8645 lands first, I rebase this branch onto it and reword the sentence against the entry that is current then. The branch is refreshed from current main (head 79b6e97632, base main 812ed15875).

AI-assisted (Claude Code).

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 79b6e976328c8b0c21f7a897774f5b36cdd4e2af. The call-site evidence remains bounded and the docs diff is clean. The earlier stale-base blocker is substantially addressed: the branch rebased onto main at e3d03fbae64e, and I verified the 147 intervening commits to current main do not touch docs/dev/debt/libSceHmd2.md; the merge preview is clean. Two integration points remain before approval: (1) #7658 and #8645 are still open and overlap this debt file; the comment says this PR need not go first but does not record an order agreed with those authors, as CONTRIBUTING requires. Please coordinate a concrete first branch and record the corresponding dependency/order in the checklist. (2) After that coordination, refresh onto current main as required by the branch guidance and rerun conventions/overlap checks. #8645 is currently DIRTY, so its eventual rebase should retain both call-site notes. No runtime test applies.

@xXPBSXx

xXPBSXx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks. This PR changes one sentence in docs/dev/debt/libSceHmd2.md. Order: #7658 (older, CLEAN) goes first and this PR waits for it, so the checklist now reads Depends on: #7658; after it lands I rebase this branch onto it and reword the sentence against the entry that is current then, and I will keep both call-site notes when I rebase. The branch is refreshed from current main (head 79b6e97632, base main 812ed15875).

AI-assisted (Claude Code).

@xXPBSXx

xXPBSXx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my comments above: this PR does not change one sentence. It adds call-site sentences to two entries in docs/dev/debt/libSceHmd2.md: two to sceHmd2Open and one to sceHmd2Initialize (2 insertions and 2 deletions in the diff of the current head). The order stays as stated: #7658 first, Depends on: #7658, and I keep both call-site notes when I rebase.

AI-assisted (Claude Code).

@xXPBSXx

xXPBSXx commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Recorded the order in the checklist and the description: Depends on: #7658 first, then this PR; #8645 edits the same file and implementation, and whichever lands second keeps both call-site notes. I measured the pair merges on current main (36df54b) and listed them in the description. The branch has been refreshed with a normal merge of main at 36df54b (no force push; the patch is still the same 2 insertions/2 deletions in docs/dev/debt/libSceHmd2.md, conventions and diff checks pass). Could you re-review the new head?

AI-assisted (Claude Code).

@adriadam10 adriadam10 self-assigned this Oct 26, 2026
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 26, 2026 14:12

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit f616a13 into boykopovar:main Oct 26, 2026
11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the two-line diff in docs/dev/debt/libSceHmd2.md: each added sentence states what the call site shows and leaves the unread parts (user ID origin, branch on the result) explicitly open, in line with the other call-site notes in the debt files. It merges cleanly into current main, and the ordering concern from the earlier reviews is recorded in the description and doesn't touch the lines this PR changes. The call-site addresses come from the author's disassembly and weren't re-checked here; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs fix error Closes an issue (Fixes #N)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libSceHmd2 debt: note how a title calls sceHmd2Open and sceHmd2Initialize

3 participants