Repository navigation
overlay: match five level functions, apply Naming Desk names and define level data - #212
Merged
Merged
Conversation
The NON_MATCHING draft missed by one float register. The rac1-decomp order fixes it: 0.2f in a local set before the if, the 0x40 store before the 0x44 store, the height sum stored before the state byte.
No code reaches these spans by address; they are zero in all 19 levels, so each is one label-named array in level_globals.c with a data.tsv row (53,636 bytes, checked in every level).
…them
Each object starts at an address code reaches and ends at the next one;
every function that reaches it lives in one src/overlays file, so the
object is defined there (label name, element type from the access width,
section(".data") for 8 bytes or less). 477,156 bytes, all zero in retail,
checked by make overlays.
Each was an unsized extern that only one file reads. Its size is the span to the next address code reaches, in whole elements of the declared type; data-refs.py --emit wrote the values (pointers as symbols). Objects whose extern sits in a NON_MATCHING draft are defined after the draft. 284,209 bytes, checked by make overlays.
Their externs were unsized; the sizes came from the span to the next address code reaches, which docs/code-cleanup.md forbids (never guess a size), and 88 of them were byte arrays. The data stays in assembly.
Each span was sized from the gap to the next symbol and may hold several variables; shared data stays in assembly.
2,936 zero objects whose length came from the gap to the next symbol, or whose type was unknown (u8), go back to assembly. The 2,377 kept ones take their type from the reading code and are one element, so no size is guessed.
…unsized array Each sat a few bytes past a label the code reads as an array of unknown size, so it may be an element of that array rather than its own variable.
Three meshes of 68, 46 and 88 vertices: source positions and UVs, then the moved positions, UVs and colours; each table ends where the next begins.
Face counts come from the draw loops (864, 58, 50); vertex and UV counts are one more than the largest index in each face table, and every table ends where the next one starts. The per-face vectors are float[4], not bytes.
end_display, read_buf_end_get and the VIF1 DMA handler were byte-exact, but the report could not pair them with the expected objects (ClearStageStateFlag, GetStateTableWord, func_00233E00), so they counted as unmatched.
A raw-word oracle had no relocation for a jal to a function of the same unit, so a recursive call differed from our object only in its relocation and the function never counted as matched.
The renames gave two prototypes of one function different types, so the NON_MATCHING drafts in five files stopped compiling. The snagglebeast update draft also comes closer to retail.
Two plain loops replace the pointer-walking draft. The HUD draft for FUN_L05_00266320 drops its pointer trick at the same distance.
…N_L00_00249d80, FUN_L05_00266320)
Decompilation progress
6 newly matched functions (4,316 B)
Compared with main (d893976). C_FUZZY uses main's last measurement. |
mateuszklysz
marked this pull request as ready for review
October 17, 2026 22:43
…wrap Level-suffixed and _cf aliases bound to other functions go back to the retail labels, as do class update names two functions in one level shared. FUN_L00_0025e310 wraps an angle into -pi..pi, so it becomes normalize_angle.
tick_countdown_32 and vec_len_xy spread by the naming pass become fast_dec_timer (the unit's own file name) and vector_length_xy, the names most files already use. Two hero_set_state lines go back to the plain label so the non-matching drafts compile.
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
Several level functions were still retail asm (INCLUDE_ASM): the trackdrive pickup update, the hero update with the vehicle mode 3 glow, the walloper beam reset, the menu icon cache lookup and a HUD counter. Hundreds of symbols still had
FUN_/D_names that the Naming Desk had already settled. Most zero-filled level data had no C definition, anddmaRefImagehad no source.After
FUN_L02_002ea210(trackdrive pickup update),FUN_L01_00228000(hero update),FUN_L00_002bcf98(walloper beam reset),FUN_L00_00249d80(menu icon cache lookup) andFUN_L05_00266320(HUD counter). The last two carryFakematch:comments for register-allocation tricks.dmaRefImagesource. ThesceFsInitdraft now differs only in the prologue save order.f2334d0_2133a8,ea210_*,*302618,spin_s, ...) were dropped. Those calls keep their retailFUN_label._cfaliases bound to other functions (activate_effect_l08,allocate_voice_for_target_entry_cf, ...) were not spread, and class update names two functions of one level share (rocket_updatein level 13) were left as labels.FUN_L00_0025e310isnormalize_angle(wraps into -pi..pi). The timer and xy length helpers use the names most files give them (fast_dec_timer,vector_length_xy).scale_timeforFUN_L04_001f1978) now use the label they really call.Verification
make elfends withPASS: reconstructed boot ELF matches retailmake overlaysends withPASS(overlay changes)make checkpasses