n64decomp / mk64

A speedy Mario Kart 64 decompilation, brought to you by the cousin of a tame racing driver.
633 stars 72 forks source link

Remaining functions to decomp #556

Open MegaMech opened 9 months ago

MegaMech commented 9 months ago

100% Match not necessary. Func Equivallency is good too. Don't forget to click "Family" in-case there are cleaner matches as some matches may be very fake-matchy.

render_objects Function Decompme Comments
func_8004C6FC https://decomp.me/scratch/TqXqn There's an unexpected mov v1,v0 and some register allocation differences
func_8004F168 https://decomp.me/scratch/FxA1w See comment at decompme link for an explanation of the problem
func_80050E34 https://decomp.me/scratch/PvJ5D Handling of the player variable is weird. The instructions are correct but out of place
code_8006E9C0 Function Decompme Comments
func_8006FA94 https://decomp.me/scratch/ohbAc Register allocation differences, especially in the first for-loop. Smaller issues are probably the result of some single-line-multiple-variable assignment shenanigans

update_objects

Function name Decomp.me link Comments
func_80080E8C https://decomp.me/scratch/YMJDJ I think this is functionally identical (not 100% certain), I have no idea what the source of the diff is
func_80082F1C https://decomp.me/scratch/RquH0 Register allocation differences, probably related to D_800E5DF4 in some capacity
func_80086074 https://decomp.me/scratch/th08i Register allocation differences, source unknown
code_800AF9B0 Function Decompme Comments
func_800AFC54 https://decomp.me/scratch/ldkgz diffs
func_800B0004 https://decomp.me/scratch/TbO9o Really dumb register allocation diff
save Function Decompme Comments
func_800B5218 https://decomp.me/scratch/KOZ5J func_equiv, stack diff, really close to ok
func_800B578C https://decomp.me/scratch/wDbXx missing asm, close to ok
func_800B68F4 https://decomp.me/scratch/NFjo1 reg alloc, close
code_80057C60 Function Decomp Comments
func_8005F90C https://decomp.me/scratch/WjMqd reg alloc. Appears to be func equiv
func_80065AB0 https://decomp.me/scratch/hdgHd Missing stack variables or incorrect gfx macros
func_80065F0C https://decomp.me/scratch/KEz08 Lots of diffs
Vehicles/AI pathing code_80005FD0 Function Decomp Comments
func_800074D4 https://decomp.me/scratch/QeMFt Matched :) !!!NEEDS A PR!!!
func_80007D04 https://decomp.me/scratch/xt5nz Matched :) !!!NEEDS A PR!!!
func_800088D8 https://decomp.me/scratch/2pzjG wip
func_8000929C https://decomp.me/scratch/9li7Y Weird stack issue
func_80009B60 https://decomp.me/scratch/uJCh3 reg alloc, minor asm diffs. See comments in the decmopme link
func_8000B140 https://decomp.me/scratch/ZtfJ3 lots of diffs
func_80017054 https://decomp.me/scratch/Ck7hV Large diff, seemingly related to an empty if statement. There's also an unused double, don't know if its part of this function or the one after it
cpu_use_item_strategy https://decomp.me/scratch/FOlbG Some diffs, 10k score
code_80091750 Function Decomp Comments
func_80097274 https://decomp.me/scratch/DSi6A Real close
func_8009195C https://decomp.me/scratch/dXpT5 Some math reordering weirdness
func_80096CD8 https://decomp.me/scratch/xV83r Weird issues
func_80099184 https://decomp.me/scratch/NAZ12 #684
func_80099394 https://decomp.me/scratch/UcyZ2 #684
func_8009952C https://decomp.me/scratch/Wv2MX #684
func_800996BC https://decomp.me/scratch/hwAAp #684
add_8018D9E0_entry https://decomp.me/scratch/1BHpa Stack differences
func_8009F5E0 No decompme link yet. While marked as non-matching there's a ton work left to be done
func_800A09E0 https://decomp.me/scratch/6wA94 #684
func_800A1FB0 https://decomp.me/scratch/s1Hod Lots of register allocation differences, neither the permuter nor I can find any improvements
func_800A474C https://decomp.me/scratch/mWCHC Differences seem to stem from the handling of the textColor function variable. The permuter reports an improvement if you make it volatile, but that seems wrong for several different reasons.
func_800AC458 https://decomp.me/scratch/NzdUC #684

