Compare commits

...

1 Commits

Author SHA1 Message Date
devin
fcd8b7f43f match(tiPcKeyboard): Base::setTranslateMode byte-identical
keyMode must be uninitialized: for mode outside {0,1,2} the switch
leaves it unset and retail provably reads the uninitialized register
(cmplw r31,r0 at 0xd6c executes with r31 never stored). Initializing
keyMode = mode changes the dispatch to an extra branch. Same accepted
uninitialized-read pattern as set_err_msg.

Also documents two probe results in tools/decomp-assist attempts files
(iplSetting scanAP inlined-bool materialization wall; tiString inputChar
indexed-store/dead-compare fossil).

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-08 22:04:16 +00:00
3 changed files with 28 additions and 1 deletions

View File

@@ -1610,7 +1610,7 @@ namespace textinput {
}
void Base::setTranslateMode(TranslateMode mode) {
u32 keyMode = mode;
u32 keyMode;
switch (mode) {
case TM_Direct:
keyMode = 0;

View File

@@ -0,0 +1,14 @@
## scanAP (w1010 revisit) — inlined-bool materialization wall
Orig inlines `Animator::isPlaying()` (`mState == 1` at +0x14) 3x but always as a
MATERIALIZED bool: `lwz rX,0x14; addi r0,rX,-1; cntlzw r0,r0; rlwinm. r0,r0,27,5,31; bne`.
Ours fuses to `lwz r0,0x14; cmpwi r0,1; beq` — 6 insns shorter overall (272 vs 266).
Tried and rejected (MWCC normalizes/folds all of them):
- `isPlaying() == false` at the call site
- `bool playing = anim->isPlaying(); if (!playing)` named local (fuses; eggColorFader's
fadeOut materializes only because `success` is also RETURNED — a second value-use)
- `int isPlaying()` return type — still fuses
- `return !(mState != ANIM_STATE_PLAY)` in the header — still fuses
Conclusion: orig's bool crosses a real value-boundary (2nd use, or a different inlined
shape we haven't identified). Same family as the fused-compare fossil in CHANSVm.
Also tried: convertRevIP untouched (98.7, 292B).

View File

@@ -15,3 +15,16 @@ Initial reconstruction uses the sibling tiString and tiUtil headers, real member
## character predicates
The sibling util declarations return bool, while target callers normalize an integer result. Guarded u32 declarations preserve every other translation unit and make all three predicates 16/16 with zero differences.
## inputChar (w1010 orchestrator probe) — indexed-store + dead-compare fossil
Orig mode==3 block (this->0x24==3) emits: `sth r6,0x10` (input[0]=0, r6=0 reused as
value), `cmplwi r4,0xa` (DEAD compare — no branch consumes it), then indexed stores
`slwi r0,r6,1; sthx r4,buf,r0; addi r6,1; slwi r0,r6,1; clrlwi r29,r6,0x10; sthx r5,buf,r0`
= input[i]=ch; i++; input[i]=0 with the index kept SYMBOLIC despite li i,0.
Ours: direct-offset `sth r4,0x10; li r29,1; sth r5,0x12` (125 vs 136 insns).
Tried: `input[i]=ch; i++; input[i]=0; count=i` — MWCC constant-folds i to 0,
re-emits direct offsets. Index must be runtime-opaque in orig (loop bound from a
call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documented
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
clrlwi (u16) — count is i.
Unresolved: what source produces symbolic-index stores + dead compare.