decomp: reconstruct one-key phonetic and result widths #985

Merged
coah80 merged 1 commits from agent/bittle/onekey-boundaries into main 2026-10-02 23:10:11 +00:00
coah80 commented 2026-10-02 23:09:25 +00:00 (Migrated from github.com)

Restores the target's halfword key formal, explicit byte-result boundaries, ordinal-width decoding and final output cursor consumption. The helper itself stays native instruction-exact; all known source callers are in this unit. No shared header or other eZiText source change.

Parent checked six pre-call halfword normalizations, byte narrowing after Zi8GetZHuwdPtr (+0x1E00), ordinal narrowing (+0x1E44), and terminal indexed store/increment (+0x2524..+0x2534) against target instructions.

  • Candidate function: 95.39716% → 96.41927%; source 2387 → 2405 instructions versus target 2397, still non-exact.
  • Unit decompiled/fuzzy: 97.778564% → 98.23523%; exact 5/9, code 3952 and data 1280/1388 preserved. All five exact functions remain ctxdiff zero.
  • Spelling/data arrays and all 11 switch relocations unchanged/exact. The already-unmatched 108-byte extabindex changes its candidate size word 0x254C → 0x2594, versus target 0x2574; same two differing bytes and section score. This is changed unmatched metadata, not an all-data-bytes-unchanged claim.
  • Only one-key text and that extent word change across 1027 objects. Pool 0/0 identical. Literal audit analyzes 7 functions and explicitly skips two unequal-size functions; no candidates/errors, zero string arguments.
  • Remote tree 0351aa4ae3 equals tested tree. No new exact match claimed.

Fresh independent verification on 5a222cde: full 43U all_source/progress/report/DOL passes SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; every unit/function report and all 1027 allocated objects audited with no score regressions. Workflow/literal/jump-table/pool tests 8/36/27/8, worktree checks and base-relative diff checks pass. No linking flags, fabricated padding, forced registers/volatile or new assembly. Partial decompilation progress, not full exact completion. Left for review; no merge performed.

Note

Reconstruct one-key phonetic and result widths in zi81key.c

  • Narrows Zi8IsMatch1Key's key parameter from Zi8UInt to ziU16 and removes the now-redundant low-16-bit masks before zero testing and spelling lookup
  • Adds explicit ziU8 casts to the duplicate and user-dictionary checks in Zi8Get1KeyPressCandidates, so those conditions now test only the low 8 bits of each helper result
  • Narrows the masked user-entry ordinal to ziU16 before shifting, and rewrites final zero termination as a postfix-indexed output store
  • Adds an investigation record in allhands-ezitext-onekey-boundaries.attempts.md covering the reconstruction trials and validation metrics
  • Risk: the ziU8 casts in Zi8Get1KeyPressCandidates mean a nonzero helper result whose low byte is zero no longer satisfies the duplicate/availability checks in zi81key.c

Macroscope summarized a0f69f6.

Restores the target's halfword key formal, explicit byte-result boundaries, ordinal-width decoding and final output cursor consumption. The helper itself stays native instruction-exact; all known source callers are in this unit. No shared header or other eZiText source change. Parent checked six pre-call halfword normalizations, byte narrowing after Zi8GetZHuwdPtr (+0x1E00), ordinal narrowing (+0x1E44), and terminal indexed store/increment (+0x2524..+0x2534) against target instructions. - Candidate function: 95.39716% → 96.41927%; source 2387 → 2405 instructions versus target 2397, still non-exact. - Unit decompiled/fuzzy: 97.778564% → 98.23523%; exact 5/9, code 3952 and data 1280/1388 preserved. All five exact functions remain ctxdiff zero. - Spelling/data arrays and all 11 switch relocations unchanged/exact. The already-unmatched 108-byte extabindex changes its candidate size word 0x254C → 0x2594, versus target 0x2574; same two differing bytes and section score. This is changed unmatched metadata, not an all-data-bytes-unchanged claim. - Only one-key text and that extent word change across 1027 objects. Pool 0/0 identical. Literal audit analyzes 7 functions and explicitly skips two unequal-size functions; no candidates/errors, zero string arguments. - Remote tree 0351aa4ae3b123a19a87730a5cc229d572451b35 equals tested tree. No new exact match claimed. Fresh independent verification on 5a222cde: full 43U all_source/progress/report/DOL passes SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; every unit/function report and all 1027 allocated objects audited with no score regressions. Workflow/literal/jump-table/pool tests 8/36/27/8, worktree checks and base-relative diff checks pass. No linking flags, fabricated padding, forced registers/volatile or new assembly. Partial decompilation progress, not full exact completion. 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] > ### Reconstruct one-key phonetic and result widths in `zi81key.c` > - Narrows `Zi8IsMatch1Key`'s key parameter from `Zi8UInt` to `ziU16` and removes the now-redundant low-16-bit masks before zero testing and spelling lookup > - Adds explicit `ziU8` casts to the duplicate and user-dictionary checks in `Zi8Get1KeyPressCandidates`, so those conditions now test only the low 8 bits of each helper result > - Narrows the masked user-entry ordinal to `ziU16` before shifting, and rewrites final zero termination as a postfix-indexed output store > - Adds an investigation record in [allhands-ezitext-onekey-boundaries.attempts.md](https://github.com/coah80/wii-ipl/pull/985/files#diff-9923ce4e44523e33f61fe4cd1a0795b39135d6f583695c81be4702e5edccfa75) covering the reconstruction trials and validation metrics > - Risk: the `ziU8` casts in `Zi8Get1KeyPressCandidates` mean a nonzero helper result whose low byte is zero no longer satisfies the duplicate/availability checks in [zi81key.c](https://github.com/coah80/wii-ipl/pull/985/files#diff-e13aedc7fb9c3007bc73ac5925316020807c84746d598f7e90ff55594c2800ea) > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized a0f69f6.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 23:10:09 +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.