diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2022-12-25 20:56:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-25 18:56:35 -0700 |
| commit | 3e3561bbf1f01a74a2ce92ae2a8749c864056792 (patch) | |
| tree | b7b04b165359e9a60291e27855d182719f221ebd /src | |
| parent | e1976267f327c81cba064ad918329dd6e48a11c5 (diff) | |
Couple small matches and m2c refreshing (#282)
* Moved stuff into header files to
make m2c_helper a more useful
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio/external.c | 39 | ||||
| -rw-r--r-- | src/audio/external.h | 28 | ||||
| -rw-r--r-- | src/code_800029B0.h | 4 | ||||
| -rw-r--r-- | src/code_80071F00.h | 1 | ||||
| -rw-r--r-- | src/code_80086E70.c | 13 | ||||
| -rw-r--r-- | src/code_8008C1D0.c | 34 | ||||
| -rw-r--r-- | src/code_80091750.c | 2809 | ||||
| -rw-r--r-- | src/code_80091750.h | 39 | ||||
| -rw-r--r-- | src/code_800B45E0.c | 420 | ||||
| -rw-r--r-- | src/code_80280650.c | 59 | ||||
| -rw-r--r-- | src/memory.c | 88 | ||||
| -rw-r--r-- | src/menus.c | 85 | ||||
| -rw-r--r-- | src/menus.h | 22 |
13 files changed, 1529 insertions, 2112 deletions
diff --git a/src/audio/external.c b/src/audio/external.c index b8bc92f80..f5f07b19c 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -13,9 +13,6 @@ void func_800C13F0(void) { } -extern OSMesgQueue *D_800EA3B0; -extern OSMesgQueue *D_800EA3B4; - void func_800C13FC(OSMesg presetId) { OSMesg mesg; osRecvMesg(D_800EA3B4, &mesg, 0); @@ -377,7 +374,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1F8C.s") #ifdef NEEDS_RODATA // data/rodata_audio_2.s extern f32 D_800F35E4;// = 100000.0f; -f32 *func_800C21E8(f32 *arg0, u32 arg1) { +f32 *func_800C21E8(Vec3f arg0, u32 arg1) { u8 var_v0; f32 *ret; // Only here to force a match @@ -4228,8 +4225,6 @@ void func_800C8CCC(void) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C8CCC.s") #endif -extern u8 D_800EA1D4; - void play_sound2(s32 soundBits) { if ((soundBits == SOUND_ACTION_REV_ENGINE) && (gCurrentCourseId == 0x12)) { @@ -4242,25 +4237,16 @@ void play_sound2(s32 soundBits) { play_sound(soundBits, &D_800EA1C8, 4, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC); } -void func_800C3448(s32); -extern u16 D_800EA15C; - void func_800C8EAC(u16 arg0) { func_800C3448(arg0 | 0x10000); D_800EA15C = arg0; } -void func_800C3448(s32); -extern u16 D_800EA160; - void func_800C8EF8(u16 arg0) { func_800C3448(arg0 | 0x1010000); D_800EA160 = arg0; } - -void func_800C36C4(s32 arg0, s32 arg1, u8 arg2, s8 arg3); - void func_800C8F44(u8 arg0) { func_800C36C4(0, 0, arg0, 1); } @@ -4789,17 +4775,13 @@ void func_800C9D80(Vec3f position, Vec3f velocity, u32 soundBits) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9D80.s") #endif - -f32 *func_800C21E8(s32, s32); -void func_800C5578(s32, s32); - -void func_800C9EF4(s32 arg0, s32 arg1) { +void func_800C9EF4(Vec3f arg0, u32 arg1) { f32 *temp; u8 i; for (i = 0; i < D_800EA1C0 + 1; i++) { temp = func_800C21E8(arg0, arg1); - if (temp != 0) { + if (temp != NULL) { func_800C5578(temp, arg1); } } @@ -4930,8 +4912,6 @@ void func_800CA118(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA118.s") #endif -extern u8 D_800EA0EC[]; - void func_800CA24C(u8 arg0) { D_800EA0EC[arg0] = 2; } @@ -4940,8 +4920,6 @@ void func_800CA270() { D_800EA0F4 = 1; } -extern u8 D_800E9F90[]; - // appears to write u8 in list of f32s? // However, 0x3C is 0.0f which could likely get confused with `u8 = 0`; void func_800CA288(u8 arg0, s8 arg1) { @@ -4965,8 +4943,6 @@ void func_800CA330(u8 arg0) { func_800C3448(arg0 << 0x10 | 0x110000FF); } -void func_800C58B8(u8, u8, u16); // extern - void func_800CA388(u8 arg0) { arg0 *= 2; func_800C58B8(0, 0, arg0); @@ -4976,9 +4952,6 @@ void func_800CA388(u8 arg0) { func_800C58B8(5, 0, arg0); } -void func_800C3448(s32); -extern u8 D_800EA104; - void func_800CA414(u16 arg0, u16 arg1) { if (D_800EA104 == 0) { func_800C3448(func_800C3508(0) | 0x30000000); @@ -4989,12 +4962,6 @@ void func_800CA414(u16 arg0, u16 arg1) { D_800EA104 = 1; } -extern u8 D_800EA108; -extern u16 D_800EA15C; -extern u8 D_800EA164; -extern u8 D_800EA1C0; -extern u8 D_8018FC08; - void func_800CA49C(u8 arg0) { if (D_800EA108 == 0) { if (D_800EA1C0 >= 2) { diff --git a/src/audio/external.h b/src/audio/external.h index bed5980a0..e86424044 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -89,6 +89,7 @@ struct Unk_800EA06C { } ; void func_800C13F0(); +void func_800C13FC(OSMesg); f32 func_800C1480(u8, u8); s8 func_800C15D0(u8, u8, u8); f32 func_800C1934(u8, u8); @@ -96,12 +97,16 @@ struct Unk_8018EFD8 *func_800C1C88(u8, Vec3f, Vec3f, f32*, u8, u32); void func_800C1DA4(Camera*, Vec3s, struct Unk_8018EFD8*); void func_800C1E2C(Camera*, Vec3f, struct Unk_8018EFD8*); void func_800C1F8C(); -f32 *func_800C21E8(s32, s32); +f32 *func_800C21E8(Vec3f, u32); +void func_800C3448(s32); +void func_800C36C4(s32, s32, u8, s8); void func_800C4084(u16); void play_sound(u32, f32*, u8, f32*, f32*, u8*); void func_800C41CC(u8, struct Unk_80191420*); void func_800C4398(); +void func_800C5578(Vec3f, u32); void func_800C5848(); +void func_800C58B8(u8, u8, u16); void func_800C6758(u8); void func_800C86D8(u8); void func_800C8770(u8); @@ -109,19 +114,29 @@ void func_800C89E4(); void play_sound2(s32); void func_800C8EAC(u16); void func_800C8EF8(u16); +void func_800C8F44(u8); void func_800C9060(u8, u32); void func_800C90F4(u8, uintptr_t); +void func_800C9A88(u8); +void func_800C9EF4(Vec3f, u32); +void func_800C9F90(u8); void func_800CA008(u8, u8); void func_800CA0A0(); void func_800CA0B8(); void func_800CA0CC(); +void func_800CA0E4(); void func_800CA118(); +void func_800CA24C(u8); void func_800CA270(); +void func_800CA288(u8, s8); +void func_800CA2B8(u8); void func_800CA2E4(u8, s8); void func_800CA30C(u8); void func_800CA330(u8); void func_800CA388(u8); +void func_800CA414(u16, u16); void func_800CA49C(u8); +void func_800CAACC(u8); void func_800CB134(); void func_800CB2C4(void); @@ -136,6 +151,7 @@ extern u8 D_8018FB91; extern Camera *D_8018FB98[4]; extern Vec3f D_8018FBA8[4]; extern Vec3f D_8018FBD8[4]; +extern u8 D_8018FC08; extern struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20]; extern u8 sSoundBankUsedListBack[SOUND_BANK_COUNT]; @@ -154,10 +170,16 @@ extern u8 D_800E9F24[8];// = { 0, 0, 0, 0, 0, 0, 0, 0 }; extern f32 D_800E9F34[8];// = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ extern f32 D_800E9F54[4];// = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ extern u8 D_800E9F2C[8];// = { 0, 0, 0, 0, 0, 0, 0, 0 }; +extern u8 D_800E9F90[]; extern struct Unk_800EA06C D_800EA06C[8]; +extern u8 D_800EA0EC[]; extern u8 D_800EA0F0;// = 0; extern u8 D_800EA0F4; +extern u8 D_800EA104; extern u8 D_800EA108;// = 0; +extern u16 D_800EA15C; +extern u16 D_800EA160; +extern u8 D_800EA164; extern s16 D_800EA174;// = 0; extern f32 D_800EA178; extern f32 D_800EA17C; @@ -166,9 +188,13 @@ extern u8 D_800EA1C0;// = 0; // Most similar to gGlobalSoundSource from SM64, but I don't know if its really // a sound source, its usage makes it look like a 0'd Vec3f for general usage extern Vec3f D_800EA1C8;// = {0.0f, 0.0f, 0.0f} +extern u8 D_800EA1D4; extern u8 D_800EA1DC;// = 0; extern u8 D_800EA244; extern s8 D_800EA16C; +extern OSMesgQueue *D_800EA3B0; +extern OSMesgQueue *D_800EA3B4; + #endif diff --git a/src/code_800029B0.h b/src/code_800029B0.h index 34156a3f2..749855a09 100644 --- a/src/code_800029B0.h +++ b/src/code_800029B0.h @@ -9,10 +9,6 @@ void func_80002DAC(); void clear_nmi_buffer(); void func_80003040(); -// audio/external - -void func_800C8F44(u16 arg0); - extern struct UnkStruct_800DC5EC *D_800DC5EC; extern struct UnkStruct_800DC5EC *D_800DC5F0; extern struct UnkStruct_800DC5EC *D_800DC5F4; diff --git a/src/code_80071F00.h b/src/code_80071F00.h index 8c3eae82e..e519f81fb 100644 --- a/src/code_80071F00.h +++ b/src/code_80071F00.h @@ -207,7 +207,6 @@ void func_80086D80(); // audio/external.c void func_800C9D80(Vec3f, Vec3f, u32); -void func_800C9EF4(Vec3f, s32); s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq); s32 osRecvMesg(OSMesgQueue*, OSMesg*, s32); diff --git a/src/code_80086E70.c b/src/code_80086E70.c index 80bb44d93..59e543b41 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -999,20 +999,17 @@ GLOBAL_ASM("asm/non_matchings/code_80086E70/func_8008933C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80072180(); // extern -s32 func_8007223C(?); // extern -f32 func_8008933C(Player *, s32, s32, s32); // extern -void func_800C9060(u8, s32); // extern +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-21-2022 +f32 func_8008933C(Player *, s32, s32, s32); /* extern */ -void func_80089474(s32 arg0, u8 arg1, s32 arg2, s32 arg3, s32 arg4) { +void func_80089474(s32 arg0, u8 arg1, s32 arg2, s32 arg3, u32 arg4) { Player *sp18; sp18 = &gPlayerOne[arg1]; - if (func_8007223C(0x4000000) != 0) { + if (func_8007223C(arg0, 0x04000000) != 0) { func_80072180(); } - if ((func_8008933C(sp18, arg0, arg2, arg3) >= 4.0) && ((sp18->unk_000 & 0x1000) != 0x1000)) { + if (((f64) func_8008933C(sp18, arg0, arg2, arg3) >= 4.0) && ((sp18->unk_000 & 0x1000) != 0x1000)) { func_800C9060(arg1, arg4); } } diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 06d86c195..d9c5dea76 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -417,7 +417,7 @@ void func_8008CDC0(Player* player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-14-2022 void func_8008CEB0(Player *player, s8 arg1) { f32 sp2C; s16 sp2A; @@ -2226,9 +2226,7 @@ void func_800914A0(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern u16 D_80152308; -extern s16 D_8015F6F8; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-15-2022 extern u32 D_8015F718; static ? D_800E7080; /* unable to generate initializer */ static ? D_800E708C; /* unable to generate initializer */ @@ -2248,9 +2246,9 @@ void func_800914E0(void) { f32 temp_f8; s16 temp_a0; s16 temp_a0_2; - s16 temp_v0_2; - u32 temp_v0; - void *temp_v0_3; + s16 temp_v0; + u16 temp_t0; + void *temp_v0_2; sp64.unk0 = (s32) D_800E7080.unk0; sp64.unk4 = (s32) D_800E7080.unk4; @@ -2258,32 +2256,32 @@ void func_800914E0(void) { sp58.unk0 = (s32) D_800E708C.unk0; sp58.unk4 = (s32) D_800E708C.unk4; sp58.unk8 = (s32) D_800E708C.unk8; - temp_v0 = D_8015F718; - temp_a0 = temp_v0 & 0xFFFFFF; + temp_a0 = D_8015F718 & 0xFFFFFF; var_t1 = &gPlayerOneCopy; - sp48 = gSegmentTable[temp_v0 >> 0x18] + temp_a0 + 0x80000000; - temp_v0_2 = (s16) gPlayerOneCopy->unk_006 - D_80152308; + sp48 = gSegmentTable[(u32) D_8015F718 >> 0x18] + temp_a0 + 0x80000000; + temp_t0 = D_80152308; + temp_v0 = (s16) gPlayerOneCopy->unk_006 - temp_t0; cameras->up[0] = 0.0f; cameras->up[2] = 0.0f; cameras->up[1] = 1.0f; - if (temp_v0_2 == 7) { + if (temp_v0 == 7) { func_800914A0(temp_a0, 7); goto block_5; } - if (temp_v0_2 < 0xE) { - temp_a0_2 = temp_v0_2 + D_8015F6F8; + if (temp_v0 < 0xE) { + temp_a0_2 = temp_v0 + (s16) D_8015F6F8; if (temp_a0_2 == 7) { func_800914A0(temp_a0_2, 7); block_5: var_t1 = &gPlayerOneCopy; } } - temp_v0_3 = (D_80152308 * 8) + sp48; - temp_f8 = (f32) (temp_v0_3->unk0 + 0xA); + temp_v0_2 = (temp_t0 * 8) + sp48; + temp_f8 = (f32) (temp_v0_2->unk0 + 0xA); cameras->pos[0] = temp_f8; - temp_f16 = (f32) (temp_v0_3->unk2 + 7); + temp_f16 = (f32) (temp_v0_2->unk2 + 7); cameras->pos[1] = temp_f16; - temp_f4 = (f32) (temp_v0_3->unk4 - 0x14); + temp_f4 = (f32) (temp_v0_2->unk4 - 0x14); cameras->pos[2] = temp_f4; cameras->lookAt[0] = (*var_t1)->pos[0]; cameras->lookAt[1] = (*var_t1)->pos[1]; diff --git a/src/code_80091750.c b/src/code_80091750.c index 8f92c7930..5f452bd99 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -280,19 +280,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80091B78.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -extern OSPfs D_8018E868; -extern ? D_8018E938; -extern ? D_8018EB38; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 extern u8 gControllerBits; -extern void *gControllerOne; -extern OSContStatus gControllerStatuses; +extern ? gControllerStatuses; s32 func_80091D74(void) { u8 sp67; - ? *var_s1; + s32 *var_s1; s32 temp_v0; s32 var_s0; @@ -302,7 +296,7 @@ s32 func_80091D74(void) { if ((*(&gControllerStatuses + 2) == 0) & 1) { return 0; } - if (!(gControllerOne->unk4 & 0x1000)) { + if (!(gControllerOne->button & 0x1000)) { return 0; } osPfsIsPlug(&gSIEventMesgQueue, &sp67); @@ -314,9 +308,9 @@ s32 func_80091D74(void) { if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { return 0; } - var_s1 = &D_8018EB38; + var_s1 = D_8018EB38; do { - temp_v0 = osPfsFileState(&D_8018E868, var_s0, &D_8018E938 + (var_s0 << 5)); + temp_v0 = osPfsFileState(&D_8018E868, var_s0, &D_8018E938[var_s0]); var_s0 += 1; var_s1 += 4; var_s1->unk-4 = temp_v0; @@ -1685,14 +1679,8 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80094C60.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_8009E230(); /* extern */ -void func_800CA0A0(); /* extern */ -void play_sound2(?); /* extern */ -extern s8 D_8018E7B0; -extern s8 D_8018EDF1; -extern s8 D_8018EE0C; -static s8 *gDebugCharacterNames[8] = { "MARIO", "LUIGI", "YOSHI", "KINOPIO", "D.KONG", "WARIO", "PEACH", "KOOPA" }; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +? func_8009E230(); /* extern */ static s8 *gDebugCourseNames[0x14] = { "m circuit", "mountain", @@ -1715,22 +1703,22 @@ static s8 *gDebugCourseNames[0x14] = { "jungle", "doughnut", }; +static s8 *gDebugCharacterNames[8] = { "MARIO", "LUIGI", "YOSHI", "KINOPIO", "D.KONG", "WARIO", "PEACH", "KOOPA" }; static s8 *gDebugScreenModeNames[5] = { "1p", "2players UD", "2players LR", "3players", "4players" }; s16 gCurrentCourseId; /* unable to generate initializer */ s8 *gDebugSoundModeNames[4] = { "stereo", "head phone", "xxx", "monaural" }; void func_80095574(void) { Gfx *temp_v1; - s16 temp_a3; - s16 temp_a3_2; s32 var_v0; s32 var_v0_2; - s8 temp_t8; + s8 temp_v0; if ((D_8018EE0C < 3) || (D_8018E7B0 != 0)) { func_800A8230(); } - if (gDebugMenuSelection >= 2) { + temp_v0 = gDebugMenuSelection; + if (temp_v0 >= 2) { load_debug_font(); debug_print_str2(0x00000050, 0x00000064, "debug_mode"); switch (gDebugMenuSelection) { @@ -1758,18 +1746,16 @@ void func_80095574(void) { } else { debug_print_str2(0x000000AA, 0x00000064, "off"); } - temp_a3 = gCurrentCourseId; - if ((temp_a3 >= 0x14) || (temp_a3 < 0)) { + if ((gCurrentCourseId >= 0x14) || (gCurrentCourseId < 0)) { gCurrentCourseId = 0; } print_str_num(0x00000050, 0x0000006E, "map_number", (s32) gCurrentCourseId); - temp_a3_2 = gCurrentCourseId; - if (temp_a3_2 < 0xA) { + if (gCurrentCourseId < 0xA) { var_v0 = 0; } else { var_v0 = 8; } - debug_print_str2(var_v0 + 0xB9, 0x0000006E, gDebugCourseNames[temp_a3_2]); + debug_print_str2(var_v0 + 0xB9, 0x0000006E, gDebugCourseNames[gCurrentCourseId]); debug_print_str2(0x00000050, 0x00000078, "screen_mode"); debug_print_str2(0x000000AA, 0x00000078, gDebugScreenModeNames[D_8018EDF1]); debug_print_str2(0x00000050, 0x00000082, "player"); @@ -1781,14 +1767,14 @@ void func_80095574(void) { } func_80057778(); } - if (gDebugMenuSelection == DEBUG_MENU_DISABLED) { + if (temp_v0 == DEBUG_MENU_DISABLED) { gMenuTimingCounter += 1; } else { gMenuTimingCounter = 3; } var_v0_2 = gMenuTimingCounter; - if (var_v0_2 == 2) { - play_sound2(SOUND_INTRO_WELCOME); + if (var_v0_2 == DEBUG_MENU_DEBUG_MODE) { + play_sound2(0x49009009); var_v0_2 = gMenuTimingCounter; } if (var_v0_2 >= 0x12D) { @@ -1855,49 +1841,39 @@ Gfx *func_800959F8(Gfx *displayListHead, Vtx *arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 void func_80095AE0(Mtx *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { s32 sp14; s32 sp10; s32 spC; s32 sp8; - s32 *temp_a2; - s32 *temp_a3; - s32 *temp_v0_2; - s32 *temp_v1; - s32 temp_v0; - Mtx *phi_v1; - s32 phi_v0; + Mtx *var_v1; + s32 var_v0; - phi_v1 = arg0; - phi_v0 = 0; + var_v0 = 0; + var_v1 = arg0; do { - temp_v0 = phi_v0 + 4; - phi_v1->m[0][0] = 0; - phi_v1->m[0][1] = 0; - phi_v1->m[0][2] = 0; - phi_v1->m[0][3] = 0; - phi_v1 += 0x10; - phi_v0 = temp_v0; - } while (temp_v0 != 0x10); - temp_v0_2 = &sp14; - temp_v1 = &sp10; - temp_a2 = &spC; - temp_a3 = &sp8; + var_v0 += 4; + var_v1->m[0][0] = 0; + var_v1->m[0][1] = 0; + var_v1->m[0][2] = 0; + var_v1->m[0][3] = 0; + var_v1 += 0x10; + } while (var_v0 != 0x10); sp14 = (s32) (arg3 * 65536.0f); sp10 = (s32) (arg4 * 65536.0f); spC = (s32) (arg1 * 65536.0f); sp8 = (s32) (arg2 * 65536.0f); - arg0->unk0 = (s16) temp_v0_2->unk0; + arg0->unk0 = (s16) sp14.unk0; arg0->unk14 = 1; - arg0->unkA = (s16) temp_v1->unk0; - arg0->unk18 = (s16) temp_a2->unk0; + arg0->unkA = (s16) sp10.unk0; + arg0->unk18 = (s16) spC.unk0; arg0->unk1E = 1; - arg0->unk1A = (s16) temp_a3->unk0; - arg0->unk20 = (s16) temp_v0_2->unk2; - arg0->unk2A = (s16) temp_v1->unk2; - arg0->unk38 = (s16) temp_a2->unk2; - arg0->unk3A = (s16) temp_a3->unk2; + arg0->unk1A = (s16) sp8.unk0; + arg0->unk20 = (s16) sp14.unk2; + arg0->unk2A = (s16) sp10.unk2; + arg0->unk38 = (s16) spC.unk2; + arg0->unk3A = (s16) sp8.unk2; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095AE0.s") @@ -3051,19 +3027,21 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097274.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +void *func_80095E10(Gfx *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ + Gfx *func_80097A14(Gfx *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA) { Gfx *temp_a0; - Gfx *temp_v0; + void *temp_v0; temp_a0 = arg0 + 8; arg0->words.w0 = 0xE7000000; arg0->words.w1 = 0; - temp_a0->words.w1 = 0x200000; + temp_a0->words.w1 = 0x00200000; temp_a0->words.w0 = 0xBA001402; temp_v0 = func_80095E10(temp_a0 + 8, arg1, 0x1000, 0x400, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, argA); - temp_v0->words.w0 = 0xE7000000; - temp_v0->words.w1 = 0; + temp_v0->unk0 = 0xE7000000; + temp_v0->unk4 = 0; temp_v0->unk8 = 0xBA001402; temp_v0->unkC = 0; return temp_v0 + 0x10; @@ -3728,7 +3706,7 @@ loop_4: GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099184.s") #endif -void func_8009969C(s32 arg0) { +void func_8009969C(MkTexture *arg0) { func_800996BC(arg0, 1); } @@ -4136,71 +4114,50 @@ void func_8009A344(void) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 0ca3d5f5fa5e3d957908269ac1535e7d4f12bce9 -void func_8009969C(MkTexture *, s32, MkAnimation *); /* extern */ - +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 s32 func_8009A374(MkAnimation *arg0) { s32 sp24; struct_8018DEE0_entry *sp1C; - MkAnimation *temp_a2; MkAnimation *temp_v0; - MkTexture *temp_a0; - s32 temp_a1; + MkAnimation *var_a2; + s32 temp_a0; + s32 var_a1; struct_8018DEE0_entry *temp_v1; - struct_8018DEE0_entry *temp_v1_2; - s32 phi_a1; - struct_8018DEE0_entry *phi_v1; - s32 phi_a1_2; - MkAnimation *phi_a2; + struct_8018DEE0_entry *var_v1; temp_v0 = segmented_to_virtual_dupe_2(arg0); - temp_a2 = temp_v0; - phi_a1 = 0; - phi_a1_2 = 0; - phi_a2 = temp_a2; + var_a1 = 0; if (D_8018DEE0->visible != 0) { - phi_v1 = D_8018DEE0; + var_v1 = D_8018DEE0; loop_2: - temp_a1 = phi_a1 + 1; - temp_v1 = phi_v1 + 0x18; - phi_a1 = temp_a1; - phi_v1 = temp_v1; - phi_a1_2 = temp_a1; - if (temp_a1 >= 0x10) { + var_a1 += 1; + var_v1 += 0x18; + if (var_a1 >= 0x10) { loop_3: goto loop_3; } - if (temp_v1->visible == 0) { + if (var_v1->visible == 0) { goto block_5; } goto loop_2; } block_5: - temp_v1_2 = &D_8018DEE0[phi_a1_2]; - temp_v1_2->textureSequence = temp_v0; - temp_v1_2->sequenceIndex = -1; - temp_v1_2->frameCountDown = 0; - temp_v1_2->visible = 0x80000000; - temp_v1_2->D_8018E118_index = gNumD_8018E118Entries; - if (temp_v0->mk64Texture != 0) { - arg0 = temp_a2; - sp24 = phi_a1_2; - sp1C = temp_v1_2; - func_8009969C(temp_a2->mk64Texture, phi_a1_2, temp_a2); - phi_a2 = arg0; - } - temp_a0 = phi_a2->unk8; - if (temp_a0 != 0) { - sp1C = &D_8018DEE0[phi_a1_2]; - sp24 = phi_a1_2; - func_8009969C(temp_a0, phi_a1_2, phi_a2); + temp_v1 = &D_8018DEE0[var_a1]; + temp_v1->textureSequence = temp_v0; + temp_v1->sequenceIndex = -1; + temp_v1->frameCountDown = 0; + temp_v1->visible = 0x80000000; + temp_v1->D_8018E118_index = gNumD_8018E118Entries; + if (temp_v0->mk64Texture != NULL) { + func_8009969C(temp_v0->mk64Texture); + } + if (temp_v0->unk8 != NULL) { + func_8009969C(temp_v0->unk8); } else { - sp24 = phi_a1_2; - sp1C = &D_8018DEE0[phi_a1_2]; - func_8009969C(phi_a2->mk64Texture, phi_a1_2, phi_a2); + func_8009969C(temp_v0->mk64Texture); } - D_8018DEE0[phi_a1_2].unk14 = 0; - return sp24; + temp_v1->unk14 = 0; + return var_a1; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A374.s") @@ -5434,84 +5391,84 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CA6C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 draw_box(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -extern ? D_800E7AE8; -extern UnkStruct_800DC5EC D_8015F480; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +struct _struct_D_800E7AE8_0x8 { + /* 0x0 */ u16 unk0; /* inferred */ + /* 0x2 */ u16 unk2; /* inferred */ + /* 0x4 */ u16 unk4; /* inferred */ + /* 0x6 */ char pad6[2]; +}; /* size = 0x8 */ + extern ? D_8018E7AC; -extern u32 D_8018E7B8; -extern s32 D_8018E7D0; +extern ? D_8018E7B8; +extern ? D_8018E7D0; extern ? D_8018E7E8; extern ? D_8018E810; -extern s8 D_8018EE0C; -extern s32 gDisplayListHead; +static struct _struct_D_800E7AE8_0x8 D_800E7AE8[0]; /* unable to generate initializer */ void func_8009CBE4(s32 arg0, s32 arg1, s32 arg2) { u32 *sp40; u32 *sp3C; + s16 var_ra; + s16 var_t2; + s16 var_t3; + s16 var_t5; s32 temp_t0; s32 temp_t1; s32 temp_v0; s32 temp_v0_2; - s32 temp_v0_4; s32 temp_v1_3; + struct UnkStruct_800DC5EC *temp_v0_3; + struct _struct_D_800E7AE8_0x8 *temp_v0_4; u32 *temp_t4; u32 *temp_t9; u32 temp_t6; void *temp_a0; void *temp_a0_2; - void *temp_v0_3; - void *temp_v0_5; void *temp_v1; void *temp_v1_2; - s16 phi_t2; - s32 phi_t5; - s16 phi_t3; - s32 phi_ra; - - temp_v0 = gModeSelection; - if ((temp_v0 == GRAND_PRIX) || (temp_v0 == TIME_TRIALS)) { - temp_v0_4 = arg0 * 8; - temp_v1_2 = temp_v0_4 + &D_8018E7E8; - temp_a0_2 = temp_v0_4 + &D_8018E810; - phi_t2 = temp_v1_2->unk0; - phi_t5 = temp_a0_2->unk0; - phi_t3 = temp_v1_2->unk2; - phi_ra = temp_a0_2->unk2; + + if ((gModeSelection == 0) || (gModeSelection == 1)) { + temp_v0 = arg0 * 8; + temp_v1 = temp_v0 + &D_8018E7E8; + temp_a0 = temp_v0 + &D_8018E810; + var_t2 = temp_v1->unk0; + var_t3 = temp_v1->unk2; + var_t5 = temp_a0->unk0; + var_ra = temp_a0->unk2; } else { temp_v0_2 = arg0 * 8; if (arg0 >= 4) { - temp_v1 = temp_v0_2 + &D_8018E7E8; - temp_a0 = temp_v0_2 + &D_8018E810; - phi_t2 = temp_v1->unk0; - phi_t5 = temp_a0->unk0; - phi_t3 = temp_v1->unk2; - phi_ra = temp_a0->unk2; + temp_v1_2 = temp_v0_2 + &D_8018E7E8; + temp_a0_2 = temp_v0_2 + &D_8018E810; + var_t2 = temp_v1_2->unk0; + var_t3 = temp_v1_2->unk2; + var_t5 = temp_a0_2->unk0; + var_ra = temp_a0_2->unk2; } else { - temp_v0_3 = (arg0 << 6) + &D_8015F480; - phi_t2 = temp_v0_3->unk30; - phi_t5 = temp_v0_3->unk2C; - phi_t3 = temp_v0_3->unk32; - phi_ra = temp_v0_3->unk2E; + temp_v0_3 = &D_8015F480[arg0]; + var_t2 = temp_v0_3->screenStartX; + var_t3 = temp_v0_3->screenStartY; + var_t5 = temp_v0_3->screenWidth; + var_ra = temp_v0_3->screenHeight; } } - temp_v0_5 = (arg2 * 8) + &D_800E7AE8; + temp_v0_4 = &D_800E7AE8[arg2]; temp_t1 = arg0 * 4; temp_t4 = temp_t1 + &D_8018E7D0; - temp_v1_3 = phi_t5 / 2; - temp_t0 = phi_ra / 2; + temp_v1_3 = var_t5 / 2; + temp_t0 = var_ra / 2; temp_t9 = temp_t1 + &D_8018E7B8; sp3C = temp_t9; sp40 = temp_t4; - gDisplayListHead = draw_box(gDisplayListHead, phi_t2 - temp_v1_3, phi_t3 - temp_t0, temp_v1_3 + phi_t2, temp_t0 + phi_t3, temp_v0_5->unk0, temp_v0_5->unk2, temp_v0_5->unk4, 0xFF - ((*temp_t4 * 0xFF) / *temp_t9)); - if ((arg1 == 0) && (temp_t6 = *temp_t4 + 1, *temp_t4 = temp_t6, ((temp_t6 < *sp3C) == 0))) { - if (gGamestate == RACING) { + gDisplayListHead = draw_box(gDisplayListHead, var_t2 - temp_v1_3, var_t3 - temp_t0, temp_v1_3 + var_t2, temp_t0 + var_t3, (s32) temp_v0_4->unk0, (s32) temp_v0_4->unk2, (s32) temp_v0_4->unk4, 0xFF - ((u32) (*temp_t4 * 0xFF) / (u32) *temp_t9)); + if ((arg1 == 0) && (temp_t6 = *temp_t4 + 1, *temp_t4 = temp_t6, ((temp_t6 < (u32) *sp3C) == 0))) { + if (gGamestate == 4) { *(&D_8018E7AC + arg0) = 6; return; } *(&D_8018E7AC + arg0) = 0; D_8018EE0C = 0; - // Duplicate return node #11. Try simplifying control flow for better match } } #else @@ -5526,8 +5483,6 @@ void func_8009CDFC(s32 arg0, s32 arg1) { func_8009CBE4(arg0, arg1, 1); } -extern u8 gSoundMode; - void func_8009CE1C(void) { if ((gSoundMode != 3) && (gPlayerCountSelection1 >= 2)) { func_800C3448(0xE0000002); @@ -5535,125 +5490,98 @@ void func_8009CE1C(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b -? func_8009CE1C(s32 *, s32, s32, s32); /* extern */ -extern s32 D_800E86A4; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 extern s16 D_8015F892; extern ? D_8018E7AC; -extern s8 D_8018E7B0; -extern u32 D_8018EDE0; -extern s8 D_8018EDFB; -extern s8 D_8018EE08; -extern s8 D_8018EE0C; -extern s16 gCreditsCourseId; -extern s8 gDebugGotoScene; -extern s32 gGamestate; -extern s32 gGamestateNext; -extern s32 gMenuSelectionFromEndingSequence; -u8 gCupSelectionByCourseId[0x15]; /* unable to generate initializer */ s16 gCurrentCourseId; /* unable to generate initializer */ +u8 gCupSelectionByCourseId[0x15]; /* unable to generate initializer */ u8 gPerCupIndexByCourseId[0x15]; /* unable to generate initializer; const */ -void func_8009CE64(s32 *arg0, s32 arg1, s32 arg2, s32 arg3) { +void func_8009CE64(s32 *arg0, s32 arg2, s32 arg3) { s32 sp28; s8 *sp18; - s16 temp_a0; s32 *var_a0; s32 temp_t6; s32 temp_t6_2; - s32 temp_v0; - s32 temp_v0_7; s32 temp_v1; s32 temp_v1_2; - s32 temp_v1_3; - s32 temp_v1_5; - s32 temp_v1_6; - s32 temp_v1_8; s32 var_a1; s32 var_a1_2; s32 var_a2; - s32 var_a3; s32 var_t7; s32 var_v0; - s8 *temp_v0_2; - s8 temp_v1_4; - s8 temp_v1_7; - s8 temp_v1_9; + s8 *temp_v0; + struct_8018D9E0_entry *temp_v0_2; struct_8018D9E0_entry *temp_v0_3; struct_8018D9E0_entry *temp_v0_4; struct_8018D9E0_entry *temp_v0_5; - struct_8018D9E0_entry *temp_v0_6; - u32 temp_t9; var_a0 = arg0; - var_a2 = arg2; - var_a3 = arg3; - temp_v0 = gGamestate; + var_a2 = arg3; var_a1 = 0; - if (temp_v0 == (s32) 5) { - temp_v1 = gCCSelection; - if ((temp_v1 != CC_150) && (temp_v1 != CC_EXTRA)) { + if (gGamestate == (s32) 5) { + if ((gCCSelection != 2) && (gCCSelection != 3)) { - } else if ((D_802874F5 < 3) && (gCupSelection == SPECIAL_CUP)) { + } else if ((D_802874F5 < 3) && (gCupSelection == 3)) { var_a1 = 1; } if (var_a1 != 0) { - gMenuSelectionFromEndingSequence = CREDITS_SEQUENCE; - gCreditsCourseId = COURSE_LUIGI_RACEWAY; + gMenuSelectionFromEndingSequence = 9; + gCreditsCourseId = 8; return; } - gMenuSelectionFromEndingSequence = MAIN_MENU_FROM_QUIT; - gMenuSelection = MAIN_MENU; + gMenuSelectionFromEndingSequence = 1; + gMenuSelection = 0x0000000B; return; } - if (temp_v0 == 4) { - temp_v0_2 = var_a0 + &D_8018E7AC; - if (*temp_v0_2 == 2) { - if (temp_v0_2 != &D_8018E7B0) { - *temp_v0_2 = 5; + if (gGamestate == 4) { + temp_v0 = var_a0 + &D_8018E7AC; + if (*temp_v0 == 2) { + if (temp_v0 != &D_8018E7B0) { + *temp_v0 = 5; return; } - sp18 = temp_v0_2; + sp18 = temp_v0; sp28 = 0; - temp_v0_3 = find_8018D9E0_entry(0x000000B0); - if (temp_v0_3 != NULL) { - temp_v1_2 = temp_v0_3->unk4; - switch (temp_v1_2) { /* switch 7; irregular */ - case 10: /* switch 7 */ + temp_v0_2 = find_8018D9E0_entry(0x000000B0); + if (temp_v0_2 != NULL) { + temp_v1 = temp_v0_2->unk4; + switch (temp_v1) { /* switch 8; irregular */ + case 10: /* switch 8 */ func_802903B0(); return; - case 11: /* switch 7 */ + case 11: /* switch 8 */ func_80290388(); return; - case 12: /* switch 7 */ + case 12: /* switch 8 */ func_80290360(); return; - default: /* switch 7 */ - case 13: /* switch 7 */ + default: /* switch 8 */ + case 13: /* switch 8 */ func_80290338(); return; } } else { sp28 = 0; - temp_v0_4 = find_8018D9E0_entry(0x000000AC); - if (temp_v0_4 != NULL) { - temp_v1_3 = temp_v0_4->unk4; - switch (temp_v1_3) { /* switch 6; irregular */ - case 11: /* switch 6 */ + temp_v0_3 = find_8018D9E0_entry(0x000000AC); + if (temp_v0_3 != NULL) { + temp_v1_2 = temp_v0_3->unk4; + switch (temp_v1_2) { /* switch 7; irregular */ + case 11: /* switch 7 */ func_802903B0(); D_8016556E = 1; return; - default: /* switch 6 */ - case 12: /* switch 6 */ + default: /* switch 7 */ + case 12: /* switch 7 */ func_80290338(); return; } } else { sp28 = 0; - temp_v0_5 = find_8018D9E0_entry(0x000000C7); + temp_v0_4 = find_8018D9E0_entry(0x000000C7); var_a1_2 = 0; - if (temp_v0_5 != NULL) { - temp_t6 = temp_v0_5->unk4; + if (temp_v0_4 != NULL) { + temp_t6 = temp_v0_4->unk4; switch (temp_t6) { /* switch 1 */ case 12: /* switch 1 */ func_802903B0(); @@ -5686,9 +5614,9 @@ void func_8009CE64(s32 *arg0, s32 arg1, s32 arg2, s32 arg3) { D_800DC5FC = 0; } } - temp_v0_6 = find_8018D9E0_entry(0x000000BD); - if (temp_v0_6 != NULL) { - temp_t6_2 = temp_v0_6->unk4; + temp_v0_5 = find_8018D9E0_entry(0x000000BD); + if (temp_v0_5 != NULL) { + temp_t6_2 = temp_v0_5->unk4; switch (temp_t6_2) { /* switch 2 */ case 11: /* switch 2 */ D_8015F892 = 1; @@ -5724,16 +5652,14 @@ void func_8009CE64(s32 *arg0, s32 arg1, s32 arg2, s32 arg3) { } } else { *(&D_8018E7AC + var_a0) = 0; - if (gDebugMenuSelection != DEBUG_MENU_EXITED) { - temp_t9 = D_8018EDE0; - switch (temp_t9) { /* switch 3 */ + if (gDebugMenuSelection != 0x40) { + switch (D_8018EDE0) { /* switch 3 */ case 0: /* switch 3 */ var_a0 = &gMenuSelection; - temp_v0_7 = gMenuSelection; var_a2 = 2; - var_t7 = temp_v0_7 + 1; - if (temp_v0_7 == LOGO_INTRO_MENU) { - gMenuSelection = START_MENU; + var_t7 = gMenuSelection + 1; + if (gMenuSelection == 8) { + gMenuSelection = 0x0000000A; D_800E86A4 = 2; } else { block_74: @@ -5748,60 +5674,57 @@ block_74: D_800DC51C = 1; D_8018EE08 = 1; gGamestateNext = 4; - gCCSelection = (s32) CC_100; - temp_v1_4 = (s8) gNextDemoId; - switch (temp_v1_4) { /* switch 4 */ + gCCSelection = (s32) 1; + switch (gNextDemoId) { /* switch 4 */ case 0: /* switch 4 */ gCurrentCourseId = 0; - gScreenModeSelection = SCREEN_MODE_1P; + gScreenModeSelection = 0; gPlayerCountSelection1 = (s32) 1; D_8018EDF3 = 1; gCharacterSelections->unk0 = 0; - gModeSelection = GRAND_PRIX; + gModeSelection = 0; break; case 1: /* switch 4 */ gCurrentCourseId = (s16) 1; var_a2 = 2; - gScreenModeSelection = (s32) SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL; + gScreenModeSelection = (s32) 1; gPlayerCountSelection1 = 2; D_8018EDF3 = (s8) 2; gCharacterSelections->unk0 = (s8) 2; gCharacterSelections->unk1 = (s8) 4; - gModeSelection = VERSUS; + gModeSelection = 2; break; case 2: /* switch 4 */ gCurrentCourseId = 0x000B; - gScreenModeSelection = SCREEN_MODE_1P; + gScreenModeSelection = 0; gPlayerCountSelection1 = (s32) 1; D_8018EDF3 = 1; gCharacterSelections->unk0 = 1; - gModeSelection = GRAND_PRIX; + gModeSelection = 0; break; case 3: /* switch 4 */ gCurrentCourseId = 0x000E; - var_a3 = 3; var_a2 = 2; - gScreenModeSelection = SCREEN_MODE_3P_4P_SPLITSCREEN; + gScreenModeSelection = 3; gPlayerCountSelection1 = 3; D_8018EDF3 = (s8) 3; gCharacterSelections->unk0 = 5; gCharacterSelections->unk1 = (s8) 2; gCharacterSelections->unk2 = 7; - gModeSelection = VERSUS; + gModeSelection = 2; break; case 4: /* switch 4 */ var_a2 = 2; gCurrentCourseId = (s16) 2; - gScreenModeSelection = SCREEN_MODE_1P; + gScreenModeSelection = 0; gPlayerCountSelection1 = (s32) 1; D_8018EDF3 = 1; gCharacterSelections->unk0 = 7; - gModeSelection = GRAND_PRIX; + gModeSelection = 0; break; case 5: /* switch 4 */ gCurrentCourseId = 0x000C; var_a2 = 2; - var_a3 = 3; gScreenModeSelection = 3; gPlayerCountSelection1 = 4; D_8018EDF3 = (s8) 4; @@ -5809,11 +5732,11 @@ block_74: gCharacterSelections->unk1 = 1; gCharacterSelections->unk2 = 6; gCharacterSelections->unk3 = (s8) 3; - gModeSelection = VERSUS; + gModeSelection = 2; break; } - gNextDemoId = temp_v1_4 + 1; - if ((s8) gNextDemoId >= 6) { + gNextDemoId += 1; + if (gNextDemoId >= 6) { gNextDemoId = 0; } var_a0 = (s32 *) gCurrentCourseId; @@ -5823,22 +5746,20 @@ block_74: break; case 3: /* switch 3 */ var_a0 = &gMenuSelection; - temp_v1_5 = gMenuSelection; - if (temp_v1_5 != DATA_MENU) { - if (temp_v1_5 == MAIN_MENU) { - gMenuSelection = DATA_MENU; + if (gMenuSelection != 6) { + if (gMenuSelection == 0x0000000B) { + gMenuSelection = 6; } } else { - gMenuSelection = MAIN_MENU; + gMenuSelection = 0x0000000B; } break; case 4: /* switch 3 */ var_a0 = &gMenuSelection; - temp_v1_6 = gMenuSelection; var_t7 = 0x0000000B; - if (temp_v1_6 != (s32) OPTIONS_MENU) { - if (temp_v1_6 == MAIN_MENU) { - gMenuSelection = (s32) OPTIONS_MENU; + if (gMenuSelection != (s32) 5) { + if (gMenuSelection == 0x0000000B) { + gMenuSelection = (s32) 5; } } else { goto block_74; @@ -5850,71 +5771,68 @@ block_74: } if (gMenuSelection >= 0xE) { gGamestateNext = 4; - if (gModeSelection == TIME_TRIALS) { + if (gModeSelection == 1) { D_8018EDFB = (s8) 1; } - func_8009CE1C(var_a0, 1, var_a2, var_a3); + func_8009CE1C(var_a0, 1, var_a2); } D_8018EE0C = 0; return; } - switch (gDebugGotoScene) { /* switch 5; irregular */ - case DEBUG_GOTO_ENDING_SEQUENCE: /* switch 5 */ + switch (gDebugGotoScene) { /* switch 5; irregular */ + case 1: /* switch 5 */ gGamestateNext = (s32) 5; break; - case DEBUG_GOTO_CREDITS_SEQUENCE_CC_50: /* switch 5 */ - case DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA: /* switch 5 */ + case 2: /* switch 5 */ + case 3: /* switch 5 */ gGamestateNext = 9; - gCreditsCourseId = COURSE_LUIGI_RACEWAY; + gCreditsCourseId = 8; break; default: /* switch 5 */ gGamestateNext = 4; - if (gModeSelection == (s32) TIME_TRIALS) { + if (gModeSelection == (s32) 1) { D_8018EDFB = 1; } - } else { - gGamestateNext = (s32) 5; + break; } func_8000F124(1, 2); - if ((gScreenModeSelection == SCREEN_MODE_3P_4P_SPLITSCREEN) && ((temp_v1_8 = gModeSelection, (temp_v1_8 == GRAND_PRIX)) || (temp_v1_8 == TIME_TRIALS))) { - gModeSelection = VERSUS; + if ((gScreenModeSelection == 3) && ((gModeSelection == 0) || (gModeSelection == 1))) { + gModeSelection = 2; } - temp_a0 = gCurrentCourseId; - if ((temp_a0 != 0x000F) && (temp_a0 != 0x0010) && (temp_a0 != 0x0011) && (temp_a0 != 0x0013)) { + if ((gCurrentCourseId != 0x000F) && (gCurrentCourseId != 0x0010) && (gCurrentCourseId != 0x0011) && (gCurrentCourseId != 0x0013)) { var_v0 = gModeSelection; - if (var_v0 == BATTLE) { - gModeSelection = GRAND_PRIX; - var_v0 = GRAND_PRIX; + if (var_v0 == 3) { + gModeSelection = 0; + var_v0 = 0; } - if ((var_v0 == VERSUS) && (gPlayerCountSelection1 == 1)) { - gModeSelection = GRAND_PRIX; + if ((var_v0 == 2) && (gPlayerCountSelection1 == 1)) { + gModeSelection = 0; } } else { - gModeSelection = BATTLE; + gModeSelection = 3; if (gPlayerCountSelection1 == 1) { D_8018EDF3 = (s8) 2; - gScreenModeSelection = SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL; + gScreenModeSelection = 1; gPlayerCountSelection1 = (s32) D_8018EDF3; } } - gCupSelection = (s8) gCupSelectionByCourseId[temp_a0]; - temp_v1_9 = gDebugGotoScene; + gCupSelection = (s8) gCupSelectionByCourseId[gCurrentCourseId]; D_800DC540 = (s32) gCupSelection; - gCupCourseSelection = (s8) gPerCupIndexByCourseId[temp_a0]; - switch (temp_v1_9) { /* switch 6; irregular */ + gCupCourseSelection = (s8) gPerCupIndexByCourseId[gCurrentCourseId]; + switch (gDebugGotoScene) { /* switch 6; irregular */ case 2: /* switch 6 */ - gCCSelection = CC_50; + gCCSelection = 0; return; case 3: /* switch 6 */ - gCCSelection = CC_EXTRA; + gCCSelection = 3; return; default: /* switch 6 */ - if (gCCSelection == CC_EXTRA) { + if (gCCSelection == 3) { gIsMirrorMode = 1; return; } gIsMirrorMode = 0; - case 1: /* switch 5 */ + case 1: /* switch 6 */ default: /* switch 2 */ return; } @@ -5925,84 +5843,84 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CE64.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 draw_box(s32, s32, s32, s32, s32, s32, s32, s32, u32); // extern -void func_8009CE64(s32); // extern -extern ? D_800E7AE8; -extern UnkStruct_800DC5EC D_8015F480; -extern u32 D_8018E7B8; -extern s32 D_8018E7D0; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +struct _struct_D_800E7AE8_0x8 { + /* 0x0 */ u16 unk0; /* inferred */ + /* 0x2 */ u16 unk2; /* inferred */ + /* 0x4 */ u16 unk4; /* inferred */ + /* 0x6 */ char pad6[2]; +}; /* size = 0x8 */ + +? func_8009CE64(s32); /* extern */ +extern ? D_8018E7B8; +extern ? D_8018E7D0; extern ? D_8018E7E8; extern ? D_8018E810; -extern s32 gDisplayListHead; +static struct _struct_D_800E7AE8_0x8 D_800E7AE8[0]; /* unable to generate initializer */ void func_8009D77C(s32 arg0, s32 arg1, s32 arg2) { s32 sp44; u32 *sp3C; u32 *sp38; + s16 var_ra; + s16 var_t3; + s16 var_t4; s32 temp_t8; s32 temp_v0; s32 temp_v0_2; s32 temp_v0_4; - s32 temp_v0_5; s32 temp_v1_3; + struct UnkStruct_800DC5EC *temp_v0_3; + struct _struct_D_800E7AE8_0x8 *temp_v0_5; u32 *temp_t1; u32 *temp_t5; - u32 temp_lo; u32 temp_t6; + u32 var_t2; void *temp_a0; void *temp_a0_2; - void *temp_v0_3; - void *temp_v0_6; void *temp_v1; void *temp_v1_2; - s16 phi_t3; - s32 phi_ra; - s16 phi_t4; - u32 phi_t2; - - temp_v0 = gModeSelection; - if ((temp_v0 == GRAND_PRIX) || (temp_v0 == TIME_TRIALS)) { - temp_v0_4 = arg0 * 8; - temp_a0_2 = temp_v0_4 + &D_8018E810; - temp_v1_2 = temp_v0_4 + &D_8018E7E8; - sp44 = temp_a0_2->unk2; - phi_t3 = temp_v1_2->unk0; - phi_ra = temp_a0_2->unk0; - phi_t4 = temp_v1_2->unk2; + + if ((gModeSelection == 0) || (gModeSelection == 1)) { + temp_v0 = arg0 * 8; + temp_a0 = temp_v0 + &D_8018E810; + temp_v1 = temp_v0 + &D_8018E7E8; + var_t3 = temp_v1->unk0; + var_t4 = temp_v1->unk2; + var_ra = temp_a0->unk0; + sp44 = (s32) temp_a0->unk2; } else if (arg0 >= 4) { temp_v0_2 = arg0 * 8; - temp_a0 = temp_v0_2 + &D_8018E810; - temp_v1 = temp_v0_2 + &D_8018E7E8; - sp44 = temp_a0->unk2; - phi_t3 = temp_v1->unk0; - phi_ra = temp_a0->unk0; - phi_t4 = temp_v1->unk2; + temp_a0_2 = temp_v0_2 + &D_8018E810; + temp_v1_2 = temp_v0_2 + &D_8018E7E8; + var_t3 = temp_v1_2->unk0; + var_t4 = temp_v1_2->unk2; + var_ra = temp_a0_2->unk0; + sp44 = (s32) temp_a0_2->unk2; } else { - temp_v0_3 = (arg0 << 6) + &D_8015F480; - sp44 = temp_v0_3->unk2E; - phi_t3 = temp_v0_3->unk30; - phi_ra = temp_v0_3->unk2C; - phi_t4 = temp_v0_3->unk32; - } - temp_v0_5 = arg0 * 4; - temp_t1 = temp_v0_5 + &D_8018E7D0; - temp_t5 = temp_v0_5 + &D_8018E7B8; - temp_lo = (*temp_t1 * 0xFF) / *temp_t5; - phi_t2 = temp_lo; - if (temp_lo >= 0x100) { - phi_t2 = 0xFF; - } - temp_v1_3 = phi_ra / 2; + temp_v0_3 = &D_8015F480[arg0]; + var_t3 = temp_v0_3->screenStartX; + var_t4 = temp_v0_3->screenStartY; + var_ra = temp_v0_3->screenWidth; + sp44 = (s32) temp_v0_3->screenHeight; + } + temp_v0_4 = arg0 * 4; + temp_t1 = temp_v0_4 + &D_8018E7D0; + temp_t5 = temp_v0_4 + &D_8018E7B8; + var_t2 = (u32) (*temp_t1 * 0xFF) / (u32) *temp_t5; + if ((s32) var_t2 >= 0x100) { + var_t2 = 0x000000FF; + } + temp_v1_3 = var_ra / 2; temp_t8 = sp44 / 2; - temp_v0_6 = (arg2 * 8) + &D_800E7AE8; + temp_v0_5 = &D_800E7AE8[arg2]; sp3C = temp_t1; sp38 = temp_t5; - gDisplayListHead = draw_box(gDisplayListHead, phi_t3 - temp_v1_3, phi_t4 - temp_t8, temp_v1_3 + phi_t3, temp_t8 + phi_t4, temp_v0_6->unk0, temp_v0_6->unk2, temp_v0_6->unk4, phi_t2); + gDisplayListHead = draw_box(gDisplayListHead, var_t3 - temp_v1_3, var_t4 - temp_t8, temp_v1_3 + var_t3, temp_t8 + var_t4, (s32) temp_v0_5->unk0, (s32) temp_v0_5->unk2, (s32) temp_v0_5->unk4, (s32) var_t2); if (arg1 == 0) { temp_t6 = *temp_t1 + 1; *temp_t1 = temp_t6; - if ((*temp_t5 + 1) < temp_t6) { + if ((u32) (*temp_t5 + 1) < temp_t6) { func_8009CE64(arg0); } } @@ -6019,210 +5937,183 @@ void func_8009D978(s32 arg0, s32 arg1) { func_8009D77C(arg0, arg1, 1); } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 draw_box(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -extern UnkStruct_800DC5EC D_8015F480; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 extern ? D_8018E7E8; extern ? D_8018E810; -extern s32 gDisplayListHead; void func_8009D998(s32 arg0) { + s16 var_t0; + s16 var_t1; + s16 var_t2; + s16 var_t3; s32 temp_v0; s32 temp_v0_2; s32 temp_v0_4; - s32 temp_v0_5; s32 temp_v1_3; + struct UnkStruct_800DC5EC *temp_v0_3; void *temp_a0; void *temp_a0_2; - void *temp_v0_3; void *temp_v1; void *temp_v1_2; - s16 phi_t0; - s32 phi_t2; - s16 phi_t1; - s32 phi_t3; - - temp_v0 = gModeSelection; - if ((temp_v0 == GRAND_PRIX) || (temp_v0 == TIME_TRIALS)) { - temp_v0_4 = arg0 * 8; - temp_v1_2 = temp_v0_4 + &D_8018E7E8; - temp_a0_2 = temp_v0_4 + &D_8018E810; - phi_t0 = temp_v1_2->unk0; - phi_t2 = temp_a0_2->unk0; - phi_t1 = temp_v1_2->unk2; - phi_t3 = temp_a0_2->unk2; + + if ((gModeSelection == 0) || (gModeSelection == 1)) { + temp_v0 = arg0 * 8; + temp_v1 = temp_v0 + &D_8018E7E8; + temp_a0 = temp_v0 + &D_8018E810; + var_t0 = temp_v1->unk0; + var_t1 = temp_v1->unk2; + var_t2 = temp_a0->unk0; + var_t3 = temp_a0->unk2; } else { temp_v0_2 = arg0 * 8; if (arg0 >= 4) { - temp_v1 = temp_v0_2 + &D_8018E7E8; - temp_a0 = temp_v0_2 + &D_8018E810; - phi_t0 = temp_v1->unk0; - phi_t2 = temp_a0->unk0; - phi_t1 = temp_v1->unk2; - phi_t3 = temp_a0->unk2; + temp_v1_2 = temp_v0_2 + &D_8018E7E8; + temp_a0_2 = temp_v0_2 + &D_8018E810; + var_t0 = temp_v1_2->unk0; + var_t1 = temp_v1_2->unk2; + var_t2 = temp_a0_2->unk0; + var_t3 = temp_a0_2->unk2; } else { - temp_v0_3 = (arg0 << 6) + &D_8015F480; - phi_t0 = temp_v0_3->unk30; - phi_t2 = temp_v0_3->unk2C; - phi_t1 = temp_v0_3->unk32; - phi_t3 = temp_v0_3->unk2E; + temp_v0_3 = &D_8015F480[arg0]; + var_t0 = temp_v0_3->screenStartX; + var_t1 = temp_v0_3->screenStartY; + var_t2 = temp_v0_3->screenWidth; + var_t3 = temp_v0_3->screenHeight; } } - temp_v0_5 = phi_t2 / 2; - temp_v1_3 = phi_t3 / 2; - gDisplayListHead = draw_box(gDisplayListHead, phi_t0 - temp_v0_5, phi_t1 - temp_v1_3, temp_v0_5 + phi_t0, temp_v1_3 + phi_t1, 0, 0, 0, 0xFF); + temp_v0_4 = var_t2 / 2; + temp_v1_3 = var_t3 / 2; + gDisplayListHead = draw_box(gDisplayListHead, var_t0 - temp_v0_4, var_t1 - temp_v1_3, temp_v0_4 + var_t0, temp_v1_3 + var_t1, 0, 0, 0, 0x000000FF); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009D998.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, ?, ?, ?, s32, s32, s32, s32, u32); // extern -void func_8009CE64(?, ? *); // extern +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +? func_8009CE64(?, ? *); /* extern */ extern u32 D_8018E7C8; -extern s32 D_8018E7D0; -extern void *gDisplayListHead; +extern ? D_8018E7D0; void func_8009DAA8(void) { - u32 temp_lo; + Gfx *temp_v1; u32 temp_t8; - void *temp_v1; - u32 phi_t0; + u32 var_t0; temp_t8 = D_8018E7D0.unk10 + 1; D_8018E7D0.unk10 = temp_t8; - if (temp_t8 >= (D_8018E7C8 + 1)) { + if (temp_t8 >= (u32) (D_8018E7C8 + 1)) { func_8009CE64(4, &D_8018E7D0); } temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->unk4 = 0; - temp_v1->unk0 = 0xE7000000; - temp_lo = (D_8018E7D0.unk10 * 0xFF) / D_8018E7C8; - phi_t0 = temp_lo; - if (temp_lo >= 0x100) { - phi_t0 = 0xFF; + temp_v1->words.w1 = 0; + temp_v1->words.w0 = 0xE7000000; + var_t0 = (u32) (D_8018E7D0.unk10 * 0xFF) / (u32) D_8018E7C8; + if ((s32) var_t0 >= 0x100) { + var_t0 = 0x000000FF; } - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x140, 0xF0, 0, 0, 0, phi_t0); + gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, (s32) var_t0); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009DAA8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, ?, ?, ?, s32, s32, s32, s32, u32); // extern -void func_8009CE64(?); // extern +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +? func_8009CE64(?); /* extern */ extern s32 D_8018D9B8; extern u32 D_8018E7C8; -extern s32 D_8018E7D0; -extern void *gDisplayListHead; +extern ? D_8018E7D0; void func_8009DB8C(void) { - s32 temp_s0; - s32 temp_s0_2; - s32 temp_s0_3; + Gfx *temp_a0; + Gfx *temp_a1; + Gfx *temp_a1_2; + Gfx *temp_a1_3; + Gfx *temp_v0_2; + Gfx *temp_v1; s32 temp_t4; s32 temp_t5; - u32 temp_lo; + s32 var_s0; + s32 var_s0_2; u32 temp_t7; u32 temp_v0; - u32 temp_v0_2; - void *temp_a0; - void *temp_a1; - void *temp_a1_2; - void *temp_a1_3; - void *temp_v0_3; - void *temp_v1; - s32 phi_s0; - s32 phi_s0_2; - u32 phi_v0; - u32 phi_s3; - s32 phi_s0_3; - u32 phi_v1; - u32 phi_s3_2; + u32 var_s3; + u32 var_v1; + void *temp_t8; temp_t7 = D_8018E7D0.unk10 + 1; D_8018E7D0.unk10 = temp_t7; temp_v0 = D_8018E7C8; - phi_v0 = temp_v0; if (temp_t7 >= temp_v0) { - phi_s0 = 0; + var_s0 = 0; if (temp_t7 == temp_v0) { do { - *(D_8018D9B8 + phi_s0) = 1; - (D_8018D9B8 + phi_s0)->unk1 = 1; - (D_8018D9B8 + phi_s0)->unk2 = 1; - temp_s0 = phi_s0 + 4; - (D_8018D9B8 + phi_s0)->unk3 = 1; - phi_s0 = temp_s0; - } while (temp_s0 != 0x4B0); + *(D_8018D9B8 + var_s0) = 1; + (D_8018D9B8 + var_s0)->unk1 = 1; + (D_8018D9B8 + var_s0)->unk2 = 1; + temp_t8 = D_8018D9B8 + var_s0; + var_s0 += 4; + temp_t8->unk3 = 1; + } while (var_s0 != 0x4B0); } else { func_8009CE64(4); } goto block_14; } - phi_s0_2 = 0; - phi_s0_2 = 0; - phi_s3_2 = 0; - if ((0x4B0 / temp_v0) != 0) { + var_s0_2 = 0; + var_s3 = 0; + if ((0x4B0U / temp_v0) != 0) { do { - phi_s3 = phi_s3_2; - if ((*(D_8018D9B8 + phi_s0_2) == 0) && (random_int(((0x4B0 - D_8018E7D0.unk10) / phi_v0) & 0xFFFF) == 0)) { - *(D_8018D9B8 + phi_s0_2) = 1; - phi_s3 = phi_s3_2 + 1; + if ((*(D_8018D9B8 + var_s0_2) == 0) && (random_int(((u32) (0x4B0U - D_8018E7D0.unk10) / temp_v0) & 0xFFFF) == 0)) { + var_s3 += 1; + *(D_8018D9B8 + var_s0_2) = 1; } - temp_v0_2 = D_8018E7C8; - temp_s0_2 = phi_s0_2 + 1; - phi_v0 = temp_v0_2; - phi_s0_2 = temp_s0_2; - phi_s3_2 = phi_s3; - if (temp_s0_2 >= 0x4B0) { - + var_s0_2 += 1; + if (var_s0_2 >= 0x4B0) { + var_s0_2 = 0; } - } while (phi_s3 < (0x4B0 / temp_v0_2)); + } while (var_s3 < (u32) (0x4B0U / (u32) D_8018E7C8)); block_14: + var_s0_2 = 0; } - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0; - temp_v0_3->unk0 = 0xE7000000; + temp_v0_2 = gDisplayListHead; + gDisplayListHead = temp_v0_2 + 8; + temp_v0_2->words.w1 = 0; + temp_v0_2->words.w0 = 0xE7000000; temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->unk0 = 0xB900031D; - temp_v1->unk4 = 0x504240; + temp_v1->words.w0 = 0xB900031D; + temp_v1->words.w1 = 0x00504240; temp_a0 = gDisplayListHead; gDisplayListHead = temp_a0 + 8; - temp_a0->unk4 = 0xFF; - temp_a0->unk0 = 0xFA000000; + temp_a0->words.w1 = 0x000000FF; + temp_a0->words.w0 = 0xFA000000; temp_a1 = gDisplayListHead; gDisplayListHead = temp_a1 + 8; - temp_a1->unk4 = 0xFFFDF6FB; - temp_a1->unk0 = 0xFCFFFFFF; - phi_s0_3 = 0; + temp_a1->words.w1 = 0xFFFDF6FB; + temp_a1->words.w0 = 0xFCFFFFFF; do { - if (*(D_8018D9B8 + phi_s0_3) != 0) { + if (*(D_8018D9B8 + var_s0_2) != 0) { temp_a1_2 = gDisplayListHead; - temp_t4 = (phi_s0_3 % 0x28) * 8; + temp_t4 = (var_s0_2 % 40) * 8; gDisplayListHead = temp_a1_2 + 8; - temp_t5 = (phi_s0_3 / 0x28) * 8; - temp_a1_2->unk4 = ((temp_t4 & 0x3FF) << 0xE) | ((temp_t5 & 0x3FF) * 4); - temp_a1_2->unk0 = (((temp_t4 + 8) & 0x3FF) << 0xE) | 0xF6000000 | (((temp_t5 + 8) & 0x3FF) * 4); + temp_t5 = (var_s0_2 / 40) * 8; + temp_a1_2->words.w1 = ((temp_t4 & 0x3FF) << 0xE) | ((temp_t5 & 0x3FF) * 4); + temp_a1_2->words.w0 = (((temp_t4 + 8) & 0x3FF) << 0xE) | 0xF6000000 | (((temp_t5 + 8) & 0x3FF) * 4); } - temp_s0_3 = phi_s0_3 + 1; - phi_s0_3 = temp_s0_3; - } while (temp_s0_3 != 0x4B0); + var_s0_2 += 1; + } while (var_s0_2 != 0x4B0); temp_a1_3 = gDisplayListHead; gDisplayListHead = temp_a1_3 + 8; - temp_a1_3->unk4 = 0; - temp_a1_3->unk0 = 0xE7000000; - temp_lo = (D_8018E7D0.unk10 * 0xFF) / D_8018E7C8; - phi_v1 = temp_lo; - if (temp_lo >= 0x100) { - phi_v1 = 0xFF; + temp_a1_3->words.w1 = 0; + temp_a1_3->words.w0 = 0xE7000000; + var_v1 = (u32) (D_8018E7D0.unk10 * 0x000000FFU) / (u32) D_8018E7C8; + if ((s32) var_v1 >= 0x100) { + var_v1 = 0x000000FF; } - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x140, 0xF0, 0, 0, 0, phi_v1); + gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, (s32) var_v1); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009DB8C.s") @@ -6401,44 +6292,31 @@ void func_8009E0F0(u32 arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E0F0.s") #endif -extern s32 D_8018EDE0; - void func_8009E1C0(void) { func_8009DFE0(10); D_8018EDE0 = 0; } -extern s32 D_8018EDE0; - void func_8009E1E4(void) { func_8009E000(10); D_8018EDE0 = 0; } -extern s32 D_8018EDE0; - void func_8009E208(void) { func_8009DFE0(10); D_8018EDE0 = 1; } -extern s32 D_8018EDE0; - void func_8009E230(void) { func_8009DFE0(10); D_8018EDE0 = 2; } -extern s32 D_8018EDE0; - void func_8009E258(void) { func_8009DFE0(10); D_8018EDE0 = 3; } -void func_8009DFE0(s32); -extern s32 D_8018EDE0; //bss - void func_8009E280(void) { func_8009DFE0(10); D_8018EDE0 = 4; @@ -6555,7 +6433,6 @@ void func_8009E2F0(s32 arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E2F0.s") #endif -void func_8009E5FC(s32); void func_8009E5BC(void) { s32 i; for (i = 0; i < 4; i++) { @@ -6563,9 +6440,6 @@ void func_8009E5BC(void) { } } -extern s8 D_8018E838[]; -extern s32 D_8018E840[]; - void func_8009E5FC(s32 arg0) { D_8018E838[arg0] = 1; D_8018E840[arg0] = 0; @@ -6579,32 +6453,25 @@ void func_8009E620(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 struct _struct_D_800E8234_0x8 { /* 0x0 */ void *unk0; /* inferred */ /* 0x4 */ ? unk4; /* inferred */ /* 0x4 */ char pad4[4]; }; /* size = 0x8 */ -s32 func_800051C4(); /* extern */ -void func_8006EF60(); /* extern */ -void func_800996BC(MkTexture *, ?, s8); /* extern */ +? func_8006EE44(s8); /* extern */ +? func_8006EF60(); /* extern */ +? func_800996BC(MkTexture *, ?, s8); /* extern */ s32 func_8009A374(void *); /* extern */ s32 func_8009A478(void *, s32); /* extern */ -void func_8009B0A4(?, ?); /* extern */ -void func_8009B538(?, ?, u16, u16, s32); /* extern */ -u32 func_8009B8C4(u64 *); /* extern */ -void func_8009B954(MkTexture *); /* extern */ -void func_8009B998(); /* extern */ -s32 func_800B5020(s32, s8, s8); /* extern */ +? func_8009B0A4(?, ?); /* extern */ +? func_8009B538(?, ?, u16, u16, s32); /* extern */ s32 func_800B5218(); /* extern */ -s32 func_800B5B94(); /* extern */ -void func_800B6708(); /* extern */ extern ? D_801640F4; -extern s32 D_8018CA78; +extern u32 D_8018CA78; extern s8 D_8018ED90; extern s32 D_8018ED94; -extern s32 gPlayerWinningIndex; static struct _struct_D_800E7248_0x8 D_800E7248[0]; /* unable to generate initializer */ static ? D_800E7268; /* unable to generate initializer */ static struct _struct_D_800E74E8_0x8 D_800E74E8[0]; /* unable to generate initializer */ @@ -6733,8 +6600,6 @@ static MkTexture *D_800E8274[8] = { D_020049E4, D_02004A34, }; - -// texture use in menu static MkTexture *D_800E8294[8] = { D_020048F4, D_0200491C, @@ -6755,7 +6620,6 @@ static MkAnimation *D_800E8320[8] = { D_02007468, D_02006AD8, }; -static ? D_800E85F7; /* unable to generate initializer */ static MkAnimation *gCharacterDefeatAnimation[8] = { D_020068E0, D_02006AC8, @@ -6766,8 +6630,8 @@ static MkAnimation *gCharacterDefeatAnimation[8] = { D_02007640, D_02006CB0, }; +static ? D_800E85F7; /* unable to generate initializer */ static ? D_800EFD64; /* unable to generate initializer; const */ -extern s16 gCupCourseOrder; MkTexture *D_800E7D74[0x14] = { D_02001B2C, D_02001B54, @@ -6863,7 +6727,6 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { s32 temp_v0_5; s32 temp_v0_6; s32 temp_v0_7; - s32 temp_v0_8; s32 var_a2; s32 var_v0; s32 var_v0_2; @@ -6872,7 +6735,6 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { s32 var_v1_5; s8 temp_a1; s8 temp_a1_2; - s8 temp_v0_9; struct _struct_D_800E7248_0x8 *temp_v0_4; struct _struct_D_800E74E8_0x8 *temp_v0_2; struct _struct_D_800E8234_0x8 *temp_v0_3; @@ -7129,7 +6991,7 @@ loop_3: case 0x61: case 0x62: sp7C = var_ra; - var_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe_2(D_800E7E34[*(&gCupCourseOrder - 0xBE + (var_ra->type * 2))])); + var_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe_2(D_800E7E34[*(gCupCourseOrder - 0xBE + (var_ra->type * 2))])); return; case 0x5E: sp7C = var_ra; @@ -7201,20 +7063,19 @@ loop_3: case 0x8B: sp7C = var_ra; temp_v0_6 = var_ra->type - 0x7C; - func_800996BC(segmented_to_virtual_dupe(D_800E7D74[*(&gCupCourseOrder + (((temp_v0_6 / 4) * 8) + ((temp_v0_6 % 4) * 2)))]), -1); + func_800996BC(segmented_to_virtual_dupe(D_800E7D74[*(gCupCourseOrder + (((temp_v0_6 / 4) * 8) + ((temp_v0_6 % 4) * 2)))]), -1); temp_v0_7 = var_ra->type - 0x7C; - func_800996BC(segmented_to_virtual_dupe(D_800E7DC4[*(&gCupCourseOrder + (((temp_v0_7 / 4) * 8) + ((temp_v0_7 % 4) * 2)))]), 0); + func_800996BC(segmented_to_virtual_dupe(D_800E7DC4[*(gCupCourseOrder + (((temp_v0_7 / 4) * 8) + ((temp_v0_7 % 4) * 2)))]), 0); func_800996BC(segmented_to_virtual_dupe(D_02004A0C), 0); return; case 0xB1: case 0xB2: case 0xB3: case 0xB4: - temp_v0_8 = gModeSelection; temp_a1 = *(&D_800EFD64 + *(&D_800E85F7 + type)); var_v1_3 = 0; - if (temp_v0_8 != VERSUS) { - if (temp_v0_8 != BATTLE) { + if (gModeSelection != 2) { + if (gModeSelection != 3) { var_a2 = type * 4; } else { var_a2 = type * 4; @@ -7247,7 +7108,7 @@ block_63: return; case 0xBB: sp7C = var_ra; - var_ra->unk1C = func_800B5020(D_8018CA78, *gCharacterSelections, priority); + var_ra->unk1C = func_800B5020(D_8018CA78, (s32) *gCharacterSelections); var_ra->unk20 = func_800B5218(); if (*D_80162DD4 != 1) { sp7C = var_ra; @@ -7261,9 +7122,8 @@ block_63: } return; case 0xE6: - temp_v0_9 = gTimeTrialDataCourseIndex; sp7C = var_ra; - var_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe_2(D_800E7E34[*(&gCupCourseOrder + (((temp_v0_9 / 4) * 8) + ((temp_v0_9 % 4) * 2)))])); + var_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe_2(D_800E7E34[*(gCupCourseOrder + ((((s8) gTimeTrialDataCourseIndex / 4) * 8) + (((s8) gTimeTrialDataCourseIndex % 4) * 2)))])); var_ra->unk1C = (s32) gTimeTrialDataCourseIndex; func_800996BC(segmented_to_virtual_dupe(D_02004A0C), 0); func_8006EF60(); @@ -8199,93 +8059,76 @@ void func_800A0AD0(UNUSED struct_8018D9E0_entry *unused) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800A08D8(u8, s32, s32); /* extern */ -s32 func_800A095C(void *, ?, ?, s32); /* extern */ -extern ? D_8018E938; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +s32 func_800A095C(s8 *, ?, ?, s32); /* extern */ extern ? D_8018EB34; -static s8 D_800E86C4 = 0; /* const */ void func_800A0B80(struct_8018D9E0_entry *arg0) { Gfx *temp_v1; Gfx *temp_v1_2; s32 temp_a2; - s32 temp_lo; s32 temp_s1; s32 temp_s1_2; s32 temp_s2; - s32 temp_s5; + s32 temp_t7; + s32 var_s1; + s32 var_s5; + s8 *var_s6; s8 temp_v0; s8 temp_v0_2; - void *temp_s4; - s8 *phi_s6; - s32 phi_s5; - s32 phi_s0; - s32 phi_s1; + u32 var_s0; temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->words.w1 = 0x32FF; + var_s6 = D_800E86C4; + var_s5 = 0; + temp_v1->words.w1 = 0x000032FF; temp_v1->words.w0 = 0xFA000000; - phi_s6 = &D_800E86C4; - phi_s5 = 0; do { - temp_v0 = *phi_s6; + temp_v0 = *var_s6; if (temp_v0 != 0) { - temp_s1 = phi_s5 * 0xA; + temp_s1 = var_s5 * 0xA; temp_a2 = arg0->row + temp_s1 + 1; - if ((s32) temp_v0 < 0xA) { - func_800A08D8((temp_v0 + 0x10) & 0xFF, 0x32, temp_a2); + if (temp_v0 < 0xA) { + func_800A08D8((temp_v0 + 0x10) & 0xFF, 0x00000032, temp_a2); } else { - func_800A08D8((((s32) temp_v0 % 10) + 0x10) & 0xFF, 0x35, temp_a2); - func_800A08D8(0x11U, 0x2F, arg0->row + temp_s1 + 1); + func_800A08D8(((temp_v0 % 10) + 0x10) & 0xFF, 0x00000035, temp_a2); + func_800A08D8(0x11U, 0x0000002F, arg0->row + temp_s1 + 1); } - temp_v0_2 = *phi_s6; + temp_v0_2 = *var_s6; temp_s2 = arg0->row + temp_s1 + 1; if (*(&D_8018EB34 + (temp_v0_2 * 4)) == 0) { - temp_s4 = (temp_v0_2 << 5) - 0x20 + &D_8018E938; - temp_s1_2 = func_800A095C(temp_s4 + 0xE, 0x10, 0x4F, temp_s2) * 8; - if (temp_s4->unkA != 0) { + temp_t7 = (temp_v0_2 << 5) - 0x20; + temp_s1_2 = func_800A095C(&D_8018E938->game_name[temp_t7], 0x10, 0x4F, temp_s2) * 8; + if (D_8018E938->ext_name[temp_t7] != 0) { func_800A08D8(0x3CU, temp_s1_2 + 0x4F, temp_s2); - func_800A08D8((u8) temp_s4->unkA, temp_s1_2 + 0x57, temp_s2); + func_800A08D8((u8) D_8018E938->ext_name[temp_t7], temp_s1_2 + 0x57, temp_s2); } - phi_s0 = (s32) ((u32) (temp_s4->unk0 + 0xFF) >> 8); - phi_s1 = 0x10; + var_s1 = 0x10; + var_s0 = (u32) ((temp_t7 + D_8018E938)->unk0 + 0xFF) >> 8; do { - func_800A08D8(((phi_s0 % 10) + 0x10) & 0xFF, phi_s1 + 0xFD, temp_s2); - temp_lo = phi_s0 / 10; - phi_s0 = temp_lo; - phi_s1 += -8; - } while (temp_lo != 0); + func_800A08D8((((s32) var_s0 % 10) + 0x10) & 0xFF, var_s1 + 0xFD, temp_s2); + var_s0 = (u32) ((s32) var_s0 / 10); + var_s1 -= 8; + } while (var_s0 != 0); } } - temp_s5 = phi_s5 + 1; - phi_s6 += 1; - phi_s5 = temp_s5; - } while (temp_s5 != 9); + var_s5 += 1; + var_s6 += 1; + } while (var_s5 != 9); temp_v1_2 = gDisplayListHead; gDisplayListHead = temp_v1_2 + 8; temp_v1_2->words.w0 = 0xED000000; - temp_v1_2->words.w1 = 0x4FC3BC; + temp_v1_2->words.w1 = 0x004FC3BC; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0B80.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -static MkTexture *D_800E7D0C[0xA] = { - D_020016BC, - D_020016E4, - D_0200170C, - D_02001734, - D_0200175C, - D_02001784, - D_020017AC, - D_020017D4, - D_020017FC, - D_02001824, -}; +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +// Probably the textures for numbers 0-9 +extern MkTexture *D_800E7D0C[0xA]; void func_800A0DFC(void) { s32 temp_t6; @@ -8295,9 +8138,9 @@ void func_800A0DFC(void) { var_s0 = gControllerPakNumPagesFree; var_s1 = 0x00000110; do { - temp_t6 = (var_s0 % 10) * 4; - var_s0 = var_s0 / 10; - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual_dupe(*(D_800E7D0C + temp_t6)), var_s1, 0x000000B8); + temp_t6 = var_s0 % 10; + var_s0 /= 10; + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual_dupe(D_800E7D0C[temp_t6]), var_s1, 0x000000B8); var_s1 -= 9; } while (var_s0 != 0); } @@ -8393,8 +8236,23 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0FA4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c -static ? D_800E7940; /* unable to generate initializer */ +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +s8 *D_800E7940[4][4] = { + { + "NO N64 CONTROLLER PAK DETECTED", + "TO SAVE GHOST DATA, ", + "INSERT N64 CONTROLLER PAK ", + "INTO CONTROLLER 1", + }, + { "UNABLE TO READ ", "N64 CONTROLLER PAK DATA", "", "" }, + { "", "", "", "" }, + { + "INSUFFICIENT FREE PAGES AVAILABLE ", + "IN N64 CONTROLLER PAK TO CREATE ", + "GAME DATA, PLEASE FREE 121 PAGES.", + "SEE INSTRUCTION BOOKLET FOR DETAILS.", + }, +}; void func_800A10CC(struct_8018D9E0_entry *arg0) { s32 temp_s3; @@ -8414,7 +8272,7 @@ block_6: gDisplayListHead = func_80098C18(gDisplayListHead, 0x0000001E, 0x00000032, 0x00000122, 0x0000006E, 0, 0, 0, 0x000000FF); temp_s3 = arg0->unk4 - 2; set_text_color(3); - var_s2 = (temp_s3 * 0x10) + &D_800E7940; + var_s2 = D_800E7940[temp_s3]; var_s0 = 0x00000041; var_s1 = 0; do { @@ -8515,39 +8373,38 @@ block_4: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A143C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -static ? D_800E7168; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7168[]; /* unable to generate initializer */ void func_800A1500(struct_8018D9E0_entry *arg0) { - s32 sp1C; - s32 temp_v1; struct_8018D9E0_entry *temp_v0; - void *temp_v0_2; - s32 phi_a1; + Unk_D_800E70A0 *temp_v0_2; + s32 var_a1; - sp1C = 0; - temp_v0 = find_8018D9E0_entry_dupe(0x64); - temp_v1 = temp_v0->unk4; - phi_a1 = sp1C; - switch (temp_v1) { /* irregular */ + var_a1 = 0; + temp_v0 = find_8018D9E0_entry_dupe(0x00000064); + switch (temp_v0->unk4) { /* irregular */ + case 0: + case 1: + break; case 2: - if (arg0->type != (((s32) temp_v0->unk1C % 4) + 0x5F)) { - case 3: - phi_a1 = 1; + if (((temp_v0->unk1C % 4) + 0x5F) != arg0->type) { + var_a1 = 1; } break; + case 3: + var_a1 = 1; + break; } -case 0: -case 1: - switch (phi_a1) { /* switch 1; irregular */ + switch (var_a1) { /* switch 1; irregular */ case 0: /* switch 1 */ - func_8009A76C(arg0->D_8018DEE0_index, 0x17, 0x70, -1); - return; + func_8009A76C(arg0->D_8018DEE0_index, 0x00000017, 0x00000070, -1); + break; case 1: /* switch 1 */ - temp_v0_2 = (arg0->type * 8) - 0x2F8 + &D_800E7168; - func_8009A76C(arg0->D_8018DEE0_index, (s32) temp_v0_2->unk0, (s32) temp_v0_2->unk2, -2); - return; + temp_v0_2 = &D_800E7168[arg0->type - 0x5F]; + func_8009A76C(arg0->D_8018DEE0_index, temp_v0_2->column, temp_v0_2->row, -2); + break; } } #else @@ -9293,14 +9150,10 @@ void func_800A2D1C(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800A32B4(s32, s32, s8, s32); /* extern */ -extern s16 gGPCurrentRacePlayerIdByRank; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +? func_800A32B4(s32, s32, s8, s32); /* extern */ extern s16 D_80164368; extern ? D_80164370; -extern s8 D_8018EDF3; -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ s8 *D_800E7500[9] = { "mushroom cup", "flower cup", @@ -9311,97 +9164,88 @@ s8 *D_800E7500[9] = { "flower cup", "star cup", "special cup", -}; /* const */ -s8 *D_800E76CC[4] = { "50(", "100(", "150(", "extra" }; /* const */ +}; +s8 *D_800E76CC[4] = { "50(", "100(", "150(", "extra" }; void func_800A2EB8(struct_8018D9E0_entry *arg0) { s8 sp74; s8 sp70; s8 sp69; s8 sp68; - s16 *temp_s0; - s32 temp_s0_2; - s32 temp_s2; - s32 temp_s2_2; - s8 *temp_s1; - s8 temp_v0; - s16 *phi_s0; - s8 *phi_s1; - s16 *phi_s0_2; - s32 phi_a0; - s32 phi_s3; - s8 *phi_s1_2; - s32 phi_s2; - s16 *phi_s0_3; - s32 phi_a0_2; - s32 phi_s3_2; - s8 *phi_s1_3; - s32 phi_s2_2; + s16 *var_s0; + s16 *var_s0_2; + s16 *var_s0_3; + s16 temp_t6; + s32 temp_s0; + s32 var_a0; + s32 var_a0_2; + s32 var_s2; + s32 var_s2_2; + s32 var_s3; + s32 var_s3_2; + s8 *var_s1; + s8 *var_s1_2; + s8 *var_s1_3; - phi_s0 = &gGPCurrentRacePlayerIdByRank; - phi_s1 = &sp70; + var_s0 = gGPCurrentRacePlayerIdByRank; + var_s1 = &sp70; do { - temp_s0 = phi_s0 + 2; - temp_s1 = phi_s1 + 1; - temp_s1->unk-1 = (s8) gPlayers[*phi_s0].characterId; - phi_s0 = temp_s0; - phi_s1 = temp_s1; - } while ((u32) temp_s0 < (u32) &D_80164370); + temp_t6 = *var_s0; + var_s0 += 2; + var_s1 += 1; + var_s1->unk-1 = (s8) gPlayers[temp_t6].characterId; + } while ((u32) var_s0 < (u32) &D_80164370); set_text_color(4); func_80093324(arg0->column + 0x1E, arg0->row + 0x19, "results", 0, 1.0f, 1.0f); set_text_color(5); func_80093324(arg0->column + 0x2C, arg0->row + 0x28, "round", 0, 0.7f, 0.7f); convert_number_to_ascii(gCupCourseSelection + 1, &sp68); func_80093324(arg0->column + 0x57, arg0->row + 0x28, &sp69, 0, 0.7f, 0.7f); - phi_s0_2 = &gGPCurrentRacePlayerIdByRank; - phi_s3 = 0; - phi_s1_2 = &sp70; - phi_s2 = 0; + var_s0_2 = gGPCurrentRacePlayerIdByRank; + var_s2 = 0; + var_s1_2 = &sp70; + var_s3 = 0; do { - if ((s32) *phi_s0_2 < (s32) D_8018EDF3) { - phi_a0 = (s32) gGlobalTimer % 3; + if (*var_s0_2 < D_8018EDF3) { + var_a0 = (s32) gGlobalTimer % 3; } else { - phi_a0 = 3; - } - set_text_color(phi_a0); - func_800A32B4(arg0->column + 7, arg0->row + phi_s3 + 0x38, *phi_s1_2, phi_s2); - temp_s2 = phi_s2 + 1; - phi_s0_2 += 2; - phi_s3 += 0x10; - phi_s1_2 += 1; - phi_s2 = temp_s2; - } while (temp_s2 < 4); - phi_s0_3 = &D_80164368; - phi_s3_2 = 0x40; - phi_s1_3 = &sp74; - phi_s2_2 = 4; + var_a0 = 3; + } + set_text_color(var_a0); + func_800A32B4(arg0->column + 7, arg0->row + var_s3 + 0x38, *var_s1_2, var_s2); + var_s2 += 1; + var_s1_2 += 1; + var_s0_2 += 2; + var_s3 += 0x10; + } while (var_s2 < 4); + var_s0_3 = &D_80164368; + var_s2_2 = 4; + var_s1_3 = &sp74; + var_s3_2 = 0x40; do { - if ((s32) *phi_s0_3 < (s32) D_8018EDF3) { - phi_a0_2 = (s32) gGlobalTimer % 3; + if (*var_s0_3 < D_8018EDF3) { + var_a0_2 = (s32) gGlobalTimer % 3; } else { - phi_a0_2 = 3; - } - set_text_color(phi_a0_2); - func_800A32B4(0xBE - arg0->column, arg0->row + phi_s3_2 + 0x5A, *phi_s1_3, phi_s2_2); - temp_s2_2 = phi_s2_2 + 1; - phi_s0_3 += 2; - phi_s3_2 += 0x10; - phi_s1_3 += 1; - phi_s2_2 = temp_s2_2; - } while (temp_s2_2 != 8); + var_a0_2 = 3; + } + set_text_color(var_a0_2); + func_800A32B4(0xBE - arg0->column, arg0->row + var_s3_2 + 0x5A, *var_s1_3, var_s2_2); + var_s2_2 += 1; + var_s1_3 += 1; + var_s0_3 += 2; + var_s3_2 += 0x10; + } while (var_s2_2 != 8); set_text_color(5); - temp_s0_2 = (s32) (((f32) (get_string_width(D_800E7500[gCupSelection]) + 8) * 0.6f) / 2.0f); + temp_s0 = (s32) (((f32) (get_string_width(D_800E7500[gCupSelection]) + 8) * 0.6f) / 2.0f); draw_text((-(s32) (((f32) (get_string_width(D_800E76CC[gCCSelection]) + 8) * 0.6f) / 2.0f) - arg0->column) + 0xF5, arg0->row + 0xE1, D_800E7500[D_800DC540], 0, 0.6f, 0.6f); - temp_v0 = D_8018EDF3; - draw_text((temp_s0_2 - arg0->column) + 0xF5, arg0->row + 0xE1, D_800E76CC[*(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0 * 3) + *(&gGameModeRowSelectionForNumPlayers + temp_v0)))], 0, 0.6f, 0.6f); + draw_text((temp_s0 - arg0->column) + 0xF5, arg0->row + 0xE1, D_800E76CC[(*(D_800E86B0 - 3))[(D_8018EDF3 * 3) + (D_800E86AC - 1)[D_8018EDF3]]], 0, 0.6f, 0.6f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A2EB8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -extern s16 gGPCurrentRacePlayerIdByRank; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 static s8 *D_800E76A8[9] = { "MARIO", "LUIGI", @@ -9412,7 +9256,7 @@ static s8 *D_800E76A8[9] = { "PEACH", "BOWSER", D_800EFE0C, -}; /* const */ +}; static s8 D_800EFE0C[9] = { 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0 }; /* const */ void func_800A32B4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { @@ -9422,7 +9266,7 @@ void func_800A32B4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { s8 sp3D; s8 sp3C; - sp50 = gTimePlayerLastTouchedFinishLine[*(&gGPCurrentRacePlayerIdByRank + (arg3 * 2))]; + sp50 = gTimePlayerLastTouchedFinishLine[gGPCurrentRacePlayerIdByRank[arg3]]; convert_number_to_ascii(arg3 + 1, &sp3C); sp3E = 0x2E; sp3F = 0; @@ -10040,46 +9884,46 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A3E60.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 extern s32 D_8018CA78; extern ? D_8018CA90; -static ? D_800E7734; /* unable to generate initializer; const */ +s8 *D_800E7734[4] = { "LAP 1", "LAP 2", "LAP 3", "TOTAL" }; void func_800A4550(s32 recordType, s32 column, s32 row) { s32 sp40; s8 sp34; s32 sp2C; s32 temp_v0; + s32 var_a0; + s32 var_v0; struct_8018D9E0_entry *temp_v0_2; - s32 phi_v0; - s32 phi_a0; if (recordType < 3) { temp_v0 = recordType * 4; sp2C = temp_v0; sp40 = *(&D_8018CA90 + temp_v0); set_text_color(2); - phi_v0 = temp_v0; + var_v0 = temp_v0; } else { sp40 = D_8018CA78; set_text_color(1); - phi_v0 = recordType * 4; + var_v0 = recordType * 4; } - func_800936B8(column + 0x21, row, *(&D_800E7734 + phi_v0), 0, 0.7f, 0.7f); - temp_v0_2 = find_8018D9E0_entry_dupe(0xBB); + func_800936B8(column + 0x21, row, *(D_800E7734 + var_v0), 0, 0.7f, 0.7f); + temp_v0_2 = find_8018D9E0_entry_dupe(0x000000BB); if (recordType < 3) { - if ((temp_v0_2->unk20 & (1 << recordType)) != 0) { - phi_a0 = (s32) gGlobalTimer % 3; + if (temp_v0_2->unk20 & (1 << recordType)) { + var_a0 = (s32) gGlobalTimer % 3; } else { - phi_a0 = 3; + var_a0 = 3; } } else { - phi_a0 = 3; + var_a0 = 3; if (temp_v0_2->unk1C >= 0) { - phi_a0 = (s32) gGlobalTimer % 3; + var_a0 = (s32) gGlobalTimer % 3; } } - set_text_color(phi_a0); + set_text_color(var_a0); get_time_record_minutes(sp40, &sp34); func_800939C8(column + 0x2C, row, &sp34, 0, 0.7f, 0.7f); func_80093324(column + 0x37, row, "'", 0, 0.7f, 0.7f); @@ -11593,56 +11437,36 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A79F4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b -? func_8009E000(?); /* extern */ +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 ? func_8009F5E0(struct_8018D9E0_entry *); /* extern */ -? func_800A9710(struct_8018D9E0_entry *); /* extern */ ? func_800A97BC(struct_8018D9E0_entry *); /* extern */ ? func_800A9A98(struct_8018D9E0_entry *); /* extern */ -? func_800A9B9C(struct_8018D9E0_entry *); /* extern */ -? func_800A9C40(struct_8018D9E0_entry *); /* extern */ -? func_800A9D5C(struct_8018D9E0_entry *); /* extern */ ? func_800A9E58(struct_8018D9E0_entry *); /* extern */ -? func_800AA280(struct_8018D9E0_entry *); /* extern */ ? func_800AA2EC(struct_8018D9E0_entry *); /* extern */ ? func_800AA69C(struct_8018D9E0_entry *); /* extern */ ? func_800AAA9C(struct_8018D9E0_entry *); /* extern */ -? func_800AAB90(struct_8018D9E0_entry *); /* extern */ ? func_800AAC18(struct_8018D9E0_entry *); /* extern */ -? func_800AB020(struct_8018D9E0_entry *); /* extern */ -? func_800AB164(struct_8018D9E0_entry *); /* extern */ ? func_800AB314(struct_8018D9E0_entry *); /* extern */ -? func_800AB904(struct_8018D9E0_entry *); /* extern */ ? func_800AB9B0(struct_8018D9E0_entry *); /* extern */ ? func_800ABAE8(struct_8018D9E0_entry *); /* extern */ ? func_800ABB24(struct_8018D9E0_entry *); /* extern */ ? func_800ABBCC(struct_8018D9E0_entry *); /* extern */ ? func_800ABC38(struct_8018D9E0_entry *); /* extern */ -? func_800ABEAC(struct_8018D9E0_entry *); /* extern */ ? func_800AC300(struct_8018D9E0_entry *); /* extern */ -? func_800AC324(struct_8018D9E0_entry *); /* extern */ ? func_800AC458(struct_8018D9E0_entry *); /* extern */ ? func_800ACA14(struct_8018D9E0_entry *); /* extern */ ? func_800ACC50(struct_8018D9E0_entry *); /* extern */ ? func_800ACF40(struct_8018D9E0_entry *); /* extern */ -? func_800AD1A4(struct_8018D9E0_entry *); /* extern */ ? func_800AD2E8(struct_8018D9E0_entry *); /* extern */ ? func_800ADF48(struct_8018D9E0_entry *); /* extern */ ? func_800AE218(struct_8018D9E0_entry *); /* extern */ -? func_800AEC54(struct_8018D9E0_entry *); /* extern */ -? func_800AEDBC(struct_8018D9E0_entry *); /* extern */ ? func_800AEF14(struct_8018D9E0_entry *); /* extern */ ? func_800AEF74(struct_8018D9E0_entry *); /* extern */ ? func_800AF004(struct_8018D9E0_entry *); /* extern */ ? func_800AF1AC(struct_8018D9E0_entry *); /* extern */ ? func_800AF270(struct_8018D9E0_entry *); /* extern */ -? func_800CA388(?); /* extern */ -? play_sound2(?); /* extern */ extern s32 D_8018ED94; -extern s32 D_8018EDE0; -extern s8 D_8018EDEE; extern void *gControllerFive; -extern s8 gMainMenuSelectionDepth; f32 D_800E8530 = 0.0f; f32 D_800E8534 = 3.0f; @@ -11654,13 +11478,8 @@ void func_800A7A4C(s32 arg0) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_6; s32 var_s0; s32 var_v1_2; - s8 temp_t1; - s8 temp_t9; - s8 temp_v0_4; - s8 temp_v0_5; struct_8018D9E0_entry *var_s1; struct_8018D9E0_entry *var_s1_2; u8 var_v1; @@ -11680,36 +11499,35 @@ block_7: if (var_v1 != 0) { switch (temp_v0) { /* switch 8; irregular */ case 0xFA: /* switch 8 */ - temp_v0_2 = D_8018ED94; - if (temp_v0_2 < 0x50) { + if (D_8018ED94 < 0x50) { D_800E8534 = 3.0f; - } else if (temp_v0_2 < 0x5A) { + } else if (D_8018ED94 < 0x5A) { temp_f0 = (f64) D_800E8530; if (temp_f0 < 1.0) { D_800E8530 = (f32) (temp_f0 + 0.1); } D_800E8534 = (f32) ((f64) D_800E8534 + 0.1); - } else if (temp_v0_2 < 0xA0) { + } else if (D_8018ED94 < 0xA0) { D_800E8534 = (f32) ((f64) D_800E8534 + 0.1); - } else if (temp_v0_2 < 0x190) { + } else if (D_8018ED94 < 0x190) { D_800E8534 = (f32) ((f64) D_800E8534 + 0.3); } temp_f18 = D_8018EDCC - D_800E8534; D_8018EDCC = temp_f18; - D_8018ED94 = temp_v0_2 + 1; + D_8018ED94 += 1; if (temp_f18 < -360.0f) { D_8018EDCC = temp_f18 + 360.0f; } temp_t2 = var_s1->unk1C + 1; var_s1->unk1C = temp_t2; if (temp_t2 == 0x000000B4) { - func_8009E000(0x28); - func_800CA388(0x64); + func_8009E000(0x00000028); + func_800CA388(0x64U); D_8018EDE0 = 0; } if ((var_s1->unk20 != 0) && (var_s1->unk1C >= 3)) { var_s1->unk20 = 0; - play_sound2(SOUND_INTRO_LOGO); + play_sound2(0x49018008); } break; case 0xDA: /* switch 8 */ @@ -11722,12 +11540,12 @@ block_7: func_800A97BC(var_s1); break; case 0x5: /* switch 8 */ - temp_v0_3 = var_s1->unk4; - switch (temp_v0_3) { /* switch 9; irregular */ + temp_v0_2 = var_s1->unk4; + switch (temp_v0_2) { /* switch 9; irregular */ case 0: /* switch 9 */ if (gControllerFive->unk4 & 0x10) { var_s1->unk4 = (s32) 1U; - play_sound2(SOUND_ACTION_PING); + play_sound2(0x4900801C); } else { var_s1->visible = 0; } @@ -11743,17 +11561,17 @@ block_7: break; case 0x10: /* switch 8 */ case 0x11: /* switch 8 */ - switch (gMainMenuSelectionDepth) { /* switch 5 */ - case OPTIONS_SELECTION: /* switch 5 */ - case DATA_SELECTION: /* switch 5 */ - case PLAYER_NUM_SELECTION: /* switch 5 */ + switch (gMainMenuSelectionDepth) { /* switch 5 */ + case 1: /* switch 5 */ + case 2: /* switch 5 */ + case 3: /* switch 5 */ func_800A9B9C(var_s1); break; - case GAME_MODE_SELECTION: /* switch 5 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 5 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* switch 5 */ + case 4: /* switch 5 */ + case 5: /* switch 5 */ + case 6: /* switch 5 */ + case 7: /* switch 5 */ + case 8: /* switch 5 */ func_800A9C40(var_s1); break; } @@ -11766,17 +11584,17 @@ block_7: case 0xC: /* switch 8 */ case 0xD: /* switch 8 */ case 0xE: /* switch 8 */ - switch (gMainMenuSelectionDepth) { /* switch 6 */ - case OPTIONS_SELECTION: /* switch 6 */ - case DATA_SELECTION: /* switch 6 */ - case PLAYER_NUM_SELECTION: /* switch 6 */ + switch (gMainMenuSelectionDepth) { /* switch 6 */ + case 1: /* switch 6 */ + case 2: /* switch 6 */ + case 3: /* switch 6 */ func_800A9B9C(var_s1); break; - case GAME_MODE_SELECTION: /* switch 6 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 6 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* switch 6 */ + case 4: /* switch 6 */ + case 5: /* switch 6 */ + case 6: /* switch 6 */ + case 7: /* switch 6 */ + case 8: /* switch 6 */ func_800A9C40(var_s1); break; } @@ -11823,8 +11641,7 @@ block_7: func_800AA69C(var_s1); break; } - temp_v0_4 = D_8018EDEE; - switch (temp_v0_4) { /* switch 10; irregular */ + switch (D_8018EDEE) { /* switch 10; irregular */ case 1: /* switch 10 */ func_800AAB90(var_s1); break; @@ -11844,8 +11661,7 @@ block_7: case 0x55: /* switch 8 */ case 0x56: /* switch 8 */ func_800AB164(var_s1); - temp_v0_5 = D_8018EDEC; - switch (temp_v0_5) { /* switch 11; irregular */ + switch (D_8018EDEC) { /* switch 11; irregular */ case 1: /* switch 11 */ func_800AB020(var_s1); break; @@ -12053,9 +11869,9 @@ block_7: do { var_s1_2 = D_8018D9E0; loop_113: - temp_v0_6 = var_s1_2->type; + temp_v0_3 = var_s1_2->type; var_v1_2 = 0; - if ((temp_v0_6 == 4) || (temp_v0_6 == 5) || (temp_v0_6 == 0x000000C7)) { + if ((temp_v0_3 == 4) || (temp_v0_3 == 5) || (temp_v0_3 == 0x000000C7)) { if (arg0 != 0) { goto block_119; } @@ -12344,51 +12160,31 @@ void func_800A890C(s32 arg0, struct_8018D9E0_entry *arg1) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A890C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b -static ? D_800E7208; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7208[][2]; /* unable to generate initializer */ void func_800A8A98(struct_8018D9E0_entry *arg0) { - ? *var_s0; - Gfx *temp_v0; - Gfx *temp_v0_2; - Gfx *temp_v0_3; - Gfx *var_v0; s32 temp_s2; s32 temp_s3; - s8 temp_v0_4; - s8 var_s4; + s32 someIndex; - temp_v0 = gDisplayListHead; temp_s2 = arg0->column; temp_s3 = arg0->row; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w0 = 0xE7000000; - temp_v0->words.w1 = 0; - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->words.w0 = 0xB900031D; - temp_v0_2->words.w1 = 0x0F0A4000; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - var_s0 = &D_800E7208; - var_s4 = 0; - temp_v0_3->words.w0 = 0xFCFFFFFF; - temp_v0_3->words.w1 = 0xFFFCF279; - do { - if ((var_s4 == gCupCourseSelection) && (temp_v0_4 = D_8018EDEC, ((temp_v0_4 < 2) == 0)) && (gModeSelection != GRAND_PRIX)) { - if ((temp_v0_4 == 2) || (temp_v0_4 == 4)) { - var_v0 = func_800959A0(gDisplayListHead, var_s0->unk0 + temp_s2, var_s0->unk2 + temp_s3, var_s0->unk8 + temp_s2, var_s0->unkA + temp_s3); + gDPPipeSync(gDisplayListHead++); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); + for (someIndex = 0; someIndex < 4; someIndex++) { + if ((someIndex == gCupCourseSelection) && (D_8018EDEC >= 2) && (gModeSelection != 0)) { + if ((D_8018EDEC == 2) || (D_8018EDEC == 4)) { + gDisplayListHead = func_800959A0(gDisplayListHead, D_800E7208[someIndex][0].column + temp_s2, D_800E7208[someIndex][0].row + temp_s3, D_800E7208[someIndex][1].column + temp_s2, D_800E7208[someIndex][1].row + temp_s3); } else { - var_v0 = func_80098C18(gDisplayListHead, var_s0->unk0 + temp_s2, var_s0->unk2 + temp_s3, var_s0->unk8 + temp_s2, var_s0->unkA + temp_s3, 0x000000FF, 0x000000F9, 0x000000DC, 0x000000FF); + gDisplayListHead = func_80098C18(gDisplayListHead, D_800E7208[someIndex][0].column + temp_s2, D_800E7208[someIndex][0].row + temp_s3, D_800E7208[someIndex][1].column + temp_s2, D_800E7208[someIndex][1].row + temp_s3, 0x000000FF, 0x000000F9, 0x000000DC, 0x000000FF); } } else { - var_v0 = func_80098C18(gDisplayListHead, var_s0->unk0 + temp_s2, var_s0->unk2 + temp_s3, var_s0->unk8 + temp_s2, var_s0->unkA + temp_s3, 1, 1, 1, 0x000000FF); + gDisplayListHead = func_80098C18(gDisplayListHead, D_800E7208[someIndex][0].column + temp_s2, D_800E7208[someIndex][0].row + temp_s3, D_800E7208[someIndex][1].column + temp_s2, D_800E7208[someIndex][1].row + temp_s3, 1, 1, 1, 0x000000FF); } - gDisplayListHead = var_v0; - var_s4 += 1; - var_s0 += 0x10; - } while (var_s4 != 4); + } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8A98.s") @@ -12517,26 +12313,22 @@ void func_800A8F48(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8F48.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 void func_800A90D4(s32 arg0, struct_8018D9E0_entry *arg1) { s32 temp_a2; s32 temp_t1; s32 temp_t7; if (arg1->unk1C < 0x20) { + if (1) {} + temp_t7 = (arg1->unk1C * 0x41) / 0x40; temp_t1 = arg1->column; temp_a2 = arg1->row; - temp_t7 = (arg1->unk1C * 0x41) / 0x40; gDPPipeSync(gDisplayListHead++); gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); gDisplayListHead = func_80098C18(gDisplayListHead, temp_t1 + temp_t7, temp_a2, (temp_t1 - temp_t7) + 0x40, temp_a2 + 0x27, 1, 1, 1, 0xFF); } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A90D4.s") -#endif void func_800A91D8(struct_8018D9E0_entry *arg0, s32 columnTarget, s32 rowTarget) { func_800A9208(arg0, columnTarget); @@ -12958,146 +12750,124 @@ void func_800A9A98(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9A98.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800AA280(); /* extern */ - +#ifdef NEEDS_RODATA +// data/data_0DD0A0_3_0.s +// jpt_800F24E8 void func_800A9B9C(struct_8018D9E0_entry *arg0) { - s32 temp_t0; - s32 temp_t6; - s32 temp_v0; - - temp_t6 = arg0->unk4; - switch (temp_t6) { + switch (arg0->unk4) { case 0: - func_800AA280(); - return; + func_800AA280(arg0); + break; case 1: - func_800AA280(); + func_800AA280(arg0); arg0->unk4 = 4; /* fallthrough */ case 4: - temp_v0 = arg0->unk1C; - if (temp_v0 > 0) { - temp_t0 = (temp_v0 - (temp_v0 / 12)) - 2; - arg0->unk1C = temp_t0; - if (temp_t0 < 0) { + if (arg0->unk1C > 0) { + arg0->unk1C = (arg0->unk1C - (arg0->unk1C / 12)) - 2; + if (arg0->unk1C < 0) { arg0->unk1C = 0; - return; } - default: - return; + } else { + arg0->unk1C = 0; + arg0->unk4 = 0; } - arg0->unk1C = 0; - arg0->unk4 = 0; - return; + break; case 2: arg0->unk4 = 3; break; + case 3: + default: + break; } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9B9C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800AA280(); /* extern */ -extern s8 D_8018EDF3; -extern s8 gMainMenuSelectionDepth; - +#ifdef NEEDS_RODATA +// data/data_0DD0A0_3_0.s +// jpt_800F24FC void func_800A9C40(struct_8018D9E0_entry *arg0) { - s32 temp_t6; - s32 temp_t7; - s32 temp_v0_2; - s8 temp_v0; - - temp_t6 = arg0->unk4; - switch (temp_t6) { + switch (arg0->unk4) { case 0: - func_800AA280(); - if (arg0->type == (D_8018EDF3 + 0xA)) { + func_800AA280(arg0); + if ((D_8018EDF3 + 0xA) == arg0->type) { arg0->unk4 = 2; - return; + } else { + arg0->unk4 = 1; } - arg0->unk4 = 1; - return; + break; case 4: - if (arg0->type == (D_8018EDF3 + 0xA)) { + if ((D_8018EDF3 + 0xA) == arg0->type) { arg0->unk4 = 2; arg0->unk1C = 0; - return; + break; } arg0->unk4 = 1; case 1: - func_800AA280(); - temp_v0 = gMainMenuSelectionDepth; - if ((temp_v0 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v0 == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { - arg0->unk1C = 0x20; - return; - } - temp_v0_2 = arg0->unk1C; - temp_t7 = temp_v0_2 + 2; - if (temp_v0_2 < 0x20) { - arg0->unk1C = temp_t7; - if (temp_t7 >= 0x20) { - arg0->unk1C = 0x20; - return; + func_800AA280(arg0); + if ((gMainMenuSelectionDepth == 7) || (gMainMenuSelectionDepth == 8)) { + arg0->unk1C = 0x00000020; + } else { + if (arg0->unk1C < 0x20) { + arg0->unk1C += 2; + if (arg0->unk1C >= 0x20) { + arg0->unk1C = 0x00000020; + } } } - default: - return; + break; case 3: - if (arg0->type == (D_8018EDF3 + 0xA)) { + if ((D_8018EDF3 + 0xA) == arg0->type) { arg0->unk4 = 2; } break; + case 2: + default: + break; } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9C40.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s8 gMainMenuSelectionDepth; -static ? D_800E70A0; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E70A0[]; /* unable to generate initializer */ +// data/data_0DD0A0_3_0.s +// jpt_800F2510 void func_800A9D5C(struct_8018D9E0_entry *arg0) { - void *sp1C; - s32 temp_t1; - s8 temp_v0; - void *temp_v0_2; + Unk_D_800E70A0 *temp_v0; - if (arg0->type == (D_8018EDF3 + 0xA)) { + if ((D_8018EDF3 + 0xA) == arg0->type) { arg0->priority = 0x0A; } else { arg0->priority = 6; } - temp_t1 = arg0->unk4; - switch (temp_t1) { + + switch (arg0->unk4) { case 2: - temp_v0 = gMainMenuSelectionDepth; - if ((temp_v0 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v0 == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { + if ((gMainMenuSelectionDepth == 7) || (gMainMenuSelectionDepth == 8)) { arg0->column = 0x00000080; arg0->row = 0x0000003E; - return; + } else { + func_800A91D8(arg0, 0x00000080, 0x0000003E); } - func_800A91D8(arg0, 0x00000080, 0x0000003E); - return; + break; case 3: - temp_v0_2 = (arg0->type * 8) - 0x50 + &D_800E70A0; - sp1C = temp_v0_2; - func_800A91D8(arg0, (s32) temp_v0_2->unk0, (s32) temp_v0_2->unk2); - if ((temp_v0_2->unk0 == arg0->column) && (temp_v0_2->unk2 == arg0->row)) { + temp_v0 = &D_800E70A0[arg0->type - 0xA]; + func_800A91D8(arg0, temp_v0->column, temp_v0->row); + if ((arg0->column == temp_v0->column) && (arg0->row == temp_v0->row)) { arg0->unk4 = 0; } /* fallthrough */ - default: case 0: case 1: case 4: - return; + default: + break; } } #else @@ -13270,23 +13040,20 @@ block_37: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9E58.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s8 gMainMenuSelectionDepth; -static ? D_800E70A0; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E70A0[]; void func_800AA280(struct_8018D9E0_entry *arg0) { - s8 temp_v1; - void *temp_v0; + Unk_D_800E70A0 *temp_v0; - temp_v1 = gMainMenuSelectionDepth; - temp_v0 = (arg0->type * 8) - 0x50 + &D_800E70A0; - if ((temp_v1 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v1 == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { - arg0->column = (s32) temp_v0->unk0; - arg0->row = (s32) temp_v0->unk2; - return; + temp_v0 = &D_800E70A0[arg0->type - 0xA]; + if ((gMainMenuSelectionDepth == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (gMainMenuSelectionDepth == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { + arg0->column = temp_v0->column; + arg0->row = temp_v0->row; + } else { + func_800A91D8(arg0, temp_v0->column, temp_v0->row); } - func_800A91D8(arg0, (s32) temp_v0->unk0, (s32) temp_v0->unk2); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA280.s") @@ -13975,43 +13742,41 @@ void func_800AB098(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB098.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -static ? D_800E7148; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7148[4]; /* unable to generate initializer */ +// data/data_0DD0A0_3_0.s +// jpt_800F261C void func_800AB164(struct_8018D9E0_entry *arg0) { - void *sp1C; - s32 temp_t1; - void *temp_v0; - void *temp_v0_2; + Unk_D_800E70A0 *thing = &D_800E7148[arg0->type - 0x53]; - if (arg0->type == (gCupSelection + 0x53)) { + if ((gCupSelection + 0x53) == arg0->type) { arg0->priority = 0x0A; } else { arg0->priority = 4; } - temp_t1 = arg0->unk4; - switch (temp_t1) { + + switch (arg0->unk4) { case 0: - temp_v0 = (arg0->type * 8) - 0x298 + &D_800E7148; - arg0->column = (s32) temp_v0->unk0; - arg0->row = (s32) temp_v0->unk2; - return; + thing = &D_800E7148[arg0->type - 0x53]; + arg0->column = thing->column; + arg0->row = thing->row; + break; case 2: func_800A91D8(arg0, 0x00000080, 0x0000003B); - return; + break; case 3: - temp_v0_2 = (arg0->type * 8) - 0x298 + &D_800E7148; - sp1C = temp_v0_2; - func_800A91D8(arg0, (s32) temp_v0_2->unk0, (s32) temp_v0_2->unk2); - if ((temp_v0_2->unk0 == arg0->column) && (temp_v0_2->unk2 == arg0->row)) { + thing = &D_800E7148[arg0->type - 0x53]; + func_800A91D8(arg0, thing->column, thing->row); + if ((arg0->column == thing->column) && (arg0->row == thing->row)) { arg0->unk4 = 0; } - /* fallthrough */ - default: + break; case 1: case 4: - return; + default: + break; } } #else @@ -14246,30 +14011,26 @@ void func_800AB314(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB314.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -static ? D_800E7248; /* unable to generate initializer */ -static ? D_800E7258; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7248[]; /* unable to generate initializer */ +extern Unk_D_800E70A0 D_800E7258[]; /* unable to generate initializer */ void func_800AB904(struct_8018D9E0_entry *arg0) { - s16 temp_a1; - s16 temp_a1_2; - s8 temp_v0; + Unk_D_800E70A0 *temp_a1; - temp_v0 = D_8018EDEC; - switch (temp_v0) { /* irregular */ + switch (D_8018EDEC) { /* irregular */ case 1: - temp_a1 = *((arg0->type * 8) - 0x328 + &D_800E7248); - if (temp_a1 != arg0->column) { - func_800A9208(arg0, (s32) temp_a1); - return; + temp_a1 = &D_800E7248[arg0->type - 0x65]; + if (arg0->column != temp_a1->column) { + func_800A9208(arg0, temp_a1->column); } - return; + break; case 2: case 3: - temp_a1_2 = *((arg0->type * 8) - 0x328 + &D_800E7258); - if (temp_a1_2 != arg0->column) { - func_800A9208(arg0, (s32) temp_a1_2); + temp_a1 = &D_800E7258[arg0->type - 0x65]; + if (arg0->column != temp_a1->column) { + func_800A9208(arg0, temp_a1->column); } break; } @@ -14327,58 +14088,40 @@ void func_800AB9B0(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB9B0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -struct _struct_D_800E7430_0x8 { - /* 0x0 */ s16 unk0; /* inferred */ - /* 0x2 */ s16 unk2; /* inferred */ - /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ -}; /* size = 0x8 */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s -static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ +extern Unk_D_800E70A0 D_800E7430[]; /* unable to generate initializer; const */ void func_800ABAE8(struct_8018D9E0_entry *arg0) { - s32 temp_v0; - struct _struct_D_800E7430_0x8 *temp_v0_2; s32 phi_v1; - temp_v0 = arg0->type; - if (temp_v0 == 0x8C) { + if (arg0->type == 0x8C) { phi_v1 = 4; } else { - phi_v1 = temp_v0 - 0x78; + phi_v1 = arg0->type - 0x78; } - temp_v0_2 = &D_800E7430[phi_v1]; - arg0->column = (s32) temp_v0_2->unk0; - arg0->row = (s32) temp_v0_2->unk2; + arg0->column = D_800E7430[phi_v1].column; + arg0->row = D_800E7430[phi_v1].row; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABAE8.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -struct _struct_D_800E7430_0x8 { - /* 0x0 */ s16 unk0; /* inferred */ - /* 0x2 */ s16 unk2; /* inferred */ - /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ -}; /* size = 0x8 */ - -static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7430[]; void func_800ABB24(struct_8018D9E0_entry *arg0) { - s32 temp_t7; - s8 temp_v0; - struct _struct_D_800E7430_0x8 *temp_v1; - - temp_v0 = gTimeTrialDataCourseIndex; - temp_v1 = &D_800E7430[(s32) temp_v0 / 4]; - arg0->column = temp_v1->unk0 - 2; - temp_t7 = arg0->unk1C + 0x10; - arg0->row = temp_v1->unk2 + (((s32) temp_v0 % 4) * 0x32) + 0x13; - arg0->unk1C = temp_t7; - if (temp_t7 >= 0x100) { - arg0->unk1C = temp_t7 - 0x100; + Unk_D_800E70A0 *temp_v1; + s32 thing = gTimeTrialDataCourseIndex; + + temp_v1 = &D_800E7430[thing / 4]; + arg0->column = temp_v1->column - 2; + arg0->row = temp_v1->row + ((thing % 4) * 0x32) + 0x13; + arg0->unk1C += 0x10; + if (arg0->unk1C >= 0x100) { + arg0->unk1C -= 0x100; arg0->unk20 = (s32) (arg0->unk20 + 1) % 3; } } @@ -14386,69 +14129,51 @@ void func_800ABB24(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABB24.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -struct _struct_D_800E7430_0x8 { - /* 0x0 */ s16 unk0; /* inferred */ - /* 0x2 */ s16 unk2; /* inferred */ - /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ -}; /* size = 0x8 */ - -static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7430[]; void func_800ABBCC(struct_8018D9E0_entry *arg0) { s32 temp_v0; - struct _struct_D_800E7430_0x8 *temp_v1; + Unk_D_800E70A0 *temp_v1; temp_v0 = arg0->type - 0x7C; temp_v1 = &D_800E7430[temp_v0 / 4]; - arg0->column = (s32) temp_v1->unk0; - arg0->row = temp_v1->unk2 + ((temp_v0 % 4) * 0x32) + 0x14; + arg0->column = (s32) temp_v1->column; + arg0->row = temp_v1->row + ((temp_v0 % 4) * 0x32) + 0x14; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABBCC.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800ABCF4(); /* extern */ -extern s8 D_8018EE08; - void func_800ABC38(struct_8018D9E0_entry *arg0) { - s32 temp_v0; - s32 temp_v0_2; - s32 temp_v0_3; - - func_800ABCF4(); - temp_v0 = D_80164A28; - switch (temp_v0) { /* irregular */ + // Huh? + s32 one = 1; + func_800ABCF4(arg0); + switch (D_80164A28) { /* irregular */ case 1: - arg0->visible = 1; - return; + arg0->visible = one; + break; case 2: - temp_v0_2 = arg0->row; - if (temp_v0_2 >= -0x13) { - arg0->row = temp_v0_2 - 2; - return; + if (arg0->row >= -0x13) { + arg0->row -= 2; + } else { + arg0->type = 0; } -block_13: - arg0->type = 0; - return; + break; default: - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1U) || (D_8018EE08 != 0)) { - goto block_13; - } - temp_v0_3 = arg0->row; - if (temp_v0_3 >= -0x13) { - arg0->row = temp_v0_3 - 2; - return; + if ((gModeSelection != 0) || (gPlayerCountSelection1 != (s32) 1U) || (D_8018EE08 != 0)) { + arg0->type = 0; + } else { + if (arg0->row >= -0x13) { + arg0->row -= 2; + } else { + arg0->type = 0; + } } - goto block_13; + break; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABC38.s") -#endif #ifdef NEEDS_RODATA // data/data_0DD0A0_3_0.s @@ -14658,23 +14383,15 @@ void func_800AC324(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800B536C(s32, s32, s32, struct_8018D9E0_entry *); /* extern */ -void func_800CA330(?, s32); /* extern */ -void play_sound2(?, s32, u8 *, struct_8018D9E0_entry *); /* extern */ -extern void *D_800DC5EC; -extern void *D_800DC5F0; -extern s16 D_8015F894; -extern s16 gGPCurrentRacePlayerIdByRank; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 +? func_800B536C(s32, s32, s32, struct_8018D9E0_entry *); /* extern */ extern ? D_80164478; extern void *D_8018D9BC; -extern s8 D_8018D9D8; -extern s8 D_8018EDF3; -static s32 D_800DDB24 = 1; static s8 gGP1stPlaceReward = 9; /* const */ static s8 gGP2ndPlaceReward = 6; /* const */ static s8 gGP3rdPlaceReward = 3; /* const */ static s8 gGP4thPlaceReward = 1; /* const */ +s32 D_800DDB24 = 1; void func_800AC458(struct_8018D9E0_entry *arg0) { s32 sp1C; @@ -14682,7 +14399,6 @@ void func_800AC458(struct_8018D9E0_entry *arg0) { s32 temp_a1; s32 temp_a1_2; s32 temp_a1_3; - s32 temp_a1_4; s32 temp_a2; s32 temp_t2; s32 temp_t3; @@ -14691,66 +14407,56 @@ void func_800AC458(struct_8018D9E0_entry *arg0) { s32 temp_t7; s32 temp_t8; s32 temp_v0; + s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_4; - s8 *temp_v1_2; - struct_8018D9E0_entry *temp_a3; + s32 var_a0; + s32 var_a1; + s32 var_t1; + s8 *temp_v1; + s8 *var_v0; u8 *temp_a2_2; u8 temp_t0; - void *temp_v0_2; - void *temp_v0_5; - void *temp_v1; - void *temp_v1_3; - s32 phi_a0; - struct_8018D9E0_entry *phi_a3; - s32 phi_t1; - s8 *phi_v0; - s32 phi_a1; temp_v0 = arg0->unk4; - temp_a3 = arg0; - phi_a3 = temp_a3; switch (temp_v0) { case 0: - temp_a3->column = -0xA0; - temp_a3->unk4 = 1; + arg0->column = -0x000000A0; + arg0->unk4 = 1; D_8018D9BC->unk0 = (s8) gGP1stPlaceReward; D_8018D9BC->unk1 = (s8) gGP2ndPlaceReward; D_8018D9BC->unk2 = (s8) gGP3rdPlaceReward; D_8018D9BC->unk3 = (s8) gGP4thPlaceReward; - temp_a3->unk20 = temp_a3->column; + arg0->unk20 = arg0->column; return; case 1: - temp_a1 = temp_a3->unk20; - temp_a3->column = temp_a1; - phi_a0 = 0x10; + temp_a1 = arg0->unk20; + var_a0 = 0x10; + arg0->column = temp_a1; if (D_8018D9D8 != 0) { - phi_a0 = 0x20; + var_a0 = 0x20; } - temp_a2 = temp_a1 + phi_a0; + temp_a2 = temp_a1 + var_a0; if (temp_a2 < 0) { - temp_a3->unk20 = temp_a2; - temp_v0_2 = D_800DC5EC; - temp_v0_2->unk30 = (s16) (temp_v0_2->unk30 + phi_a0); - temp_v1 = D_800DC5F0; - temp_v1->unk30 = (s16) (temp_v1->unk30 - phi_a0); + arg0->unk20 = temp_a2; + D_800DC5EC->screenStartX += var_a0; + D_800DC5F0->screenStartX -= var_a0; return; } - temp_a3->unk20 = 0; - temp_a3->column = 0; - temp_a3->unk4 = 2; - temp_a3->unk1C = 0; - D_800DC5EC->unk30 = 0xF0; - D_800DC5F0->unk30 = 0x50; + arg0->unk20 = 0; + arg0->column = 0; + arg0->unk4 = 2; + arg0->unk1C = 0; + D_800DC5EC->screenStartX = 0x00F0; + D_800DC5F0->screenStartX = 0x0050; return; case 2: - temp_a3->column = 0; - temp_t5 = temp_a3->unk1C + 1; - temp_a3->unk1C = temp_t5; + arg0->column = 0; + temp_t5 = arg0->unk1C + 1; + arg0->unk1C = temp_t5; if (((D_8018D9D8 != 0) || (temp_t5 >= 0x1F)) && (D_800DDB24 != 0)) { - temp_a3->unk4 = 3; - temp_a3->unk1C = 0; - temp_a3->unk20 = 0; + arg0->unk4 = 3; + arg0->unk1C = 0; + arg0->unk20 = 0; return; } default: @@ -14759,84 +14465,82 @@ void func_800AC458(struct_8018D9E0_entry *arg0) { case 4: case 5: case 6: - temp_t3 = temp_a3->unk1C + 1; + var_t1 = 0; + temp_t3 = arg0->unk1C + 1; temp_a1_2 = temp_v0 - 3; - temp_a3->unk1C = temp_t3; + arg0->unk1C = temp_t3; if (((temp_t3 % 3) == 0) || (D_8018D9D8 != 0)) { temp_a2_2 = D_8018D9BC + temp_a1_2; temp_t0 = *temp_a2_2; if ((s32) temp_t0 > 0) { *temp_a2_2 = temp_t0 - 1; - temp_v1_2 = &gGPPointsByCharacterId[*(&gPlayers->characterId + (*(&gGPCurrentRacePlayerIdByRank + (temp_a1_2 * 2)) * 0xDD8))]; + temp_v1 = &gGPPointsByCharacterId[*(&gPlayers->characterId + (gGPCurrentRacePlayerIdByRank[temp_a1_2] * 0xDD8))]; sp18 = 0; - arg0 = temp_a3; - *temp_v1_2 += 1; + *temp_v1 += 1; sp1C = temp_a1_2; - play_sound2(SOUND_ACTION_COUNT_SCORE, temp_a1_2, temp_a2_2, temp_a3); - phi_a3 = arg0; + play_sound2(0x49008017); + var_t1 = 0; if ((*(D_8018D9BC + temp_a1_2) == 0) && (arg0->unk20 == 0)) { arg0->unk20 = 1; arg0->unk1C = 0; } } } - phi_t1 = 0; - if ((phi_a3->unk20 != 0) && ((temp_v0_3 = phi_a3->unk1C, ((temp_v0_3 < 0xB) == 0)) || ((D_8018D9D8 != 0) && (temp_v0_3 >= 4)))) { - phi_t1 = 1; + if ((arg0->unk20 != 0) && ((temp_v0_2 = arg0->unk1C, ((temp_v0_2 < 0xB) == 0)) || ((D_8018D9D8 != 0) && (temp_v0_2 >= 4)))) { + var_t1 = 1; } - if (phi_t1 != 0) { - temp_v0_4 = phi_a3->unk4; - phi_a3->unk20 = 0; - phi_a3->unk1C = 0; - if (temp_v0_4 < 6) { - phi_a3->unk4 = temp_v0_4 + 1; + if (var_t1 != 0) { + temp_v0_3 = arg0->unk4; + arg0->unk20 = 0; + arg0->unk1C = 0; + if (temp_v0_3 < 6) { + arg0->unk4 = temp_v0_3 + 1; return; } - phi_a3->unk4 = 7; + arg0->unk4 = 7; return; } break; case 7: - temp_t2 = temp_a3->unk1C + 1; - temp_a3->unk1C = temp_t2; - if ((((D_8018D9D8 != 0) && (temp_t2 >= 0xB)) || (temp_a3->unk1C >= 0x3D)) && (D_800DDB24 != 0)) { - temp_a3->unk4 = 8; - temp_a3->unk1C = 0; + temp_t2 = arg0->unk1C + 1; + arg0->unk1C = temp_t2; + if ((((D_8018D9D8 != 0) && (temp_t2 >= 0xB)) || (arg0->unk1C >= 0x3D)) && (D_800DDB24 != 0)) { + arg0->unk4 = 8; + arg0->unk1C = 0; return; } break; case 8: - temp_t8 = temp_a3->unk1C + 1; - temp_a3->unk1C = temp_t8; + temp_t8 = arg0->unk1C + 1; + arg0->unk1C = temp_t8; if (D_8018D9D8 != 0) { - temp_a3->unk1C = temp_t8 + 5; + arg0->unk1C = temp_t8 + 5; } - if (temp_a3->unk1C >= 0x29) { - temp_a3->unk4 = 9; + if (arg0->unk1C >= 0x29) { + arg0->unk4 = 9; return; } break; case 9: - temp_t7 = temp_a3->unk1C - 1; - temp_a3->unk1C = temp_t7; + temp_t7 = arg0->unk1C - 1; + arg0->unk1C = temp_t7; if (D_8018D9D8 != 0) { - temp_a3->unk1C = temp_t7 - 5; + arg0->unk1C = temp_t7 - 5; } - if (temp_a3->unk1C <= 0) { - temp_a3->unk4 = 0xA; - temp_a3->unk1C = 0; - phi_a1 = 0; + if (arg0->unk1C <= 0) { + arg0->unk4 = 0x0000000A; + arg0->unk1C = 0; + var_a1 = 0; if (gCupCourseSelection == 3) { - phi_v0 = gCharacterIdByGPOverallRank; + var_v0 = gCharacterIdByGPOverallRank; loop_41: - if ((s32) *(&D_80164478 + (*phi_v0 * 2)) < (s32) D_8018EDF3) { - func_800B536C(phi_a1, phi_a1, 8, temp_a3); + if (*(&D_80164478 + (*var_v0 * 2)) < D_8018EDF3) { + func_800B536C(var_a1, var_a1, 8, arg0); return; } - temp_a1_3 = phi_a1 + 1; - phi_v0 += 1; - phi_a1 = temp_a1_3; - if (temp_a1_3 == 8) { + var_a1 += 1; + var_v0 += 1; + if (var_a1 == 8) { return; } goto loop_41; @@ -14844,41 +14548,39 @@ loop_41: } break; case 10: - temp_t3_2 = temp_a3->unk1C + 1; - temp_a3->unk1C = temp_t3_2; + temp_t3_2 = arg0->unk1C + 1; + arg0->unk1C = temp_t3_2; if (temp_t3_2 > 0) { - temp_a3->unk4 = 0xB; - temp_a3->unk1C = 0; + arg0->unk4 = 0x0000000B; + arg0->unk1C = 0; func_800921B4(); return; } break; case 11: if ((D_8018D9D8 != 0) && (D_800DDB24 != 0)) { - temp_a3->unk4 = 0xC; - temp_a3->unk20 = temp_a3->row; - play_sound2(SOUND_ACTION_NEXT_COURSE); + arg0->unk4 = 0x0000000C; + arg0->unk20 = arg0->row; + play_sound2(0x49008015); return; } break; case 12: - temp_a1_4 = temp_a3->unk20; - temp_a3->row = temp_a1_4; - if (temp_a1_4 < 0xF0) { - temp_a3->unk20 = temp_a1_4 + 0x10; - temp_v0_5 = D_800DC5EC; - temp_v0_5->unk32 = (s16) (temp_v0_5->unk32 + 0x10); - temp_v1_3 = D_800DC5F0; - temp_v1_3->unk32 = (s16) (temp_v1_3->unk32 - 0x10); + temp_a1_3 = arg0->unk20; + arg0->row = temp_a1_3; + if (temp_a1_3 < 0xF0) { + arg0->unk20 = temp_a1_3 + 0x10; + D_800DC5EC->screenStartY += 0x10; + D_800DC5F0->screenStartY -= 0x10; return; } - temp_a3->unk20 = 0; - temp_a3->unk4 = 0xD; - temp_a3->unk1C = 0; - D_800DC5EC->unk32 = 0x12C; - D_800DC5F0->unk32 = -0x3C; + arg0->unk20 = 0; + arg0->unk4 = 0x0000000D; + arg0->unk1C = 0; + D_800DC5EC->screenStartY = 0x012C; + D_800DC5F0->screenStartY = -0x003C; D_8015F894 = 4; - func_800CA330(0x19, temp_a1_4); + func_800CA330(0x19U); break; } } @@ -14910,119 +14612,81 @@ void func_800AC978(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_8009DFE0(?, struct_8018D9E0_entry *); /* extern */ -void func_800CA330(?); /* extern */ -void play_sound2(?, struct_8018D9E0_entry *); /* extern */ -extern void *gControllerFive; - +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 void func_800ACA14(struct_8018D9E0_entry *arg0) { f64 temp_f0; f64 temp_f0_2; f64 temp_f0_3; - s32 temp_a0; s32 temp_v0; + s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_4; - struct_8018D9E0_entry *temp_a1; - struct_8018D9E0_entry *temp_a1_2; - u16 temp_v1; - u16 temp_v1_2; - void *temp_t5; - void *temp_v0_2; - s32 phi_a0; - struct_8018D9E0_entry *phi_a1; - u16 phi_v1; - struct_8018D9E0_entry *phi_a1_2; - s32 phi_v0; - struct_8018D9E0_entry *phi_a1_3; - struct_8018D9E0_entry *phi_a1_4; + s32 var_a0; + s32 var_v0; + u16 var_v1; - temp_v0 = arg0->unk4; - temp_a1 = arg0; - phi_a1_3 = temp_a1; - phi_a1_4 = temp_a1; - switch (temp_v0) { /* irregular */ + switch (arg0->unk4) { /* irregular */ default: - phi_v0 = arg0->unk20; + var_v0 = arg0->unk20; break; case 0: - if (temp_a1->unk20 >= 0xB) { - temp_a1->unk1C += 3; + if (arg0->unk20 >= 0xB) { + arg0->unk1C += 3; } - if (temp_a1->unk1C >= 0x65) { - temp_a1->unk4 = 0xB; - temp_a1->unk1C = 0; + if (arg0->unk1C >= 0x65) { + arg0->unk4 = 0x0000000B; + arg0->unk1C = 0; } -block_24: - phi_v0 = phi_a1_4->unk20; - phi_a1_3 = phi_a1_4; + var_v0 = arg0->unk20; break; case 11: case 12: - arg0 = temp_a1; - temp_a1_2 = arg0; - phi_a1 = temp_a1_2; - phi_a1_4 = temp_a1_2; - if (func_800B4520(temp_a1) != 0) { - + if (func_800B4520() != 0) { + // Wut? } else { - temp_v0_2 = gControllerFive; - temp_v1 = temp_v0_2->unk6; - temp_a0 = temp_v1 | temp_v0_2->unkC; - phi_a0 = temp_a0; - phi_v1 = temp_v1; - if ((temp_a0 & 0x800) != 0) { - temp_v0_3 = temp_a1_2->unk4; - if (temp_v0_3 >= 0xC) { - temp_a1_2->unk4 = temp_v0_3 - 1; - arg0 = temp_a1_2; - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1_2); + var_v1 = gControllerFive->buttonPressed; + var_a0 = var_v1 | gControllerFive->stickPressed; + if (var_a0 & 0x800) { + temp_v0_2 = arg0->unk4; + if (temp_v0_2 >= 0xC) { + arg0->unk4 = temp_v0_2 - 1; + play_sound2(0x49008000); temp_f0 = (f64) arg0->unk24; - phi_a1 = arg0; if (temp_f0 < 4.2) { arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_t5 = gControllerFive; - temp_v1_2 = temp_t5->unk6; - phi_a0 = temp_v1_2 | temp_t5->unkC; - phi_v1 = temp_v1_2; + var_v1 = gControllerFive->buttonPressed; + var_a0 = var_v1 | gControllerFive->stickPressed; } } - phi_a1_2 = phi_a1; - if ((phi_a0 & 0x400) != 0) { - temp_v0_4 = phi_a1->unk4; - if (temp_v0_4 < 0xC) { - phi_a1->unk4 = temp_v0_4 + 1; - arg0 = phi_a1; - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1); + if (var_a0 & 0x400) { + temp_v0_3 = arg0->unk4; + if (temp_v0_3 < 0xC) { + arg0->unk4 = temp_v0_3 + 1; + play_sound2(0x49008000); temp_f0_2 = (f64) arg0->unk24; - phi_a1_2 = arg0; if (temp_f0_2 < 4.2) { arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_v1 = gControllerFive->unk6; + var_v1 = gControllerFive->buttonPressed; } } - phi_a1_4 = phi_a1_2; - if ((phi_v1 & 0x9000) != 0) { - arg0 = phi_a1_2; - func_8009DFE0(0x1E, phi_a1_2); - func_800CA330(0x19); - play_sound2(SOUND_ACTION_CONTINUE_UNKNOWN); + if (var_v1 & 0x9000) { + func_8009DFE0(0x0000001E); + func_800CA330(0x19U); + play_sound2(0x4900801B); temp_f0_3 = (f64) arg0->unk24; - phi_a1_4 = arg0; if (temp_f0_3 < 4.2) { arg0->unk24 = (f32) (temp_f0_3 + 4.0); } } } - goto block_24; + var_v0 = arg0->unk20; + break; } - if (phi_v0 < 0x28) { - phi_a1_3->unk20 = phi_v0 + 1; + if (var_v0 < 0x28) { + arg0->unk20 = var_v0 + 1; } } #else @@ -15030,75 +14694,55 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ACA14.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_8009DFE0(?, struct_8018D9E0_entry *); /* extern */ -void play_sound2(?, struct_8018D9E0_entry *); /* extern */ -extern s8 D_8018EDF3; -extern s8 D_8018EDF4; -extern s8 D_8018EDF6; -extern void *gControllerFive; - +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 void func_800ACC50(struct_8018D9E0_entry *arg0) { f64 temp_f0; f64 temp_f0_2; f64 temp_f0_3; - s32 temp_a0; - s32 temp_s0; s32 temp_t6; s32 temp_t8; s32 temp_t9; + s32 temp_v0; s32 temp_v0_2; - s32 temp_v0_3; - struct_8018D9E0_entry *temp_a1; - struct_8018D9E0_entry *temp_a1_2; - u16 temp_v1; - u16 temp_v1_2; - void *temp_t8_2; - void *temp_v0; - s32 phi_s0; - s32 phi_a0; - struct_8018D9E0_entry *phi_a1; - u16 phi_v1; - struct_8018D9E0_entry *phi_a1_2; + s32 var_a0; + s32 var_s0; + u16 var_v1; temp_t6 = arg0->unk4; - temp_a1 = arg0; switch (temp_t6) { case 0: - temp_t8 = temp_a1->unk1C + 3; - temp_a1->unk1C = temp_t8; + temp_t8 = arg0->unk1C + 3; + arg0->unk1C = temp_t8; if (temp_t8 >= 0x65) { - temp_a1->unk4 = 1; - temp_a1->unk1C = 0; - phi_s0 = 0; - if ((s32) D_8018EDF3 > 0) { + arg0->unk4 = 1; + arg0->unk1C = 0; + var_s0 = 0; + if (D_8018EDF3 > 0) { do { - add_8018D9E0_entry(phi_s0 + 0xB1, 0, 0, (s8) (5 - phi_s0)); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 < (s32) D_8018EDF3); + add_8018D9E0_entry(var_s0 + 0xB1, 0, 0, (s8) (5 - var_s0)); + var_s0 += 1; + } while (var_s0 < D_8018EDF3); return; } } default: return; case 1: - arg0 = temp_a1; - if (find_8018D9E0_entry_dupe(0xB1)->unk4 >= 2) { + if (find_8018D9E0_entry_dupe(0x000000B1)->unk4 >= 2) { arg0->unk4 = 2; return; } break; case 2: - temp_t9 = temp_a1->unk1C + 0x20; - temp_a1->unk1C = temp_t9; + temp_t9 = arg0->unk1C + 0x20; + arg0->unk1C = temp_t9; if (temp_t9 >= 0x100) { - if (gModeSelection == VERSUS) { - temp_a1->unk4 = (s32) D_8018EDF4; + if (gModeSelection == 2) { + arg0->unk4 = (s32) D_8018EDF4; } else { - temp_a1->unk4 = (s32) D_8018EDF6; + arg0->unk4 = (s32) D_8018EDF6; } - temp_a1->unk1C = 0; + arg0->unk1C = 0; return; } break; @@ -15106,54 +14750,40 @@ void func_800ACC50(struct_8018D9E0_entry *arg0) { case 11: case 12: case 13: - arg0 = temp_a1; - temp_a1_2 = arg0; - phi_a1 = temp_a1_2; - if (func_800B4520(temp_a1) == 0) { - temp_v0 = gControllerFive; - temp_v1 = temp_v0->unk6; - temp_a0 = temp_v1 | temp_v0->unkC; - phi_a0 = temp_a0; - phi_v1 = temp_v1; - if ((temp_a0 & 0x800) != 0) { - temp_v0_2 = temp_a1_2->unk4; - if (temp_v0_2 >= 0xB) { - temp_a1_2->unk4 = temp_v0_2 - 1; - arg0 = temp_a1_2; - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1_2); + if (func_800B4520() == 0) { + var_v1 = gControllerFive->buttonPressed; + var_a0 = var_v1 | gControllerFive->stickPressed; + if (var_a0 & 0x800) { + temp_v0 = arg0->unk4; + if (temp_v0 >= 0xB) { + arg0->unk4 = temp_v0 - 1; + play_sound2(0x49008000); temp_f0 = (f64) arg0->unk24; - phi_a1 = arg0; if (temp_f0 < 4.2) { arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_t8_2 = gControllerFive; - temp_v1_2 = temp_t8_2->unk6; - phi_a0 = temp_v1_2 | temp_t8_2->unkC; - phi_v1 = temp_v1_2; + var_v1 = gControllerFive->buttonPressed; + var_a0 = var_v1 | gControllerFive->stickPressed; } } - phi_a1_2 = phi_a1; - if ((phi_a0 & 0x400) != 0) { - temp_v0_3 = phi_a1->unk4; - if (temp_v0_3 < 0xD) { - phi_a1->unk4 = temp_v0_3 + 1; - arg0 = phi_a1; - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1); + if (var_a0 & 0x400) { + temp_v0_2 = arg0->unk4; + if (temp_v0_2 < 0xD) { + arg0->unk4 = temp_v0_2 + 1; + play_sound2(0x49008000); temp_f0_2 = (f64) arg0->unk24; - phi_a1_2 = arg0; if (temp_f0_2 < 4.2) { arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_v1 = gControllerFive->unk6; + var_v1 = gControllerFive->buttonPressed; } } - if ((phi_v1 & 0x9000) != 0) { - arg0 = phi_a1_2; - func_8009DFE0(0x1E, phi_a1_2); - play_sound2(SOUND_MENU_OK_CLICKED); - if (gModeSelection == VERSUS) { + if (var_v1 & 0x9000) { + func_8009DFE0(0x0000001E); + play_sound2(0x49008016); + if (gModeSelection == 2) { D_8018EDF4 = (s8) arg0->unk4; } else { D_8018EDF6 = (s8) arg0->unk4; @@ -15350,27 +14980,9 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AD1A4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 s32 func_800B6348(s32); /* extern */ -void func_800B6708(); /* extern */ -s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ -void play_sound2(?, u16); /* extern */ -extern void *D_800DC5EC; -extern void *D_800DC5F0; -extern s32 D_80162DF8; extern void *D_8018D9BC; -extern s8 D_8018D9D8; -extern OSPfs D_8018E868; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; -extern s32 D_8018EB84; -extern s8 D_8018EDF5; -extern void *gControllerOne; -static u16 D_800E86F0; /* unable to generate initializer; const */ -static s32 D_800E86F4 = 0x4E4B544A; /* const */ -static s8 D_800E86F8 = 0; /* const */ -static u8 D_800F2E64; /* unable to generate initializer; const */ -static u8 D_800F2E74; /* unable to generate initializer; const */ static s8 gGP1stPlaceReward = 9; /* const */ static s8 gGP2ndPlaceReward = 6; /* const */ static s8 gGP3rdPlaceReward = 3; /* const */ @@ -15383,35 +14995,26 @@ void func_800AD2E8(struct_8018D9E0_entry *arg0) { f64 temp_f0_3; f64 temp_f0_4; s32 temp_a0; - s32 temp_a0_2; s32 temp_a2; s32 temp_t2; s32 temp_t9; s32 temp_v0; + s32 temp_v0_2; s32 temp_v0_3; s32 temp_v0_4; s32 temp_v0_5; s32 temp_v0_6; s32 temp_v0_7; - s32 temp_v0_8; - s8 temp_t3; - u16 temp_a1; - u16 temp_a1_2; - void *temp_t6; - void *temp_v0_2; - void *temp_v1; - void *temp_v1_2; - s32 phi_a1; - s32 phi_a0; - u16 phi_a1_2; - u16 phi_a1_3; - s32 phi_v1; - s32 phi_v1_2; + s32 var_a0; + s32 var_a1; + s32 var_v1; + s32 var_v1_2; + u16 var_a1_2; temp_v0 = arg0->unk4; switch ((u32) temp_v0) { /* switch 3; irregular */ case 0: /* switch 3 */ - arg0->column = -0xA0; + arg0->column = -0x000000A0; arg0->unk4 = 1; D_8018D9BC->unk0 = (s8) gGP1stPlaceReward; D_8018D9BC->unk1 = (s8) gGP2ndPlaceReward; @@ -15421,29 +15024,26 @@ void func_800AD2E8(struct_8018D9E0_entry *arg0) { return; case 1: /* switch 3 */ temp_a0 = arg0->unk20; + var_a1 = 0x10; arg0->column = temp_a0; - phi_a1 = 0x10; if (D_8018D9D8 != 0) { - phi_a1 = 0x20; + var_a1 = 0x20; } - temp_a2 = temp_a0 + phi_a1; + temp_a2 = temp_a0 + var_a1; if (temp_a2 < 0) { arg0->unk20 = temp_a2; - temp_v0_2 = D_800DC5EC; - temp_v0_2->unk30 = (s16) (temp_v0_2->unk30 + phi_a1); - temp_v1 = D_800DC5F0; - temp_v1->unk30 = (s16) (temp_v1->unk30 - phi_a1); + D_800DC5EC->screenStartX += var_a1; + D_800DC5F0->screenStartX -= var_a1; return; } arg0->unk20 = 0; arg0->column = 0; - temp_t3 = D_8018EDF5; - arg0->unk4 = (s32) temp_t3; - if ((temp_t3 == 9) && (D_80162DF8 == 1)) { - arg0->unk4 = temp_t3 - 1; + arg0->unk4 = (s32) D_8018EDF5; + if ((D_8018EDF5 == 9) && (D_80162DF8 == 1)) { + arg0->unk4 = D_8018EDF5 - 1; } - D_800DC5EC->unk30 = 0xF0; - D_800DC5F0->unk30 = 0x50; + D_800DC5EC->screenStartX = 0x00F0; + D_800DC5F0->screenStartX = 0x0050; return; case 5: /* switch 3 */ case 6: /* switch 3 */ @@ -15452,73 +15052,70 @@ void func_800AD2E8(struct_8018D9E0_entry *arg0) { case 9: /* switch 3 */ case 10: /* switch 3 */ if (func_800B4520() == 0) { - temp_v1_2 = gControllerOne; - temp_a1 = temp_v1_2->unk6; - temp_a0_2 = temp_a1 | temp_v1_2->unkC; - phi_a0 = temp_a0_2; - phi_a1_2 = temp_a1; - if ((temp_a0_2 & 0x800) != 0) { - temp_v0_3 = arg0->unk4; - temp_t2 = temp_v0_3 - 1; - if (temp_v0_3 >= 6) { + var_a1_2 = gControllerOne->buttonPressed; + var_a0 = var_a1_2 | gControllerOne->stickPressed; + if (var_a0 & 0x800) { + temp_v0_2 = arg0->unk4; + temp_t2 = temp_v0_2 - 1; + if (temp_v0_2 >= 6) { arg0->unk4 = temp_t2; if ((D_80162DF8 == 1) && (temp_t2 == 9)) { arg0->unk4 = temp_t2 - 1; } - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1); + play_sound2(0x49008000); temp_f0 = (f64) arg0->unk24; if (temp_f0 < 4.2) { arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_t6 = gControllerOne; - temp_a1_2 = temp_t6->unk6; - phi_a0 = temp_a1_2 | temp_t6->unkC; - phi_a1_2 = temp_a1_2; + var_a1_2 = gControllerOne->buttonPressed; + var_a0 = var_a1_2 | gControllerOne->stickPressed; } } - phi_a1_3 = phi_a1_2; - if ((phi_a0 & 0x400) != 0) { - temp_v0_4 = arg0->unk4; - temp_t9 = temp_v0_4 + 1; - if (temp_v0_4 < 0xA) { + if (var_a0 & 0x400) { + temp_v0_3 = arg0->unk4; + temp_t9 = temp_v0_3 + 1; + if (temp_v0_3 < 0xA) { arg0->unk4 = temp_t9; if ((D_80162DF8 == 1) && (temp_t9 == 9)) { arg0->unk4 = temp_t9 + 1; } - temp_v0_5 = arg0->unk4; - if ((temp_v0_5 == 0xA) && (*D_80162DD4 != 0)) { - arg0->unk4 = temp_v0_5 - 2; - phi_a1_3 = gControllerOne->unk6; + temp_v0_4 = arg0->unk4; + if ((temp_v0_4 == 0x0000000A) && (*D_80162DD4 != 0)) { + arg0->unk4 = temp_v0_4 - 2; + var_a1_2 = gControllerOne->buttonPressed; } else { - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1_2); + play_sound2(0x49008000); temp_f0_2 = (f64) arg0->unk24; if (temp_f0_2 < 4.2) { arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_a1_3 = gControllerOne->unk6; + var_a1_2 = gControllerOne->buttonPressed; } } } - if ((phi_a1_3 & 0x9000) != 0) { - temp_v0_6 = arg0->unk4; - if (temp_v0_6 == 0xA) { + if (var_a1_2 & 0x9000) { + temp_v0_5 = arg0->unk4; + if (temp_v0_5 == 0x0000000A) { temp_f0_3 = (f64) arg0->unk24; - phi_v1 = 0; + var_v1 = 0; if (temp_f0_3 < 4.2) { arg0->unk24 = (f32) (temp_f0_3 + 4.0); } if (D_800E86F8 != 0) { sp28 = 0; - temp_v0_7 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84); - switch (temp_v0_7) { /* switch 4; irregular */ + temp_v0_6 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84); + var_v1 = 0; + switch (temp_v0_6) { /* switch 4; irregular */ + case 5: /* switch 4 */ + break; case 0: /* switch 4 */ func_800B6708(); arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x11; sp28 = 1; - play_sound2(SOUND_MENU_SELECT); - phi_v1 = 1; + play_sound2(0x49008001); + var_v1 = 1; break; case 2: /* switch 4 */ /* fallthrough */ @@ -15527,70 +15124,69 @@ void func_800AD2E8(struct_8018D9E0_entry *arg0) { break; } } - case 5: /* switch 4 */ - if (phi_v1 == 0) { + if (var_v1 == 0) { if (D_800E86F8 == 0) { - sp28 = phi_v1; - temp_v0_8 = func_800B5F30(); - phi_v1_2 = phi_v1; - switch (temp_v0_8) { /* switch 2 */ + sp28 = var_v1; + temp_v0_7 = func_800B5F30(); + var_v1_2 = var_v1; + switch (temp_v0_7) { /* switch 2 */ case -1: /* switch 2 */ - arg0->unk4 = 0xB; - phi_v1_2 = 1; + arg0->unk4 = 0x0000000B; + var_v1_2 = 1; break; case -3: /* switch 2 */ case -2: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; + arg0->unk4 = 0x0000000C; + var_v1_2 = 1; break; case 1: /* switch 2 */ case 11: /* switch 2 */ - arg0->unk4 = 0xB; - phi_v1_2 = 1; + arg0->unk4 = 0x0000000B; + var_v1_2 = 1; break; case 10: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; + arg0->unk4 = 0x0000000C; + var_v1_2 = 1; break; default: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; + var_v1_2 = 1; + arg0->unk4 = 0x0000000C; break; } - if (phi_v1_2 != 0) { - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + if (var_v1_2 != 0) { + play_sound2(0x4900FF07); return; } - if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) == 0) { + if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84) == 0) { func_800B6708(); arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x11; - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); return; } goto block_56; } block_56: if (D_8018EB7C >= D_8018EB78) { - arg0->unk4 = 0xE; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + arg0->unk4 = 0x0000000E; + play_sound2(0x4900FF07); return; } if (gControllerPakNumPagesFree >= 0x79) { - arg0->unk4 = 0x13; + arg0->unk4 = 0x00000013; arg0->unk1C = 0; - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); return; } - arg0->unk4 = 0xE; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + arg0->unk4 = 0x0000000E; + play_sound2(0x4900FF07); return; } } else { - arg0->unk1C = temp_v0_6; - D_8018EDF5 = (s8) temp_v0_6; - arg0->unk4 = 0x1E; + arg0->unk1C = temp_v0_5; + D_8018EDF5 = (s8) temp_v0_5; + arg0->unk4 = 0x0000001E; arg0->unk20 = arg0->row; - play_sound2(SOUND_ACTION_NEXT_COURSE, phi_a1_3); + play_sound2(0x49008015); temp_f0_4 = (f64) arg0->unk24; if (temp_f0_4 < 4.2) { arg0->unk24 = (f32) (temp_f0_4 + 4.0); @@ -15608,12 +15204,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AD2E8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_8009DFE0(?, struct_8018D9E0_entry *, void *, s32 *); /* extern */ -void func_800C9F90(?); /* extern */ -void func_800CA330(?); /* extern */ -void func_8028DF38(?, struct_8018D9E0_entry *, void *, s32 *); /* extern */ -extern Controller gControllers; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 static ? D_800F0B50; /* unable to generate initializer; const */ static ? D_800F0B54; /* unable to generate initializer; const */ @@ -15622,26 +15213,19 @@ void func_800ADF48(struct_8018D9E0_entry *arg0) { f64 temp_f0; f64 temp_f0_2; f64 temp_f0_3; - s32 temp_a0; - s32 temp_t2; s32 temp_t7; s32 temp_v0; s32 temp_v0_2; + s32 var_a0; s8 temp_v0_3; - struct_8018D9E0_entry *temp_a1; - u16 temp_v1; - u16 temp_v1_2; - void *temp_a2; - s32 phi_a0; - u16 phi_v1; - struct_8018D9E0_entry *phi_a1; + u16 var_v1; + void *var_a2; - temp_a1 = arg0; if (D_800DC5FC != 0) { temp_t7 = arg0->unk4; switch (temp_t7) { case 0: - temp_a1->unk4 = (s32) *(&D_800F0B50 + gModeSelection); + arg0->unk4 = (s32) *(&D_800F0B50 + gModeSelection); return; case 11: case 12: @@ -15658,68 +15242,58 @@ void func_800ADF48(struct_8018D9E0_entry *arg0) { case 42: case 43: case 44: - arg0 = temp_a1; - if (func_800B4520(temp_a1) == 0) { - temp_t2 = (D_800DC5FC * 0x10) - 0x10; - temp_a2 = temp_t2 + &gControllers; - temp_v1 = temp_a2->unk6; - temp_a0 = temp_v1 | temp_a2->unkC; - phi_a0 = temp_a0; - phi_v1 = temp_v1; - if ((temp_a0 & 0x800) != 0) { + if (func_800B4520() == 0) { + var_a2 = (D_800DC5FC * 0x10) - 0x10 + gControllers; + var_v1 = var_a2->unk6; + var_a0 = var_v1 | var_a2->unkC; + if (var_a0 & 0x800) { temp_v0 = arg0->unk4; - if ((s32) *(&D_800F0B50 + gModeSelection) < temp_v0) { + if (*(&D_800F0B50 + gModeSelection) < temp_v0) { arg0->unk4 = temp_v0 - 1; - sp18 = temp_a2; - arg0 = arg0; - play_sound2(SOUND_MENU_CURSOR_MOVE); + sp18 = var_a2; + play_sound2(0x49008000); temp_f0 = (f64) arg0->unk24; if (temp_f0 < 4.2) { arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_v1_2 = temp_a2->unk6; - phi_a0 = temp_v1_2 | temp_a2->unkC; - phi_v1 = temp_v1_2; + var_v1 = var_a2->unk6; + var_a0 = var_v1 | var_a2->unkC; } } - phi_a1 = arg0; - if ((phi_a0 & 0x400) != 0) { + if (var_a0 & 0x400) { temp_v0_2 = arg0->unk4; - if (temp_v0_2 < (s32) *(&D_800F0B54 + gModeSelection)) { + if (temp_v0_2 < *(&D_800F0B54 + gModeSelection)) { arg0->unk4 = temp_v0_2 + 1; - sp18 = temp_t2 + &gControllers; - arg0 = arg0; - play_sound2(SOUND_MENU_CURSOR_MOVE); + sp18 = var_a2; + play_sound2(0x49008000); temp_f0_2 = (f64) arg0->unk24; - phi_a1 = arg0; if (temp_f0_2 < 4.2) { arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_v1 = (temp_t2 + &gControllers)->unk6; + var_v1 = var_a2->unk6; } } - if ((phi_v1 & 0x4000) != 0) { + if (var_v1 & 0x4000) { temp_v0_3 = *(&D_800F0B50 + gModeSelection); - if (phi_a1->unk4 != temp_v0_3) { - phi_a1->unk4 = (s32) temp_v0_3; - play_sound2(SOUND_MENU_GO_BACK); + if (arg0->unk4 != temp_v0_3) { + arg0->unk4 = (s32) temp_v0_3; + play_sound2(0x49008002); return; } } - if ((phi_v1 & 0x9000) != 0) { - if (phi_a1->unk4 == *(&D_800F0B50 + gModeSelection)) { - phi_a1->unk4 = 0; + if (var_v1 & 0x9000) { + if (arg0->unk4 == *(&D_800F0B50 + gModeSelection)) { + arg0->unk4 = 0; D_800DC5FC = 0; - func_8028DF38(0x1E, phi_a1, temp_t2 + &gControllers, &gModeSelection); - func_800C9F90(0); + func_8028DF38(0x0000001E, arg0, var_a2, &gModeSelection); + func_800C9F90(0U); return; } - arg0 = phi_a1; - func_8009DFE0(0x1E, phi_a1, temp_t2 + &gControllers, &gModeSelection); - play_sound2(SOUND_ACTION_CONTINUE_UNKNOWN); - func_800CA330(0x3C); + func_8009DFE0(0x0000001E); + play_sound2(0x4900801B); + func_800CA330(0x3CU); temp_f0_3 = (f64) arg0->unk24; if (temp_f0_3 < 4.2) { arg0->unk24 = (f32) (temp_f0_3 + 4.0); @@ -15730,7 +15304,7 @@ void func_800ADF48(struct_8018D9E0_entry *arg0) { break; } } else { - temp_a1->unk4 = 0; + arg0->unk4 = 0; default: } } @@ -15739,29 +15313,10 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ADF48.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_8009DFE0(?); /* extern */ -s32 func_800B6178(s32); /* extern */ +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-12-2022 s32 func_800B6348(s32); /* extern */ s32 func_800B63F0(s32); /* extern */ -void func_800B6708(); /* extern */ -void func_800CA330(?); /* extern */ -void func_800CA388(?); /* extern */ -s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ -void play_sound2(?, s32); /* extern */ -extern s8 D_8018CAE0; -extern OSPfs D_8018E868; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; -extern s32 D_8018EB84; -extern struct_8018EE10_entry D_8018EE10; -extern void *gControllerOne; -static s16 D_800DC5B8; /* unable to generate initializer */ -static u16 D_800E86F0; /* unable to generate initializer; const */ -static s32 D_800E86F4 = 0x4E4B544A; /* const */ -static s8 D_800E86F8 = 0; /* const */ -static u8 D_800F2E64; /* unable to generate initializer; const */ -static u8 D_800F2E74; /* unable to generate initializer; const */ +u16 D_800DC5B8; /* unable to generate initializer */ void func_800AE218(struct_8018D9E0_entry *arg0) { s32 sp28; @@ -15776,39 +15331,26 @@ void func_800AE218(struct_8018D9E0_entry *arg0) { f64 temp_f0_7; f64 temp_f0_8; f64 temp_f0_9; - s32 temp_a0_4; - s32 temp_a1; - s32 temp_a1_2; - s32 temp_a1_3; + s32 temp_a0_2; s32 temp_t5; - s32 temp_t6_2; + s32 temp_t6; s32 temp_t9; s32 temp_v0; + s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_4; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; s32 temp_v1_4; s32 temp_v1_5; + s32 var_a1; + s32 var_a1_2; + s32 var_a1_3; + s32 var_v1; + s32 var_v1_2; u16 temp_a0; - u16 temp_a0_2; - u16 temp_a0_3; - u16 temp_a0_5; - u16 temp_a0_6; - void *temp_t0; - void *temp_t2; - void *temp_t6; - void *temp_v0_2; - void *temp_v0_5; - void *temp_v0_6; - s32 phi_a1; - u16 phi_a0; - s32 phi_v1; - s32 phi_v1_2; - s32 phi_a1_2; - s32 phi_a1_3; - u16 phi_a0_2; + u16 var_a0; + u16 var_a0_2; if (arg0->unk4 != 0) { D_800DC5B8 = 0; @@ -15819,9 +15361,9 @@ void func_800AE218(struct_8018D9E0_entry *arg0) { if (temp_v0 < 0x1E) { arg0->unk1C = temp_v0 + 1; } - if ((gControllerOne->unk6 & 0x1000) != 0) { - arg0->unk4 = 0xF; - play_sound2(SOUND_ACTION_GO_BACK_2); + if (gControllerOne->buttonPressed & 0x1000) { + arg0->unk4 = 0x0000000F; + play_sound2(0x49008005); return; } if (D_8018CAE0 != 0) { @@ -15835,7 +15377,7 @@ void func_800AE218(struct_8018D9E0_entry *arg0) { temp_t5 = arg0->unk1C + 3; arg0->unk1C = temp_t5; if (temp_t5 >= 0x8D) { - arg0->unk4 = 0xF; + arg0->unk4 = 0x0000000F; return; } break; @@ -15846,55 +15388,53 @@ void func_800AE218(struct_8018D9E0_entry *arg0) { case 15: /* switch 1 */ case 16: /* switch 1 */ if (func_800B4520() == 0) { - temp_v0_2 = gControllerOne; - temp_a0 = temp_v0_2->unk6; - temp_a1 = temp_a0 | temp_v0_2->unkC; - phi_a1 = temp_a1; - phi_a0 = temp_a0; - if ((temp_a1 & 0x800) != 0) { + var_a0 = gControllerOne->buttonPressed; + var_a1 = var_a0 | gControllerOne->stickPressed; + if (var_a1 & 0x800) { temp_v1 = arg0->unk4; if (temp_v1 >= 0xC) { arg0->unk4 = temp_v1 - 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1); + play_sound2(0x49008000); temp_f0 = (f64) arg0->unk24; if (temp_f0 < 4.2) { arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_t2 = gControllerOne; - temp_a0_2 = temp_t2->unk6; - phi_a1 = temp_a0_2 | temp_t2->unkC; - phi_a0 = temp_a0_2; + var_a0 = gControllerOne->buttonPressed; + var_a1 = var_a0 | gControllerOne->stickPressed; } } - if ((phi_a1 & 0x400) != 0) { + if (var_a1 & 0x400) { temp_v1_2 = arg0->unk4; if (temp_v1_2 < 0x10) { arg0->unk4 = temp_v1_2 + 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1); + play_sound2(0x49008000); temp_f0_2 = (f64) arg0->unk24; if (temp_f0_2 < 4.2) { arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_a0 = gControllerOne->unk6; + var_a0 = gControllerOne->buttonPressed; } } - if ((phi_a0 & 0x9000) != 0) { - if (arg0->unk4 == 0x10) { + if (var_a0 & 0x9000) { + if (arg0->unk4 == 0x00000010) { temp_f0_3 = (f64) arg0->unk24; - phi_v1 = 0; + var_v1 = 0; if (temp_f0_3 < 4.2) { arg0->unk24 = (f32) (temp_f0_3 + 4.0); } if (D_800E86F8 != 0) { sp28 = 0; - temp_v0_3 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84); - switch (temp_v0_3) { /* switch 3; irregular */ + temp_v0_2 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84); + var_v1 = 0; + switch (temp_v0_2) { /* switch 3; irregular */ + case 5: /* switch 3 */ + break; case 0: /* switch 3 */ func_800B6708(); arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x1E; - phi_v1 = 1; + var_v1 = 1; break; case 2: /* switch 3 */ /* fallthrough */ @@ -15903,71 +15443,70 @@ void func_800AE218(struct_8018D9E0_entry *arg0) { break; } } - case 5: /* switch 3 */ - if (phi_v1 != 0) { - play_sound2(SOUND_MENU_SELECT); + if (var_v1 != 0) { + play_sound2(0x49008001); return; } if (D_800E86F8 == 0) { - sp28 = phi_v1; - temp_v0_4 = func_800B5F30(); - phi_v1_2 = phi_v1; - switch (temp_v0_4) { /* switch 2 */ + sp28 = var_v1; + temp_v0_3 = func_800B5F30(); + var_v1_2 = var_v1; + switch (temp_v0_3) { /* switch 2 */ case -1: /* switch 2 */ - arg0->unk4 = 0x15; - phi_v1_2 = 1; + arg0->unk4 = 0x00000015; + var_v1_2 = 1; break; case -3: /* switch 2 */ case -2: /* switch 2 */ - arg0->unk4 = 0x16; - phi_v1_2 = 1; + arg0->unk4 = 0x00000016; + var_v1_2 = 1; break; case 1: /* switch 2 */ case 11: /* switch 2 */ - arg0->unk4 = 0x15; - phi_v1_2 = 1; + arg0->unk4 = 0x00000015; + var_v1_2 = 1; break; case 10: /* switch 2 */ - arg0->unk4 = 0x16; - phi_v1_2 = 1; + arg0->unk4 = 0x00000016; + var_v1_2 = 1; break; default: /* switch 2 */ - arg0->unk4 = 0x16; - phi_v1_2 = 1; + var_v1_2 = 1; + arg0->unk4 = 0x00000016; break; } - if (phi_v1_2 != 0) { - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + if (var_v1_2 != 0) { + play_sound2(0x4900FF07); return; } - if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) == 0) { + if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84) == 0) { func_800B6708(); arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x1E; - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); return; } goto block_49; } block_49: if (D_8018EB7C >= D_8018EB78) { - arg0->unk4 = 0x18; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + arg0->unk4 = 0x00000018; + play_sound2(0x4900FF07); return; } if (gControllerPakNumPagesFree >= 0x79) { - arg0->unk4 = 0x20; + arg0->unk4 = 0x00000020; arg0->unk1C = 0; - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); return; } - arg0->unk4 = 0x18; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + arg0->unk4 = 0x00000018; + play_sound2(0x4900FF07); return; } - func_8009DFE0(0x1E); - play_sound2(SOUND_MENU_OK_CLICKED); - func_800CA330(0x19); - func_800CA388(0x19); + func_8009DFE0(0x0000001E); + play_sound2(0x49008016); + func_800CA330(0x19U); + func_800CA388(0x19U); temp_f0_4 = (f64) arg0->unk24; if (temp_f0_4 < 4.2) { arg0->unk24 = (f32) (temp_f0_4 + 4.0); @@ -15983,9 +15522,9 @@ block_49: case 25: /* switch 1 */ case 26: /* switch 1 */ case 41: /* switch 1 */ - if ((gControllerOne->unk6 & 0xD000) != 0) { - arg0->unk4 = 0x10; - play_sound2(SOUND_MENU_GO_BACK); + if (gControllerOne->buttonPressed & 0xD000) { + arg0->unk4 = 0x00000010; + play_sound2(0x49008002); temp_f0_5 = (f64) arg0->unk24; if (temp_f0_5 < 4.2) { arg0->unk24 = (f32) (temp_f0_5 + 4.0); @@ -15997,28 +15536,25 @@ block_49: case 31: /* switch 1 */ arg0->unk20 = (u32) arg0->unk4 - 0x1E; if (func_800B639C((gCupSelection * 4) + gCupCourseSelection) != arg0->unk20) { - temp_v0_5 = gControllerOne; - temp_a1_2 = temp_v0_5->unk6 | temp_v0_5->unkC; - phi_a1_2 = temp_a1_2; - if ((temp_a1_2 & 0x800) != 0) { + var_a1_2 = gControllerOne->buttonPressed | gControllerOne->stickPressed; + if (var_a1_2 & 0x800) { temp_v1_3 = arg0->unk4; if (temp_v1_3 >= 0x1F) { arg0->unk4 = temp_v1_3 - 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1_2); + play_sound2(0x49008000); temp_f0_6 = (f64) arg0->unk24; if (temp_f0_6 < 4.2) { arg0->unk24 = (f32) (temp_f0_6 + 4.0); } arg0->unk8 = -1; - temp_t0 = gControllerOne; - phi_a1_2 = temp_t0->unk6 | temp_t0->unkC; + var_a1_2 = gControllerOne->buttonPressed | gControllerOne->stickPressed; } } - if ((phi_a1_2 & 0x400) != 0) { + if (var_a1_2 & 0x400) { temp_v1_4 = arg0->unk4; if (temp_v1_4 < 0x1F) { arg0->unk4 = temp_v1_4 + 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1_2); + play_sound2(0x49008000); temp_f0_7 = (f64) arg0->unk24; if (temp_f0_7 < 4.2) { arg0->unk24 = (f32) (temp_f0_7 + 4.0); @@ -16027,23 +15563,23 @@ block_49: } } } - temp_a0_3 = gControllerOne->unk6; - if ((temp_a0_3 & 0x4000) != 0) { - arg0->unk4 = 0x10; - play_sound2(SOUND_MENU_GO_BACK); + temp_a0 = gControllerOne->buttonPressed; + if (temp_a0 & 0x4000) { + arg0->unk4 = 0x00000010; + play_sound2(0x49008002); return; } - if ((temp_a0_3 & 0x9000) != 0) { - temp_a0_4 = arg0->unk20; - if (((temp_a0_4 << 7) + &D_8018EE10)->unk4 == 0) { - arg0->unk4 = 0x28; + if (temp_a0 & 0x9000) { + temp_a0_2 = arg0->unk20; + if (D_8018EE10[temp_a0_2].ghostDataSaved == 0) { + arg0->unk4 = 0x00000028; arg0->unk1C = 0; - } else if (func_800B63F0(temp_a0_4) == 0) { - arg0->unk4 = 0x1A; + } else if (func_800B63F0(temp_a0_2) == 0) { + arg0->unk4 = 0x0000001A; } else { - arg0->unk4 = 0x23; + arg0->unk4 = 0x00000023; } - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); temp_f0_8 = (f64) arg0->unk24; if (temp_f0_8 < 4.2) { arg0->unk24 = (f32) (temp_f0_8 + 4.0); @@ -16053,59 +15589,54 @@ block_49: break; case 32: /* switch 1 */ if ((arg0->unk1C == 1) && (func_800B6A68() != 0)) { - arg0->unk4 = 0x19; + arg0->unk4 = 0x00000019; return; } temp_t9 = arg0->unk1C + 1; arg0->unk1C = temp_t9; if (temp_t9 >= 2) { - arg0->unk4 = 0x1E; + arg0->unk4 = 0x0000001E; return; } break; case 35: /* switch 1 */ case 36: /* switch 1 */ - temp_v0_6 = gControllerOne; - temp_a0_5 = temp_v0_6->unk6; - temp_a1_3 = temp_a0_5 | temp_v0_6->unkC; - phi_a1_3 = temp_a1_3; - phi_a0_2 = temp_a0_5; - if (((temp_a1_3 & 0x800) != 0) && ((s32) (u32) arg0->unk4 >= 0x24)) { + var_a0_2 = gControllerOne->buttonPressed; + var_a1_3 = var_a0_2 | gControllerOne->stickPressed; + if ((var_a1_3 & 0x800) && ((s32) (u32) arg0->unk4 >= 0x24)) { arg0->unk4 = (u32) arg0->unk4 - 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, temp_a1_3); + play_sound2(0x49008000); temp_f0_9 = (f64) arg0->unk24; if (temp_f0_9 < 4.2) { arg0->unk24 = (f32) (temp_f0_9 + 4.0); } arg0->unk8 = -1; - temp_t6 = gControllerOne; - temp_a0_6 = temp_t6->unk6; - phi_a1_3 = temp_a0_6 | temp_t6->unkC; - phi_a0_2 = temp_a0_6; + var_a0_2 = gControllerOne->buttonPressed; + var_a1_3 = var_a0_2 | gControllerOne->stickPressed; } - if ((phi_a1_3 & 0x400) != 0) { + if (var_a1_3 & 0x400) { temp_v1_5 = arg0->unk4; if (temp_v1_5 < 0x24) { arg0->unk4 = temp_v1_5 + 1; - play_sound2(SOUND_MENU_CURSOR_MOVE, phi_a1_3); + play_sound2(0x49008000); temp_f0_10 = (f64) arg0->unk24; if (temp_f0_10 < 4.2) { arg0->unk24 = (f32) (temp_f0_10 + 4.0); } arg0->unk8 = 1; - phi_a0_2 = gControllerOne->unk6; + var_a0_2 = gControllerOne->buttonPressed; } } - if ((phi_a0_2 & 0x4000) != 0) { + if (var_a0_2 & 0x4000) { arg0->unk4 = arg0->unk20 + 0x1E; - play_sound2(SOUND_MENU_GO_BACK); + play_sound2(0x49008002); return; } - if ((phi_a0_2 & 0x9000) != 0) { - if (arg0->unk4 == 0x24) { - arg0->unk4 = 0x28; + if (var_a0_2 & 0x9000) { + if (arg0->unk4 == 0x00000024) { + arg0->unk4 = 0x00000028; arg0->unk1C = 0; - play_sound2(SOUND_MENU_SELECT); + play_sound2(0x49008001); temp_f0_11 = (f64) arg0->unk24; if (temp_f0_11 < 4.2) { arg0->unk24 = (f32) (temp_f0_11 + 4.0); @@ -16113,30 +15644,30 @@ block_49: } } else { arg0->unk4 = arg0->unk20 + 0x1E; - play_sound2(SOUND_MENU_GO_BACK); + play_sound2(0x49008002); return; } } break; case 40: /* switch 1 */ if (arg0->unk1C == 1) { - if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) != 0) { - arg0->unk4 = 0x29; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84) != 0) { + arg0->unk4 = 0x00000029; + play_sound2(0x4900FF07); return; } if (func_800B6178(arg0->unk20) != 0) { - arg0->unk4 = 0x29; - play_sound2(SOUND_MENU_FILE_NOT_FOUND); + arg0->unk4 = 0x00000029; + play_sound2(0x4900FF07); return; } goto block_107; } block_107: - temp_t6_2 = arg0->unk1C + 1; - arg0->unk1C = temp_t6_2; - if (temp_t6_2 >= 2) { - arg0->unk4 = 0x10; + temp_t6 = arg0->unk1C + 1; + arg0->unk1C = temp_t6; + if (temp_t6 >= 2) { + arg0->unk4 = 0x00000010; } break; } @@ -16287,121 +15818,87 @@ void func_800AEF74(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEF74.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_8009DFE0(?); /* extern */ -void func_800CA330(?); /* extern */ -void func_800CA388(?); /* extern */ -void play_sound2(?); /* extern */ -extern void *gControllerFive; - +#ifdef NEEDS_RODATA +// data/data_0DD0A0_3_0.s +// jpt_800F2A9C +extern struct Controller *gControllerFive; void func_800AF004(struct_8018D9E0_entry *arg0) { s32 temp_t1; - s32 temp_t6; - s32 temp_t6_2; - s32 temp_t8; - s32 temp_t9; - void *temp_v0; - temp_t6 = arg0->unk4; - switch (temp_t6) { + switch (arg0->unk4) { case 0: - temp_t8 = arg0->unk1C + 3; - arg0->unk1C = temp_t8; - if (temp_t8 >= 0x65) { + arg0->unk1C += 3; + if (arg0->unk1C >= 0x65) { arg0->unk1C = 0; arg0->unk4 = 1; - gCupSelection = (s8) ((s32) gCupSelection % 4); - gCCSelection = (s32) gCCSelection % 4; - add_8018D9E0_entry(0x12C, 0, 0, 4); - return; + gCupSelection %= 4; + gCCSelection %= 4; + add_8018D9E0_entry(0x0000012C, 0, 0, 4); } - default: - return; + break; case 1: case 2: case 3: case 4: - temp_t6_2 = arg0->unk1C + 1; - arg0->unk1C = temp_t6_2; - if (temp_t6_2 >= 9) { + arg0->unk1C += 1; + if (arg0->unk1C >= 9) { arg0->unk1C = 0; - temp_t9 = arg0->unk4 + 1; - arg0->unk4 = temp_t9; - add_8018D9E0_entry(temp_t9 + 0x12B, 0, 0, 4); - return; + arg0->unk4++; + add_8018D9E0_entry(arg0->unk4 + 0x12B, 0, 0, 4); } break; case 5: - temp_t1 = arg0->unk1C + 1; - arg0->unk1C = temp_t1; - if ((temp_t1 >= 0x65) && ((temp_v0 = gControllerFive, (temp_v0->unk6 != 0)) || (temp_v0->unkC != 0))) { + arg0->unk1C += 1; + if ((arg0->unk1C >= 0x65) && ((gControllerFive->buttonPressed != 0) || (gControllerFive->stickPressed != 0))) { arg0->unk4 = 6; arg0->unk1C = 0; - if ((s32) D_802874F5 < 3) { + if (D_802874F5 < 3) { play_sound2(SOUND_MENU_OK_CLICKED); - return; + } else { + play_sound2(SOUND_ACTION_CONTINUE_UNKNOWN); } - play_sound2(SOUND_ACTION_CONTINUE_UNKNOWN); - return; } break; case 6: - func_8009DFE0(0x1E); - func_800CA330(0x19); - func_800CA388(0x19); + func_8009DFE0(0x0000001E); + func_800CA330(0x19U); + func_800CA388(0x19U); arg0->unk4 = 7; break; + case 7: + default: + break; } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF004.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -struct _struct_D_800E7458_0x8 { - /* 0x0 */ s16 unk0; /* inferred */ - /* 0x2 */ s16 unk2; /* inferred */ - /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ -}; /* size = 0x8 */ - -struct _struct_D_800E7480_0x8 { - /* 0x0 */ s16 unk0; /* inferred */ - /* 0x2 */ s16 unk2; /* inferred */ - /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ -}; /* size = 0x8 */ - -void func_800A91D8(s16, s16); /* extern */ -static struct _struct_D_800E7458_0x8 D_800E7458[0]; /* unable to generate initializer; const */ -static struct _struct_D_800E7480_0x8 D_800E7480[0]; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/data_0DD0A0_2_0.s +extern Unk_D_800E70A0 D_800E7458[0]; /* unable to generate initializer */ +extern Unk_D_800E70A0 D_800E7480[0]; /* unable to generate initializer */ void func_800AF1AC(struct_8018D9E0_entry *arg0) { - struct _struct_D_800E7480_0x8 *sp18; - s32 temp_v0; - s32 temp_v1; - struct _struct_D_800E7458_0x8 *temp_v0_2; - struct _struct_D_800E7480_0x8 *temp_v0_3; + Unk_D_800E70A0 *temp_v0_2; + s32 idx = arg0->type - 0x12C; - temp_v0 = arg0->unk4; - temp_v1 = arg0->type - 0x12C; - switch (temp_v0) { /* irregular */ + switch (arg0->unk4) { /* irregular */ case 0: - temp_v0_2 = &D_800E7458[temp_v1]; - arg0->column = (s32) temp_v0_2->unk0; + temp_v0_2 = &D_800E7458[idx]; + arg0->column = temp_v0_2->column; + arg0->row = temp_v0_2->row; arg0->unk4 = 1; - arg0->row = (s32) temp_v0_2->unk2; - return; + break; case 1: - temp_v0_3 = &D_800E7480[temp_v1]; - sp18 = temp_v0_3; - func_800A91D8(temp_v0_3->unk0, temp_v0_3->unk2); - if ((temp_v0_3->unk0 == arg0->column) && (temp_v0_3->unk2 == arg0->row)) { + temp_v0_2 = &D_800E7480[idx]; + func_800A91D8(arg0, temp_v0_2->column, temp_v0_2->row); + if ((arg0->column == temp_v0_2->column) && (arg0->row == temp_v0_2->row)) { arg0->unk4 = 2; } - /* fallthrough */ + break; case 2: - return; + break; } } #else diff --git a/src/code_80091750.h b/src/code_80091750.h index 1c401646c..52107825b 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -49,6 +49,13 @@ typedef struct { /* 0x04 */ Gfx *displayList; } struct_8018E768_entry; // size = 0x08 +typedef struct { + /* 0x00 */ s16 column; + /* 0x02 */ s16 row; + /* 0x04 */ s16 pad0; + /* 0x06 */ s16 pad1; +} Unk_D_800E70A0; // size = 0x08 + /* Function Prototypes */ f64 exponent_by_squaring(f64, s32); @@ -115,9 +122,9 @@ void *segmented_to_virtual_dupe_2(const void*); Gfx *func_8009C204(Gfx*, MkTexture*, s32, s32, s32); void func_8009CA2C(); void func_8009CA6C(s32); +void func_8009969C(MkTexture*); void func_80099A94(MkTexture *, s32); void func_80099AEC(); -void func_8009E1E4(); void func_80099E54(); void func_80099E60(MkTexture *, s32, s32); void func_80099EC4(); @@ -141,18 +148,31 @@ Gfx *func_8009C434(Gfx*, struct_8018DEE0_entry*, s32, s32, s32); Gfx *func_8009C708(Gfx*, struct_8018DEE0_entry *, s32, s32, s32, s32); void func_8009C918(); void func_8009CA2C(); +void func_8009CDDC(s32, s32); +void func_8009CDFC(s32, s32); +void func_8009CE1C(); +void func_8009D958(s32, s32); +void func_8009D978(s32, s32); +void func_8009DF4C(s32); +void func_8009DF6C(s32); +void func_8009DFE0(s32); +void func_8009E000(s32); void func_8009E0F0(s32); void func_8009E1C0(); void func_8009E1E4(); void func_8009E208(); +void func_8009E230(); void func_8009E258(); void func_8009E280(); void func_8009E5BC(); +void func_8009E5FC(s32); void func_8009E620(); void add_8018D9E0_entry(s32, s32, s32, s8); void func_800A08D8(u8, s32, s32); void func_800A0AD0(struct_8018D9E0_entry*); +void func_800A0DFC(); void func_800A11D0(struct_8018D9E0_entry*, s32, s32); +void func_800A1500(struct_8018D9E0_entry*); void func_800A15EC(struct_8018D9E0_entry*); void func_800A1924(struct_8018D9E0_entry*); void func_800A1A20(struct_8018D9E0_entry*); @@ -183,8 +203,10 @@ void get_time_record_centiseconds(s32, char*); void func_800A8230(); void func_800A8250(); void func_800A86E8(struct_8018D9E0_entry*); +void func_800A8A98(struct_8018D9E0_entry*); void func_800A8E14(struct_8018D9E0_entry*); void func_800A8EC0(struct_8018D9E0_entry*); +void func_800A90D4(s32, struct_8018D9E0_entry*); void func_800A91D8(struct_8018D9E0_entry*, s32, s32); void func_800A9208(struct_8018D9E0_entry*, s32); void func_800A9278(struct_8018D9E0_entry*, s32); @@ -194,6 +216,10 @@ void func_800A940C(struct_8018D9E0_entry*, s32); void func_800A94C8(struct_8018D9E0_entry*, s32, s32); void func_800A954C(struct_8018D9E0_entry*); void func_800A9710(struct_8018D9E0_entry*); +void func_800A9B9C(struct_8018D9E0_entry*); +void func_800A9C40(struct_8018D9E0_entry*); +void func_800A9D5C(struct_8018D9E0_entry*); +void func_800AA280(struct_8018D9E0_entry*); void func_800AAB90(struct_8018D9E0_entry*); void func_800AADD4(struct_8018D9E0_entry*); void func_800AAE18(struct_8018D9E0_entry*); @@ -206,12 +232,19 @@ void func_800AAF94(struct_8018D9E0_entry*, s32); s32 func_800AAFCC(s32); void func_800AB020(struct_8018D9E0_entry*); void func_800AB098(struct_8018D9E0_entry*); +void func_800AB164(struct_8018D9E0_entry*); void func_800AB260(struct_8018D9E0_entry*); void func_800AB290(struct_8018D9E0_entry*); +void func_800AB904(struct_8018D9E0_entry*); +void func_800ABAE8(struct_8018D9E0_entry*); +void func_800ABB24(struct_8018D9E0_entry*); +void func_800ABBCC(struct_8018D9E0_entry*); +void func_800ABC38(struct_8018D9E0_entry*); void func_800ABCF4(struct_8018D9E0_entry*); void func_800ABEAC(struct_8018D9E0_entry*); void func_800ABF68(struct_8018D9E0_entry*); void func_800AC128(struct_8018D9E0_entry*); +void func_800AC300(struct_8018D9E0_entry*); void func_800AC324(struct_8018D9E0_entry*); void func_800AC978(struct_8018D9E0_entry*); void func_800AD1A4(struct_8018D9E0_entry*); @@ -220,6 +253,8 @@ void func_800AEDBC(struct_8018D9E0_entry*); void func_800AEE90(struct_8018D9E0_entry*); void func_800AEEBC(struct_8018D9E0_entry*); void func_800AEEE8(struct_8018D9E0_entry*); +void func_800AF004(struct_8018D9E0_entry*); +void func_800AF1AC(struct_8018D9E0_entry*); void func_800AF480(struct_8018D9E0_entry*); void func_800AF4DC(struct_8018D9E0_entry*); void func_800AF740(struct_8018D9E0_entry*); @@ -295,6 +330,8 @@ extern s32 gNumD_8018E768Entries; // D_8018E760 extern struct_8018E768_entry D_8018E768[D_8018E768_SIZE]; // D_8018E768 extern s8 gTextColor; // D_8018E860 extern s8 D_8018ED91; +extern s8 D_8018E838[]; +extern s32 D_8018E840[]; extern s32 D_8018E850; extern s32 D_8018E854; extern s32 D_8018E858; diff --git a/src/code_800B45E0.c b/src/code_800B45E0.c index 3e8a7cdde..2cf8387e3 100644 --- a/src/code_800B45E0.c +++ b/src/code_800B45E0.c @@ -721,178 +721,150 @@ s32 check_for_controller_pak(s32 controller) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 check_for_controller_pak(s32); // extern -s32 osPfsInit(? *, OSPfs *, ?); // extern -extern u16 D_800E86F0; -extern u32 D_800E86F4; -extern s8 D_800E86F8; -extern u8 D_800F2E64; -extern u8 D_800F2E74; -extern OSPfs D_8018E868; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; -extern s32 gControllerPakNumPagesFree; -extern s32 D_8018EB84; -extern OSMesgQueue gSIEventMesgQueue; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +s32 check_for_controller_pak(?); /* extern */ s32 func_800B5B94(void) { + s32 temp_v0; s32 temp_v0_2; - s32 temp_v0_3; - s8 temp_v0; - s8 phi_v0; - ? phi_v0_2; + s32 var_v0; + s8 var_v0_2; - temp_v0 = D_800E86F8; - phi_v0 = temp_v0; - if (temp_v0 != 0) { - temp_v0_2 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84); - if (temp_v0_2 != 0) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 5) { - D_800E86F8 = 0; - goto block_8; - } - phi_v0 = D_800E86F8; - } else { - D_800E86F8 = 0; + var_v0_2 = D_800E86F8; + if (var_v0_2 != 0) { + temp_v0 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84); + switch (temp_v0) { /* irregular */ + default: + D_800E86F8 = 0; block_8: - phi_v0 = 0; - } + var_v0_2 = 0; goto block_9; + case 0: + return 0; + case 5: + var_v0_2 = D_800E86F8; + goto block_9; + case 2: + D_800E86F8 = 0; + goto block_8; } - return 0; - } + } else { block_9: - if (phi_v0 == 0) { - if (check_for_controller_pak(0) == 0) { - return 1; - } - temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 1) { - if (temp_v0_3 != 4) { - if (temp_v0_3 != 0xA) { - if (temp_v0_3 == 0xB) { - goto block_17; + if (var_v0_2 == 0) { + if (check_for_controller_pak(0) == 0) { + return 1; + } + temp_v0_2 = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0); + if (temp_v0_2 != 0) { + if (temp_v0_2 != 1) { + if (temp_v0_2 != 4) { + if (temp_v0_2 != 0x0000000A) { + if (temp_v0_2 == 0x0000000B) { + goto block_17; + } + goto block_19; } - goto block_19; + return 2; } +block_19: return 2; } -block_19: +block_17: + return 1; + } + D_800E86F8 = 1; + if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB84) == 0) { + return 0; + } + if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { return 2; } -block_17: - return 1; - } - D_800E86F8 = 1; - if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) == 0) { - return 0; + if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { + return 2; + } + gControllerPakNumPagesFree = (s32) gControllerPakNumPagesFree >> 8; + goto block_27; } - if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { - return 2; +block_27: + if (D_8018EB7C >= D_8018EB78) { + return 4; } - if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { - return 2; + var_v0 = 4; + if (gControllerPakNumPagesFree >= 0x79) { + var_v0 = -1; } - gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; - goto block_27; + return var_v0; } -block_27: - if (D_8018EB7C >= D_8018EB78) { - return 4; - } - phi_v0_2 = 4; - if (gControllerPakNumPagesFree >= 0x79) { - phi_v0_2 = -1; - } - return phi_v0_2; } #else GLOBAL_ASM("asm/non_matchings/menus/func_800B5B94.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 check_for_controller_pak(?); // extern -s32 osPfsInit(? *, OSPfs *, ?); // extern -extern u16 D_800E86F0; -extern u32 D_800E86F4; -extern s8 D_800E86FC; -extern u8 D_800F2E64; -extern u8 D_800F2E74; -extern OSPfs D_8018E8D0; -extern s32 D_8018EB88; -extern OSMesgQueue gSIEventMesgQueue; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +s32 check_for_controller_pak(?); /* extern */ -s8 func_800B5DA4(void) { +s32 func_800B5DA4(void) { + s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; - s32 temp_v0_4; - s8 temp_v0; - s8 phi_v0; - s8 phi_v0_2; + s8 var_v0; - temp_v0 = D_800E86FC; - phi_v0 = temp_v0; - if (temp_v0 != 0) { - temp_v0_2 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB88); - if (temp_v0_2 != 0) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 5) { - goto block_7; - } - return -1; - } -block_7: + var_v0 = D_800E86FC; + if (var_v0 != 0) { + temp_v0 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB88); + switch (temp_v0) { /* switch 1; irregular */ + case 0: /* switch 1 */ + return 0; + case 5: /* switch 1 */ + return -1; + default: /* switch 1 */ + case 2: /* switch 1 */ D_800E86FC = 0; - phi_v0 = 0; + var_v0 = 0; goto block_8; } - return 0; - } + } else { block_8: - phi_v0_2 = phi_v0; - if (phi_v0 == 0) { - if (check_for_controller_pak(1) == 0) { - return 1; - } - temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 1) { - if (temp_v0_3 != 4) { - if (temp_v0_3 != 0xA) { - if (temp_v0_3 == 0xB) { - goto block_16; + if (var_v0 == 0) { + if (check_for_controller_pak(1) == 0) { + return 1; + } + temp_v0_2 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1); + if (temp_v0_2 != 0) { + if (temp_v0_2 != 1) { + if (temp_v0_2 != 4) { + if (temp_v0_2 != 0x0000000A) { + if (temp_v0_2 == 0x0000000B) { + goto block_16; + } + goto block_18; } - goto block_18; + goto block_25; } - goto block_25; - } block_18: - goto block_25; - } -block_16: - return 1; - } - D_800E86FC = 1; - temp_v0_4 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB88); - if (temp_v0_4 != 0) { - if (temp_v0_4 != 2) { - if (temp_v0_4 != 5) { goto block_25; } - return -1; +block_16: + return 1; } + D_800E86FC = 1; + temp_v0_3 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, D_800F2E64, D_800F2E74, &D_8018EB88); + switch (temp_v0_3) { /* irregular */ + case 0: + return 0; + case 5: + return -1; + case 2: block_25: - phi_v0_2 = 2; - // Duplicate return node #26. Try simplifying control flow for better match - return phi_v0_2; + var_v0 = 2; + /* Duplicate return node #26. Try simplifying control flow for better match */ + return (s32) var_v0; + } + } else { + return (s32) var_v0; } - return 0; } - return phi_v0_2; } #else GLOBAL_ASM("asm/non_matchings/menus/func_800B5DA4.s") @@ -977,100 +949,90 @@ GLOBAL_ASM("asm/non_matchings/menus/func_800B60E8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800051C4(); // extern -s32 func_800B6088(s32); // extern -s8 func_800B60E8(s32); // extern -extern u8 *D_800DC714; -extern s32 D_80162DFC; -extern OSPfs D_8018E868; -extern s32 D_8018EB84; -extern struct_8018EE10_entry D_8018EE10; -extern s8 gCupSelection; - +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 s32 func_800B6178(s32 arg0) { - s32 temp_s0_2; s32 temp_v0; - s32 temp_v0_2; - s32 temp_v0_3; - s32 temp_v1; - s8 temp_s0; - s8 temp_s0_3; - void *temp_s1; - void *temp_s3; - s8 phi_s0; - void *phi_s1; - s32 phi_s0_2; - void *phi_s1_2; - s32 phi_v0; - s8 phi_s0_3; - void *phi_s1_3; - s32 phi_v1; + s32 var_s0_2; + s32 var_v0; + s32 var_v1; + s8 temp_t0; + s8 temp_t1; + s8 temp_t3; + s8 temp_t4; + s8 temp_t5; + s8 temp_t9; + s8 var_s0; + s8 var_s0_3; + struct_8018EE10_entry *temp_s3; + struct_8018EE10_entry *var_s1; + struct_8018EE10_entry *var_s1_2; + struct_8018EE10_entry *var_s1_3; + u8 temp_v0_2; if ((arg0 != 0) && (arg0 != 1)) { return -1; } - if (gGamestate == RACING) { + if (gGamestate == 4) { func_800051C4(); } - temp_s3 = (arg0 << 7) + &D_8018EE10; - temp_s3->unk4 = 0; + temp_s3 = &D_8018EE10[arg0]; + temp_s3->ghostDataSaved = 0; temp_v0 = func_800B6088(arg0); - temp_v1 = temp_v0; - phi_v1 = temp_v1; + var_v1 = temp_v0; if (temp_v0 != 0) { - temp_s3->unk4 = 0; - phi_s0 = 0; - phi_s1 = temp_s3; + temp_s3->ghostDataSaved = 0; + var_s0 = 0; + var_s1 = temp_s3; do { - phi_s1->unk7 = phi_s0; - temp_s0 = phi_s0 + 4; - phi_s1->unkA = phi_s0 + 3; - phi_s1->unk9 = phi_s0 + 2; - phi_s1->unk8 = phi_s0 + 1; - phi_s0 = temp_s0; - phi_s1 += 4; - } while (temp_s0 != 0x3C); + temp_t9 = var_s0 + 1; + temp_t0 = var_s0 + 2; + temp_t1 = var_s0 + 3; + var_s1->unk_07[0] = var_s0; + var_s0 += 4; + var_s1->unk_07[3] = temp_t1; + var_s1->unk_07[2] = temp_t0; + var_s1->unk_07[1] = temp_t9; + var_s1 += 4; + } while (var_s0 != 0x3C); } else { - temp_v0_2 = osPfsReadWriteFile(&D_8018E868, D_8018EB84, 1, (arg0 * 0x3C00) + 0x100, 0x3C00, D_800DC714); - phi_v0 = temp_v0_2; - phi_v1 = temp_v0_2; - if (temp_v0_2 == 0) { - temp_s3->unk4 = 1; - if (gGamestate == RACING) { - temp_s3->unk5 = (gCupSelection * 4) + gCupCourseSelection; + var_v0 = osPfsReadWriteFile(&D_8018E868, D_8018EB84, 1U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714); + var_v1 = var_v0; + if (var_v0 == 0) { + temp_s3->ghostDataSaved = 1; + if (gGamestate == 4) { + temp_s3->courseIndex = (gCupSelection * 4) + gCupCourseSelection; } - temp_s3->unk0 = D_80162DFC; - temp_s3->unk6 = D_80162DE0; - phi_s0_2 = 0; - phi_s1_2 = temp_s3; + var_s0_2 = 0; + temp_s3->unk_00 = D_80162DFC; + var_s1_2 = temp_s3; + temp_s3->characterId = (u8) D_80162DE0; do { - temp_s0_2 = phi_s0_2 + 1; - temp_s1 = phi_s1_2 + 1; - temp_s1->unk6 = func_800B60E8(phi_s0_2); - phi_s0_2 = temp_s0_2; - phi_s1_2 = temp_s1; - } while (temp_s0_2 != 0x3C); - temp_v0_3 = func_800B6088(arg0); - phi_v0 = temp_v0_3; - phi_v1 = temp_v0_3; + temp_v0_2 = func_800B60E8(var_s0_2); + var_s0_2 += 1; + var_s1_2 += 1; + var_s1_2->characterId = temp_v0_2; + } while (var_s0_2 != 0x0000003C); + var_v0 = func_800B6088(arg0); + var_v1 = var_v0; } - if (phi_v0 != 0) { - temp_s3->unk4 = 0; - phi_s0_3 = 0; - phi_s1_3 = temp_s3; + if (var_v0 != 0) { + temp_s3->ghostDataSaved = 0; + var_s0_3 = 0; + var_s1_3 = temp_s3; do { - phi_s1_3->unk7 = phi_s0_3; - temp_s0_3 = phi_s0_3 + 4; - phi_s1_3->unkA = phi_s0_3 + 3; - phi_s1_3->unk9 = phi_s0_3 + 2; - phi_s1_3->unk8 = phi_s0_3 + 1; - phi_s0_3 = temp_s0_3; - phi_s1_3 += 4; - } while (temp_s0_3 != 0x3C); + temp_t3 = var_s0_3 + 1; + temp_t4 = var_s0_3 + 2; + temp_t5 = var_s0_3 + 3; + var_s1_3->unk_07[0] = var_s0_3; + var_s0_3 += 4; + var_s1_3->unk_07[3] = temp_t5; + var_s1_3->unk_07[2] = temp_t4; + var_s1_3->unk_07[1] = temp_t3; + var_s1_3 += 4; + } while (var_s0_3 != 0x3C); } } - return phi_v1; + return var_v1; } #else GLOBAL_ASM("asm/non_matchings/menus/func_800B6178.s") @@ -1169,44 +1131,36 @@ s32 func_800B64EC(s32 arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800B60E8(s32); // extern -extern u8 *D_800DC714; -extern s32 D_80162DFC; -extern s32 D_8018D9C0; -extern OSPfs D_8018E8D0; -extern s32 D_8018EB88; -extern ? D_8018EE15; - +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 s32 func_800B65F4(s32 arg0, s32 arg1) { s32 sp34; - s32 temp_s0; s32 temp_v0; - void *temp_s3; - s32 phi_s0; - void *phi_s1; + s32 var_s0; + struct_8018EE10_entry *temp_s3; + struct_8018EE10_entry *var_s1; + u8 temp_v0_2; if ((arg0 != 0) && (arg0 != 1)) { return -1; } - temp_v0 = osPfsReadWriteFile(&D_8018E8D0, D_8018EB88, 0, (arg0 * 0x3C00) + 0x100, 0x3C00, D_800DC714); + temp_v0 = osPfsReadWriteFile(&D_8018E8D0, D_8018EB88, 0U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714); sp34 = temp_v0; if (temp_v0 == 0) { - temp_s3 = D_8018D9C0 + (arg0 << 7); - phi_s0 = 0; - phi_s1 = temp_s3; + temp_s3 = &D_8018D9C0[arg0]; + var_s1 = temp_s3; + var_s0 = 0; loop_5: - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - if (phi_s1->unk7 != func_800B60E8(phi_s0)) { - temp_s3->unk4 = 0; + temp_v0_2 = func_800B60E8(var_s0); + var_s0 += 1; + if ((u8) var_s1->unk_07[0] != temp_v0_2) { + temp_s3->ghostDataSaved = 0; return -2; } - phi_s1 += 1; - if (temp_s0 == 0x3C) { - D_80162DE0 = temp_s3->unk6; - D_80162DFC = temp_s3->unk0; - *(&D_8018EE15 + (arg1 << 7)) = temp_s3->unk5; + var_s1 += 1; + if (var_s0 == 0x0000003C) { + D_80162DE0 = (s32) temp_s3->characterId; + D_80162DFC = temp_s3->unk_00; + *(&D_8018EE10->courseIndex + (arg1 << 7)) = temp_s3->courseIndex; goto block_9; } goto loop_5; diff --git a/src/code_80280650.c b/src/code_80280650.c index 44f59dc70..083cf5a89 100644 --- a/src/code_80280650.c +++ b/src/code_80280650.c @@ -211,67 +211,58 @@ GLOBAL_ASM("asm/non_matchings/code_80280650/func_80280B50.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80280B50(f32 *, f32, s32, s16); // extern -extern s32 D_80284E50; +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-10-2022 +static s32 D_80284E50[4] = { 0x007F2040, 0x0040207F, 0x00207F20, 0x007F7F20 }; void func_80280D1C(void *arg0) { f32 sp60; f32 sp5C; f32 sp58; - f32 *temp_s4; f32 temp_f0; - s32 temp_s0; s32 temp_v0; - s32 temp_v1; - s32 temp_v1_2; - s32 phi_s1; - s32 phi_s0; - s32 phi_v1; + s32 var_s0; + s32 var_s1; + s32 var_v1; - phi_s1 = 0; - phi_s0 = 0; + var_s0 = 0; + var_s1 = 0; if (arg0->unk44 < 0x1E) { - temp_s4 = &sp58; do { sp58 = arg0->unk10; - sp5C = arg0->unk14 - phi_s1; + sp5C = arg0->unk14 - (f32) var_s1; sp60 = arg0->unk18; - func_80280B50(temp_s4, ((0xA - phi_s0) / 10.0f) * 2.0f, *(&D_80284E50 + (arg0->unk48 * 4)), ((0x1E - arg0->unk44) * 0x64) / 30.0f); - temp_s0 = phi_s0 + 1; - phi_s1 += 2; - phi_s0 = temp_s0; - } while (temp_s0 != 0xA); + func_80280B50(&sp58, ((f32) (0xA - var_s0) / 10.0f) * 2.0f, D_80284E50[arg0->unk48], (s16) (s32) ((f32) ((0x1E - arg0->unk44) * 0x64) / 30.0f)); + var_s0 += 1; + var_s1 += 2; + } while (var_s0 != 0xA); } else { temp_v0 = arg0->unk2C; if (temp_v0 < 5) { - temp_v1 = arg0->unk3C + (arg0->unk40 * 2); - arg0->unk3C = temp_v1; - arg0->unk34 = arg0->unk34 + (arg0->unk38 * 2.0f); - phi_v1 = temp_v1; + var_v1 = arg0->unk3C + (arg0->unk40 * 2); + arg0->unk3C = var_v1; + arg0->unk34 = (f32) (arg0->unk34 + (arg0->unk38 * 2.0f)); } else { - temp_f0 = 1.0f + (((temp_v0 * 7) - 0x23) / 10.0f); - temp_v1_2 = arg0->unk3C + (arg0->unk40 / temp_f0); - arg0->unk3C = temp_v1_2; - arg0->unk34 = arg0->unk34 + (arg0->unk38 / temp_f0); - phi_v1 = temp_v1_2; - if (temp_v1_2 < 0) { + temp_f0 = 1.0f + ((f32) ((temp_v0 * 7) - 0x23) / 10.0f); + var_v1 = (s32) ((f32) arg0->unk3C + ((f32) arg0->unk40 / temp_f0)); + arg0->unk3C = var_v1; + arg0->unk34 = (f32) (arg0->unk34 + (arg0->unk38 / temp_f0)); + if (var_v1 < 0) { arg0->unk3C = 0; - phi_v1 = 0; + var_v1 = 0; } } - arg0->unk2C = arg0->unk2C + 1; - if ((phi_v1 <= 0) || !(arg0->unk34 > 0.0f)) { + arg0->unk2C = (s32) (arg0->unk2C + 1); + if ((var_v1 <= 0) || !(arg0->unk34 > 0.0f)) { if (arg0->unk2C < 0x1E) { goto block_12; } arg0->unk0 = 0; } else { block_12: - func_80280B50(arg0 + 0x10, arg0->unk34, arg0->unk30, phi_v1); + func_80280B50(arg0 + 0x10, arg0->unk34, arg0->unk30, (s16) var_v1); } } - arg0->unk44 = arg0->unk44 + 1; + arg0->unk44 = (s32) (arg0->unk44 + 1); } #else GLOBAL_ASM("asm/non_matchings/code_80280650/func_80280D1C.s") diff --git a/src/memory.c b/src/memory.c index f735db9c2..397a3fc37 100644 --- a/src/memory.c +++ b/src/memory.c @@ -1307,28 +1307,23 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AA7C8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void dma_copy(u8 *, s32, s32, s32); // extern -extern u8 *gPrevLoadedAddress; - -s32 func_802AA88C(s32 arg0, s32 arg1) { +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-09-2022 +void *func_802AA88C(u8 *arg0, u8 *arg1) { s32 sp28; u8 *sp20; - u8 *sp1C; - s32 temp_t6; + u32 sp1C; + u32 temp_t6; u8 *temp_a0; - u8 *temp_a1; temp_t6 = ((arg1 - arg0) + 0xF) & ~0xF; temp_a0 = gHeapEndPtr - temp_t6; sp20 = temp_a0; - dma_copy(temp_a0, arg0, temp_t6, arg1); - temp_a1 = gPrevLoadedAddress; - sp1C = temp_a1; + dma_copy(temp_a0, arg0, temp_t6); + sp1C = gPrevLoadedAddress; sp28 = (temp_a0->unk4 + 0xF) & ~0xF; - mio0decode(temp_a0, temp_a1); - gPrevLoadedAddress = &gPrevLoadedAddress[sp28]; - return sp1C; + mio0decode(temp_a0, (u8 *) gPrevLoadedAddress); + gPrevLoadedAddress += sp28; + return (void *) sp1C; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AA88C.s") @@ -3153,15 +3148,10 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802ADDC8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-09-2022 s32 func_802ABB04(f32, f32, s32); /* extern */ -f32 func_802ABE30(f32, f32, f32, s32); /* extern */ -extern u8 D_8014F110; +extern ? D_8014F110; extern s32 D_8015F584; -extern s16 D_8015F6E8; -extern s16 D_8015F6EA; -extern s16 D_8015F6F0; -extern s16 D_8015F6F2; static f32 D_802B9E4C = -3000.0f; static f32 D_802B9E50 = 3000.0f; static f32 D_802B9E54 = 3000.0f; @@ -3171,39 +3161,31 @@ static f32 D_802B9E60 = 3000.0f; f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) { f32 temp_f0; - f32 temp_f20; - s16 temp_v0; - s16 temp_v1; + f32 var_f20; + s32 temp_at; s32 temp_f4; s32 temp_f6; s32 temp_t0; s32 temp_t9; + s32 var_s2; u16 temp_s0; u16 temp_t1; + u16 var_s1; void *temp_t2; - u16 phi_s1; - f32 phi_f20; - s32 phi_s2; - f32 phi_f20_2; - f32 phi_f20_3; - - temp_v0 = D_8015F6EA; - temp_f20 = D_802B9E4C; - temp_v1 = D_8015F6F2; - temp_f4 = (s32) ((arg0 - (f32) temp_v0) / (f32) ((s32) (D_8015F6E8 - temp_v0) / 32)); - temp_f6 = (s32) ((arg2 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32)); + + var_f20 = D_802B9E4C; + temp_f4 = (s32) ((arg0 - (f32) D_8015F6EA) / (f32) ((s32) (D_8015F6E8 - D_8015F6EA) / 32)); + temp_f6 = (s32) ((arg2 - (f32) D_8015F6F2) / (f32) ((s32) (D_8015F6F0 - D_8015F6F2) / 32)); temp_t0 = (s16) temp_f6 << 5; temp_t2 = ((s16) ((s16) temp_f4 + temp_t0) * 4) + &D_8014F110; temp_t1 = temp_t2->unk2; - phi_f20 = temp_f20; - phi_f20_2 = temp_f20; - if ((s32) (s16) temp_f4 < 0) { + if ((s16) temp_f4 < 0) { return D_802B9E50; } if ((s16) temp_f6 & 0x04000000) { return D_802B9E54; } - if ((s32) (s16) temp_f4 >= 0x20) { + if ((s16) temp_f4 >= 0x20) { return D_802B9E58; } if (temp_t0 >= 0x400) { @@ -3212,26 +3194,24 @@ f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) { if (temp_t1 == 0) { return D_802B9E60; } - phi_s1 = temp_t2->unk0; - phi_s2 = 0; + var_s1 = temp_t2->unk0; + var_s2 = 0; if ((s32) temp_t1 > 0) { do { - temp_s0 = *(D_8015F584 + (phi_s1 * 2)); - phi_f20_3 = phi_f20; - if ((((*D_8015F580)[temp_s0].flags & 0x4000) != 0) && (func_802ABB04(arg0, arg2, temp_s0 & 0xFFFF) == 1)) { + temp_s0 = *(D_8015F584 + (var_s1 * 2)); + if ((D_8015F580[temp_s0].flags & 0x4000) && (func_802ABB04(arg0, arg2, temp_s0 & 0xFFFF) == 1)) { temp_f0 = func_802ABE30(arg0, arg1, arg2, temp_s0 & 0xFFFF); - if ((temp_f0 <= arg1) && (phi_f20 < temp_f0)) { - phi_f20_3 = temp_f0; + if ((temp_f0 <= arg1) && (var_f20 < temp_f0)) { + var_f20 = temp_f0; } } - temp_t9 = (phi_s2 + 1) & 0xFFFF; - phi_s1 = (phi_s1 + 1) & 0xFFFF; - phi_f20 = phi_f20_3; - phi_s2 = temp_t9; - phi_f20_2 = phi_f20_3; - } while (temp_t9 < (s32) temp_t1); - } - return phi_f20_2; + temp_t9 = (var_s2 + 1) & 0xFFFF; + temp_at = temp_t9 < (s32) temp_t1; + var_s2 = temp_t9; + var_s1 = (var_s1 + 1) & 0xFFFF; + } while (temp_at != 0); + } + return var_f20; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AE1C0.s") diff --git a/src/menus.c b/src/menus.c index b1c4fa946..e11cd468c 100644 --- a/src/menus.c +++ b/src/menus.c @@ -19,7 +19,6 @@ /** Externs to be put into headers **/ extern s16 D_8015F892; // bss unknown extern u32 D_800DC5AC; // data? from this file or another (main.c?)? -extern void func_800C3448(s32); extern void rmonPrintf(const char *, ...); // not in a libultra header? /** BSS **/ @@ -91,25 +90,27 @@ u32 sVIGammaOffDitherOn = OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON; /*** Const/rodata Data ***/ // used to set gScreenModeSelection; might be smaller; could be function static data -const s8 D_800F2B50[] = {0, 1, 2, 3, 3, 0, 0, 0}; +const s8 D_800F2B50[] = {0, 1, 2, 3, 3}; // set to D_8018EDF3, then that sets gPlayerCountSelection1 -const s8 D_800F2B58[] = {1, 2, 2, 3, 4, 0, 0, 0}; +const s8 D_800F2B58[] = {1, 2, 2, 3, 4}; // Limit for each column in one-two-three-four players selection -const s8 D_800F2B60[4] = {1, 2, 1, 1}; - -// Limit in each column -const s8 D_800F2B64[4][3] = { - {2, 1, 0}, - {2, 2, 0}, - {2, 0, 0}, - {2, 0, 0} +const s8 D_800F2B60[5][3] = { + {1, 2, 1}, + {1, 2, 1}, + {0, 2, 2}, + {0, 2, 0}, + {0, 2, 0}, + // {0, 3, 1}, + // {0, 3, 3}, + // {0, 3, 0}, + // {0, 3, 0}, }; // is this another union GameModePack? Figure out when decomping. const s32 gGameModeFromNumPlayersAndRowSelection[5][3] = { - { 0x03010003, 0x03000300, 0x00030000 }, + { 0x03010003, 0x03000300, 0x00030000 }, // Despite this matching, there is no way this line belongs in this array { GRAND_PRIX, TIME_TRIALS, 0x00000000 }, //first column { GRAND_PRIX, VERSUS, BATTLE }, //second { VERSUS, BATTLE, 0x00000000 }, //third @@ -151,17 +152,6 @@ union GameModePack { }; const union GameModePack D_800F2BE4 = { {0, 1, 2, 3} }; -/** forward decs **/ -void options_menu_act(struct Controller *, u16); -void data_menu_act(struct Controller *, u16); -void course_data_menu_act(struct Controller *, u16); -void logo_intro_menu_act(struct Controller *, u16); -void controller_pak_menu_act(struct Controller *, u16); -void splash_menu_act(struct Controller *, u16); -void main_menu_act(struct Controller *, u16); -void player_select_menu_act(struct Controller *, u16); -void course_select_menu_act(struct Controller *, u16); -void func_800B44AC(void); /**************************/ /** @@ -234,14 +224,6 @@ void update_menus(void) { } } - -// D_8018EDEC is position on options screen? -#ifndef NON_MATCHING -// issue is regalloc starting at the 0x32 0x33 case -enum MenuOptionsCursorPositions { - MENU_OPTIONS_CSRPOS_SOUNDMODE = 0x16 -}; - // navigation of the options menu void options_menu_act(struct Controller *controller, u16 arg1) { u16 btnAndStick; // sp3E @@ -276,7 +258,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { sp38->unk8 = 1; sp2C = TRUE; } - // L800B066C if ((btnAndStick & CONT_UP) && (D_8018EDEC >= 0x16)) { D_8018EDEC -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); @@ -286,14 +267,12 @@ void options_menu_act(struct Controller *controller, u16 arg1) { sp2C = TRUE; sp38->unk8 = -1; } - // L800B06FC if (sp2C && gSoundMode != sp38->unk4) { gSaveDataSoundMode = gSoundMode; write_save_data_grand_prix_points_and_sound_mode(); update_save_data_backup(); sp38->unk4 = gSoundMode; } - // L800B0758 if (btnAndStick & CONT_B) { func_8009E280(); play_sound2(SOUND_MENU_GO_BACK); @@ -305,7 +284,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } return; } - // L800B07C8 if (btnAndStick & CONT_A) { switch (D_8018EDEC) { case 0x16: @@ -357,20 +335,16 @@ void options_menu_act(struct Controller *controller, u16 arg1) { play_sound2(SOUND_MENU_FILE_NOT_FOUND); break; } - // L800B09DC - // definitely reading u8 at 0x84 from struct_8018EE10_entry, - // but that is too big for the size of the struct... unsized array off the end? - if (sp2C == -1 && !sp30->ghostDataSaved && !((u8 *)sp30)[0x84]) { + if (sp2C == -1 && !sp30[0].ghostDataSaved && !sp30[1].ghostDataSaved) { D_8018EDEC = 0x2A; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - // L800B0A20 if (sp2C == 0) { - if (sp30->ghostDataSaved) { + if (sp30[0].ghostDataSaved) { D_8018EDEC = 0x28; play_sound2(SOUND_MENU_SELECT); - } else if (((u8 *)sp30)[0x84]) { + } else if (sp30[1].ghostDataSaved) { D_8018EDEC = 0x29; play_sound2(SOUND_MENU_SELECT); } else { @@ -418,7 +392,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = 1; } - // L800B0B74 if ((btnAndStick & CONT_UP) && (D_8018EDEC >= 0x1F)) { D_8018EDEC -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); @@ -427,13 +400,11 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = -1; } - // L800B0BF8 if (btnAndStick & CONT_B) { D_8018EDEC = 0x18; play_sound2(SOUND_MENU_GO_BACK); return; } - // L800B0C20 if (btnAndStick & CONT_A) { switch (D_8018EDEC) { case 0x1E: @@ -469,8 +440,7 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = 1; } - // L800B0D38 - if ((btnAndStick & CONT_UP) && (D_8018EDEC >= 0x29) && sp30->ghostDataSaved) { + if ((btnAndStick & CONT_UP) && (D_8018EDEC >= 0x29) && sp30[0].ghostDataSaved) { D_8018EDEC -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { @@ -478,13 +448,11 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = -1; } - // L800B0DD0 if (btnAndStick & CONT_B) { D_8018EDEC = 0x17; play_sound2(SOUND_MENU_GO_BACK); return; } - // L800B0DF4 if (btnAndStick & CONT_A) { sp38->unk20 = D_8018EDEC - 0x28; if (sp30[sp38->unk20].courseIndex == D_8018EE10[1].courseIndex && D_8018EE10[1].ghostDataSaved) { @@ -518,12 +486,10 @@ void options_menu_act(struct Controller *controller, u16 arg1) { sp38->unk8 = -1; } } - // L800B0FA4 if (btnAndStick & CONT_B) { D_8018EDEC = sp38->unk20 + 0x28; play_sound2(SOUND_MENU_GO_BACK); } else if (btnAndStick & CONT_A) { - // L800B0FCC sp38->unk1C = D_8018EDEC - 0x32; if (D_8018EE10[(sp38->unk1C)].ghostDataSaved) { D_8018EDEC = 0x38; @@ -563,7 +529,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = 1; } - // L800B10C4 if ((btnAndStick & CONT_LEFT) && D_8018EDEC >= 0x39) { D_8018EDEC -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); @@ -572,7 +537,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { } sp38->unk8 = -1; } - // L800B114C if (btnAndStick & CONT_B) { D_8018EDEC = sp38->unk1C + 0x32; play_sound2(SOUND_MENU_GO_BACK); @@ -607,13 +571,11 @@ void options_menu_act(struct Controller *controller, u16 arg1) { if (res == 0) { res = func_800B65F4(sp38->unk20, sp38->unk1C); } - // L800B1230 if (res != 0) { D_8018EDEC = 0x42; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - // L800B1254 res = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, (u8 *)D_800F2E64, (u8 *)D_800F2E74, &D_8018EB84); if (res == 0) { res = func_800B6178(sp38->unk1C); @@ -623,7 +585,6 @@ void options_menu_act(struct Controller *controller, u16 arg1) { play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - // L800B12DC D_8018EDEC = 0x3C; D_8018EE10[sp38->unk1C].courseIndex = (sp30 + sp38->unk20)->courseIndex; func_800B6088(sp38->unk1C); @@ -644,7 +605,7 @@ void options_menu_act(struct Controller *controller, u16 arg1) { if (func_800B6A68()) { D_8018EDEC = 0x36; play_sound2(SOUND_MENU_FILE_NOT_FOUND); - } else if (sp30->ghostDataSaved) { + } else if (sp30[0].ghostDataSaved) { D_8018EDEC = 0x28; } else { D_8018EDEC = 0x29; @@ -654,11 +615,7 @@ void options_menu_act(struct Controller *controller, u16 arg1) { default: break; } } - // L800B13A0 return -} -#else -GLOBAL_ASM("asm/non_matchings/menus/options_menu_act.s") -#endif +} // Handle navigating the data menu interface void data_menu_act(struct Controller *controller, UNUSED u16 arg1) { @@ -1435,12 +1392,12 @@ void main_menu_act(struct Controller *controller, u16 arg1) { if (btnAndStick & CONT_DOWN) { sp24 = FALSE; if (func_800B555C()) { - if (sp28 < D_800F2B64[D_8018EDF3][D_800E86AC[D_8018EDF3 - 1] + 1]) { + if (sp28 < D_800F2B60[D_8018EDF3 + 4][D_800E86AC[D_8018EDF3 - 1] + 1]) { sp24 = TRUE; } } else { // L800B30D4 - if (sp28 < D_800F2B60[D_8018EDF3]) { + if (sp28 < D_800F2B60[D_8018EDF3][D_800E86AC[D_8018EDF3 - 1] + 1]) { sp24 = TRUE; } } diff --git a/src/menus.h b/src/menus.h index 8ea82436c..79293f7fc 100644 --- a/src/menus.h +++ b/src/menus.h @@ -6,11 +6,29 @@ #include <types.h> #include <defines.h> +// D_8018EDEC is position on options screen? +enum MenuOptionsCursorPositions { + MENU_OPTIONS_CSRPOS_SOUNDMODE = 0x16 +}; + /* functions */ void update_menus(void); -void func_800B3F74(s32 menuSelection); +void options_menu_act(struct Controller *, u16); +void data_menu_act(struct Controller *, u16); +void course_data_menu_act(struct Controller *, u16); +void logo_intro_menu_act(struct Controller *, u16); +void controller_pak_menu_act(struct Controller *, u16); +void splash_menu_act(struct Controller *, u16); +void func_800B28C8(void); +void main_menu_act(struct Controller *, u16); +s32 is_character_spot_free(s32); +void player_select_menu_act(struct Controller *, u16); +void course_select_menu_act(struct Controller *, u16); +void func_800B3F74(s32); +void func_800B44AC(void); void func_800B44BC(void); s32 func_800B4520(void); +void func_800B4560(s32, s32); /* data */ extern s32 gMenuSelection; @@ -23,7 +41,7 @@ extern s8 gControllerPakSelectedTableRow; extern s8 D_800E86C4[12]; extern s8 D_800E86D0[16]; -extern const s8 D_800F2B60[4]; +extern const s8 D_800F2B60[5][3]; extern const s32 gGameModeFromNumPlayersAndRowSelection[5][3]; extern const s16 gCupCourseOrder[5][4]; |