code_80091750 Lots of funcs left 23 unattempted, 29 non_matching.

menus.c Function Decomp Comments
main_menu_act https://decomp.me/scratch/93qj8
player_select_menu_act https://decomp.me/scratch/POeGU Big diffs or outdated decompme
math_util.c Function Decomp Comments
func_802B8614 https://decomp.me/scratch/cwX7l unused, SpazzyLemons has made interesting progress. Something about the use/calculation of lenght is screwy
crash_screen.c Function Decomp Comments
crash_screen_draw_square Don't even bother trying (func equiv).
audio/external.c Function Decomp Comments
func_800C16E8 https://decomp.me/scratch/99CQl Register allocation and instruction ordering differences, no idea what the source is. Might(?) be functionally equivalent
func_800C284C https://decomp.me/scratch/B9kUf Register allocation differences
func_800C2A2C https://decomp.me/scratch/TS7EW Lots and lots of register allocation differences, but might be functionally equivalent
func_800C3724 https://decomp.me/scratch/LpM1t Lots of work left to be done. Has different US and EU versions
func_800C4398 https://decomp.me/scratch/fmmyb Stack issues
func_800C4888 https://decomp.me/scratch/cqBii Probably a variant of select_current_sounds from SM64, lots of work left to be done
func_800C4FE4 https://decomp.me/scratch/Lm9EX Register allocation differences
audio/load.c Function Decomp Comments
audio_init https://decomp.me/scratch/5FBUM Register allocation differences. This function is an unholy bastard child of the Shindou and EU SM64 versions of this function with some extra MK64 special sauce thrown in. There are different US and EU versions
audio/synthesis.c Function Decomp Comments
synthesis_process_note https://decomp.me/scratch/htpLe Probably func equiv. Mix of SM64 EU & Shindou. Some inaccuracies
func_800B86A0 No decompme :( Probably a variant of process_envelope from SM64. Diff is huge, no idea why. Speculation: the version of the ABI we have/use is horribly horribly wrong but is only noticeably wrong in this specific function
Tmcg2 commented 9 months ago

code_80091750:

Concerning D_802BFB80 Vetri found that changing

  typedef struct 
  {
      u8 pixel_index_array[0x1000];
  } struct_D_802BFB80;
  extern struct_D_802BFB80 D_802BFB80[][2][8];

to

  typedef struct 
  {
      u8 pixel_index_array[0x2000];
  } struct_D_802BFB80;
  extern struct_D_802BFB80 D_802BFB80[][2][4];

can lead to matches in the function(s) where its relevant. But that seems wrong given that D_802BFB80 kind of has to have 8 as its last dimension based on its usage elsewhere in the codebase. We could redefine it to being a union I guess? Something like:

  typedef struct {
      u8 pixel_index_array[0x2000];
  } thing0;
  typedef struct {
      u8 pixel_index_array[0x1000];
  } thing1;
  typedef union {
  thing0 blah0[][2][4];
  thing1 blah1[][2][8];
  } the_union;
  extern the_union D_802BFB80;

If it makes stuff match, then great. It'd be super fugly, but if it works it works.

MegaMech commented 6 months ago

PR'd func_8007C4A4 https://decomp.me/scratch/aJbM5 and func_80095AE0 https://decomp.me/scratch/77riB

PR #618

PR #623 Matched func_80092290.s

MegaMech commented 6 months ago

Matching: |func_800AFE00| https://decomp.me/scratch/rIICB | #631 |