decomp(keyboard): reconstruct literal-input output lifetime #1060

Merged
coah80 merged 1 commits from agent/bittle/keyboard-builder-review into main 2026-10-03 05:54:10 +00:00
coah80 commented 2026-10-03 05:52:07 +00:00 (Migrated from github.com)

Partial reconstruction

Represent mode-3 input construction with a private CharacterOutput builder that owns its used output cursor/count: initialize, append the existing character, terminate and return length. Other translation modes, Kana processing, selection replacement and cursor updates are unchanged. No newline branch, unused state or forced noinline boundary is introduced.

  • inputChar: 90.132355% → 90.757355%; 125 → 126 instructions versus original 136, frame remains 0x30
  • Unit: 98.962906% → 99.028595%
  • All 41 exact functions and 288/288 data bytes preserved

The added instruction materializes a local zero for termination/preview clearing. The target's initial-NUL/dynamic-index operations still do not reappear; ten target instructions remain missing. This is a small supported partial lifetime reconstruction, not a recovered complete converter or exact match.

Independent verification

Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree 98a30103e1.

  • Full 43U build/progress/report/DOL passed; complete 1,027-unit report changes only inputChar fuzzy, no regressions
  • 3,407,872 production-body source-equivalence scenarios: all 65,536 UTF-16 values, eight mode classes, both selection paths and representative Kana queues; NUL/newline/0xfffe outputs, counts and call traces preserved
  • Deterministic mocks exercise queue lengths 0..4 and both look-ahead outcomes; this is source-level equivalence, not Wii runtime execution
  • All 41 exact functions independently checked; all other emitted function bodies, allocated data and data relocations unchanged
  • Pool empty/identical; literal audit 41 functions, no candidates/errors; inputChar unequal extent explicitly skipped
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass

No headers, linking flags, compiler settings or other regions changed.

Note

Reconstruct literal-input output buffer handling in tiString.cpp

Replaces the direct single-character buffer assignment in Decolated::inputChar (translate mode 3) with an anonymous CharacterOutput helper class. The helper initializes a wide-character output buffer, appends characters while tracking the write count, and terminates the buffer. Character, terminator, and count values are unchanged. Risk: the new output lifetime in tiString.cpp should be checked for correctness of buffer termination and count tracking.

Macroscope summarized a36e8b6.

## Partial reconstruction Represent mode-3 input construction with a private CharacterOutput builder that owns its used output cursor/count: initialize, append the existing character, terminate and return length. Other translation modes, Kana processing, selection replacement and cursor updates are unchanged. No newline branch, unused state or forced noinline boundary is introduced. - inputChar: 90.132355% → 90.757355%; 125 → 126 instructions versus original 136, frame remains 0x30 - Unit: 98.962906% → 99.028595% - All 41 exact functions and 288/288 data bytes preserved The added instruction materializes a local zero for termination/preview clearing. The target's initial-NUL/dynamic-index operations still do not reappear; ten target instructions remain missing. This is a small supported partial lifetime reconstruction, not a recovered complete converter or exact match. ## Independent verification Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree 98a30103e1e1911badfae8988109fc8ca30ef361. - Full 43U build/progress/report/DOL passed; complete 1,027-unit report changes only inputChar fuzzy, no regressions - 3,407,872 production-body source-equivalence scenarios: all 65,536 UTF-16 values, eight mode classes, both selection paths and representative Kana queues; NUL/newline/0xfffe outputs, counts and call traces preserved - Deterministic mocks exercise queue lengths 0..4 and both look-ahead outcomes; this is source-level equivalence, not Wii runtime execution - All 41 exact functions independently checked; all other emitted function bodies, allocated data and data relocations unchanged - Pool empty/identical; literal audit 41 functions, no candidates/errors; inputChar unequal extent explicitly skipped - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass No headers, linking flags, compiler settings or other regions changed. <!-- 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 literal-input output buffer handling in `tiString.cpp` > Replaces the direct single-character buffer assignment in `Decolated::inputChar` (translate mode 3) with an anonymous `CharacterOutput` helper class. The helper initializes a wide-character output buffer, appends characters while tracking the write count, and terminates the buffer. Character, terminator, and count values are unchanged. Risk: the new output lifetime in [tiString.cpp](https://github.com/coah80/wii-ipl/pull/1060/files#diff-b0b3ca27efcd4fe55f30676c8737d0c1b91c4b7560c379e044a7eb98ccc12036) should be checked for correctness of buffer termination and count tracking. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized a36e8b6.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 05:54:08 +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.