Skip to content

Match and link lbdvd, textdraw, sobjlib, and mndatadel - #3025

Merged
ribbanya merged 12 commits into
doldecomp:masterfrom
MarkMcCaskey:match-issue-2933
Aug 9, 2026
Merged

Match and link lbdvd, textdraw, sobjlib, and mndatadel#3025
ribbanya merged 12 commits into
doldecomp:masterfrom
MarkMcCaskey:match-issue-2933

Conversation

@MarkMcCaskey

@MarkMcCaskey MarkMcCaskey commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Working through some near matches from #2933. A lot of these are very hard but I got a few. I'll keep grinding on a few but the matches here can be merged whenever.

These cases are pushing the limits of what the tools can do but there's a clear path to being able to solve these problems.

@MarkMcCaskey MarkMcCaskey added the ai-assisted Utilizes a LLM to do the heavy lifting label Aug 8, 2026
@decomp-dev

decomp-dev Bot commented Aug 8, 2026

Copy link
Copy Markdown

Report for GALE01 (2800533 - 9de1965)

📈 Matched code: 85.32% (+0.16%, +6128 bytes)
📈 Linked code: 58.00% (+0.55%, +21476 bytes)
📈 Matched data: 88.04% (+0.00%, +8 bytes)
📈 Linked data: 56.94% (+0.47%, +5728 bytes)

✅ 6 new matches
Unit Item Bytes Before After
main/melee/mn/mndatadel .sbss +8 0.00% 100.00%
main/melee/mn/mndatadel mnDataDel_8024EA6C +6 98.45% 100.00%
main/melee/lb/lbdvd lbDvd_80018254 +5 99.69% 100.00%
main/melee/if/textdraw DevText_Draw +2 99.78% 100.00%
main/sysdolphin/baselib/sobjlib HSD_SObjLib_803A4A68 +2 99.95% 100.00%
main/melee/mn/mndatadel mnDataDel_8024FE4C +1 99.90% 100.00%
📈 1 improvement in an unmatched item
Unit Item Bytes Before After
main/melee/if/textdraw .sbss +6 81.82% 92.31%

Reorder the text-loop locals so MWCC preserves the target register webs while assigning stack objects in the original EABI frame order.

The stack allocator walks lexical compiler objects before finalizing the outgoing-argument, local, linkage, and save bands. Keeping color_ptr in the text scope preserves r31, while moving the addressed GXColor into the inner loop assigns it local+0x8 (SP+0x10). The dead function-scope index carrier takes local+0x18 (SP+0x20); cursor and background colors remain at SP+0x0c, +0x14, and +0x18, with the final frame unchanged at 0x90.

Verified DevText_Draw and DevText_DrawAll at 100% with GC/1.2.5n.
Promote TextDraw's split-unit globals so the original textlib.o can resolve the draw list, pool head, and menu allocator state from the reconstructed object. MWCC emits external zero-initialized objects in reverse declaration order, so declare the .sbss owners in reverse address order and retain the otherwise dead word at 0x804D6E3C as the second pool-head slot. This reproduces the original 0x38-byte small-BSS contribution and keeps the following allocator globals at 0x804D6E40, 0x804D6E44, 0x804D6E48, and 0x804D6E4C.

The DevText_Draw match itself depends on MWCC's lexical stack-object walk: the addressed inner-loop GXColor owns local+0x8 (SP+0x10), the dead function-scope carrier owns local+0x18 (SP+0x20), and cursor/background objects retain SP+0x0c, +0x14, and +0x18 in the 0x90-byte EABI frame. Register-web allocation remains exact across all twelve functions.

Verified all TextDraw functions at 100% and the full GALE01 DOL checksum.
Replace 0x18 bytes of dead named stack objects with two optimized-away by-value GXColor carriers. MWCC allocates each inline identity call as 0x0C bytes in the compiler-temporary stratum, so the pair moves the contiguous color-argument band from SP+0x1C..0x5C to the target SP+0x34..0x74 without emitting instructions or data.

Inlining the center calculations, CI predicate, and z-color expression removes the corresponding lexical objects plus PAD_STACK. The object-slot cursor therefore remains 0x80, the final EABI frame remains 0xC8, and all GPR/FPR save locations and register webs stay unchanged.

Verified every function and material section in sobjlib at 100% with GC/1.2.5n.
Promote sobjlib after verifying every function and material section at 100%. The final HSD_SObjLib_803A4A68 match preserves MWCC's 0x80-byte object-slot cursor and 0xC8 EABI frame by replacing 0x18 bytes of late lexical objects with 0x18 bytes of early compiler-generated by-value color temporaries.

Verified the linked GALE01 DOL checksum.
Reshape mnDataDel_8024EA6C around an explicit table iterator and an inline animation consumer. Passing the animation frame by value lets MWCC retain the ABI f1 call-result carrier as the long-lived f31 web instead of materializing f1 -> f0 -> f31, while passing &sp18 preserves the target stack-slot ownership and repeated SP+0x18 reloads. The saved-f30 set and 0x48 EABI frame remain unchanged.

Use a shared zero carrier and named byte cursor for mnDataDel_8024FE4C. This preserves the optimizer's slwi/add strength-reduction PCode and four-byte induction step while making the object-backed cursor web color to r24 rather than r25.

Verified every function plus .text, .data, .bss, .sdata, and .sdata2 in mndatadel at 100% with GC/1.2.5n.
Enable mndatadel as a matching object after verifying all functions and material sections at 100%. The two sbss definitions are declared in reverse source order so MWCC emits mnDataDel_804D6C68 before mnDataDel_804D6C6C at the target addresses.

Verified build/GALE01/main.dol against the target checksum.
@MarkMcCaskey MarkMcCaskey changed the title Work on near matches Match and link lbdvd, textdraw, sobjlib, and mndatadel Aug 9, 2026
@MarkMcCaskey
MarkMcCaskey marked this pull request as ready for review August 9, 2026 01:37
@ribbanya
ribbanya merged commit 013091a into doldecomp:master Aug 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Utilizes a LLM to do the heavy lifting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants