Skip to content

Grind main/menu_letter: 95.90% -> 95.97% (structural)#17667

Merged
asmithbot merged 2 commits into
mainfrom
pr/menu_letter/emp29
Jun 14, 2026
Merged

Grind main/menu_letter: 95.90% -> 95.97% (structural)#17667
asmithbot merged 2 commits into
mainfrom
pr/menu_letter/emp29

Conversation

@asmithbot

Copy link
Copy Markdown
Collaborator

Two faithful structural fixes to main/menu_letter, verified against the Ghidra ground truth (resources/ghidra-decomp-1-31-2026).

LetterLstBaseDraw: !(param_1 < e8) form (96.37% -> 96.66%, misalign 6 -> 4)

Ghidra 8016398c shows if (DOUBLE_803330e8 <= param_1) compiling to
fcmpo cr0, e8, param; cror eq, lt, eq; bne with the constant kept on the
left. Our param_1 >= DOUBLE_803330e8 canonicalized to a plain blt with
operands swapped. Rewriting as !(param_1 < DOUBLE_803330e8) (value-identical)
preserves the target's operand order and the cror+bne idiom.

LetterListDraw: icon loop reloads topIndex (91.85% -> 92.35%, misalign 23 -> 21)

Ghidra 80165554 line 153 reloads sVar1 from *(short*)(field_0x82c + 0x34)
immediately before the attachment-icon loop, rather than reusing the topRow
CSE from m_singMenuState->topIndex. Added a branch-local reload
(iconTopRow = *(s16*)(GetLetterStateBase+0x34)), matching the original.

Result

Unit fuzzy_match_percent 95.90219 -> 95.97173. No function regressed; total
misalign 129 -> 125. Remaining divergences are mwcc-internal dead-ends
(int->double-bias anonymous pool, entries[n++] index-materialize scheduling,
andc-vs-nor+andi instruction selection, cntlzw equality-materialize, prologue
register coloring).

🤖 Generated with Claude Code

zcanann and others added 2 commits June 14, 2026 12:55
…>96.66)

Ghidra 8016398c LetterLstBaseDraw shows `if (DOUBLE_803330e8 <= param_1)`
compiling to `fcmpo cr0, e8, param; cror eq, lt, eq; bne` (constant kept on
the left). Our `param_1 >= DOUBLE_803330e8` canonicalized to a plain `blt`
with operands swapped. Writing it as `!(param_1 < DOUBLE_803330e8)` (value-
identical) preserves the target's operand order and cror+bne, dropping
misalign 6->4 and unit fuzzy 95.90219->95.92841.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
….35)

Ghidra 80165554 LetterListDraw line 153 reloads sVar1 from
*(short*)(field_0x82c + 0x34) immediately before the attachment-icon loop,
rather than reusing the topRow CSE from m_singMenuState->topIndex. Adding a
branch-local reload (iconTopRow = *(s16*)(GetLetterStateBase+0x34)) drops
misalign 23->21 and unit fuzzy 95.92841->95.97173.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@decomp-dev

decomp-dev Bot commented Jun 14, 2026

Copy link
Copy Markdown

Report for GCCP01 (3a718db - 3ee4cfc)

📈 2 improvements in unmatched items
Unit Item Bytes Before After
main/menu_letter CMenuPcs::LetterListDraw() +8 92.25% 92.75%
main/menu_letter CMenuPcs::LetterLstBaseDraw(float) +4 97.04% 97.33%

@asmithbot asmithbot merged commit 89a01de into main Jun 14, 2026
2 checks passed
@asmithbot asmithbot deleted the pr/menu_letter/emp29 branch June 14, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants