fix(MemoryCard): initialize shared-state fallback result without code changes #1174

Merged
coah80 merged 1 commits from agent/bittle/card-result-initialization into main 2026-10-05 02:55:58 +00:00
coah80 commented 2026-10-05 02:54:25 +00:00 (Migrated from github.com)

Summary

Initialize result from the selected file number in isMoveEnable and isCopyEnable. These are the only two source-line changes. Shared card state can change between the eligibility test and the second error-selection pass, leaving result unassigned in the previous C++. Retail retains the file number in r29 on that fallthrough; the initializer makes this source behavior explicit without adding a fabricated value. All volatile reads, error priorities, and output timing remain unchanged.

Independent verification

  • Complete MemoryCardManager object is byte-identical to the baseline
  • Both functions remain 100%, 118/118 instructions, zero differences
  • All 1,027 source-object hashes and full report unchanged in worker comparison
  • Parent forced recompilation and independently compared object bytes/full report, then rebuilt after rebase onto #1173
  • Exact siblings 23/26 unchanged; pool/literal audits pass, 23 exact functions, zero skips/errors
  • Full default43U and explicitok pass; original/built DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
  • Based on 0aa16c079205083814ce0caeeaceed267e3c24f6; tested tree e5644c0295 equals published tree

This is a source-correctness repair, not a percentage gain. No flags, metadata, linking changes, assembly or unrelated edits. Evidence: tools/decomp-assist/card-result-initialization-audit.md. No merge performed.

Note

Initialize fallback result in MemoryCardManager::isMoveEnable and isCopyEnable

Initializes the local result value from the selected file number before the move- and copy-eligibility branches run, in iplMemoryCardManager.cpp. All existing conditions and output handling are unchanged.

  • In an edge case where the initial eligibility test fails but no later branch assigns a failure code, the optional code output now gets the selected file number instead of an uninitialized local value.
  • Adds an audit doc at card-result-initialization-audit.md covering the trial, build checks, and binary comparison.

Macroscope summarized 42b06fb.

## Summary Initialize result from the selected file number in isMoveEnable and isCopyEnable. These are the only two source-line changes. Shared card state can change between the eligibility test and the second error-selection pass, leaving result unassigned in the previous C++. Retail retains the file number in r29 on that fallthrough; the initializer makes this source behavior explicit without adding a fabricated value. All volatile reads, error priorities, and output timing remain unchanged. ## Independent verification - Complete MemoryCardManager object is byte-identical to the baseline - Both functions remain 100%, 118/118 instructions, zero differences - All 1,027 source-object hashes and full report unchanged in worker comparison - Parent forced recompilation and independently compared object bytes/full report, then rebuilt after rebase onto #1173 - Exact siblings 23/26 unchanged; pool/literal audits pass, 23 exact functions, zero skips/errors - Full default43U and explicitok pass; original/built DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d - Based on 0aa16c079205083814ce0caeeaceed267e3c24f6; tested tree e5644c0295738dc5cecaa4accb3f8e341cecc682 equals published tree This is a source-correctness repair, not a percentage gain. No flags, metadata, linking changes, assembly or unrelated edits. Evidence: tools/decomp-assist/card-result-initialization-audit.md. No merge performed. <!-- 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] > ### Initialize fallback result in `MemoryCardManager::isMoveEnable` and `isCopyEnable` > Initializes the local result value from the selected file number before the move- and copy-eligibility branches run, in [iplMemoryCardManager.cpp](https://github.com/coah80/wii-ipl/pull/1174/files#diff-cefe6d084ed79d8a93e811b4d989e447072875668ebaac41fec15b623cf26734). All existing conditions and output handling are unchanged. > > - In an edge case where the initial eligibility test fails but no later branch assigns a failure code, the optional code output now gets the selected file number instead of an uninitialized local value. > - Adds an audit doc at [card-result-initialization-audit.md](https://github.com/coah80/wii-ipl/pull/1174/files#diff-1ac2bcf029ffd16e98b01c371d395f451755d8419f815e02c3fa63fa873fdcff) covering the trial, build checks, and binary comparison. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 42b06fb.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-05 02:55:56 +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.