decomp: reconstruct alpha boundary and output expressions #991

Merged
coah80 merged 1 commits from agent/bittle/alpha-boundary-flow into main 2026-10-02 23:37:35 +00:00
coah80 commented 2026-10-02 23:35:42 +00:00 (Migrated from github.com)

Reconstruction

Recover original operand order for suffix/dictionary bounds, inclusive punctuation/prefix limits, and the countOnly output branch's fallthrough. Source variables are integer lengths/indices; halfword dictionary-count narrowing is retained. The separate opposite-order length check is intentionally left unchanged.

Target evidence: Zi8AlphaGetCandidates +0x25A8, +0x2948/+0x2978/+0x2990, +0x30F8, +0x3B08 and +0x3B84. No invented storage, register control, padding or ABI change.

  • Function:95.02813%→95.23011%;3946/3946 instructions
  • Unit:96.37759%→96.52474%;11/12 exact and5880/21664 exact code preserved
  • Matched data remains516/564; all allocated non-text bytes and normalized relocations unchanged, including the existing unmatched switch table
  • Only same-sized alpha .text changes among1027 source objects; no function/unit/data regressions
  • All11 exact functions retain ctxdiff zero; pool identical(no strings); literal audit has no candidates/errors
  • Full43U build and required DOL SHA1 pass

Partial source reconstruction only; no exact engine or complete-data claim. No Chinese, one-key, header or linking changes.

Parent validation baseline

Rebased and independently rebuilt on main 13881c99fb. Tested tree 004ba92020.
DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d. Worktree/diff checks pass. User requested decompilation first, matching next and linking last. No merge performed or requested by this author.

Note

Reconstruct alpha boundary and output expressions in Zi8AlphaGetCandidates

  • Rewrites several decompiled comparison and branch expressions in the candidate-generation path of zi8alpha.c to match the original binary.
  • Notable rewrites: suffix truncation now compares combined word/prefix length against the max, lookup-mode checks place the scan index on the left, the punctuation fallback uses an inclusive bound through 0xF010, and the prefix-selection threshold is <= 1.
  • Reorders the countOnly branches so the true arm clears letters and the false arm stores candidateCount.
  • Adds a report in allhands-ezitext-alpha-boundary-flow.attempts.md documenting the reconstruction results and validation.
  • Risk: none — expressions are semantically equivalent; object comparison was validated per the report.

Macroscope summarized f84c90f.

## Reconstruction Recover original operand order for suffix/dictionary bounds, inclusive punctuation/prefix limits, and the countOnly output branch's fallthrough. Source variables are integer lengths/indices; halfword dictionary-count narrowing is retained. The separate opposite-order length check is intentionally left unchanged. Target evidence: Zi8AlphaGetCandidates +0x25A8, +0x2948/+0x2978/+0x2990, +0x30F8, +0x3B08 and +0x3B84. No invented storage, register control, padding or ABI change. - Function:95.02813%→95.23011%;3946/3946 instructions - Unit:96.37759%→96.52474%;11/12 exact and5880/21664 exact code preserved - Matched data remains516/564; all allocated non-text bytes and normalized relocations unchanged, including the existing unmatched switch table - Only same-sized alpha .text changes among1027 source objects; no function/unit/data regressions - All11 exact functions retain ctxdiff zero; pool identical(no strings); literal audit has no candidates/errors - Full43U build and required DOL SHA1 pass Partial source reconstruction only; no exact engine or complete-data claim. No Chinese, one-key, header or linking changes. ## Parent validation baseline Rebased and independently rebuilt on main 13881c99fb2f3df970ea5c4308f0aaa063a931b1. Tested tree 004ba92020b2b10b23baa46cfaa4d441322bc67a. DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d. Worktree/diff checks pass. User requested decompilation first, matching next and linking last. No merge performed or requested by this author. <!-- 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] > ### Reconstruct alpha boundary and output expressions in `Zi8AlphaGetCandidates` > - Rewrites several decompiled comparison and branch expressions in the candidate-generation path of [zi8alpha.c](https://github.com/coah80/wii-ipl/pull/991/files#diff-d9d8f6044ba4883939783bcce6da08c5875ea20b0dd0f305b1d77e8601ec0654) to match the original binary. > - Notable rewrites: suffix truncation now compares combined word/prefix length against the max, lookup-mode checks place the scan index on the left, the punctuation fallback uses an inclusive bound through 0xF010, and the prefix-selection threshold is `<= 1`. > - Reorders the `countOnly` branches so the true arm clears letters and the false arm stores `candidateCount`. > - Adds a report in [allhands-ezitext-alpha-boundary-flow.attempts.md](https://github.com/coah80/wii-ipl/pull/991/files#diff-0cfe70facdc0bbd4e19aa212b7d6ba9cf2b4e5d6dc8f7011f43177b4361ea9e0) documenting the reconstruction results and validation. > - Risk: none — expressions are semantically equivalent; object comparison was validated per the report. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized f84c90f.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 23:37:33 +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.