fix(card): match the OS thread entry parameter contract #1043

Merged
coah80 merged 1 commits from agent/bittle/card-thread-review into main 2026-10-03 04:46:08 +00:00
coah80 commented 2026-10-03 04:45:13 +00:00 (Migrated from github.com)

Source correction

Give cardThreadMain its genuinely unused void* entry parameter in declaration and definition, and remove the function-pointer cast at OSCreateThread. The existing body and registration arguments are unchanged. The original SDK stores registration r5 in context gpr[3], then enters the callback through that restored context; cardThreadMain overwrites r3 before reading it.

This fixes the C++ function type, with no fuzzy percentage gain. A direct C++98 binding rejects the old declaration and accepts the corrected one; no runtime sanitizer claim is made for the SDK context launch.

Independent verification

Rebased and fully tested on 5dcbc4372f.

  • Full 43U build/report/DOL passed; all 1,027 report units unchanged
  • All 1,027 allocated object payloads/canonical relocations unchanged
  • Owned object: five allocated sections and 522 relocation records identical; only 46 generated anonymous local-label spellings differ in .strtab
  • 27/30 exact functions and 1496/1496 matched data bytes preserved; all 27 exact functions independently compared
  • Raw original DOL audit covers six caller/SDK functions, 656 nonrelocated words and 73 calls, including concrete entry/parameter context handoff
  • Pool43/43 identical; literal audit45 arguments/29functions, zero candidates/errors; unchanged loadCardFileIcons unequal extent skipped
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass
  • Tested tree57cfe5395c9d421bbb2c7f3838de05d655a354e6

Detailed evidence: tools/decomp-assist/card-thread-entry-contract-20261003.md. No linking flags or other regions changed.

Note

Fix cardThreadMain signature to match OS thread entry contract

Changes the C-linkage declaration and definition of cardThreadMain in iplCardSequence.cpp to accept the standard void-pointer thread argument. Removes the explicit function-pointer cast when passing it to OSCreateThread, so the call binds directly to the SDK's thread-entry type. The function body is unchanged. Adds card-thread-entry-contract-20261003.md recording the rationale, binary comparison results, and verification hashes.

Macroscope summarized 8be5224.

## Source correction Give cardThreadMain its genuinely unused void* entry parameter in declaration and definition, and remove the function-pointer cast at OSCreateThread. The existing body and registration arguments are unchanged. The original SDK stores registration r5 in context gpr[3], then enters the callback through that restored context; cardThreadMain overwrites r3 before reading it. This fixes the C++ function type, with no fuzzy percentage gain. A direct C++98 binding rejects the old declaration and accepts the corrected one; no runtime sanitizer claim is made for the SDK context launch. ## Independent verification Rebased and fully tested on 5dcbc4372fab834712a11968fbb0985467ebffc7. - Full 43U build/report/DOL passed; all 1,027 report units unchanged - All 1,027 allocated object payloads/canonical relocations unchanged - Owned object: five allocated sections and 522 relocation records identical; only 46 generated anonymous local-label spellings differ in .strtab - 27/30 exact functions and 1496/1496 matched data bytes preserved; all 27 exact functions independently compared - Raw original DOL audit covers six caller/SDK functions, 656 nonrelocated words and 73 calls, including concrete entry/parameter context handoff - Pool43/43 identical; literal audit45 arguments/29functions, zero candidates/errors; unchanged loadCardFileIcons unequal extent skipped - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass - Tested tree57cfe5395c9d421bbb2c7f3838de05d655a354e6 Detailed evidence: tools/decomp-assist/card-thread-entry-contract-20261003.md. No linking flags or other regions changed. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Fix `cardThreadMain` signature to match OS thread entry contract > Changes the C-linkage declaration and definition of `cardThreadMain` in [iplCardSequence.cpp](https://github.com/coah80/wii-ipl/pull/1043/files#diff-f522f916c990017f7c52bea35b7777db45f5b54897d68286050669924b44e3f2) to accept the standard void-pointer thread argument. Removes the explicit function-pointer cast when passing it to `OSCreateThread`, so the call binds directly to the SDK's thread-entry type. The function body is unchanged. Adds [card-thread-entry-contract-20261003.md](https://github.com/coah80/wii-ipl/pull/1043/files#diff-0632b73a92c68bf4ec30493ff4ad083c8da36ba67f7dbf3edba7dbbab41d30f5) recording the rationale, binary comparison results, and verification hashes. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 8be5224.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 04:46:06 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.