Decompile hardware keyboard character conversion #703

Merged
coah80 merged 1 commits from agent/bittle/hw-character-cpp into main 2026-10-02 00:54:12 +00:00
coah80 commented 2026-10-02 00:52:37 +00:00 (Migrated from github.com)

Replace HWKeyboard::convertWCCode assembly with C++ Japanese/Chinese punctuation switches. The compiler now generates the switch table naturally, so remove the hand-authored 63-entry function-address/addend array. Keep the existing explicit vtable bytes/relocations unchanged, moving that declaration after the switch so generated data has the original order.

Shared header: add a private const mgr() overload returning const Manager*, allowing the original const virtual getters. No field/layout/virtual-order change. Quote selection uses normal if/return paths, not assembly or register tricks.

Fresh verification on 426555a3:

  • convertWCCode: 131/131 instructions, ctxdiff 0 (524 bytes converted to C++)
  • Explicit jump_table_diff --table scHwKeyboardConvertWCCodeJumpTable: 63/63 destinations/addends exact; automatic selection alone would skip this custom-named table
  • Entire .data: 288/288 bytes and all 70 relocations identical
  • Unit stays 10/10 code-exact and fully linked
  • Deleted all source objects and rebuilt after header change; every unit/global report measure identical to fresh main, zero regressions
  • Full all_source/progress/report/ok passes; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
  • Workflow tests 7/7, pool tests 8/8, jump-table tests 20/20, worktree/diff checks pass
  • Previously disclosed local ctxdiff compatibility adapter used
  • Remote tree 85a2d44767 equals tested local tree

No score increase claimed: prior assembly was already exact. Existing unit data-report discrepancy from #698 remains; no symbol-size/address edits or artificial padding. Independent of #701's input-dispatch conversion. Left for Cole's review and merge.

Note

Replace hand-written PPC assembly with C++ in HWKeyboard::convertWCCode

  • Rewrites the hardware keyboard character conversion in tiHwKeyboard.cpp as a C++ method, replacing the 0x3f-entry assembly jump table. Case selection now lives in the method body.
  • Keeps the QWERTY/PC-keyboard mode checks, JP and CN punctuation mappings, state-dependent quote handling, and fallback to the original character.
  • Adds a const manager accessor in tiHwKeyboard.h so const methods can reach the manager.
  • Behavioral Change: the vtable entries are unchanged, but the vtable definition is reordered after the new method.

Macroscope summarized 91a76ae.

Replace HWKeyboard::convertWCCode assembly with C++ Japanese/Chinese punctuation switches. The compiler now generates the switch table naturally, so remove the hand-authored 63-entry function-address/addend array. Keep the existing explicit vtable bytes/relocations unchanged, moving that declaration after the switch so generated data has the original order. Shared header: add a private const mgr() overload returning const Manager*, allowing the original const virtual getters. No field/layout/virtual-order change. Quote selection uses normal if/return paths, not assembly or register tricks. Fresh verification on 426555a3: - convertWCCode: 131/131 instructions, ctxdiff 0 (524 bytes converted to C++) - Explicit jump_table_diff --table scHwKeyboardConvertWCCodeJumpTable: 63/63 destinations/addends exact; automatic selection alone would skip this custom-named table - Entire .data: 288/288 bytes and all 70 relocations identical - Unit stays 10/10 code-exact and fully linked - Deleted all source objects and rebuilt after header change; every unit/global report measure identical to fresh main, zero regressions - Full all_source/progress/report/ok passes; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d - Workflow tests 7/7, pool tests 8/8, jump-table tests 20/20, worktree/diff checks pass - Previously disclosed local ctxdiff compatibility adapter used - Remote tree 85a2d447675c90e7acd830d56d767fa947980a6a equals tested local tree No score increase claimed: prior assembly was already exact. Existing unit data-report discrepancy from #698 remains; no symbol-size/address edits or artificial padding. Independent of #701's input-dispatch conversion. Left for Cole's review and merge. <!-- 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] > ### Replace hand-written PPC assembly with C++ in `HWKeyboard::convertWCCode` > - Rewrites the hardware keyboard character conversion in [tiHwKeyboard.cpp](https://github.com/coah80/wii-ipl/pull/703/files#diff-8cb43f83ff067681621db42405d3d111f67a100a45a59f5de0c354bbb8857879) as a C++ method, replacing the 0x3f-entry assembly jump table. Case selection now lives in the method body. > - Keeps the QWERTY/PC-keyboard mode checks, JP and CN punctuation mappings, state-dependent quote handling, and fallback to the original character. > - Adds a const manager accessor in [tiHwKeyboard.h](https://github.com/coah80/wii-ipl/pull/703/files#diff-69fa1d2d9d3ac165f31d7b6cbcad709704a966e41e619b31d83d17f75941c9cd) so const methods can reach the manager. > - Behavioral Change: the vtable entries are unchanged, but the vtable definition is reordered after the new method. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 91a76ae.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 00:54: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.