match(kbd): reconstruct synchronous LED command reservation #988

Merged
coah80 merged 1 commits from agent/bittle/kbd-sync-reservation into main 2026-10-02 23:29:15 +00:00
coah80 commented 2026-10-02 23:28:02 +00:00 (Migrated from github.com)

Scope

Reconstruct KBDSetLeds using bounded signed array indexing and an indexed reservation loop. Preserve interrupt boundaries, error handling and the asynchronous helper. Channel is checked below 4; the reservation ordinal is bounded below 12. The signed source forms are inferred from natural C lowering, not uniquely recovered original declarations.

Independent verification

Rebuilt against main b26e248bb0e08308371ff5f23c7c49b705e955ca; tested tree 58b7c8ee99.

  • KBDSetLeds: 84.6076% → 100%; ctxdiff 79/79 instructions, zero differences
  • kbd_lib: 15 → 16/21 exact functions; exact code 3088 → 3404/5764 bytes; fuzzy 97.70437% → 98.54823%
  • Data remains 5296/5296 exact; all allocated non-text bytes and normalized relocations unchanged
  • All 1027 source objects compared: only kbd_lib .text changed; all project function/unit metrics nonregressing
  • Pool identical (no strings); literal audit passed; workflow/literal/jump-table/pool tests: 8/36/27/8 passed
  • Full 43U all_source, progress, report and DOL build pass; SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
  • Worktree checks and diff check pass; terminal completion assertion still correctly fails on the remaining project work

No linking/configuration change. User requested decompilation first; this focused source reconstruction also achieves an exact function. No merge requested or performed by this author.

Note

Rebuild KBDSetLeds LED command reservation scan in kbd_lib.c

Rewrites KBDSetLeds in kbd_lib.c to read the channel flags directly instead of using the channel-flag helper, and to scan the command buffer with indexed array access instead of pointer iteration. The 12-entry scan, device assignment, interrupt protection, LED submission, and buffer cleanup behavior are unchanged.

  • Risk: direct flags access in KBDSetLeds must match the flag layout the removed helper enforced; check the channel record's flags field if LED state regresses.

Macroscope summarized abca0cd.

## Scope Reconstruct KBDSetLeds using bounded signed array indexing and an indexed reservation loop. Preserve interrupt boundaries, error handling and the asynchronous helper. Channel is checked below 4; the reservation ordinal is bounded below 12. The signed source forms are inferred from natural C lowering, not uniquely recovered original declarations. ## Independent verification Rebuilt against main b26e248bb0e08308371ff5f23c7c49b705e955ca; tested tree 58b7c8ee997be3430b40b3bc61c32e9afd53db03. - KBDSetLeds: 84.6076% → 100%; ctxdiff 79/79 instructions, zero differences - kbd_lib: 15 → 16/21 exact functions; exact code 3088 → 3404/5764 bytes; fuzzy 97.70437% → 98.54823% - Data remains 5296/5296 exact; all allocated non-text bytes and normalized relocations unchanged - All 1027 source objects compared: only kbd_lib .text changed; all project function/unit metrics nonregressing - Pool identical (no strings); literal audit passed; workflow/literal/jump-table/pool tests: 8/36/27/8 passed - Full 43U all_source, progress, report and DOL build pass; SHA1 26116613f624061ba99c8d1a299aaa6efa85670d - Worktree checks and diff check pass; terminal completion assertion still correctly fails on the remaining project work No linking/configuration change. User requested decompilation first; this focused source reconstruction also achieves an exact function. No merge requested or performed by this author. <!-- 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] > ### Rebuild `KBDSetLeds` LED command reservation scan in `kbd_lib.c` > Rewrites `KBDSetLeds` in [kbd_lib.c](https://github.com/coah80/wii-ipl/pull/988/files#diff-9b4466637323b1279a5587265ed5aac8d7603bf7a136d97819b8fbaa2b68be5f) to read the channel flags directly instead of using the channel-flag helper, and to scan the command buffer with indexed array access instead of pointer iteration. The 12-entry scan, device assignment, interrupt protection, LED submission, and buffer cleanup behavior are unchanged. > - Risk: direct flags access in `KBDSetLeds` must match the flag layout the removed helper enforced; check the channel record's flags field if LED state regresses. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized abca0cd.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 23:29:13 +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.