decomp(card): scope the permission-check result #1059

Merged
coah80 merged 1 commits from agent/bittle/card-permission-review into main 2026-10-03 05:52:05 +00:00
coah80 commented 2026-10-03 05:51:22 +00:00 (Migrated from github.com)

Partial reconstruction

Use a stage-local permissionResult for the existing initial copy/move permission check. Its failure paths return through the same finish operation; success continues to the existing status query that defines the later transfer result. There is no copy back, extra live state or allocation-only duplicate.

Original permission result lives in r16 only through its error gate; that register is subsequently reused for createSize. The source now describes that actual operation boundary.

  • runCardMoveOrCopy: 97.8125% → 97.88651%, still 608/608 instructions
  • Positional differences: 185 → 176; unit 97.20097% → 97.219246%
  • Exact functions 27/30, matched code 4,168 and data 1,496/1,496 preserved

This is a small partial fuzzy gain, not an exact or linking claim.

Independent verification

Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree bc2a8b6fb3.

  • Full 43U build/progress/report/DOL passed; all 1,027 units compared, only this function's fuzzy changes, no regressions
  • 17,328 compiled-PPC prefix cases against the original cover all permission bytes, both slots, file boundaries, copy/move/other commands and negative/nonnegative status results
  • Error/report traces and transfer-stage entry agree: 4,416 early returns and 12,912 transfer entries; wrong-mask negative control detected
  • Raw DOL verifies 513 nonrelocated words and all 79 call destinations
  • All 29 unrelated function streams and allocated data unchanged; 27 exact functions independently checked
  • Pool 43/43 identical; literal audit 45 arguments/29 functions, no candidates/errors; pre-existing loadCardFileIcons unequal extent skipped
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass

CARD calls are modeled and execution stops at early return or the next transfer status query; this is not a complete card-copy or Wii runtime test. Details: tools/decomp-assist/card-permission-lifetime-20261003.md.

Note

Scope the permission-check result in runCardMoveOrCopy

Moves the permission-check result in runCardMoveOrCopy into a local scoped around the status query, permission checks, and error gate. The later transfer-stage result keeps the existing result variable. Error codes and reporting flow are unchanged.

Macroscope summarized d53c5bf.

## Partial reconstruction Use a stage-local permissionResult for the existing initial copy/move permission check. Its failure paths return through the same finish operation; success continues to the existing status query that defines the later transfer result. There is no copy back, extra live state or allocation-only duplicate. Original permission result lives in r16 only through its error gate; that register is subsequently reused for createSize. The source now describes that actual operation boundary. - runCardMoveOrCopy: 97.8125% → 97.88651%, still 608/608 instructions - Positional differences: 185 → 176; unit 97.20097% → 97.219246% - Exact functions 27/30, matched code 4,168 and data 1,496/1,496 preserved This is a small partial fuzzy gain, not an exact or linking claim. ## Independent verification Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree bc2a8b6fb393a92c9ab22fe94903201ac29b6f7f. - Full 43U build/progress/report/DOL passed; all 1,027 units compared, only this function's fuzzy changes, no regressions - 17,328 compiled-PPC prefix cases against the original cover all permission bytes, both slots, file boundaries, copy/move/other commands and negative/nonnegative status results - Error/report traces and transfer-stage entry agree: 4,416 early returns and 12,912 transfer entries; wrong-mask negative control detected - Raw DOL verifies 513 nonrelocated words and all 79 call destinations - All 29 unrelated function streams and allocated data unchanged; 27 exact functions independently checked - Pool 43/43 identical; literal audit 45 arguments/29 functions, no candidates/errors; pre-existing loadCardFileIcons unequal extent skipped - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass CARD calls are modeled and execution stops at early return or the next transfer status query; this is not a complete card-copy or Wii runtime test. Details: tools/decomp-assist/card-permission-lifetime-20261003.md. <!-- 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] > ### Scope the permission-check result in `runCardMoveOrCopy` > Moves the permission-check result in `runCardMoveOrCopy` into a local scoped around the status query, permission checks, and error gate. The later transfer-stage result keeps the existing result variable. Error codes and reporting flow are unchanged. > > - Adds a reconstruction and validation report in [card-permission-lifetime-20261003.md](https://github.com/coah80/wii-ipl/pull/1059/files#diff-8a88fd87952be0c475dc4d4c3f1367f9ef45332b70d8b02f1ce3ea3b9c6fb474) covering instruction differences, exactness checks, and original-machine validation > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized d53c5bf.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 05:52:03 +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.