decomp: reconstruct alpha restriction gates and suffix fallback #966

Merged
coah80 merged 1 commits from agent/bittle/alpha-reconstruction into main 2026-10-02 21:53:19 +00:00
coah80 commented 2026-10-02 21:52:19 +00:00 (Migrated from github.com)

Decompilation-first correction

Fixes five alpha-engine gates that tested completionAllowed instead of currentVowelRestriction, plus a retry condition that tested dictionaryKind instead of dictionaryIndex. Restores target-order suffix-lock/alternate-prefix fallback and language snapshot placement. No headers, helper prototypes, linking flags, metadata, data arrays, assembly or padding changes.

Target evidence

Variable identities are traced through definitions/uses, not assumed from equal stack offsets. Target table-31 bit-4 handling at +0x0798 clears current restriction in stack0x84/primary snapshot0x8C; bit-2 handling at +0x07C8 clears completion in0x88/0x90. Source slots are four bytes lower. The five gates at +0x2114,+0x2214,+0x32F4,+0x3384,+0x3664 read target0x84. Target +0x1430 uses dictionaryIndex at0x64 to load/store dictionaryKind at0x60; +0x3060 retry and subsequent increment use0x64. Parent independently checked these target instructions.

Fresh verification on 580b79f4

  • Zi8AlphaGetCandidates decompiled/fuzzy 92.01039% → 94.47314%; 3946/3946 instructions unchanged.
  • Unit decompiled/fuzzy 94.17892% → 95.97323%.
  • Existing 11/12 exact functions preserved; all 11 ctxdiff zero. Exact code 5880/21664 and data 516/564 unchanged. No report regressions.
  • All 1027 native objects audited: only alpha .text changes, size 21664 unchanged; all data and every other allocated object unchanged.
  • Pool 0/0 identical. Literal audit analyzes 12 functions, zero resolvable string arguments, no candidates/errors/skips (not a behavioral proof).
  • Full 43U all_source/progress/report/DOL passed SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
  • Tests workflow8/literal36/jump-table27/pool8, worktree checks and diff check pass.

Larger prototype/layout experiments with data-metric regressions are deliberately excluded. This is a focused semantic/control-flow reconstruction, not a new exact match or runtime equivalence proof. Remote tree6156e190a06db5c411d584eee4cca0e86c457b1a equals tested tree. Left for review; no merge performed.

Note

Fix alpha restriction gates and suffix fallback in Zi8AlphaGetCandidates

Reconstruction fix in zi8alpha.c. Zi8AlphaGetCandidates now gates dictionary qualification, suffix activation, suffix locking, and prefix-punctuation checks on the current vowel/punctuation restriction state instead of the completion-allowed state.

  • The dictionary retry loop now terminates on dictionaryIndex rather than the selected dictionary kind, and language-pass restoration picks primary or secondary restriction/completion values based on the current language.
  • The alternate-prefix fallback path resets its working state after applying an alternate prefix.
  • Adds a reconstruction report in allhands-ezitext-remainder.attempts.md covering the baseline comparison, six semantic corrections, rejected experiments, and build/hash validation.

Macroscope summarized bf32a72.

## Decompilation-first correction Fixes five alpha-engine gates that tested completionAllowed instead of currentVowelRestriction, plus a retry condition that tested dictionaryKind instead of dictionaryIndex. Restores target-order suffix-lock/alternate-prefix fallback and language snapshot placement. No headers, helper prototypes, linking flags, metadata, data arrays, assembly or padding changes. ## Target evidence Variable identities are traced through definitions/uses, not assumed from equal stack offsets. Target table-31 bit-4 handling at +0x0798 clears current restriction in stack0x84/primary snapshot0x8C; bit-2 handling at +0x07C8 clears completion in0x88/0x90. Source slots are four bytes lower. The five gates at +0x2114,+0x2214,+0x32F4,+0x3384,+0x3664 read target0x84. Target +0x1430 uses dictionaryIndex at0x64 to load/store dictionaryKind at0x60; +0x3060 retry and subsequent increment use0x64. Parent independently checked these target instructions. ## Fresh verification on 580b79f4 - Zi8AlphaGetCandidates decompiled/fuzzy 92.01039% → 94.47314%; 3946/3946 instructions unchanged. - Unit decompiled/fuzzy 94.17892% → 95.97323%. - Existing 11/12 exact functions preserved; all 11 ctxdiff zero. Exact code 5880/21664 and data 516/564 unchanged. No report regressions. - All 1027 native objects audited: only alpha .text changes, size 21664 unchanged; all data and every other allocated object unchanged. - Pool 0/0 identical. Literal audit analyzes 12 functions, zero resolvable string arguments, no candidates/errors/skips (not a behavioral proof). - Full 43U all_source/progress/report/DOL passed SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. - Tests workflow8/literal36/jump-table27/pool8, worktree checks and diff check pass. Larger prototype/layout experiments with data-metric regressions are deliberately excluded. This is a focused semantic/control-flow reconstruction, not a new exact match or runtime equivalence proof. Remote tree6156e190a06db5c411d584eee4cca0e86c457b1a equals tested tree. Left for review; 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] > ### Fix alpha restriction gates and suffix fallback in `Zi8AlphaGetCandidates` > Reconstruction fix in [zi8alpha.c](https://github.com/coah80/wii-ipl/pull/966/files#diff-d9d8f6044ba4883939783bcce6da08c5875ea20b0dd0f305b1d77e8601ec0654). `Zi8AlphaGetCandidates` now gates dictionary qualification, suffix activation, suffix locking, and prefix-punctuation checks on the current vowel/punctuation restriction state instead of the completion-allowed state. > - The dictionary retry loop now terminates on `dictionaryIndex` rather than the selected dictionary kind, and language-pass restoration picks primary or secondary restriction/completion values based on the current language. > - The alternate-prefix fallback path resets its working state after applying an alternate prefix. > - Adds a reconstruction report in [allhands-ezitext-remainder.attempts.md](https://github.com/coah80/wii-ipl/pull/966/files#diff-6b6794edfe7e4fe17f78973cd6a3eea311dfb70c24e3155d2dddda609eeccb01) covering the baseline comparison, six semantic corrections, rejected experiments, and build/hash validation. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized bf32a72.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 21:53:17 +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.