fix(keyboard): declare KPRPutChar byte return #1044

Merged
coah80 merged 1 commits from agent/bittle/kpr-return-review into main 2026-10-03 04:49:22 +00:00
coah80 commented 2026-10-03 04:47:41 +00:00 (Migrated from github.com)

One-line source contract correction

The local KPRPutChar declaration in tiString.cpp says u32, while the actual SDK implementation returns u8 queue->oCount. Correct only the return declaration to u8; preserve both explicit &0xff masks and every argument/body.

The exact original callee is 74/74 instructions. Its sole normal return after OSRestoreInterrupts is lbz r3,0x10(r29) at function+0x10c. Both inputChar call sites pass queue/character in r3/r4 and narrow the byte result. No fuzzy gain is claimed.

Independent verification

Rebased on e58cd9e734b5b17759df9ddb29713eb9870ab092; tested tree 936eebc991.

  • Full43U all_source/progress/report/DOL build passed
  • tiString.o is byte-identical to fresh main; all1,027 report units unchanged
  • All1,027 allocated object payloads and canonical relocations unchanged
  • Unit41/42 exact,4632/5176 matched code,288/288 matched data preserved
  • SDK kpr_lib all9 functions independently zero-difference against original
  • Pool0/0; literal check41 functions, no arguments/candidates/errors; inputChar unequal extent explicitly skipped
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
  • Worktree and diff checks pass

The remaining inputChar structural mismatch is unresolved. The wchar_t character spelling and separate tiInputForm declarations are outside this focused patch; wchar_t/u16 are both unsigned16-bit with compatible target ABI, but distinct C++ types. No linking flags changed.

Note

Fix KPRPutChar declaration to return u8 instead of u32

Changes the declared return type of the KPRPutChar C linkage function in tiString.cpp from u32 to u8. Parameters and C linkage stay the same. Risk: callers compiled against this declaration now read the result as an 8-bit value instead of 32-bit.

Macroscope summarized e359695.

## One-line source contract correction The local KPRPutChar declaration in tiString.cpp says u32, while the actual SDK implementation returns u8 queue->oCount. Correct only the return declaration to u8; preserve both explicit &0xff masks and every argument/body. The exact original callee is 74/74 instructions. Its sole normal return after OSRestoreInterrupts is lbz r3,0x10(r29) at function+0x10c. Both inputChar call sites pass queue/character in r3/r4 and narrow the byte result. No fuzzy gain is claimed. ## Independent verification Rebased on e58cd9e734b5b17759df9ddb29713eb9870ab092; tested tree 936eebc9915e796337423d31841cb02de6ce6a23. - Full43U all_source/progress/report/DOL build passed - tiString.o is byte-identical to fresh main; all1,027 report units unchanged - All1,027 allocated object payloads and canonical relocations unchanged - Unit41/42 exact,4632/5176 matched code,288/288 matched data preserved - SDK kpr_lib all9 functions independently zero-difference against original - Pool0/0; literal check41 functions, no arguments/candidates/errors; inputChar unequal extent explicitly skipped - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d - Worktree and diff checks pass The remaining inputChar structural mismatch is unresolved. The wchar_t character spelling and separate tiInputForm declarations are outside this focused patch; wchar_t/u16 are both unsigned16-bit with compatible target ABI, but distinct C++ types. No linking flags 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] > ### Fix `KPRPutChar` declaration to return `u8` instead of `u32` > Changes the declared return type of the `KPRPutChar` C linkage function in [tiString.cpp](https://github.com/coah80/wii-ipl/pull/1044/files#diff-b0b3ca27efcd4fe55f30676c8737d0c1b91c4b7560c379e044a7eb98ccc12036) from `u32` to `u8`. Parameters and C linkage stay the same. Risk: callers compiled against this declaration now read the result as an 8-bit value instead of 32-bit. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized e359695.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 04:49:20 +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.