Repository navigation
overlay: three Veldin 2 functions - #172
Merged
mateuszklysz merged 3 commits intoOct 13, 2026
Merged
Conversation
FUN_L18_002d82c0, from the rac1-decomp draft (ported from rac1-decomp). Case 3 writes its scaled rate to a new variable and case 5 uses its own ratio variable with each gravity arm spelled out in full, which cross-jumps into retail's shared tail.
FUN_L18_002f0390 in exact C. The moby search is a goto loop (no loop notes, so the *p reload stays in the loop as retail), and the draw loop uses its own counter so it gets a separate register from the build loop.
FUN_L18_002fc100 in exact C. D_L18_0015F5C4 and D_L18_0015F5CC stay plain externs: retail reads them only in branch delay slots, where the assembler (nomacro) goes through $gp anyway, so no sda declaration is needed and the lui accesses in the rest of the file stay as they are.
Report for SCUS_971.99 (e934c0a - b936470)📈 Matched code: 86.63% (+0.08%, +2908 bytes) ✅ 3 new matches
|
Decompilation progress
3 newly matched functions (2,908 B)
Compared with main (e934c0a). C_FUZZY uses main's last measurement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
Three pending Veldin 2 (level 18) functions.
FUN_L18_002d82c0FUN_L18_002fc100FUN_L18_002f0390After
All three are exact (2,908 bytes). One commit per function, each gated, and the branch gated again on current main (#171).
Things worth a look
FUN_L18_002d82c0is ported from rac1-decomp's nonmatching draft (nonmatching/l18_veldin2/func_L18_002D96B0.c), with the usualPorted fromcomment, then finished here: case 3 keeps the scaled rate in its own variable (reusingtswapped the multiply's operands), and case 5 gets its own ratio and writes each gravity arm out in full, which gives retail's shared tail and registers.FUN_L18_002fc100needed no file split. Retail readsD_L18_0015F5C4/D_L18_0015F5CConly in branch delay slots, where the assembler (nomacro) can't expand a lui+lw and goes through$gpwithout a known size. So both stay plain externs with nosdaattribute, and the other functions in the file keep their lui accesses. The rest ports the old exact draft onto decomp: recover names for functions, globals and struct fields #165's names (glow_color,collision,hit_slot); its extern is now(struct Moby *), with a cast at theFUN_L18_002fbb98call site.FUN_L18_002f0390follows upstream'sFUN_L18_002f1fd8(struct GeometryQuad quads[16], plain for loops). The moby search is a goto loop, like the matchedFUN_L16_002ceca8, which keeps the*preload inside the loop for the branch delay slot; the draw loop gets its own counter; the colour argument isi + 1 - (j >> 1).Verification
make elfends withPASS: reconstructed boot ELF matches retailmake overlaysends withPASS: all 2782 overlay functions in C match retail, with their 17232 copies in other placesmake checkpasses