diff --git a/asm/non_matchings/code_80091750/func_80093C1C.s b/asm/non_matchings/code_80091750/func_80093C1C.s deleted file mode 100644 index 2cb3e71e1..000000000 --- a/asm/non_matchings/code_80091750/func_80093C1C.s +++ /dev/null @@ -1,34 +0,0 @@ -glabel func_80093C1C -/* 09481C 80093C1C 3C058015 */ lui $a1, %hi(gDisplayListHead) # $a1, 0x8015 -/* 094820 80093C20 24A50298 */ addiu $a1, %lo(gDisplayListHead) # addiu $a1, $a1, 0x298 -/* 094824 80093C24 8CA30000 */ lw $v1, ($a1) -/* 094828 80093C28 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 09482C 80093C2C AFBF0014 */ sw $ra, 0x14($sp) -/* 094830 80093C30 3C180200 */ lui $t8, %hi(D_02007F18) # $t8, 0x200 -/* 094834 80093C34 246E0008 */ addiu $t6, $v1, 8 -/* 094838 80093C38 ACAE0000 */ sw $t6, ($a1) -/* 09483C 80093C3C 27187F18 */ addiu $t8, %lo(D_02007F18) # addiu $t8, $t8, 0x7f18 -/* 094840 80093C40 3C0F0600 */ lui $t7, 0x600 -/* 094844 80093C44 AC6F0000 */ sw $t7, ($v1) -/* 094848 80093C48 0C02729B */ jal func_8009CA6C -/* 09484C 80093C4C AC780004 */ sw $t8, 4($v1) -/* 094850 80093C50 3C058015 */ lui $a1, %hi(gDisplayListHead) # $a1, 0x8015 -/* 094854 80093C54 24A50298 */ addiu $a1, %lo(gDisplayListHead) # addiu $a1, $a1, 0x298 -/* 094858 80093C58 8CA30000 */ lw $v1, ($a1) -/* 09485C 80093C5C 3C090200 */ lui $t1, %hi(D_02007F48) # $t1, 0x200 -/* 094860 80093C60 25297F48 */ addiu $t1, %lo(D_02007F48) # addiu $t1, $t1, 0x7f48 -/* 094864 80093C64 24790008 */ addiu $t9, $v1, 8 -/* 094868 80093C68 ACB90000 */ sw $t9, ($a1) -/* 09486C 80093C6C 3C080600 */ lui $t0, 0x600 -/* 094870 80093C70 AC680000 */ sw $t0, ($v1) -/* 094874 80093C74 AC690004 */ sw $t1, 4($v1) -/* 094878 80093C78 8FBF0014 */ lw $ra, 0x14($sp) -/* 09487C 80093C7C 27BD0018 */ addiu $sp, $sp, 0x18 -/* 094880 80093C80 03E00008 */ jr $ra -/* 094884 80093C84 00000000 */ nop - -/* 094888 80093C88 03E00008 */ jr $ra -/* 09488C 80093C8C 00000000 */ nop - -/* 094890 80093C90 03E00008 */ jr $ra -/* 094894 80093C94 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800AEE90.s b/asm/non_matchings/code_80091750/func_800AEE90.s deleted file mode 100644 index 3d78af3af..000000000 --- a/asm/non_matchings/code_80091750/func_800AEE90.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel func_800AEE90 -/* 0AFA90 800AEE90 3C0E8019 */ lui $t6, %hi(D_8018EDEC) # $t6, 0x8019 -/* 0AFA94 800AEE94 81CEEDEC */ lb $t6, %lo(D_8018EDEC)($t6) -/* 0AFA98 800AEE98 2401000B */ li $at, 11 -/* 0AFA9C 800AEE9C 240F0001 */ li $t7, 1 -/* 0AFAA0 800AEEA0 51C10004 */ beql $t6, $at, .L800AEEB4 -/* 0AFAA4 800AEEA4 A08F0015 */ sb $t7, 0x15($a0) -/* 0AFAA8 800AEEA8 03E00008 */ jr $ra -/* 0AFAAC 800AEEAC A0800015 */ sb $zero, 0x15($a0) - -/* 0AFAB0 800AEEB0 A08F0015 */ sb $t7, 0x15($a0) -.L800AEEB4: -/* 0AFAB4 800AEEB4 03E00008 */ jr $ra -/* 0AFAB8 800AEEB8 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800AEEBC.s b/asm/non_matchings/code_80091750/func_800AEEBC.s deleted file mode 100644 index 4d4caf9f5..000000000 --- a/asm/non_matchings/code_80091750/func_800AEEBC.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel func_800AEEBC -/* 0AFABC 800AEEBC 3C0E8019 */ lui $t6, %hi(D_8018EDEC) # $t6, 0x8019 -/* 0AFAC0 800AEEC0 81CEEDEC */ lb $t6, %lo(D_8018EDEC)($t6) -/* 0AFAC4 800AEEC4 2401000C */ li $at, 12 -/* 0AFAC8 800AEEC8 240F0001 */ li $t7, 1 -/* 0AFACC 800AEECC 51C10004 */ beql $t6, $at, .L800AEEE0 -/* 0AFAD0 800AEED0 A08F0015 */ sb $t7, 0x15($a0) -/* 0AFAD4 800AEED4 03E00008 */ jr $ra -/* 0AFAD8 800AEED8 A0800015 */ sb $zero, 0x15($a0) - -/* 0AFADC 800AEEDC A08F0015 */ sb $t7, 0x15($a0) -.L800AEEE0: -/* 0AFAE0 800AEEE0 03E00008 */ jr $ra -/* 0AFAE4 800AEEE4 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800AEEE8.s b/asm/non_matchings/code_80091750/func_800AEEE8.s deleted file mode 100644 index dbb17eee0..000000000 --- a/asm/non_matchings/code_80091750/func_800AEEE8.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel func_800AEEE8 -/* 0AFAE8 800AEEE8 3C0E8019 */ lui $t6, %hi(D_8018EDEC) # $t6, 0x8019 -/* 0AFAEC 800AEEEC 81CEEDEC */ lb $t6, %lo(D_8018EDEC)($t6) -/* 0AFAF0 800AEEF0 2401000D */ li $at, 13 -/* 0AFAF4 800AEEF4 240F0001 */ li $t7, 1 -/* 0AFAF8 800AEEF8 51C10004 */ beql $t6, $at, .L800AEF0C -/* 0AFAFC 800AEEFC A08F0015 */ sb $t7, 0x15($a0) -/* 0AFB00 800AEF00 03E00008 */ jr $ra -/* 0AFB04 800AEF04 A0800015 */ sb $zero, 0x15($a0) - -/* 0AFB08 800AEF08 A08F0015 */ sb $t7, 0x15($a0) -.L800AEF0C: -/* 0AFB0C 800AEF0C 03E00008 */ jr $ra -/* 0AFB10 800AEF10 00000000 */ nop diff --git a/src/code_80091750.c b/src/code_80091750.c index dd5ed28ea..f79507518 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -4,6 +4,7 @@ #include "code_80091750.h" #include "code_800AF9B0.h" #include "credits_01.h" +#include "data_segment2.h" #include "variables.h" // TODO: Move gGfxPool out of main.h // Unfortunately that's not a small effort due to weird import structure in this project @@ -539,14 +540,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092258.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe -extern ? D_02007BB8; -extern ? D_02007CD8; -extern ? D_02007DF8; -static u32 D_800E84C0[3] = { (u32) &D_02007BB8, (u32) &D_02007CD8, (u32) &D_02007DF8 }; /* const */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static mk_Vtx_Flag *D_800E84C0[3] = { D_02007BB8, D_02007CD8, D_02007DF8 }; /* const */ static ? D_800E84CC; /* unable to generate initializer; const */ -void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) { +void func_80092290(s32 arg0, s32 *arg1, s32 *arg2, s32 arg3) { + mk_Vtx_Flag **temp_s0; + mk_Vtx_Flag *temp_v0; s32 temp_a0; s32 temp_a1; s32 temp_s4; @@ -556,12 +556,10 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) { s32 temp_t8; s32 temp_t8_2; s32 temp_t9; - u32 *temp_s0; void *temp_a2; - void *temp_v0; void *temp_v1; void *temp_v1_2; - u32 *phi_s0; + mk_Vtx_Flag **phi_s0; if ((arg0 >= 4) && (arg0 < 6)) { temp_t8 = *arg2 + 0x10; @@ -902,26 +900,47 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092E1C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -s32 func_80092EE4(void *arg0) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +s32 func_80092EE4(s8 *character) { s32 temp_t6; s8 temp_a1; s32 phi_v1; - temp_a1 = arg0->unk0; - temp_t6 = (arg0->unk1 + 0x80) & 0xFF; + temp_a1 = character->unk0; + temp_t6 = (character->unk1 + 0x80) & 0xFF; phi_v1 = 2; - if (temp_a1 != -0x5F) { - if (temp_a1 != -0x5D) { - if (temp_a1 != -0x55) { - return 2; - } - if (temp_t6 == 0x2E) { - phi_v1 = 0xE0; - } - /* Duplicate return node #31. Try simplifying control flow for better match */ + switch (temp_a1) { /* switch 3; irregular */ + default: /* switch 3 */ + return 2; + case -95: /* switch 3 */ + switch (temp_t6) { /* switch 1 */ + case 0x22: /* switch 1 */ + case 0x24: /* switch 1 */ + return 0xEA; + case 0x23: /* switch 1 */ + return 0xE9; + case 0x25: /* switch 1 */ + return 0xD0; + case 0x2A: /* switch 1 */ + return 0xE8; + case 0x30: /* switch 1 */ + return 0xEB; + case 0x47: /* switch 1 */ + return 0xD1; + case 0x49: /* switch 1 */ + return 0xD2; + case 0x5C: /* switch 1 */ + return 0xD3; + case 0x3C: /* switch 1 */ + case 0x3D: /* switch 1 */ + case 0x5D: /* switch 1 */ + return 0xD4; + default: /* switch 1 */ + default: /* switch 2 */ return phi_v1; } + break; + case -93: /* switch 3 */ if ((temp_t6 >= 0x30) && (temp_t6 < 0x3A)) { return temp_t6 + 0xA5; } @@ -951,33 +970,13 @@ s32 func_80092EE4(void *arg0) { case 0x76: /* switch 2 */ return 0xE7; } - } else { - switch (temp_t6) { /* switch 1 */ - case 0x22: /* switch 1 */ - case 0x24: /* switch 1 */ - return 0xEA; - case 0x23: /* switch 1 */ - return 0xE9; - case 0x25: /* switch 1 */ - return 0xD0; - case 0x2A: /* switch 1 */ - return 0xE8; - case 0x30: /* switch 1 */ - return 0xEB; - case 0x47: /* switch 1 */ - return 0xD1; - case 0x49: /* switch 1 */ - return 0xD2; - case 0x5C: /* switch 1 */ - return 0xD3; - case 0x3C: /* switch 1 */ - case 0x3D: /* switch 1 */ - case 0x5D: /* switch 1 */ - return 0xD4; - default: /* switch 1 */ - default: /* switch 2 */ - return phi_v1; + break; + case -85: /* switch 3 */ + if (temp_t6 == 0x2E) { + phi_v1 = 0xE0; } + /* Duplicate return node #31. Try simplifying control flow for better match */ + return phi_v1; } } #else @@ -1255,22 +1254,19 @@ void func_80093A5C(u32 arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_80093A5C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//? func_8009CA6C(void **); // extern -extern u8 D_02007F18; -extern u8 D_02007F48; -extern Gfx *gDisplayListHead; - -void func_80093C1C(void) { - gSPDisplayList(gDisplayListHead++, &D_02007F18); - func_8009CA6C(&gDisplayListHead); - gSPDisplayList(gDisplayListHead++, &D_02007F48); +void func_80093C1C(s32 arg0) { + gSPDisplayList(gDisplayListHead++, D_02007F18); + func_8009CA6C(arg0); + gSPDisplayList(gDisplayListHead++, D_02007F48); } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_80093C1C.s") -#endif +UNUSED void func_80093C88(void) { + return; +} + +UNUSED void func_80093C90(void) { + return; +} void func_80093C98(s32 arg0) { gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880)); @@ -1380,11 +1376,12 @@ void func_800940EC(s32 arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe -extern ? D_06009410; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? guRotate(Mtx *, f32, f32, f32, f32); /* extern */ +? guScale(Mtx *, f32, f32, f32); /* extern */ void func_800942D0(void) { - ? *sp6C; + Gfx *sp6C; Gfx *temp_v0; Gfx *temp_v0_10; Gfx *temp_v0_11; @@ -1424,7 +1421,7 @@ void func_800942D0(void) { guRotate(temp_s1, D_8018EDC8, 1.0f, 0.0f, 0.0f); temp_s4 = temp_s1 + 0x40; guRotate(temp_s4, D_8018EDCC, 0.0f, 1.0f, 0.0f); - guScale(temp_s1 + 0x80, 1.0f, 1.0f, (bitwise s32) D_8018EDC4); + guScale(temp_s1 + 0x80, 1.0f, 1.0f, D_8018EDC4); temp_v0_3 = gDisplayListHead; gDisplayListHead = temp_v0_3 + 8; temp_v0_3->words.w1 = (u32) temp_s1; @@ -1462,13 +1459,13 @@ void func_800942D0(void) { if (10.0f < 3.0f) { phi_f26 = 10.0f; } - sp6C = &D_06009410; + sp6C = D_06009410; do { guRotate(phi_s1, 0.0f, 1.0f, 0.0f, 0.0f); temp_s3 = phi_s2 + 1; temp_s4_2 = phi_s1 + 0x40; guRotate(temp_s4_2, (f32) temp_s3 * 0.0f * phi_f26, 0.0f, 1.0f, 0.0f); - guScale(phi_s1 + 0x80, 1.0f, 1.0f, 0x40000000); + guScale(phi_s1 + 0x80, 1.0f, 1.0f, 2.0f); temp_v0_10 = gDisplayListHead; gDisplayListHead = temp_v0_10 + 8; temp_v0_10->words.w1 = (u32) phi_s1; @@ -1763,21 +1760,44 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80094C60.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? debug_print_str2(s32, ?, ? *, s16); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? debug_print_str2(s32, ?, s8 *, s16); /* extern */ ? func_80057778(); /* extern */ ? func_8009E230(); /* extern */ -? func_800A8230(); /* extern */ ? func_800CA0A0(); /* extern */ ? load_debug_font(); /* extern */ ? play_sound2(?); /* extern */ ? print_str_num(?, ?, ? *, s16); /* extern */ -static ? D_020076E0; /* unable to generate initializer */ -static ? gDebugCourseNames; /* unable to generate initializer; const */ -static ? gDebugCharacterNames; /* unable to generate initializer; const */ -static ? gDebugScreenModeNames; /* unable to generate initializer; const */ -static ? gDebugSoundModeNames; /* unable to generate initializer; const */ +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" }; /* const */ +static s8 *gDebugCourseNames[0x14] = { + "m circuit", + "mountain", + "castle", + "ghost", + "maze", + "snow", + "beach", + "p circuit", + "l circuit", + "farm", + "highway", + "desert", + "sherbet", + "rainbow", + "stadium", + "block", + "skyscraper", + "deck", + "jungle", + "doughnut", +}; /* const */ +static s8 *gDebugScreenModeNames[5] = { "1p", "2players UD", "2players LR", "3players", "4players" }; /* const */ s16 gCurrentCourseId; /* unable to generate initializer */ +s8 gCharacterSelections[4]; /* unable to generate initializer; const */ +s8 *gDebugSoundModeNames[4] = { "stereo", "head phone", "xxx", "monaural" }; /* const */ void func_80095574(void) { Gfx *temp_v1; @@ -1790,16 +1810,15 @@ void func_80095574(void) { s8 phi_v0_2; s32 phi_v0_3; - if ((D_8018EE0C < 3) || (D_8018E7B0 != 0)) { + if (((s32) D_8018EE0C < 3) || (D_8018E7B0 != 0)) { func_800A8230(); } temp_v0 = gDebugMenuSelection; phi_v0_2 = temp_v0; - if (temp_v0 >= DEBUG_MENU_DEBUG_MODE) { + if ((s32) temp_v0 >= DEBUG_MENU_DEBUG_MODE) { load_debug_font(); debug_print_str2(0x50, 0x64, "debug_mode"); temp_t8 = gDebugMenuSelection; - // Draw asterisk next to selected debug menu option switch (temp_t8) { case DEBUG_MENU_DEBUG_MODE: debug_print_str2(0x46, 0x64, "*"); @@ -1826,21 +1845,21 @@ void func_80095574(void) { debug_print_str2(0xAA, 0x64, "off"); } temp_a3 = gCurrentCourseId; - if ((temp_a3 >= 0x14) || (temp_a3 < 0)) { + if (((s32) temp_a3 >= 0x14) || ((s32) temp_a3 < 0)) { gCurrentCourseId = 0; } print_str_num(0x50, 0x6E, "map_number", gCurrentCourseId); temp_a3_2 = gCurrentCourseId; - if (temp_a3_2 < 0xA) { + if ((s32) temp_a3_2 < 0xA) { phi_v0 = 0; } else { phi_v0 = 8; } debug_print_str2(phi_v0 + 0xB9, 0x6E, gDebugCourseNames[temp_a3_2], temp_a3_2); debug_print_str2(0x50, 0x78, "screen_mode"); - debug_print_str2(0xAA, 0x78, *(&gDebugScreenModeNames + (D_8018EDF1 * 4))); + debug_print_str2(0xAA, 0x78, gDebugScreenModeNames[D_8018EDF1]); debug_print_str2(0x50, 0x82, "player"); - debug_print_str2(0xAA, 0x82, *(&gDebugCharacterNames + (gCharacterSelections * 4))); + debug_print_str2(0xAA, 0x82, gDebugCharacterNames[*gCharacterSelections]); debug_print_str2(0x50, 0x8C, "sound mode"); debug_print_str2(0xAA, 0x8C, gDebugSoundModeNames[gSoundMode]); if (gDebugMenuSelection == DEBUG_MENU_GIVE_ALL_GOLD_CUP) { @@ -1866,8 +1885,8 @@ void func_80095574(void) { } temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x6000000; - temp_v1->words.w1 = &D_020076E0; + temp_v1->words.w0 = 0x06000000; + temp_v1->words.w1 = (u32) D_020076E0; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095574.s") @@ -1922,46 +1941,74 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800959CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_02007BB8; -extern ? D_800E84CC; -extern ? D_800E84EC; -extern ? D_800E850C; -extern s8 gTextColor; -extern s32 gGlobalTimer; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *D_800E84CC[8] = { + D_02007838, + D_02007858, + D_02007878, + D_02007898, + D_020078B8, + D_020078D8, + D_020078F8, + D_02007918, +}; /* const */ +Gfx *D_800E84EC[8] = { + D_02007938, + D_02007958, + D_02007978, + D_02007998, + D_020079B8, + D_020079D8, + D_020079F8, + D_02007A18, +}; /* const */ +Gfx *D_800E850C[8] = { + D_02007A38, + D_02007A58, + D_02007A78, + D_02007A98, + D_02007AB8, + D_02007AD8, + D_02007AF8, + D_02007B18, +}; /* const */ -void *func_800959F8(void *arg0, s32 arg1) { +Gfx *func_800959F8(Gfx *arg0, mk_Vtx_Flag *arg1) { + s8 temp_v0; s8 phi_v1; + Gfx *phi_a0; - if (gTextColor < 4) { - phi_v1 = gTextColor; + temp_v0 = gTextColor; + phi_a0 = arg0; + if ((s32) temp_v0 < 4) { + phi_v1 = temp_v0; } else { - phi_v1 = ((gTextColor * 2) + (gGlobalTimer % 2)) - 4; + phi_v1 = ((temp_v0 * 2) + ((s32) gGlobalTimer % 2)) - 4; } - if (arg1 == &D_02007BB8) { - arg0->unk0 = 0x6000000; - arg0->unk4 = D_800E84CC[phi_v1]; + if (arg1 == D_02007BB8) { + arg0->words.w0 = 0x06000000; + arg0->words.w1 = (u32) D_800E84CC[phi_v1]; return arg0 + 8; } - if (arg1 == 0x2007CD8) { - arg0->unk0 = 0x6000000; - arg0->unk4 = D_800E84EC[phi_v1]; + if (arg1 == 0x02007CD8) { + arg0->words.w0 = 0x06000000; + arg0->words.w1 = (u32) D_800E84EC[phi_v1]; return arg0 + 8; } - if (arg1 == 0x2007DF8) { - arg0->unk0 = 0x6000000; - arg0->unk4 = D_800E850C[phi_v1]; - arg0 += 8; + if (arg1 == 0x02007DF8) { + arg0->words.w0 = 0x06000000; + arg0->words.w1 = (u32) D_800E850C[phi_v1]; + phi_a0 = arg0 + 8; } - return arg0; + return phi_a0; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800959F8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80095AE0(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_80095AE0(Mtx *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { s32 sp14; s32 sp10; s32 spC; @@ -1971,17 +2018,17 @@ void func_80095AE0(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { s32 *temp_v0_2; s32 *temp_v1; s32 temp_v0; - void *phi_v1; + Mtx *phi_v1; s32 phi_v0; phi_v1 = arg0; phi_v0 = 0; do { temp_v0 = phi_v0 + 4; - phi_v1->unk0 = 0; - phi_v1->unk4 = 0; - phi_v1->unk8 = 0; - phi_v1->unkC = 0; + 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); @@ -1989,100 +2036,94 @@ void func_80095AE0(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { temp_v1 = &sp10; temp_a2 = &spC; temp_a3 = &sp8; - sp14 = arg3 * 65536.0f; - sp10 = arg4 * 65536.0f; - spC = arg1 * 65536.0f; - sp8 = arg2 * 65536.0f; - arg0->unk0 = temp_v0_2->unk0; + 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->unk14 = 1; - arg0->unkA = temp_v1->unk0; - arg0->unk18 = temp_a2->unk0; + arg0->unkA = (s16) temp_v1->unk0; + arg0->unk18 = (s16) temp_a2->unk0; arg0->unk1E = 1; - arg0->unk1A = temp_a3->unk0; - arg0->unk20 = temp_v0_2->unk2; - arg0->unk2A = temp_v1->unk2; - arg0->unk38 = temp_a2->unk2; - arg0->unk3A = temp_a3->unk2; + 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; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095AE0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800959F8(void *, ? *, void *, s32); // extern -? func_80095AE0(void *, s32, s32, s32, f32); // extern -? rmonPrintf(? *); // extern -extern ? D_02007BB8; -extern ? D_02007CD8; -extern ? D_02007DF8; -extern ? D_800F0BCC; -extern ? D_800F0BEC; -extern s16 D_80164AF0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_80095AE0(Mtx *, s32, s32, s32, f32); /* extern */ +? rmonPrintf(? *); /* extern */ -void *func_80095BD0(void *arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32 arg5, s32 arg6, f32 arg7) { - void *sp28; +Gfx *func_80095BD0(Gfx *arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32 arg5, s32 arg6, f32 arg7) { + Mtx *sp28; + Gfx *temp_s0; + Gfx *temp_s0_2; + Gfx *temp_s0_3; + Gfx *temp_s0_4; + Gfx *temp_s0_5; + Gfx *temp_s0_6; + Gfx *temp_s0_7; s16 temp_v0; s32 temp_a3; s32 temp_v0_2; - void *temp_s0; - void *temp_s0_2; - void *temp_s0_3; - void *temp_s0_4; - void *temp_s0_5; - void *temp_s0_6; - void *temp_s0_7; - ? *phi_a1; + mk_Vtx_Flag *phi_a1; temp_v0 = D_80164AF0; - if (temp_v0 < 0x2F7) { - sp28 = gGfxPool + (temp_v0 << 6) + 0xFAC0; - if (temp_v0 < 0) { - rmonPrintf(&D_800F0BCC); + if ((s32) temp_v0 < 0x2F7) { + sp28 = &gGfxPool->mtxPool[temp_v0] + 0xFAC0; + if ((s32) temp_v0 < 0) { + rmonPrintf("effectcount < 0 !!!!!!(kawano)\n"); } func_80095AE0(sp28, arg2, arg3, arg6, arg7); - arg0->unk0 = 0x1020040; - arg0->unk4 = (gGfxPool + (D_80164AF0 << 6) + 0xFAC0) & 0x1FFFFFFF; + arg0->words.w0 = 0x01020040; + arg0->words.w1 = (s32) (&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0) & 0x1FFFFFFF; temp_s0_2 = arg0 + 8; - D_80164AF0 = D_80164AF0 + 1; - temp_s0_2->unk0 = (((arg4 >> 1) - 1) & 0xFFF) | 0xFD880000; + D_80164AF0 += 1; + temp_s0_2->words.w0 = (((arg4 >> 1) - 1) & 0xFFF) | 0xFD880000; temp_s0_3 = temp_s0_2 + 8; - temp_s0_2->unk4 = arg1; - temp_a3 = (((((arg4 + 1) >> 1) + 7) >> 3) & 0x1FF) << 9; + temp_s0_2->words.w1 = (u32) arg1; + temp_a3 = (((u32) (((u32) (arg4 + 1) >> 1) + 7) >> 3) & 0x1FF) << 9; temp_s0_4 = temp_s0_3 + 8; - temp_s0_3->unk0 = temp_a3 | 0xF5880000; - temp_s0_3->unk4 = 0x7000000; + temp_s0_3->words.w0 = temp_a3 | 0xF5880000; + temp_s0_3->words.w1 = 0x07000000; temp_s0_5 = temp_s0_4 + 8; - temp_s0_4->unk0 = 0xE6000000; - temp_s0_4->unk4 = 0; - temp_s0_5->unk0 = 0xF4000000; + temp_s0_4->words.w0 = 0xE6000000; + temp_s0_4->words.w1 = 0; + temp_s0_5->words.w0 = 0xF4000000; temp_v0_2 = (arg5 * 4) & 0xFFF; temp_s0_6 = temp_s0_5 + 8; - temp_s0_5->unk4 = (((arg4 * 2) & 0xFFF) << 0xC) | 0x7000000 | temp_v0_2; + temp_s0_5->words.w1 = (((arg4 * 2) & 0xFFF) << 0xC) | 0x07000000U | temp_v0_2; temp_s0_7 = temp_s0_6 + 8; - temp_s0_6->unk0 = 0xE7000000; + temp_s0_6->words.w0 = 0xE7000000; temp_s0 = temp_s0_7 + 8; - temp_s0_6->unk4 = 0; - temp_s0_7->unk4 = 0; - temp_s0_7->unk0 = temp_a3 | 0xF5800000; - temp_s0->unk0 = 0xF2000000; - temp_s0->unk4 = (((arg4 * 4) & 0xFFF) << 0xC) | temp_v0_2; - if (arg4 != 0x10) { - if (arg4 != 0x1A) { - if (arg4 != 0x1E) { - phi_a1 = &D_02007CD8; - } else { - phi_a1 = &D_02007DF8; - } - } else { - phi_a1 = &D_02007BB8; - } - } else { - phi_a1 = &D_02007CD8; + temp_s0_6->words.w1 = 0; + temp_s0_7->words.w1 = 0; + temp_s0_7->words.w0 = temp_a3 | 0xF5800000; + temp_s0->words.w0 = 0xF2000000; + temp_s0->words.w1 = (((arg4 * 4) & 0xFFF) << 0xC) | temp_v0_2; + switch (arg4) { /* irregular */ + default: + phi_a1 = D_02007CD8; + break; + case 16: + phi_a1 = D_02007CD8; + break; + case 26: + phi_a1 = D_02007BB8; + break; + case 30: + phi_a1 = D_02007DF8; + break; } - return func_800959F8(temp_s0 + 8, phi_a1, temp_s0, temp_a3); + return func_800959F8(temp_s0 + 8, phi_a1); } - rmonPrintf(&D_800F0BEC); + rmonPrintf("MAX effectcount(760) over!!!!(kawano)\n"); return arg0; } #else @@ -2090,14 +2131,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095BD0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, u32 argB, u32 argC) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80095E10(Gfx *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, u32 argB, u32 argC) { s32 sp7C; s32 sp70; s32 sp6C; s32 sp68; s32 sp64; u32 sp34; + Gfx *temp_a0_10; s32 temp_a2; s32 temp_a2_2; s32 temp_a2_3; @@ -2118,7 +2160,6 @@ void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u32 temp_t6_2; u32 temp_t7; void *temp_a0; - void *temp_a0_10; void *temp_a0_2; void *temp_a0_3; void *temp_a0_4; @@ -2140,8 +2181,8 @@ void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u32 phi_v1; s32 phi_t0_3; s32 phi_a1_2; - s32 phi_t1; - void *phi_a0; + u32 phi_t1; + Gfx *phi_a0; s32 phi_t2; s32 phi_s2; s32 phi_t4; @@ -2153,35 +2194,35 @@ void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 phi_s6; s32 phi_s7; s32 phi_fp; - void *phi_a0_2; + Gfx *phi_a0_2; s32 phi_a2_4; - void *phi_a0_3; + Gfx *phi_a0_3; s32 phi_s4; s32 phi_ra; - void *phi_a0_4; + Gfx *phi_a0_4; sp68 = 0; sp64 = 0; - phi_t0 = 1; - phi_t0_2 = 1; + phi_t0 = 1U; + phi_t0_2 = (s32) 1U; phi_a0_2 = arg0; phi_a0_3 = arg0; - if (argB >= 2) { + if (argB >= 2U) { do { temp_t7 = phi_t0 * 2; phi_t0 = temp_t7; - phi_t0_2 = temp_t7; + phi_t0_2 = (s32) temp_t7; } while (temp_t7 < argB); } temp_lo = 0x400 / phi_t0_2; phi_a2 = temp_lo; phi_t0_3 = phi_t0_2; - if (argC < (temp_lo / 2)) { + if (argC < (u32) (temp_lo / 2)) { phi_v0 = temp_lo / 2; do { temp_v0 = phi_v0 / 2; phi_v0 = temp_v0; - } while (argC < temp_v0); + } while (argC < (u32) temp_v0); sp6C = phi_v0; phi_a2 = phi_v0; } @@ -2210,7 +2251,7 @@ void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, arg6 = (arg4 - arg8) + 0x140; } phi_v0_4 = arg5; - phi_v1 = arg6; + phi_v1 = (u32) arg6; phi_ra = arg9; if (arg9 < 0) { phi_v0_4 = arg5 - arg9; @@ -2225,7 +2266,7 @@ void *func_80095E10(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, } else { sp7C = phi_a1; phi_s3 = phi_v0_4; - if (phi_v0_4 < arg7) { + if ((u32) phi_v0_4 < (u32) arg7) { arg8 = phi_a1; loop_24: temp_t6_2 = phi_a2_2 + phi_s3; @@ -2234,7 +2275,7 @@ loop_24: phi_a0_2 = phi_a0_3; phi_a2_4 = phi_a2_2; phi_a0_4 = phi_a0_3; - if (arg7 < temp_t6_2) { + if ((u32) arg7 < temp_t6_2) { temp_s4 = arg7 - phi_s3; phi_s4 = temp_s4; if (temp_s4 != 0) { @@ -2244,16 +2285,16 @@ loop_24: phi_s4 = phi_a2_2; block_28: phi_a1_2 = arg4; - if (arg4 < phi_v1) { - arg6 = phi_v1; + if ((u32) arg4 < phi_v1) { + arg6 = (s32) phi_v1; sp6C = phi_a2_2; sp70 = phi_t0_3; loop_30: temp_s5 = sp70 + phi_a1_2; phi_s2 = sp70; - phi_v1 = arg6; + phi_v1 = (u32) arg6; phi_a0_4 = phi_a0; - if (arg6 < temp_s5) { + if ((u32) arg6 < temp_s5) { temp_s2 = arg6 - phi_a1_2; phi_s2 = temp_s2; if (temp_s2 == 0) { @@ -2266,7 +2307,7 @@ loop_30: temp_v1 = (sp64 & 0xF) << 0xE; phi_t1 = temp_v0_2 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); phi_t2 = temp_v0_2 | 0xF5000000 | 0x100000; - phi_t4 = temp_v1 | 0x7000000 | temp_a2; + phi_t4 = temp_v1 | 0x07000000 | temp_a2; phi_a3 = (phi_s3 * 4) & 0xFFF; phi_t0_4 = ((phi_s3 + phi_s4) * 4) & 0xFFF; phi_v1_2 = temp_v1; @@ -2283,7 +2324,7 @@ loop_30: temp_v1_2 = (sp64 & 0xF) << 0xE; phi_t1 = temp_v0_3 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); phi_t2 = temp_v0_3 | 0xF5000000 | 0x100000; - phi_t4 = temp_v1_2 | 0x7000000 | temp_a2_2; + phi_t4 = temp_v1_2 | 0x07000000 | temp_a2_2; phi_a3 = (phi_s3 * 4) & 0xFFF; phi_t0_4 = ((phi_s3 + phi_s4) * 4) & 0xFFF; phi_v1_2 = temp_v1_2; @@ -2293,11 +2334,11 @@ loop_30: phi_s7 = (phi_s3 << 5) & 0xFFFF; phi_fp = (arg2 << 0x10) | (arg3 & 0xFFFF); block_35: - phi_a0->unk0 = phi_t1; + phi_a0->words.w0 = phi_t1; temp_a2_3 = phi_a1_2 + phi_s2; - phi_a0->unk4 = argA; + phi_a0->words.w1 = argA; temp_a0 = phi_a0 + 8; - temp_t3 = phi_t2 | ((((((temp_a2_3 - phi_a1_2) * 2) + 9) >> 3) & 0x1FF) << 9); + temp_t3 = phi_t2 | ((((u32) (((temp_a2_3 - phi_a1_2) * 2) + 9) >> 3) & 0x1FF) << 9); temp_a0_2 = temp_a0 + 8; temp_t1 = ((phi_a1_2 * 4) & 0xFFF) << 0xC; temp_a0->unk0 = temp_t3; @@ -2306,34 +2347,34 @@ block_35: temp_a0_3 = temp_a0_2 + 8; temp_t2 = ((temp_a2_3 * 4) & 0xFFF) << 0xC; temp_a0_2->unk4 = 0; - temp_a0_3->unk0 = temp_t1 | 0xF4000000 | phi_a3; + temp_a0_3->unk0 = (s32) (temp_t1 | 0xF4000000 | phi_a3); temp_a0_4 = temp_a0_3 + 8; - temp_a0_3->unk4 = temp_t2 | 0x7000000 | phi_t0_4; + temp_a0_3->unk4 = (s32) (temp_t2 | 0x07000000 | phi_t0_4); temp_a0_5 = temp_a0_4 + 8; temp_a0_4->unk0 = 0xE7000000; temp_a0_4->unk4 = 0; temp_a0_6 = temp_a0_5 + 8; - temp_a0_5->unk4 = phi_v1_2 | phi_a2_3; + temp_a0_5->unk4 = (s32) (phi_v1_2 | phi_a2_3); temp_a0_5->unk0 = temp_t3; - temp_a0_6->unk4 = temp_t2 | phi_t0_4; - temp_a0_6->unk0 = temp_t1 | 0xF2000000 | phi_a3; + temp_a0_6->unk4 = (s32) (temp_t2 | phi_t0_4); + temp_a0_6->unk0 = (s32) (temp_t1 | 0xF2000000 | phi_a3); temp_a0_7 = temp_a0_6 + 8; - temp_a0_7->unk0 = ((((arg8 + phi_s2) * 4) & 0xFFF) << 0xC) | 0xE4000000 | phi_s1; + temp_a0_7->unk0 = (s32) (((((arg8 + phi_s2) * 4) & 0xFFF) << 0xC) | 0xE4000000 | phi_s1); temp_a0_8 = temp_a0_7 + 8; - temp_a0_7->unk4 = (((arg8 * 4) & 0xFFF) << 0xC) | phi_s6; + temp_a0_7->unk4 = (s32) ((((arg8 * 4) & 0xFFF) << 0xC) | phi_s6); temp_a0_8->unk0 = 0xB3000000; temp_a0_9 = temp_a0_8 + 8; - temp_a0_8->unk4 = (phi_a1_2 << 0x15) | phi_s7; + temp_a0_8->unk4 = (s32) ((phi_a1_2 << 0x15) | phi_s7); temp_a0_9->unk0 = 0xB2000000; temp_a0_9->unk4 = phi_fp; arg8 += sp70; temp_a0_10 = temp_a0_9 + 8; - phi_a1_2 = temp_s5; + phi_a1_2 = (s32) temp_s5; phi_a0 = temp_a0_10; phi_a0_4 = temp_a0_10; - if (temp_s5 >= arg6) { + if (temp_s5 >= (u32) arg6) { phi_a2_4 = sp6C; - phi_v1 = arg6; + phi_v1 = (u32) arg6; phi_t0_3 = sp70; } else { goto loop_30; @@ -2342,11 +2383,11 @@ block_35: } arg8 = sp7C; phi_a2_2 = phi_a2_4; - phi_s3 = sp34; + phi_s3 = (s32) sp34; phi_a0_2 = phi_a0_4; phi_a0_3 = phi_a0_4; phi_ra += phi_a2_4; - if (sp34 < arg7) { + if (sp34 < (u32) arg7) { goto loop_24; } } @@ -2359,14 +2400,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095E10.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, s32 argB, s32 argC, u32 argD, u32 argE) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_800963F0(Gfx *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, s32 argB, s32 argC, u32 argD, u32 argE) { s32 sp8C; s32 sp78; s32 sp74; s32 sp70; s32 sp6C; u32 sp34; + Gfx *temp_a0_10; f32 temp_f0; f32 temp_f0_2; f32 temp_f10; @@ -2391,7 +2433,6 @@ void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, u32 temp_t7; u32 temp_t8; void *temp_a0; - void *temp_a0_10; void *temp_a0_2; void *temp_a0_3; void *temp_a0_4; @@ -2416,8 +2457,8 @@ void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, s32 phi_t0_3; u32 phi_a1_2; s32 phi_fp; - s32 phi_t1; - void *phi_a0; + u32 phi_t1; + Gfx *phi_a0; s32 phi_t2; u32 phi_s2; s32 phi_t4; @@ -2432,36 +2473,36 @@ void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, f32 phi_f12; f32 phi_f18; u32 phi_a2_2; - void *phi_a0_2; - void *phi_a0_3; + Gfx *phi_a0_2; + Gfx *phi_a0_3; f32 phi_f0; f32 phi_f16; f32 phi_f10; f32 phi_f8; - void *phi_a0_4; + Gfx *phi_a0_4; sp70 = 0; sp6C = 0; - phi_t0 = 1; - phi_t0_2 = 1; + phi_t0 = 1U; + phi_t0_2 = (s32) 1U; phi_a0_2 = arg0; phi_a0_3 = arg0; - if (argD >= 2) { + if (argD >= 2U) { do { temp_t7 = phi_t0 * 2; phi_t0 = temp_t7; - phi_t0_2 = temp_t7; + phi_t0_2 = (s32) temp_t7; } while (temp_t7 < argD); } temp_lo = 0x400 / phi_t0_2; phi_a3 = temp_lo; phi_t0_3 = phi_t0_2; - if (argE < (temp_lo / 2)) { + if (argE < (u32) (temp_lo / 2)) { phi_v0 = temp_lo / 2; do { temp_v0 = phi_v0 / 2; phi_v0 = temp_v0; - } while (argE < temp_v0); + } while (argE < (u32) temp_v0); sp74 = phi_v0; phi_a3 = phi_v0; } @@ -2487,9 +2528,9 @@ void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, arg6 -= argA; phi_ra = 0; } else { - temp_f0 = argA + ((arg8 - arg6) * arg4); + temp_f0 = (f32) argA + ((f32) (arg8 - arg6) * arg4); if (temp_f0 > 320.0f) { - arg8 = arg8 - (temp_f0 - 320.0f); + arg8 = (s32) ((f32) arg8 - (temp_f0 - 320.0f)); } } phi_v0_4 = arg7; @@ -2499,23 +2540,23 @@ void *func_800963F0(void *arg0, s8 arg1, s32 arg2, s32 arg3, f32 arg4, f32 arg5, phi_v0_4 = arg7 - argB; phi_a1 = 0; } else { - temp_f0_2 = argB + ((arg9 - arg7) * arg5); + temp_f0_2 = (f32) argB + ((f32) (arg9 - arg7) * arg5); if (temp_f0_2 > 240.0f) { - arg9 = arg9 - (temp_f0_2 - 240.0f); + arg9 = (s32) ((f32) arg9 - (temp_f0_2 - 240.0f)); } } - phi_a2 = arg9; - phi_v1 = arg8; + phi_a2 = (u32) arg9; + phi_v1 = (u32) arg8; if (arg8 < arg6) { } else if (arg9 < phi_v0_4) { } else { sp8C = phi_ra; - arg2 = arg2 / arg4; - arg3 = arg3 / arg5; + arg2 = (s32) ((f32) arg2 / arg4); + arg3 = (s32) ((f32) arg3 / arg5); phi_s3 = phi_v0_4; - if (phi_v0_4 < arg9) { + if ((u32) phi_v0_4 < (u32) arg9) { argB = phi_a1; loop_24: temp_t8 = phi_a3_2 + phi_s3; @@ -2528,25 +2569,25 @@ loop_24: temp_fp = phi_a2 - phi_s3; phi_fp = temp_fp; if (temp_fp != 0) { - phi_f12 = argB; - phi_f18 = phi_a3_2 * arg5; + phi_f12 = (f32) argB; + phi_f18 = (f32) phi_a3_2 * arg5; goto block_28; } } else { phi_fp = phi_a3_2; - phi_f12 = argB; - phi_f18 = phi_a3_2 * arg5; + phi_f12 = (f32) argB; + phi_f18 = (f32) phi_a3_2 * arg5; block_28: - phi_a1_2 = arg6; - if (arg6 < phi_v1) { + phi_a1_2 = (u32) arg6; + if ((u32) arg6 < phi_v1) { sp74 = phi_a3_2; sp78 = phi_t0_3; loop_30: temp_s4 = sp78 + phi_a1_2; - phi_a2_2 = arg9; - phi_v1 = arg8; + phi_a2_2 = (u32) arg9; + phi_v1 = (u32) arg8; phi_a0_4 = phi_a0; - if (arg8 < temp_s4) { + if ((u32) arg8 < temp_s4) { temp_s2 = arg8 - phi_a1_2; phi_s2 = temp_s2; if (temp_s2 == 0) { @@ -2556,53 +2597,53 @@ loop_30: temp_v0_2 = (arg1 & 7) << 0x15; temp_v1 = (sp6C & 0xF) << 0xE; temp_a2 = (sp70 & 0xF) * 0x10; - temp_f10 = phi_fp; + temp_f10 = (f32) phi_fp; phi_t1 = temp_v0_2 | 0xFD000000 | 0x100000 | ((argD - 1) & 0xFFF); phi_t2 = temp_v0_2 | 0xF5000000 | 0x100000; - phi_t4 = temp_v1 | 0x7000000 | temp_a2; + phi_t4 = temp_v1 | 0x07000000 | temp_a2; phi_a3_3 = (phi_s3 * 4) & 0xFFF; phi_t0_4 = ((phi_s3 + phi_fp) * 4) & 0xFFF; phi_s0 = temp_v1 | temp_a2; phi_s5 = (argB * 4) & 0xFFF; phi_s6 = (phi_s3 << 5) & 0xFFFF; phi_s7 = (arg2 << 0x10) | (arg3 & 0xFFFF); - phi_f0 = phi_ra_2; - phi_f16 = sp78 * arg4; + phi_f0 = (f32) phi_ra_2; + phi_f16 = (f32) sp78 * arg4; phi_f10 = temp_f10; if (phi_fp < 0) { phi_f10 = temp_f10 + 4294967296.0f; } - phi_s1 = ((argB + (phi_f10 * arg5)) * 4) & 0xFFF; + phi_s1 = ((argB + (u32) (phi_f10 * arg5)) * 4) & 0xFFF; goto block_39; } } else { temp_v0_3 = (arg1 & 7) << 0x15; temp_v1_2 = (sp6C & 0xF) << 0xE; temp_a2_2 = (sp70 & 0xF) * 0x10; - temp_f8 = phi_fp; + temp_f8 = (f32) phi_fp; phi_t1 = temp_v0_3 | 0xFD000000 | 0x100000 | ((argD - 1) & 0xFFF); phi_t2 = temp_v0_3 | 0xF5000000 | 0x100000; - phi_s2 = sp78; - phi_t4 = temp_v1_2 | 0x7000000 | temp_a2_2; + phi_s2 = (u32) sp78; + phi_t4 = temp_v1_2 | 0x07000000 | temp_a2_2; phi_a3_3 = (phi_s3 * 4) & 0xFFF; phi_t0_4 = ((phi_s3 + phi_fp) * 4) & 0xFFF; phi_s0 = temp_v1_2 | temp_a2_2; phi_s5 = (argB * 4) & 0xFFF; phi_s6 = (phi_s3 << 5) & 0xFFFF; phi_s7 = (arg2 << 0x10) | (arg3 & 0xFFFF); - phi_f0 = phi_ra_2; - phi_f16 = sp78 * arg4; + phi_f0 = (f32) phi_ra_2; + phi_f16 = (f32) sp78 * arg4; phi_f8 = temp_f8; if (phi_fp < 0) { phi_f8 = temp_f8 + 4294967296.0f; } - phi_s1 = ((argB + (phi_f8 * arg5)) * 4) & 0xFFF; + phi_s1 = ((argB + (u32) (phi_f8 * arg5)) * 4) & 0xFFF; block_39: - phi_a0->unk0 = phi_t1; + phi_a0->words.w0 = phi_t1; temp_a2_3 = phi_a1_2 + phi_s2; - phi_a0->unk4 = argC; + phi_a0->words.w1 = argC; temp_a0 = phi_a0 + 8; - temp_t3 = phi_t2 | ((((((temp_a2_3 - phi_a1_2) * 2) + 9) >> 3) & 0x1FF) << 9); + temp_t3 = phi_t2 | ((((u32) (((temp_a2_3 - phi_a1_2) * 2) + 9) >> 3) & 0x1FF) << 9); temp_a0_2 = temp_a0 + 8; temp_t1 = ((phi_a1_2 * 4) & 0xFFF) << 0xC; temp_a0->unk0 = temp_t3; @@ -2611,9 +2652,9 @@ block_39: temp_a0_3 = temp_a0_2 + 8; temp_t2 = ((temp_a2_3 * 4) & 0xFFF) << 0xC; temp_a0_2->unk4 = 0; - temp_a0_3->unk0 = temp_t1 | 0xF4000000 | phi_a3_3; + temp_a0_3->unk0 = (s32) (temp_t1 | 0xF4000000 | phi_a3_3); temp_a0_4 = temp_a0_3 + 8; - temp_a0_3->unk4 = temp_t2 | 0x7000000 | phi_t0_4; + temp_a0_3->unk4 = (s32) (temp_t2 | 0x07000000 | phi_t0_4); temp_a0_5 = temp_a0_4 + 8; temp_a0_6 = temp_a0_5 + 8; temp_a0_4->unk0 = 0xE7000000; @@ -2621,33 +2662,33 @@ block_39: temp_a0_7 = temp_a0_6 + 8; temp_a0_5->unk4 = phi_s0; temp_a0_5->unk0 = temp_t3; - temp_a0_6->unk4 = temp_t2 | phi_t0_4; - temp_a0_6->unk0 = temp_t1 | 0xF2000000 | phi_a3_3; + temp_a0_6->unk4 = (s32) (temp_t2 | phi_t0_4); + temp_a0_6->unk0 = (s32) (temp_t1 | 0xF2000000 | phi_a3_3); temp_a0_8 = temp_a0_7 + 8; temp_a0_9 = temp_a0_8 + 8; - temp_a0_7->unk0 = ((((phi_ra_2 + (phi_s2 * arg4)) * 4) & 0xFFF) << 0xC) | 0xE4000000 | phi_s1; - temp_a0_7->unk4 = (((phi_ra_2 * 4) & 0xFFF) << 0xC) | phi_s5; + temp_a0_7->unk0 = (s32) (((((phi_ra_2 + (u32) ((f32) phi_s2 * arg4)) * 4) & 0xFFF) << 0xC) | 0xE4000000 | phi_s1); + temp_a0_7->unk4 = (s32) ((((phi_ra_2 * 4) & 0xFFF) << 0xC) | phi_s5); temp_a0_8->unk0 = 0xB3000000; - temp_a0_8->unk4 = (phi_a1_2 << 0x15) | phi_s6; + temp_a0_8->unk4 = (s32) ((phi_a1_2 << 0x15) | phi_s6); temp_a0_9->unk0 = 0xB2000000; temp_a0_9->unk4 = phi_s7; temp_a0_10 = temp_a0_9 + 8; phi_a1_2 = temp_s4; phi_a0 = temp_a0_10; - phi_ra_2 = phi_f0 + phi_f16; + phi_ra_2 = (s32) (phi_f0 + phi_f16); phi_a0_4 = temp_a0_10; - if (temp_s4 >= arg8) { - phi_a2_2 = arg9; + if (temp_s4 >= (u32) arg8) { + phi_a2_2 = (u32) arg9; phi_a3_2 = sp74; - phi_v1 = arg8; + phi_v1 = (u32) arg8; phi_t0_3 = sp78; } else { goto loop_30; } } } - argB = phi_f12 + phi_f18; - phi_s3 = sp34; + argB = (s32) (phi_f12 + phi_f18); + phi_s3 = (s32) sp34; phi_a2 = phi_a2_2; phi_a0_2 = phi_a0_4; phi_a0_3 = phi_a0_4; @@ -2665,29 +2706,33 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800963F0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 *draw_box(void *, s32, u32, u32, u32, s32, s32, s32, s32); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +s32 random_int(?, u32); /* extern */ extern ? D_0B002A00; -void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { +Gfx *func_80096CD8(Gfx *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { s32 spD4; s32 spD0; s32 spCC; s32 spC8; s32 spC4; - u32 sp84; + s32 sp84; /* compiler-managed */ u32 sp80; u32 sp7C; u32 sp78; s32 sp58; - s32 *temp_v0_3; + Gfx *temp_s0; + Gfx *temp_s0_11; + Gfx *temp_v0_3; s32 temp_a0; s32 temp_a1; s32 temp_a2; s32 temp_a3; s32 temp_lo; s32 temp_s1; + s32 temp_s3; s32 temp_s4; + s32 temp_t4; s32 temp_t5; s32 temp_t8; s32 temp_t8_2; @@ -2698,14 +2743,10 @@ void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; - u32 temp_s3; u32 temp_t2; - u32 temp_t4; u32 temp_t6; u32 temp_t7; - void *temp_s0; void *temp_s0_10; - void *temp_s0_11; void *temp_s0_2; void *temp_s0_3; void *temp_s0_4; @@ -2721,16 +2762,16 @@ void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { s32 phi_s1_2; u32 phi_a1; s32 phi_s4; - u32 phi_s2; - u32 phi_fp; + s32 phi_s2; + s32 phi_fp; u32 phi_s3; u32 phi_s4_2; u32 phi_t4; u32 phi_t4_2; s32 phi_ra_3; u32 phi_s1_3; - s32 phi_a1_2; - void *phi_s0; + u32 phi_a1_2; + Gfx *phi_s0; s32 phi_t5; s32 phi_t3; s32 phi_s4_3; @@ -2739,34 +2780,34 @@ void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { s32 phi_s3_2; s32 phi_s7; u32 phi_s3_3; - void *phi_s0_2; + Gfx *phi_s0_2; s32 phi_ra_4; - void *phi_s0_3; - void *phi_s0_4; + Gfx *phi_s0_3; + Gfx *phi_s0_4; spC8 = 0; spC4 = 0; - phi_ra = 1; - phi_ra_2 = 1; + phi_ra = 1U; + phi_ra_2 = (s32) 1U; phi_s4 = arg1; phi_s2 = arg2; phi_s0_2 = arg0; - if (arg3 >= 2) { + if (arg3 >= 2U) { do { temp_t7 = phi_ra * 2; phi_ra = temp_t7; - phi_ra_2 = temp_t7; + phi_ra_2 = (s32) temp_t7; } while (temp_t7 < arg3); } temp_lo = 0x400 / phi_ra_2; spCC = temp_lo; phi_a1 = arg4; - if (arg4 < (temp_lo / 2)) { + if (arg4 < (u32) (temp_lo / 2)) { phi_v0 = temp_lo / 2; do { temp_v0 = phi_v0 / 2; phi_v0 = temp_v0; - } while (arg4 < temp_v0); + } while (arg4 < (u32) temp_v0); spCC = phi_v0; } phi_s1 = phi_ra_2; @@ -2788,14 +2829,14 @@ void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { if (arg1 < 0) { arg3 -= arg1; phi_s4 = 0; - } else if ((arg1 + arg3) >= 0x141) { + } else if ((u32) (arg1 + arg3) >= 0x141U) { arg3 = 0x140 - arg1; } - phi_s4_2 = phi_s4; + phi_s4_2 = (u32) phi_s4; if (arg2 < 0) { phi_a1 = arg4 - arg2; phi_s2 = 0; - } else if ((arg2 + arg4) >= 0xF1) { + } else if ((u32) (arg2 + arg4) >= 0xF1U) { phi_a1 = 0xF0 - arg2; } if (arg3 == 0) { @@ -2807,26 +2848,26 @@ void *func_80096CD8(void *arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4) { temp_s3 = phi_s2 + phi_a1; temp_t4 = phi_s4 + arg3; sp84 = temp_t4; - temp_v0_2 = random_int(0x64); + temp_v0_2 = random_int(0x64, phi_a1); temp_s1 = temp_v0_2; temp_v0_3 = draw_box(arg0, phi_s4, phi_s2, sp84, temp_s3, 0, 0, 0, temp_v0_2); temp_v1 = (temp_s1 + 0x96) & 0xFF; - temp_v0_3->unk0 = 0xE7000000; + temp_v0_3->words.w0 = 0xE7000000; temp_v0_3->unk8 = 0xB900031D; temp_v0_3->unkC = 0x504240; temp_v0_3->unk10 = 0xFA000000; - temp_v0_3->unk4 = 0; - temp_v0_3->unk14 = (temp_v1 << 0x18) | (temp_v1 << 0x10) | (temp_v1 << 8) | temp_v1; + temp_v0_3->words.w1 = 0; + temp_v0_3->unk14 = (s32) ((temp_v1 << 0x18) | (temp_v1 << 0x10) | (temp_v1 << 8) | temp_v1); temp_v0_3->unk1C = 0xFF2FFFFF; temp_v0_3->unk18 = 0xFC119623; temp_s0 = temp_v0_3 + 0x20; phi_fp = phi_s2; - phi_s3 = temp_s3; - phi_t4 = temp_t4; + phi_s3 = (u32) temp_s3; + phi_t4 = (u32) temp_t4; phi_s0_2 = temp_s0; phi_ra_4 = phi_ra_2; phi_s0_3 = temp_s0; - if (phi_s2 < temp_s3) { + if ((u32) phi_s2 < (u32) temp_s3) { loop_23: temp_t6 = spCC + phi_fp; sp7C = temp_t6; @@ -2848,7 +2889,7 @@ block_26: phi_s1_3 = phi_s4_2; if (phi_s4_2 < phi_t4) { sp80 = phi_s3; - arg1 = phi_s4_2; + arg1 = (s32) phi_s4_2; loop_28: temp_t2 = phi_ra_3 + phi_s1_3; phi_t4 = phi_t4_2; @@ -2859,13 +2900,13 @@ loop_28: phi_s4_3 = temp_s4; if (temp_s4 == 0) { phi_s3_3 = sp80; - phi_s4_2 = arg1; + phi_s4_2 = (u32) arg1; } else { temp_v0_4 = (spC4 & 0xF) << 0xE; temp_v1_2 = (spC8 & 0xF) * 0x10; phi_a1_2 = ((arg3 - 1) & 0xFFF) | 0xFD700000; phi_t3 = (phi_fp << 5) & 0xFFFF; - phi_s6 = temp_v0_4 | 0x7000000 | temp_v1_2; + phi_s6 = temp_v0_4 | 0x07000000 | temp_v1_2; phi_s2_2 = (phi_fp * 4) & 0xFFF; phi_s3_2 = ((phi_fp + phi_t5) * 4) & 0xFFF; phi_s7 = temp_v0_4 | temp_v1_2; @@ -2877,12 +2918,12 @@ loop_28: phi_a1_2 = ((arg3 - 1) & 0xFFF) | 0xFD700000; phi_t3 = (phi_fp << 5) & 0xFFFF; phi_s4_3 = phi_ra_3; - phi_s6 = temp_v0_5 | 0x7000000 | temp_v1_3; + phi_s6 = temp_v0_5 | 0x07000000 | temp_v1_3; phi_s2_2 = (phi_fp * 4) & 0xFFF; phi_s3_2 = ((phi_fp + phi_t5) * 4) & 0xFFF; phi_s7 = temp_v0_5 | temp_v1_3; block_33: - phi_s0->unk0 = phi_a1_2; + phi_s0->words.w0 = phi_a1_2; spD0 = phi_ra_3; spD4 = phi_t5; sp84 = phi_t4_2; @@ -2890,9 +2931,9 @@ block_33: sp78 = temp_t2; temp_s0_2 = phi_s0 + 8; temp_a2 = phi_s1_3 + phi_s4_3; - phi_s0->unk4 = (random_int(0x80) * 2) + &D_0B002A00; + phi_s0->words.w1 = (random_int(0x80, phi_a1_2) * 2) + &D_0B002A00; temp_s0_3 = temp_s0_2 + 8; - temp_a3 = ((((((temp_a2 - phi_s1_3) * 2) + 9) >> 3) & 0x1FF) << 9) | 0xF5700000; + temp_a3 = ((((u32) (((temp_a2 - phi_s1_3) * 2) + 9) >> 3) & 0x1FF) << 9) | 0xF5700000; temp_s0_2->unk0 = temp_a3; temp_s0_2->unk4 = phi_s6; temp_s0_3->unk0 = 0xE6000000; @@ -2900,9 +2941,9 @@ block_33: temp_s0_3->unk4 = 0; temp_s0_4 = temp_s0_3 + 8; temp_a0 = ((temp_a2 * 4) & 0xFFF) << 0xC; - temp_s0_4->unk0 = temp_a1 | 0xF4000000 | phi_s2_2; + temp_s0_4->unk0 = (s32) (temp_a1 | 0xF4000000 | phi_s2_2); temp_s0_5 = temp_s0_4 + 8; - temp_s0_4->unk4 = temp_a0 | 0x7000000 | phi_s3_2; + temp_s0_4->unk4 = (s32) (temp_a0 | 0x07000000 | phi_s3_2); temp_s0_6 = temp_s0_5 + 8; temp_s0_5->unk0 = 0xE7000000; temp_s0_5->unk4 = 0; @@ -2910,16 +2951,16 @@ block_33: temp_s0_6->unk4 = phi_s7; temp_s0_6->unk0 = temp_a3; temp_s0_8 = temp_s0_7 + 8; - temp_s0_7->unk4 = temp_a0 | phi_s3_2; - temp_s0_7->unk0 = temp_a1 | 0xF2000000 | phi_s2_2; + temp_s0_7->unk4 = (s32) (temp_a0 | phi_s3_2); + temp_s0_7->unk0 = (s32) (temp_a1 | 0xF2000000 | phi_s2_2); temp_s0_9 = temp_s0_8 + 8; - temp_s0_8->unk4 = temp_a1 | phi_s2_2; - temp_s0_8->unk0 = temp_a0 | 0xE4000000 | phi_s3_2; + temp_s0_8->unk4 = (s32) (temp_a1 | phi_s2_2); + temp_s0_8->unk0 = (s32) (temp_a0 | 0xE4000000 | phi_s3_2); temp_s0_9->unk0 = 0xB3000000; temp_s0_10 = temp_s0_9 + 8; - temp_s0_9->unk4 = (phi_s1_3 << 0x15) | phi_t3; + temp_s0_9->unk4 = (s32) ((phi_s1_3 << 0x15) | phi_t3); temp_s0_10->unk0 = 0xB2000000; - temp_s0_10->unk4 = 0x4000400; + temp_s0_10->unk4 = 0x04000400; temp_s0_11 = temp_s0_10 + 8; phi_s1_3 = temp_t2; phi_s0 = temp_s0_11; @@ -2928,13 +2969,13 @@ block_33: phi_ra_4 = phi_ra_3; if (temp_t2 >= phi_t4_2) { phi_s3_3 = sp80; - phi_s4_2 = arg1; + phi_s4_2 = (u32) arg1; } else { goto loop_28; } } } - phi_fp = sp7C; + phi_fp = (s32) sp7C; phi_s3 = phi_s3_3; phi_s0_2 = phi_s0_4; phi_s0_3 = phi_s0_4; @@ -2951,12 +2992,12 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80096CD8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +s32 random_int(?, u32, s32, s32); /* extern */ extern ? D_000FFF00; extern ? D_0B002A00; -extern s32 gGlobalTimer; -void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, u32 argB, u32 argC) { +Gfx *func_80097274(Gfx *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, u32 argB, u32 argC) { s32 sp108; s32 sp104; s32 sp100; @@ -2973,6 +3014,12 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 sp48; s32 sp44; s32 sp40; + Gfx *temp_s0; + Gfx *temp_s0_22; + Gfx *temp_s0_2; + Gfx *temp_s0_3; + Gfx *temp_s0_4; + Gfx *temp_s0_5; s32 temp_a0_2; s32 temp_a0_3; s32 temp_a0_4; @@ -3001,7 +3048,6 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u32 temp_t9; u32 temp_t9_2; void *temp_a0; - void *temp_s0; void *temp_s0_10; void *temp_s0_11; void *temp_s0_12; @@ -3014,11 +3060,6 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, void *temp_s0_19; void *temp_s0_20; void *temp_s0_21; - void *temp_s0_22; - void *temp_s0_2; - void *temp_s0_3; - void *temp_s0_4; - void *temp_s0_5; void *temp_s0_6; void *temp_s0_7; void *temp_s0_8; @@ -3036,8 +3077,8 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u32 phi_v1; s32 phi_s4; s32 phi_t5_2; - s32 phi_a1; - void *phi_s0; + u32 phi_a1; + Gfx *phi_s0; s32 phi_a3; s32 phi_t3_2; s32 phi_t4_2; @@ -3045,26 +3086,26 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 phi_s3; s32 phi_t2; s32 phi_ra; - void *phi_s0_2; + Gfx *phi_s0_2; s32 phi_t3_3; s32 phi_t4_3; - void *phi_s0_3; - void *phi_s0_4; + Gfx *phi_s0_3; + Gfx *phi_s0_4; temp_s0_2 = arg0 + 8; - arg0->unk0 = 0xE7000000; - arg0->unk4 = 0; + arg0->words.w0 = 0xE7000000; + arg0->words.w1 = 0; temp_s0_3 = temp_s0_2 + 8; - temp_s0_2->unk0 = 0xBA001402; - temp_s0_2->unk4 = &D_000FFF00; + temp_s0_2->words.w0 = 0xBA001402; + temp_s0_2->words.w1 = (u32) &D_000FFF00; temp_s0_4 = temp_s0_3 + 8; - temp_s0_3->unk0 = 0xBA001001; - temp_s0_3->unk4 = 0; - temp_s0_4->unk0 = 0xFA000000; + temp_s0_3->words.w0 = 0xBA001001; + temp_s0_3->words.w1 = 0; + temp_s0_4->words.w0 = 0xFA000000; temp_t7 = gGlobalTimer; temp_s0_5 = temp_s0_4 + 8; - phi_t0 = 1; - phi_t0_2 = 1; + phi_t0 = 1U; + phi_t0_2 = (s32) 1U; phi_t3 = 0; phi_t4 = 0; phi_t3_3 = 0; @@ -3072,27 +3113,27 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, if ((temp_t7 < 0) && ((temp_t7 & 0xFF) != 0)) { } - temp_s0_4->unk4 = temp_t7 & 0xFF & 0xFF; - temp_s0_5->unk4 = 0x1FFC9238; - temp_s0_5->unk0 = 0xFC2527FF; + temp_s0_4->words.w1 = temp_t7 & 0xFF & 0xFF; + temp_s0_5->words.w1 = 0x1FFC9238; + temp_s0_5->words.w0 = 0xFC2527FF; temp_s0 = temp_s0_5 + 8; phi_s0_2 = temp_s0; phi_s0_3 = temp_s0; - if (argB >= 2) { + if (argB >= 2U) { do { temp_t9 = phi_t0 * 2; phi_t0 = temp_t9; - phi_t0_2 = temp_t9; + phi_t0_2 = (s32) temp_t9; } while (temp_t9 < argB); } temp_lo = 0x400 / phi_t0_2; spF4 = temp_lo; - if (argC < (temp_lo / 2)) { + if (argC < (u32) (temp_lo / 2)) { phi_v0 = temp_lo / 2; do { temp_v0 = phi_v0 / 2; phi_v0 = temp_v0; - } while (argC < temp_v0); + } while (argC < (u32) temp_v0); spF4 = phi_v0; } phi_v0_2 = phi_t0_2; @@ -3124,7 +3165,7 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, } temp_t6_2 = arg9; phi_v0_4 = arg5; - phi_v1 = arg6; + phi_v1 = (u32) arg6; if (temp_t6_2 < 0) { arg9 = 0; phi_v0_4 = arg5 - temp_t6_2; @@ -3139,7 +3180,7 @@ void *func_80097274(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, } sp104 = phi_a0; phi_t5 = phi_v0_4; - if (phi_v0_4 < arg7) { + if ((u32) phi_v0_4 < (u32) arg7) { arg8 = phi_a0; spF8 = phi_t0_2; spF0 = phi_t3; @@ -3151,7 +3192,7 @@ loop_27: phi_s0 = phi_s0_3; phi_s0_2 = phi_s0_3; phi_s0_4 = phi_s0_3; - if (arg7 < temp_t6_3) { + if ((u32) arg7 < temp_t6_3) { temp_v0_2 = arg7 - phi_t5; spFC = temp_v0_2; if (temp_v0_2 != 0) { @@ -3161,14 +3202,14 @@ loop_27: spFC = spF4; block_31: phi_s4 = arg4; - if (arg4 < phi_v1) { - arg6 = phi_v1; + if ((u32) arg4 < phi_v1) { + arg6 = (s32) phi_v1; loop_33: temp_t9_2 = spF8 + phi_s4; sp80 = temp_t9_2; - phi_v1 = arg6; + phi_v1 = (u32) arg6; phi_s0_4 = phi_s0; - if (arg6 < temp_t9_2) { + if ((u32) arg6 < temp_t9_2) { temp_t3_2 = arg6 - phi_s4; phi_t3_2 = temp_t3_2; if (temp_t3_2 != 0) { @@ -3182,11 +3223,11 @@ loop_33: sp40 = (arg2 << 0x10) | (arg3 & 0xFFFF); phi_a1 = temp_a0_2 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); phi_a3 = temp_a0_2 | 0xF5000000 | 0x100000; - phi_t4_2 = temp_v0_3 | 0x7000000 | temp_v1; + phi_t4_2 = temp_v0_3 | 0x07000000 | temp_v1; phi_a2 = (phi_t5_2 * 4) & 0xFFF; phi_s3 = ((phi_t5_2 + spFC) * 4) & 0xFFF; phi_t2 = temp_v0_3 | temp_v1; - phi_ra = temp_v0_3 | 0x1000000 | temp_v1; + phi_ra = temp_v0_3 | 0x01000000 | temp_v1; goto block_37; } } else { @@ -3200,17 +3241,17 @@ loop_33: phi_a1 = temp_a0_3 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); phi_a3 = temp_a0_3 | 0xF5000000 | 0x100000; phi_t3_2 = spF8; - phi_t4_2 = temp_v0_4 | 0x7000000 | temp_v1_2; + phi_t4_2 = temp_v0_4 | 0x07000000 | temp_v1_2; phi_a2 = (phi_t5_2 * 4) & 0xFFF; phi_s3 = ((phi_t5_2 + spFC) * 4) & 0xFFF; phi_t2 = temp_v0_4 | temp_v1_2; - phi_ra = temp_v0_4 | 0x1000000 | temp_v1_2; + phi_ra = temp_v0_4 | 0x01000000 | temp_v1_2; block_37: - phi_s0->unk0 = phi_a1; + phi_s0->words.w0 = phi_a1; temp_a0_4 = phi_s4 + phi_t3_2; - phi_s0->unk4 = argA; + phi_s0->words.w1 = argA; temp_s0_6 = phi_s0 + 8; - temp_s1 = phi_a3 | ((((((temp_a0_4 - phi_s4) * 2) + 9) >> 3) & 0x1FF) << 9); + temp_s1 = phi_a3 | ((((u32) (((temp_a0_4 - phi_s4) * 2) + 9) >> 3) & 0x1FF) << 9); temp_s0_7 = temp_s0_6 + 8; temp_s0_6->unk0 = temp_s1; temp_s0_6->unk4 = phi_t4_2; @@ -3219,7 +3260,7 @@ block_37: temp_s0_8 = temp_s0_7 + 8; temp_s2 = ((temp_a0_4 * 4) & 0xFFF) << 0xC; temp_s0_7->unk4 = 0; - temp_s6 = temp_s2 | 0x7000000 | phi_s3; + temp_s6 = temp_s2 | 0x07000000 | phi_s3; temp_s0_9 = temp_s0_8 + 8; temp_s5 = temp_a3 | 0xF4000000 | phi_a2; temp_s0_8->unk0 = temp_s5; @@ -3232,7 +3273,7 @@ block_37: temp_s0_10->unk0 = temp_s1; temp_s7 = temp_a3 | 0xF2000000 | phi_a2; temp_s0_12 = temp_s0_11 + 8; - temp_s0_11->unk4 = temp_s2 | phi_s3; + temp_s0_11->unk4 = (s32) (temp_s2 | phi_s3); temp_s0_11->unk0 = temp_s7; temp_s0_12->unk0 = phi_a1; sp50 = phi_ra; @@ -3240,7 +3281,7 @@ block_37: sp68 = phi_t4_2; sp100 = phi_t3_2; temp_s0_13 = temp_s0_12 + 8; - temp_s0_12->unk4 = (random_int(0x80) * 2) + &D_0B002A00; + temp_s0_12->unk4 = (void *) ((random_int(0x80, phi_a1, phi_a2, temp_a3) * 2) + &D_0B002A00); temp_s0_14 = temp_s0_13 + 8; temp_a1 = temp_s1 | 0x100; temp_s0_13->unk0 = temp_a1; @@ -3257,24 +3298,24 @@ block_37: temp_s0_17->unk0 = temp_a1; temp_s0_17->unk4 = phi_ra; temp_s0_18 = temp_s0_17 + 8; - temp_s0_18->unk4 = temp_s2 | 0x1000000 | phi_s3; + temp_s0_18->unk4 = (s32) (temp_s2 | 0x01000000 | phi_s3); temp_s0_18->unk0 = temp_s7; temp_s0_19 = temp_s0_18 + 8; - temp_s0_19->unk0 = ((((arg8 + phi_t3_2) * 4) & 0xFFF) << 0xC) | 0xE4000000 | sp4C; + temp_s0_19->unk0 = (s32) (((((arg8 + phi_t3_2) * 4) & 0xFFF) << 0xC) | 0xE4000000 | sp4C); temp_s0_20 = temp_s0_19 + 8; - temp_s0_19->unk4 = (((arg8 * 4) & 0xFFF) << 0xC) | sp48; + temp_s0_19->unk4 = (s32) ((((arg8 * 4) & 0xFFF) << 0xC) | sp48); temp_s0_20->unk0 = 0xB3000000; temp_s0_21 = temp_s0_20 + 8; - temp_s0_20->unk4 = (phi_s4 << 0x15) | sp44; + temp_s0_20->unk4 = (s32) ((phi_s4 << 0x15) | sp44); temp_s0_21->unk0 = 0xB2000000; temp_s0_22 = temp_s0_21 + 8; temp_s0_21->unk4 = sp40; arg8 += spF8; - phi_s4 = sp80; + phi_s4 = (s32) sp80; phi_s0 = temp_s0_22; phi_s0_4 = temp_s0_22; - if (sp80 >= arg6) { - phi_v1 = arg6; + if (sp80 >= (u32) arg6) { + phi_v1 = (u32) arg6; } else { goto loop_33; } @@ -3282,17 +3323,17 @@ block_37: } arg8 = sp104; arg9 += spF4; - phi_t5 = sp84; + phi_t5 = (s32) sp84; phi_s0_2 = phi_s0_4; phi_s0_3 = phi_s0_4; - if (sp84 < arg7) { + if (sp84 < (u32) arg7) { goto loop_27; } } } temp_a0 = phi_s0_2 + 8; - phi_s0_2->unk0 = 0xE7000000; - phi_s0_2->unk4 = 0; + phi_s0_2->words.w0 = 0xE7000000; + phi_s0_2->words.w1 = 0; temp_a0->unk0 = 0xBA001402; temp_a0->unk4 = 0; return temp_a0 + 8; @@ -3302,21 +3343,19 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097274.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern - -void *func_80097A14(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA) { - s32 *temp_v0; - void *temp_a0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +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; temp_a0 = arg0 + 8; - arg0->unk0 = 0xE7000000; - arg0->unk4 = 0; - temp_a0->unk4 = 0x200000; - temp_a0->unk0 = 0xBA001402; + arg0->words.w0 = 0xE7000000; + arg0->words.w1 = 0; + temp_a0->words.w1 = 0x200000; + 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->unk0 = 0xE7000000; - temp_v0->unk4 = 0; + temp_v0->words.w0 = 0xE7000000; + temp_v0->words.w1 = 0; temp_v0->unk8 = 0xBA001402; temp_v0->unkC = 0; return temp_v0 + 0x10; @@ -3326,11 +3365,11 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097A14.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80097AE4(Gfx *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { s32 sp34; + Gfx *temp_a0_20; s32 temp_s1; - s32 temp_s4; s32 temp_t1; s32 temp_t6; s32 temp_t7; @@ -3340,6 +3379,7 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) s32 temp_t8_3; s32 temp_t9; s32 temp_v1; + u32 temp_s4; void *temp_a0; void *temp_a0_10; void *temp_a0_11; @@ -3351,7 +3391,6 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) void *temp_a0_17; void *temp_a0_18; void *temp_a0_19; - void *temp_a0_20; void *temp_a0_2; void *temp_a0_3; void *temp_a0_4; @@ -3360,11 +3399,11 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) void *temp_a0_7; void *temp_a0_8; void *temp_a0_9; - void *phi_a0; + Gfx *phi_a0; s32 phi_a2; s32 phi_s0; s32 phi_s2; - void *phi_a0_2; + Gfx *phi_a0_2; phi_a0 = arg0; phi_s0 = arg2; @@ -3377,24 +3416,24 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) temp_s4 = temp_t8 | 0xFD000000 | 0x100000 | 0x3F; temp_t8_2 = temp_t8 | 0xF5000000 | 0x100000 | 0x1200; sp34 = arg2; - temp_t7 = (((0x8000 / (0x20 - arg5)) & 0xFFFF) << 0x10) | 0x400; + temp_t7 = (((0x8000 / (s32) (0x20 - arg5)) & 0xFFFF) << 0x10) | 0x400; phi_a2 = 0; do { temp_a0 = phi_a0 + 8; - phi_a0->unk0 = temp_s4; - phi_a0->unk4 = arg4; + phi_a0->words.w0 = temp_s4; + phi_a0->words.w1 = arg4; temp_a0_2 = temp_a0 + 8; temp_t6 = (phi_a2 * 4) & 0xFFF; temp_a0_3 = temp_a0_2 + 8; - temp_a0->unk4 = 0x7014050; + temp_a0->unk4 = 0x07014050; temp_a0->unk0 = temp_t8_2; temp_s1 = phi_a2 + 0x20; temp_t9 = (temp_s1 * 4) & 0xFFF; temp_a0_2->unk4 = 0; temp_a0_2->unk0 = 0xE6000000; temp_a0_4 = temp_a0_3 + 8; - temp_a0_3->unk4 = temp_t9 | 0x7080000; - temp_a0_3->unk0 = temp_t6 | 0xF4000000; + temp_a0_3->unk4 = (s32) (temp_t9 | 0x07080000); + temp_a0_3->unk0 = (s32) (temp_t6 | 0xF4000000); temp_a0_5 = temp_a0_4 + 8; temp_a0_4->unk4 = 0; temp_a0_4->unk0 = 0xE7000000; @@ -3403,14 +3442,14 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) temp_a0_6 = temp_a0_5 + 8; temp_v1 = phi_s0 + 0x20; temp_t1 = phi_s2 + 0x20; - temp_a0_6->unk0 = temp_t6 | 0xF2000000; - temp_a0_6->unk4 = temp_t9 | 0x80000; + temp_a0_6->unk0 = (s32) (temp_t6 | 0xF2000000); + temp_a0_6->unk4 = (s32) (temp_t9 | 0x80000); temp_t7_2 = (temp_t1 * 4) & 0xFFF; temp_a0_7 = temp_a0_6 + 8; temp_t8_3 = (phi_s2 * 4) & 0xFFF; - temp_a0_7->unk0 = (((temp_v1 * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t7_2; + temp_a0_7->unk0 = (s32) ((((temp_v1 * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t7_2); temp_a0_8 = temp_a0_7 + 8; - temp_a0_7->unk4 = ((((phi_s0 + arg5) * 4) & 0xFFF) << 0xC) | temp_t8_3; + temp_a0_7->unk4 = (s32) (((((phi_s0 + arg5) * 4) & 0xFFF) << 0xC) | temp_t8_3); temp_a0_9 = temp_a0_8 + 8; temp_a0_8->unk0 = 0xB3000000; temp_a0_10 = temp_a0_9 + 8; @@ -3421,26 +3460,26 @@ void *func_80097AE4(void *arg0, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) temp_a0_10->unk4 = arg4; temp_a0_10->unk0 = temp_s4; temp_a0_12 = temp_a0_11 + 8; - temp_a0_11->unk4 = 0x7014050; + temp_a0_11->unk4 = 0x07014050; temp_a0_11->unk0 = temp_t8_2; temp_a0_13 = temp_a0_12 + 8; temp_a0_12->unk4 = 0; temp_a0_12->unk0 = 0xE6000000; temp_a0_14 = temp_a0_13 + 8; - temp_a0_13->unk4 = temp_t9 | 0x7100000; - temp_a0_13->unk0 = temp_t6 | 0xF4080000; + temp_a0_13->unk4 = (s32) (temp_t9 | 0x07100000); + temp_a0_13->unk0 = (s32) (temp_t6 | 0xF4080000); temp_a0_15 = temp_a0_14 + 8; temp_a0_14->unk4 = 0; temp_a0_14->unk0 = 0xE7000000; temp_a0_15->unk4 = 0x14050; temp_a0_16 = temp_a0_15 + 8; temp_a0_15->unk0 = temp_t8_2; - temp_a0_16->unk0 = temp_t6 | 0xF2080000; - temp_a0_16->unk4 = temp_t9 | 0x100000; + temp_a0_16->unk0 = (s32) (temp_t6 | 0xF2080000); + temp_a0_16->unk4 = (s32) (temp_t9 | 0x100000); temp_a0_17 = temp_a0_16 + 8; - temp_a0_17->unk0 = (((((temp_v1 - arg5) + 0x20) * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t7_2; + temp_a0_17->unk0 = (s32) ((((((temp_v1 - arg5) + 0x20) * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t7_2); temp_a0_18 = temp_a0_17 + 8; - temp_a0_17->unk4 = (((temp_v1 * 4) & 0xFFF) << 0xC) | temp_t8_3; + temp_a0_17->unk4 = (s32) ((((temp_v1 * 4) & 0xFFF) << 0xC) | temp_t8_3); temp_a0_19 = temp_a0_18 + 8; temp_a0_18->unk0 = 0xB3000000; temp_a0_18->unk4 = 0; @@ -3461,8 +3500,8 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097AE4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80097E58(void *arg0, s8 arg1, ? arg2, u32 arg3, u32 arg5, s32 arg6, s32 arg7, s32 arg8, u32 arg9, s32 argB) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80097E58(Gfx *arg0, s8 arg1, s32 arg2, u32 arg3, u32 arg5, s32 arg6, s32 arg7, s32 arg8, u32 arg9, s32 argB, s32 argB) { s32 spEC; s32 spDC; s32 sp80; @@ -3471,6 +3510,7 @@ void *func_80097E58(void *arg0, s8 arg1, ? arg2, u32 arg3, u32 arg5, s32 arg6, s s32 sp40; s32 sp3C; s32 sp30; + Gfx *temp_a0_20; s32 temp_a1; s32 temp_a3; s32 temp_s0; @@ -3502,7 +3542,6 @@ void *func_80097E58(void *arg0, s8 arg1, ? arg2, u32 arg3, u32 arg5, s32 arg6, s void *temp_a0_17; void *temp_a0_18; void *temp_a0_19; - void *temp_a0_20; void *temp_a0_2; void *temp_a0_3; void *temp_a0_4; @@ -3512,8 +3551,8 @@ void *func_80097E58(void *arg0, s8 arg1, ? arg2, u32 arg3, u32 arg5, s32 arg6, s void *temp_a0_8; void *temp_a0_9; u32 phi_t4; - s32 phi_s3; - void *phi_a0; + u32 phi_s3; + Gfx *phi_a0; s32 phi_t2; s32 phi_s0; s32 phi_s2; @@ -3526,25 +3565,25 @@ void *func_80097E58(void *arg0, s8 arg1, ? arg2, u32 arg3, u32 arg5, s32 arg6, s s32 phi_s6; s32 phi_t3; s32 phi_s5; - void *phi_a0_2; + Gfx *phi_a0_2; phi_a0 = arg0; phi_a0_2 = arg0; if (argB >= 0x20) { } else { - temp_t0 = arg9 >> 1; - temp_t7 = arg9 - temp_t0; + temp_t0 = (u32) argB >> 1; + temp_t7 = argB - temp_t0; sp80 = temp_t7; spDC = temp_t7; - spEC = arg6; + spEC = arg7; phi_t4 = arg3; - phi_s4 = arg6; - if (arg3 < arg5) { + phi_s4 = arg7; + if (arg3 < (u32) arg6) { loop_3: phi_a0_2 = phi_a0; - if (arg5 < (phi_t4 + 0x20)) { - temp_v0 = arg5 - phi_t4; + if ((u32) arg6 < (u32) (phi_t4 + 0x20)) { + temp_v0 = arg6 - phi_t4; phi_s2 = temp_v0; if (temp_v0 != 0) { temp_t9 = (arg1 & 7) << 0x15; @@ -3553,21 +3592,21 @@ loop_3: temp_t6 = temp_t9 | 0xF5000000 | 0x100000; sp60 = temp_t0 << 0x15; temp_t6_2 = ((temp_t0 * 4) & 0xFFF) << 0xC; - sp5C = ((((sp80 << 5) << 0xA) / (sp80 * temp_v1)) << 0x10) | 0x400; - temp_t7_2 = ((arg9 * 4) & 0xFFF) << 0xC; + sp5C = (((s32) ((sp80 << 5) << 0xA) / (s32) (sp80 * temp_v1)) << 0x10) | 0x400; + temp_t7_2 = ((argB * 4) & 0xFFF) << 0xC; sp40 = temp_t6_2 | 0xF4000000; - sp3C = ((((temp_t0 << 5) << 0xA) / (temp_t0 * temp_v1)) << 0x10) | 0x400; - phi_s3 = temp_t9 | 0xFD000000 | 0x100000 | ((arg9 - 1) & 0xFFF); - phi_t2 = temp_t6 | (((((temp_t0 * 2) + 9) >> 3) & 0x1FF) << 9); - phi_s0 = temp_t6_2 | 0x7000000; + sp3C = (((s32) ((temp_t0 << 5) << 0xA) / (s32) (temp_t0 * temp_v1)) << 0x10) | 0x400; + phi_s3 = temp_t9 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); + phi_t2 = temp_t6 | ((((u32) ((temp_t0 * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s0 = temp_t6_2 | 0x07000000; phi_v0 = temp_t6_2; - phi_s1 = (temp_t0 * argB) / 0x20; - phi_ra = temp_t6 | ((((((arg9 - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); - phi_s7 = temp_t7_2 | 0x7000000; - phi_fp = temp_t6 | ((((((arg9 - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s1 = (s32) (temp_t0 * argB) / 32; + phi_ra = temp_t6 | ((((u32) (((argB - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s7 = temp_t7_2 | 0x07000000; + phi_fp = temp_t6 | ((((u32) (((argB - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); phi_s6 = temp_t6_2 | 0xF2000000; phi_t3 = temp_t7_2; - phi_s5 = (spDC * temp_v1) / 0x20; + phi_s5 = (s32) (spDC * temp_v1) / 32; goto block_7; } } else { @@ -3577,27 +3616,27 @@ loop_3: temp_t7_3 = temp_t8 | 0xF5000000 | 0x100000; sp60 = temp_t0 << 0x15; temp_t7_4 = ((temp_t0 * 4) & 0xFFF) << 0xC; - sp5C = ((((sp80 << 5) << 0xA) / (sp80 * temp_v1_2)) << 0x10) | 0x400; - temp_t6_3 = ((arg9 * 4) & 0xFFF) << 0xC; + sp5C = (((s32) ((sp80 << 5) << 0xA) / (s32) (sp80 * temp_v1_2)) << 0x10) | 0x400; + temp_t6_3 = ((argB * 4) & 0xFFF) << 0xC; sp40 = temp_t7_4 | 0xF4000000; - sp3C = ((((temp_t0 << 5) << 0xA) / (temp_t0 * temp_v1_2)) << 0x10) | 0x400; - phi_s3 = temp_t8 | 0xFD000000 | 0x100000 | ((arg9 - 1) & 0xFFF); - phi_t2 = temp_t7_3 | (((((temp_t0 * 2) + 9) >> 3) & 0x1FF) << 9); - phi_s0 = temp_t7_4 | 0x7000000; + sp3C = (((s32) ((temp_t0 << 5) << 0xA) / (s32) (temp_t0 * temp_v1_2)) << 0x10) | 0x400; + phi_s3 = temp_t8 | 0xFD000000 | 0x100000 | ((argB - 1) & 0xFFF); + phi_t2 = temp_t7_3 | ((((u32) ((temp_t0 * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s0 = temp_t7_4 | 0x07000000; phi_s2 = 0x20; phi_v0 = temp_t7_4; - phi_s1 = (temp_t0 * argB) / 0x20; - phi_ra = temp_t7_3 | ((((((arg9 - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); - phi_s7 = temp_t6_3 | 0x7000000; - phi_fp = temp_t7_3 | ((((((arg9 - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s1 = (s32) (temp_t0 * argB) / 32; + phi_ra = temp_t7_3 | ((((u32) (((argB - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); + phi_s7 = temp_t6_3 | 0x07000000; + phi_fp = temp_t7_3 | ((((u32) (((argB - temp_t0) * 2) + 9) >> 3) & 0x1FF) << 9); phi_s6 = temp_t7_4 | 0xF2000000; phi_t3 = temp_t6_3; - phi_s5 = (spDC * temp_v1_2) / 0x20; + phi_s5 = (s32) (spDC * temp_v1_2) / 32; block_7: - phi_a0->unk0 = phi_s3; + phi_a0->words.w0 = phi_s3; temp_a0 = phi_a0 + 8; - phi_a0->unk4 = arg8; - temp_a0->unk4 = 0x7014050; + phi_a0->words.w1 = arg9; + temp_a0->unk4 = 0x07014050; temp_a0_2 = temp_a0 + 8; temp_a0->unk0 = phi_t2; temp_t9_2 = (phi_t4 * 4) & 0xFFF; @@ -3605,23 +3644,23 @@ block_7: temp_a0_2->unk0 = 0xE6000000; temp_a3 = ((phi_t4 + phi_s2) * 4) & 0xFFF; temp_a0_2->unk4 = 0; - temp_a0_3->unk0 = temp_t9_2 | 0xF4000000; + temp_a0_3->unk0 = (s32) (temp_t9_2 | 0xF4000000); temp_a0_4 = temp_a0_3 + 8; - temp_a0_3->unk4 = phi_s0 | temp_a3; + temp_a0_3->unk4 = (s32) (phi_s0 | temp_a3); temp_a0_5 = temp_a0_4 + 8; temp_a0_4->unk0 = 0xE7000000; temp_a0_4->unk4 = 0; temp_a0_6 = temp_a0_5 + 8; temp_a0_5->unk4 = 0x14050; temp_a0_5->unk0 = phi_t2; - temp_a0_6->unk4 = phi_v0 | temp_a3; - temp_a0_6->unk0 = temp_t9_2 | 0xF2000000; + temp_a0_6->unk4 = (s32) (phi_v0 | temp_a3); + temp_a0_6->unk0 = (s32) (temp_t9_2 | 0xF2000000); temp_s0 = phi_s4 + temp_t0; - temp_t1 = ((arg7 + phi_s2) * 4) & 0xFFF; + temp_t1 = ((arg8 + phi_s2) * 4) & 0xFFF; temp_a0_7 = temp_a0_6 + 8; - temp_a0_7->unk0 = (((temp_s0 * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t1; - temp_t2 = (arg7 * 4) & 0xFFF; - temp_a0_7->unk4 = ((((phi_s1 + phi_s4) * 4) & 0xFFF) << 0xC) | temp_t2; + temp_a0_7->unk0 = (s32) ((((temp_s0 * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t1); + temp_t2 = (arg8 * 4) & 0xFFF; + temp_a0_7->unk4 = (s32) (((((phi_s1 + phi_s4) * 4) & 0xFFF) << 0xC) | temp_t2); temp_a0_8 = temp_a0_7 + 8; temp_a1 = (phi_t4 << 5) & 0xFFFF; temp_a0_9 = temp_a0_8 + 8; @@ -3632,41 +3671,41 @@ block_7: temp_a0_9->unk4 = sp3C; temp_a0_10->unk0 = phi_s3; temp_a0_11 = temp_a0_10 + 8; - temp_a0_10->unk4 = arg8; + temp_a0_10->unk4 = arg9; temp_a0_12 = temp_a0_11 + 8; - temp_a0_11->unk4 = 0x7014050; + temp_a0_11->unk4 = 0x07014050; temp_a0_11->unk0 = phi_ra; temp_a0_12->unk0 = 0xE6000000; temp_a0_12->unk4 = 0; temp_a0_13 = temp_a0_12 + 8; temp_a0_14 = temp_a0_13 + 8; - temp_a0_13->unk0 = sp40 | temp_t9_2; - temp_a0_13->unk4 = phi_s7 | temp_a3; + temp_a0_13->unk0 = (s32) (sp40 | temp_t9_2); + temp_a0_13->unk4 = (s32) (phi_s7 | temp_a3); temp_a0_15 = temp_a0_14 + 8; temp_a0_14->unk0 = 0xE7000000; temp_a0_14->unk4 = 0; temp_a0_15->unk4 = 0x14050; temp_a0_16 = temp_a0_15 + 8; temp_a0_15->unk0 = phi_fp; - temp_a0_16->unk0 = phi_s6 | temp_t9_2; - temp_a0_16->unk4 = phi_t3 | temp_a3; + temp_a0_16->unk0 = (s32) (phi_s6 | temp_t9_2); + temp_a0_16->unk4 = (s32) (phi_t3 | temp_a3); temp_a0_17 = temp_a0_16 + 8; - temp_a0_17->unk0 = ((((phi_s5 + temp_s0) * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t1; - temp_a0_17->unk4 = (((temp_s0 * 4) & 0xFFF) << 0xC) | temp_t2; + temp_a0_17->unk0 = (s32) (((((phi_s5 + temp_s0) * 4) & 0xFFF) << 0xC) | 0xE4000000 | temp_t1); + temp_a0_17->unk4 = (s32) ((((temp_s0 * 4) & 0xFFF) << 0xC) | temp_t2); temp_a0_18 = temp_a0_17 + 8; temp_a0_18->unk0 = 0xB3000000; temp_a0_19 = temp_a0_18 + 8; - temp_a0_18->unk4 = sp60 | temp_a1; + temp_a0_18->unk4 = (s32) (sp60 | temp_a1); temp_a0_19->unk0 = 0xB2000000; temp_t4 = phi_t4 + 0x20; temp_a0_20 = temp_a0_19 + 8; temp_a0_19->unk4 = sp5C; - arg7 += 0x20; + arg8 += 0x20; phi_t4 = temp_t4; phi_a0 = temp_a0_20; phi_s4 = spEC; phi_a0_2 = temp_a0_20; - if (temp_t4 < arg5) { + if (temp_t4 < (u32) arg6) { goto loop_3; } } @@ -3679,16 +3718,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097E58.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -f32 sins(s32); // extern -f32 coss(s32); // extern -extern s32 D_8018D9B0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +extern u32 D_8018D9B0; extern u32 D_8018E7B8; extern s32 D_8018E7D0; -void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5, s32 arg6, s32 arg8) { +Gfx *func_800987D0(Gfx *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5, s32 arg6, s32 arg8, s32 arg8) { u32 sp60; s32 sp5C; + Gfx *temp_s0_10; f32 temp_f0; f32 temp_f18; f32 temp_f24; @@ -3702,14 +3740,13 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 s32 temp_t4; s32 temp_t8; s32 temp_t8_2; - s32 temp_v0_2; s32 temp_v0_3; + s32 temp_v0_4; u32 temp_t2; u32 temp_t9; u32 temp_v0; - u32 temp_v0_4; + u32 temp_v0_2; void *temp_s0; - void *temp_s0_10; void *temp_s0_2; void *temp_s0_3; void *temp_s0_4; @@ -3720,15 +3757,15 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 void *temp_s0_9; u32 phi_v0; u32 phi_v0_2; - void *phi_s0; + Gfx *phi_s0; u32 phi_a2; s32 phi_t5; f32 phi_f6; f64 phi_f10; u32 phi_v0_3; - void *phi_s0_2; - void *phi_s0_3; - void *phi_s0_4; + Gfx *phi_s0_2; + Gfx *phi_s0_3; + Gfx *phi_s0_4; temp_v0 = D_8018E7B8; phi_v0 = temp_v0; @@ -3736,25 +3773,25 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 phi_s0_3 = arg0; if (temp_v0 == 0) { D_8018E7B8 = 1; - phi_v0 = 1; + phi_v0 = 1U; } - temp_f24 = sins((((D_8018E7D0 * 0x4E20) / phi_v0) % 0x4E20) & 0xFFFF); - temp_f0 = coss((((D_8018E7D0 * 0x4E20) / D_8018E7B8) % 0x4E20) & 0xFFFF); + temp_f24 = sins(((u32) ((u32) (D_8018E7D0 * 0x4E20U) / phi_v0) % 20000U) & 0xFFFF); + temp_f0 = coss(((u32) ((u32) (D_8018E7D0 * 0x4E20U) / (u32) D_8018E7B8) % 20000U) & 0xFFFF); temp_t8 = D_8018E7D0; - temp_f6 = temp_t8; + temp_f6 = (f32) temp_t8; phi_f6 = temp_f6; phi_t5 = arg5; if (temp_t8 < 0) { phi_f6 = temp_f6 + 4294967296.0f; } temp_t9 = D_8018E7B8; - temp_f10 = temp_t9; + temp_f10 = (f64) temp_t9; phi_f10 = temp_f10; - if (temp_t9 < 0) { + if ((s32) temp_t9 < 0) { phi_f10 = temp_f10 + 4294967296.0; } sp5C = arg5; - temp_f18 = ((phi_f6 * 0.5) / phi_f10) + 1.0; + temp_f18 = (f32) ((((f64) phi_f6 * 0.5) / phi_f10) + 1.0); phi_v0_2 = arg2; if (arg2 < arg4) { do { @@ -3764,47 +3801,47 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 phi_s0_4 = phi_s0_3; if (arg1 < arg3) { sp60 = phi_v0_2; - temp_v0_2 = arg6 - 0x78; + temp_v0_3 = arg6 - 0x78; temp_t8_2 = (phi_v0_2 * 4) & 0xFFF; temp_t4 = ((phi_v0_2 + 0x20) * 4) & 0xFFF; do { - phi_s0->unk0 = ((arg8 - 1) & 0xFFF) | 0xFD100000; + phi_s0->words.w0 = ((arg8 - 1) & 0xFFF) | 0xFD100000; temp_s0 = phi_s0 + 8; - phi_s0->unk4 = D_8018D9B0; + phi_s0->words.w1 = D_8018D9B0; temp_s0_2 = temp_s0 + 8; - temp_a3 = (((((arg1 * 0 * 2) + 0x49) >> 3) & 0x1FF) << 9) | 0xF5100000; + temp_a3 = ((((s32) ((arg1 * 0 * 2) + 0x49) >> 3) & 0x1FF) << 9) | 0xF5100000; temp_t1 = ((phi_a2 * 4) & 0xFFF) << 0xC; temp_t2 = phi_a2 + 0x20; temp_s0_3 = temp_s0_2 + 8; temp_s0->unk0 = temp_a3; - temp_s0->unk4 = 0x7014050; - temp_v0_3 = ((temp_t2 * 4) & 0xFFF) << 0xC; + temp_s0->unk4 = 0x07014050; + temp_v0_4 = ((temp_t2 * 4) & 0xFFF) << 0xC; temp_s0_2->unk4 = 0; temp_s0_2->unk0 = 0xE6000000; - temp_s0_3->unk0 = temp_t1 | 0xF4000000 | temp_t8_2; + temp_s0_3->unk0 = (s32) (temp_t1 | 0xF4000000 | temp_t8_2); temp_s0_4 = temp_s0_3 + 8; - temp_s0_3->unk4 = temp_v0_3 | 0x7000000 | temp_t4; + temp_s0_3->unk4 = (s32) (temp_v0_4 | 0x07000000 | temp_t4); temp_s0_5 = temp_s0_4 + 8; temp_s0_4->unk4 = 0; temp_s0_4->unk0 = 0xE7000000; temp_s0_5->unk4 = 0x14050; temp_s0_5->unk0 = temp_a3; temp_s0_6 = temp_s0_5 + 8; - temp_f2 = phi_t5 - 0xA0; - temp_s0_6->unk4 = temp_v0_3 | temp_t4; - temp_s0_6->unk0 = temp_t1 | 0xF2000000 | temp_t8_2; + temp_f2 = (f32) (phi_t5 - 0xA0); + temp_s0_6->unk4 = (s32) (temp_v0_4 | temp_t4); + temp_s0_6->unk0 = (s32) (temp_t1 | 0xF2000000 | temp_t8_2); temp_s0_7 = temp_s0_6 + 8; temp_s0_8 = temp_s0_7 + 8; temp_s0_9 = temp_s0_8 + 8; temp_s0_10 = temp_s0_9 + 8; - temp_f6_2 = (((temp_f2 * temp_f0) + (temp_f24 * temp_v0_2)) * temp_f18) + 160.0f; - temp_f4 = (((-temp_f24 * temp_f2) + (temp_f0 * temp_v0_2)) * temp_f18) + 120.0f; - temp_s0_7->unk0 = ((((temp_f6_2 + 0x20) * 4) & 0xFFF) << 0xC) | 0xE4000000 | (((temp_f4 + 0x20) * 4) & 0xFFF); - temp_s0_7->unk4 = (((temp_f6_2 * 4) & 0xFFF) << 0xC) | ((temp_f4 * 4) & 0xFFF); + temp_f6_2 = (s32) ((((temp_f2 * temp_f0) + (temp_f24 * (f32) temp_v0_3)) * temp_f18) + 160.0f); + temp_f4 = (s32) ((((-temp_f24 * temp_f2) + (temp_f0 * (f32) temp_v0_3)) * temp_f18) + 120.0f); + temp_s0_7->unk0 = (s32) (((((temp_f6_2 + 0x20) * 4) & 0xFFF) << 0xC) | 0xE4000000 | (((temp_f4 + 0x20) * 4) & 0xFFF)); + temp_s0_7->unk4 = (s32) ((((temp_f6_2 * 4) & 0xFFF) << 0xC) | ((temp_f4 * 4) & 0xFFF)); temp_s0_8->unk0 = 0xB3000000; temp_s0_8->unk4 = 0; temp_s0_9->unk0 = 0xB2000000; - temp_s0_9->unk4 = 0x4000400; + temp_s0_9->unk4 = 0x04000400; phi_s0 = temp_s0_10; phi_a2 = temp_t2; phi_t5 += 0x20; @@ -3812,13 +3849,13 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 } while (temp_t2 < arg3); phi_v0_3 = sp60; } - temp_v0_4 = phi_v0_3 + 0x20; + temp_v0_2 = phi_v0_3 + 0x20; arg6 += 0x20; - phi_v0_2 = temp_v0_4; + phi_v0_2 = temp_v0_2; phi_s0_2 = phi_s0_4; phi_s0_3 = phi_s0_4; phi_t5 = sp5C; - } while (temp_v0_4 < arg4); + } while (temp_v0_2 < arg4); } return phi_s0_2; } @@ -4126,30 +4163,28 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800996BC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? dma_copy_base_729a30(s32, s32, u8 *); // extern -void *segmented_to_virtual(void*); // extern -extern u8 *D_8018D9B4; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? dma_copy_base_729a30(u64 *, s32, s32); /* extern */ +? mio0decode(s32, void *); /* extern */ +extern s32 D_8018D9B4; -void func_80099958(s32 arg1, s32 arg2) { - s32 temp_a0; - s32 temp_t6; +void func_80099958(MkTexture *arg0, s32 arg1, s32 arg2) { + MkTexture *temp_v0; u16 temp_v0_2; - u8 *temp_s2; - void *temp_v0; - void *phi_s0; + u64 *temp_a0; + u64 *temp_t6; + MkTexture *phi_s0; s32 phi_a1; - s32 phi_a0; + u64 *phi_a0; s32 phi_a1_2; temp_v0 = segmented_to_virtual(arg0); - temp_t6 = temp_v0->unk4; + temp_t6 = temp_v0->textureData; phi_s0 = temp_v0; phi_a0 = temp_t6; if (temp_t6 != 0) { - temp_s2 = &D_802BFB80[(arg2 << 0x10) + ((arg1 / 2) << 0xF) + ((arg1 % 2) << 0xD) + 0x4000]; do { - temp_v0_2 = phi_s0->unk10; + temp_v0_2 = phi_s0->size; phi_a1 = 0x1400; if (temp_v0_2 != 0) { phi_a1 = temp_v0_2 & 0xFFFF; @@ -4159,7 +4194,7 @@ void func_80099958(s32 arg1, s32 arg2) { phi_a1_2 = (((phi_a1 / 8) * 8) + 8) & 0xFFFF; } dma_copy_base_729a30(phi_a0, phi_a1_2, D_8018D9B4); - mio0decode(D_8018D9B4, temp_s2); + mio0decode(D_8018D9B4, (arg2 << 0x10) + ((arg1 / 2) << 0xF) + ((arg1 % 2) << 0xD) + 0x4000 + D_802BFB80); temp_a0 = phi_s0->unk18; phi_s0 += 0x14; phi_a0 = temp_a0; @@ -4190,15 +4225,14 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099A70.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(void*); // extern -extern s32 D_8018E060; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +extern void *D_8018E060; -void func_80099A94(s32 arg1) { - s32 *sp1C; - s32 *temp_v1; - s32 *phi_v1; - s32 *phi_v1_2; +void func_80099A94(MkTexture *arg0, s32 arg1) { + void **sp1C; + void **temp_v1; + void **phi_v1; + void **phi_v1_2; phi_v1 = &D_8018E060; phi_v1_2 = &D_8018E060; @@ -4344,15 +4378,14 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099E54.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(void*); // extern -extern s32 D_8018E0E8; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +extern void *D_8018E0E8; -void func_80099E60(s32 arg1, s32 arg2) { - s32 *sp1C; - s32 *temp_v1; - s32 *phi_v1; - s32 *phi_v1_2; +void func_80099E60(MkTexture *arg0, s32 arg1, s32 arg2) { + void **sp1C; + void **temp_v1; + void **phi_v1; + void **phi_v1_2; phi_v1 = &D_8018E0E8; phi_v1_2 = &D_8018E0E8; @@ -4365,8 +4398,8 @@ void func_80099E60(s32 arg1, s32 arg2) { } sp1C = phi_v1_2; phi_v1_2->unk0 = segmented_to_virtual(arg0); - phi_v1_2->unk4 = arg1; - phi_v1_2->unk6 = arg2; + phi_v1_2->unk4 = (s16) arg1; + phi_v1_2->unk6 = (s16) arg2; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099E60.s") @@ -5145,10 +5178,11 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B538.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s32 D_8018D9B0; +extern s32 gNumD_8018E118Entries; -s32 func_8009B8C4(u32 arg0) { +s32 func_8009B8C4(u64 *arg0) { s32 sp4; s32 temp_a1; s32 temp_v1; @@ -5198,18 +5232,17 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B938.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(void*); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s32 D_8018E75C; extern s32 D_8018E760; extern ? D_8018E768; -void func_8009B954(void) { +void func_8009B954(MkTexture *arg0) { void *temp_v1; temp_v1 = (D_8018E760 * 8) + &D_8018E768; - temp_v1->unk0 = segmented_to_virtual(); - temp_v1->unk4 = D_8018E75C; + temp_v1->unk0 = segmented_to_virtual(arg0); + temp_v1->unk4 = (s32) D_8018E75C; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B954.s") @@ -5234,25 +5267,24 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B998.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(void*); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern ? D_8018E768; extern ? D_8018E7A8; -void *func_8009B9D0(void *arg0, ? arg1) { - s32 sp34; +Gfx *func_8009B9D0(Gfx *arg0, MkTexture *arg1) { + u32 sp34; s32 sp2C; ? *temp_s0; - void *temp_t0; - void *temp_v0; + Gfx *temp_t0; + MkTexture *temp_v0; ? *phi_s0; - void *phi_v0; + Gfx *phi_v0; sp2C = 0; phi_s0 = &D_8018E768; loop_1: temp_v0 = segmented_to_virtual(arg1); - phi_v0 = temp_v0; + phi_v0 = (Gfx *) temp_v0; if (temp_v0 == phi_s0->unk0) { sp2C = 1; sp34 = phi_s0->unk4; @@ -5266,8 +5298,8 @@ loop_1: temp_t0 = arg0; if (sp2C != 0) { arg0 = temp_t0 + 8; - temp_t0->unk0 = 0x6000000; - temp_t0->unk4 = sp34; + temp_t0->words.w0 = 0x06000000; + temp_t0->words.w1 = sp34; phi_v0 = arg0; } return phi_v0; @@ -5277,84 +5309,80 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B9D0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ -void *func_800987D0(void *, ?, ?, u16, s32, s32, s32, s32, s32, s32); /* extern */ -void *segmented_to_virtual(void*); /* extern */ -static ? D_02007708; /* unable to generate initializer */ -static ? D_02007728; /* unable to generate initializer */ -static ? D_02007748; /* unable to generate initializer */ -static ? D_02007768; /* unable to generate initializer */ -static ? D_02007788; /* unable to generate initializer */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80095E10(Gfx *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +Gfx *func_800987D0(Gfx *, ?, ?, u16, s32, s32, s32, s32, s32, s32); /* extern */ +s32 func_8009B8C4(u64 *); /* extern */ +extern s8 D_8018E7B0; -void *func_8009BA74(void *arg0, s32 arg1, s32 arg2, s32 arg3) { +Gfx *func_8009BA74(Gfx *arg0, MkTexture *arg1, s32 column, s32 row) { + MkTexture *temp_v0; s32 temp_v0_2; u16 temp_s1; u16 temp_s1_2; u16 temp_t7; u16 temp_v0_3; u16 temp_v0_4; - void *temp_v0; - void *phi_s2; - void *phi_s0; - void *phi_s0_2; + MkTexture *phi_s2; + Gfx *phi_s0; + Gfx *phi_s0_2; s8 phi_s4; - void *phi_s0_3; - void *phi_s0_4; - void *phi_v0; + Gfx *phi_s0_3; + Gfx *phi_s0_4; + Gfx *phi_v0; temp_v0 = segmented_to_virtual(arg1); phi_s2 = temp_v0; phi_s0 = arg0; phi_s0_3 = arg0; - if (temp_v0->unk4 != 0) { + if (temp_v0->textureData != 0) { do { - temp_t7 = phi_s2->unk0; + temp_t7 = phi_s2->type; phi_s4 = 0; switch (temp_t7) { case 0: - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007708; + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007708; phi_s0_2 = phi_s0 + 8; break; case 1: - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; phi_s0_2 = phi_s0 + 8; break; case 2: - phi_s0->unk4 = &D_02007748; - phi_s0->unk0 = 0x6000000; + phi_s0->words.w1 = D_02007748; + phi_s0->words.w0 = 0x06000000; phi_s0_2 = phi_s0 + 8; break; case 3: - phi_s0->unk4 = &D_02007768; - phi_s0->unk0 = 0x6000000; + phi_s0->words.w1 = D_02007768; + phi_s0->words.w0 = 0x06000000; phi_s0_2 = phi_s0 + 8; phi_s4 = 3; break; case 4: - phi_s0->unk4 = &D_02007788; - phi_s0->unk0 = 0x6000000; + phi_s0->words.w1 = D_02007788; + phi_s0->words.w0 = 0x06000000; phi_s0_2 = phi_s0 + 8; break; default: - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; phi_s0_2 = phi_s0 + 8; break; } - temp_v0_2 = func_8009B8C4(phi_s2->unk4); + temp_v0_2 = func_8009B8C4(phi_s2->textureData); phi_s0_4 = phi_s0_2; if (temp_v0_2 != 0) { if (D_8018E7B0 != 4) { - temp_s1 = phi_s2->unk8; - temp_v0_3 = phi_s2->unkA; - phi_v0 = func_80095E10(phi_s0_2, phi_s4, 0x400, 0x400, 0, 0, temp_s1, temp_v0_3, phi_s2->unkC + arg2, phi_s2->unkE + arg3, temp_v0_2, temp_s1, temp_v0_3); + temp_s1 = phi_s2->width; + temp_v0_3 = phi_s2->height; + phi_v0 = func_80095E10(phi_s0_2, phi_s4, 0x400, 0x400, 0, 0, (s32) temp_s1, (s32) temp_v0_3, phi_s2->dX + column, phi_s2->dY + row, temp_v0_2, (s32) temp_s1, (s32) temp_v0_3); } else { - temp_v0_4 = phi_s2->unkA; - temp_s1_2 = phi_s2->unk8; - phi_v0 = func_800987D0(phi_s0_2, 0, 0, temp_s1_2, temp_v0_4, phi_s2->unkC + arg2, phi_s2->unkE + arg3, temp_v0_2, temp_s1_2, temp_v0_4); + temp_v0_4 = phi_s2->height; + temp_s1_2 = phi_s2->width; + phi_v0 = func_800987D0(phi_s0_2, 0, 0, temp_s1_2, (s32) temp_v0_4, phi_s2->dX + column, phi_s2->dY + row, temp_v0_2, (s32) temp_s1_2, (s32) temp_v0_4); } phi_s0_4 = phi_v0; } @@ -5370,17 +5398,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BA74.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80097274(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_80097A14(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_80097AE4(void *, ?, s32, s32, s32, s32); // extern -void *func_80097E58(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern -s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_02007708; -extern ? D_02007728; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80097274(Gfx *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +Gfx *func_80097A14(Gfx *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32); /* extern */ +Gfx *func_80097AE4(Gfx *, ?, s32, s32, s32, s32); /* extern */ +Gfx *func_80097E58(Gfx *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +s32 func_8009B8C4(u64 *); /* extern */ -void *func_8009BC9C(void *arg0, ? arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { +Gfx *func_8009BC9C(Gfx *arg0, MkTexture *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { + MkTexture *temp_v0; s16 temp_v0_2; s32 temp_v0_3; u16 temp_v0_4; @@ -5389,65 +5415,57 @@ void *func_8009BC9C(void *arg0, ? arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) u16 temp_v1; u16 temp_v1_2; u16 temp_v1_3; - void *temp_v0; - void *phi_s0; - void *phi_s1; - void *phi_s1_2; - void *phi_s1_3; - void *phi_s1_4; - void *phi_v0; + MkTexture *phi_s0; + Gfx *phi_s1; + Gfx *phi_s1_2; + Gfx *phi_s1_3; + Gfx *phi_s1_4; + Gfx *phi_v0; temp_v0 = segmented_to_virtual(arg1); phi_s0 = temp_v0; phi_s1 = arg0; phi_s1_3 = arg0; - if (temp_v0->unk4 != 0) { + if (temp_v0->textureData != 0) { do { - temp_v0_2 = phi_s0->unk0; + temp_v0_2 = phi_s0->type; phi_s1_2 = phi_s1; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - - } else { - phi_s1->unk4 = &D_02007728; - phi_s1->unk0 = 0x6000000; - phi_s1_2 = phi_s1 + 8; - } - } else { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_02007708; + switch (temp_v0_2) { /* irregular */ + case 0: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_02007708; phi_s1_2 = phi_s1 + 8; + break; + case 1: + phi_s1->words.w1 = D_02007728; + phi_s1->words.w0 = 0x06000000; + phi_s1_2 = phi_s1 + 8; + break; } - temp_v0_3 = func_8009B8C4(phi_s0->unk4); + temp_v0_3 = func_8009B8C4(phi_s0->textureData); phi_s1_4 = phi_s1_2; if (temp_v0_3 != 0) { - if (arg4 != 1) { - if (arg4 != 2) { - if (arg4 != 3) { - if (arg4 != 4) { - - } else { - temp_v0_4 = phi_s0->unk8; - temp_v1 = phi_s0->unkA; - phi_v0 = func_80097274(phi_s1_2, 0, 0x400, 0x400, 0, 0, temp_v0_4, temp_v1, phi_s0->unkC + arg2, phi_s0->unkE + arg3, temp_v0_3, temp_v0_4, temp_v1, arg5); - goto block_17; - } - } else { - temp_v0_5 = phi_s0->unk8; - temp_v1_2 = phi_s0->unkA; - phi_v0 = func_80097A14(phi_s1_2, 0, 0, 0, temp_v0_5, temp_v1_2, phi_s0->unkC + arg2, phi_s0->unkE + arg3, temp_v0_3, temp_v0_5, temp_v1_2); - goto block_17; - } - } else { - temp_v0_6 = phi_s0->unk8; - temp_v1_3 = phi_s0->unkA; - phi_v0 = func_80097E58(phi_s1_2, 0, 0, 0, temp_v0_6, temp_v1_3, phi_s0->unkC + arg2, phi_s0->unkE + arg3, temp_v0_3, temp_v0_6, temp_v1_3, arg5); - goto block_17; - } - } else { - phi_v0 = func_80097AE4(phi_s1_2, 0, phi_s0->unkC + arg2, phi_s0->unkE + arg3, temp_v0_3, arg5); + switch (arg4) { /* switch 1; irregular */ + case 1: /* switch 1 */ + phi_v0 = func_80097AE4(phi_s1_2, 0, phi_s0->dX + arg2, phi_s0->dY + arg3, temp_v0_3, arg5); block_17: phi_s1_4 = phi_v0; + break; + case 2: /* switch 1 */ + temp_v0_4 = phi_s0->width; + temp_v1 = phi_s0->height; + phi_v0 = func_80097E58(phi_s1_2, 0, 0, 0, (s32) temp_v0_4, (s32) temp_v1, phi_s0->dX + arg2, phi_s0->dY + arg3, temp_v0_3, (s32) temp_v0_4, (s32) temp_v1, arg5); + goto block_17; + case 3: /* switch 1 */ + temp_v0_5 = phi_s0->width; + temp_v1_2 = phi_s0->height; + phi_v0 = func_80097A14(phi_s1_2, 0, 0, 0, (s32) temp_v0_5, (s32) temp_v1_2, phi_s0->dX + arg2, phi_s0->dY + arg3, temp_v0_3, (s32) temp_v0_5, (s32) temp_v1_2); + goto block_17; + case 4: /* switch 1 */ + temp_v0_6 = phi_s0->width; + temp_v1_3 = phi_s0->height; + phi_v0 = func_80097274(phi_s1_2, 0, 0x400, 0x400, 0, 0, (s32) temp_v0_6, (s32) temp_v1_3, phi_s0->dX + arg2, phi_s0->dY + arg3, temp_v0_3, (s32) temp_v0_6, (s32) temp_v1_3, arg5); + goto block_17; } } phi_s0 += 0x14; @@ -5462,14 +5480,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BC9C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80095BD0(void *, s32, f32, f32, s32, s32, f32, f32); // extern -s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_020077F8; -extern ? D_02007818; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80095BD0(void *, s32, f32, f32, s32, s32, f32, f32); /* extern */ +s32 func_8009B8C4(u64 *); /* extern */ -void *func_8009BEF0(void *arg0, ? arg1, f32 arg2, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { +Gfx *func_8009BEF0(Gfx *arg0, MkTexture *arg1, f32 arg2, f32 arg3, s32 arg4, f32 arg5, f32 arg6) { + MkTexture *temp_s0; + MkTexture *temp_v0; f32 temp_f0; f32 temp_f0_2; f32 temp_f10; @@ -5490,70 +5507,68 @@ void *func_8009BEF0(void *arg0, ? arg1, f32 arg2, f32 arg3, s32 arg4, f32 arg5, u16 temp_t7; u16 temp_t8; u16 temp_t9; - void *temp_s0; - void *temp_v0; - void *phi_s0; + MkTexture *phi_s0; f32 phi_f6; f32 phi_f16; f32 phi_f6_2; f32 phi_f16_2; s32 phi_v0; - void *phi_s1; + Gfx *phi_s1; f32 phi_f16_3; f32 phi_f4; f32 phi_f18; f32 phi_f10; - void *phi_s1_2; + Gfx *phi_s1_2; s32 phi_v0_2; - void *phi_s1_3; + Gfx *phi_s1_3; s32 phi_v0_3; - void *phi_v0_4; + Gfx *phi_v0_4; s32 phi_v0_5; temp_v0 = segmented_to_virtual(arg1); phi_s0 = temp_v0; phi_s1 = arg0; phi_s1_2 = arg0; - if (temp_v0->unk4 != 0) { + if (temp_v0->textureData != 0) { do { - temp_t7 = phi_s0->unkC; - temp_f6 = temp_t7; + temp_t7 = phi_s0->dX; + temp_f6 = (f32) temp_t7; phi_f6 = temp_f6; phi_s1_3 = phi_s1; phi_v0_5 = 0; - if (temp_t7 < 0) { + if ((s32) temp_t7 < 0) { phi_f6 = temp_f6 + 4294967296.0f; } temp_f0 = phi_f6 + arg2; if (temp_f0 > 320.0f) { phi_v0_5 = 1; } - temp_t8 = phi_s0->unk8; - temp_f16 = temp_t8; + temp_t8 = phi_s0->width; + temp_f16 = (f32) temp_t8; phi_f16 = temp_f16; phi_v0_3 = phi_v0_5; - if (temp_t8 < 0) { + if ((s32) temp_t8 < 0) { phi_f16 = temp_f16 + 4294967296.0f; } if ((temp_f0 + (phi_f16 * arg5)) < 0.0f) { phi_v0_3 = phi_v0_5 + 1; } - temp_t9 = phi_s0->unkE; - temp_f6_2 = temp_t9; + temp_t9 = phi_s0->dY; + temp_f6_2 = (f32) temp_t9; phi_f6_2 = temp_f6_2; phi_v0_2 = phi_v0_3; - if (temp_t9 < 0) { + if ((s32) temp_t9 < 0) { phi_f6_2 = temp_f6_2 + 4294967296.0f; } temp_f0_2 = phi_f6_2 + arg3; if (temp_f0_2 < 0.0f) { phi_v0_2 = phi_v0_3 + 1; } - temp_t0 = phi_s0->unkA; - temp_f16_2 = temp_t0; + temp_t0 = phi_s0->height; + temp_f16_2 = (f32) temp_t0; phi_f16_2 = temp_f16_2; phi_v0 = phi_v0_2; - if (temp_t0 < 0) { + if ((s32) temp_t0 < 0) { phi_f16_2 = temp_f16_2 + 4294967296.0f; } if ((temp_f0_2 - (phi_f16_2 * arg6)) > 240.0f) { @@ -5562,48 +5577,46 @@ void *func_8009BEF0(void *arg0, ? arg1, f32 arg2, f32 arg3, s32 arg4, f32 arg5, if (phi_v0 != 0) { } else { - temp_v0_2 = func_8009B8C4(phi_s0->unk4); + temp_v0_2 = func_8009B8C4(phi_s0->textureData); temp_a1 = temp_v0_2; if (temp_v0_2 != 0) { - if (arg4 != 1) { - if (arg4 != 2) { - - } else { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_02007818; - temp_t5 = phi_s0->unkC; - temp_f16_3 = temp_t5; - phi_f16_3 = temp_f16_3; - if (temp_t5 < 0) { - phi_f16_3 = temp_f16_3 + 4294967296.0f; - } - temp_t6 = phi_s0->unkE; - temp_f4 = temp_t6; - phi_f4 = temp_f4; - if (temp_t6 < 0) { - phi_f4 = temp_f4 + 4294967296.0f; - } - phi_v0_4 = func_80095BD0(phi_s1 + 8, temp_a1, phi_f16_3 + arg2, phi_f4 + arg3, phi_s0->unk8, phi_s0->unkA, arg5, arg6); - goto block_34; - } - } else { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_020077F8; - temp_t1 = phi_s0->unkC; - temp_f18 = temp_t1; + switch (arg4) { /* irregular */ + case 1: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_020077F8; + temp_t1 = phi_s0->dX; + temp_f18 = (f32) temp_t1; phi_f18 = temp_f18; - if (temp_t1 < 0) { + if ((s32) temp_t1 < 0) { phi_f18 = temp_f18 + 4294967296.0f; } - temp_t2 = phi_s0->unkE; - temp_f10 = temp_t2; + temp_t2 = phi_s0->dY; + temp_f10 = (f32) temp_t2; phi_f10 = temp_f10; - if (temp_t2 < 0) { + if ((s32) temp_t2 < 0) { phi_f10 = temp_f10 + 4294967296.0f; } - phi_v0_4 = func_80095BD0(phi_s1 + 8, temp_a1, phi_f18 + arg2, phi_f10 + arg3, phi_s0->unk8, phi_s0->unkA, arg5, arg6); + phi_v0_4 = func_80095BD0(phi_s1 + 8, temp_a1, phi_f18 + arg2, phi_f10 + arg3, (s32) phi_s0->width, (s32) phi_s0->height, arg5, arg6); block_34: phi_s1_3 = phi_v0_4; + break; + case 2: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_02007818; + temp_t5 = phi_s0->dX; + temp_f16_3 = (f32) temp_t5; + phi_f16_3 = temp_f16_3; + if ((s32) temp_t5 < 0) { + phi_f16_3 = temp_f16_3 + 4294967296.0f; + } + temp_t6 = phi_s0->dY; + temp_f4 = (f32) temp_t6; + phi_f4 = temp_f4; + if ((s32) temp_t6 < 0) { + phi_f4 = temp_f4 + 4294967296.0f; + } + phi_v0_4 = func_80095BD0(phi_s1 + 8, temp_a1, phi_f16_3 + arg2, phi_f4 + arg3, (s32) phi_s0->width, (s32) phi_s0->height, arg5, arg6); + goto block_34; } } } @@ -5611,7 +5624,7 @@ block_34: phi_s0 = temp_s0; phi_s1 = phi_s1_3; phi_s1_2 = phi_s1_3; - } while (temp_s0->unk4 != 0); + } while (temp_s0->textureData != 0); } return phi_s1_2; } @@ -5620,80 +5633,72 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BEF0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_02007708; -extern ? D_02007728; -extern ? D_02007768; -extern f32 D_800F1074; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_800963F0(Gfx *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +s32 func_8009B8C4(u64 *); /* extern */ -void *func_8009C204(void *arg0, ? arg1, s32 arg2, s32 arg3, s32 arg4) { - f32 temp_f22; +Gfx *func_8009C204(Gfx *arg0, MkTexture *arg1, s32 arg2, s32 arg3, s32 arg4) { + MkTexture *temp_v0; s16 temp_v0_2; s32 temp_v0_3; u16 temp_v0_4; u16 temp_v0_5; u16 temp_v1; u16 temp_v1_2; - void *temp_v0; - void *phi_s1; - void *phi_s0; - void *phi_s0_2; + MkTexture *phi_s1; + Gfx *phi_s0; + Gfx *phi_s0_2; s8 phi_s2; - void *phi_s0_3; - void *phi_s0_4; - void *phi_v0; + Gfx *phi_s0_3; + Gfx *phi_s0_4; + Gfx *phi_v0; temp_v0 = segmented_to_virtual(arg1); phi_s1 = temp_v0; phi_s0 = arg0; phi_s0_3 = arg0; - if (temp_v0->unk4 != 0) { - temp_f22 = D_800F1074; + if (temp_v0->textureData != 0) { do { - temp_v0_2 = phi_s1->unk0; + temp_v0_2 = phi_s1->type; phi_s2 = 0; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - if (temp_v0_2 != 3) { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; - phi_s0_2 = phi_s0 + 8; - } else { - phi_s0->unk4 = &D_02007768; - phi_s0->unk0 = 0x6000000; - phi_s0_2 = phi_s0 + 8; - phi_s2 = 3; - } - } else { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; - phi_s0_2 = phi_s0 + 8; - } - } else { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007708; + switch (temp_v0_2) { /* irregular */ + default: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; phi_s0_2 = phi_s0 + 8; + break; + case 0: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007708; + phi_s0_2 = phi_s0 + 8; + break; + case 1: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; + phi_s0_2 = phi_s0 + 8; + break; + case 3: + phi_s0->words.w1 = D_02007768; + phi_s0->words.w0 = 0x06000000; + phi_s0_2 = phi_s0 + 8; + phi_s2 = 3; + break; } - temp_v0_3 = func_8009B8C4(phi_s1->unk4); + temp_v0_3 = func_8009B8C4(phi_s1->textureData); phi_s0_4 = phi_s0_2; - if (arg4 != 2) { - if (arg4 != 3) { - - } else { - temp_v0_4 = phi_s1->unk8; - temp_v1 = phi_s1->unkA; - phi_v0 = func_800963F0(phi_s0_2, phi_s2, 0x400, 0x400, temp_f22, 0.5f, 0, 0, temp_v0_4, temp_v1, phi_s1->unkC + arg2, phi_s1->unkE + arg3, temp_v0_3, temp_v0_4, temp_v1); - goto block_14; - } - } else { - temp_v0_5 = phi_s1->unk8; - temp_v1_2 = phi_s1->unkA; - phi_v0 = func_800963F0(phi_s0_2, phi_s2, 0x400, 0x400, 0.5f, 0.5f, 0, 0, temp_v0_5, temp_v1_2, phi_s1->unkC + arg2, phi_s1->unkE + arg3, temp_v0_3, temp_v0_5, temp_v1_2); + switch (arg4) { /* switch 1; irregular */ + case 2: /* switch 1 */ + temp_v0_4 = phi_s1->width; + temp_v1 = phi_s1->height; + phi_v0 = func_800963F0(phi_s0_2, phi_s2, 0x400, 0x400, 0.5f, 0.5f, 0, 0, (s32) temp_v0_4, (s32) temp_v1, phi_s1->dX + arg2, phi_s1->dY + arg3, temp_v0_3, (s32) temp_v0_4, (s32) temp_v1); block_14: phi_s0_4 = phi_v0; + break; + case 3: /* switch 1 */ + temp_v0_5 = phi_s1->width; + temp_v1_2 = phi_s1->height; + phi_v0 = func_800963F0(phi_s0_2, phi_s2, 0x400, 0x400, 0.457f, 0.5f, 0, 0, (s32) temp_v0_5, (s32) temp_v1_2, phi_s1->dX + arg2, phi_s1->dY + arg3, temp_v0_3, (s32) temp_v0_5, (s32) temp_v1_2); + goto block_14; } phi_s1 += 0x14; phi_s0 = phi_s0_4; @@ -5707,19 +5712,16 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C204.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_02007708; -extern ? D_02007728; -extern ? D_02007768; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80095E10(Gfx *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +Gfx *func_800963F0(Gfx *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ +Gfx *func_80097E58(Gfx *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ extern s32 D_8018D9B0; extern ? D_8018E11C; extern ? D_8018E124; -void *func_8009C434(void *arg0, void *arg1, s32 arg2, s32 arg3, s32 arg4) { +Gfx *func_8009C434(Gfx *arg0, struct_8018DEE0_entry *arg1, s32 arg2, s32 arg3, s32 arg4) { + MkTexture *temp_v0; s16 temp_v0_2; u16 temp_v0_3; u16 temp_v0_4; @@ -5727,69 +5729,69 @@ void *func_8009C434(void *arg0, void *arg1, s32 arg2, s32 arg3, s32 arg4) { u16 temp_v1; u16 temp_v1_2; u16 temp_v1_3; - void *temp_v0; - void *phi_s0; - void *phi_s1; - void *phi_s1_2; + MkTexture *phi_s0; + Gfx *phi_s1; + Gfx *phi_s1_2; s8 phi_t1; s32 phi_t0; - void *phi_s1_3; - void *phi_s1_4; - void *phi_v0; + Gfx *phi_s1_3; + Gfx *phi_s1_4; + Gfx *phi_v0; - temp_v0 = segmented_to_virtual(*(arg1->unk0 + (arg1->unk4 * 8))); + temp_v0 = segmented_to_virtual(arg1->textureSequence[arg1->sequenceIndex].MkTexture); phi_s0 = temp_v0; phi_s1 = arg0; phi_s1_3 = arg0; - if (temp_v0->unk4 != 0) { + if (temp_v0->textureData != 0) { do { - temp_v0_2 = phi_s0->unk0; + temp_v0_2 = phi_s0->type; phi_t1 = 0; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - if (temp_v0_2 != 3) { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_02007728; - phi_s1_2 = phi_s1 + 8; - } else { - phi_s1->unk4 = &D_02007768; - phi_s1->unk0 = 0x6000000; - phi_s1_2 = phi_s1 + 8; - phi_t1 = 3; - } - } else { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_02007728; - phi_s1_2 = phi_s1 + 8; - } - } else { - phi_s1->unk0 = 0x6000000; - phi_s1->unk4 = &D_02007708; + switch (temp_v0_2) { /* irregular */ + default: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_02007728; phi_s1_2 = phi_s1 + 8; + break; + case 0: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_02007708; + phi_s1_2 = phi_s1 + 8; + break; + case 1: + phi_s1->words.w0 = 0x06000000; + phi_s1->words.w1 = D_02007728; + phi_s1_2 = phi_s1 + 8; + break; + case 3: + phi_s1->words.w1 = D_02007768; + phi_s1->words.w0 = 0x06000000; + phi_s1_2 = phi_s1 + 8; + phi_t1 = 3; + break; } phi_s1_4 = phi_s1_2; if (arg1->unk14 != 0) { - phi_t0 = *(&D_8018E124 + (arg1->unk10 * 8)); + phi_t0 = *(&D_8018E124 + (arg1->D_8018E118_index * 8)); } else { - phi_t0 = *(&D_8018E11C + (arg1->unk10 * 8)); + phi_t0 = *(&D_8018E11C + (arg1->D_8018E118_index * 8)); } if (arg4 >= 0) { - temp_v0_3 = phi_s0->unk8; - temp_v1 = phi_s0->unkA; - phi_v0 = func_80097E58(phi_s1_2, phi_t1, 0, 0, temp_v0_3, temp_v1, phi_s0->unkC + arg2, phi_s0->unkE + arg3, (phi_t0 * 2) + D_8018D9B0, temp_v0_3, temp_v1, arg4); + temp_v0_3 = phi_s0->width; + temp_v1 = phi_s0->height; + phi_v0 = func_80097E58(phi_s1_2, phi_t1, 0, 0, (s32) temp_v0_3, (s32) temp_v1, phi_s0->dX + arg2, phi_s0->dY + arg3, (phi_t0 * 2) + D_8018D9B0, (s32) temp_v0_3, (s32) temp_v1, arg4); goto block_18; } if (arg4 != -2) { if (arg4 == -1) { - temp_v0_4 = phi_s0->unk8; - temp_v1_2 = phi_s0->unkA; - phi_v0 = func_80095E10(phi_s1_2, phi_t1, 0x400, 0x400, 0, 0, temp_v0_4, temp_v1_2, phi_s0->unkC + arg2, phi_s0->unkE + arg3, (phi_t0 * 2) + D_8018D9B0, temp_v0_4, temp_v1_2); + temp_v0_4 = phi_s0->width; + temp_v1_2 = phi_s0->height; + phi_v0 = func_80095E10(phi_s1_2, phi_t1, 0x400, 0x400, 0, 0, (s32) temp_v0_4, (s32) temp_v1_2, phi_s0->dX + arg2, phi_s0->dY + arg3, (phi_t0 * 2) + D_8018D9B0, (s32) temp_v0_4, (s32) temp_v1_2); goto block_18; } } else { - temp_v0_5 = phi_s0->unk8; - temp_v1_3 = phi_s0->unkA; - phi_v0 = func_800963F0(phi_s1_2, phi_t1, 0x400, 0x400, 0.5f, 0.5f, 0, 0, temp_v0_5, temp_v1_3, phi_s0->unkC + arg2, phi_s0->unkE + arg3, (phi_t0 * 2) + D_8018D9B0, temp_v0_5, temp_v1_3); + temp_v0_5 = phi_s0->width; + temp_v1_3 = phi_s0->height; + phi_v0 = func_800963F0(phi_s1_2, phi_t1, 0x400, 0x400, 0.5f, 0.5f, 0, 0, (s32) temp_v0_5, (s32) temp_v1_3, phi_s0->dX + arg2, phi_s0->dY + arg3, (phi_t0 * 2) + D_8018D9B0, (s32) temp_v0_5, (s32) temp_v1_3); block_18: phi_s1_4 = phi_v0; } @@ -5805,67 +5807,62 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C434.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, u8 *, s32, s32, s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_02007708; -extern ? D_02007728; -extern ? D_02007748; -extern ? D_02007768; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_80097E58(Gfx *, s8, ?, ?, s32, s32, s32, s32, void *, s32, s32, s32); /* extern */ -void *func_8009C708(void *arg0, void *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { +Gfx *func_8009C708(Gfx *arg0, struct_8018DEE0_entry *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { + MkTexture *temp_v0; s16 temp_v0_2; u16 temp_v0_3; u16 temp_v1; - void *temp_v0; - void *phi_s1; - void *phi_s0; - void *phi_s0_2; + MkTexture *phi_s1; + Gfx *phi_s0; + Gfx *phi_s0_2; s8 phi_t0; - void *phi_s0_3; - void *phi_s0_4; + Gfx *phi_s0_3; + Gfx *phi_s0_4; - temp_v0 = segmented_to_virtual(*(arg1->unk0 + (arg1->unk4 * 8))); + temp_v0 = segmented_to_virtual(arg1->textureSequence[arg1->sequenceIndex].MkTexture); phi_s1 = temp_v0; phi_s0 = arg0; phi_s0_3 = arg0; - if (temp_v0->unk4 != 0) { + if (temp_v0->textureData != 0) { do { - temp_v0_2 = phi_s1->unk0; + temp_v0_2 = phi_s1->type; phi_t0 = 0; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 3) { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; - phi_s0_2 = phi_s0 + 8; - } else { - phi_s0->unk4 = &D_02007768; - phi_s0->unk0 = 0x6000000; - phi_s0_2 = phi_s0 + 8; - phi_t0 = 3; - } - } else { - phi_s0->unk4 = &D_02007748; - phi_s0->unk0 = 0x6000000; - phi_s0_2 = phi_s0 + 8; - } - } else { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007728; - phi_s0_2 = phi_s0 + 8; - } - } else { - phi_s0->unk0 = 0x6000000; - phi_s0->unk4 = &D_02007708; + switch (temp_v0_2) { /* irregular */ + default: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; phi_s0_2 = phi_s0 + 8; + break; + case 0: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007708; + phi_s0_2 = phi_s0 + 8; + break; + case 1: + phi_s0->words.w0 = 0x06000000; + phi_s0->words.w1 = D_02007728; + phi_s0_2 = phi_s0 + 8; + break; + case 2: + phi_s0->words.w1 = D_02007748; + phi_s0->words.w0 = 0x06000000; + phi_s0_2 = phi_s0 + 8; + break; + case 3: + phi_s0->words.w1 = D_02007768; + phi_s0->words.w0 = 0x06000000; + phi_s0_2 = phi_s0 + 8; + phi_t0 = 3; + break; } phi_s0_4 = phi_s0_2; if (arg5 >= 0) { - temp_v0_3 = phi_s1->unk8; - temp_v1 = phi_s1->unkA; - phi_s0_4 = func_80097E58(phi_s0_2, phi_t0, 0, 0, temp_v0_3, temp_v1, phi_s1->unkC + arg2, phi_s1->unkE + arg3, &D_802BFB80[(arg1->unk14 << 0x10) + ((arg4 / 2) << 0xF) + ((arg4 % 2) << 0xD) + 0x4000], temp_v0_3, temp_v1, arg5); + temp_v0_3 = phi_s1->width; + temp_v1 = phi_s1->height; + phi_s0_4 = func_80097E58(phi_s0_2, phi_t0, 0, 0, (s32) temp_v0_3, (s32) temp_v1, phi_s1->dX + arg2, phi_s1->dY + arg3, (arg1->unk14 << 0x10) + ((arg4 / 2) << 0xF) + ((arg4 % 2) << 0xD) + 0x4000 + D_802BFB80, (s32) temp_v0_3, (s32) temp_v1, arg5); } phi_s1 += 0x14; phi_s0 = phi_s0_4; @@ -5951,7 +5948,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CA2C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_8009CDDC(s32, ?, s32); /* extern */ ? func_8009CDFC(s32, ?, s32); /* extern */ ? func_8009D958(s32, ?, s32); /* extern */ @@ -5959,7 +5956,6 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CA2C.s") ? func_8009D998(s32, ?, s32); /* extern */ ? func_8009DAA8(Gfx **, ?, s32); /* extern */ ? func_8009DB8C(Gfx **, ?, s32); /* extern */ -s32 func_800AAF30(?); /* extern */ extern ? D_0D0076F8; extern ? D_8018E7AC; @@ -5971,8 +5967,8 @@ void func_8009CA6C(s32 arg0) { if ((arg0 == 4) || ((arg0 = arg0, (func_800AAF30(0xAA) == 0)) && (arg0 = arg0, (func_800AAF30(0xAB) == 0)) && (arg0 = arg0, (func_800AAF30(0xB9) == 0)) && (arg0 = arg0, (func_800AAF30(0xBA) == 0)) && (arg0 = arg0, (func_800AAF30(0xAC) == 0)) && (arg0 = arg0, (func_800AAF30(0xB0) == 0)))) { temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x6000000; - temp_v1->words.w1 = &D_0D0076F8; + temp_v1->words.w0 = 0x06000000; + temp_v1->words.w1 = (u32) &D_0D0076F8; phi_a1 = 0; if ((arg0 != 4) && (D_800DC5FC != 0)) { phi_a1 = 1; @@ -5999,8 +5995,7 @@ void func_8009CA6C(s32 arg0) { return; case 8: func_8009CDFC(arg0, phi_a1, arg0); - /* Duplicate return node #19. Try simplifying control flow for better match */ - return; + break; } } else { default: @@ -7290,520 +7285,284 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E620.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 struct _struct_D_800E8234_0x8 { - /* 0x0 */ u32 unk0; /* inferred */ + /* 0x0 */ void *unk0; /* inferred */ /* 0x4 */ struct _struct_D_800E8234_0x8 unk4; /* inferred */ }; /* size = 0x8 */ s32 func_800051C4(); /* extern */ ? func_8006EE44(s8); /* extern */ ? func_8006EF60(); /* extern */ -? func_80099184(? *, s8); /* extern */ -? func_800996BC(? *, ?, s8); /* extern */ +? func_800996BC(MkTexture *, ?, s8); /* extern */ s32 func_8009A374(void *); /* extern */ s32 func_8009A478(void *, s32); /* extern */ ? func_8009B0A4(?, ?); /* extern */ ? func_8009B538(?, ?, u16, u16, s32); /* extern */ -s32 func_8009B8C4(? *); /* extern */ -? func_8009B954(? *); /* extern */ +u32 func_8009B8C4(u64 *); /* extern */ +? func_8009B954(MkTexture *); /* extern */ ? func_8009B998(); /* extern */ -s32 *func_8009BA74(s32 *, ? *, s32, s32); /* extern */ s32 func_800B5020(s32, s8, s8); /* extern */ s32 func_800B5218(); /* extern */ -s32 func_800B54C0(s8, s32, s8); /* extern */ -s32 func_800B555C(s8); /* extern */ -? func_800B559C(s32); /* extern */ s32 func_800B5B94(); /* extern */ ? func_800B6708(); /* extern */ s32 random_int(?, s8); /* extern */ -extern ? D_020014C8; -extern ? D_02001540; -extern ? D_0200157C; -extern ? D_020015A4; -extern ? D_020015CC; -extern ? D_02001630; -extern ? D_02001658; -extern ? D_0200184C; -extern ? D_02001874; -extern ? D_0200198C; -extern ? D_0200199C; -extern ? D_020019AC; -extern ? D_020019BC; -extern ? D_020019CC; -extern ? D_020019DC; -extern ? D_02001B2C; -extern ? D_02001B54; -extern ? D_02001B7C; -extern ? D_02001BA4; -extern ? D_02001BCC; -extern ? D_02001BF4; -extern ? D_02001C1C; -extern ? D_02001C44; -extern ? D_02001C6C; -extern ? D_02001C94; -extern ? D_02001CBC; -extern ? D_02001CE4; -extern ? D_02001D0C; -extern ? D_02001D34; -extern ? D_02001D5C; -extern ? D_02001D84; -extern ? D_02001DAC; -extern ? D_02001DD4; -extern ? D_02001DFC; -extern ? D_02001E24; -extern ? D_02001E64; -extern ? D_02001E74; -extern ? D_02001E84; -extern ? D_02001E94; -extern ? D_02001EA4; -extern ? D_02001EB4; -extern ? D_02001EC4; -extern ? D_02001ED4; -extern ? D_02001EE4; -extern ? D_02001EF4; -extern ? D_02001F04; -extern ? D_02001F14; -extern ? D_02001F24; -extern ? D_02001F34; -extern ? D_02001F44; -extern ? D_02001F54; -extern ? D_02001F64; -extern ? D_02001F74; -extern ? D_02001F84; -extern ? D_02001F94; -extern ? D_02001FA4; -extern ? D_020020BC; -extern ? D_020020CC; -extern ? D_020020DC; -extern ? D_02003594; -extern ? D_020035BC; -extern ? D_020035E4; -extern ? D_0200360C; -extern ? D_02003634; -extern ? D_0200365C; -extern ? D_02003684; -extern ? D_020036AC; -extern ? D_020036D4; -extern ? D_020036FC; -extern ? D_02003724; -extern ? D_0200374C; -extern ? D_02003774; -extern ? D_0200379C; -extern ? D_020037C4; -extern ? D_020037EC; -extern ? D_02003814; -extern ? D_0200383C; -extern ? D_02003864; -extern ? D_0200388C; -extern ? D_020038B4; -extern ? D_020038DC; -extern ? D_02003904; -extern ? D_0200392C; -extern ? D_02003954; -extern ? D_0200397C; -extern ? D_020039A4; -extern ? D_020039CC; -extern ? D_02003A1C; -extern ? D_02003A44; -extern ? D_02003A6C; -extern ? D_02003A94; -extern ? D_02003ABC; -extern ? D_02003AE4; -extern ? D_02003B0C; -extern ? D_02003B34; -extern ? D_02003B5C; -extern ? D_02003B84; -extern ? D_02003BAC; -extern ? D_02003BFC; -extern ? D_02003C24; -extern ? D_02003C4C; -extern ? D_02003C74; -extern ? D_02003C9C; -extern ? D_02003CC4; -extern ? D_02003CEC; -extern ? D_02003D14; -extern ? D_02003D3C; -extern ? D_02003D64; -extern ? D_02003D8C; -extern ? D_02003DB4; -extern ? D_02003DDC; -extern ? D_02003E04; -extern ? D_02003E2C; -extern ? D_02003E54; -extern ? D_02003E7C; -extern ? D_02003EA4; -extern ? D_02003ECC; -extern ? D_02003EF4; -extern ? D_02003F1C; -extern ? D_02003F44; -extern ? D_02003F6C; -extern ? D_02003F94; -extern ? D_02003FE4; -extern ? D_0200400C; -extern ? D_02004034; -extern ? D_0200405C; -extern ? D_02004084; -extern ? D_020040AC; -extern ? D_020040D4; -extern ? D_020040FC; -extern ? D_02004124; -extern ? D_0200414C; -extern ? D_02004174; -extern ? D_0200419C; -extern ? D_020041C4; -extern ? D_020041EC; -extern ? D_02004214; -extern ? D_0200423C; -extern ? D_02004264; -extern ? D_0200428C; -extern ? D_020042B4; -extern ? D_020042DC; -extern ? D_02004304; -extern ? D_0200432C; -extern ? D_02004354; -extern ? D_0200437C; -extern ? D_020043A4; -extern ? D_020043CC; -extern ? D_020043F4; -extern ? D_0200441C; -extern ? D_02004444; -extern ? D_0200446C; -extern ? D_02004494; -extern ? D_020044BC; -extern ? D_020044E4; -extern ? D_0200450C; -extern ? D_02004534; -extern ? D_0200455C; -extern ? D_02004598; -extern ? D_020045C0; -extern ? D_020045E8; -extern ? D_02004610; -extern ? D_02004638; -extern ? D_020048F4; -extern ? D_0200491C; -extern ? D_02004944; -extern ? D_0200496C; -extern ? D_02004994; -extern ? D_020049BC; -extern ? D_020049E4; -extern ? D_02004A0C; -extern ? D_02004A34; -extern ? D_02004B4C; -extern ? D_02004B74; -extern ? D_02004EA8; -extern ? D_02004ED0; -extern ? D_02004EF8; -extern ? D_02004F20; -extern ? D_02004F48; -extern ? D_02004F70; -extern ? D_02004F98; -extern ? D_02004FC0; -extern ? D_02004FE8; -extern ? D_02005010; -extern ? D_02005038; -extern ? D_02005060; -extern ? D_02005088; -extern ? D_020050B0; -extern ? D_020050D8; -extern ? D_02005100; -extern ? D_02005128; -extern ? D_02005150; -extern ? D_02005178; -extern ? D_020051A0; -extern ? D_02006708; -extern ? D_020068E0; -extern ? D_020068F0; -extern ? D_02006AC8; -extern ? D_02006AD8; -extern ? D_02006CB0; -extern ? D_02006CC0; -extern ? D_02006E98; -extern ? D_02006EA8; -extern ? D_02007080; -extern ? D_02007090; -extern ? D_02007270; -extern ? D_02007280; -extern ? D_02007458; -extern ? D_02007468; -extern ? D_02007640; -extern s32 gPlayerWinningIndex; -extern u16 D_80162DD4; extern ? D_801640F4; extern s32 D_8018CA78; -extern s32 gD_8018E118TotalSize; -extern s32 *D_8018E75C; +extern Gfx *D_8018E75C; extern s8 D_8018ED90; extern s32 D_8018ED94; -extern s32 D_8018EDC0; -extern f32 D_8018EDC4; -extern f32 D_8018EDC8; -extern f32 D_8018EDCC; -extern f32 D_8018EDD0; -extern f32 D_8018EDD4; -extern f32 D_8018EDD8; -extern f32 D_8018EDDC; extern ? D_8018EE10; -extern ? D_802874D8; -extern s8 gCupCourseSelection; -extern u8 gSoundMode; -extern ? gTexture7ED50C; -extern s8 gTimeTrialDataCourseIndex; +extern s32 gD_8018E118TotalSize; +extern s32 gPlayerWinningIndex; static struct _struct_D_800E7248_0x8 D_800E7248[0]; /* unable to generate initializer; const */ static ? D_800E7268; /* unable to generate initializer; const */ static struct _struct_D_800E74E8_0x8 D_800E74E8[0]; /* unable to generate initializer; const */ static struct _struct_D_800E8234_0x8 D_800E7AF8[0x36]; /* unable to generate initializer; const */ static ? D_800E7CA8; /* unable to generate initializer; const */ static struct _struct_D_800E8234_0x8 D_800E7D0C[5]; /* unable to generate initializer; const */ -static u32 D_800E7D34[6] = { - (u32) &D_0200198C, - (u32) &D_0200199C, - (u32) &D_020019AC, - (u32) &D_020019BC, - (u32) &D_020019CC, - (u32) &D_020019DC, -}; /* const */ -static ? *D_800E7D4C[2] = { &D_02004598, &D_020045C0 }; /* const */ +static MkAnimation *D_800E7D34[6] = { D_0200198C, D_0200199C, D_020019AC, D_020019BC, D_020019CC, D_020019DC }; /* const */ +static MkTexture *D_800E7D4C[2] = { D_02004598, D_020045C0 }; /* const */ static ? D_800E7D54; /* unable to generate initializer; const */ -static u32 D_800E7D74[0x14] = { - (u32) &D_02001B2C, - (u32) &D_02001B54, - (u32) &D_02001B7C, - (u32) &D_02001BA4, - (u32) &D_02001BCC, - (u32) &D_02001BF4, - (u32) &D_02001C1C, - (u32) &D_02001C44, - (u32) &D_02001C6C, - (u32) &D_02001C94, - (u32) &D_02001CBC, - (u32) &D_02001CE4, - (u32) &D_02001D0C, - (u32) &D_02001D34, - (u32) &D_02001D5C, - (u32) &D_02001D84, - (u32) &D_02001DAC, - (u32) &D_02001DD4, - (u32) &D_02001DFC, - (u32) &D_02001E24, -}; /* const */ -static u32 D_800E7DC4[0x17] = { - (u32) &D_02004EA8, - (u32) &D_02004ED0, - (u32) &D_02004EF8, - (u32) &D_02004F20, - (u32) &D_02004F48, - (u32) &D_02004F70, - (u32) &D_02004F98, - (u32) &D_02004FC0, - (u32) &D_02004FE8, - (u32) &D_02005010, - (u32) &D_02005038, - (u32) &D_02005060, - (u32) &D_02005088, - (u32) &D_020050B0, - (u32) &D_020050D8, - (u32) &D_02005100, - (u32) &D_02005128, - (u32) &D_02005150, - (u32) &D_02005178, - (u32) &D_020051A0, - (u32) &D_020020BC, - (u32) &D_020020CC, - (u32) &D_020020DC, -}; /* const */ static ? D_800E7E20; /* unable to generate initializer; const */ -static u32 D_800E7E34[0x14] = { - (u32) &D_02001E64, - (u32) &D_02001E74, - (u32) &D_02001E84, - (u32) &D_02001E94, - (u32) &D_02001EA4, - (u32) &D_02001EB4, - (u32) &D_02001EC4, - (u32) &D_02001ED4, - (u32) &D_02001EE4, - (u32) &D_02001EF4, - (u32) &D_02001F04, - (u32) &D_02001F14, - (u32) &D_02001F24, - (u32) &D_02001F34, - (u32) &D_02001F44, - (u32) &D_02001F54, - (u32) &D_02001F64, - (u32) &D_02001F74, - (u32) &D_02001F84, - (u32) &D_02001F94, -}; /* const */ static ? D_800E7FF0; /* unable to generate initializer; const */ -static u32 D_800E80A0[0x1D] = { - (u32) &D_02003594, - (u32) &D_02003BFC, - (u32) &D_020035BC, - (u32) &D_02003C24, - (u32) &D_020035E4, - (u32) &D_02003C4C, - (u32) &D_0200360C, - (u32) &D_02003C74, - (u32) &D_02003634, - (u32) &D_02003C9C, - (u32) &D_0200365C, - (u32) &D_02003CC4, - (u32) &D_02003684, - (u32) &D_02003CEC, - (u32) &D_020036AC, - (u32) &D_02003D14, - (u32) &D_020036D4, - (u32) &D_02003D3C, - (u32) &D_020036FC, - (u32) &D_02003D64, - (u32) &D_02003724, - (u32) &D_02003D8C, - (u32) &D_02004034, - (u32) &D_0200374C, - (u32) &D_02003DB4, - (u32) &D_02003774, - (u32) &D_02003DDC, - (u32) &D_0200379C, - (u32) &D_02003E04, +static MkTexture *D_800E80A0[0x1D] = { + D_02003594, + D_02003BFC, + D_020035BC, + D_02003C24, + D_020035E4, + D_02003C4C, + D_0200360C, + D_02003C74, + D_02003634, + D_02003C9C, + D_0200365C, + D_02003CC4, + D_02003684, + D_02003CEC, + D_020036AC, + D_02003D14, + D_020036D4, + D_02003D3C, + D_020036FC, + D_02003D64, + D_02003724, + D_02003D8C, + D_02004034, + D_0200374C, + D_02003DB4, + D_02003774, + D_02003DDC, + D_0200379C, + D_02003E04, }; /* const */ -static u32 D_800E8114[0x18] = { - (u32) &D_020037C4, - (u32) &D_020037EC, - (u32) &D_02003814, - (u32) &D_0200383C, - (u32) &D_02003864, - (u32) &D_0200388C, - (u32) &D_02003E2C, - (u32) &D_02003EF4, - (u32) &D_020038B4, - (u32) &D_02003E54, - (u32) &D_02003F1C, - (u32) &D_020038DC, - (u32) &D_02003E7C, - (u32) &D_02003F44, - (u32) &D_02003904, - (u32) &D_02003EA4, - (u32) &D_02003F6C, - (u32) &D_0200392C, - (u32) &D_02003ECC, - (u32) &D_02003F94, - (u32) &D_02003954, - (u32) &D_0200397C, - (u32) &D_020039A4, - (u32) &D_020039CC, +static MkTexture *D_800E8114[0x18] = { + D_020037C4, + D_020037EC, + D_02003814, + D_0200383C, + D_02003864, + D_0200388C, + D_02003E2C, + D_02003EF4, + D_020038B4, + D_02003E54, + D_02003F1C, + D_020038DC, + D_02003E7C, + D_02003F44, + D_02003904, + D_02003EA4, + D_02003F6C, + D_0200392C, + D_02003ECC, + D_02003F94, + D_02003954, + D_0200397C, + D_020039A4, + D_020039CC, }; /* const */ -static u32 D_800E817C[0x1A] = { - (u32) &D_02003A1C, - (u32) &D_02003FE4, - (u32) &D_02003A44, - (u32) &D_0200400C, - (u32) &D_02003A6C, - (u32) &D_02003A94, - (u32) &D_02003ABC, - (u32) &D_02003AE4, - (u32) &D_02003B0C, - (u32) &D_02003B34, - (u32) &D_02003B5C, - (u32) &D_02003B84, - (u32) &D_02003BAC, - (u32) &D_0200405C, - (u32) &D_02004084, - (u32) &D_020040AC, - (u32) &D_020040D4, - (u32) &D_020040FC, - (u32) &D_020043CC, - (u32) &D_02004444, - (u32) &D_0200437C, - (u32) &D_020043F4, - (u32) &D_02004124, - (u32) &D_0200414C, - (u32) &D_02004174, - (u32) &D_0200419C, +static MkTexture *D_800E817C[0x1A] = { + D_02003A1C, + D_02003FE4, + D_02003A44, + D_0200400C, + D_02003A6C, + D_02003A94, + D_02003ABC, + D_02003AE4, + D_02003B0C, + D_02003B34, + D_02003B5C, + D_02003B84, + D_02003BAC, + D_0200405C, + D_02004084, + D_020040AC, + D_020040D4, + D_020040FC, + D_020043CC, + D_02004444, + D_0200437C, + D_020043F4, + D_02004124, + D_0200414C, + D_02004174, + D_0200419C, }; /* const */ -static u32 D_800E81E4[0x12] = { - (u32) &D_020041C4, - (u32) &D_020041EC, - (u32) &D_02004214, - (u32) &D_0200423C, - (u32) &D_02004264, - (u32) &D_0200428C, - (u32) &D_020042B4, - (u32) &D_020042DC, - (u32) &D_02004354, - (u32) &D_020043A4, - (u32) &D_0200441C, - (u32) &D_0200446C, - (u32) &D_02004494, - (u32) &D_020044BC, - (u32) &D_02004304, - (u32) &D_0200432C, - (u32) &D_020044E4, - (u32) &D_0200450C, +static MkTexture *D_800E81E4[0x12] = { + D_020041C4, + D_020041EC, + D_02004214, + D_0200423C, + D_02004264, + D_0200428C, + D_020042B4, + D_020042DC, + D_02004354, + D_020043A4, + D_0200441C, + D_0200446C, + D_02004494, + D_020044BC, + D_02004304, + D_0200432C, + D_020044E4, + D_0200450C, }; /* const */ -static u32 D_800E822C[2] = { (u32) &D_02004534, (u32) &D_0200455C }; /* const */ +static MkTexture *D_800E822C[2] = { D_02004534, D_0200455C }; /* const */ static struct _struct_D_800E8234_0x8 D_800E8234[3]; /* unable to generate initializer; const */ -static u32 D_800E8274[8] = { - (u32) &D_020048F4, - (u32) &D_0200491C, - (u32) &D_02004944, - (u32) &D_0200496C, - (u32) &D_020049BC, - (u32) &D_02004994, - (u32) &D_020049E4, - (u32) &D_02004A34, +static MkTexture *D_800E8274[8] = { + D_020048F4, + D_0200491C, + D_02004944, + D_0200496C, + D_020049BC, + D_02004994, + D_020049E4, + D_02004A34, }; /* const */ -static u32 D_800E8294[8] = { - (u32) &D_020048F4, - (u32) &D_0200491C, - (u32) &D_02004944, - (u32) &D_0200496C, - (u32) &D_020049BC, - (u32) &D_02004994, - (u32) &D_020049E4, - (u32) &D_02004A34, +static MkTexture *D_800E8294[8] = { + D_020048F4, + D_0200491C, + D_02004944, + D_0200496C, + D_020049BC, + D_02004994, + D_020049E4, + D_02004A34, }; /* const */ -static u32 D_800E8320[8] = { - (u32) &D_02006708, - (u32) &D_020068F0, - (u32) &D_02006CC0, - (u32) &D_02006EA8, - (u32) &D_02007090, - (u32) &D_02007280, - (u32) &D_02007468, - (u32) &D_02006AD8, +static MkAnimation *D_800E8320[8] = { + D_02006708, + D_020068F0, + D_02006CC0, + D_02006EA8, + D_02007090, + D_02007280, + D_02007468, + D_02006AD8, }; /* const */ -static u32 D_800E8420[8] = { - (u32) &D_020068E0, - (u32) &D_02006AC8, - (u32) &D_02006E98, - (u32) &D_02007080, - (u32) &D_02007270, - (u32) &D_02007458, - (u32) &D_02007640, - (u32) &D_02006CB0, +static MkAnimation *D_800E8420[8] = { + D_020068E0, + D_02006AC8, + D_02006E98, + D_02007080, + D_02007270, + D_02007458, + D_02007640, + D_02006CB0, }; /* const */ static ? D_800E85F7; /* unable to generate initializer; const */ -static s8 gCharacterSelections = 0; /* const */ static ? D_800EFD64; /* unable to generate initializer; const */ +MkTexture *D_800E7D74[0x14] = { + D_02001B2C, + D_02001B54, + D_02001B7C, + D_02001BA4, + D_02001BCC, + D_02001BF4, + D_02001C1C, + D_02001C44, + D_02001C6C, + D_02001C94, + D_02001CBC, + D_02001CE4, + D_02001D0C, + D_02001D34, + D_02001D5C, + D_02001D84, + D_02001DAC, + D_02001DD4, + D_02001DFC, + D_02001E24, +}; /* const */ +MkTexture *D_800E7DC4[0x17] = { + D_02004EA8, + D_02004ED0, + D_02004EF8, + D_02004F20, + D_02004F48, + D_02004F70, + D_02004F98, + D_02004FC0, + D_02004FE8, + D_02005010, + D_02005038, + D_02005060, + D_02005088, + D_020050B0, + D_020050D8, + D_02005100, + D_02005128, + D_02005150, + D_02005178, + D_020051A0, + (MkTexture *) D_020020BC, + (MkTexture *) D_020020CC, + (MkTexture *) D_020020DC, +}; /* const */ +MkAnimation *D_800E7E34[0x14] = { + D_02001E64, + D_02001E74, + D_02001E84, + D_02001E94, + D_02001EA4, + D_02001EB4, + D_02001EC4, + D_02001ED4, + D_02001EE4, + D_02001EF4, + D_02001F04, + D_02001F14, + D_02001F24, + D_02001F34, + D_02001F44, + D_02001F54, + D_02001F64, + D_02001F74, + D_02001F84, + D_02001F94, +}; /* const */ +s8 gCharacterSelections[4]; /* unable to generate initializer; const */ s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { struct_8018D9E0_entry *sp7C; - s32 *sp6C; + Gfx *sp6C; s32 sp3C; struct _struct_D_800E8234_0x8 *sp24; /* compiler-managed */ s32 sp20; - s32 *temp_v0_2; - s32 *temp_v1_10; - s32 *temp_v1_2; - s32 *temp_v1_3; - s32 *temp_v1_4; - s32 *temp_v1_5; - s32 *temp_v1_6; - s32 *temp_v1_7; - s32 *temp_v1_8; - s32 *temp_v1_9; + Gfx *temp_v0_2; + Gfx *temp_v1_10; + Gfx *temp_v1_2; + Gfx *temp_v1_3; + Gfx *temp_v1_4; + Gfx *temp_v1_5; + Gfx *temp_v1_6; + Gfx *temp_v1_7; + Gfx *temp_v1_8; + Gfx *temp_v1_9; s32 temp_t8; s32 temp_t9; s32 temp_v0; @@ -7824,13 +7583,13 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { s32 phi_v0; s32 phi_v0_2; s32 phi_v1; - u32 phi_a0; + MkAnimation *phi_a0; struct _struct_D_800E8234_0x8 *phi_v1_2; struct _struct_D_800E8234_0x8 *phi_v1_3; u8 phi_v1_4; s32 phi_v1_5; struct _struct_D_800E8234_0x8 *phi_a2; - u32 phi_a0_2; + MkAnimation *phi_a0_2; phi_ra = D_8018D9E0; phi_v0 = 0; @@ -7886,22 +7645,22 @@ loop_3: return; case 0xD2: sp7C = phi_ra; - func_800996BC(&D_020014C8, 0, priority); - func_8009B954(&D_020014C8); - D_8018E75C = func_8009BA74(D_8018E75C, &D_020014C8, phi_ra->column, phi_ra->row); + func_800996BC(D_020014C8, 0, priority); + func_8009B954(D_020014C8); + D_8018E75C = func_8009BA74(D_8018E75C, D_020014C8, phi_ra->column, phi_ra->row); func_8009B998(); return; case 0xD3: sp7C = phi_ra; - func_800996BC(&D_02001540, 0, priority); - func_8009B954(&D_02001540); - D_8018E75C = func_8009BA74(D_8018E75C, &D_02001540, phi_ra->column, phi_ra->row); + func_800996BC(D_02001540, 0, priority); + func_8009B954(D_02001540); + D_8018E75C = func_8009BA74(D_8018E75C, D_02001540, phi_ra->column, phi_ra->row); func_8009B998(); return; case 0xD4: sp7C = phi_ra; - func_800996BC(&D_0200157C, 0, priority); - func_80099184(&D_02001874); + func_800996BC(D_0200157C, 0, priority); + func_80099184((s32) D_02001874); phi_ra->row = 0x69; phi_v1_2 = D_800E7AF8; do { @@ -7913,63 +7672,63 @@ loop_3: return; case 0xD5: sp7C = phi_ra; - func_80099184(&D_020015A4, priority); - func_8009B954(&D_020015A4); - temp_v0_2 = func_8009BA74(D_8018E75C, &D_020015A4, phi_ra->column, phi_ra->row); + func_80099184((s32) D_020015A4); + func_8009B954(D_020015A4); + temp_v0_2 = func_8009BA74(D_8018E75C, D_020015A4, phi_ra->column, phi_ra->row); D_8018E75C = temp_v0_2; D_8018E75C = temp_v0_2 + 8; - *temp_v0_2 = 0xFD700000; + temp_v0_2->words.w0 = 0xFD700000; sp6C = temp_v0_2; - sp6C->unk4 = func_8009B8C4(&gTexture7ED50C); + sp6C->words.w1 = func_8009B8C4(gTexture7ED50C); temp_v1_2 = D_8018E75C; D_8018E75C = temp_v1_2 + 8; - temp_v1_2->unk0 = 0xF5700000; - temp_v1_2->unk4 = 0x07080200; + temp_v1_2->words.w0 = 0xF5700000; + temp_v1_2->words.w1 = 0x07080200; temp_v1_3 = D_8018E75C; D_8018E75C = temp_v1_3 + 8; - temp_v1_3->unk4 = 0; - temp_v1_3->unk0 = 0xE6000000; + temp_v1_3->words.w1 = 0; + temp_v1_3->words.w0 = 0xE6000000; temp_v1_4 = D_8018E75C; D_8018E75C = temp_v1_4 + 8; - temp_v1_4->unk4 = 0x074FF020; - temp_v1_4->unk0 = 0xF3000000; + temp_v1_4->words.w1 = 0x074FF020; + temp_v1_4->words.w0 = 0xF3000000; temp_v1_5 = D_8018E75C; D_8018E75C = temp_v1_5 + 8; - temp_v1_5->unk4 = 0; - temp_v1_5->unk0 = 0xE7000000; + temp_v1_5->words.w1 = 0; + temp_v1_5->words.w0 = 0xE7000000; temp_v1_6 = D_8018E75C; D_8018E75C = temp_v1_6 + 8; - temp_v1_6->unk0 = 0xF5708000; - temp_v1_6->unk4 = 0x80200; + temp_v1_6->words.w0 = 0xF5708000; + temp_v1_6->words.w1 = 0x80200; temp_v1_7 = D_8018E75C; D_8018E75C = temp_v1_7 + 8; - temp_v1_7->unk0 = 0xF2000000; - temp_v1_7->unk4 = 0x3FC010; + temp_v1_7->words.w0 = 0xF2000000; + temp_v1_7->words.w1 = 0x3FC010; temp_v1_8 = D_8018E75C; D_8018E75C = temp_v1_8 + 8; - temp_v1_8->unk4 = 0x802C0; - temp_v1_8->unk0 = 0xE44802D4; + temp_v1_8->words.w1 = 0x802C0; + temp_v1_8->words.w0 = 0xE44802D4; temp_v1_9 = D_8018E75C; D_8018E75C = temp_v1_9 + 8; - temp_v1_9->unk4 = 0x80; - temp_v1_9->unk0 = 0xB3000000; + temp_v1_9->words.w1 = 0x80; + temp_v1_9->words.w0 = 0xB3000000; temp_v1_10 = D_8018E75C; D_8018E75C = temp_v1_10 + 8; - temp_v1_10->unk0 = 0xB2000000; - temp_v1_10->unk4 = 0x0400FC00; + temp_v1_10->words.w0 = 0xB2000000; + temp_v1_10->words.w1 = 0x0400FC00; sp7C = phi_ra; func_8009B998(); - func_80099184(&D_020015CC); - func_8009B954(&D_020015CC); - D_8018E75C = func_8009BA74(D_8018E75C, &D_020015CC, phi_ra->column, phi_ra->row); + func_80099184((s32) D_020015CC); + func_8009B954(D_020015CC); + D_8018E75C = func_8009BA74(D_8018E75C, D_020015CC, phi_ra->column, phi_ra->row); func_8009B998(); - func_80099184(&D_02001630); - func_8009B954(&D_02001630); - D_8018E75C = func_8009BA74(D_8018E75C, &D_02001630, phi_ra->column, phi_ra->row); + func_80099184((s32) D_02001630); + func_8009B954(D_02001630); + D_8018E75C = func_8009BA74(D_8018E75C, D_02001630, phi_ra->column, phi_ra->row); func_8009B998(); - func_80099184(&D_02001658); - func_8009B954(&D_02001658); - D_8018E75C = func_8009BA74(D_8018E75C, &D_02001658, phi_ra->column, phi_ra->row); + func_80099184((s32) D_02001658); + func_8009B954(D_02001658); + D_8018E75C = func_8009BA74(D_8018E75C, D_02001658, phi_ra->column, phi_ra->row); func_8009B998(); return; case 0xD6: @@ -7987,7 +7746,7 @@ loop_3: return; case 0xD8: case 0xD9: - func_80099184(&D_0200184C, priority); + func_80099184((s32) D_0200184C); return; case 0x1: func_800996BC(D_800E7D4C[func_800B555C(priority)], 0); @@ -7995,16 +7754,16 @@ loop_3: case 0x2: func_8006EE44(priority); gD_8018E118TotalSize += 0x10000; - func_80099184(&D_020045E8); + func_80099184((s32) D_020045E8); return; case 0x3: - func_80099184(&D_02004610, priority); + func_80099184((s32) D_02004610); return; case 0x23: case 0x24: case 0x25: func_800996BC(D_800E7D4C[func_800B555C(priority)], 0); - func_800996BC(&D_02004B74, 0); + func_800996BC(D_02004B74, 0); func_8009B0A4(0, 0x19); temp_v0_3 = &D_800E74E8[type]; func_8009B538(0, 0x12C00, temp_v0_3->unk-118, temp_v0_3->unk-116, (s32) temp_v0_3->unk-114); @@ -8035,11 +7794,11 @@ loop_3: func_80099184(segmented_to_virtual(sp24->unk-54)); return; case 0x2A: - func_800996BC(&D_02004B4C, 0, priority); + func_800996BC(D_02004B4C, 0, priority); return; case 0x33: sp7C = phi_ra; - func_800996BC(&D_02004B74, 0, priority); + func_800996BC(D_02004B74, 0, priority); phi_ra->unk1C = 0x20; return; case 0x34: @@ -8101,7 +7860,7 @@ loop_3: case 0x67: phi_ra->unk1C = (s32) gCupSelection; sp7C = phi_ra; - temp_v0_6 = func_800B54C0(gCupSelection, gCCSelection, priority); + temp_v0_6 = func_800B54C0((s32) gCupSelection, gCCSelection); temp_v1_12 = temp_v0_6; phi_ra->unk20 = temp_v0_6; phi_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe(*(&D_800E7E20 + ((((s32) gCCSelection / 2) * 0x10) + -(s32) (temp_v1_12 * 4))))); @@ -8115,7 +7874,7 @@ loop_3: phi_ra->row = 0xC3; return; case 0x69: - func_800996BC(segmented_to_virtual((u32) &D_02004A0C), 0); + func_800996BC(segmented_to_virtual(D_02004A0C), 0); if (func_800B5B94() == 0) { func_800B6708(); return; @@ -8130,7 +7889,7 @@ loop_3: func_800996BC(segmented_to_virtual(D_800E8114[type]), 0); return; case 0x8C: - func_800996BC(segmented_to_virtual((u32) &D_02004A34), 0); + func_800996BC(segmented_to_virtual(D_02004A34), 0); if (func_800B5B94() == 0) { func_800B6708(); return; @@ -8139,7 +7898,7 @@ loop_3: D_8018EE10.unk84 = 0; return; case 0x8D: - func_80099184(segmented_to_virtual((u32) &D_02001FA4)); + func_80099184(segmented_to_virtual(D_02001FA4)); return; case 0x7C: case 0x7D: @@ -8162,7 +7921,7 @@ loop_3: func_800996BC(segmented_to_virtual(D_800E7D74[*(gCupCourseOrder + (((temp_v0_7 / 4) * 8) + ((temp_v0_7 % 4) * 2)))]), -1); temp_v0_8 = phi_ra->type - 0x7C; func_800996BC(segmented_to_virtual(D_800E7DC4[*(gCupCourseOrder + (((temp_v0_8 / 4) * 8) + ((temp_v0_8 % 4) * 2)))]), 0); - func_800996BC(segmented_to_virtual((u32) &D_02004A0C), 0); + func_800996BC(segmented_to_virtual(D_02004A0C), 0); return; case 0xB1: case 0xB2: @@ -8207,12 +7966,12 @@ loop_3: return; case 0xBB: sp7C = phi_ra; - phi_ra->unk1C = func_800B5020(D_8018CA78, D_800E86A8, priority); + phi_ra->unk1C = func_800B5020(D_8018CA78, *gCharacterSelections, priority); phi_ra->unk20 = func_800B5218(); - if (D_80162DD4 != 1) { + if (*D_80162DD4 != 1) { sp7C = phi_ra; if (func_800051C4() >= 0x3C01) { - D_80162DD4 = 1; + *D_80162DD4 = 1; } } if ((phi_ra->unk1C == 0) || (phi_ra->unk20 != 0)) { @@ -8225,7 +7984,7 @@ loop_3: sp7C = phi_ra; phi_ra->D_8018DEE0_index = func_8009A374(segmented_to_virtual_dupe(D_800E7E34[*(gCupCourseOrder + ((((s32) temp_v0_10 / 4) * 8) + (((s32) temp_v0_10 % 4) * 2)))])); phi_ra->unk1C = (s32) gTimeTrialDataCourseIndex; - func_800996BC(segmented_to_virtual((u32) &D_02004A0C), 0); + func_800996BC(segmented_to_virtual(D_02004A0C), 0); func_8006EF60(); if (func_800B5B94() == 0) { func_800B6708(); @@ -8238,14 +7997,14 @@ loop_3: phi_ra->unk4 = (s32) gSoundMode; return; case 0xF1: - func_800996BC(segmented_to_virtual((u32) &D_02004638), 0); + func_800996BC(segmented_to_virtual(D_02004638), 0); return; case 0xBE: D_8018ED90 = 0; return; case 0x130: - temp_a1_2 = *(&D_800EFD64 + D_802874D8.unk1E); - if ((s32) D_802874D8.unk1D >= 3) { + temp_a1_2 = *(&D_800EFD64 + D_802874D8.unk_1E); + if ((s32) D_802874D8.unk_1D >= 3) { phi_v0_2 = 1; } phi_v1 = temp_a1_2 * 4; @@ -8267,109 +8026,190 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/add_8018D9E0_entry.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void *draw_box(void *, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ -? draw_text(s32, s32, ? *, ?, f32, f32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_8004C8D4(s16, s16); /* extern */ -s32 get_string_width(? *); /* extern */ -? func_80093324(s32, s32, ? *, s32, f32, f32); /* extern */ -? func_800936B8(s32, s32, ? *, s32, f32, f32); /* extern */ -? func_800939C8(?, ?, ? *, ?, f32, f32); /* extern */ -? func_80094660(s32, s32); /* extern */ -? func_800947B4(s32, s32); /* extern */ -void *func_800959A0(void *, s32, s32, s32, s32); /* extern */ -void *func_800959CC(void *, s32, s32, s32, s32); /* extern */ -void *func_80096CD8(void *, ?, ?, ?, s32); /* extern */ -void *func_80098C18(void *, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ -? func_8009A76C(s32, s32, s32, s32); /* extern */ -? func_8009A7EC(s32, s32, s32, s32, s32); /* extern */ -void *func_8009B9D0(void *, ? *); /* extern */ -void *func_8009BA74(void *, ? *, s32, s32); /* extern */ -void *func_8009BC9C(void *, ? *, s32, s32, s32, s32); /* extern */ -? func_800A09E0(void *); /* extern */ -? func_800A0AD0(void *); /* extern */ -? func_800A0B80(void *); /* extern */ +Gfx *func_800959CC(Gfx *, s32, s32, s32, s32); /* extern */ +Gfx *func_80096CD8(Gfx *, ?, ?, ?, s32); /* extern */ +Gfx *func_8009B9D0(Gfx *, MkTexture *); /* extern */ +Gfx *func_8009BC9C(Gfx *, MkTexture *, s32, s32, s32, s32); /* extern */ +? func_800A09E0(struct_8018D9E0_entry *); /* extern */ +? func_800A0B80(struct_8018D9E0_entry *); /* extern */ ? func_800A0DFC(s32); /* extern */ -? func_800A0EB8(void *, s32); /* extern */ -? func_800A0FA4(void *, s32); /* extern */ -? func_800A10CC(void *); /* extern */ -? func_800A11D0(void *, s32, s32); /* extern */ -? func_800A12BC(void *, ? *); /* extern */ -? func_800A143C(void *, s32); /* extern */ -? func_800A1500(void *); /* extern */ -? func_800A15EC(void *); /* extern */ -? func_800A1780(void *); /* extern */ -? func_800A1924(void *); /* extern */ -? func_800A1A20(void *); /* extern */ -? func_800A1BE0(void *); /* extern */ -? func_800A1DE0(void *); /* extern */ -? func_800A1F30(void *); /* extern */ -? func_800A1FB0(void *); /* extern */ -? func_800A2D1C(void *); /* extern */ -? func_800A2EB8(void *); /* extern */ -? func_800A34A8(void *); /* extern */ -? func_800A3C84(void *); /* extern */ -? func_800A3E60(void *); /* extern */ -? func_800A4A24(void *); /* extern */ -? func_800A4B38(void *); /* extern */ -? func_800A5738(void *); /* extern */ -? func_800A6034(void *); /* extern */ -? func_800A6154(void *); /* extern */ -? func_800A638C(void *); /* extern */ -? func_800A70E8(void *); /* extern */ -? func_800A7258(void *); /* extern */ -? func_800A72FC(void *); /* extern */ -? func_800A7448(void *); /* extern */ -? func_800A75A0(void *); /* extern */ -? func_800A761C(void *); /* extern */ -? func_800A7790(void *); /* extern */ -? get_time_record_minutes(s32, ? *); /* extern */ -? get_time_record_seconds(s32, ? *); /* extern */ -? get_time_record_centiseconds(s32, ? *); /* extern */ -? func_800A8270(s32, void *); /* extern */ -? func_800A8564(void *); /* extern */ -? func_800A86E8(void *); /* extern */ -? func_800A874C(void *); /* extern */ -? func_800A890C(s32, void *); /* extern */ -? func_800A8A98(void *); /* extern */ -? func_800A8CA4(void *); /* extern */ -? func_800A8E14(void *); /* extern */ -? func_800A8EC0(void *); /* extern */ -? func_800A8F48(void *); /* extern */ -? func_800A90D4(s32, void *); /* extern */ -s32 func_800B4EB4(?, ?); /* extern */ -s32 func_800B555C(s32); /* extern */ -void *segmented_to_virtual(void*); /* extern */ -? set_text_color(s32); /* extern */ -extern s32 D_800DC540; -extern s32 D_800DC548; +? func_800A0EB8(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A0FA4(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A10CC(struct_8018D9E0_entry *); /* extern */ +? func_800A12BC(struct_8018D9E0_entry *, void *); /* extern */ +? func_800A143C(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A1500(struct_8018D9E0_entry *); /* extern */ +? func_800A1780(struct_8018D9E0_entry *); /* extern */ +? func_800A1BE0(struct_8018D9E0_entry *); /* extern */ +? func_800A1DE0(struct_8018D9E0_entry *); /* extern */ +? func_800A1F30(struct_8018D9E0_entry *); /* extern */ +? func_800A1FB0(struct_8018D9E0_entry *); /* extern */ +? func_800A2D1C(struct_8018D9E0_entry *); /* extern */ +? func_800A2EB8(struct_8018D9E0_entry *); /* extern */ +? func_800A34A8(struct_8018D9E0_entry *); /* extern */ +? func_800A3E60(struct_8018D9E0_entry *); /* extern */ +? func_800A4A24(struct_8018D9E0_entry *); /* extern */ +? func_800A5738(struct_8018D9E0_entry *); /* extern */ +? func_800A6154(struct_8018D9E0_entry *); /* extern */ +? func_800A638C(struct_8018D9E0_entry *); /* extern */ +? func_800A70E8(struct_8018D9E0_entry *); /* extern */ +? func_800A761C(struct_8018D9E0_entry *); /* extern */ +? func_800A7790(struct_8018D9E0_entry *); /* extern */ +? func_800A8270(s32, struct_8018D9E0_entry *); /* extern */ +? func_800A8564(struct_8018D9E0_entry *); /* extern */ +? func_800A874C(struct_8018D9E0_entry *); /* extern */ +? func_800A890C(s32, struct_8018D9E0_entry *); /* extern */ +? func_800A8A98(struct_8018D9E0_entry *); /* extern */ +? func_800A8CA4(struct_8018D9E0_entry *); /* extern */ +? func_800A8F48(struct_8018D9E0_entry *); /* extern */ +? func_800A90D4(s32, struct_8018D9E0_entry *); /* extern */ extern ? D_8018EDE8; -extern s8 gMainMenuSelectionDepth; extern s8 D_8018EDF3; extern s8 D_802874F6; -extern ? gCharacterGridSelections; -extern void *gDisplayListHead; -extern s32 gGfxPool; -extern s32 gGlobalTimer; -static ? D_020014C8; /* unable to generate initializer */ -static ? D_02001540; /* unable to generate initializer */ -static ? D_020015A4; /* unable to generate initializer */ -static ? D_020015CC; /* unable to generate initializer */ -static ? D_02001630; /* unable to generate initializer */ -static ? D_02001658; /* unable to generate initializer */ -static ? D_020045E8; /* unable to generate initializer */ -static ? D_02004610; /* unable to generate initializer */ -static ? D_02004638; /* unable to generate initializer */ -static ? D_02004660; /* unable to generate initializer */ -static ? D_0200487C; /* unable to generate initializer */ -static ? D_02004A34; /* unable to generate initializer */ -static ? D_02004B4C; /* unable to generate initializer */ -static ? D_02004B74; /* unable to generate initializer */ -static ? D_02004E80; /* unable to generate initializer */ -static s16 gCurrentCourseId; /* type too large by 2; unable to generate initializer */ -static ? D_800E7500; /* unable to generate initializer; const */ -static ? D_800E7524; /* unable to generate initializer; const */ -static ? *D_800E7574[8] = { +extern s8 gMainMenuSelectionDepth; +static s8 *D_800E7594[0xC] = { + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", +}; /* const */ +static s8 *D_800E77A0[2] = { "CONNECT A CONTROLLER TO SOCKET 1,", "THEN POWER ON AGAIN" }; /* const */ +static MkTexture *D_800E7CA8[0x19] = { + D_020010E0, + D_02001108, + D_02001130, + D_02001158, + D_02001180, + D_020011A8, + D_020011D0, + D_020011F8, + D_02001220, + D_02001248, + D_02001270, + D_02001298, + D_020012C0, + D_020012E8, + D_02001310, + D_02001338, + D_02001360, + D_02001388, + D_020013B0, + D_020013D8, + D_02001400, + D_02001428, + D_02001450, + D_02001478, + D_020014A0, +}; /* const */ +static MkTexture *D_800E7D4C[2] = { D_02004598, D_020045C0 }; /* const */ +static MkTexture *D_800E7D54[8] = { + D_02001A8C, + D_02001A64, + D_02001AB4, + D_02001A14, + D_02001B04, + D_020019EC, + D_02001ADC, + D_02001A3C, +}; /* const */ +static MkTexture *D_800E817C[0x1A] = { + D_02003A1C, + D_02003FE4, + D_02003A44, + D_0200400C, + D_02003A6C, + D_02003A94, + D_02003ABC, + D_02003AE4, + D_02003B0C, + D_02003B34, + D_02003B5C, + D_02003B84, + D_02003BAC, + D_0200405C, + D_02004084, + D_020040AC, + D_020040D4, + D_020040FC, + D_020043CC, + D_02004444, + D_0200437C, + D_020043F4, + D_02004124, + D_0200414C, + D_02004174, + D_0200419C, +}; /* const */ +static MkTexture *D_800E824C[2] = { D_0200478C, D_02004854 }; /* const */ +static MkTexture *D_800E8254[8] = { + D_02004660, + D_02004688, + D_020046D8, + D_0200473C, + D_0200478C, + D_0200487C, + D_020048A4, + D_020048CC, +}; /* const */ +static MkTexture *D_800E8294[8] = { + D_020048F4, + D_0200491C, + D_02004944, + D_0200496C, + D_020049BC, + D_02004994, + D_020049E4, + D_02004A34, +}; /* const */ +static ? D_800EFD64; /* unable to generate initializer; const */ +static ? gGameModeFromNumPlayersAndRowSelection; /* unable to generate initializer; const */ +static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ +static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ +s16 gCurrentCourseId; /* unable to generate initializer */ +s8 *D_800E7500[9] = { + "mushroom cup", + "flower cup", + "star cup", + "special cup", + "battle", + "mushroom cup", + "flower cup", + "star cup", + "special cup", +}; /* const */ +s8 *D_800E7524[0x14] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", +}; /* const */ +s8 *D_800E7574[8] = { "mario raceway", "choco mountain", "bowser's castle", @@ -8379,34 +8219,25 @@ static ? *D_800E7574[8] = { "koopa troopa beach", "royal raceway", }; /* const */ -static ? D_800E7594; /* unable to generate initializer; const */ -static ? *D_800E77A0[2] = { "CONNECT A CONTROLLER TO SOCKET 1,", "THEN POWER ON AGAIN" }; /* const */ -static ? D_800E77A8; /* unable to generate initializer; const */ -static ? D_800E7CA8; /* unable to generate initializer; const */ -static ? D_800E7D4C; /* unable to generate initializer; const */ -static ? D_800E7D54; /* unable to generate initializer; const */ -static ? D_800E817C; /* unable to generate initializer; const */ -static ? D_800E824C; /* unable to generate initializer; const */ -static ? D_800E8254; /* unable to generate initializer; const */ -static ? D_800E8294; /* unable to generate initializer; const */ -static ? gCharacterSelections; /* unable to generate initializer; const */ -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? D_800EFD64; /* unable to generate initializer; const */ -static ? gGameModeFromNumPlayersAndRowSelection; /* unable to generate initializer; const */ +s8 *D_800E77A8 = "BATTLE GAME"; /* const */ +s8 gCharacterSelections[4]; /* unable to generate initializer; const */ -void func_8009F5E0(void *arg0) { +void func_8009F5E0(struct_8018D9E0_entry *arg0) { s32 spAC; s32 spA8; - ? *sp9C; - ? sp80; + MkTexture *sp9C; + s8 sp80; s32 sp58; f32 sp4C; s32 sp44; - ? **sp40; + s8 **sp40; s32 sp3C; f32 sp38; - ? **temp_v0_8; + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; + Gfx *temp_v1; + Gfx *temp_v1_2; s32 temp_a0; s32 temp_a0_2; s32 temp_a0_3; @@ -8417,12 +8248,12 @@ void func_8009F5E0(void *arg0) { s32 temp_a1_5; s32 temp_a1_6; s32 temp_a1_7; - s32 temp_a2_2; + s32 temp_a2; s32 temp_a2_3; s32 temp_a2_4; + s32 temp_a2_5; s32 temp_a2_6; - s32 temp_a2_8; - s32 temp_a2_9; + s32 temp_a2_7; s32 temp_t0; s32 temp_t1; s32 temp_t2; @@ -8431,555 +8262,588 @@ void func_8009F5E0(void *arg0) { s32 temp_t8; s32 temp_t9; s32 temp_v0_10; + s32 temp_v0_12; s32 temp_v0_13; - s32 temp_v0_5; + s32 temp_v0_4; s32 temp_v0_6; s32 temp_v0_7; - s32 temp_v0_9; s32 temp_v1_3; s32 temp_v1_4; s32 temp_v1_5; - s32 temp_v1_6; + s32 temp_v1_7; s32 temp_v1_8; - s8 temp_a2; - s8 temp_a2_5; - s8 temp_a2_7; + s8 **temp_v0_5; + s8 temp_a2_2; s8 temp_v0_11; - s8 temp_v0_12; - s8 temp_v0_4; - s8 temp_v1_7; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - void *temp_v1; - void *temp_v1_2; + s8 temp_v0_8; + s8 temp_v0_9; + s8 temp_v1_6; f32 phi_f0; - void *phi_v0; + Gfx *phi_v0; s32 phi_t0; - ? **phi_v0_2; + s8 **phi_v0_2; s32 phi_v1; s32 phi_t0_2; s32 phi_v1_2; s32 phi_a2; s8 phi_a2_2; s32 phi_a1; - void *phi_v0_3; + Gfx *phi_v0_3; s32 phi_a2_3; s32 phi_a2_4; - if (arg0->unk15 != 0) { + if ((s8) arg0->visible != 0) { temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->unk4 = 0; - temp_v1->unk0 = 0xE7000000; - temp_t0 = arg0->unk0; + temp_v1->words.w1 = 0; + temp_v1->words.w0 = 0xE7000000; + temp_t0 = arg0->type; phi_t0_2 = temp_t0; - if (temp_t0 >= 0x10F) { - if (temp_t0 >= 0x131) { - switch (temp_t0) { /* switch 1 */ - func_800A7790(arg0); - break; - } - /* Duplicate return node #135. Try simplifying control flow for better match */ + switch (temp_t0) { /* switch 6; irregular */ + case 0xFA: /* switch 6 */ + func_80094660(gGfxPool, arg0->unk1C); + return; + case 0xFB: /* switch 6 */ + func_800947B4(gGfxPool, arg0->unk1C); + return; + case 0xD2: /* switch 6 */ + gDisplayListHead = func_8009B9D0(gDisplayListHead, D_020014C8); + return; + case 0xD3: /* switch 6 */ + gDisplayListHead = func_8009B9D0(gDisplayListHead, D_02001540); + return; + case 0xD4: /* switch 6 */ + func_800A09E0(arg0); + func_800A0AD0(arg0); + func_800A0B80(arg0); + return; + case 0xD5: /* switch 6 */ + // Sets the text color of the text on the Controller Pak menu + // Also sets the color of the shading at the top and bottom of the menu + // Does not set color of the text in the table itself + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x00, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015A4); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x00, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015CC); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x32, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001630); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x32, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001658); + return; + case 0xD6: /* switch 6 */ + func_8009A76C(arg0->type, arg0->type, arg0->type, -1); + return; + case 0xD7: /* switch 6 */ + func_800A0DFC(temp_t0); + return; + case 0xD8: /* switch 6 */ + case 0xD9: /* switch 6 */ + func_800A0EB8(arg0, temp_t0 - 0xD8); + return; + case 0x1: /* switch 6 */ + gDisplayListHead = func_8009BA74(gDisplayListHead, D_800E7D4C[func_800B555C(temp_t0)], arg0->type, arg0->type); + return; + case 0x2: /* switch 6 */ + func_8004C8D4((s16) (arg0->type + 0xA0), (s16) (arg0->type + 0x47)); + gDisplayListHead = func_8009BA74(gDisplayListHead, D_020045E8, arg0->type, arg0->type); + return; + case 0x3: /* switch 6 */ + if (((s32) ((s32) gGlobalTimer / 8) % 3) != 0) { + gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004610, arg0->type, arg0->type); return; } - switch (temp_t0) { /* switch 2 */ - case 0x12B: /* switch 2 */ - func_800A7258(arg0); - return; - case 0x12C: /* switch 2 */ - func_800A72FC(arg0); - return; - case 0x12D: /* switch 2 */ - func_800A7448(arg0); - return; - case 0x12E: /* switch 2 */ - func_800A75A0(arg0); - return; - case 0x12F: /* switch 2 */ - func_800A761C(arg0); - return; - case 0x130: /* switch 2 */ - if (arg0->unk4 != 0) { - temp_a2 = *(&D_800EFD64 + D_802874F6); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2 * 4))), arg0->unkC, arg0->unk10); - func_8009A7EC(arg0->unk18, arg0->unkC, arg0->unk10, 0, arg0->unk1C); - return; - } - /* Duplicate return node #135. Try simplifying control flow for better match */ - return; + break; + case 0x5: /* switch 6 */ + temp_t4 = (s32) ((f32) (get_string_width(*D_800E7574) + 5) * 0.9f) / 2; + gDisplayListHead = draw_box(gDisplayListHead, 0xA0 - temp_t4, 0x7B, temp_t4 + 0xA0, 0xA4, 0, 0, 0, 0x96); + set_text_color(1); + draw_text(0x9B, 0x8C, *D_800E7574, 0, 0.9f, 0.9f); + temp_v1_3 = func_800B4EB4(0, 7) & 0xFFFFF; + if (temp_v1_3 < 0x1EAA) { + set_text_color((s32) gGlobalTimer % 2); + } else if (temp_v1_3 < 0x2329) { + set_text_color((s32) gGlobalTimer % 3); + } else { + set_text_color(3); } - } else if (temp_t0 >= 0x38) { - switch (temp_t0) { /* switch 3 */ - case 0xFA: /* switch 3 */ - func_80094660(gGfxPool, arg0->unk1C); - return; - case 0xFB: /* switch 3 */ - func_800947B4(gGfxPool, arg0->unk1C); - return; - case 0xD2: /* switch 3 */ - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020014C8); - return; - case 0xD3: /* switch 3 */ - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001540); - return; - case 0xD4: /* switch 3 */ - func_800A09E0(arg0); - func_800A0AD0(arg0); - func_800A0B80(arg0); - return; - case 0xD5: /* switch 3 */ - // Sets the text color of the text on the Controller Pak menu - // Also sets the color of the shading at the top and bottom of the menu - // Does not set color of the text in the table itself - gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x00, 0x00, 0xFF); - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015A4); - gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x00, 0x00, 0xFF); - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015CC); - gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x32, 0x00, 0xFF); - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001630); - gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x32, 0x00, 0xFF); - gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001658); - return; - case 0xD6: /* switch 3 */ - func_8009A76C(arg0->unk0, arg0->unk0, arg0->unk0, -1); - return; - case 0xD7: /* switch 3 */ - func_800A0DFC(temp_t0); - return; - case 0xD8: /* switch 3 */ - case 0xD9: /* switch 3 */ - func_800A0EB8(arg0, temp_t0 - 0xD8); - return; - case 0x58: /* switch 3 */ - case 0x59: /* switch 3 */ - case 0x5A: /* switch 3 */ - case 0x5B: /* switch 3 */ - case 0x5C: /* switch 3 */ - func_800A8A98(arg0); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E817C + (arg0->unk0 * 4))), arg0->unkC, arg0->unk10); - func_800A8CA4(arg0); - return; - case 0x52: /* switch 3 */ - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E817C + (temp_t0 * 4))), arg0->unkC, arg0->unk10); - return; - case 0x5F: /* switch 3 */ - case 0x60: /* switch 3 */ - case 0x61: /* switch 3 */ - case 0x62: /* switch 3 */ - func_800A1500(arg0); - return; - case 0x53: /* switch 3 */ - case 0x54: /* switch 3 */ - case 0x55: /* switch 3 */ - case 0x56: /* switch 3 */ - temp_a0 = temp_t0 - 0x53; - spAC = temp_a0; - func_800A890C(temp_a0, arg0); - func_800A143C(arg0, spAC); - return; - case 0x5D: /* switch 3 */ - func_800A8564(arg0); - gDisplayListHead = func_8009BC9C(gDisplayListHead, &D_02004E80, arg0->unkC, arg0->unk10, 2, arg0->unk1C); - return; - case 0x65: /* switch 3 */ - case 0x66: /* switch 3 */ - if (temp_t0 == 0x65) { - phi_f0 = 0.6f; - } else { - phi_f0 = 0.8f; - } - sp4C = phi_f0; - func_800A86E8(arg0); - set_text_color(TEXT_YELLOW); - func_80093324(arg0->unkC + 8, arg0->unk10 + 0x10, *(&D_800E7594 + (arg0->unk0 * 4)), 0, phi_f0, 0.8f); - func_800A874C(arg0); - return; - case 0x6E: /* switch 3 */ - func_800A8E14(arg0); - return; - case 0x67: /* switch 3 */ - func_800A8EC0(arg0); - return; - case 0x68: /* switch 3 */ - temp_a1 = arg0->unkC; - temp_a2_2 = arg0->unk10; - gDisplayListHead = func_80098C18(gDisplayListHead, temp_a1, temp_a2_2, temp_a1 + 0x3F, temp_a2_2 + 0x11, 1, 1, 1, 0xFF); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E8294 + (D_800DC548 * 4))), arg0->unkC, arg0->unk10); - return; - case 0x69: /* switch 3 */ - func_800A8F48(arg0); - return; - case 0x78: /* switch 3 */ - case 0x79: /* switch 3 */ - case 0x7A: /* switch 3 */ - case 0x7B: /* switch 3 */ - temp_a0_2 = temp_t0 - 0x78; - spAC = temp_a0_2; - func_800A90D4(temp_a0_2, arg0); - func_800A143C(arg0, spAC); - return; - case 0x8C: /* switch 3 */ - temp_v0_4 = gMainMenuSelectionDepth; - if ((temp_v0_4 >= GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION) && (spAC == (temp_t0 - spA8))) { - if (temp_v0_4 >= CONFIRM_OK_SELECTION) { - temp_a1_2 = arg0->unkC; - temp_a2_3 = arg0->unk10; - phi_v0 = func_80098C18(gDisplayListHead, temp_a1_2, temp_a2_3, temp_a1_2 + 0x3F, temp_a2_3 + 0x11, 0xFF, 0xF9, 0xDC, 0xFF); - } else { - temp_v1_3 = arg0->unk10; - temp_v0_5 = arg0->unkC; - phi_v0 = func_800959A0(gDisplayListHead, temp_v0_5, temp_v1_3, temp_v0_5 + 0x3F, temp_v1_3 + 0x11); - } - } else { - temp_a1_3 = arg0->unkC; - temp_a2_4 = arg0->unk10; - phi_v0 = func_80098C18(gDisplayListHead, temp_a1_3, temp_a2_4, temp_a1_3 + 0x3F, temp_a2_4 + 0x11, 1, 1, 1, 0xFF); - } - gDisplayListHead = phi_v0; - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004A34, arg0->unkC, arg0->unk10); - set_text_color(TEXT_YELLOW); - func_800936B8(0x125, 0x1C, "a BUTTON*SEE DATA B BUTTON*EXIT", 0, 0.55f, 0.55f); - return; - case 0x8D: /* switch 3 */ - func_800A1780(arg0); - return; - case 0x7C: /* switch 3 */ - case 0x7D: /* switch 3 */ - case 0x7E: /* switch 3 */ - case 0x7F: /* switch 3 */ - case 0x80: /* switch 3 */ - case 0x81: /* switch 3 */ - case 0x82: /* switch 3 */ - case 0x83: /* switch 3 */ - case 0x84: /* switch 3 */ - case 0x85: /* switch 3 */ - case 0x86: /* switch 3 */ - case 0x87: /* switch 3 */ - case 0x88: /* switch 3 */ - case 0x89: /* switch 3 */ - case 0x8A: /* switch 3 */ - case 0x8B: /* switch 3 */ - func_800A15EC(arg0); - return; - case 0x96: /* switch 3 */ - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - func_800936B8(arg0->unkC, arg0->unk10, *(&D_800E7500 + (D_800DC540 * 4)), arg0->unk1C, arg0->unk24, 1.0f); - return; - case 0x97: /* switch 3 */ - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - func_80093324(arg0->unkC, arg0->unk10, *(&D_800E7524 + (gCurrentCourseId * 4)), arg0->unk1C, arg0->unk24, 1.0f); - return; - case 0x98: /* switch 3 */ - func_800A2D1C(arg0); - return; - case 0x5E: /* switch 3 */ - gDisplayListHead = func_80096CD8(gDisplayListHead, 0x19, 0x72, 0x7C, 0x4A); - return; - case 0xAA: /* switch 3 */ - func_800A2EB8(arg0); - return; - case 0xAB: /* switch 3 */ - func_800A34A8(arg0); - return; - case 0xAC: /* switch 3 */ - func_800A6154(arg0); - return; - case 0xAF: /* switch 3 */ - func_800A6034(arg0); - return; - case 0xB0: /* switch 3 */ - func_800A638C(arg0); - return; - case 0xB1: /* switch 3 */ - case 0xB2: /* switch 3 */ - case 0xB3: /* switch 3 */ - case 0xB4: /* switch 3 */ - temp_v0_6 = temp_t0 - 0xB1; - if (arg0->unk4 != 0) { - temp_a2_5 = *(&D_800EFD64 + *(&gCharacterSelections + temp_v0_6)); - spA8 = temp_v0_6; - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2_5 * 4))), arg0->unkC, arg0->unk10); - func_8009A7EC(arg0->unk18, arg0->unkC, arg0->unk10, spA8, arg0->unk1C); - func_800A11D0(arg0, spA8, 0xFF); - return; - } - /* Duplicate return node #135. Try simplifying control flow for better match */ - return; - case 0xB9: /* switch 3 */ - func_800A3C84(arg0); - return; - case 0xBA: /* switch 3 */ - func_800A3E60(arg0); - return; - case 0xBC: /* switch 3 */ - func_800A4A24(arg0); - return; - case 0xC7: /* switch 3 */ - func_800A4B38(arg0); - return; - case 0xBD: /* switch 3 */ - func_800A5738(arg0); - return; - case 0xE6: /* switch 3 */ - func_800A1924(arg0); - return; - case 0xE7: /* switch 3 */ - func_800A1A20(arg0); - return; - case 0xE8: /* switch 3 */ - func_800A1BE0(arg0); - return; - case 0xE9: /* switch 3 */ - func_800A1DE0(arg0); - return; - case 0xEA: /* switch 3 */ - func_800A1F30(arg0); - return; - case 0xF0: /* switch 3 */ - func_800A1FB0(arg0); - return; - case 0xF1: /* switch 3 */ - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004638, arg0->unkC, arg0->unk10); - return; - case 0x10E: /* switch 3 */ - func_800A70E8(arg0); - return; + get_time_record_minutes(temp_v1_3, &sp80); + func_800939C8(0x77, 0xA0, &sp80, 0, 1.0f, 1.0f); + func_80093324(0x8B, 0xA0, "'", 0, 1.0f, 1.0f); + get_time_record_seconds(temp_v1_3, &sp80); + func_800939C8(0x94, 0xA0, &sp80, 0, 1.0f, 1.0f); + func_80093324(0xA7, 0xA0, "\"", 0, 1.0f, 1.0f); + get_time_record_centiseconds(temp_v1_3, &sp80); + func_800939C8(0xB4, 0xA0, &sp80, 0, 1.0f, 1.0f); + return; + case 0x4: /* switch 6 */ + sp58 = get_string_width(D_800E77A0->unk0); + temp_v0_4 = get_string_width(D_800E77A0->unk4); + phi_t0 = sp58; + if (sp58 < temp_v0_4) { + phi_t0 = temp_v0_4; } - } else { - switch (temp_t0) { /* switch 4 */ - case 0x1: /* switch 4 */ - gDisplayListHead = func_8009BA74(gDisplayListHead, *(&D_800E7D4C + (func_800B555C(temp_t0) * 4)), arg0->unk0, arg0->unk0); - return; - case 0x2: /* switch 4 */ - func_8004C8D4(arg0->unk0 + 0xA0, arg0->unk0 + 0x47); - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_020045E8, arg0->unk0, arg0->unk0); - return; - case 0x3: /* switch 4 */ - if (((gGlobalTimer / 8) % 3) != 0) { - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004610, arg0->unk0, arg0->unk0); - return; - } - /* Duplicate return node #135. Try simplifying control flow for better match */ - return; - case 0x5: /* switch 4 */ - temp_t4 = ((get_string_width(*D_800E7574) + 5) * 0.9f) / 2; - gDisplayListHead = draw_box(gDisplayListHead, 0xA0 - temp_t4, 0x7B, temp_t4 + 0xA0, 0xA4, 0, 0, 0, 0x96); - set_text_color(TEXT_GREEN); - draw_text(0x9B, 0x8C, *D_800E7574, 0, 0.9f, 0.9f); - temp_v1_4 = func_800B4EB4(0, 7) & 0xFFFFF; - if (temp_v1_4 < 0x1EAA) { - set_text_color(gGlobalTimer % 2); - } else if (temp_v1_4 < 0x2329) { - set_text_color(gGlobalTimer % 3); + temp_t2 = (s32) ((f32) phi_t0 * 0.75f) / 2; + temp_t5 = (s32) (((f64) (0.75f * 2.0f) + 0.5) * 16.0) / 2; + gDisplayListHead = draw_box(gDisplayListHead, 0xA0 - temp_t2, 0xB6 - temp_t5, temp_t2 + 0xA0, temp_t5 + 0xB6, 0, 0, 0, 0x96); + set_text_color(4); + sp38 = (f32) 0xB4; + sp3C = (s32) ((f32) 0xA0 - (1.0f * 0.75f)); + phi_v0_2 = D_800E77A0; + phi_v1 = 0; + do { + sp40 = phi_v0_2; + sp44 = phi_v1; + draw_text(sp3C, (s32) (sp38 + ((f32) phi_v1 * 0.75f)), *phi_v0_2, 0, 0.75f, 0.75f); + temp_v0_5 = phi_v0_2 + 4; + phi_v0_2 = temp_v0_5; + phi_v1 += 0x12; + } while (temp_v0_5 != &D_800E77A8); + return; + case 0x23: /* switch 6 */ + case 0x24: /* switch 6 */ + case 0x25: /* switch 6 */ + gDisplayListHead = func_8009BC9C(gDisplayListHead, D_800E7D4C[func_800B555C(temp_t0)], arg0->column, arg0->row, 3, 0); + return; + case 0xA: /* switch 6 */ + gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004660, arg0->column, arg0->row); + return; + case 0xB: /* switch 6 */ + case 0xC: /* switch 6 */ + case 0xD: /* switch 6 */ + case 0xE: /* switch 6 */ + temp_a0 = temp_t0 - 0xB; + spAC = temp_a0; + func_800A8270(temp_a0, arg0); + func_800A0FA4(arg0, spAC); + return; + case 0xF: /* switch 6 */ + func_800A8564(arg0); + gDisplayListHead = func_8009BC9C(gDisplayListHead, D_0200487C, arg0->column, arg0->row, 2, arg0->unk1C); + return; + case 0x10: /* switch 6 */ + case 0x11: /* switch 6 */ + temp_v1_4 = arg0->unk1C; + phi_v1_2 = temp_v1_4; + if (temp_v1_4 < 0x20) { + temp_t9 = (s32) (temp_v1_4 * 0x3A) / 64; + if ((temp_t0 - 0xF) == gMainMenuSelectionDepth) { + temp_v0_6 = arg0->column; + temp_v1_5 = arg0->row; + gDisplayListHead = func_800959CC(gDisplayListHead, temp_v0_6 + temp_t9, temp_v1_5, (temp_v0_6 - temp_t9) + 0x39, temp_v1_5 + 0x12); } else { - set_text_color(TEXT_YELLOW); + temp_v0_7 = arg0->column; + temp_a2 = arg0->row; + gDisplayListHead = func_80098C18(gDisplayListHead, temp_v0_7 + temp_t9, temp_a2, (temp_v0_7 - temp_t9) + 0x39, temp_a2 + 0x12, 1, 1, 1, 0xFF); } - get_time_record_minutes(temp_v1_4, &sp80); - func_800939C8(0x77, 0xA0, &sp80, 0, 1.0f, 1.0f); - func_80093324(0x8B, 0xA0, "'", 0, 1.0f, 1.0f); - get_time_record_seconds(temp_v1_4, &sp80); - func_800939C8(0x94, 0xA0, &sp80, 0, 1.0f, 1.0f); - func_80093324(0xA7, 0xA0, "\"", 0, 1.0f, 1.0f); - get_time_record_centiseconds(temp_v1_4, &sp80); - func_800939C8(0xB4, 0xA0, &sp80, 0, 1.0f, 1.0f); - return; - case 0x4: /* switch 4 */ - sp58 = get_string_width(D_800E77A0->unk0); - temp_v0_7 = get_string_width(D_800E77A0->unk4); - phi_t0 = sp58; - if (sp58 < temp_v0_7) { - phi_t0 = temp_v0_7; + phi_t0_2 = arg0->type; + phi_v1_2 = arg0->unk1C; + } + temp_t8 = phi_t0_2 - 0xA; + spA8 = temp_t8; + gDisplayListHead = func_8009BC9C(gDisplayListHead, D_800E8254[temp_t8], arg0->column, arg0->row, 2, phi_v1_2); + return; + case 0x12: /* switch 6 */ + case 0x13: /* switch 6 */ + case 0x14: /* switch 6 */ + case 0x15: /* switch 6 */ + case 0x16: /* switch 6 */ + case 0x17: /* switch 6 */ + case 0x18: /* switch 6 */ + case 0x19: /* switch 6 */ + temp_v0_8 = D_8018EDF3; + temp_v1_6 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_8); + temp_a2_2 = *(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0_8 * 3) + temp_v1_6)); + temp_a1 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0_8 * 0xC) + (temp_v1_6 * 4))); + phi_a2 = (s32) temp_a2_2; + phi_a2_2 = temp_a2_2; + phi_a1 = temp_a1; + switch (temp_t0) { /* switch 5 */ + case 18: /* switch 5 */ + case 19: /* switch 5 */ + case 20: /* switch 5 */ + case 21: /* switch 5 */ + if ((temp_a1 != 0) && (temp_a1 != 2)) { + phi_a2 = -1; } - temp_t2 = (phi_t0 * 0.75f) / 2; - temp_t5 = (((0.75f * 2.0f) + 0.5) * 16.0) / 2; - gDisplayListHead = draw_box(gDisplayListHead, 0xA0 - temp_t2, 0xB6 - temp_t5, temp_t2 + 0xA0, temp_t5 + 0xB6, 0, 0, 0, 0x96); - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - sp38 = 0xB4; - sp3C = 0xA0 - (1.0f * 0.75f); - phi_v0_2 = D_800E77A0; - phi_v1 = 0; - do { - sp40 = phi_v0_2; - sp44 = phi_v1; - draw_text(sp3C, sp38 + (phi_v1 * 0.75f), *phi_v0_2, 0, 0.75f, 0.75f); - temp_v0_8 = phi_v0_2 + 4; - phi_v0_2 = temp_v0_8; - phi_v1 += 0x12; - } while (temp_v0_8 != &D_800E77A8); - return; - case 0x23: /* switch 4 */ - case 0x24: /* switch 4 */ - case 0x25: /* switch 4 */ - gDisplayListHead = func_8009BC9C(gDisplayListHead, *(&D_800E7D4C + (func_800B555C(temp_t0) * 4)), arg0->unkC, arg0->unk10, 3, 0); - return; - case 0xA: /* switch 4 */ - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004660, arg0->unkC, arg0->unk10); - return; - case 0xB: /* switch 4 */ - case 0xC: /* switch 4 */ - case 0xD: /* switch 4 */ - case 0xE: /* switch 4 */ - temp_a0_3 = temp_t0 - 0xB; - spAC = temp_a0_3; - func_800A8270(temp_a0_3, arg0); - func_800A0FA4(arg0, spAC); - return; - case 0xF: /* switch 4 */ - func_800A8564(arg0); - gDisplayListHead = func_8009BC9C(gDisplayListHead, &D_0200487C, arg0->unkC, arg0->unk10, 2, arg0->unk1C); - return; - case 0x10: /* switch 4 */ - case 0x11: /* switch 4 */ - temp_v1_5 = arg0->unk1C; - phi_v1_2 = temp_v1_5; - if (temp_v1_5 < 0x20) { - temp_t9 = (temp_v1_5 * 0x3A) / 64; - if ((temp_t0 - 0xF) == gMainMenuSelectionDepth) { - temp_v0_9 = arg0->unkC; - temp_v1_6 = arg0->unk10; - gDisplayListHead = func_800959CC(gDisplayListHead, temp_v0_9 + temp_t9, temp_v1_6, (temp_v0_9 - temp_t9) + 0x39, temp_v1_6 + 0x12); - } else { - temp_v0_10 = arg0->unkC; - temp_a2_6 = arg0->unk10; - gDisplayListHead = func_80098C18(gDisplayListHead, temp_v0_10 + temp_t9, temp_a2_6, (temp_v0_10 - temp_t9) + 0x39, temp_a2_6 + 0x12, 1, 1, 1, 0xFF); - } - phi_t0_2 = arg0->unk0; - phi_v1_2 = arg0->unk1C; - } - temp_t8 = phi_t0_2 - 0xA; - spA8 = temp_t8; - gDisplayListHead = func_8009BC9C(gDisplayListHead, *(&D_800E8254 + (temp_t8 * 4)), arg0->unkC, arg0->unk10, 2, phi_v1_2); - return; - case 0x12: /* switch 4 */ - case 0x13: /* switch 4 */ - case 0x14: /* switch 4 */ - case 0x15: /* switch 4 */ - case 0x16: /* switch 4 */ - case 0x17: /* switch 4 */ - case 0x18: /* switch 4 */ - case 0x19: /* switch 4 */ - temp_v0_11 = D_8018EDF3; - temp_v1_7 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_11); - temp_a2_7 = *(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0_11 * 3) + temp_v1_7)); - temp_a1_4 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0_11 * 0xC) + (temp_v1_7 * 4))); - phi_a2 = temp_a2_7; - phi_a2_2 = temp_a2_7; - phi_a1 = temp_a1_4; - switch (temp_t0) { /* switch 5 */ - case 18: /* switch 5 */ - case 19: /* switch 5 */ - case 20: /* switch 5 */ - case 21: /* switch 5 */ - if ((temp_a1_4 != 0) && (temp_a1_4 != 2)) { - phi_a2 = -1; - } - spA8 = 0x12; - spAC = phi_a2; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); - phi_a2_2 = phi_a2; + spA8 = 0x12; + spAC = phi_a2; + sp9C = segmented_to_virtual(D_800E824C[temp_t0]); + phi_a2_2 = (s8) phi_a2; block_58: - phi_a1 = spA8; - break; - case 22: /* switch 5 */ - case 23: /* switch 5 */ - if (temp_a1_4 != 2) { - phi_a2_2 = -1; - } else { - spA8 = 0x16; - spAC = temp_a2_7; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); - phi_a2_2 = temp_a2_7; - goto block_58; - } - break; - case 24: /* switch 5 */ - case 25: /* switch 5 */ - if (temp_a1_4 != 1) { - phi_a2_2 = -1; - } else { - spA8 = 0x18; - spAC = temp_a2_7; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); - phi_a2_2 = temp_a2_7; - goto block_58; - } - break; + phi_a1 = spA8; + break; + case 22: /* switch 5 */ + case 23: /* switch 5 */ + if (temp_a1 != 2) { + phi_a2_2 = -1; + } else { + spA8 = 0x16; + spAC = (s32) temp_a2_2; + sp9C = segmented_to_virtual(D_800E824C[temp_t0]); + phi_a2_2 = temp_a2_2; + goto block_58; } - if (phi_a2_2 != -1) { - temp_v0_12 = gMainMenuSelectionDepth; - if ((temp_v0_12 >= GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION) && (phi_a2_2 == (arg0->unk0 - phi_a1))) { - if (temp_v0_12 >= CONFIRM_OK_SELECTION) { - temp_a1_5 = arg0->unkC; - temp_a2_8 = arg0->unk10; - phi_v0_3 = func_80098C18(gDisplayListHead, temp_a1_5, temp_a2_8, temp_a1_5 + 0x3F, temp_a2_8 + 0x11, 0xFF, 0xF9, 0xDC, 0xFF); - } else { - temp_v1_8 = arg0->unk10; - temp_v0_13 = arg0->unkC; - phi_v0_3 = func_800959A0(gDisplayListHead, temp_v0_13, temp_v1_8, temp_v0_13 + 0x3F, temp_v1_8 + 0x11); - } - } else { - temp_a1_6 = arg0->unkC; - temp_a2_9 = arg0->unk10; - phi_v0_3 = func_80098C18(gDisplayListHead, temp_a1_6, temp_a2_9, temp_a1_6 + 0x3F, temp_a2_9 + 0x11, 1, 1, 1, 0xFF); - } - gDisplayListHead = phi_v0_3; - gDisplayListHead = func_8009BA74(gDisplayListHead, sp9C, arg0->unkC, arg0->unk10); - return; + break; + case 24: /* switch 5 */ + case 25: /* switch 5 */ + if (temp_a1 != 1) { + phi_a2_2 = -1; + } else { + spA8 = 0x18; + spAC = (s32) temp_a2_2; + sp9C = segmented_to_virtual(D_800E824C[temp_t0]); + phi_a2_2 = temp_a2_2; + goto block_58; } - /* Duplicate return node #135. Try simplifying control flow for better match */ - return; - case 0x1B: /* switch 4 */ - func_800A10CC(arg0); - return; - case 0x2A: /* switch 4 */ - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004B4C, arg0->unkC, arg0->unk10); - return; - case 0x34: /* switch 4 */ - case 0x35: /* switch 4 */ - case 0x36: /* switch 4 */ - case 0x37: /* switch 4 */ - temp_a1_7 = temp_t0 - 0x34; - if (*(&gCharacterGridSelections + temp_a1_7) != 0) { - if (*(&D_8018EDE8 + temp_a1_7) == 0) { - phi_a2_3 = 0xFF; + break; + } + if (phi_a2_2 != -1) { + temp_v0_9 = gMainMenuSelectionDepth; + if (((s32) temp_v0_9 >= 5) && (phi_a2_2 == (arg0->type - phi_a1))) { + if ((s32) temp_v0_9 >= 6) { + temp_a1_2 = arg0->column; + temp_a2_3 = arg0->row; + phi_v0_3 = func_80098C18(gDisplayListHead, temp_a1_2, temp_a2_3, temp_a1_2 + 0x3F, temp_a2_3 + 0x11, 0xFF, 0xF9, 0xDC, 0xFF); } else { - temp_t1 = gGlobalTimer % 16; - if (temp_t1 >= 8) { - phi_a2_4 = (temp_t1 * -8) + 0x80; - } else { - phi_a2_4 = temp_t1 * 8; - } - phi_a2_3 = phi_a2_4 + 0xBF; + temp_v1_7 = arg0->row; + temp_v0_10 = arg0->column; + phi_v0_3 = func_800959A0(gDisplayListHead, temp_v0_10, temp_v1_7, temp_v0_10 + 0x3F, temp_v1_7 + 0x11); } - func_800A11D0(arg0, temp_a1_7, phi_a2_3); - return; + } else { + temp_a1_3 = arg0->column; + temp_a2_4 = arg0->row; + phi_v0_3 = func_80098C18(gDisplayListHead, temp_a1_3, temp_a2_4, temp_a1_3 + 0x3F, temp_a2_4 + 0x11, 1, 1, 1, 0xFF); } - /* Duplicate return node #135. Try simplifying control flow for better match */ - return; - case 0x33: /* switch 4 */ - func_800A8564(arg0); - gDisplayListHead = func_8009BC9C(gDisplayListHead, &D_02004B74, arg0->unkC, arg0->unk10, 2, arg0->unk1C); - return; - case 0x2B: /* switch 4 */ - case 0x2C: /* switch 4 */ - case 0x2D: /* switch 4 */ - case 0x2E: /* switch 4 */ - case 0x2F: /* switch 4 */ - case 0x30: /* switch 4 */ - case 0x31: /* switch 4 */ - case 0x32: /* switch 4 */ - func_800A12BC(arg0, segmented_to_virtual(*(&D_800E7CA8 + (temp_t0 * 4)))); - case 0xA0: /* switch 3 */ - case 0xA1: /* switch 3 */ - func_8009A76C(arg0->unk18, arg0->unkC, arg0->unk10, arg0->unk1C); + gDisplayListHead = phi_v0_3; + gDisplayListHead = func_8009BA74(gDisplayListHead, sp9C, arg0->column, arg0->row); return; } + break; + case 0x1B: /* switch 6 */ + func_800A10CC(arg0); + return; + case 0x2A: /* switch 6 */ + gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004B4C, arg0->column, arg0->row); + return; + case 0x34: /* switch 6 */ + case 0x35: /* switch 6 */ + case 0x36: /* switch 6 */ + case 0x37: /* switch 6 */ + temp_a1_4 = temp_t0 - 0x34; + if (gCharacterGridSelections[temp_a1_4] != 0) { + if (*(&D_8018EDE8 + temp_a1_4) == 0) { + phi_a2_3 = 0xFF; + } else { + temp_t1 = (s32) gGlobalTimer % 16; + if (temp_t1 >= 8) { + phi_a2_4 = (temp_t1 * -8) + 0x80; + } else { + phi_a2_4 = temp_t1 * 8; + } + phi_a2_3 = phi_a2_4 + 0xBF; + } + func_800A11D0(arg0, temp_a1_4, phi_a2_3); + return; + } + break; + case 0x33: /* switch 6 */ + func_800A8564(arg0); + gDisplayListHead = func_8009BC9C(gDisplayListHead, D_02004B74, arg0->column, arg0->row, 2, arg0->unk1C); + return; + case 0x2B: /* switch 6 */ + case 0x2C: /* switch 6 */ + case 0x2D: /* switch 6 */ + case 0x2E: /* switch 6 */ + case 0x2F: /* switch 6 */ + case 0x30: /* switch 6 */ + case 0x31: /* switch 6 */ + case 0x32: /* switch 6 */ + func_800A12BC(arg0, segmented_to_virtual(D_800E7CA8[temp_t0])); + /* fallthrough */ + case 0xA0: /* switch 6 */ + case 0xA1: /* switch 6 */ + func_8009A76C(arg0->D_8018DEE0_index, arg0->column, arg0->row, arg0->unk1C); + return; + case 0x58: /* switch 6 */ + case 0x59: /* switch 6 */ + case 0x5A: /* switch 6 */ + case 0x5B: /* switch 6 */ + case 0x5C: /* switch 6 */ + func_800A8A98(arg0); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E817C[arg0->type]), arg0->column, arg0->row); + func_800A8CA4(arg0); + return; + case 0x52: /* switch 6 */ + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E817C[temp_t0]), arg0->column, arg0->row); + return; + case 0x5F: /* switch 6 */ + case 0x60: /* switch 6 */ + case 0x61: /* switch 6 */ + case 0x62: /* switch 6 */ + func_800A1500(arg0); + return; + case 0x53: /* switch 6 */ + case 0x54: /* switch 6 */ + case 0x55: /* switch 6 */ + case 0x56: /* switch 6 */ + temp_a0_2 = temp_t0 - 0x53; + spAC = temp_a0_2; + func_800A890C(temp_a0_2, arg0); + func_800A143C(arg0, spAC); + return; + case 0x5D: /* switch 6 */ + func_800A8564(arg0); + gDisplayListHead = func_8009BC9C(gDisplayListHead, D_02004E80, arg0->column, arg0->row, 2, arg0->unk1C); + return; + case 0x65: /* switch 6 */ + case 0x66: /* switch 6 */ + if (temp_t0 == 0x65) { + phi_f0 = 0.6f; + } else { + phi_f0 = 0.8f; + } + sp4C = phi_f0; + func_800A86E8(arg0); + set_text_color(3); + func_80093324(arg0->column + 8, arg0->row + 0x10, D_800E7594[arg0->type], 0, phi_f0, 0.8f); + func_800A874C(arg0); + return; + case 0x6E: /* switch 6 */ + func_800A8E14(arg0); + return; + case 0x67: /* switch 6 */ + func_800A8EC0(arg0); + return; + case 0x68: /* switch 6 */ + temp_a1_5 = arg0->column; + temp_a2_5 = arg0->row; + gDisplayListHead = func_80098C18(gDisplayListHead, temp_a1_5, temp_a2_5, temp_a1_5 + 0x3F, temp_a2_5 + 0x11, 1, 1, 1, 0xFF); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E8294[gCCSelection]), arg0->column, arg0->row); + return; + case 0x69: /* switch 6 */ + func_800A8F48(arg0); + return; + case 0x78: /* switch 6 */ + case 0x79: /* switch 6 */ + case 0x7A: /* switch 6 */ + case 0x7B: /* switch 6 */ + temp_a0_3 = temp_t0 - 0x78; + spAC = temp_a0_3; + func_800A90D4(temp_a0_3, arg0); + func_800A143C(arg0, spAC); + return; + case 0x8C: /* switch 6 */ + temp_v0_11 = gMainMenuSelectionDepth; + if (((s32) temp_v0_11 >= 5) && (spAC == (temp_t0 - spA8))) { + if ((s32) temp_v0_11 >= 6) { + temp_a1_6 = arg0->column; + temp_a2_6 = arg0->row; + phi_v0 = func_80098C18(gDisplayListHead, temp_a1_6, temp_a2_6, temp_a1_6 + 0x3F, temp_a2_6 + 0x11, 0xFF, 0xF9, 0xDC, 0xFF); + } else { + temp_v1_8 = arg0->row; + temp_v0_12 = arg0->column; + phi_v0 = func_800959A0(gDisplayListHead, temp_v0_12, temp_v1_8, temp_v0_12 + 0x3F, temp_v1_8 + 0x11); + } + } else { + temp_a1_7 = arg0->column; + temp_a2_7 = arg0->row; + phi_v0 = func_80098C18(gDisplayListHead, temp_a1_7, temp_a2_7, temp_a1_7 + 0x3F, temp_a2_7 + 0x11, 1, 1, 1, 0xFF); + } + gDisplayListHead = phi_v0; + gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004A34, arg0->column, arg0->row); + set_text_color(3); + func_800936B8(0x125, 0x1C, "a BUTTON*SEE DATA B BUTTON*EXIT", 0, 0.55f, 0.55f); + return; + case 0x8D: /* switch 6 */ + func_800A1780(arg0); + return; + case 0x7C: /* switch 6 */ + case 0x7D: /* switch 6 */ + case 0x7E: /* switch 6 */ + case 0x7F: /* switch 6 */ + case 0x80: /* switch 6 */ + case 0x81: /* switch 6 */ + case 0x82: /* switch 6 */ + case 0x83: /* switch 6 */ + case 0x84: /* switch 6 */ + case 0x85: /* switch 6 */ + case 0x86: /* switch 6 */ + case 0x87: /* switch 6 */ + case 0x88: /* switch 6 */ + case 0x89: /* switch 6 */ + case 0x8A: /* switch 6 */ + case 0x8B: /* switch 6 */ + func_800A15EC(arg0); + return; + case 0x96: /* switch 6 */ + set_text_color(4); + func_800936B8(arg0->column, arg0->row, D_800E7500[D_800DC540], arg0->unk1C, arg0->unk24, 1.0f); + return; + case 0x97: /* switch 6 */ + set_text_color(5); + func_80093324(arg0->column, arg0->row, D_800E7524[gCurrentCourseId], arg0->unk1C, arg0->unk24, 1.0f); + return; + case 0x98: /* switch 6 */ + func_800A2D1C(arg0); + return; + case 0x5E: /* switch 6 */ + gDisplayListHead = func_80096CD8(gDisplayListHead, 0x19, 0x72, 0x7C, 0x4A); + return; + case 0xAA: /* switch 6 */ + func_800A2EB8(arg0); + return; + case 0xAB: /* switch 6 */ + func_800A34A8(arg0); + return; + case 0xAC: /* switch 6 */ + func_800A6154(arg0); + return; + case 0xAF: /* switch 6 */ + func_800A6034(arg0); + return; + case 0xB0: /* switch 6 */ + func_800A638C(arg0); + return; + case 0xB1: /* switch 6 */ + case 0xB2: /* switch 6 */ + case 0xB3: /* switch 6 */ + case 0xB4: /* switch 6 */ + temp_v0_13 = temp_t0 - 0xB1; + if (arg0->unk4 != 0) { + spA8 = temp_v0_13; + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E7D54[*(&D_800EFD64 + gCharacterSelections[temp_v0_13])]), arg0->column, arg0->row); + func_8009A7EC(arg0->D_8018DEE0_index, arg0->column, arg0->row, spA8, arg0->unk1C); + func_800A11D0(arg0, spA8, 0xFF); + return; + } + break; + case 0xB9: /* switch 6 */ + func_800A3C84(arg0); + return; + case 0xBA: /* switch 6 */ + func_800A3E60(arg0); + return; + case 0xBC: /* switch 6 */ + func_800A4A24(arg0); + return; + case 0xC7: /* switch 6 */ + func_800A4B38(arg0); + return; + case 0xBD: /* switch 6 */ + func_800A5738(arg0); + return; + case 0xE6: /* switch 6 */ + func_800A1924(arg0); + return; + case 0xE7: /* switch 6 */ + func_800A1A20(arg0); + return; + case 0xE8: /* switch 6 */ + func_800A1BE0(arg0); + return; + case 0xE9: /* switch 6 */ + func_800A1DE0(arg0); + return; + case 0xEA: /* switch 6 */ + func_800A1F30(arg0); + return; + case 0xF0: /* switch 6 */ + func_800A1FB0(arg0); + return; + case 0xF1: /* switch 6 */ + gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004638, arg0->column, arg0->row); + return; + case 0x10E: /* switch 6 */ + func_800A70E8(arg0); + return; + case 0x12B: /* switch 6 */ + func_800A7258(arg0); + return; + case 0x12C: /* switch 6 */ + func_800A72FC(arg0); + return; + case 0x12D: /* switch 6 */ + func_800A7448(arg0); + return; + case 0x12E: /* switch 6 */ + func_800A75A0(arg0); + return; + case 0x12F: /* switch 6 */ + func_800A761C(arg0); + return; + case 0x130: /* switch 6 */ + if (arg0->unk4 != 0) { + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E7D54[*(&D_800EFD64 + D_802874F6)]), arg0->column, arg0->row); + func_8009A7EC(arg0->D_8018DEE0_index, arg0->column, arg0->row, 0, arg0->unk1C); + return; + } + break; + case 0x190: /* switch 6 */ + case 0x191: /* switch 6 */ + case 0x192: /* switch 6 */ + case 0x193: /* switch 6 */ + case 0x194: /* switch 6 */ + case 0x195: /* switch 6 */ + case 0x196: /* switch 6 */ + case 0x197: /* switch 6 */ + case 0x198: /* switch 6 */ + case 0x199: /* switch 6 */ + case 0x19A: /* switch 6 */ + case 0x19B: /* switch 6 */ + case 0x19C: /* switch 6 */ + case 0x19D: /* switch 6 */ + case 0x19E: /* switch 6 */ + case 0x19F: /* switch 6 */ + case 0x1A0: /* switch 6 */ + case 0x1A1: /* switch 6 */ + case 0x1A2: /* switch 6 */ + case 0x1A3: /* switch 6 */ + case 0x1A4: /* switch 6 */ + case 0x1A5: /* switch 6 */ + case 0x1A6: /* switch 6 */ + case 0x1A7: /* switch 6 */ + case 0x1A8: /* switch 6 */ + case 0x1A9: /* switch 6 */ + case 0x1AA: /* switch 6 */ + case 0x1AB: /* switch 6 */ + case 0x1AC: /* switch 6 */ + case 0x1AD: /* switch 6 */ + case 0x1AE: /* switch 6 */ + case 0x1AF: /* switch 6 */ + case 0x1B0: /* switch 6 */ + case 0x1B1: /* switch 6 */ + case 0x1B2: /* switch 6 */ + case 0x1B3: /* switch 6 */ + case 0x1B4: /* switch 6 */ + case 0x1B5: /* switch 6 */ + case 0x1B6: /* switch 6 */ + case 0x1B7: /* switch 6 */ + case 0x1B8: /* switch 6 */ + case 0x1B9: /* switch 6 */ + case 0x1BA: /* switch 6 */ + case 0x1BB: /* switch 6 */ + case 0x1BC: /* switch 6 */ + case 0x1BD: /* switch 6 */ + case 0x1BE: /* switch 6 */ + case 0x1BF: /* switch 6 */ + case 0x1C0: /* switch 6 */ + case 0x1C1: /* switch 6 */ + case 0x1C2: /* switch 6 */ + case 0x1C3: /* switch 6 */ + case 0x1C4: /* switch 6 */ + case 0x1C5: /* switch 6 */ + case 0x1C6: /* switch 6 */ + case 0x1C7: /* switch 6 */ + case 0x1C8: /* switch 6 */ + case 0x1C9: /* switch 6 */ + case 0x1CA: /* switch 6 */ + case 0x1CB: /* switch 6 */ + case 0x1CC: /* switch 6 */ + case 0x1CD: /* switch 6 */ + case 0x1CE: /* switch 6 */ + func_800A7790(arg0); + break; } - } else { - default: /* switch 4 */ - default: /* switch 3 */ - default: /* switch 2 */ } } #else @@ -9086,15 +8950,16 @@ void func_800A0AD0(UNUSED struct_8018D9E0_entry *unused) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800A08D8(u8, s32, s32); // extern -s32 func_800A095C(void *, ?, ?, s32); // extern -extern s8 D_800E86C4; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A08D8(u8, s32, s32); /* extern */ +s32 func_800A095C(void *, ?, ?, s32); /* extern */ extern ? D_8018E938; extern ? D_8018EB34; -extern void *gDisplayListHead; +static s8 D_800E86C4 = 0; /* const */ -void func_800A0B80(void *arg0) { +void func_800A0B80(struct_8018D9E0_entry *arg0) { + Gfx *temp_v1; + Gfx *temp_v1_2; s32 temp_a2; s32 temp_lo; s32 temp_s1; @@ -9104,8 +8969,6 @@ void func_800A0B80(void *arg0) { s8 temp_v0; s8 temp_v0_2; void *temp_s4; - void *temp_v1; - void *temp_v1_2; s8 *phi_s6; s32 phi_s5; s32 phi_s0; @@ -9113,35 +8976,35 @@ void func_800A0B80(void *arg0) { temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->unk4 = 0x32FF; - temp_v1->unk0 = 0xFA000000; + temp_v1->words.w1 = 0x32FF; + temp_v1->words.w0 = 0xFA000000; phi_s6 = &D_800E86C4; phi_s5 = 0; do { temp_v0 = *phi_s6; if (temp_v0 != 0) { temp_s1 = phi_s5 * 0xA; - temp_a2 = arg0->unk10 + temp_s1 + 1; - if (temp_v0 < 0xA) { + temp_a2 = arg0->row + temp_s1 + 1; + if ((s32) temp_v0 < 0xA) { func_800A08D8((temp_v0 + 0x10) & 0xFF, 0x32, temp_a2); } else { - func_800A08D8(((temp_v0 % 0xA) + 0x10) & 0xFF, 0x35, temp_a2); - func_800A08D8(0x11, 0x2F, arg0->unk10 + temp_s1 + 1); + func_800A08D8((((s32) temp_v0 % 10) + 0x10) & 0xFF, 0x35, temp_a2); + func_800A08D8(0x11U, 0x2F, arg0->row + temp_s1 + 1); } temp_v0_2 = *phi_s6; - temp_s2 = arg0->unk10 + temp_s1 + 1; + 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) { - func_800A08D8(0x3C, temp_s1_2 + 0x4F, temp_s2); - func_800A08D8(temp_s4->unkA, temp_s1_2 + 0x57, temp_s2); + func_800A08D8(0x3CU, temp_s1_2 + 0x4F, temp_s2); + func_800A08D8((u8) temp_s4->unkA, temp_s1_2 + 0x57, temp_s2); } - phi_s0 = (temp_s4->unk0 + 0xFF) >> 8; + phi_s0 = (s32) ((u32) (temp_s4->unk0 + 0xFF) >> 8); phi_s1 = 0x10; do { - func_800A08D8(((phi_s0 % 0xA) + 0x10) & 0xFF, phi_s1 + 0xFD, temp_s2); - temp_lo = phi_s0 / 0xA; + 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); @@ -9153,8 +9016,8 @@ void func_800A0B80(void *arg0) { } while (temp_s5 != 9); temp_v1_2 = gDisplayListHead; gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->unk0 = 0xED000000; - temp_v1_2->unk4 = 0x4FC3BC; + temp_v1_2->words.w0 = 0xED000000; + temp_v1_2->words.w1 = 0x4FC3BC; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0B80.s") @@ -9187,19 +9050,20 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0DFC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_8009BA74(void *, ? *, s16, s16); // extern -void *func_800AAEF4(?); // extern -extern ? D_0200184C; -extern ? D_800E7278; -extern void *gDisplayListHead; -extern s8 gControllerPakMenuSelection; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E7278_0x8 { + /* 0x0 */ s16 unk0; /* inferred */ + /* 0x2 */ s16 unk2; /* inferred */ + /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ +}; /* size = 0x8 */ + +static struct _struct_D_800E7278_0x8 D_800E7278[0]; /* unable to generate initializer; const */ void func_800A0EB8(s32 arg0, s32 arg1) { + Gfx *temp_t0; s8 temp_v0; - void *temp_t0; - void *temp_t3; - void *temp_v0_2; + struct _struct_D_800E7278_0x8 *temp_v0_2; + struct_8018D9E0_entry *temp_t3; s32 phi_t1; temp_t3 = func_800AAEF4(0xDA); @@ -9217,10 +9081,10 @@ void func_800A0EB8(s32 arg0, s32 arg1) { block_7: temp_t0 = gDisplayListHead; gDisplayListHead = temp_t0 + 8; - temp_t0->unk0 = 0xFA000000; - temp_t0->unk4 = ((temp_t3->unk20 & 0xFF) << 0x10) | 0xFF000000 | 0xFF; - temp_v0_2 = (phi_t1 * 8) + &D_800E7278; - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_0200184C, temp_v0_2->unk0, temp_v0_2->unk2); + temp_t0->words.w0 = 0xFA000000; + temp_t0->words.w1 = ((temp_t3->unk20 & 0xFF) << 0x10) | 0xFF000000 | 0xFF; + temp_v0_2 = &D_800E7278[phi_t1]; + gDisplayListHead = func_8009BA74(gDisplayListHead, D_0200184C, (s32) temp_v0_2->unk0, (s32) temp_v0_2->unk2); } } #else @@ -9228,31 +9092,41 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0EB8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -static ? D_800E8234; /* unable to generate initializer; const */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E8234_0x8 { + /* 0x0 */ MkTexture *unk0; /* inferred */ + /* 0x4 */ MkTexture *unk4; /* inferred */ +}; /* size = 0x8 */ -void func_800A0FA4(void *arg0, s32 arg1) { - u32 temp_t6; - void *temp_s1; - void *temp_s1_2; - s32 phi_v0; +Gfx *func_8009BC9C(Gfx *, void *, s32, s32, s32, s32); /* extern */ +static struct _struct_D_800E8234_0x8 D_800E8234[3] = { + { D_02004688, D_020047DC }, + { D_020046D8, D_02004804 }, + { D_0200473C, D_0200482C }, +}; /* const */ + +void func_800A0FA4(struct_8018D9E0_entry *arg0, s32 arg1) { + s32 temp_t6; + struct _struct_D_800E8234_0x8 *temp_s1; + struct _struct_D_800E8234_0x8 *temp_s1_2; + Gfx *phi_v0; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: case 2: case 3: - temp_s1 = (arg1 * 8) + &D_800E8234; - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(temp_s1->unk0), arg0->unkC, arg0->unk10); - phi_v0 = func_8009BA74(gDisplayListHead, segmented_to_virtual(temp_s1->unk4), arg0->unkC, arg0->unk10); + temp_s1 = &D_800E8234[arg1]; + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(temp_s1->unk0), arg0->column, arg0->row); + phi_v0 = func_8009BA74(gDisplayListHead, segmented_to_virtual(temp_s1->unk4), arg0->column, arg0->row); block_4: gDisplayListHead = phi_v0; break; case 1: case 4: - temp_s1_2 = (arg1 * 8) + &D_800E8234; - gDisplayListHead = func_8009BC9C(gDisplayListHead, segmented_to_virtual(temp_s1_2->unk0), arg0->unkC, arg0->unk10, 2, arg0->unk1C); - phi_v0 = func_8009BC9C(gDisplayListHead, segmented_to_virtual(temp_s1_2->unk4), arg0->unkC, arg0->unk10, 2, arg0->unk1C); + temp_s1_2 = &D_800E8234[arg1]; + gDisplayListHead = func_8009BC9C(gDisplayListHead, segmented_to_virtual(temp_s1_2->unk0), arg0->column, arg0->row, 2, arg0->unk1C); + phi_v0 = func_8009BC9C(gDisplayListHead, segmented_to_virtual(temp_s1_2->unk4), arg0->column, arg0->row, 2, arg0->unk1C); goto block_4; } } @@ -9303,23 +9177,25 @@ void func_800A11D0(struct_8018D9E0_entry *arg0, s32 arg1, s32 arg2) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800A12BC(void *arg0) { - u32 temp_t6; - s32 phi_v0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_8009BC9C(Gfx *, s32, s32, s32, s32); /* extern */ + +void func_800A12BC(struct_8018D9E0_entry *arg0, MkTexture *arg1) { + s32 temp_t6; + Gfx *phi_v0; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: case 2: case 4: - phi_v0 = func_8009BA74(gDisplayListHead, MIPS2C_ERROR(Read from unset register $a1), arg0->unkC); + phi_v0 = func_8009BA74(gDisplayListHead, arg1, arg0->column, arg0->row); block_4: gDisplayListHead = phi_v0; break; case 1: case 3: - phi_v0 = func_8009BC9C(gDisplayListHead, MIPS2C_ERROR(Read from unset register $a1), arg0->unkC, arg0->unk10, 2, arg0->unk1C); + phi_v0 = func_8009BC9C(gDisplayListHead, arg0->column, arg0->row, 2, arg0->unk1C); goto block_4; } } @@ -9328,25 +9204,49 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A12BC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -static ? D_800E82C8; /* unable to generate initializer; const */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +Gfx *func_8009BC9C(Gfx *, void *, s32, s32, s32, s32); /* extern */ +static MkTexture *D_800E82C8[0x16] = { + D_02004BC4, + D_02004BEC, + D_02004C14, + D_02004C3C, + D_02004C64, + D_02004C8C, + D_02004CF0, + D_02004D54, + D_02004DB8, + D_02004E1C, + D_02004E80, + D_02004BC4, + D_02004BEC, + D_02004C14, + D_02004C3C, + D_02004C64, + D_02004C8C, + D_02004CF0, + D_02004D54, + D_02004DB8, + D_02004E1C, + D_02004E80, +}; /* const */ -void func_800A143C(void *arg0, s32 arg1) { - u32 temp_t6; - s32 phi_v0; +void func_800A143C(struct_8018D9E0_entry *arg0, s32 arg1) { + s32 temp_t6; + Gfx *phi_v0; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: case 2: case 3: - phi_v0 = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E82C8 + (arg1 * 4))), arg0->unkC, arg0->unk10); + phi_v0 = func_8009BA74(gDisplayListHead, segmented_to_virtual(D_800E82C8[arg1]), arg0->column, arg0->row); block_4: gDisplayListHead = phi_v0; break; case 1: case 4: - phi_v0 = func_8009BC9C(gDisplayListHead, segmented_to_virtual(*(&D_800E82C8 + (arg1 * 4))), arg0->unkC, arg0->unk10, 2, arg0->unk1C); + phi_v0 = func_8009BC9C(gDisplayListHead, segmented_to_virtual(D_800E82C8[arg1]), arg0->column, arg0->row, 2, arg0->unk1C); goto block_4; } } @@ -9355,15 +9255,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A143C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009A76C(s32, s16, s16, ?); // extern -void *func_800AAEF4(?); // extern -extern ? D_800E7168; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static ? D_800E7168; /* unable to generate initializer; const */ -void func_800A1500(void *arg0) { +void func_800A1500(struct_8018D9E0_entry *arg0) { s32 sp1C; s32 temp_v1; - void *temp_v0; + struct_8018D9E0_entry *temp_v0; void *temp_v0_2; s32 phi_a1; @@ -9371,27 +9269,25 @@ void func_800A1500(void *arg0) { temp_v0 = func_800AAEF4(0x64); temp_v1 = temp_v0->unk4; phi_a1 = sp1C; - if ((temp_v1 != 0) && (temp_v1 != 1)) { - if (temp_v1 != 2) { - if (temp_v1 != 3) { - - } else { - goto block_7; - } - } else if (arg0->unk0 != ((temp_v0->unk1C % 4) + 0x5F)) { -block_7: + switch (temp_v1) { /* irregular */ + case 2: + if (arg0->type != (((s32) temp_v0->unk1C % 4) + 0x5F)) { + case 3: phi_a1 = 1; } + break; } - if (phi_a1 != 0) { - if (phi_a1 != 1) { - return; - } - temp_v0_2 = (arg0->unk0 * 8) - 0x2F8 + &D_800E7168; - func_8009A76C(arg0->unk18, temp_v0_2->unk0, temp_v0_2->unk2, -2); +case 0: +case 1: + switch (phi_a1) { /* switch 1; irregular */ + case 0: /* switch 1 */ + func_8009A76C(arg0->D_8018DEE0_index, 0x17, 0x70, -1); + return; + 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; } - func_8009A76C(arg0->unk18, 0x17, 0x70, -1); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1500.s") @@ -9472,64 +9368,60 @@ void func_800A1A20(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(?, s32, s32, ?, f32, f32); // extern -? func_80093358(?, s32, s32, ?, f32, f32); // extern -? func_800A66A8(s32, s16 *); // extern -s32 func_800B639C(s8); // extern -? set_text_color(?); // extern -extern s32 D_800E7834; -extern f32 D_800F1B54; -extern ? D_8018EB90; -extern s8 gTimeTrialDataCourseIndex; -extern s8 gCourseRecordsMenuSelection; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ +static s8 *D_800E7834[3] = { + "return to menu", + "erase records for this course", + "erase ghost from this course", +}; /* const */ -void func_800A1BE0(s32 arg0) { +void func_800A1BE0(struct_8018D9E0_entry *arg0) { s16 sp7A; s16 sp78; - f32 temp_f20; + Gfx *temp_v1; s32 temp_s0; s8 temp_v0; - void *temp_v1; s32 phi_s0; s32 phi_s1; s32 phi_s4; - s32 *phi_s3; - ? phi_s2; + s8 **phi_s3; + s32 phi_s2; temp_v0 = gTimeTrialDataCourseIndex; - temp_f20 = D_800F1B54; phi_s0 = 0; phi_s4 = 0x3F; - phi_s3 = &D_800E7834; + phi_s3 = D_800E7834; do { phi_s1 = 0; if (phi_s0 == gCourseRecordsMenuSelection) { - phi_s2 = TEXT_BLUE_GREEN_RED_CYCLE_2; + phi_s2 = 5; } else { - phi_s2 = TEXT_GREEN; - if (phi_s0 != 1) { - if (phi_s0 != 2) { - - } else if (func_800B639C(gTimeTrialDataCourseIndex) < 0) { + phi_s2 = 1; + switch (phi_s0) { /* irregular */ + case 1: + if (D_8018EB90.allCourseTimeTrialRecords.cupRecords[((s32) temp_v0 / 4)].courseRecords[((s32) temp_v0 % 4)].records[0].unk12 == 0) { +block_9: + phi_s1 = 1; + } + break; + case 2: + if (func_800B639C((s32) gTimeTrialDataCourseIndex) < 0) { goto block_9; } - } else if ((((temp_v0 / 4) * 0x60) + ((temp_v0 % 4) * 0x18) + &D_8018EB90)->unk12 == 0) { -block_9: - phi_s1 = 1; + break; } } if (phi_s1 != 0) { - set_text_color(TEXT_BLUE); + set_text_color(0); temp_v1 = gDisplayListHead; gDisplayListHead = temp_v1 + 8; - temp_v1->unk4 = 0x96; - temp_v1->unk0 = 0xFA000000; - func_80093358(0x25, phi_s4, *phi_s3, 0, temp_f20, temp_f20); + temp_v1->words.w1 = 0x96; + temp_v1->words.w0 = 0xFA000000; + func_80093358(0x25, phi_s4, *phi_s3, 0, 0.6f, 0.6f); } else { set_text_color(phi_s2); - func_80093324(0x25, phi_s4, *phi_s3, 0, temp_f20, temp_f20); + func_80093324(0x25, phi_s4, *phi_s3, 0, 0.6f, 0.6f); } temp_s0 = phi_s0 + 1; phi_s0 = temp_s0; @@ -9545,49 +9437,43 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1BE0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(?, s32, s32, ?, f32, f32); // extern -? func_800A66A8(s32, s16 *); // extern -? set_text_color(?); // extern -extern s32 D_800E7840; -extern ? D_800E7848; -extern f32 D_800F1B58; -extern s8 gCourseRecordsMenuSelection; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ extern s8 D_8018EDF9; +static s8 *D_800E7840[2] = { "quit", "erase" }; /* const */ +static struct _struct_D_800E7848_0xC D_800E7848[2]; /* unable to generate initializer; const */ -void func_800A1DE0(s32 arg0) { +void func_800A1DE0(struct_8018D9E0_entry *arg0) { s16 sp5A; s16 sp58; - f32 temp_f20; s32 temp_s0; s32 temp_s2; s32 phi_s0; s32 phi_s1; s32 phi_s2; - ? phi_a0; + s32 phi_a0; s32 phi_s1_2; - s32 *phi_s0_2; + s8 **phi_s0_2; - set_text_color(TEXT_GREEN); - temp_f20 = D_800F1B58; + set_text_color(1); phi_s0 = 0x3C; phi_s1 = 0; do { - func_80093324(0x1B, phi_s0, (&D_800E7848 + (gCourseRecordsMenuSelection * 0xC) + phi_s1)->unk-C, 0, temp_f20, temp_f20); + func_80093324(0x1B, phi_s0, (&D_800E7848[gCourseRecordsMenuSelection] + phi_s1)->unk-C, 0, 0.65f, 0.65f); temp_s0 = phi_s0 + 0xD; phi_s0 = temp_s0; phi_s1 += 4; } while (temp_s0 < 0x63); phi_s2 = 0; phi_s1_2 = 0x6E; - phi_s0_2 = &D_800E7840; + phi_s0_2 = D_800E7840; do { - phi_a0 = TEXT_GREEN; + phi_a0 = 1; if (phi_s2 == D_8018EDF9) { - phi_a0 = TEXT_BLUE_GREEN_RED_CYCLE_2; + phi_a0 = 5; } set_text_color(phi_a0); - func_80093324(0x43, phi_s1_2, *phi_s0_2, 0, temp_f20, temp_f20); + func_80093324(0x43, phi_s1_2, *phi_s0_2, 0, 0.65f, 0.65f); temp_s2 = phi_s2 + 1; phi_s2 = temp_s2; phi_s1_2 += 0xD; @@ -9618,72 +9504,105 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1F30.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -Gfx *draw_box(Gfx *, ?, ?, ?, s32, s32, s32, s32, s32); /* extern */ -? draw_text(s32, s32, ? *, ?, f32, f32); /* extern */ -? func_800921C0(s32, s32, ?); /* extern */ -? func_80092224(s32, s32, ?); /* extern */ -? func_80093324(s16, s16, ? *, ?, f32, f32); /* extern */ -? func_800A66A8(void *, s16 *); /* extern */ -? convert_number_to_ascii(s32, ? *); /* extern */ -? set_text_color(s32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E7890_0x10 { + /* 0x00 */ s8 *unk0; /* inferred */ + /* 0x04 */ char pad4[0xC]; /* maybe part of unk0[4]? */ +}; /* size = 0x10 */ + +struct _struct_D_800E78D0_0xC { + /* 0x0 */ s8 *unk0; /* inferred */ + /* 0x4 */ char pad4[8]; /* maybe part of unk0[3]? */ +}; /* size = 0xC */ + +struct _struct_D_800E7900_0xC { + /* 0x0 */ s8 *unk0; /* inferred */ + /* 0x4 */ char pad4[8]; /* maybe part of unk0[3]? */ +}; /* size = 0xC */ + +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ +extern s32 D_8018D9C0; extern ? D_8018EE10; -static ? D_800E75C4; /* unable to generate initializer; const */ -static ? gSoundModeNames; /* unable to generate initializer; const */ -static ? *D_800E7840[2] = { "quit", "erase" }; /* const */ -static ? *D_800E7868[4] = { +static s8 *D_800E75C4[0x14] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", +}; /* const */ +static s8 *D_800E7840[2] = { "quit", "erase" }; /* const */ +static s8 *D_800E7868[4] = { "RETURN TO GAME SELECT", "SOUND MODE", "COPY N64 CONTROLLER PAK", "ERASE ALL DATA", }; /* const */ -static ? *D_800E7878[3] = { "ALL SAVED DATA WILL BE", "PERMANENTLY ERASED.", "ARE YOU REALLY SURE?" }; /* const */ -static ? *D_800E7884[3] = { "", "ALL SAVED DATA", "HAS BEEN NOW ERASED." }; /* const */ -static ? D_800E7890; /* unable to generate initializer; const */ -static ? D_800E78D0; /* unable to generate initializer; const */ -static ? D_800E7900; /* unable to generate initializer; const */ -static ? *D_800E7918[2] = { "CONTROLLER 1", "CONTROLLER 2" }; /* const */ -static ? D_800E7920; /* unable to generate initializer; const */ -static ? *D_800E7928[2] = { "CURRENT DATA WILL BE ERASED,", "IS THIS OK?" }; /* const */ -static ? *D_800E7930[2] = { "QUIT", "COPY" }; /* const */ -static ? D_800E7938; /* unable to generate initializer; const */ -static ? *D_800E7A44 = "NO DATA"; /* const */ -static ? *D_800E7A48[3] = { "CREATING ", "MARIO KART 64 ", "GAME DATA" }; /* const */ +static s8 *D_800E7878[3] = { "ALL SAVED DATA WILL BE", "PERMANENTLY ERASED.", "ARE YOU REALLY SURE?" }; /* const */ +static s8 *D_800E7884[3] = { "", "ALL SAVED DATA", "HAS BEEN NOW ERASED." }; /* const */ +static struct _struct_D_800E7890_0x10 D_800E7890[4]; /* unable to generate initializer; const */ +static struct _struct_D_800E78D0_0xC D_800E78D0[4]; /* unable to generate initializer; const */ +static struct _struct_D_800E7900_0xC D_800E7900[2]; /* unable to generate initializer; const */ +static s8 *D_800E7918[2] = { "CONTROLLER 1", "CONTROLLER 2" }; /* const */ +static s8 *D_800E7920[2] = { + "WHICH FILE DO YOU WANT TO MAKE A COPY OF?", + "TO WHICH FILE DO YOU WANT TO COPY?", +}; /* const */ +static s8 *D_800E7928[2] = { "CURRENT DATA WILL BE ERASED,", "IS THIS OK?" }; /* const */ +static s8 *D_800E7930[2] = { "QUIT", "COPY" }; /* const */ +static s8 *D_800E7938[2] = { "COPYING", "DATA COPY COMPLETED" }; /* const */ +static s8 *D_800E7A44 = "NO DATA"; /* const */ +static s8 *D_800E7A48[3] = { "CREATING ", "MARIO KART 64 ", "GAME DATA" }; /* const */ static ? D_800E7A54; /* unable to generate initializer; const */ -static ? gCupCourseOrder; /* unable to generate initializer; const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ +s8 *gSoundModeNames[4] = { "STEREO", "HEADPHONE", "", "MONO" }; /* const */ -void func_800A1FB0(void *arg0) { +void func_800A1FB0(struct_8018D9E0_entry *arg0) { s16 spE2; s16 spE0; - ? spB9; - ? spB8; - ? spA9; - ? spA8; - ? sp99; - ? sp98; + s8 spB9; + s8 spB8; + s8 spA9; + s8 spA8; + s8 sp99; + s8 sp98; s32 sp88; - ? **sp84; - ? **sp78; - ? **temp_s0_4; - ? **temp_s1; - ? **temp_s1_2; - ? **temp_s1_3; - ? **temp_v0_3; - s16 temp_s0; - s16 temp_s0_2; - s16 temp_s0_3; - s16 temp_s3; - s16 temp_s3_3; + s8 **sp84; + s8 **sp78; s32 temp_a0; s32 temp_a0_2; s32 temp_a0_3; + s32 temp_s0; + s32 temp_s0_2; + s32 temp_s0_3; s32 temp_s1_4; s32 temp_s1_5; s32 temp_s1_6; s32 temp_s2; s32 temp_s2_2; s32 temp_s2_3; + s32 temp_s3; s32 temp_s3_2; + s32 temp_s3_3; + s8 **temp_s0_4; + s8 **temp_s1; + s8 **temp_s1_2; + s8 **temp_s1_3; + s8 **temp_v0_3; s8 temp_v0; s8 temp_v0_2; s8 temp_v0_4; @@ -9691,47 +9610,48 @@ void func_800A1FB0(void *arg0) { s8 temp_v1_2; s32 phi_a0; s32 phi_s2; - s16 phi_s0; - ? **phi_s1; - s16 phi_s0_2; - ? **phi_s1_2; + s32 phi_s0; + s8 **phi_s1; + s32 phi_s0_2; + s8 **phi_s1_2; s32 phi_a0_2; s32 phi_s2_2; - s16 phi_s0_3; - ? **phi_s1_3; - s16 phi_s0_4; - ? **phi_s1_4; - s16 phi_s0_5; - ? **phi_s1_5; - s16 phi_s0_6; - ? **phi_s1_6; - s16 phi_s0_7; - ? **phi_s1_7; - s16 phi_s0_8; - ? **phi_s1_8; + s32 phi_s0_3; + s8 **phi_s1_3; + s32 phi_s0_4; + s8 **phi_s1_4; + s32 phi_s0_5; + struct _struct_D_800E78D0_0xC *phi_s1_5; + s32 phi_s0_6; + struct _struct_D_800E7890_0x10 *phi_s1_6; + s32 phi_s0_7; + struct _struct_D_800E7900_0xC *phi_s1_7; + s32 phi_s0_8; + s8 **phi_s1_8; s32 phi_s4; - s16 phi_s3; + s32 phi_s3; s32 phi_s5; s32 phi_s0_9; s16 phi_s6; s16 phi_s2_3; void *phi_v1; s32 phi_s1_9; - ? **phi_s0_10; - s16 phi_s3_2; + s8 **phi_s0_10; + s32 phi_s3_2; s32 phi_s0_11; - s16 phi_s6_2; - s16 phi_s2_4; + s32 phi_s6_2; + s32 phi_s2_4; void *phi_v1_2; s32 phi_s2_5; s16 phi_s1_10; - ? **phi_s3_3; - s16 phi_s3_4; + s8 **phi_s3_3; + s32 phi_s3_4; s32 phi_s0_12; - s16 phi_s6_3; - s16 phi_s2_6; + s32 phi_s6_3; + s32 phi_s2_6; void *phi_v1_3; s8 phi_v1_4; + gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x140, 0xF0, 0, 0, 0, 0x64); temp_v1 = D_8018EDEC; phi_v1_4 = temp_v1; @@ -9745,27 +9665,27 @@ void func_800A1FB0(void *arg0) { phi_s0 = 0x55; phi_s1 = D_800E7868; do { - func_80092224(phi_a0, phi_s2, TEXT_YELLOW); + func_80092224(phi_a0, phi_s2, 3); func_80093324(0x32, phi_s0, *phi_s1, 0, 0.9f, 1.0f); temp_a0 = D_8018EDEC - 0x15; phi_a0 = temp_a0; phi_s1 += 4; if (phi_s2 == temp_a0) { spE0 = 0x32; - spE2 = phi_s0; + spE2 = (s16) phi_s0; } temp_s2 = phi_s2 + 1; phi_s2 = temp_s2; phi_s0 += 0x23; } while (temp_s2 != 4); - set_text_color(TEXT_GREEN); + set_text_color(1); draw_text(0xE6, 0x78, gSoundModeNames[gSoundMode], 0, 1.0f, 1.0f); block_98: phi_v1_4 = D_8018EDEC; break; case 0x1E: /* switch 1 */ case 0x1F: /* switch 1 */ - set_text_color(TEXT_YELLOW); + set_text_color(3); phi_s0_2 = 0x55; phi_s1_2 = D_800E7878; do { @@ -9773,13 +9693,13 @@ block_98: temp_s1 = phi_s1_2 + 4; phi_s0_2 += 0x14; phi_s1_2 = temp_s1; - } while (temp_s1 < D_800E7884); + } while ((u32) temp_s1 < (u32) D_800E7884); phi_a0_2 = D_8018EDEC - 0x1E; phi_s2_2 = 0; phi_s0_3 = 0x96; phi_s1_3 = D_800E7840; do { - func_80092224(phi_a0_2, phi_s2_2, TEXT_GREEN); + func_80092224(phi_a0_2, phi_s2_2, 1); func_80093324(0x84, phi_s0_3, *phi_s1_3, 0, 1.0f, 1.0f); temp_v1_2 = D_8018EDEC; temp_a0_2 = temp_v1_2 - 0x1E; @@ -9788,7 +9708,7 @@ block_98: phi_v1_4 = temp_v1_2; if (phi_s2_2 == temp_a0_2) { spE0 = 0x84; - spE2 = phi_s0_3; + spE2 = (s16) phi_s0_3; } temp_s2_2 = phi_s2_2 + 1; phi_s2_2 = temp_s2_2; @@ -9796,7 +9716,7 @@ block_98: } while (temp_s2_2 != 2); break; case 0x20: /* switch 1 */ - set_text_color(TEXT_YELLOW); + set_text_color(3); phi_s0_4 = 0x55; phi_s1_4 = D_800E7884; do { @@ -9804,17 +9724,17 @@ block_98: temp_s1_2 = phi_s1_4 + 4; phi_s0_4 += 0x14; phi_s1_4 = temp_s1_2; - } while (temp_s1_2 != &D_800E7890); + } while (temp_s1_2 != D_800E7890); goto block_98; case 0x2A: /* switch 1 */ case 0x2B: /* switch 1 */ case 0x2C: /* switch 1 */ case 0x2D: /* switch 1 */ - set_text_color(TEXT_RED); + set_text_color(2); phi_s0_5 = 0x55; - phi_s1_5 = ((D_8018EDEC - 0x2A) * 0xC) + &D_800E78D0; + phi_s1_5 = &D_800E78D0[D_8018EDEC - 0x2A]; do { - func_80093324(0x32, phi_s0_5, *phi_s1_5, 0, 0.9f, 0.9f); + func_80093324(0x32, phi_s0_5, phi_s1_5->unk0, 0, 0.9f, 0.9f); temp_s0 = phi_s0_5 + 0x14; phi_s0_5 = temp_s0; phi_s1_5 += 4; @@ -9824,11 +9744,11 @@ block_98: case 0x35: /* switch 1 */ case 0x36: /* switch 1 */ case 0x37: /* switch 1 */ - set_text_color(TEXT_RED); + set_text_color(2); phi_s0_6 = 0x55; - phi_s1_6 = ((D_8018EDEC - 0x34) * 0x10) + &D_800E7890; + phi_s1_6 = &D_800E7890[D_8018EDEC - 0x34]; do { - func_80093324(0x23, phi_s0_6, *phi_s1_6, 0, 0.8f, 0.8f); + func_80093324(0x23, phi_s0_6, phi_s1_6->unk0, 0, 0.8f, 0.8f); temp_s0_2 = phi_s0_6 + 0x14; phi_s0_6 = temp_s0_2; phi_s1_6 += 4; @@ -9836,11 +9756,11 @@ block_98: goto block_98; case 0x41: /* switch 1 */ case 0x42: /* switch 1 */ - set_text_color(TEXT_RED); + set_text_color(2); phi_s0_7 = 0x55; - phi_s1_7 = ((D_8018EDEC - 0x41) * 0xC) + &D_800E7900; + phi_s1_7 = &D_800E7900[D_8018EDEC - 0x41]; do { - func_80093324(0x41, phi_s0_7, *phi_s1_7, 0, 0.9f, 0.9f); + func_80093324(0x41, phi_s0_7, phi_s1_7->unk0, 0, 0.9f, 0.9f); temp_s0_3 = phi_s0_7 + 0x14; phi_s0_7 = temp_s0_3; phi_s1_7 += 4; @@ -9848,7 +9768,7 @@ block_98: goto block_98; case 0x46: /* switch 1 */ case 0x47: /* switch 1 */ - set_text_color(TEXT_YELLOW); + set_text_color(3); phi_s0_8 = 0x55; phi_s1_8 = D_800E7A48; do { @@ -9874,42 +9794,42 @@ block_98: phi_s4 = 0; } set_text_color(phi_s4 + 1); - draw_text(0xA0, 0x55, *(&D_800E7920 + (phi_s4 * 4)), 0, 0.6f, 0.6f); + draw_text(0xA0, 0x55, D_800E7920[phi_s4], 0, 0.6f, 0.6f); sp88 = 0x5C; sp78 = (phi_s4 * 0x89) + 0x2A; sp84 = D_800E7918; phi_s3 = 0x2A; phi_s6 = 0x20; do { - set_text_color(TEXT_YELLOW); + set_text_color(3); draw_text(sp88, 0x7D, *sp84, 0, 0.75f, 0.75f); phi_s0_9 = 0; phi_s2_3 = 0x96; loop_38: if (phi_s3 != sp78) { - func_800921C0(D_8018EDEC - phi_s5, phi_s0_9, TEXT_GREEN); + func_800921C0(D_8018EDEC - phi_s5, phi_s0_9, 1); if (phi_s0_9 == (D_8018EDEC - phi_s5)) { spE0 = phi_s6; spE2 = phi_s2_3; } } else if ((phi_s4 != 0) && (phi_s0_9 == arg0->unk20)) { - set_text_color(gGlobalTimer % 3); + set_text_color((s32) gGlobalTimer % 3); } else { - set_text_color(TEXT_GREEN); + set_text_color(1); } temp_s1_4 = phi_s0_9 + 1; convert_number_to_ascii(temp_s1_4, &spB8); - func_80093324(phi_s6, phi_s2_3, &spB9, 0, 0.6f, 0.6f); + func_80093324((s32) phi_s6, (s32) phi_s2_3, &spB9, 0, 0.6f, 0.6f); if (phi_s3 == 0x2A) { phi_v1 = (phi_s0_9 << 7) + &D_8018EE10; } else { phi_v1 = D_8018D9C0 + (phi_s0_9 << 7); } if (phi_v1->unk4 == 0) { - func_80093324(phi_s3, phi_s2_3, D_800E7A44, 0, 0.5f, 0.5f); + func_80093324(phi_s3, (s32) phi_s2_3, D_800E7A44, 0, 0.5f, 0.5f); } else { temp_v0 = phi_v1->unk5; - func_80093324(phi_s3, phi_s2_3, *(&D_800E75C4 + (*(&gCupCourseOrder + (((temp_v0 / 4) * 8) + ((temp_v0 % 4) * 2))) * 4)), 0, 0.5f, 0.5f); + func_80093324(phi_s3, (s32) phi_s2_3, D_800E75C4[*(gCupCourseOrder + ((((s32) temp_v0 / 4) * 8) + (((s32) temp_v0 % 4) * 2)))], 0, 0.5f, 0.5f); } phi_s0_9 = temp_s1_4; phi_s2_3 += 0x1E; @@ -9925,7 +9845,7 @@ loop_38: goto block_98; case 0x38: /* switch 1 */ case 0x39: /* switch 1 */ - set_text_color(TEXT_RED); + set_text_color(2); phi_s1_9 = 0x4D; phi_s0_10 = D_800E7928; do { @@ -9933,27 +9853,27 @@ loop_38: temp_s0_4 = phi_s0_10 + 4; phi_s1_9 += 0x14; phi_s0_10 = temp_s0_4; - } while (temp_s0_4 < D_800E7930); + } while ((u32) temp_s0_4 < (u32) D_800E7930); sp88 = 0x5C; sp84 = D_800E7918; phi_s3_2 = 0x2A; phi_s6_2 = 0x20; do { - set_text_color(TEXT_YELLOW); + set_text_color(3); draw_text(sp88, 0x7D, *sp84, 0, 0.75f, 0.75f); phi_s0_11 = 0; phi_s2_4 = 0x96; loop_58: if (phi_s3_2 == 0x2A) { if (phi_s0_11 == arg0->unk1C) { - set_text_color(gGlobalTimer % 3); + set_text_color((s32) gGlobalTimer % 3); } else { - set_text_color(TEXT_GREEN); + set_text_color(1); } } else if (phi_s0_11 == arg0->unk20) { - set_text_color(gGlobalTimer % 3); + set_text_color((s32) gGlobalTimer % 3); } else { - set_text_color(TEXT_GREEN); + set_text_color(1); } temp_s1_5 = phi_s0_11 + 1; convert_number_to_ascii(temp_s1_5, &spA8); @@ -9967,7 +9887,7 @@ loop_58: func_80093324(phi_s3_2, phi_s2_4, D_800E7A44, 0, 0.5f, 0.5f); } else { temp_v0_2 = phi_v1_2->unk5; - func_80093324(phi_s3_2, phi_s2_4, *(&D_800E75C4 + (*(&gCupCourseOrder + (((temp_v0_2 / 4) * 8) + ((temp_v0_2 % 4) * 2))) * 4)), 0, 0.5f, 0.5f); + func_80093324(phi_s3_2, phi_s2_4, D_800E75C4[*(gCupCourseOrder + ((((s32) temp_v0_2 / 4) * 8) + (((s32) temp_v0_2 % 4) * 2)))], 0, 0.5f, 0.5f); } phi_s0_11 = temp_s1_5; phi_s2_4 += 0x1E; @@ -9989,8 +9909,8 @@ loop_58: spE0 = phi_s1_10; spE2 = 0xD2; } - func_800921C0(temp_a0_3, temp_s1_5, TEXT_YELLOW); - func_80093324(phi_s1_10, 0xD2, *phi_s3_3, 0, 0.75f, 0.75f); + func_800921C0(temp_a0_3, temp_s1_5, 3); + func_80093324((s32) phi_s1_10, 0xD2, *phi_s3_3, 0, 0.75f, 0.75f); temp_s2_3 = phi_s2_5 + 1; phi_s2_5 = temp_s2_3; phi_s1_10 += 0x32; @@ -10000,8 +9920,8 @@ loop_58: case 0x3A: /* switch 1 */ case 0x3B: /* switch 1 */ case 0x3C: /* switch 1 */ - set_text_color(TEXT_RED); - temp_v0_3 = (((temp_v1 - 0x3A) / 2) * 4) + &D_800E7938; + set_text_color(2); + temp_v0_3 = &D_800E7938[(s32) (temp_v1 - 0x3A) / 2]; sp78 = temp_v0_3; draw_text(0xA0, 0x55, *temp_v0_3, 0, 1.0f, 1.0f); sp88 = 0x5C; @@ -10009,25 +9929,25 @@ loop_58: phi_s3_4 = 0x2A; phi_s6_3 = 0x20; do { - set_text_color(TEXT_YELLOW); + set_text_color(3); draw_text(sp88, 0x7D, *sp84, 0, 0.75f, 0.75f); phi_s0_12 = 0; phi_s2_6 = 0x96; loop_80: if (phi_s3_4 == 0x2A) { if (phi_s0_12 == arg0->unk1C) { - if (sp78 == &D_800E7938) { - set_text_color(TEXT_RED); + if (sp78 == D_800E7938) { + set_text_color(2); } else { - set_text_color(gGlobalTimer % 3); + set_text_color((s32) gGlobalTimer % 3); } } else { - set_text_color(TEXT_GREEN); + set_text_color(1); } } else if (phi_s0_12 == arg0->unk20) { - set_text_color(TEXT_RED); + set_text_color(2); } else { - set_text_color(TEXT_GREEN); + set_text_color(1); } temp_s1_6 = phi_s0_12 + 1; convert_number_to_ascii(temp_s1_6, &sp98); @@ -10041,7 +9961,7 @@ loop_80: func_80093324(phi_s3_4, phi_s2_6, D_800E7A44, 0, 0.5f, 0.5f); } else { temp_v0_4 = phi_v1_3->unk5; - func_80093324(phi_s3_4, phi_s2_6, *(&D_800E75C4 + (*(&gCupCourseOrder + (((temp_v0_4 / 4) * 8) + ((temp_v0_4 % 4) * 2))) * 4)), 0, 0.5f, 0.5f); + func_80093324(phi_s3_4, phi_s2_6, D_800E75C4[*(gCupCourseOrder + ((((s32) temp_v0_4 / 4) * 8) + (((s32) temp_v0_4 % 4) * 2)))], 0, 0.5f, 0.5f); } phi_s0_12 = temp_s1_6; phi_s2_6 += 0x1E; @@ -10078,35 +9998,26 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1FB0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_80098FC8(s32, ?, s32, ?, s32); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s8 D_8018EE08; -extern s32 gDisplayListHead; -void func_800A2D1C(void *arg0) { +void func_800A2D1C(struct_8018D9E0_entry *arg0) { + Gfx *temp_v0_2; + Gfx *temp_v0_3; + Gfx *temp_v0_4; s32 temp_t0; s32 temp_t8; s32 temp_v0; - s32 temp_v0_2; - s32 temp_v0_3; - s32 temp_v0_4; temp_v0 = D_80164A28; - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { - goto block_13; - } - temp_t8 = arg0->unk1C - 2; - arg0->unk1C = temp_t8; - if (temp_t8 > 0) { - temp_v0_2 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, temp_t8); - gDisplayListHead = temp_v0_2; - gDisplayListHead = func_80098FC8(temp_v0_2, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); - return; - } - goto block_13; - } + switch (temp_v0) { /* irregular */ + case 1: + temp_v0_2 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, 0x28); + gDisplayListHead = temp_v0_2; + gDisplayListHead = func_80098FC8(temp_v0_2, 0, 0xC7, 0x13F, 0xEF); + arg0->unk1C = 0x28; + return; + case 2: temp_t0 = arg0->unk1C - 2; arg0->unk1C = temp_t0; if (temp_t0 > 0) { @@ -10116,54 +10027,54 @@ void func_800A2D1C(void *arg0) { return; } block_13: - arg0->unk0 = 0; + arg0->type = 0; return; + default: + if ((gModeSelection != 0) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { + goto block_13; + } + temp_t8 = arg0->unk1C - 2; + arg0->unk1C = temp_t8; + if (temp_t8 > 0) { + temp_v0_4 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, temp_t8); + gDisplayListHead = temp_v0_4; + gDisplayListHead = func_80098FC8(temp_v0_4, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); + return; + } + goto block_13; } - temp_v0_4 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, 0x28); - gDisplayListHead = temp_v0_4; - gDisplayListHead = func_80098FC8(temp_v0_4, 0, 0xC7, 0x13F, 0xEF); - arg0->unk1C = 0x28; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A2D1C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? draw_text(s32, s32, s32, ?, f32, f32); // extern -s32 get_string_width(s32); // extern -? func_80093324(s32, s32, ? *, ?, f32, f32); // extern -? func_800A32B4(s32, s32, s8, s32); // extern -? convert_number_to_ascii(s32, ? *); // extern -? set_text_color(s32); // extern -extern s32 D_800DC540; -extern ? D_800E7500; -extern ? D_800E76CC; -extern ? gGameModeRowSelectionForNumPlayers; -extern ? gGameModeSubMenuRowSelectionForNumPlayers; -extern ? D_800F0C1C; -extern ? D_800F0C24; -extern f32 D_800F1C90; -extern f32 D_800F1C94; -extern f32 D_800F1C98; -extern f32 D_800F1C9C; -extern f32 D_800F1CA0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A32B4(s32, s32, s8, s32); /* extern */ extern s16 D_80164360; extern s16 D_80164368; extern ? D_80164370; -extern s8 gCupSelection; -extern s32 gGlobalTimer; -extern ? gPlayers; +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", + "star cup", + "special cup", + "battle", + "mushroom cup", + "flower cup", + "star cup", + "special cup", +}; /* const */ +s8 *D_800E76CC[4] = { "50(", "100(", "150(", "extra" }; /* const */ -void func_800A2EB8(void *arg0) { +void func_800A2EB8(struct_8018D9E0_entry *arg0) { s8 sp74; s8 sp70; - ? sp69; - ? sp68; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f0_4; + s8 sp69; + s8 sp68; s16 *temp_s0; s32 temp_s0_2; s32 temp_s2; @@ -10188,35 +10099,28 @@ void func_800A2EB8(void *arg0) { do { temp_s0 = phi_s0 + 2; temp_s1 = phi_s1 + 1; - temp_s1->unk-1 = (&gPlayers + (*phi_s0 * 0xDD8))->unk254; + temp_s1->unk-1 = (s8) gPlayers[*phi_s0].characterId; phi_s0 = temp_s0; phi_s1 = temp_s1; - } while (temp_s0 < &D_80164370); - // "Results" - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - func_80093324(arg0->unkC + 0x1E, arg0->unk10 + 0x19, &D_800F0C1C, 0, 1.0f, 1.0f); - // "Round" - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - temp_f0 = D_800F1C90; - func_80093324(arg0->unkC + 0x2C, arg0->unk10 + 0x28, &D_800F0C24, 0, temp_f0, temp_f0); - // Convert index of current course in the cup order into a round number + } while ((u32) temp_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); - // Print previously converted round number - temp_f0_2 = D_800F1C94; - func_80093324(arg0->unkC + 0x57, arg0->unk10 + 0x28, &sp69, 0, temp_f0_2, temp_f0_2); + func_80093324(arg0->column + 0x57, arg0->row + 0x28, &sp69, 0, 0.7f, 0.7f); phi_s0_2 = &D_80164360; phi_s3 = 0; phi_s1_2 = &sp70; phi_s2 = 0; - // Print rank 1, 2, 3 and 4 3-lap times do { - if (*phi_s0_2 < D_8018EDF3) { - phi_a0 = gGlobalTimer % 3; + if ((s32) *phi_s0_2 < (s32) D_8018EDF3) { + phi_a0 = (s32) gGlobalTimer % 3; } else { - phi_a0 = TEXT_YELLOW; + phi_a0 = 3; } set_text_color(phi_a0); - func_800A32B4(arg0->unkC + 7, arg0->unk10 + phi_s3 + 0x38, *phi_s1_2, phi_s2); + 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; @@ -10227,126 +10131,110 @@ void func_800A2EB8(void *arg0) { phi_s3_2 = 0x40; phi_s1_3 = &sp74; phi_s2_2 = 4; - // Print rank 5, 6, 7 and 8 3-lap times do { - if (*phi_s0_3 < D_8018EDF3) { - phi_a0_2 = gGlobalTimer % 3; + if ((s32) *phi_s0_3 < (s32) D_8018EDF3) { + phi_a0_2 = (s32) gGlobalTimer % 3; } else { - phi_a0_2 = TEXT_YELLOW; + phi_a0_2 = 3; } set_text_color(phi_a0_2); - func_800A32B4(0xBE - arg0->unkC, arg0->unk10 + phi_s3_2 + 0x5A, *phi_s1_3, phi_s2_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); - // Print Cup name - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - temp_s0_2 = ((get_string_width(*(&D_800E7500 + (gCupSelection * 4))) + 8) * D_800F1C98) / 2.0f; - temp_f0_3 = D_800F1C9C; - // Some very complicated way to print the cup name and CC mode - draw_text((-(((get_string_width(*(&D_800E76CC + (gCCSelection * 4))) + 8) * temp_f0_3) / 2.0f) - arg0->unkC) + 0xF5, arg0->unk10 + 0xE1, *(&D_800E7500 + (D_800DC540 * 4)), 0, temp_f0_3, temp_f0_3); + set_text_color(5); + temp_s0_2 = (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; - temp_f0_4 = D_800F1CA0; - // Print CC mode again? - draw_text((temp_s0_2 - arg0->unkC) + 0xF5, arg0->unk10 + 0xE1, *(&D_800E76CC + (*(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0 * 3) + *(&gGameModeRowSelectionForNumPlayers + temp_v0))) * 4)), 0, temp_f0_4, temp_f0_4); + 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); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A2EB8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(s32, ?, ? *, ?, f32, f32); // extern -? func_800939C8(s32, ?, ? *, ?, f32, f32); // extern -? convert_number_to_ascii(s32, ? *); // extern -extern ? D_800E76A8; -extern ? D_800F0C2C; -extern ? D_800F0C30; -extern f32 D_800F1CA4; -extern f32 D_800F1CA8; -extern ? gTimePlayerLastTouchedFinishLine; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern ? D_80164360; +static s8 *D_800E76A8[9] = { + "MARIO", + "LUIGI", + "YOSHI", + "TOAD", + "D.K.", + "WARIO", + "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, ? arg1, s32 arg2, s32 arg3) { +void func_800A32B4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { f32 sp50; s8 sp3F; s8 sp3E; - ? sp3D; - ? sp3C; - f32 temp_f20; - f32 temp_f4; + s8 sp3D; + s8 sp3C; - temp_f4 = *(&gTimePlayerLastTouchedFinishLine + (*(&D_80164360 + (arg3 * 2)) * 4)); - sp50 = temp_f4; - // Convert arg3 (some index) into a rank string - // This is a little wonky. - // sp3c becomes "0x30, rank#, \0" + sp50 = gTimePlayerLastTouchedFinishLine[*(&D_80164360 + (arg3 * 2))]; convert_number_to_ascii(arg3 + 1, &sp3C); - temp_f20 = D_800F1CA4; - // change the \0 to a "." sp3E = 0x2E; - // add a new termnitator sp3F = 0; - // Print rank string - func_800939C8(arg0 - 1, arg1, &sp3D, -4, temp_f20, temp_f20); - // Print character name (arg2 is almost certainly characterId) - func_80093324(arg0 + 0xA, arg1, *(&D_800E76A8 + (arg2 * 4)), 0, D_800F1CA8, temp_f20); - // Get minutes - convert_number_to_ascii(sp50 / 60.0f, &sp3C); - // Print minutes - func_800939C8(arg0 + 0x42, arg1, &sp3C, 0, temp_f20, temp_f20); - // Get seconds - convert_number_to_ascii(temp_f4 % 0x3C, &sp3C); - // Print ' - func_80093324(arg0 + 0x4E, arg1, &D_800F0C2C, 0, temp_f20, temp_f20); - // Print seconds - func_800939C8(arg0 + 0x56, arg1, &sp3C, 0, temp_f20, temp_f20); - // Get centiseconds - convert_number_to_ascii((sp50 * 100.0) % 0x64, &sp3C); - // Print " - func_80093324(arg0 + 0x62, arg1, &D_800F0C30, 0, temp_f20, temp_f20); - // Print centiseconds - func_800939C8(arg0 + 0x6A, arg1, &sp3C, 0, temp_f20, temp_f20); + func_800939C8(arg0 - 1, arg1, &sp3D, -4, 0.7f, 0.7f); + func_80093324(arg0 + 0xA, arg1, D_800E76A8[arg2], 0, 0.65f, 0.7f); + convert_number_to_ascii((s32) (sp50 / 60.0f), &sp3C); + func_800939C8(arg0 + 0x42, arg1, &sp3C, 0, 0.7f, 0.7f); + convert_number_to_ascii((s32) sp50 % 60, &sp3C); + func_80093324(arg0 + 0x4E, arg1, "'", 0, 0.7f, 0.7f); + func_800939C8(arg0 + 0x56, arg1, &sp3C, 0, 0.7f, 0.7f); + convert_number_to_ascii((s32) ((f64) sp50 * 100.0) % 100, &sp3C); + func_80093324(arg0 + 0x62, arg1, "\"", 0, 0.7f, 0.7f); + func_800939C8(arg0 + 0x6A, arg1, &sp3C, 0, 0.7f, 0.7f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A32B4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? draw_text(s32, s32, s32, ?, f32, f32); /* extern */ -s32 get_string_width(s32); /* extern */ -? func_80093324(s32, s32, ? *, ?, f32, f32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800A3A10(s8 *); /* extern */ -? func_800A3ADC(void *, s32, s32, s8, s32, s8 *); /* extern */ -? convert_number_to_ascii(s32, ? *); /* extern */ -? set_text_color(s32); /* extern */ -extern s32 D_800DC540; +? func_800A3ADC(struct_8018D9E0_entry *, s32, s32, s8, s32, s8 *); /* extern */ extern ? D_80164360; extern ? D_80164370; extern ? D_80164478; extern s8 D_8018EDF3; -static ? D_800E7500; /* unable to generate initializer; const */ -static ? D_800E76CC; /* unable to generate initializer; const */ -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ +static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ +static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ +s8 *D_800E7500[9] = { + "mushroom cup", + "flower cup", + "star cup", + "special cup", + "battle", + "mushroom cup", + "flower cup", + "star cup", + "special cup", +}; /* const */ +s8 *D_800E76CC[4] = { "50(", "100(", "150(", "extra" }; /* const */ -void func_800A34A8(void *arg0) { +void func_800A34A8(struct_8018D9E0_entry *arg0) { s8 sp80; - ? sp79; - ? sp78; + s8 sp79; + s8 sp78; s32 sp68; ? *temp_a0; - s32 temp_s0_2; + s32 temp_s0_4; s32 temp_s1; s32 temp_s1_2; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; s8 *temp_s0; + s8 *temp_s0_2; + s8 *temp_s0_3; s8 temp_v0; ? *phi_a0; s8 *phi_s0; @@ -10368,10 +10256,10 @@ void func_800A34A8(void *arg0) { do { temp_a0 = phi_a0 + 8; temp_s0 = phi_s0 + 4; - temp_s0->unk-4 = gPlayers[phi_a0->unk0].characterId; - temp_s0->unk-3 = gPlayers[phi_a0->unk2].characterId; - temp_s0->unk-2 = gPlayers[phi_a0->unk4].characterId; - temp_s0->unk-1 = gPlayers[temp_a0->unk-2].characterId; + temp_s0->unk-4 = (s8) gPlayers[phi_a0->unk0].characterId; + temp_s0->unk-3 = (s8) gPlayers[phi_a0->unk2].characterId; + temp_s0->unk-2 = (s8) gPlayers[phi_a0->unk4].characterId; + temp_s0->unk-1 = (s8) gPlayers[temp_a0->unk-2].characterId; phi_a0 = temp_a0; phi_s0 = temp_s0; } while (temp_a0 != &D_80164370); @@ -10379,18 +10267,13 @@ void func_800A34A8(void *arg0) { func_800A3A10(&sp80); func_800A3A10(gCharacterIdByGPOverallRank); } - // "Driver's Points" - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - func_80093324(arg0->unkC + 0x19, 0x19 - arg0->unk10, "driver's points", 0, 0.8f, 0.8f); - // "Round" - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - func_80093324(arg0->unkC + 0x36, 0x28 - arg0->unk10, "round", 0, 0.7f, 0.7f); - // Convert course index to a round number + set_text_color(4); + func_80093324(arg0->column + 0x19, 0x19 - arg0->row, "driver's points", 0, 0.8f, 0.8f); + set_text_color(5); + func_80093324(arg0->column + 0x36, 0x28 - arg0->row, "round", 0, 0.7f, 0.7f); convert_number_to_ascii(gCupCourseSelection + 1, &sp78); - // Print round number - func_80093324(arg0->unkC + 0x61, 0x28 - arg0->unk10, &sp79, 0, 0.7f, 0.7f); + func_80093324(arg0->column + 0x61, 0x28 - arg0->row, &sp79, 0, 0.7f, 0.7f); phi_s1 = 0; - // Print rank 1, 2, 3 and 4 lines do { temp_v1_2 = arg0->unk4; if ((temp_v1_2 != 8) && (temp_v1_2 != 9)) { @@ -10402,29 +10285,30 @@ void func_800A34A8(void *arg0) { } } if (phi_v0 == 0) { + temp_s0_2 = &(&sp80)[phi_s1]; if (temp_v1_2 < 9) { - phi_v0_2 = *(&D_80164360 + (phi_s1 * 2)); + phi_v0_2 = (s32) *(&D_80164360 + (phi_s1 * 2)); phi_v1 = 0; } else { - phi_v0_2 = *(&D_80164478 + ((&sp80)[phi_s1] * 2)); + phi_v0_2 = (s32) *(&D_80164478 + (*temp_s0_2 * 2)); phi_v1 = 0xD; } - if (phi_v0_2 < D_8018EDF3) { - phi_a0_2 = gGlobalTimer % 3; + if (phi_v0_2 < (s32) D_8018EDF3) { + phi_a0_2 = (s32) gGlobalTimer % 3; } else { - phi_a0_2 = TEXT_YELLOW; + phi_a0_2 = 3; } sp68 = phi_v1; set_text_color(phi_a0_2); - func_800A3ADC(arg0, arg0->unkC + phi_v1 + 0x1C, ((phi_s1 * 0x10) - arg0->unk10) + 0x38, (&sp80)[phi_s1], phi_s1, &sp80); + func_800A3ADC(arg0, arg0->column + phi_v1 + 0x1C, ((phi_s1 * 0x10) - arg0->row) + 0x38, *temp_s0_2, phi_s1, &sp80); } temp_s1 = phi_s1 + 1; phi_s1 = temp_s1; } while (temp_s1 < 4); phi_s1_2 = 4; - // Print rank 5, 6, 7 and 8 lines do { temp_v1_3 = arg0->unk4; + temp_s0_3 = &(&sp80)[phi_s1_2]; if ((temp_v1_3 != 8) && (temp_v1_3 != 9)) { phi_v0_3 = 0; } else { @@ -10435,26 +10319,26 @@ void func_800A34A8(void *arg0) { } if (phi_v0_3 == 0) { if (temp_v1_3 < 9) { - phi_v0_4 = *(&D_80164360 + (phi_s1_2 * 2)); + phi_v0_4 = (s32) *(&D_80164360 + (phi_s1_2 * 2)); } else { - phi_v0_4 = *(&D_80164478 + ((&sp80)[phi_s1_2] * 2)); + phi_v0_4 = (s32) *(&D_80164478 + (*temp_s0_3 * 2)); } - if (phi_v0_4 < D_8018EDF3) { - phi_a0_3 = gGlobalTimer % 3; + if (phi_v0_4 < (s32) D_8018EDF3) { + phi_a0_3 = (s32) gGlobalTimer % 3; } else { - phi_a0_3 = TEXT_YELLOW; + phi_a0_3 = 3; } set_text_color(phi_a0_3); - func_800A3ADC(arg0, 0xBE - arg0->unkC, arg0->unk10 + (phi_s1_2 * 0x10) + 0x5A, (&sp80)[phi_s1_2], phi_s1_2, &sp80); + func_800A3ADC(arg0, 0xBE - arg0->column, arg0->row + (phi_s1_2 * 0x10) + 0x5A, *temp_s0_3, phi_s1_2, &sp80); } temp_s1_2 = phi_s1_2 + 1; phi_s1_2 = temp_s1_2; } while (temp_s1_2 != 8); - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - temp_s0_2 = ((get_string_width(*(&D_800E7500 + (gCupSelection * 4))) + 8) * 0.6f) / 2.0f; - draw_text((-(((get_string_width(*(&D_800E76CC + (gCCSelection * 4))) + 8) * 0.6f) / 2.0f) - arg0->unkC) + 0xE6, arg0->unk10 + 0xE1, *(&D_800E7500 + (D_800DC540 * 4)), 0, 0.6f, 0.6f); + set_text_color(5); + temp_s0_4 = (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) + 0xE6, arg0->row + 0xE1, D_800E7500[D_800DC540], 0, 0.6f, 0.6f); temp_v0 = D_8018EDF3; - draw_text((temp_s0_2 - arg0->unkC) + 0xE6, arg0->unk10 + 0xE1, *(&D_800E76CC + (*(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0 * 3) + *(&gGameModeRowSelectionForNumPlayers + temp_v0))) * 4)), 0, 0.6f, 0.6f); + draw_text((temp_s0_4 - arg0->column) + 0xE6, arg0->row + 0xE1, D_800E76CC[*(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0 * 3) + *(&gGameModeRowSelectionForNumPlayers + temp_v0)))], 0, 0.6f, 0.6f); } } #else @@ -10520,14 +10404,22 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A3A10.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_80093324(s32, s32, s8 *, ?, f32, f32); /* extern */ -? func_800939C8(s32, s32, s8 *, ?, f32, f32); /* extern */ -? convert_number_to_ascii(s8, s8 *); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s32 D_8018D9BC; -static ? D_800E76A8; /* unable to generate initializer; const */ +static s8 *D_800E76A8[9] = { + "MARIO", + "LUIGI", + "YOSHI", + "TOAD", + "D.K.", + "WARIO", + "PEACH", + "BOWSER", + D_800EFE0C, +}; /* const */ +static s8 D_800EFE0C[9] = { 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0 }; /* const */ -void func_800A3ADC(void *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { +void func_800A3ADC(struct_8018D9E0_entry *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { s8 sp37; s8 sp36; s8 sp35; @@ -10560,18 +10452,12 @@ loop_4: } sp36 = 0x2E; sp37 = 0; - // Print rank # + "." func_800939C8(arg1, arg2, &sp35, -4, 0.7f, 0.7f); - // Print character name - func_80093324(arg1 + 0xA, arg2, *(&D_800E76A8 + (arg3 * 4)), 0, 0.7f, 0.7f); - // Print character's current point count - convert_number_to_ascii(gGPPointsByCharacterId[arg3], &sp34); + func_80093324(arg1 + 0xA, arg2, D_800E76A8[arg3], 0, 0.7f, 0.7f); + convert_number_to_ascii((s32) gGPPointsByCharacterId[arg3], &sp34); func_800939C8(arg1 + 0x47, arg2, &sp34, 0, 0.7f, 0.7f); - // Print "+" + points left to be allocated - // Only done for rank 1, 2, 3 and 4 - // arg4 is almost certainly rank if ((arg4 < 4) && (arg0->unk4 < 9)) { - convert_number_to_ascii(*(D_8018D9BC + arg4), &sp34); + convert_number_to_ascii((s32) *(D_8018D9BC + arg4), &sp34); sp34 = 0x2B; func_80093324(arg1 + 0x5A, arg2, &sp34, 0, 0.7f, 0.7f); } @@ -10603,48 +10489,72 @@ void func_800A3C84(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? draw_text(s32, s32, ? *, ?, f32, f32); /* extern */ -? func_800921C0(s32, s32, ?); /* extern */ -? func_80093324(s32, s32, ? *, ?, f32, f32); /* extern */ -? func_80093358(s32, s32, ? *, ?, f32, f32); /* extern */ -? func_800A4550(s32, s32, s32); /* extern */ -? func_800A66A8(void *, s16 *); /* extern */ -? convert_number_to_ascii(s32, ? *); /* extern */ -? set_text_color(?); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E798C_0x1C { + /* 0x00 */ s8 *unk0; /* inferred */ + /* 0x04 */ struct _struct_D_800E798C_0x1C unk4; /* inferred */ +}; /* size = 0x1C */ + +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ +extern s32 D_80162DF8; extern ? D_8018EE10; static ? D_800E7390; /* unable to generate initializer; const */ static ? D_800E73C0; /* unable to generate initializer; const */ static ? D_800E73D0; /* unable to generate initializer; const */ -static ? D_800E7574; /* unable to generate initializer; const */ -static ? D_800E75C4; /* unable to generate initializer; const */ -static ? *D_800E7730 = "LAP TIME"; /* const */ +static s8 *D_800E75C4[0x14] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", +}; /* const */ static ? D_800E775C; /* unable to generate initializer; const */ -static ? D_800E798C; /* unable to generate initializer; const */ -static ? *D_800E7A3C[2] = { "SELECT THE FILE ", "YOU WANT TO SAVE" }; /* const */ -static ? *D_800E7A44 = "NO DATA"; /* const */ -static ? *D_800E7A48[3] = { "CREATING ", "MARIO KART 64 ", "GAME DATA" }; /* const */ +static struct _struct_D_800E798C_0x1C D_800E798C[6]; /* unable to generate initializer; const */ +static s8 *D_800E7A3C[2] = { "SELECT THE FILE ", "YOU WANT TO SAVE" }; /* const */ +static s8 *D_800E7A44 = "NO DATA"; /* const */ +static struct _struct_D_800E798C_0x1C D_800E7A48; /* type too large by 0x10; unable to generate initializer; const */ static ? D_800E7A54; /* unable to generate initializer; const */ -static ? *D_800E7A60[3] = { "THE PREVIOUS DATA ", "WILL BE ERASED, ", "IS THIS OK?" }; /* const */ -static ? *D_800E7A6C[2] = { "QUIT", "SAVE" }; /* const */ -static ? *D_800E7A74[3] = { "SAVING GHOST DATA", "", "PLEASE WAIT" }; /* const */ -static ? *D_800E7A80[2] = { "UNABLE TO SAVE ", "THE GHOST" }; /* const */ -static ? D_800E7A88; /* unable to generate initializer; const */ -static ? gCupCourseOrder; /* unable to generate initializer; const */ +static s8 *D_800E7A60[3] = { "THE PREVIOUS DATA ", "WILL BE ERASED, ", "IS THIS OK?" }; /* const */ +static s8 *D_800E7A6C[2] = { "QUIT", "SAVE" }; /* const */ +static struct _struct_D_800E798C_0x1C D_800E7A74; /* type too large by 0x10; unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A80; /* type too large by 0x14; unable to generate initializer; const */ +s8 *D_800E7574[8] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", +}; /* const */ +s8 *D_800E7730 = "LAP TIME"; /* const */ +s8 *D_800E7A88[4] = { "YOU ARE AWARDED THE", "GOLD CUP", "SILVER CUP", "BRONZE CUP" }; /* const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ -void func_800A3E60(void *arg0) { +void func_800A3E60(struct_8018D9E0_entry *arg0) { s16 sp86; s16 sp84; s32 sp6C; - ? sp61; - ? sp60; + s8 sp61; + s8 sp60; s32 sp54; - ? **sp50; - ? **temp_s0_2; - ? **temp_s0_3; - ? **temp_v0_3; - ? **temp_v0_4; - ? **temp_v0_5; + struct _struct_D_800E798C_0x1C *sp50; Gfx *temp_v1_2; s16 *temp_a1; s32 temp_a0; @@ -10654,46 +10564,51 @@ void func_800A3E60(void *arg0) { s32 temp_s1_3; s32 temp_v0; s32 temp_v1; + s8 **temp_s0_2; + s8 **temp_s0_3; s8 temp_v0_2; + struct _struct_D_800E798C_0x1C *temp_v0_3; + struct _struct_D_800E798C_0x1C *temp_v0_4; + struct _struct_D_800E798C_0x1C *temp_v0_5; s32 phi_s1; s32 phi_s0; s32 phi_s1_2; s32 phi_v1; s32 phi_s2; ? *phi_s0_2; - ? **phi_v0; + struct _struct_D_800E798C_0x1C *phi_v0; s32 phi_s0_3; s32 phi_s2_2; - ? **phi_s0_4; + s8 **phi_s0_4; s32 phi_s1_3; s32 phi_s0_5; ? *phi_s2_3; - ? **phi_v0_2; + struct _struct_D_800E798C_0x1C *phi_v0_2; s32 phi_s0_6; s32 phi_s2_4; - ? **phi_s0_7; + s8 **phi_s0_7; s32 phi_s1_4; s32 phi_s0_8; - ? **phi_s2_5; - ? **phi_v0_3; + s8 **phi_s2_5; + struct _struct_D_800E798C_0x1C *phi_v0_3; s32 phi_s0_9; - ? **phi_v0_4; + struct _struct_D_800E798C_0x1C *phi_v0_4; s32 phi_s0_10; void *phi_v0_5; temp_v0 = arg0->unk4; if ((temp_v0 != 0) && (temp_v0 != 0x1F)) { - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - draw_text(arg0->unkC + 0x55, 0x19 - arg0->unk10, *(&D_800E7574 + (*(&gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2))) * 4)), 0, 0.6f, 0.6f); - set_text_color(TEXT_YELLOW); - draw_text(arg0->unkC + 0x55, 0x28 - arg0->unk10, D_800E7730, 0, 0.75f, 0.75f); + set_text_color(4); + draw_text(arg0->column + 0x55, 0x19 - arg0->row, D_800E7574[*(gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2)))], 0, 0.6f, 0.6f); + set_text_color(3); + draw_text(arg0->column + 0x55, 0x28 - arg0->row, D_800E7730, 0, 0.75f, 0.75f); phi_s1 = 0; phi_s0 = 0; phi_s1_2 = 0; phi_s1_3 = 0; phi_s1_4 = 0; do { - func_800A4550(phi_s1, arg0->unkC + 0x26, (phi_s0 - arg0->unk10) + 0x37); + func_800A4550(phi_s1, arg0->column + 0x26, (phi_s0 - arg0->row) + 0x37); temp_s1 = phi_s1 + 1; phi_s1 = temp_s1; phi_s0 += 0xF; @@ -10712,33 +10627,35 @@ void func_800A3E60(void *arg0) { phi_s0_2 = &D_800E775C; do { sp6C = 0; - func_800921C0(arg0->unk4 - 5, phi_s1_2, TEXT_GREEN); + func_800921C0(arg0->unk4 - 5, phi_s1_2, 1); phi_v1 = sp6C; - if (phi_s1_2 != 4) { - if (phi_s1_2 != 5) { - - } else if (D_80162DD4 != 0) { + switch (phi_s1_2) { /* switch 3; irregular */ + case 4: /* switch 3 */ + if (D_80162DF8 == 1) { + phi_v1 = 1; + } + break; + case 5: /* switch 3 */ + if (*D_80162DD4 != 0) { phi_v1 = 2; } - } else if (D_80162DF8 == 1) { - phi_v1 = 1; + break; } if (phi_v1 != 0) { - set_text_color(TEXT_BLUE); + set_text_color(0); temp_v1_2 = gDisplayListHead; gDisplayListHead = temp_v1_2 + 8; temp_v1_2->words.w1 = 0x96; temp_v1_2->words.w0 = 0xFA000000; - func_80093358(0xB2 - arg0->unkC, arg0->unk10 + phi_s2 + 0x93, phi_s0_2->unk4, 0, 0.75f, 0.75f); + func_80093358(0xB2 - arg0->column, arg0->row + phi_s2 + 0x93, phi_s0_2->unk4, 0, 0.75f, 0.75f); } else { - func_80093324(0xB2 - arg0->unkC, arg0->unk10 + phi_s2 + 0x93, phi_s0_2->unk4, 0, 0.75f, 0.75f); + func_80093324(0xB2 - arg0->column, arg0->row + phi_s2 + 0x93, phi_s0_2->unk4, 0, 0.75f, 0.75f); } temp_s1_2 = phi_s1_2 + 1; phi_s1_2 = temp_s1_2; phi_s2 += 0xD; phi_s0_2 += 4; } while (temp_s1_2 != 6); -block_43: break; case 11: /* switch 1 */ case 12: /* switch 1 */ @@ -10746,105 +10663,105 @@ block_43: case 14: /* switch 1 */ case 15: /* switch 1 */ case 16: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0 = ((arg0->unk4 - 0xB) * 0x1C) + &D_800E798C; + set_text_color(3); + phi_v0 = &D_800E798C[arg0->unk4 - 0xB]; phi_s0_3 = 0x8C; do { sp50 = phi_v0; - func_80093324(0xA2, phi_s0_3, *phi_v0, 0, 0.6f, 0.6f); + func_80093324(0xA2, phi_s0_3, phi_v0->unk0, 0, 0.6f, 0.6f); temp_s0 = phi_s0_3 + 0xD; - phi_v0 += 4; + phi_v0 = &phi_v0->unk4; phi_s0_3 = temp_s0; } while (temp_s0 != 0xE7); - goto block_43; + break; case 17: /* switch 1 */ case 18: /* switch 1 */ - set_text_color(TEXT_GREEN); + set_text_color(1); phi_s2_2 = 0; phi_s0_4 = D_800E7A3C; do { - func_80093324(0xA5, arg0->unk10 + phi_s2_2 + 0x8C, *phi_s0_4, 0, 0.7f, 0.7f); + func_80093324(0xA5, arg0->row + phi_s2_2 + 0x8C, *phi_s0_4, 0, 0.7f, 0.7f); temp_s0_2 = phi_s0_4 + 4; phi_s2_2 += 0xD; phi_s0_4 = temp_s0_2; - } while (temp_s0_2 < &D_800E7A44); + } while ((u32) temp_s0_2 < (u32) &D_800E7A44); phi_s0_5 = 0xAA; phi_s2_3 = &D_8018EE10; do { - func_800921C0(arg0->unk4 - 0x11, phi_s1_3, TEXT_GREEN); + func_800921C0(arg0->unk4 - 0x11, phi_s1_3, 1); temp_a0 = phi_s1_3 + 1; sp54 = temp_a0; convert_number_to_ascii(temp_a0, &sp60); - func_80093324(0xB1 - arg0->unkC, phi_s0_5, &sp61, 0, 0.6f, 0.6f); + func_80093324(0xB1 - arg0->column, phi_s0_5, &sp61, 0, 0.6f, 0.6f); if (phi_s2_3->unk4 == 0) { - func_80093324(0xBB - arg0->unkC, phi_s0_5, D_800E7A44, 0, 0.45f, 0.45f); + func_80093324(0xBB - arg0->column, phi_s0_5, D_800E7A44, 0, 0.45f, 0.45f); } else { temp_v0_2 = phi_s2_3->unk5; - func_80093324(0xBB - arg0->unkC, phi_s0_5, *(&D_800E75C4 + (*(&gCupCourseOrder + (((temp_v0_2 / 4) * 8) + ((temp_v0_2 % 4) * 2))) * 4)), 0, 0.45f, 0.45f); + func_80093324(0xBB - arg0->column, phi_s0_5, D_800E75C4[*(gCupCourseOrder + ((((s32) temp_v0_2 / 4) * 8) + (((s32) temp_v0_2 % 4) * 2)))], 0, 0.45f, 0.45f); } phi_s1_3 = sp54; phi_s0_5 += 0x1E; phi_s2_3 += 0x80; } while (sp54 != 2); - goto block_43; + break; case 19: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_2 = D_800E7A48; + set_text_color(3); + phi_v0_2 = &D_800E7A48; phi_s0_6 = 0x93; do { sp50 = phi_v0_2; - func_80093324(0xAA, phi_s0_6, *phi_v0_2, 0, 0.8f, 0.8f); - temp_v0_3 = phi_v0_2 + 4; + func_80093324(0xAA, phi_s0_6, phi_v0_2->unk0, 0, 0.8f, 0.8f); + temp_v0_3 = &phi_v0_2->unk4; phi_v0_2 = temp_v0_3; phi_s0_6 += 0xD; } while (temp_v0_3 != &D_800E7A54); - goto block_43; + break; case 20: /* switch 1 */ case 21: /* switch 1 */ - set_text_color(TEXT_YELLOW); + set_text_color(3); phi_s2_4 = 0; phi_s0_7 = D_800E7A60; do { - func_80093324(0xA3, arg0->unk10 + phi_s2_4 + 0x8C, *phi_s0_7, 0, 0.67f, 0.67f); + func_80093324(0xA3, arg0->row + phi_s2_4 + 0x8C, *phi_s0_7, 0, 0.67f, 0.67f); temp_s0_3 = phi_s0_7 + 4; phi_s2_4 += 0xD; phi_s0_7 = temp_s0_3; - } while (temp_s0_3 < D_800E7A6C); + } while ((u32) temp_s0_3 < (u32) D_800E7A6C); phi_s0_8 = 0xB9; phi_s2_5 = D_800E7A6C; do { - func_800921C0(arg0->unk4 - 0x14, phi_s1_4, TEXT_GREEN); - func_80093324(0xC8 - arg0->unkC, phi_s0_8, *phi_s2_5, 0, 0.75f, 0.75f); + func_800921C0(arg0->unk4 - 0x14, phi_s1_4, 1); + func_80093324(0xC8 - arg0->column, phi_s0_8, *phi_s2_5, 0, 0.75f, 0.75f); temp_s1_3 = phi_s1_4 + 1; phi_s1_4 = temp_s1_3; phi_s0_8 += 0xF; phi_s2_5 += 4; } while (temp_s1_3 != 2); - goto block_43; + break; case 25: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_3 = D_800E7A74; + set_text_color(3); + phi_v0_3 = &D_800E7A74; phi_s0_9 = 0x93; do { sp50 = phi_v0_3; - func_80093324(0xA3, phi_s0_9, *phi_v0_3, 0, 0.67f, 0.67f); - temp_v0_4 = phi_v0_3 + 4; + func_80093324(0xA3, phi_s0_9, phi_v0_3->unk0, 0, 0.67f, 0.67f); + temp_v0_4 = &phi_v0_3->unk4; phi_v0_3 = temp_v0_4; phi_s0_9 += 0xD; - } while (temp_v0_4 != D_800E7A80); - goto block_43; + } while (temp_v0_4 != &D_800E7A80); + break; case 26: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_4 = D_800E7A80; + set_text_color(3); + phi_v0_4 = &D_800E7A80; phi_s0_10 = 0x93; do { sp50 = phi_v0_4; - func_80093324(0xAA, phi_s0_10, *phi_v0_4, 0, 0.75f, 0.75f); - temp_v0_5 = phi_v0_4 + 4; + func_80093324(0xAA, phi_s0_10, phi_v0_4->unk0, 0, 0.75f, 0.75f); + temp_v0_5 = &phi_v0_4->unk4; phi_v0_4 = temp_v0_5; phi_s0_10 += 0xD; - } while (temp_v0_5 != &D_800E7A88); - goto block_43; + } while (temp_v0_5 != D_800E7A88); + break; } switch (arg0->unk4) { /* switch 2 */ case 5: /* switch 2 */ @@ -10856,8 +10773,8 @@ block_43: phi_v0_5 = (arg0->unk4 * 8) - 0x28 + &D_800E7390; block_50: temp_a1 = &sp84; - sp84 = phi_v0_5->unk0 - arg0->unkC; - sp86 = phi_v0_5->unk2 + arg0->unk10; + sp84 = phi_v0_5->unk0 - arg0->column; + sp86 = phi_v0_5->unk2 + arg0->row; func_800A66A8(arg0, temp_a1); break; case 17: /* switch 2 */ @@ -10879,150 +10796,124 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A3E60.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(s32, s32, ? *, ?, f32, f32); // extern -? func_800936B8(s32, s32, s32, ?, f32, f32); // extern -? func_800939C8(s32, s32, ? *, ?, f32, f32); // extern -? get_time_record_minutes(s32, ? *); // extern -? get_time_record_seconds(s32, ? *); // extern -? get_time_record_centiseconds(s32, ? *); // extern -void *func_800AAEF4(?); // extern -? set_text_color(s32); // extern -extern ? D_800E7734; -extern ? D_800F0C4C; -extern ? D_800F0C50; -extern f32 D_800F1DC4; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s32 D_8018CA78; extern ? D_8018CA90; -extern s32 gGlobalTimer; +static ? D_800E7734; /* unable to generate initializer; const */ -void func_800A4550(s32 arg0, s32 arg1, s32 arg2) { +void func_800A4550(s32 recordType, s32 column, s32 row) { s32 sp40; - ? sp34; + s8 sp34; s32 sp2C; - f32 temp_f20; s32 temp_v0; - void *temp_v0_2; + struct_8018D9E0_entry *temp_v0_2; s32 phi_v0; s32 phi_a0; - if (arg0 < 3) { - temp_v0 = arg0 * 4; + if (recordType < 3) { + temp_v0 = recordType * 4; sp2C = temp_v0; sp40 = *(&D_8018CA90 + temp_v0); - set_text_color(TEXT_RED); + set_text_color(2); phi_v0 = temp_v0; } else { sp40 = D_8018CA78; - set_text_color(TEXT_GREEN); - phi_v0 = arg0 * 4; + set_text_color(1); + phi_v0 = recordType * 4; } - temp_f20 = D_800F1DC4; - func_800936B8(arg1 + 0x21, arg2, *(&D_800E7734 + phi_v0), 0, temp_f20, temp_f20); + func_800936B8(column + 0x21, row, *(&D_800E7734 + phi_v0), 0, 0.7f, 0.7f); temp_v0_2 = func_800AAEF4(0xBB); - if (arg0 < 3) { - if ((temp_v0_2->unk20 & (1 << arg0)) != 0) { - phi_a0 = gGlobalTimer % 3; + if (recordType < 3) { + if ((temp_v0_2->unk20 & (1 << recordType)) != 0) { + phi_a0 = (s32) gGlobalTimer % 3; } else { - phi_a0 = TEXT_YELLOW; + phi_a0 = 3; } } else { - phi_a0 = TEXT_YELLOW; - // If 3 lap time is in top 5 times + phi_a0 = 3; if (temp_v0_2->unk1C >= 0) { - phi_a0 = gGlobalTimer % 3; + phi_a0 = (s32) gGlobalTimer % 3; } } set_text_color(phi_a0); - // Get minutes get_time_record_minutes(sp40, &sp34); - // Print minute - func_800939C8(arg1 + 0x2C, arg2, &sp34, 0, temp_f20, temp_f20); - // ' - func_80093324(arg1 + 0x37, arg2, &D_800F0C4C, 0, temp_f20, temp_f20); - // Get seconds + func_800939C8(column + 0x2C, row, &sp34, 0, 0.7f, 0.7f); + func_80093324(column + 0x37, row, "'", 0, 0.7f, 0.7f); get_time_record_seconds(sp40, &sp34); - // Print seconds - func_800939C8(arg1 + 0x40, arg2, &sp34, 0, temp_f20, temp_f20); - // " - func_80093324(arg1 + 0x4B, arg2, &D_800F0C50, 0, temp_f20, temp_f20); - // Get milliseconds + func_800939C8(column + 0x40, row, &sp34, 0, 0.7f, 0.7f); + func_80093324(column + 0x4B, row, "\"", 0, 0.7f, 0.7f); get_time_record_centiseconds(sp40, &sp34); - // Print millisecond - func_800939C8(arg1 + 0x55, arg2, &sp34, 0, temp_f20, temp_f20); + func_800939C8(column + 0x55, row, &sp34, 0, 0.7f, 0.7f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A4550.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? draw_text(s32, s32, s32, ?, f32, f32); // extern -? func_80093324(s32, s32, ? *, ?, f32, f32); // extern -? func_800939C8(s32, s32, ? *, ?, f32, f32); // extern -? get_time_record_minutes(u32, ? *); // extern -? get_time_record_seconds(u32, ? *); // extern -? get_time_record_centiseconds(u32, ? *); // extern -void *func_800AAEF4(?); // extern -u32 func_800B4E24(s32, s8 *); // extern -u32 func_800B4EB4(s32, s8); // extern -u32 func_800B4F2C(s8 *); // extern -u32 func_800B4FB0(s8); // extern -? set_text_color(s32); // extern -extern ? D_800E76A8; -extern ? D_800E7744; -extern ? D_800F0C54; -extern ? D_800F0C58; -extern f32 D_800F1DC8; -extern s8 gTimeTrialDataCourseIndex; -extern s32 gGlobalTimer; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static s8 *D_800E76A8[9] = { + "MARIO", + "LUIGI", + "YOSHI", + "TOAD", + "D.K.", + "WARIO", + "PEACH", + "BOWSER", + D_800EFE0C, +}; /* const */ +static s8 *D_800E7744[6] = { D_800EFF20, D_800EFF28, D_800EFF30, D_800EFF38, D_800EFF40, " " }; /* const */ +static s8 D_800EFE0C[9] = { 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0 }; /* const */ +static s8 D_800EFF20[5] = { 0x31, 0x20, 0xA3, -0xD, 0 }; /* const */ +static s8 D_800EFF28[5] = { 0x32, 0x20, 0xA3, -0x12, 0 }; /* const */ +static s8 D_800EFF30[5] = { 0x33, 0x20, 0xA3, -0xE, 0 }; /* const */ +static s8 D_800EFF38[5] = { 0x34, 0x20, 0xA3, -0xC, 0 }; /* const */ +static s8 D_800EFF40[5] = { 0x35, 0x20, 0xA3, -0xC, 0 }; /* const */ -void func_800A474C(s32 arg0, s32 arg1, s32 arg2) { +void func_800A474C(s32 recordType, s32 column, s32 row) { u32 sp48; s32 sp40; - ? sp38; + s8 sp38; s32 sp30; - u32 sp2C; - f32 temp_f20; - u32 temp_t0; - void *temp_v0; + s32 sp2C; + s32 temp_t0; + struct_8018D9E0_entry *temp_v0; u32 phi_v0; u32 phi_v0_2; u32 phi_v0_3; - if (D_800DC50C == RACING) { + if (D_800DC50C == 4) { sp30 = 0; } else { sp30 = 1; } - if (arg0 < 5) { + if (recordType < 5) { if (sp30 == 0) { - phi_v0 = func_800B4E24(arg0, &gTimeTrialDataCourseIndex); + phi_v0 = func_800B4E24(recordType); } else { - phi_v0 = func_800B4EB4(arg0, gTimeTrialDataCourseIndex); + phi_v0 = func_800B4EB4(recordType, (s32) gTimeTrialDataCourseIndex); } sp48 = phi_v0; - set_text_color(TEXT_GREEN); + set_text_color(1); } else { if (sp30 == 0) { phi_v0_2 = func_800B4F2C(&gTimeTrialDataCourseIndex); } else { - phi_v0_2 = func_800B4FB0(gTimeTrialDataCourseIndex); + phi_v0_2 = func_800B4FB0((s32) gTimeTrialDataCourseIndex); } sp48 = phi_v0_2; } - temp_f20 = D_800F1DC8; - func_800939C8(arg1 + 0x14, arg2, *(&D_800E7744 + (arg0 * 4)), 2, temp_f20, temp_f20); + func_800939C8(column + 0x14, row, D_800E7744[recordType], 2, 0.65f, 0.65f); if (sp30 == 0) { temp_v0 = func_800AAEF4(0xBB); - if (arg0 < 5) { - if (arg0 == temp_v0->unk1C) { - sp40 = gGlobalTimer % 3; + if (recordType < 5) { + if (recordType == temp_v0->unk1C) { + sp40 = (s32) gGlobalTimer % 3; } else { goto block_21; } } else if (temp_v0->unk20 != 0) { - sp40 = gGlobalTimer % 3; + sp40 = (s32) gGlobalTimer % 3; } else { goto block_21; } @@ -11034,62 +10925,42 @@ block_21: temp_t0 = sp48 & 0xFFFFF; sp2C = temp_t0; get_time_record_minutes(temp_t0, &sp38); - // Print minute - func_800939C8(arg1 + 0x27, arg2, &sp38, 0, temp_f20, temp_f20); - // ' - func_80093324(arg1 + 0x32, arg2, &D_800F0C54, 0, temp_f20, temp_f20); + func_800939C8(column + 0x27, row, &sp38, 0, 0.65f, 0.65f); + func_80093324(column + 0x32, row, "'", 0, 0.65f, 0.65f); get_time_record_seconds(sp2C, &sp38); - // Print second - func_800939C8(arg1 + 0x3B, arg2, &sp38, 0, temp_f20, temp_f20); - // " - func_80093324(arg1 + 0x46, arg2, &D_800F0C58, 0, temp_f20, temp_f20); + func_800939C8(column + 0x3B, row, &sp38, 0, 0.65f, 0.65f); + func_80093324(column + 0x46, row, "\"", 0, 0.65f, 0.65f); get_time_record_centiseconds(sp2C, &sp38); - // Print millisecond - func_800939C8(arg1 + 0x50, arg2, &sp38, 0, temp_f20, temp_f20); - if (sp2C < MAX_TIME) { + func_800939C8(column + 0x50, row, &sp38, 0, 0.65f, 0.65f); + if ((u32) sp2C < 0x927C0U) { phi_v0_3 = sp48 >> 0x14; } else { - phi_v0_3 = 8; + phi_v0_3 = 8U; } - draw_text(arg1 + 0x78, arg2, *(&D_800E76A8 + (phi_v0_3 * 4)), 0, temp_f20, temp_f20); + draw_text(column + 0x78, row, D_800E76A8[phi_v0_3], 0, 0.65f, 0.65f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A474C.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 -? draw_text(s32, s32, ? *, ?, f32, f32); // extern -s32 get_string_width(? *, void *); // extern -? set_text_color(?); // extern -extern ? D_800E7780; -extern f32 D_800F1DCC; -extern f32 D_800F1DD0; -extern s32 gDisplayListHead; - -void func_800A4A24(void *arg0) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A4A24(struct_8018D9E0_entry *arg0) { s32 sp38; s32 sp34; - f32 temp_f0; - f32 temp_f0_2; s32 temp_t0; s32 temp_t1; s32 temp_t2; - void *temp_a1; - temp_t1 = arg0->unk10; - temp_a1 = arg0; - temp_t0 = 0x140 - arg0->unkC; + temp_t1 = arg0->row; + temp_t0 = 0x140 - arg0->column; sp38 = temp_t0; - arg0 = temp_a1; + arg0 = arg0; sp34 = temp_t1; - temp_f0 = D_800F1DCC; - temp_t2 = ((get_string_width(&D_800E7780, temp_a1) + 8) * temp_f0) / 2; - gDisplayListHead = draw_box(gDisplayListHead, temp_t0 - temp_t2, (temp_t1 - (24.0f * temp_f0)) + 4, temp_t2 + temp_t0, temp_t1 + 4, 0, 0, 0, 0x64); - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - temp_f0_2 = D_800F1DD0; - draw_text(arg0->unkC - 3, arg0->unk10, &D_800E7780, 0, temp_f0_2, temp_f0_2); + temp_t2 = (s32) ((f32) (get_string_width("NOW-MEET THE COURSE GHOST!!!") + 8) * 0.85f) / 2; + gDisplayListHead = draw_box(gDisplayListHead, temp_t0 - temp_t2, (temp_t1 - (s32) (24.0f * 0.85f)) + 4, temp_t2 + temp_t0, temp_t1 + 4, 0, 0, 0, 0x64); + set_text_color(4); + draw_text(arg0->column - 3, arg0->row, "NOW-MEET THE COURSE GHOST!!!", 0, 0.85f, 0.85f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A4A24.s") @@ -11115,35 +10986,33 @@ void func_800A4B38(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 draw_box(s32, ?, ?, ?, s32, s32, s32, s32, s32); // extern -? draw_text(?, ?, s32, ?, f32, f32); // extern -? func_800921C0(s32, s32, ?); // extern -? func_80093324(s16, s32, ? *, ?, f32, f32); // extern -? func_800939C8(?, ?, ? *, ?, f32, f32); // extern -? get_time_record_minutes(s32, ? *); // extern -? get_time_record_seconds(s32, ? *); // extern -? get_time_record_centiseconds(s32, ? *); // extern -s32 func_800B4E24(?); // extern -s32 func_800B4F2C(); // extern -? set_text_color(?); // extern -extern ? D_800E7574; -extern ? D_800E7728; -extern ? *D_800E775C; -extern s16 D_800E8538; -extern s16 D_800E853A; -extern ? D_800F0C5C; -extern ? D_800F0C60; -extern ? D_800F0C64; -extern ? D_800F0C68; -extern f32 D_800F1DD4; -extern s8 gCupSelection; -extern ? gCupCourseOrder; -extern s32 gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static s8 *D_800E775C[7] = { + "CONTINUE GAME", + "RETRY", + "COURSE CHANGE", + "DRIVER CHANGE", + "QUIT", + "REPLAY", + "SAVE GHOST", +}; /* const */ +static s16 D_800E8538; /* unable to generate initializer; const */ +static s16 D_800E853A; /* unable to generate initializer; const */ +s8 *D_800E7574[8] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", +}; /* const */ +s8 *D_800E7728 = "BEST RECORDS"; /* const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ -void func_800A4BC8(void *arg0) { - ? sp68; - f32 temp_f20; +void func_800A4BC8(struct_8018D9E0_entry *arg0) { + s8 sp68; s32 temp_a0; s32 temp_a0_2; s32 temp_s0; @@ -11151,53 +11020,40 @@ void func_800A4BC8(void *arg0) { s32 temp_s1_2; s32 phi_s0; s32 phi_s1; - ? **phi_s2; + s8 **phi_s2; gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, 0x8C); - set_text_color(TEXT_YELLOW); - draw_text(0xA0, 0x50, *(&D_800E7574 + (*(&gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2))) * 4)), 0, 1.0f, 1.0f); - set_text_color(TEXT_RED); - temp_f20 = D_800F1DD4; - // "Best Records" - draw_text(0x9D, 0x60, D_800E7728.unk0, 0, temp_f20, temp_f20); + set_text_color(3); + draw_text(0xA0, 0x50, D_800E7574[*(gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2)))], 0, 1.0f, 1.0f); + set_text_color(2); + draw_text(0x9D, 0x60, D_800E7728.unk0, 0, 0.8f, 0.8f); temp_a0 = func_800B4E24(0) & 0xFFFFF; temp_s1 = temp_a0; - // Print minutes get_time_record_minutes(temp_a0, &sp68); - func_800939C8(0x7F, 0x6D, &sp68, 0, temp_f20, temp_f20); - // ' - func_80093324(0x8E, 0x6D, &D_800F0C5C, 0, temp_f20, temp_f20); - // Print seconds + func_800939C8(0x7F, 0x6D, &sp68, 0, 0.8f, 0.8f); + func_80093324(0x8E, 0x6D, "'", 0, 0.8f, 0.8f); get_time_record_seconds(temp_s1, &sp68); - func_800939C8(0x98, 0x6D, &sp68, 0, temp_f20, temp_f20); - // " - func_80093324(0xA7, 0x6D, &D_800F0C60, 0, temp_f20, temp_f20); - // Print centiseconds + func_800939C8(0x98, 0x6D, &sp68, 0, 0.8f, 0.8f); + func_80093324(0xA7, 0x6D, "\"", 0, 0.8f, 0.8f); get_time_record_centiseconds(temp_s1, &sp68); - func_800939C8(0xB3, 0x6D, &sp68, 0, temp_f20, temp_f20); - // "Best Lap" - draw_text(0x9D, 0x7C, D_800E7728.unk4, 0, temp_f20, temp_f20); + func_800939C8(0xB3, 0x6D, &sp68, 0, 0.8f, 0.8f); + draw_text(0x9D, 0x7C, D_800E7728.unk4, 0, 0.8f, 0.8f); temp_a0_2 = func_800B4F2C() & 0xFFFFF; temp_s1_2 = temp_a0_2; - // Print minutes get_time_record_minutes(temp_a0_2, &sp68); - func_800939C8(0x7F, 0x89, &sp68, 0, temp_f20, temp_f20); - // ' - func_80093324(0x8E, 0x89, &D_800F0C64, 0, temp_f20, temp_f20); - // Print seconds + func_800939C8(0x7F, 0x89, &sp68, 0, 0.8f, 0.8f); + func_80093324(0x8E, 0x89, "'", 0, 0.8f, 0.8f); get_time_record_seconds(temp_s1_2, &sp68); - func_800939C8(0x98, 0x89, &sp68, 0, temp_f20, temp_f20); - // " - func_80093324(0xA7, 0x89, &D_800F0C68, 0, temp_f20, temp_f20); - // Print centiseconds + func_800939C8(0x98, 0x89, &sp68, 0, 0.8f, 0.8f); + func_80093324(0xA7, 0x89, "\"", 0, 0.8f, 0.8f); get_time_record_centiseconds(temp_s1_2, &sp68); - func_800939C8(0xB3, 0x89, &sp68, 0, temp_f20, temp_f20); + func_800939C8(0xB3, 0x89, &sp68, 0, 0.8f, 0.8f); phi_s0 = 0; phi_s1 = 0; - phi_s2 = &D_800E775C; + phi_s2 = D_800E775C; do { - func_800921C0(arg0->unk4 - 0xB, phi_s0, TEXT_GREEN); - func_80093324(D_800E8538, D_800E853A + phi_s1, *phi_s2, 0, 0.75f, 0.75f); + func_800921C0(arg0->unk4 - 0xB, phi_s0, 1); + func_80093324((s32) D_800E8538, D_800E853A + phi_s1, *phi_s2, 0, 0.75f, 0.75f); temp_s0 = phi_s0 + 1; phi_s0 = temp_s0; phi_s1 += 0xD; @@ -11209,17 +11065,21 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A4BC8.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 -? func_800921C0(s32, s32, ?); // extern -? func_80093324(s32, s32, s32, ?, f32, f32); // extern -extern u16 D_800DC5FC; -extern ? D_800E775C; -extern ? D_800E8540; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern ? D_8015F480; -extern s32 gDisplayListHead; +extern s32 gScreenModeSelection; +static s8 *D_800E775C[7] = { + "CONTINUE GAME", + "RETRY", + "COURSE CHANGE", + "DRIVER CHANGE", + "QUIT", + "REPLAY", + "SAVE GHOST", +}; /* const */ +static ? D_800E8540; /* unable to generate initializer; const */ -void func_800A4EF8(void *arg0) { +void func_800A4EF8(struct_8018D9E0_entry *arg0) { s16 temp_t0; s16 temp_v1; s32 temp_s0; @@ -11235,8 +11095,8 @@ void func_800A4EF8(void *arg0) { temp_v0 = (D_800DC5FC << 6) - 0x40 + &D_8015F480; temp_v1 = temp_v0->unk30; temp_t0 = temp_v0->unk32; - temp_t3 = temp_v0->unk2C / 2; - temp_t4 = temp_v0->unk2E / 2; + temp_t3 = (s32) temp_v0->unk2C / 2; + temp_t4 = (s32) temp_v0->unk2E / 2; gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 0x8C); temp_s3 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8540; phi_a1 = 0; @@ -11250,8 +11110,8 @@ void func_800A4EF8(void *arg0) { } else { phi_s0 = phi_a1 + 1; } - func_800921C0(arg0->unk4 - 0x15, phi_a1, TEXT_YELLOW); - func_80093324(temp_s3->unk0 - 2, temp_s3->unk2 + phi_s2, *(&D_800E775C + (phi_s1 * 4)), 0, 0.75f, 0.75f); + func_800921C0(arg0->unk4 - 0x15, phi_a1, 3); + func_80093324(temp_s3->unk0 - 2, temp_s3->unk2 + phi_s2, D_800E775C[phi_s1], 0, 0.75f, 0.75f); phi_a1 = phi_s0; phi_s2 += 0xD; } while (phi_s0 != 4); @@ -11261,25 +11121,44 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A4EF8.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 -? draw_text(s32, s32, s32, ?, f32, f32); // extern -? func_800921C0(s32, s32, ?); // extern -s32 get_string_width(s32); // extern -? func_80093324(s16, s32, s32, ?, f32, f32); // extern -? set_text_color(?); // extern -extern u16 D_800DC5FC; -extern ? D_800E7500; -extern ? D_800E7574; -extern ? D_800E76CC; -extern s32 D_800E775C; -extern ? D_800E85C0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern ? D_8015F480; -extern s8 gCupSelection; -extern ? gCupCourseOrder; -extern s32 gDisplayListHead; +extern s32 gScreenModeSelection; +static s8 *D_800E775C[7] = { + "CONTINUE GAME", + "RETRY", + "COURSE CHANGE", + "DRIVER CHANGE", + "QUIT", + "REPLAY", + "SAVE GHOST", +}; /* const */ +static ? D_800E85C0; /* unable to generate initializer; const */ +s8 *D_800E7500[9] = { + "mushroom cup", + "flower cup", + "star cup", + "special cup", + "battle", + "mushroom cup", + "flower cup", + "star cup", + "special cup", +}; /* const */ +s8 *D_800E7574[8] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", +}; /* const */ +s8 *D_800E76CC[4] = { "50(", "100(", "150(", "extra" }; /* const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ -void func_800A5084(void *arg0) { +void func_800A5084(struct_8018D9E0_entry *arg0) { s16 temp_t0; s16 temp_v1; s32 temp_s0; @@ -11291,29 +11170,29 @@ void func_800A5084(void *arg0) { void *temp_v0; s32 phi_s0; s32 phi_s1; - s32 *phi_s2; + s8 **phi_s2; temp_v0 = (D_800DC5FC << 6) - 0x40 + &D_8015F480; temp_v1 = temp_v0->unk30; temp_t0 = temp_v0->unk32; - temp_t3 = temp_v0->unk2C / 2; - temp_t4 = temp_v0->unk2E / 2; + temp_t3 = (s32) temp_v0->unk2C / 2; + temp_t4 = (s32) temp_v0->unk2E / 2; gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 0x8C); temp_s3 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E85C0; - temp_s0 = ((get_string_width(*(&D_800E7500 + (gCupSelection * 4))) * 1.0f) + 10.0f) / 2.0f; - temp_s1 = ((get_string_width(*(&D_800E76CC + (gCCSelection * 4))) * 1.0f) + 10.0f) / 2.0f; - set_text_color(TEXT_YELLOW); - draw_text(0xA0 - temp_s1, temp_s3->unk2 - 0x32, *(&D_800E7500 + (gCupSelection * 4)), 0, 1.0f, 1.0f); - set_text_color(TEXT_YELLOW); - draw_text(temp_s0 + 0xA0, temp_s3->unk2 - 0x32, *(&D_800E76CC + (gCCSelection * 4)), 0, 1.0f, 1.0f); - set_text_color(TEXT_YELLOW); - draw_text(0xA0, temp_s3->unk2 - 0x1E, *(&D_800E7574 + (*(&gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2))) * 4)), 0, 1.0f, 1.0f); + temp_s0 = (s32) ((((f32) get_string_width(D_800E7500[gCupSelection]) * 1.0f) + 10.0f) / 2.0f); + temp_s1 = (s32) ((((f32) get_string_width(D_800E76CC[gCCSelection]) * 1.0f) + 10.0f) / 2.0f); + set_text_color(3); + draw_text(0xA0 - temp_s1, temp_s3->unk2 - 0x32, D_800E7500[gCupSelection], 0, 1.0f, 1.0f); + set_text_color(3); + draw_text(temp_s0 + 0xA0, temp_s3->unk2 - 0x32, D_800E76CC[gCCSelection], 0, 1.0f, 1.0f); + set_text_color(3); + draw_text(0xA0, temp_s3->unk2 - 0x1E, D_800E7574[*(gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2)))], 0, 1.0f, 1.0f); phi_s0 = 0; phi_s1 = 0; - phi_s2 = &D_800E775C; + phi_s2 = D_800E775C; do { - func_800921C0(arg0->unk4 - 0x1F, phi_s0, TEXT_YELLOW); - func_80093324(temp_s3->unk0, temp_s3->unk2 + phi_s1, *phi_s2, 0, 0.75f, 0.75f); + func_800921C0(arg0->unk4 - 0x1F, phi_s0, 3); + func_80093324((s32) temp_s3->unk0, temp_s3->unk2 + phi_s1, *phi_s2, 0, 0.75f, 0.75f); temp_s0_2 = phi_s0 + 1; phi_s0 = temp_s0_2; phi_s1 += 0xD; @@ -11325,17 +11204,21 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A5084.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 -? func_800921C0(s32, s32, ?); // extern -? func_80093324(s32, s32, s32, ?, f32, f32); // extern -extern u16 D_800DC5FC; -extern ? D_800E775C; -extern ? D_800E8600; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern ? D_8015F480; -extern s32 gDisplayListHead; +extern s32 gScreenModeSelection; +static s8 *D_800E775C[7] = { + "CONTINUE GAME", + "RETRY", + "COURSE CHANGE", + "DRIVER CHANGE", + "QUIT", + "REPLAY", + "SAVE GHOST", +}; /* const */ +static ? D_800E8600; /* unable to generate initializer; const */ -void func_800A5360(void *arg0) { +void func_800A5360(struct_8018D9E0_entry *arg0) { s16 temp_t0; s16 temp_v1; s32 temp_s0; @@ -11351,8 +11234,8 @@ void func_800A5360(void *arg0) { temp_v0 = (D_800DC5FC << 6) - 0x40 + &D_8015F480; temp_v1 = temp_v0->unk30; temp_t0 = temp_v0->unk32; - temp_t3 = temp_v0->unk2C / 2; - temp_t4 = temp_v0->unk2E / 2; + temp_t3 = (s32) temp_v0->unk2C / 2; + temp_t4 = (s32) temp_v0->unk2E / 2; gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 0x8C); temp_s3 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8600; phi_a1 = 0; @@ -11366,8 +11249,8 @@ void func_800A5360(void *arg0) { } else { phi_s0 = phi_a1 + 1; } - func_800921C0(arg0->unk4 - 0x29, phi_a1, TEXT_YELLOW); - func_80093324(temp_s3->unk0 - 2, temp_s3->unk2 + phi_s2, *(&D_800E775C + (phi_s1 * 4)), 0, 0.75f, 0.75f); + func_800921C0(arg0->unk4 - 0x29, phi_a1, 3); + func_80093324(temp_s3->unk0 - 2, temp_s3->unk2 + phi_s2, D_800E775C[phi_s1], 0, 0.75f, 0.75f); phi_a1 = phi_s0; phi_s2 += 0xD; } while (phi_s0 != 4); @@ -11377,27 +11260,24 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A5360.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800A66A8(void *, s16 *); // extern -void *func_800AAF30(?); // extern -extern u16 D_800DC5FC; -extern ? D_800E8538; -extern ? D_800E8540; -extern ? D_800E85C0; -extern ? D_800E8600; -extern ? D_800F0B50; -extern s16 D_80164AF0; -extern ? D_802B8880; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ +? guOrtho(Mtx *, f32, ?, ?, f32, f32, f32, f32); /* extern */ +extern s32 gScreenModeSelection; +static ? D_800E8538; /* unable to generate initializer; const */ +static ? D_800E8540; /* unable to generate initializer; const */ +static ? D_800E85C0; /* unable to generate initializer; const */ +static ? D_800E8600; /* unable to generate initializer; const */ +static ? D_800F0B50; /* unable to generate initializer; const */ void func_800A54EC(void) { s16 sp52; s16 sp50; - void *sp48; + struct_8018D9E0_entry *sp48; s32 sp40; + Gfx *temp_v1; + Gfx *temp_v1_2; s32 temp_t2; - void *temp_v1; - void *temp_v1_2; ? *phi_v1; if (D_800DC5FC != 0) { @@ -11406,31 +11286,31 @@ void func_800A54EC(void) { temp_v1 = gDisplayListHead; sp48 = func_800AAF30(0xC7); gDisplayListHead = temp_v1 + 8; - temp_v1->unk4 = &D_802B8880 & 0x1FFFFFFF; - temp_v1->unk0 = 0x3800010; + temp_v1->words.w1 = (s32) D_802B8880 & 0x1FFFFFFF; + temp_v1->words.w0 = 0x03800010; sp40 = temp_t2; - guOrtho(gGfxPool + (D_80164AF0 << 6) + 0xFAC0, 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f); + guOrtho(&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0, 0.0f, 0x439F8000, 0x436F0000, 0.0f, -100.0f, 100.0f, 1.0f); temp_v1_2 = gDisplayListHead; gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->unk0 = 0x1030040; - temp_v1_2->unk4 = (gGfxPool + (D_80164AF0 << 6) + 0xFAC0) & 0x1FFFFFFF; - D_80164AF0 = D_80164AF0 + 1; - if (temp_t2 != GRAND_PRIX) { - if (temp_t2 != TIME_TRIALS) { - if (temp_t2 != VERSUS) { - if (temp_t2 != BATTLE) { - phi_v1 = sp4C; - } else { - phi_v1 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8600; - } - } else { - phi_v1 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8540; - } - } else { - phi_v1 = &D_800E8538; - } - } else { + temp_v1_2->words.w0 = 0x01030040; + temp_v1_2->words.w1 = (s32) (&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0) & 0x1FFFFFFF; + D_80164AF0 += 1; + switch (temp_t2) { /* irregular */ + default: + phi_v1 = sp4C; + break; + case 1: + phi_v1 = &D_800E8538; + break; + case 2: + phi_v1 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8540; + break; + case 0: phi_v1 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E85C0; + break; + case 3: + phi_v1 = ((gScreenModeSelection << 5) + (D_800DC5FC * 8)) - 8 + &D_800E8600; + break; } sp50 = phi_v1->unk0 - 8; sp52 = (phi_v1->unk2 + ((sp48->unk4 - *(&D_800F0B50 + temp_t2)) * 0xD)) - 8; @@ -11442,64 +11322,76 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A54EC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -Gfx *draw_box(Gfx *, ?, ?, s32, s32, s32, s32, s32, s32); /* extern */ -? func_800921C0(s32, s32, ?); /* extern */ -s32 get_string_width(? *); /* extern */ -? func_80093324(s32, s32, ? *, ?, f32, f32); /* extern */ -? func_80093358(s16, s32, ? *, ?, f32, f32); /* extern */ -? func_80093754(?, ?, s32, ?, f32, f32); /* extern */ -? func_800A66A8(void *, s16 *); /* extern */ -? convert_number_to_ascii(s32, ? *); /* extern */ -? get_time_record_minutes(s32, ? *); /* extern */ -? get_time_record_seconds(s32, ? *); /* extern */ -? get_time_record_centiseconds(s32, ? *); /* extern */ -s32 func_800B4E24(?); /* extern */ -? set_text_color(?); /* extern */ -? text_draw(?, ?, ? *, ?, f32, f32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E798C_0x1C { + /* 0x00 */ s8 *unk0; /* inferred */ + /* 0x04 */ s8 *unk4; /* inferred */ + /* 0x08 */ char pad8[0xC]; /* maybe part of unk4[4]? */ + /* 0x14 */ s8 *unk14; /* inferred */ + /* 0x18 */ char pad18[4]; +}; /* size = 0x1C */ + +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ extern ? D_8018EE10; static ? D_800E73E0; /* unable to generate initializer; const */ static ? D_800E7410; /* unable to generate initializer; const */ static ? D_800E7420; /* unable to generate initializer; const */ -static ? D_800E7574; /* unable to generate initializer; const */ -static ? D_800E75C4; /* unable to generate initializer; const */ -static ? D_800E7728; /* unable to generate initializer; const */ -static ? *D_800E775C[7] = { - "CONTINUE GAME", - "RETRY", - "COURSE CHANGE", - "DRIVER CHANGE", - "QUIT", - "REPLAY", - "SAVE GHOST", +static s8 *D_800E75C4[0x14] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", }; /* const */ -static ? D_800E798C; /* unable to generate initializer; const */ -static ? *D_800E7A3C[2] = { "SELECT THE FILE ", "YOU WANT TO SAVE" }; /* const */ -static ? *D_800E7A44 = "NO DATA"; /* const */ -static ? *D_800E7A48[3] = { "CREATING ", "MARIO KART 64 ", "GAME DATA" }; /* const */ +static struct _struct_D_800E798C_0x1C D_800E775C; /* unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E798C[6]; /* unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A3C; /* type too large by 0x14; unable to generate initializer; const */ +static s8 *D_800E7A44 = "NO DATA"; /* const */ +static struct _struct_D_800E798C_0x1C D_800E7A48; /* type too large by 0x10; unable to generate initializer; const */ static ? D_800E7A54; /* unable to generate initializer; const */ -static ? *D_800E7A60[3] = { "THE PREVIOUS DATA ", "WILL BE ERASED, ", "IS THIS OK?" }; /* const */ -static ? *D_800E7A6C[2] = { "QUIT", "SAVE" }; /* const */ -static ? *D_800E7A74[3] = { "SAVING GHOST DATA", "", "PLEASE WAIT" }; /* const */ -static ? *D_800E7A80[2] = { "UNABLE TO SAVE ", "THE GHOST" }; /* const */ -static ? D_800E7A88; /* unable to generate initializer; const */ -static s16 D_800E8538; /* type too large by 2; unable to generate initializer; const */ -static s16 D_800E853A; /* type too large by 2; unable to generate initializer; const */ -static ? gCupCourseOrder; /* unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A60; /* type too large by 0x10; unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A6C; /* type too large by 0x14; unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A74; /* type too large by 0x10; unable to generate initializer; const */ +static struct _struct_D_800E798C_0x1C D_800E7A80; /* type too large by 0x14; unable to generate initializer; const */ +static s16 D_800E8538; /* unable to generate initializer; const */ +static s16 D_800E853A; /* unable to generate initializer; const */ +s8 *D_800E7574[8] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", +}; /* const */ +s8 *D_800E7728 = "BEST RECORDS"; /* const */ +s8 *D_800E7A88[4] = { "YOU ARE AWARDED THE", "GOLD CUP", "SILVER CUP", "BRONZE CUP" }; /* const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ -void func_800A5738(void *arg0) { +void func_800A5738(struct_8018D9E0_entry *arg0) { s16 sp9A; s16 sp98; - ? sp84; - ? sp5D; - ? sp5C; + s8 sp84; + s8 sp5D; + s8 sp5C; s32 sp54; - ? **sp50; - ? **temp_v0_2; - ? **temp_v0_4; - ? **temp_v0_5; - ? **temp_v0_6; - ? **temp_v0_7; + struct _struct_D_800E798C_0x1C *sp50; Gfx *temp_v0; s16 *temp_a1; s32 temp_a0; @@ -11513,237 +11405,239 @@ void func_800A5738(void *arg0) { s32 temp_s1_5; s32 temp_v1; s32 temp_v1_2; + s8 **temp_v0_2; + s8 **temp_v0_4; + s8 **temp_v0_5; + s8 **temp_v0_6; + s8 **temp_v0_7; s8 temp_v0_3; s32 phi_s1; s32 phi_s2; - ? **phi_v0; + struct _struct_D_800E798C_0x1C *phi_v0; s32 phi_s1_2; s32 phi_s0; - ? **phi_v0_2; + struct _struct_D_800E798C_0x1C *phi_v0_2; s32 phi_s0_2; - ? **phi_v0_3; + struct _struct_D_800E798C_0x1C *phi_v0_3; s32 phi_s0_3; s32 phi_s1_3; s32 phi_s0_4; ? *phi_s2_2; - ? **phi_v0_4; + struct _struct_D_800E798C_0x1C *phi_v0_4; s32 phi_s0_5; - ? **phi_v0_5; + struct _struct_D_800E798C_0x1C *phi_v0_5; s32 phi_s0_6; - ? **phi_v0_6; + struct _struct_D_800E798C_0x1C *phi_v0_6; s32 phi_s1_4; s32 phi_s0_7; - ? **phi_v0_7; + struct _struct_D_800E798C_0x1C *phi_v0_7; s32 phi_s0_8; - ? **phi_v0_8; + struct _struct_D_800E798C_0x1C *phi_v0_8; s32 phi_s0_9; void *phi_v0_9; temp_v1 = arg0->unk4; if (temp_v1 == 0) { - if ((arg0->unk1C >= 0x1E) && (((gGlobalTimer / 16) % 2) != 0)) { - gDisplayListHead = draw_box(gDisplayListHead, 0xC0, 0x21, (get_string_width(D_800E775C->unk14) * 0.8f) + 0xC6, 0x32, 0, 0, 0, 0x96); - set_text_color(TEXT_GREEN); - func_80093324(0xBF, 0x30, D_800E775C->unk14, 0, 0.8f, 0.8f); - return; + if ((arg0->unk1C >= 0x1E) && (((s32) ((s32) gGlobalTimer / 16) % 2) != 0)) { + gDisplayListHead = draw_box(gDisplayListHead, 0xC0, 0x21, (s32) ((f32) get_string_width(D_800E775C.unk14) * 0.8f) + 0xC6, 0x32, 0, 0, 0, 0x96); + set_text_color(1); + func_80093324(0xBF, 0x30, D_800E775C.unk14, 0, 0.8f, 0.8f); } - /* Duplicate return node #43. Try simplifying control flow for better match */ - return; - } - if (temp_v1 == 1) { - temp_s1 = arg0->unk1C; - phi_s1 = temp_s1; - phi_s2 = (temp_s1 * 0xFF) / 140; } else { - phi_s1 = 0x8C; - phi_s2 = 0xFF; - } - temp_v0 = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, phi_s1); - gDisplayListHead = temp_v0; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w1 = phi_s2 & 0xFF; - temp_v0->words.w0 = 0xFA000000; - set_text_color(TEXT_YELLOW); - func_80093754(0xA0, 0x50, *(&D_800E7574 + (*(&gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2))) * 4)), 0, 1.0f, 1.0f); - temp_v1_2 = arg0->unk4; - switch (temp_v1_2) { /* switch 1 */ - case 1: /* switch 1 */ - case 11: /* switch 1 */ - case 12: /* switch 1 */ - case 13: /* switch 1 */ - case 14: /* switch 1 */ - case 15: /* switch 1 */ - case 16: /* switch 1 */ - set_text_color(TEXT_RED); - func_80093754(0x9D, 0x60, D_800E7728.unk0, 0, 0.8f, 0.8f); - temp_a0 = func_800B4E24(0) & 0xFFFFF; - temp_s1_2 = temp_a0; - get_time_record_minutes(temp_a0, &sp84); - text_draw(0x7F, 0x6D, &sp84, 0, 0.8f, 0.8f); - func_80093358(0x8E, 0x6D, "'", 0, 0.8f, 0.8f); - get_time_record_seconds(temp_s1_2, &sp84); - text_draw(0x98, 0x6D, &sp84, 0, 0.8f, 0.8f); - func_80093358(0xA7, 0x6D, "\"", 0, 0.8f, 0.8f); - get_time_record_centiseconds(temp_s1_2, &sp84); - text_draw(0xB3, 0x6D, &sp84, 0, 0.8f, 0.8f); - func_80093754(0x9D, 0x7C, D_800E7728.unk4, 0, 0.8f, 0.8f); - temp_a0_2 = func_800B4F2C() & 0xFFFFF; - temp_s1_3 = temp_a0_2; - get_time_record_minutes(temp_a0_2, &sp84); - text_draw(0x7F, 0x89, &sp84, 0, 0.8f, 0.8f); - func_80093358(0x8E, 0x89, "'", 0, 0.8f, 0.8f); - get_time_record_seconds(temp_s1_3, &sp84); - text_draw(0x98, 0x89, &sp84, 0, 0.8f, 0.8f); - func_80093358(0xA7, 0x89, "\"", 0, 0.8f, 0.8f); - get_time_record_centiseconds(temp_s1_3, &sp84); - text_draw(0xB3, 0x89, &sp84, 0, 0.8f, 0.8f); - phi_v0 = D_800E775C; - phi_s1_2 = 0; - phi_s0 = 0; - do { - sp50 = phi_v0; - func_800921C0(arg0->unk4 - 0xB, phi_s1_2, TEXT_GREEN); - func_80093358(D_800E8538, D_800E853A + phi_s0, phi_v0->unk4, 0, 0.75f, 0.75f); - temp_s1_4 = phi_s1_2 + 1; - phi_v0 += 4; - phi_s1_2 = temp_s1_4; - phi_s0 += 0xD; - } while (temp_s1_4 != 6); -block_36: - break; - case 21: /* switch 1 */ - case 22: /* switch 1 */ - case 23: /* switch 1 */ - case 24: /* switch 1 */ - case 25: /* switch 1 */ - case 26: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_2 = ((arg0->unk4 - 0x15) * 0x1C) + &D_800E798C; - phi_s0_2 = 0x6E; - do { - sp50 = phi_v0_2; - func_80093324(0x4D, phi_s0_2, *phi_v0_2, 0, 0.8f, 0.8f); - temp_s0 = phi_s0_2 + 0xD; - phi_v0_2 += 4; - phi_s0_2 = temp_s0; - } while (temp_s0 != 0xC9); - goto block_36; - case 30: /* switch 1 */ - case 31: /* switch 1 */ - set_text_color(TEXT_GREEN); - phi_v0_3 = D_800E7A3C; - phi_s0_3 = 0; - do { - sp50 = phi_v0_3; - func_80093324(0x5A, arg0->unk10 + phi_s0_3 + 0x6E, *phi_v0_3, 0, 0.8f, 0.8f); - temp_v0_2 = phi_v0_3 + 4; - phi_v0_3 = temp_v0_2; - phi_s0_3 += 0xD; - } while (temp_v0_2 < &D_800E7A44); - phi_s1_3 = 0; - phi_s0_4 = 0x96; - phi_s2_2 = &D_8018EE10; - do { - func_800921C0(arg0->unk4 - 0x1E, phi_s1_3, TEXT_GREEN); - temp_a0_3 = phi_s1_3 + 1; - sp54 = temp_a0_3; - convert_number_to_ascii(temp_a0_3, &sp5C); - func_80093324(0x5A - arg0->unkC, phi_s0_4, &sp5D, 0, 0.75f, 0.75f); - if (phi_s2_2->unk4 == 0) { - func_80093324(0x69 - arg0->unkC, phi_s0_4, D_800E7A44, 0, 0.75f, 0.75f); - } else { - temp_v0_3 = phi_s2_2->unk5; - func_80093324(0x69 - arg0->unkC, phi_s0_4, *(&D_800E75C4 + (*(&gCupCourseOrder + (((temp_v0_3 / 4) * 8) + ((temp_v0_3 % 4) * 2))) * 4)), 0, 0.75f, 0.75f); - } - phi_s1_3 = sp54; - phi_s0_4 += 0x14; - phi_s2_2 += 0x80; - } while (sp54 != 2); - goto block_36; - case 32: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_4 = D_800E7A48; - phi_s0_5 = 0x6E; - do { - sp50 = phi_v0_4; - func_80093324(0x64, phi_s0_5, *phi_v0_4, 0, 0.8f, 0.8f); - temp_v0_4 = phi_v0_4 + 4; - phi_v0_4 = temp_v0_4; - phi_s0_5 += 0xD; - } while (temp_v0_4 != &D_800E7A54); - goto block_36; - case 35: /* switch 1 */ - case 36: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_5 = D_800E7A60; - phi_s0_6 = 0; - do { - sp50 = phi_v0_5; - func_80093324(0x55, arg0->unk10 + phi_s0_6 + 0x6E, *phi_v0_5, 0, 0.8f, 0.8f); - temp_v0_5 = phi_v0_5 + 4; - phi_v0_5 = temp_v0_5; - phi_s0_6 += 0xD; - } while (temp_v0_5 < D_800E7A6C); - phi_v0_6 = D_800E7A6C; - phi_s1_4 = 0; - phi_s0_7 = 0x9B; - do { - sp50 = phi_v0_6; - func_800921C0(arg0->unk4 - 0x23, phi_s1_4, TEXT_GREEN); - func_80093324(0x7D - arg0->unkC, phi_s0_7, *phi_v0_6, 0, 0.8f, 0.8f); - temp_s1_5 = phi_s1_4 + 1; - phi_v0_6 += 4; - phi_s1_4 = temp_s1_5; - phi_s0_7 += 0xF; - } while (temp_s1_5 != 2); - goto block_36; - case 40: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_7 = D_800E7A74; - phi_s0_8 = 0x6E; - do { - sp50 = phi_v0_7; - func_80093324(0x55, phi_s0_8, *phi_v0_7, 0, 0.8f, 0.8f); - temp_v0_6 = phi_v0_7 + 4; - phi_v0_7 = temp_v0_6; - phi_s0_8 += 0xD; - } while (temp_v0_6 != D_800E7A80); - goto block_36; - case 41: /* switch 1 */ - set_text_color(TEXT_YELLOW); - phi_v0_8 = D_800E7A80; - phi_s0_9 = 0x6E; - do { - sp50 = phi_v0_8; - func_80093324(0x5D, phi_s0_9, *phi_v0_8, 0, 0.8f, 0.8f); - temp_v0_7 = phi_v0_8 + 4; - phi_v0_8 = temp_v0_7; - phi_s0_9 += 0xD; - } while (temp_v0_7 != &D_800E7A88); - goto block_36; - } - switch (arg0->unk4) { /* switch 2 */ - case 11: /* switch 2 */ - case 12: /* switch 2 */ - case 13: /* switch 2 */ - case 14: /* switch 2 */ - case 15: /* switch 2 */ - case 16: /* switch 2 */ - phi_v0_9 = (arg0->unk4 * 8) - 0x58 + &D_800E73E0; + if (temp_v1 == 1) { + temp_s1 = arg0->unk1C; + phi_s1 = temp_s1; + phi_s2 = (s32) (temp_s1 * 0xFF) / 140; + } else { + phi_s1 = 0x8C; + phi_s2 = 0xFF; + } + temp_v0 = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, phi_s1); + gDisplayListHead = temp_v0; + gDisplayListHead = temp_v0 + 8; + temp_v0->words.w1 = phi_s2 & 0xFF; + temp_v0->words.w0 = 0xFA000000; + set_text_color(3); + func_80093754(0xA0, 0x50, D_800E7574[*(gCupCourseOrder + ((gCupSelection * 8) + (gCupCourseSelection * 2)))], 0, 1.0f, 1.0f); + temp_v1_2 = arg0->unk4; + switch (temp_v1_2) { /* switch 1 */ + case 1: /* switch 1 */ + case 11: /* switch 1 */ + case 12: /* switch 1 */ + case 13: /* switch 1 */ + case 14: /* switch 1 */ + case 15: /* switch 1 */ + case 16: /* switch 1 */ + set_text_color(2); + func_80093754(0x9D, 0x60, D_800E7728.unk0, 0, 0.8f, 0.8f); + temp_a0 = func_800B4E24(0) & 0xFFFFF; + temp_s1_2 = temp_a0; + get_time_record_minutes(temp_a0, &sp84); + text_draw(0x7F, 0x6D, &sp84, 0, 0.8f, 0.8f); + func_80093358(0x8E, 0x6D, "'", 0, 0.8f, 0.8f); + get_time_record_seconds(temp_s1_2, &sp84); + text_draw(0x98, 0x6D, &sp84, 0, 0.8f, 0.8f); + func_80093358(0xA7, 0x6D, "\"", 0, 0.8f, 0.8f); + get_time_record_centiseconds(temp_s1_2, &sp84); + text_draw(0xB3, 0x6D, &sp84, 0, 0.8f, 0.8f); + func_80093754(0x9D, 0x7C, D_800E7728.unk4, 0, 0.8f, 0.8f); + temp_a0_2 = func_800B4F2C() & 0xFFFFF; + temp_s1_3 = temp_a0_2; + get_time_record_minutes(temp_a0_2, &sp84); + text_draw(0x7F, 0x89, &sp84, 0, 0.8f, 0.8f); + func_80093358(0x8E, 0x89, "'", 0, 0.8f, 0.8f); + get_time_record_seconds(temp_s1_3, &sp84); + text_draw(0x98, 0x89, &sp84, 0, 0.8f, 0.8f); + func_80093358(0xA7, 0x89, "\"", 0, 0.8f, 0.8f); + get_time_record_centiseconds(temp_s1_3, &sp84); + text_draw(0xB3, 0x89, &sp84, 0, 0.8f, 0.8f); + phi_v0 = &D_800E775C; + phi_s1_2 = 0; + phi_s0 = 0; + do { + sp50 = phi_v0; + func_800921C0(arg0->unk4 - 0xB, phi_s1_2, 1); + func_80093358((s32) D_800E8538, D_800E853A + phi_s0, phi_v0->unk4, 0, 0.75f, 0.75f); + temp_s1_4 = phi_s1_2 + 1; + phi_v0 = (struct _struct_D_800E798C_0x1C *) &phi_v0->unk4; + phi_s1_2 = temp_s1_4; + phi_s0 += 0xD; + } while (temp_s1_4 != 6); + break; + case 21: /* switch 1 */ + case 22: /* switch 1 */ + case 23: /* switch 1 */ + case 24: /* switch 1 */ + case 25: /* switch 1 */ + case 26: /* switch 1 */ + set_text_color(3); + phi_v0_2 = &D_800E798C[arg0->unk4 - 0x15]; + phi_s0_2 = 0x6E; + do { + sp50 = phi_v0_2; + func_80093324(0x4D, phi_s0_2, phi_v0_2->unk0, 0, 0.8f, 0.8f); + temp_s0 = phi_s0_2 + 0xD; + phi_v0_2 = (struct _struct_D_800E798C_0x1C *) &phi_v0_2->unk4; + phi_s0_2 = temp_s0; + } while (temp_s0 != 0xC9); + break; + case 30: /* switch 1 */ + case 31: /* switch 1 */ + set_text_color(1); + phi_v0_3 = &D_800E7A3C; + phi_s0_3 = 0; + do { + sp50 = phi_v0_3; + func_80093324(0x5A, arg0->row + phi_s0_3 + 0x6E, phi_v0_3->unk0, 0, 0.8f, 0.8f); + temp_v0_2 = &phi_v0_3->unk4; + phi_v0_3 = (struct _struct_D_800E798C_0x1C *) temp_v0_2; + phi_s0_3 += 0xD; + } while ((u32) temp_v0_2 < (u32) &D_800E7A44); + phi_s1_3 = 0; + phi_s0_4 = 0x96; + phi_s2_2 = &D_8018EE10; + do { + func_800921C0(arg0->unk4 - 0x1E, phi_s1_3, 1); + temp_a0_3 = phi_s1_3 + 1; + sp54 = temp_a0_3; + convert_number_to_ascii(temp_a0_3, &sp5C); + func_80093324(0x5A - arg0->column, phi_s0_4, &sp5D, 0, 0.75f, 0.75f); + if (phi_s2_2->unk4 == 0) { + func_80093324(0x69 - arg0->column, phi_s0_4, D_800E7A44, 0, 0.75f, 0.75f); + } else { + temp_v0_3 = phi_s2_2->unk5; + func_80093324(0x69 - arg0->column, phi_s0_4, D_800E75C4[*(gCupCourseOrder + ((((s32) temp_v0_3 / 4) * 8) + (((s32) temp_v0_3 % 4) * 2)))], 0, 0.75f, 0.75f); + } + phi_s1_3 = sp54; + phi_s0_4 += 0x14; + phi_s2_2 += 0x80; + } while (sp54 != 2); + break; + case 32: /* switch 1 */ + set_text_color(3); + phi_v0_4 = &D_800E7A48; + phi_s0_5 = 0x6E; + do { + sp50 = phi_v0_4; + func_80093324(0x64, phi_s0_5, phi_v0_4->unk0, 0, 0.8f, 0.8f); + temp_v0_4 = &phi_v0_4->unk4; + phi_v0_4 = (struct _struct_D_800E798C_0x1C *) temp_v0_4; + phi_s0_5 += 0xD; + } while (temp_v0_4 != &D_800E7A54); + break; + case 35: /* switch 1 */ + case 36: /* switch 1 */ + set_text_color(3); + phi_v0_5 = &D_800E7A60; + phi_s0_6 = 0; + do { + sp50 = phi_v0_5; + func_80093324(0x55, arg0->row + phi_s0_6 + 0x6E, phi_v0_5->unk0, 0, 0.8f, 0.8f); + temp_v0_5 = &phi_v0_5->unk4; + phi_v0_5 = (struct _struct_D_800E798C_0x1C *) temp_v0_5; + phi_s0_6 += 0xD; + } while ((u32) temp_v0_5 < (u32) &D_800E7A6C); + phi_v0_6 = &D_800E7A6C; + phi_s1_4 = 0; + phi_s0_7 = 0x9B; + do { + sp50 = phi_v0_6; + func_800921C0(arg0->unk4 - 0x23, phi_s1_4, 1); + func_80093324(0x7D - arg0->column, phi_s0_7, phi_v0_6->unk0, 0, 0.8f, 0.8f); + temp_s1_5 = phi_s1_4 + 1; + phi_v0_6 = (struct _struct_D_800E798C_0x1C *) &phi_v0_6->unk4; + phi_s1_4 = temp_s1_5; + phi_s0_7 += 0xF; + } while (temp_s1_5 != 2); + break; + case 40: /* switch 1 */ + set_text_color(3); + phi_v0_7 = &D_800E7A74; + phi_s0_8 = 0x6E; + do { + sp50 = phi_v0_7; + func_80093324(0x55, phi_s0_8, phi_v0_7->unk0, 0, 0.8f, 0.8f); + temp_v0_6 = &phi_v0_7->unk4; + phi_v0_7 = (struct _struct_D_800E798C_0x1C *) temp_v0_6; + phi_s0_8 += 0xD; + } while (temp_v0_6 != &D_800E7A80); + break; + case 41: /* switch 1 */ + set_text_color(3); + phi_v0_8 = &D_800E7A80; + phi_s0_9 = 0x6E; + do { + sp50 = phi_v0_8; + func_80093324(0x5D, phi_s0_9, phi_v0_8->unk0, 0, 0.8f, 0.8f); + temp_v0_7 = &phi_v0_8->unk4; + phi_v0_8 = (struct _struct_D_800E798C_0x1C *) temp_v0_7; + phi_s0_9 += 0xD; + } while (temp_v0_7 != D_800E7A88); + break; + } + switch (arg0->unk4) { /* switch 2 */ + case 11: /* switch 2 */ + case 12: /* switch 2 */ + case 13: /* switch 2 */ + case 14: /* switch 2 */ + case 15: /* switch 2 */ + case 16: /* switch 2 */ + phi_v0_9 = (arg0->unk4 * 8) - 0x58 + &D_800E73E0; block_42: - temp_a1 = &sp98; - sp98 = phi_v0_9->unk0; - sp9A = phi_v0_9->unk2; - func_800A66A8(arg0, temp_a1); - break; - case 30: /* switch 2 */ - case 31: /* switch 2 */ - phi_v0_9 = (arg0->unk4 * 8) - 0xF0 + &D_800E7410; - goto block_42; - case 35: /* switch 2 */ - case 36: /* switch 2 */ - phi_v0_9 = (arg0->unk4 * 8) - 0x118 + &D_800E7420; - goto block_42; + temp_a1 = &sp98; + sp98 = phi_v0_9->unk0; + sp9A = phi_v0_9->unk2; + func_800A66A8(arg0, temp_a1); + break; + case 30: /* switch 2 */ + case 31: /* switch 2 */ + phi_v0_9 = (arg0->unk4 * 8) - 0xF0 + &D_800E7410; + goto block_42; + case 35: /* switch 2 */ + case 36: /* switch 2 */ + phi_v0_9 = (arg0->unk4 * 8) - 0x118 + &D_800E7420; + goto block_42; + } } } #else @@ -11765,25 +11659,18 @@ void func_800A6034(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, ?, ?, ?, s32, s32, s32, s32, s32); // extern -? func_800921C0(s32, s32, ?); // extern -? func_80093324(?, s32, s32, ?, f32, f32); // extern -? func_80093358(?, s32, s32, ?, f32, f32); // extern -void *func_80098FC8(void *, ?, s32, ?, s32); // extern -? func_800A66A8(void *, s16 *); // extern -? set_text_color(?); // extern -extern ? D_800E775C; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A66A8(struct_8018D9E0_entry *, s16 *); /* extern */ +static ? D_800E775C; /* unable to generate initializer; const */ -void func_800A6154(void *arg0) { +void func_800A6154(struct_8018D9E0_entry *arg0) { s16 sp6E; s16 sp6C; + Gfx *temp_v0; + Gfx *temp_v0_3; s32 temp_s0; s32 temp_s1; s32 temp_v0_2; - void *temp_v0; - void *temp_v0_3; s32 phi_s0; ? *phi_s2; s32 phi_s1; @@ -11792,11 +11679,11 @@ void func_800A6154(void *arg0) { if (arg0->unk4 == 0) { gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, arg0->unk1C); - set_text_color(TEXT_YELLOW); + set_text_color(3); temp_v0 = gDisplayListHead; gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0xFA000000; - temp_v0->unk4 = ((arg0->unk1C * 0xFF) / 0x64) & 0xFF; + temp_v0->words.w0 = 0xFA000000; + temp_v0->words.w1 = ((s32) (arg0->unk1C * 0xFF) / 100) & 0xFF; phi_s0 = 0x96; phi_s2 = &D_800E775C; do { @@ -11811,7 +11698,7 @@ void func_800A6154(void *arg0) { phi_s0_2 = 0x96; phi_s2_2 = &D_800E775C; do { - func_800921C0(arg0->unk4 - 0xB, phi_s1, TEXT_YELLOW); + func_800921C0(arg0->unk4 - 0xB, phi_s1, 3); func_80093324(0x8C, phi_s0_2, phi_s2_2->unk4, 0, 1.0f, 1.0f); temp_s1 = phi_s1 + 1; phi_s1 = temp_s1; @@ -11836,30 +11723,22 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A6154.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, ?, ?, ?, s32, s32, s32, s32, s32); // extern -? draw_text(?, s32, s32, ?, f32, f32); // extern -? func_800921C0(s32, s32, ?); // extern -? func_80093324(?, s32, s32, ?, f32, f32); // extern -? func_80093754(?, s32, s32, ?, f32, f32); // extern -? func_800A66A8(void *, void *); // extern -? func_800A69C8(void *, s32); // extern -? func_800A6BEC(void *, s32); // extern -? func_800A6CC0(void *, s32); // extern -? set_text_color(?); // extern -extern ? D_800E7360; -extern ? D_800E775C; -extern ? D_800E7778; -extern f32 D_800F1F10; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A66A8(struct_8018D9E0_entry *, void *); /* extern */ +? func_800A69C8(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A6BEC(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A6CC0(struct_8018D9E0_entry *, s32); /* extern */ +extern s8 D_8018EDF3; +static ? D_800E7360; /* unable to generate initializer; const */ +static ? D_800E775C; /* unable to generate initializer; const */ +static s8 *D_800E7778[2] = { "VS MATCH RANKING", "BATTLE RANKING" }; /* const */ -void func_800A638C(void *arg0) { - f32 temp_f20; +void func_800A638C(struct_8018D9E0_entry *arg0) { + Gfx *temp_v0; + Gfx *temp_v0_2; s32 temp_a0; s32 temp_s0; s8 temp_a0_2; - void *temp_v0; - void *temp_v0_2; s32 phi_a1; s32 phi_s0; s32 phi_s1; @@ -11867,35 +11746,38 @@ void func_800A638C(void *arg0) { if (arg0->unk4 == 0) { gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, arg0->unk1C); - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); + set_text_color(5); temp_v0 = gDisplayListHead; gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0xFA000000; - temp_v0->unk4 = ((arg0->unk1C * 0xFF) / 0x64) & 0xFF; - func_80093754(0xA0, arg0->unk10 + 0x1E, *(&D_800E7778 + ((gModeSelection / 3) * 4)), 0, 1.0f, 1.0f); + temp_v0->words.w0 = 0xFA000000; + temp_v0->words.w1 = ((s32) (arg0->unk1C * 0xFF) / 100) & 0xFF; + func_80093754(0xA0, arg0->row + 0x1E, D_800E7778[(s32) gModeSelection / 3], 0, 1.0f, 1.0f); } else { gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, 0x64); - set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); - draw_text(0xA0, arg0->unk10 + 0x1E, *(&D_800E7778 + ((gModeSelection / 3) * 4)), 0, 1.0f, 1.0f); + set_text_color(5); + draw_text(0xA0, arg0->row + 0x1E, D_800E7778[(s32) gModeSelection / 3], 0, 1.0f, 1.0f); } temp_a0 = arg0->unk4; - if ((temp_a0 != 0) && (temp_a0 != 1)) { - if (temp_a0 != 2) { - phi_a1 = 0xFF; - } else { - phi_a1 = arg0->unk1C; - } - } else { + switch (temp_a0) { /* irregular */ + default: + phi_a1 = 0xFF; + break; + case 0: + case 1: phi_a1 = 0; + break; + case 2: + phi_a1 = arg0->unk1C; + break; } temp_v0_2 = gDisplayListHead; gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk4 = phi_a1 & 0xFF; - temp_v0_2->unk0 = 0xFA000000; + temp_v0_2->words.w1 = phi_a1 & 0xFF; + temp_v0_2->words.w0 = 0xFA000000; temp_a0_2 = D_8018EDF3; - if (temp_a0_2 != TWO_PLAYERS_SELECTED) { - if (temp_a0_2 != THREE_PLAYERS_SELECTED) { - if (temp_a0_2 != FOUR_PLAYERS_SELECTED) { + if (temp_a0_2 != 2) { + if (temp_a0_2 != 3) { + if (temp_a0_2 != 4) { } else { func_800A6CC0(arg0, phi_a1); @@ -11909,11 +11791,10 @@ void func_800A638C(void *arg0) { phi_s0 = 0; phi_s1 = 0xAE; if (arg0->unk4 >= 0xA) { - temp_f20 = D_800F1F10; phi_s2 = &D_800E775C; do { - func_800921C0(arg0->unk4 - 0xA, phi_s0, TEXT_GREEN); - func_80093324(0x69, phi_s1, phi_s2->unk4, 0, temp_f20, temp_f20); + func_800921C0(arg0->unk4 - 0xA, phi_s0, 1); + func_80093324(0x69, phi_s1, phi_s2->unk4, 0, 0.8f, 0.8f); temp_s0 = phi_s0 + 1; phi_s0 = temp_s0; phi_s1 += 0xF; @@ -11927,55 +11808,52 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A638C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? guMtxCatL(Mtx *, Mtx *, Mtx *); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? guMtxCatL(Mtx *, Mtx *, Mtx *); /* extern */ +? guRotate(Mtx *, f32, f32, f32, f32); /* extern */ +? guScale(f32, f32, Mtx *, f32, f32, f32); /* extern */ +? guTranslate(Mtx *, f32, f32, f32); /* extern */ extern ? D_0D003090; -extern f64 D_800F1F18; -extern f32 D_800F1F20; -extern s16 D_80164AF0; extern f32 D_8018ED98; extern f32 D_8018ED9C; extern f32 D_8018EDA0; extern f32 D_8018EDA4; extern f32 D_8018EDA8; extern f32 D_8018EDAC; -extern void *gDisplayListHead; -void func_800A66A8(void *arg0, void *arg1) { +void func_800A66A8(struct_8018D9E0_entry *arg0, f32 *arg1) { + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; + Gfx *temp_v0_4; + Gfx *temp_v0_5; + Gfx *temp_v0_6; Mtx *temp_s0; Mtx *temp_s1; f32 temp_f0_2; - f32 temp_f0_3; f32 temp_f12; f32 temp_f14; f32 temp_f2; f64 temp_f0; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - void *temp_v0_4; - void *temp_v0_5; - void *temp_v0_6; - temp_s1 = gGfxPool + (D_80164AF0 << 6) + 0xFAC0; - temp_f0 = arg0->unk24; + temp_s1 = &gGfxPool->mtxPool[D_80164AF0] + 0xFAC0; + temp_f0 = (f64) arg0->unk24; if (temp_f0 > 1.5) { - arg0->unk24 = temp_f0 * D_800F1F18; + arg0->unk24 = (f32) (temp_f0 * 0.95); } else { arg0->unk24 = 1.5f; } temp_f0_2 = arg0->unk24; - temp_f2 = temp_f0_2 * 3.0f * arg0->unk8; + temp_f2 = temp_f0_2 * 3.0f * (f32) arg0->unk8; temp_f12 = temp_f0_2 * 4.0f; temp_f14 = temp_f0_2 * 2.0f; - D_8018EDA0 = D_8018EDA0 + temp_f14; + D_8018EDA0 += temp_f14; D_8018EDA4 = temp_f2; D_8018EDA8 = temp_f12; D_8018EDAC = temp_f14; D_8018ED98 = D_8018ED98 + temp_f2; D_8018ED9C = D_8018ED9C + temp_f12; - temp_f0_3 = D_800F1F20; - guScale(temp_s1, temp_f0_3, temp_f0_3, temp_f0_3); + guScale(temp_f12, temp_f14, temp_s1, 1.2f, 1.2f, 1.2f); temp_s0 = temp_s1 + 0x40; guRotate(temp_s0, D_8018ED9C, 0.0f, 1.0f, 0.0f); guMtxCatL(temp_s1, temp_s0, temp_s1); @@ -11983,33 +11861,33 @@ void func_800A66A8(void *arg0, void *arg1) { guMtxCatL(temp_s1, temp_s0, temp_s1); guRotate(temp_s0, D_8018ED98, 1.0f, 0.0f, 0.0f); guMtxCatL(temp_s1, temp_s0, temp_s1); - guTranslate(temp_s0, arg1->unk0, arg1->unk2, 0.0f); + guTranslate(temp_s0, (f32) arg1->unk0, (f32) arg1->unk2, 0.0f); guMtxCatL(temp_s1, temp_s0, temp_s1); temp_v0 = gDisplayListHead; gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0x1020040; - temp_v0->unk4 = (gGfxPool + (D_80164AF0 << 6) + 0xFAC0) & 0x1FFFFFFF; + temp_v0->words.w0 = 0x01020040; + temp_v0->words.w1 = (s32) (&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0) & 0x1FFFFFFF; temp_v0_2 = gDisplayListHead; - D_80164AF0 = D_80164AF0 + 1; + D_80164AF0 += 1; gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xB6000000; - temp_v0_2->unk4 = 0x20000; + temp_v0_2->words.w0 = 0xB6000000; + temp_v0_2->words.w1 = 0x20000; temp_v0_3 = gDisplayListHead; gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0xFF33FFFF; - temp_v0_3->unk0 = 0xFC121824; + temp_v0_3->words.w1 = 0xFF33FFFF; + temp_v0_3->words.w0 = 0xFC121824; temp_v0_4 = gDisplayListHead; gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->unk4 = 0; - temp_v0_4->unk0 = 0xC0000000; + temp_v0_4->words.w1 = 0; + temp_v0_4->words.w0 = 0xC0000000; temp_v0_5 = gDisplayListHead; gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->unk4 = 0x504340; - temp_v0_5->unk0 = 0xB900031D; + temp_v0_5->words.w1 = 0x504340; + temp_v0_5->words.w0 = 0xB900031D; temp_v0_6 = gDisplayListHead; gDisplayListHead = temp_v0_6 + 8; - temp_v0_6->unk0 = 0x6000000; - temp_v0_6->unk4 = &D_0D003090; + temp_v0_6->words.w0 = 0x06000000; + temp_v0_6->words.w1 = (u32) &D_0D003090; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A66A8.s") @@ -12269,50 +12147,42 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A6E94.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, ?, ?, s32, s32, s32, s32, s32, s32); // extern -s32 get_string_width(s32); // extern -? func_80093358(?, s32, s32, ?, f32, f32); // extern -? set_text_color(?, s32); // extern -extern s32 D_800E7A34; -extern f32 D_800F1F2C; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static s8 *D_800E7A34[2] = { "RACE DATA CANNOT ", "BE SAVED FOR GHOST" }; /* const */ -void func_800A70E8(void *arg0) { - f32 temp_f20; +void func_800A70E8(struct_8018D9E0_entry *arg0) { + Gfx *temp_v0; s32 temp_a1; s32 temp_f6; s32 temp_s0; s32 temp_s0_2; - void *temp_v0; s32 phi_s0; s32 phi_a1; s32 phi_s0_2; - s32 *phi_s1; + s8 **phi_s1; if (arg0->unk4 == 1) { - temp_f20 = D_800F1F2C; - temp_s0 = get_string_width(D_800E7A34.unk0) * temp_f20; - temp_f6 = get_string_width(D_800E7A34.unk4) * temp_f20; + temp_s0 = (s32) ((f32) get_string_width(D_800E7A34->unk0) * 0.45f); + temp_f6 = (s32) ((f32) get_string_width(D_800E7A34->unk4) * 0.45f); phi_s0 = temp_s0; if (temp_s0 < temp_f6) { phi_s0 = temp_f6; } gDisplayListHead = draw_box(gDisplayListHead, 0xC0, 0x22, phi_s0 + 0xC6, 0x39, 0, 0, 0, 0x96); - temp_a1 = 0x180 - ((arg0->unk1C % 0x20) * 8); + temp_a1 = 0x180 - (((s32) arg0->unk1C % 32) * 8); phi_a1 = temp_a1; if (temp_a1 >= 0x100) { phi_a1 = 0xFF; } temp_v0 = gDisplayListHead; gDisplayListHead = temp_v0 + 8; - temp_v0->unk4 = phi_a1 & 0xFF; - temp_v0->unk0 = 0xFA000000; - set_text_color(TEXT_RED); + temp_v0->words.w1 = phi_a1 & 0xFF; + temp_v0->words.w0 = 0xFA000000; + set_text_color(2); phi_s0_2 = 0x2C; - phi_s1 = &D_800E7A34; + phi_s1 = D_800E7A34; do { - func_80093358(0xC0, phi_s0_2, *phi_s1, 0, temp_f20, temp_f20); + func_80093358(0xC0, phi_s0_2, *phi_s1, 0, 0.45f, 0.45f); temp_s0_2 = phi_s0_2 + 0xA; phi_s0_2 = temp_s0_2; phi_s1 += 4; @@ -13045,16 +12915,16 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8250.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800959A0(void *, s32, s32, s32, s32); // extern -void *func_80098C18(void *, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_80098FC8(void *, s32, s32, s32, s32); // extern -extern ? D_800E86AC; -extern ? D_800F2B60; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +extern s8 D_8018EDF3; extern s8 gMainMenuSelectionDepth; -extern void *gDisplayListHead; +static ? D_800E86AC; /* unable to generate initializer; const */ +static ? D_800F2B60; /* unable to generate initializer; const */ -void func_800A8270(s32 arg0, void *arg1) { +void func_800A8270(s32 arg0, struct_8018D9E0_entry *arg1) { + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; s32 temp_a3; s32 temp_s0; s32 temp_s2; @@ -13069,49 +12939,46 @@ void func_800A8270(s32 arg0, void *arg1) { s8 *temp_s7; s8 temp_v0_4; s8 temp_v0_5; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - void *phi_v0; + Gfx *phi_v0; s32 phi_s2; s32 phi_s3; s32 phi_s0; s32 phi_s4; - void *phi_v0_2; + Gfx *phi_v0_2; temp_a3 = arg1->unk1C; if (temp_a3 < 0x20) { temp_v0 = gDisplayListHead; - temp_t1 = arg1->unkC; - temp_s0 = arg1->unk10; + temp_t1 = arg1->column; + temp_s0 = arg1->row; gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0xE7000000; - temp_v0->unk4 = 0; + temp_v0->words.w0 = 0xE7000000; + temp_v0->words.w1 = 0; temp_v0_2 = gDisplayListHead; gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xB900031D; - temp_v0_2->unk4 = 0xF0A4000; + temp_v0_2->words.w0 = 0xB900031D; + temp_v0_2->words.w1 = 0x0F0A4000; temp_v0_3 = gDisplayListHead; - temp_t6 = (temp_a3 << 6) / 0x40; + temp_t6 = (s32) (temp_a3 << 6) / 64; gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0xFFFCF279; - temp_v0_3->unk0 = 0xFCFFFFFF; + temp_v0_3->words.w1 = 0xFFFCF279; + temp_v0_3->words.w0 = 0xFCFFFFFF; temp_s3 = temp_t1 + temp_t6; phi_s3 = temp_s3; if ((arg0 + 1) == D_8018EDF3) { temp_v0_4 = gMainMenuSelectionDepth; temp_s3_2 = temp_t1 + temp_t6; phi_s3 = temp_s3_2; - if ((temp_v0_4 == OPTIONS_SELECTION) || (temp_v0_4 == DATA_SELECTION) || (temp_v0_4 == PLAYER_NUM_SELECTION)) { - temp_s4_2 = (temp_t1 - temp_t6) + 0x3F; - phi_v0 = func_800959A0(gDisplayListHead, temp_s3_2, temp_s0, temp_s4_2, temp_s0 + 0x35); - phi_s4 = temp_s4_2; - } else { + if ((temp_v0_4 == 1) || (temp_v0_4 == 2) || (temp_v0_4 == 3)) { temp_s4 = (temp_t1 - temp_t6) + 0x3F; - temp_s3_3 = temp_t1 + temp_t6; - phi_v0 = func_80098C18(gDisplayListHead, temp_s3_3, temp_s0, temp_s4, temp_s0 + 0x35, 0xFF, 0xF9, 0xDC, 0xFF); - phi_s3 = temp_s3_3; + phi_v0 = func_800959A0(gDisplayListHead, temp_s3_2, temp_s0, temp_s4, temp_s0 + 0x35); phi_s4 = temp_s4; + } else { + temp_s4_2 = (temp_t1 - temp_t6) + 0x3F; + temp_s3_3 = temp_t1 + temp_t6; + phi_v0 = func_80098C18(gDisplayListHead, temp_s3_3, temp_s0, temp_s4_2, temp_s0 + 0x35, 0xFF, 0xF9, 0xDC, 0xFF); + phi_s3 = temp_s3_3; + phi_s4 = temp_s4_2; } } else { temp_s4_3 = (temp_t1 - temp_t6) + 0x3F; @@ -13122,9 +12989,9 @@ void func_800A8270(s32 arg0, void *arg1) { temp_s7 = arg0 + &D_800F2B60; phi_s2 = 0; phi_s0 = temp_s0 + 0x41; - if (*temp_s7 >= 0) { + if ((s32) *temp_s7 >= 0) { do { - if ((phi_s2 == *(arg0 + &D_800E86AC)) && ((arg0 + 1) == D_8018EDF3) && (temp_v0_5 = gMainMenuSelectionDepth, ((temp_v0_5 < GAME_MODE_SELECTION) == 0))) { + if ((phi_s2 == *(arg0 + &D_800E86AC)) && ((arg0 + 1) == D_8018EDF3) && (temp_v0_5 = gMainMenuSelectionDepth, (((s32) temp_v0_5 < 4) == 0))) { if (temp_v0_5 == 4) { phi_v0_2 = func_800959A0(gDisplayListHead, phi_s3, phi_s0, phi_s4, phi_s0 + 0x11); } else { @@ -13137,7 +13004,7 @@ void func_800A8270(s32 arg0, void *arg1) { temp_s2 = phi_s2 + 1; phi_s2 = temp_s2; phi_s0 += 0x12; - } while (*temp_s7 >= temp_s2); + } while ((s32) *temp_s7 >= temp_s2); } } } @@ -13146,78 +13013,67 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8270.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800959A0(s32, s32, s32, s32, s32); // extern -s32 func_80098C18(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_0200487C; -extern ? D_02004B74; -extern ? D_02004E80; -extern s8 D_8018EDEC; -extern s8 gMainMenuSelectionDepth; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s8 D_8018EDEE; -extern s32 gDisplayListHead; +extern s8 gMainMenuSelectionDepth; -void func_800A8564(void *arg0) { +void func_800A8564(struct_8018D9E0_entry *arg0) { s32 sp34; s32 sp30; + MkTexture *temp_v0_4; s32 temp_a2; s32 temp_t0; s32 temp_v0; - s32 temp_v0_4; + s32 temp_v0_3; s8 temp_v0_2; - s8 temp_v0_3; - void *temp_a3; - void *temp_v0_5; + s8 temp_v0_5; s32 phi_a1; - ? *phi_a0; - s32 phi_v0; + MkTexture *phi_a0; + Gfx *phi_v0; - temp_v0 = arg0->unk0; - temp_a3 = arg0; + temp_v0 = arg0->type; phi_a1 = 0; - if (temp_v0 != 0xF) { - if (temp_v0 != 0x33) { - if (temp_v0 != 0x5D) { - return; - } - phi_a0 = &D_02004E80; - phi_a0 = &D_02004E80; - if (D_8018EDEC == 3) { - goto block_11; - } - goto block_12; + switch (temp_v0) { /* irregular */ + case 0xF: + temp_v0_2 = gMainMenuSelectionDepth; + phi_a0 = D_0200487C; + phi_a0 = D_0200487C; + if ((temp_v0_2 == 6) || (temp_v0_2 == 7)) { +block_11: + phi_a1 = 1; } - temp_v0_2 = D_8018EDEE; - phi_a0 = &D_02004B74; - phi_a0 = &D_02004B74; - if ((temp_v0_2 == 2) || (temp_v0_2 == 3)) { +block_12: + temp_v0_3 = arg0->unk1C; + if (temp_v0_3 < 0x20) { + sp34 = (s32) (temp_v0_3 << 5) / 64; + sp30 = phi_a1; + arg0 = arg0; + temp_v0_4 = segmented_to_virtual(phi_a0); + temp_t0 = arg0->column + temp_v0_4->dX; + temp_a2 = arg0->row + temp_v0_4->dY; + if (phi_a1 != 0) { + phi_v0 = func_800959A0(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12); + } else { + phi_v0 = func_80098C18(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12, 1, 1, 1, 0xFF); + } + gDisplayListHead = phi_v0; + } + return; + case 0x33: + temp_v0_5 = D_8018EDEE; + phi_a0 = D_02004B74; + phi_a0 = D_02004B74; + if ((temp_v0_5 == 2) || (temp_v0_5 == 3)) { goto block_11; } goto block_12; - } - temp_v0_3 = gMainMenuSelectionDepth; - phi_a0 = &D_0200487C; - phi_a0 = &D_0200487C; - if ((temp_v0_3 == CONFIRM_OK_SELECTION) || (temp_v0_3 == CONFIRM_OK_SELECTION_FROM_BACK_OUT)) { -block_11: - phi_a1 = 1; - } -block_12: - temp_v0_4 = temp_a3->unk1C; - if (temp_v0_4 < 0x20) { - sp34 = (temp_v0_4 << 5) / 0x40; - sp30 = phi_a1; - arg0 = temp_a3; - temp_v0_5 = segmented_to_virtual(phi_a0); - temp_t0 = arg0->unkC + temp_v0_5->unkC; - temp_a2 = arg0->unk10 + temp_v0_5->unkE; - if (phi_a1 != 0) { - phi_v0 = func_800959A0(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12); - } else { - phi_v0 = func_80098C18(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12, 1, 1, 1, 0xFF); + case 0x5D: + phi_a0 = D_02004E80; + phi_a0 = D_02004E80; + if (D_8018EDEC == 3) { + goto block_11; } - gDisplayListHead = phi_v0; + goto block_12; } } #else @@ -13229,93 +13085,81 @@ void func_800A86E8(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(s32, s32, ? *, ?, f32, f32); // extern -? func_800936B8(s32, s32, s32, ?, f32, f32); // extern -? get_time_record_minutes(u32, ? *); // extern -? get_time_record_seconds(u32, ? *); // extern -? get_time_record_centiseconds(u32, ? *); // extern -u32 func_800B4E24(?); // extern -u32 func_800B4F2C(); // extern -? set_text_color(?); // extern -? text_draw(s32, s32, ? *, ?, f32, f32); // extern -extern ? D_800E76A8; -extern ? D_800F0C98; -extern ? D_800F0C9C; -extern f32 D_800F24A0; -extern f32 D_800F24A4; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static s8 *D_800E76A8[9] = { + "MARIO", + "LUIGI", + "YOSHI", + "TOAD", + "D.K.", + "WARIO", + "PEACH", + "BOWSER", + D_800EFE0C, +}; /* const */ +static s8 D_800EFE0C[9] = { 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0xA1, 0xBC, 0 }; /* const */ -void func_800A874C(void *arg0) { - ? sp58; - f32 temp_f20; - f32 temp_f22; - u32 temp_s1; +void func_800A874C(struct_8018D9E0_entry *arg0) { + s8 sp58; + s32 temp_s1; u32 phi_v0; u32 phi_s2; - set_text_color(TEXT_GREEN); - if (arg0->unk0 == 0x65) { + set_text_color(1); + if (arg0->type == 0x65) { phi_v0 = func_800B4E24(0); } else { phi_v0 = func_800B4F2C(); } temp_s1 = phi_v0 & 0xFFFFF; get_time_record_minutes(temp_s1, &sp58); - temp_f20 = D_800F24A0; - temp_f22 = D_800F24A4; - text_draw(arg0->unkC + 5, arg0->unk10 + 0x21, &sp58, 0, temp_f20, temp_f22); - func_80093324(arg0->unkC + 0xE, arg0->unk10 + 0x21, &D_800F0C98, 0, temp_f20, temp_f22); + text_draw(arg0->column + 5, arg0->row + 0x21, &sp58, 0, 0.6f, 0.65f); + func_80093324(arg0->column + 0xE, arg0->row + 0x21, "'", 0, 0.6f, 0.65f); get_time_record_seconds(temp_s1, &sp58); - text_draw(arg0->unkC + 0x16, arg0->unk10 + 0x21, &sp58, 0, temp_f20, temp_f22); - func_80093324(arg0->unkC + 0x20, arg0->unk10 + 0x21, &D_800F0C9C, 0, temp_f20, temp_f22); + text_draw(arg0->column + 0x16, arg0->row + 0x21, &sp58, 0, 0.6f, 0.65f); + func_80093324(arg0->column + 0x20, arg0->row + 0x21, "\"\0\x03\x03\x03\x02\0\x02\x02" /* not null-terminated */, 0, 0.6f, 0.65f); get_time_record_centiseconds(temp_s1, &sp58); - text_draw(arg0->unkC + 0x29, arg0->unk10 + 0x21, &sp58, 0, temp_f20, temp_f22); - if (temp_s1 < MAX_TIME) { + text_draw(arg0->column + 0x29, arg0->row + 0x21, &sp58, 0, 0.6f, 0.65f); + if ((u32) temp_s1 < 0x927C0U) { phi_s2 = phi_v0 >> 0x14; } else { - phi_s2 = 8; + phi_s2 = 8U; } - func_800936B8(arg0->unkC + 0x60, arg0->unk10 + 0x21, *(&D_800E76A8 + (phi_s2 * 4)), 0, temp_f20, temp_f22); + func_800936B8(arg0->column + 0x60, arg0->row + 0x21, D_800E76A8[phi_s2], 0, 0.6f, 0.65f); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A874C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800959A0(void *, s32, s32, s32, s32); // extern -void *func_80098C18(void *, s32, s32, s32, s32, s32, s32, s32, s32); // extern -extern s8 D_8018EDEC; -extern s8 gCupSelection; -extern void *gDisplayListHead; - -void func_800A890C(s32 arg0, void *arg1) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A890C(s32 arg0, struct_8018D9E0_entry *arg1) { + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; s32 temp_a2; s32 temp_t0; s32 temp_t1; s32 temp_t7; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - void *phi_v0; + Gfx *phi_v0; temp_t1 = arg1->unk1C; if (temp_t1 < 0x20) { temp_v0 = gDisplayListHead; - temp_t0 = arg1->unkC; - temp_a2 = arg1->unk10; + temp_t0 = arg1->column; + temp_a2 = arg1->row; gDisplayListHead = temp_v0 + 8; - temp_v0->unk4 = 0; - temp_v0->unk0 = 0xE7000000; + temp_v0->words.w1 = 0; + temp_v0->words.w0 = 0xE7000000; temp_v0_2 = gDisplayListHead; gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xB900031D; - temp_v0_2->unk4 = 0xF0A4000; + temp_v0_2->words.w0 = 0xB900031D; + temp_v0_2->words.w1 = 0x0F0A4000; temp_v0_3 = gDisplayListHead; - temp_t7 = (temp_t1 * 0x41) / 0x40; + temp_t7 = (s32) (temp_t1 * 0x41) / 64; gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk0 = 0xFCFFFFFF; - temp_v0_3->unk4 = 0xFFFCF279; + temp_v0_3->words.w0 = 0xFCFFFFFF; + temp_v0_3->words.w1 = 0xFFFCF279; if (arg0 == gCupSelection) { if (D_8018EDEC == 1) { phi_v0 = func_800959A0(gDisplayListHead, temp_t0 + temp_t7, temp_a2, (temp_t0 - temp_t7) + 0x40, temp_a2 + 0x27); @@ -13333,43 +13177,39 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A890C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800959A0(void *, s32, s32, s32, s32); // extern -void *func_80098C18(void *, s32, s32, s32, s32, s32, s32, s32, s32); // extern -extern ? D_800E7208; -extern s8 D_8018EDEC; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static ? D_800E7208; /* unable to generate initializer; const */ -void func_800A8A98(void *arg0) { +void func_800A8A98(struct_8018D9E0_entry *arg0) { + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; s32 temp_s2; s32 temp_s3; s32 temp_s4; s8 temp_v0_4; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; s32 phi_s4; ? *phi_s0; - void *phi_v0; + Gfx *phi_v0; temp_v0 = gDisplayListHead; - temp_s2 = arg0->unkC; - temp_s3 = arg0->unk10; + temp_s2 = arg0->column; + temp_s3 = arg0->row; gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0xE7000000; - temp_v0->unk4 = 0; + temp_v0->words.w0 = 0xE7000000; + temp_v0->words.w1 = 0; temp_v0_2 = gDisplayListHead; gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xB900031D; - temp_v0_2->unk4 = 0xF0A4000; + temp_v0_2->words.w0 = 0xB900031D; + temp_v0_2->words.w1 = 0x0F0A4000; temp_v0_3 = gDisplayListHead; gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk0 = 0xFCFFFFFF; - temp_v0_3->unk4 = 0xFFFCF279; + temp_v0_3->words.w0 = 0xFCFFFFFF; + temp_v0_3->words.w1 = 0xFFFCF279; phi_s4 = 0; phi_s0 = &D_800E7208; do { - if ((phi_s4 == gCupCourseSelection) && (temp_v0_4 = D_8018EDEC, ((temp_v0_4 < 2) == 0)) && (gModeSelection != GRAND_PRIX)) { + if ((phi_s4 == gCupCourseSelection) && (temp_v0_4 = D_8018EDEC, (((s32) temp_v0_4 < 2) == 0)) && (gModeSelection != 0)) { if ((temp_v0_4 == 2) || (temp_v0_4 == 4)) { phi_v0 = func_800959A0(gDisplayListHead, phi_s0->unk0 + temp_s2, phi_s0->unk2 + temp_s3, phi_s0->unk8 + temp_s2, phi_s0->unkA + temp_s3); } else { @@ -13389,51 +13229,50 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8A98.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *draw_box(void *, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *func_800AAEF4(?); // extern -extern ? D_800E7208; -extern s8 D_8018EDEC; -extern ? D_E6FFFFFC; -extern void *gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E7208_0x10 { + /* 0x00 */ s16 unk0; /* inferred */ + /* 0x02 */ s16 unk2; /* inferred */ + /* 0x04 */ char pad4[4]; /* maybe part of unk2[3]? */ + /* 0x08 */ s16 unk8; /* inferred */ + /* 0x0A */ s16 unkA; /* inferred */ + /* 0x0C */ char padC[4]; /* maybe part of unkA[3]? */ +}; /* size = 0x10 */ -void func_800A8CA4(void *arg0) { +static struct _struct_D_800E7208_0x10 D_800E7208[0]; /* unable to generate initializer; const */ + +void func_800A8CA4(struct_8018D9E0_entry *arg0) { + Gfx *temp_v1; + Gfx *temp_v1_2; + Gfx *temp_v1_3; s32 temp_s0; s32 temp_s2; s32 temp_s3; - s32 temp_t6; - void *temp_v0; - void *temp_v0_2; - void *temp_v1; - void *temp_v1_2; - void *temp_v1_3; + struct _struct_D_800E7208_0x10 *temp_v0_2; + struct_8018D9E0_entry *temp_v0; s32 phi_s0; temp_v0 = func_800AAEF4(0x64); temp_v1 = gDisplayListHead; - temp_s2 = arg0->unkC; - temp_s3 = arg0->unk10; + temp_s2 = arg0->column; + temp_s3 = arg0->row; gDisplayListHead = temp_v1 + 8; - temp_v1->unk0 = &D_E6FFFFFC; - temp_v1->unk4 = 0; + temp_v1->words.w0 = 0xE7000000; + temp_v1->words.w1 = 0; temp_v1_2 = gDisplayListHead; gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->unk0 = 0xB900031D; - temp_v1_2->unk4 = 0xF0A4000; + temp_v1_2->words.w0 = 0xB900031D; + temp_v1_2->words.w1 = 0x0F0A4000; temp_v1_3 = gDisplayListHead; gDisplayListHead = temp_v1_3 + 8; - temp_v1_3->unk0 = 0xFCFFFFFF; - temp_v1_3->unk4 = 0xFFFCF279; - if (gModeSelection == GRAND_PRIX) { + temp_v1_3->words.w0 = 0xFCFFFFFF; + temp_v1_3->words.w1 = 0xFFFCF279; + if (gModeSelection == 0) { phi_s0 = 0; if (D_8018EDEC != 3) { do { - temp_t6 = temp_v0->unk1C; - temp_v0_2 = &D_800E7208 + (phi_s0 * 0x10); - if ((temp_t6 < 0) && ((temp_t6 & 3) != 0)) { - - } - if (phi_s0 != (temp_t6 & 3)) { + temp_v0_2 = &D_800E7208[phi_s0]; + if (phi_s0 != ((s32) temp_v0->unk1C % 4)) { gDisplayListHead = draw_box(gDisplayListHead, temp_v0_2->unk0 + temp_s2, temp_v0_2->unk2 + temp_s3, temp_v0_2->unk8 + temp_s2, temp_v0_2->unkA + temp_s3, 0, 0, 0, 0x64); } temp_s0 = phi_s0 + 1; @@ -13462,53 +13301,51 @@ void func_800A8EC0(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_80098FC8(s32, s32, s16, s32, s32); // extern -s32 func_8009BA74(s32, ?, ?, ?); // extern -s32 func_8009C204(s32, s32, s32, s16, s32); // extern -s32 func_800B639C(s32); // extern -void *segmented_to_virtual(void*); // extern -extern ? D_02004A0C; -extern ? D_800E7168; -extern s8 D_8018EDEC; -extern s8 gCupSelection; -extern s32 gDisplayListHead; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E7168_0x8 { + /* 0x0 */ s16 unk0; /* inferred */ + /* 0x2 */ s16 unk2; /* inferred */ + /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ +}; /* size = 0x8 */ -void func_800A8F48(s32 arg0) { +static struct _struct_D_800E7168_0x8 D_800E7168[0]; /* unable to generate initializer; const */ + +void func_800A8F48(struct_8018D9E0_entry *arg0) { + Gfx *temp_v0_3; s16 temp_s0; s16 temp_v1; s32 temp_s1; s32 temp_s2; - s32 temp_v0_2; s8 temp_v0; - void *temp_v0_3; + struct _struct_D_800E7168_0x8 *temp_v0_2; s32 phi_s1; temp_v0 = D_8018EDEC; - if (temp_v0 != 1) { - if (temp_v0 != 2) { - - } + switch (temp_v0) { /* irregular */ + case 1: + phi_s1 = 0; + do { + if (func_800B639C((gCupSelection * 4) + phi_s1) >= 0) { + temp_v0_2 = &D_800E7168[phi_s1]; + temp_v1 = temp_v0_2->unk0; + temp_s0 = temp_v0_2->unk2; + temp_s2 = temp_v1 + 0x20; + gDisplayListHead = func_80098FC8(gDisplayListHead, temp_s2, (s32) temp_s0, temp_v1 + 0x3F, temp_s0 + 9); + gDisplayListHead = func_8009C204(gDisplayListHead, segmented_to_virtual(D_02004A0C), temp_s2, (s32) temp_s0, 2); + } + temp_s1 = phi_s1 + 1; + phi_s1 = temp_s1; + } while (temp_s1 != 4); + return; + default: + case 2: if (func_800B639C((gCupSelection * 4) + gCupCourseSelection) >= 0) { - temp_v0_2 = func_80098FC8(gDisplayListHead, 0x57, 0x70, 0x96, 0x81); - gDisplayListHead = temp_v0_2; - gDisplayListHead = func_8009BA74(temp_v0_2, 0x2004A0C, 0x57, 0x70); + temp_v0_3 = func_80098FC8(gDisplayListHead, 0x57, 0x70, 0x96, 0x81); + gDisplayListHead = temp_v0_3; + gDisplayListHead = func_8009BA74(temp_v0_3, (MkTexture *)0x02004A0C, 0x57, 0x70); } return; } - phi_s1 = 0; - do { - if (func_800B639C((gCupSelection * 4) + phi_s1) >= 0) { - temp_v0_3 = &D_800E7168 + (phi_s1 * 8); - temp_v1 = temp_v0_3->unk0; - temp_s0 = temp_v0_3->unk2; - temp_s2 = temp_v1 + 0x20; - gDisplayListHead = func_80098FC8(gDisplayListHead, temp_s2, temp_s0, temp_v1 + 0x3F, temp_s0 + 9); - gDisplayListHead = func_8009C204(gDisplayListHead, segmented_to_virtual(&D_02004A0C), temp_s2, temp_s0, 2); - } - temp_s1 = phi_s1 + 1; - phi_s1 = temp_s1; - } while (temp_s1 != 4); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8F48.s") @@ -13549,15 +13386,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A91D8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800A9208(void *arg0, s32 arg1) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A9208(struct_8018D9E0_entry *arg0, s32 arg1) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; s32 temp_v1; s32 phi_v0; - temp_v1 = arg0->unkC; + temp_v1 = arg0->column; temp_v0 = arg1 - temp_v1; phi_v0 = temp_v0; if (temp_v0 != 0) { @@ -13575,22 +13412,22 @@ void func_800A9208(void *arg0, s32 arg1) { } } } - arg0->unkC = temp_v1 + phi_v0; + arg0->column = temp_v1 + phi_v0; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9208.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800A9278(void *arg0, s32 arg1) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A9278(struct_8018D9E0_entry *arg0, s32 arg1) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; s32 temp_v1; s32 phi_v0; - temp_v1 = arg0->unk10; + temp_v1 = arg0->row; temp_v0 = arg1 - temp_v1; phi_v0 = temp_v0; if (temp_v0 != 0) { @@ -13608,15 +13445,15 @@ void func_800A9278(void *arg0, s32 arg1) { } } } - arg0->unk10 = temp_v1 + phi_v0; + arg0->row = temp_v1 + phi_v0; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9278.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800A92E8(void *arg0, s32 arg1) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A92E8(struct_8018D9E0_entry *arg0, s32 arg1) { s32 temp_t0; s32 temp_t7; s32 temp_v0; @@ -13628,7 +13465,7 @@ void func_800A92E8(void *arg0, s32 arg1) { s32 phi_v0_3; s32 phi_v0_4; - temp_v1 = arg0->unkC; + temp_v1 = arg0->column; temp_v0 = arg1 - temp_v1; if (temp_v0 != 0) { if (temp_v0 > 0) { @@ -13642,29 +13479,26 @@ void func_800A92E8(void *arg0, s32 arg1) { phi_v0_2 = 8; } temp_t7 = temp_v1 + phi_v0_2; - arg0->unkC = temp_t7; + arg0->column = temp_t7; if (arg1 < temp_t7) { - arg0->unkC = arg1; - return; + arg0->column = arg1; + } + } else { + temp_v0_3 = (temp_v0 / 4) - 1; + phi_v0_3 = temp_v0_3; + if (temp_v0_3 < -0x10) { + phi_v0_3 = -0x10; + } + phi_v0_4 = phi_v0_3; + if (phi_v0_3 < -8) { + phi_v0_4 = -8; + } + temp_t0 = temp_v1 + phi_v0_4; + arg0->column = temp_t0; + if (temp_t0 < arg1) { + arg0->column = arg1; } - // Duplicate return node #14. Try simplifying control flow for better match - return; } - temp_v0_3 = (temp_v0 / 4) - 1; - phi_v0_3 = temp_v0_3; - if (temp_v0_3 < -0x10) { - phi_v0_3 = -0x10; - } - phi_v0_4 = phi_v0_3; - if (phi_v0_3 < -8) { - phi_v0_4 = -8; - } - temp_t0 = temp_v1 + phi_v0_4; - arg0->unkC = temp_t0; - if (temp_t0 < arg1) { - arg0->unkC = arg1; - } - // Duplicate return node #14. Try simplifying control flow for better match } } #else @@ -13672,8 +13506,8 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A92E8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800A940C(void *arg0, s32 arg1) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800A940C(struct_8018D9E0_entry *arg0, s32 arg1) { s32 temp_lo; s32 temp_t7; s32 temp_t9; @@ -13684,7 +13518,7 @@ void func_800A940C(void *arg0, s32 arg1) { s32 phi_v0_3; s32 phi_v0_4; - temp_v1 = arg0->unkC; + temp_v1 = arg0->column; temp_v0 = arg1 - temp_v1; if (temp_v0 != 0) { temp_lo = 0xC8 / temp_v0; @@ -13699,27 +13533,24 @@ void func_800A940C(void *arg0, s32 arg1) { phi_v0_2 = 0x10; } temp_t7 = temp_v1 + phi_v0_2; - arg0->unkC = temp_t7; + arg0->column = temp_t7; if (arg1 < temp_t7) { - arg0->unkC = arg1; - return; + arg0->column = arg1; + } + } else { + if (temp_lo < -0x18) { + phi_v0_3 = -0x18; + } + phi_v0_4 = phi_v0_3; + if (phi_v0_3 >= -0xF) { + phi_v0_4 = -0x10; + } + temp_t9 = temp_v1 + phi_v0_4; + arg0->column = temp_t9; + if (temp_t9 < arg1) { + arg0->column = arg1; } - // Duplicate return node #14. Try simplifying control flow for better match - return; } - if (temp_lo < -0x18) { - phi_v0_3 = -0x18; - } - phi_v0_4 = phi_v0_3; - if (phi_v0_3 >= -0xF) { - phi_v0_4 = -0x10; - } - temp_t9 = temp_v1 + phi_v0_4; - arg0->unkC = temp_t9; - if (temp_t9 < arg1) { - arg0->unkC = arg1; - } - // Duplicate return node #14. Try simplifying control flow for better match } } #else @@ -13781,15 +13612,15 @@ void func_800A954C(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009A594(s32, ?, s32, void *); /* extern */ -static ? D_800E7D34; /* unable to generate initializer; const */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static MkAnimation *D_800E7D34[6] = { D_0200198C, D_0200199C, D_020019AC, D_020019BC, D_020019CC, D_020019DC }; /* const */ -void func_800A9710(void *arg0) { +void func_800A9710(struct_8018D9E0_entry *arg0) { s8 temp_t6; s32 phi_v0; - switch (gControllerPakMenuSelection) { + temp_t6 = gControllerPakMenuSelection; + switch (temp_t6) { case CONTROLLER_PAK_MENU_ERASE: case CONTROLLER_PAK_MENU_QUIT: phi_v0 = 1; @@ -13814,7 +13645,7 @@ void func_800A9710(void *arg0) { if (phi_v0 != arg0->unk4) { arg0->unk4 = phi_v0; arg0 = arg0; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7D34 + (phi_v0 * 4)), MIPS2C_ERROR(Read from unset register $a1)), arg0); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E7D34[phi_v0])); } } #else @@ -13822,18 +13653,18 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9710.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E86C4; -extern ? D_800E86C6; -extern ? D_800E86C7; -extern ? D_800E86C8; -extern ? D_800E86C9; -extern ? D_800E86CA; -extern ? D_800E86CB; -extern ? D_800E86CC; -extern s8 D_800E86D0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +static ? D_800E86C4; /* unable to generate initializer; const */ +static ? D_800E86C6; /* unable to generate initializer; const */ +static ? D_800E86C7; /* unable to generate initializer; const */ +static ? D_800E86C8; /* unable to generate initializer; const */ +static ? D_800E86C9; /* unable to generate initializer; const */ +static ? D_800E86CA; /* unable to generate initializer; const */ +static ? D_800E86CB; /* unable to generate initializer; const */ +static ? D_800E86CC; /* unable to generate initializer; const */ +s8 D_800E86D0[0x14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; /* const */ -void func_800A97BC(void *arg0) { +void func_800A97BC(struct_8018D9E0_entry *arg0) { s32 temp_t4; s32 temp_t7; s8 temp_v0; @@ -13850,120 +13681,119 @@ void func_800A97BC(void *arg0) { u32 phi_v1; u32 phi_v1_2; - temp_v0 = D_800E86D0; + temp_v0 = *D_800E86D0; if (temp_v0 != 1) { if (temp_v0 != 2) { - D_800E86D0 = 0; + *D_800E86D0 = 0; return; } - temp_t4 = arg0->unk10 + 2; - arg0->unk10 = temp_t4; + temp_t4 = arg0->row + 2; + arg0->row = temp_t4; if (temp_t4 >= 0x73) { - arg0->unk10 = 0x69; - D_800E86D0 = 0; - phi_v1 = &D_800E86CC; + arg0->row = 0x69; + *D_800E86D0 = 0; + phi_v1 = (u32) &D_800E86CC; do { - if (phi_v1 >= &D_800E86C6) { - phi_v1->unk0 = phi_v1->unk-1; + if (phi_v1 >= (u32) &D_800E86C6) { + phi_v1->unk0 = (s8) phi_v1->unk-1; } else { temp_v0_2 = phi_v1->unk1; if ((temp_v0_2 == 1) || (temp_v0_2 == 0)) { phi_v1->unk0 = 0; } else { - phi_v1->unk0 = temp_v0_2 - 1; + phi_v1->unk0 = (s8) (temp_v0_2 - 1); } } - if (phi_v1 >= &D_800E86C7) { - phi_v1->unk-1 = phi_v1->unk-2; + if (phi_v1 >= (u32) &D_800E86C7) { + phi_v1->unk-1 = (s8) phi_v1->unk-2; } else { temp_v0_3 = phi_v1->unk0; if ((temp_v0_3 == 1) || (temp_v0_3 == 0)) { phi_v1->unk-1 = 0; } else { - phi_v1->unk-1 = temp_v0_3 - 1; + phi_v1->unk-1 = (s8) (temp_v0_3 - 1); } } - if (phi_v1 >= &D_800E86C8) { - phi_v1->unk-2 = phi_v1->unk-3; + if (phi_v1 >= (u32) &D_800E86C8) { + phi_v1->unk-2 = (s8) phi_v1->unk-3; } else { temp_v0_4 = phi_v1->unk-1; if ((temp_v0_4 == 1) || (temp_v0_4 == 0)) { phi_v1->unk-2 = 0; } else { - phi_v1->unk-2 = temp_v0_4 - 1; + phi_v1->unk-2 = (s8) (temp_v0_4 - 1); } } - if (phi_v1 >= &D_800E86C9) { - phi_v1->unk-3 = phi_v1->unk-4; + if (phi_v1 >= (u32) &D_800E86C9) { + phi_v1->unk-3 = (s8) phi_v1->unk-4; } else { temp_v0_5 = phi_v1->unk-2; if ((temp_v0_5 == 1) || (temp_v0_5 == 0)) { phi_v1->unk-3 = 0; } else { - phi_v1->unk-3 = temp_v0_5 - 1; + phi_v1->unk-3 = (s8) (temp_v0_5 - 1); } } temp_v1 = phi_v1 - 4; phi_v1 = temp_v1; } while (temp_v1 != &D_800E86C4); D_800E86C4.unk8 = 0; - D_800E86C4.unk0 = D_800E86C4.unk8; + D_800E86C4.unk0 = (s8) D_800E86C4.unk8; } - // Duplicate return node #59. Try simplifying control flow for better match - return; - } - temp_t7 = arg0->unk10 - 2; - arg0->unk10 = temp_t7; - if (temp_t7 < 0x60) { - arg0->unk10 = 0x69; - D_800E86D0 = 0; - phi_v1_2 = &D_800E86C4; - do { - if (phi_v1_2 < &D_800E86CB) { - phi_v1_2->unk0 = phi_v1_2->unk1; - } else { - temp_v0_6 = phi_v1_2->unk-1; - if ((temp_v0_6 == 0x10) || (temp_v0_6 == 0)) { - phi_v1_2->unk0 = 0; + } else { + temp_t7 = arg0->row - 2; + arg0->row = temp_t7; + if (temp_t7 < 0x60) { + arg0->row = 0x69; + *D_800E86D0 = 0; + phi_v1_2 = (u32) &D_800E86C4; + do { + if (phi_v1_2 < (u32) &D_800E86CB) { + phi_v1_2->unk0 = (s8) phi_v1_2->unk1; } else { - phi_v1_2->unk0 = temp_v0_6 + 1; + temp_v0_6 = phi_v1_2->unk-1; + if ((temp_v0_6 == 0x10) || (temp_v0_6 == 0)) { + phi_v1_2->unk0 = 0; + } else { + phi_v1_2->unk0 = (s8) (temp_v0_6 + 1); + } } - } - if (phi_v1_2 < &D_800E86CA) { - phi_v1_2->unk1 = phi_v1_2->unk2; - } else { - temp_v0_7 = phi_v1_2->unk0; - if ((temp_v0_7 == 0x10) || (temp_v0_7 == 0)) { - phi_v1_2->unk1 = 0; + if (phi_v1_2 < (u32) &D_800E86CA) { + phi_v1_2->unk1 = (s8) phi_v1_2->unk2; } else { - phi_v1_2->unk1 = temp_v0_7 + 1; + temp_v0_7 = phi_v1_2->unk0; + if ((temp_v0_7 == 0x10) || (temp_v0_7 == 0)) { + phi_v1_2->unk1 = 0; + } else { + phi_v1_2->unk1 = (s8) (temp_v0_7 + 1); + } } - } - if (phi_v1_2 < &D_800E86C9) { - phi_v1_2->unk2 = phi_v1_2->unk3; - } else { - temp_v0_8 = phi_v1_2->unk1; - if ((temp_v0_8 == 0x10) || (temp_v0_8 == 0)) { - phi_v1_2->unk2 = 0; + if (phi_v1_2 < (u32) &D_800E86C9) { + phi_v1_2->unk2 = (s8) phi_v1_2->unk3; } else { - phi_v1_2->unk2 = temp_v0_8 + 1; + temp_v0_8 = phi_v1_2->unk1; + if ((temp_v0_8 == 0x10) || (temp_v0_8 == 0)) { + phi_v1_2->unk2 = 0; + } else { + phi_v1_2->unk2 = (s8) (temp_v0_8 + 1); + } } - } - if (phi_v1_2 < &D_800E86C8) { - phi_v1_2->unk3 = phi_v1_2->unk4; - } else { - temp_v0_9 = phi_v1_2->unk2; - if ((temp_v0_9 == 0x10) || (temp_v0_9 == 0)) { - phi_v1_2->unk3 = 0; + if (phi_v1_2 < (u32) &D_800E86C8) { + phi_v1_2->unk3 = (s8) phi_v1_2->unk4; } else { - phi_v1_2->unk3 = temp_v0_9 + 1; + temp_v0_9 = phi_v1_2->unk2; + if ((temp_v0_9 == 0x10) || (temp_v0_9 == 0)) { + phi_v1_2->unk3 = 0; + } else { + phi_v1_2->unk3 = (s8) (temp_v0_9 + 1); + } } - } - temp_v1_2 = phi_v1_2 + 4; - phi_v1_2 = temp_v1_2; - } while (temp_v1_2 != &D_800E86CC); - D_800E86C4.unk8 = 0; - D_800E86C4.unk0 = D_800E86C4.unk8; + temp_v1_2 = phi_v1_2 + 4; + phi_v1_2 = temp_v1_2; + } while (temp_v1_2 != &D_800E86CC); + D_800E86C4.unk8 = 0; + D_800E86C4.unk0 = (s8) D_800E86C4.unk8; + } } } #else @@ -13971,15 +13801,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A97BC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800F0C9C; -extern ? D_800F0CA7; -extern ? D_800F0CAB; -extern s8 D_8018EDEC; -extern s8 gMainMenuSelectionDepth; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s8 D_8018EDEE; +extern s8 gMainMenuSelectionDepth; +static ? D_800F0CA7; /* unable to generate initializer; const */ +static ? D_800F0CAB; /* unable to generate initializer; const */ -void func_800A9A98(void *arg0) { +void func_800A9A98(struct_8018D9E0_entry *arg0) { s32 temp_t2; s32 temp_t4; s32 temp_v0; @@ -13987,61 +13815,63 @@ void func_800A9A98(void *arg0) { s32 temp_v0_3; s32 phi_v0; - temp_v0 = arg0->unk0; - if (temp_v0 != 0xF) { - if (temp_v0 != 0x33) { - if (temp_v0 != 0x5D) { - phi_v0 = sp4; - } else { - phi_v0 = *(&D_800F0CAB + D_8018EDEC); - } - } else { - phi_v0 = *(&D_800F0CA7 + D_8018EDEE); - } - } else { - phi_v0 = *(&D_800F0C9C + 3 + gMainMenuSelectionDepth); + temp_v0 = arg0->type; + switch (temp_v0) { /* irregular */ + default: + phi_v0 = sp4; + break; + case 0xF: + phi_v0 = (s32) *("\"\0\x03\x03\x03\x02\0\x02\x02" /* not null-terminated */ + 3 + gMainMenuSelectionDepth); + break; + case 0x5D: + phi_v0 = (s32) *(&D_800F0CAB + D_8018EDEC); + break; + case 0x33: + phi_v0 = (s32) *(&D_800F0CA7 + D_8018EDEE); + break; } - if (phi_v0 != 0) { - if (phi_v0 != 1) { - if (phi_v0 != 2) { - if (phi_v0 != 3) { - return; - } - temp_v0_2 = arg0->unk1C; - temp_t4 = temp_v0_2 + 2; - if (temp_v0_2 < 0x20) { - arg0->unk1C = temp_t4; - if (temp_t4 >= 0x20) { - arg0->unk1C = 0x20; - } - } - // Duplicate return node #20. Try simplifying control flow for better match - return; - } - temp_v0_3 = arg0->unk1C; - if ((temp_v0_3 > 0) && (temp_t2 = (temp_v0_3 - (temp_v0_3 / 0xC)) - 2, arg0->unk1C = temp_t2, (temp_t2 < 0))) { + switch (phi_v0) { /* switch 1; irregular */ + case 0: /* switch 1 */ + arg0->unk1C = 0; + return; + case 1: /* switch 1 */ + arg0->unk1C = 0x20; + return; + case 2: /* switch 1 */ + temp_v0_2 = arg0->unk1C; + if (temp_v0_2 > 0) { + temp_t2 = (temp_v0_2 - (temp_v0_2 / 12)) - 2; + arg0->unk1C = temp_t2; + if (temp_t2 < 0) { arg0->unk1C = 0; return; } - return; } - arg0->unk1C = 0x20; return; + case 3: /* switch 1 */ + temp_v0_3 = arg0->unk1C; + temp_t4 = temp_v0_3 + 2; + if (temp_v0_3 < 0x20) { + arg0->unk1C = temp_t4; + if (temp_t4 >= 0x20) { + arg0->unk1C = 0x20; + } + } + break; } - arg0->unk1C = 0; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9A98.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800AA280(); /* extern */ -void func_800A9B9C(void *arg0) { +void func_800A9B9C(struct_8018D9E0_entry *arg0) { s32 temp_t0; + s32 temp_t6; s32 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { @@ -14069,8 +13899,7 @@ void func_800A9B9C(void *arg0) { return; case 2: arg0->unk4 = 3; - /* Duplicate return node #9. Try simplifying control flow for better match */ - return; + break; } } #else @@ -14078,27 +13907,29 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9B9C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800AA280(); /* extern */ +extern s8 D_8018EDF3; +extern s8 gMainMenuSelectionDepth; -void func_800A9C40(void *arg0) { +void func_800A9C40(struct_8018D9E0_entry *arg0) { + s32 temp_t6; s32 temp_t7; s32 temp_v0_2; s8 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: func_800AA280(); - if (arg0->unk0 == (D_8018EDF3 + 0xA)) { + if (arg0->type == (D_8018EDF3 + 0xA)) { arg0->unk4 = 2; return; } arg0->unk4 = 1; return; case 4: - if (arg0->unk0 == (D_8018EDF3 + 0xA)) { + if (arg0->type == (D_8018EDF3 + 0xA)) { arg0->unk4 = 2; arg0->unk1C = 0; return; @@ -14107,24 +13938,26 @@ void func_800A9C40(void *arg0) { case 1: func_800AA280(); temp_v0 = gMainMenuSelectionDepth; - if ((temp_v0 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v0 == TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT)) { + if ((temp_v0 == 7) || (temp_v0 == 8)) { arg0->unk1C = 0x20; return; } temp_v0_2 = arg0->unk1C; temp_t7 = temp_v0_2 + 2; - if ((temp_v0_2 < 0x20) && (arg0->unk1C = temp_t7, ((temp_t7 < 0x20) == 0))) { - arg0->unk1C = 0x20; - return; + if (temp_v0_2 < 0x20) { + arg0->unk1C = temp_t7; + if (temp_t7 >= 0x20) { + arg0->unk1C = 0x20; + return; + } } default: return; case 3: - if (arg0->unk0 == (D_8018EDF3 + 0xA)) { + if (arg0->type == (D_8018EDF3 + 0xA)) { arg0->unk4 = 2; } - /* Duplicate return node #16. Try simplifying control flow for better match */ - return; + break; } } #else @@ -14132,41 +13965,46 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9C40.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800A91D8(s16, s16); /* extern */ +extern s8 D_8018EDF3; +extern s8 gMainMenuSelectionDepth; static ? D_800E70A0; /* unable to generate initializer; const */ -void func_800A9D5C(void *arg0) { +void func_800A9D5C(struct_8018D9E0_entry *arg0) { void *sp1C; + s32 temp_t1; s8 temp_v0; - u32 temp_t1; void *temp_v0_2; - if (arg0->unk0 == (D_8018EDF3 + 0xA)) { - arg0->unk14 = 0xA; + if (arg0->type == (D_8018EDF3 + 0xA)) { + arg0->priority = 0xA; } else { - arg0->unk14 = 6; + arg0->priority = 6; } temp_t1 = arg0->unk4; switch (temp_t1) { case 2: temp_v0 = gMainMenuSelectionDepth; - if ((temp_v0 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v0 == TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT)) { - arg0->unkC = 0x80; - arg0->unk10 = 0x3E; + if ((temp_v0 == 7) || (temp_v0 == 8)) { + arg0->column = 0x80; + arg0->row = 0x3E; return; } func_800A91D8(0x80, 0x3E); return; case 3: - temp_v0_2 = (arg0->unk0 * 8) - 0x50 + &D_800E70A0; + temp_v0_2 = (arg0->type * 8) - 0x50 + &D_800E70A0; sp1C = temp_v0_2; func_800A91D8(temp_v0_2->unk0, temp_v0_2->unk2); - if ((temp_v0_2->unk0 == arg0->unkC) && (temp_v0_2->unk2 == arg0->unk10)) { + if ((temp_v0_2->unk0 == arg0->column) && (temp_v0_2->unk2 == arg0->row)) { arg0->unk4 = 0; } /* fallthrough */ default: + case 0: + case 1: + case 4: return; } } @@ -14175,14 +14013,17 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9D5C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_800A91D8(void *, s32, s32); /* extern */ -? func_800A92E8(void *, s32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A91D8(struct_8018D9E0_entry *, s32, s32); /* extern */ +? func_800A92E8(struct_8018D9E0_entry *, s32); /* extern */ +void *func_800AAE68(s32, s8, s32); /* extern */ +extern s8 D_8018EDF3; +extern s8 gMainMenuSelectionDepth; static ? D_800E70E8; /* unable to generate initializer; const */ -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? gGameModeFromNumPlayersAndRowSelection; /* unable to generate initializer; const */ +static ? gGameModeFromNumPlayersAndRowSelection; /* unable to generate initializer; const */ +static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -void func_800A9E58(void *arg0) { +void func_800A9E58(struct_8018D9E0_entry *arg0) { void *sp2C; s16 *sp28; s32 sp24; @@ -14208,7 +14049,7 @@ void func_800A9E58(void *arg0) { void *temp_v1_4; s32 phi_a3; - temp_t6 = arg0->unk0; + temp_t6 = arg0->type; switch (temp_t6) { /* switch 1 */ case 18: /* switch 1 */ case 19: /* switch 1 */ @@ -14237,98 +14078,107 @@ block_5: temp_v1 = arg0->unk4; temp_a2 = *(&gGameModeRowSelectionForNumPlayers + temp_v0); temp_a1 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0 * 0xC) + (temp_a2 * 4))); - if (temp_v1 != 0) { - if (temp_v1 != 1) { - if (temp_v1 != 2) { - return; - } - temp_t9 = gMainMenuSelectionDepth; - switch (temp_t9) { /* switch 4 */ - if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { - arg0->unk15 = 0; - goto block_37; - } - if (arg0->unk20 != temp_a2) { - arg0->unk4 = 0; - } - temp_v0_2 = func_800AAE68(arg0, temp_a1, temp_a2); - temp_v1_2 = (arg0->unk0 * 8) + -(sp24 * 8) + &D_800E70E8; - temp_a1_2 = temp_v0_2->unkC + temp_v1_2->unk0; - arg0->unkC = temp_a1_2; - arg0->unk10 = temp_v0_2->unk10 + arg0->unk1C; - sp2C = temp_v0_2; - func_800A91D8(arg0, temp_a1_2, (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_2->unk10 + temp_v1_2->unk2); - arg0->unk1C = arg0->unk10 - sp2C->unk10; - return; - default: /* switch 4 */ - arg0->unk15 = 0; - goto block_37; - } - } else { - temp_t2 = gMainMenuSelectionDepth; - switch (temp_t2) { /* switch 3 */ - if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { - arg0->unk15 = 0; -block_37: - arg0->unk4 = 0; - /* Duplicate return node #38. Try simplifying control flow for better match */ - return; - } - if (arg0->unk20 != temp_a2) { - arg0->unk4 = 0; - } - temp_v0_3 = func_800AAE68(arg0, temp_a1, temp_a2); - arg0->unkC = temp_v0_3->unkC + arg0->unk1C; - temp_v1_3 = (arg0->unk0 * 8) + -(sp24 * 8) + &D_800E70E8; - sp2C = temp_v0_3; - sp28 = temp_v1_3; - func_800A92E8(arg0, temp_v0_3->unkC + *temp_v1_3); - temp_t2_2 = arg0->unkC - sp2C->unkC; - arg0->unk1C = temp_t2_2; - if (*temp_v1_3 == temp_t2_2) { - arg0->unk4 = 2; - arg0->unk1C = arg0->unk10 - sp2C->unk10; - return; - } - return; - default: /* switch 3 */ - arg0->unk15 = 0; - goto block_37; - } - } - } else { + switch (temp_v1) { /* switch 5; irregular */ + case 0: /* switch 5 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { - arg0->unk15 = 0; + arg0->visible = 0; return; } - arg0->unk20 = temp_a2; + arg0->unk20 = (s32) temp_a2; temp_t5 = gMainMenuSelectionDepth; switch (temp_t5) { /* switch 2 */ - case GAME_MODE_SELECTION: /* switch 2 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 2 */ - case CONFIRM_OK_SELECTION: /* switch 2 */ - arg0->unk15 = 1; - temp_v0_4 = func_800AAE68(arg0, temp_a1, temp_a2); - arg0->unkC = temp_v0_4->unkC; + case 4: /* switch 2 */ + case 5: /* switch 2 */ + case 6: /* switch 2 */ + arg0->visible = 1; + temp_v0_2 = func_800AAE68(temp_a1, temp_a2, sp20); + arg0->column = temp_v0_2->unkC; arg0->unk1C = 0; arg0->unk4 = 1; - arg0->unk10 = (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_4->unk10 + 0x41; + arg0->row = (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_2->unk10 + 0x41; return; - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 2 */ - case TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT: /* switch 2 */ - temp_v0_5 = func_800AAE68(arg0, temp_a1, temp_a2); - temp_v1_4 = (arg0->unk0 * 8) + -(sp24 * 8) + &D_800E70E8; - arg0->unkC = temp_v0_5->unkC + temp_v1_4->unk0; - temp_t5_2 = (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_5->unk10 + temp_v1_4->unk2; - arg0->unk10 = temp_t5_2; - arg0->unk1C = temp_t5_2 - temp_v0_5->unk10; - arg0->unk15 = 1; + case 7: /* switch 2 */ + case 8: /* switch 2 */ + temp_v0_3 = func_800AAE68(temp_a1, temp_a2, sp20); + temp_v1_2 = (arg0->type * 8) + -(s32) (sp24 * 8) + &D_800E70E8; + arg0->column = temp_v0_3->unkC + temp_v1_2->unk0; + temp_t5_2 = (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_3->unk10 + temp_v1_2->unk2; + arg0->row = temp_t5_2; + arg0->unk1C = temp_t5_2 - temp_v0_3->unk10; + arg0->visible = 1; arg0->unk4 = 2; return; default: /* switch 2 */ - arg0->unk15 = 0; + arg0->visible = 0; return; } + break; + case 1: /* switch 5 */ + temp_t2 = gMainMenuSelectionDepth; + switch (temp_t2) { /* switch 3 */ + case 4: /* switch 3 */ + case 5: /* switch 3 */ + case 6: /* switch 3 */ + case 7: /* switch 3 */ + case 8: /* switch 3 */ + if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { + arg0->visible = 0; +block_37: + arg0->unk4 = 0; + } else { + if (arg0->unk20 != temp_a2) { + arg0->unk4 = 0; + } + temp_v0_4 = func_800AAE68(temp_a1, temp_a2, sp20); + arg0->column = temp_v0_4->unkC + arg0->unk1C; + temp_v1_3 = (arg0->type * 8) + -(s32) (sp24 * 8) + &D_800E70E8; + sp2C = temp_v0_4; + sp28 = temp_v1_3; + func_800A92E8(arg0, temp_v0_4->unkC + *temp_v1_3); + temp_t2_2 = arg0->column - sp2C->unkC; + arg0->unk1C = temp_t2_2; + if (*temp_v1_3 == temp_t2_2) { + arg0->unk4 = 2; + arg0->unk1C = arg0->row - sp2C->unk10; + return; + } + return; + } + break; + default: /* switch 3 */ + arg0->visible = 0; + goto block_37; + } + break; + case 2: /* switch 5 */ + temp_t9 = gMainMenuSelectionDepth; + switch (temp_t9) { /* switch 4 */ + case 4: /* switch 4 */ + case 5: /* switch 4 */ + case 6: /* switch 4 */ + case 7: /* switch 4 */ + case 8: /* switch 4 */ + if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { + arg0->visible = 0; + goto block_37; + } + if (arg0->unk20 != temp_a2) { + arg0->unk4 = 0; + } + temp_v0_5 = func_800AAE68(temp_a1, temp_a2, sp20); + temp_v1_4 = (arg0->type * 8) + -(s32) (sp24 * 8) + &D_800E70E8; + temp_a1_2 = temp_v0_5->unkC + temp_v1_4->unk0; + arg0->column = temp_a1_2; + arg0->row = temp_v0_5->unk10 + arg0->unk1C; + sp2C = temp_v0_5; + func_800A91D8(arg0, temp_a1_2, (*(&gGameModeRowSelectionForNumPlayers + D_8018EDF3) * 0x12) + temp_v0_5->unk10 + temp_v1_4->unk2); + arg0->unk1C = arg0->row - sp2C->unk10; + return; + default: /* switch 4 */ + arg0->visible = 0; + goto block_37; + } + break; } } #else @@ -14336,20 +14186,20 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9E58.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800A91D8(s16, s16); // extern -extern ? D_800E70A0; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A91D8(s16, s16); /* extern */ extern s8 gMainMenuSelectionDepth; +static ? D_800E70A0; /* unable to generate initializer; const */ -void func_800AA280(void *arg0) { +void func_800AA280(struct_8018D9E0_entry *arg0) { s8 temp_v1; void *temp_v0; temp_v1 = gMainMenuSelectionDepth; - temp_v0 = (arg0->unk0 * 8) - 0x50 + &D_800E70A0; + temp_v0 = (arg0->type * 8) - 0x50 + &D_800E70A0; if ((temp_v1 == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || (temp_v1 == TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT)) { - arg0->unkC = temp_v0->unk0; - arg0->unk10 = temp_v0->unk2; + arg0->column = (s32) temp_v0->unk0; + arg0->row = (s32) temp_v0->unk2; return; } func_800A91D8(temp_v0->unk0, temp_v0->unk2); @@ -14359,21 +14209,26 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA280.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -s32 check_for_controller_pak(?); /* extern */ -s32 osPfsInit(? *, ? *, ?); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +s32 check_for_controller_pak(?); /* extern */ s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ s32 osPfsFreeBlocks(? *, s32 *); /* extern */ +s32 osPfsInit(OSMesgQueue *, ? *, ?); /* extern */ s32 osPfsNumFiles(? *, s32 *, s32 *); /* extern */ extern ? D_8018E868; +extern s32 D_8018EB78; +extern s32 D_8018EB7C; extern ? D_8018EB84; -extern ? gSIEventMesgQueue; -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ +extern s8 D_8018EDF3; +extern s8 gMainMenuSelectionDepth; +static u16 D_800E86F0; /* unable to generate initializer; const */ +static s32 D_800E86F4 = 0x4E4B544A; /* const */ +static s8 D_800E86F8 = 0; /* const */ static ? D_800F2E64; /* unable to generate initializer; const */ static ? D_800F2E74; /* unable to generate initializer; const */ -u16 D_800E86F0; /* unable to generate initializer; const */ +static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -void func_800AA2EC(void *arg0) { +void func_800AA2EC(struct_8018D9E0_entry *arg0) { s32 sp20; s32 temp_v0_2; s32 temp_v0_3; @@ -14398,20 +14253,18 @@ void func_800AA2EC(void *arg0) { if (D_800E86F8 != 0) { sp20 = 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) { - goto block_12; - } - } else { -block_12: - D_800E86F8 = 0; - } - } else { + switch (temp_v0_2) { /* switch 1; irregular */ + case 0: /* switch 1 */ arg0->unk4 = 1; phi_t1 = 1; + break; + default: /* switch 1 */ + case 2: /* switch 1 */ + D_800E86F8 = 0; + break; } } + case 5: /* switch 1 */ if (phi_t1 == 0) { if (D_800E86F8 == 0) { if (check_for_controller_pak(0) == 0) { @@ -14452,7 +14305,7 @@ block_22: arg0->unk4 = 3; return; } - gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; + gControllerPakNumPagesFree = (s32) gControllerPakNumPagesFree >> 8; goto block_32; } block_32: @@ -14465,14 +14318,12 @@ block_32: return; } arg0->unk4 = 5; - /* Duplicate return node #37. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #37. Try simplifying control flow for better match */ + } else { + default: return; } - default: - return; + break; } } #else @@ -15009,11 +14860,11 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAFCC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800AB020(void *arg0) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800AB020(struct_8018D9E0_entry *arg0) { s32 temp_t0; + s32 temp_t6; s32 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { @@ -15030,6 +14881,8 @@ void func_800AB020(void *arg0) { return; } default: + case 0: + case 3: return; } arg0->unk1C = 0; @@ -15037,8 +14890,7 @@ void func_800AB020(void *arg0) { return; case 2: arg0->unk4 = 3; - /* Duplicate return node #8. Try simplifying control flow for better match */ - return; + break; } } #else @@ -15046,23 +14898,23 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB020.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800AB098(void *arg0) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800AB098(struct_8018D9E0_entry *arg0) { + s32 temp_t6; s32 temp_t8; s32 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: - if (arg0->unk0 == (gCupSelection + 0x53)) { + if (arg0->type == (gCupSelection + 0x53)) { arg0->unk4 = 2; return; } arg0->unk4 = 1; return; case 4: - if (arg0->unk0 == (gCupSelection + 0x53)) { + if (arg0->type == (gCupSelection + 0x53)) { arg0->unk4 = 2; arg0->unk1C = 0; return; @@ -15071,18 +14923,20 @@ void func_800AB098(void *arg0) { case 1: temp_v0 = arg0->unk1C; temp_t8 = temp_v0 + 2; - if ((temp_v0 < 0x20) && (arg0->unk1C = temp_t8, ((temp_t8 < 0x20) == 0))) { - arg0->unk1C = 0x20; - return; + if (temp_v0 < 0x20) { + arg0->unk1C = temp_t8; + if (temp_t8 >= 0x20) { + arg0->unk1C = 0x20; + return; + } } default: return; case 3: - if (arg0->unk0 == (gCupSelection + 0x53)) { + if (arg0->type == (gCupSelection + 0x53)) { arg0->unk4 = 2; } - /* Duplicate return node #13. Try simplifying control flow for better match */ - return; + break; } } #else @@ -15090,40 +14944,42 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB098.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800A91D8(s16, s16); /* extern */ static ? D_800E7148; /* unable to generate initializer; const */ -void func_800AB164(void *arg0) { +void func_800AB164(struct_8018D9E0_entry *arg0) { void *sp1C; - u32 temp_t1; + s32 temp_t1; void *temp_v0; void *temp_v0_2; - if (arg0->unk0 == (gCupSelection + 0x53)) { - arg0->unk14 = 0xA; + if (arg0->type == (gCupSelection + 0x53)) { + arg0->priority = 0xA; } else { - arg0->unk14 = 4; + arg0->priority = 4; } temp_t1 = arg0->unk4; switch (temp_t1) { case 0: - temp_v0 = (arg0->unk0 * 8) - 0x298 + &D_800E7148; - arg0->unkC = temp_v0->unk0; - arg0->unk10 = temp_v0->unk2; + temp_v0 = (arg0->type * 8) - 0x298 + &D_800E7148; + arg0->column = (s32) temp_v0->unk0; + arg0->row = (s32) temp_v0->unk2; return; case 2: func_800A91D8(0x80, 0x3B); return; case 3: - temp_v0_2 = (arg0->unk0 * 8) - 0x298 + &D_800E7148; + temp_v0_2 = (arg0->type * 8) - 0x298 + &D_800E7148; sp1C = temp_v0_2; func_800A91D8(temp_v0_2->unk0, temp_v0_2->unk2); - if ((temp_v0_2->unk0 == arg0->unkC) && (temp_v0_2->unk2 == arg0->unk10)) { + if ((temp_v0_2->unk0 == arg0->column) && (temp_v0_2->unk2 == arg0->row)) { arg0->unk4 = 0; } /* fallthrough */ default: + case 1: + case 4: return; } } @@ -15149,12 +15005,8 @@ void func_800AB290(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800AAEF4(s32, s32, void *); // extern -extern s8 D_8018EDEC; -extern s8 gCupSelection; - -void func_800AB314(void *arg0) { +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +void func_800AB314(struct_8018D9E0_entry *arg0) { s32 sp3C; void *sp24; void **sp1C; @@ -15181,15 +15033,15 @@ void func_800AB314(void *arg0) { arg0 = arg0; temp_a1 = phi_a1 + 1; temp_v1 = phi_v1 + 4; - temp_v1->unk-4 = func_800AAEF4(phi_a1 + 0x5F, phi_a1, arg0); + temp_v1->unk-4 = func_800AAEF4(phi_a1 + 0x5F); phi_v1 = temp_v1; phi_a1 = temp_a1; } while (temp_a1 < 4); - if (gModeSelection != GRAND_PRIX) { + if (gModeSelection != 0) { if (D_8018EDEC != 1) { arg0->unk4 = 0; arg0->unk20 = 0; - if (gCupCourseSelection == CUP_COURSE_ONE) { + if (gCupCourseSelection == 0) { sp24->unk15 = 1; if (arg0->unk1C != 0) { arg0->unk1C = 0; @@ -15197,15 +15049,15 @@ void func_800AB314(void *arg0) { } else { sp24->unk15 = 0; } - if (gCupCourseSelection == CUP_COURSE_TWO) { + if (gCupCourseSelection == 1) { sp28->unk15 = 1; if (arg0->unk1C != 1) { - arg0->unk1C = 1; + arg0->unk1C = (s32) 1; } } else { sp28->unk15 = 0; } - if (gCupCourseSelection == CUP_COURSE_THREE) { + if (gCupCourseSelection == 2) { sp2C->unk15 = 1; if (arg0->unk1C != 2) { arg0->unk1C = 2; @@ -15213,192 +15065,191 @@ void func_800AB314(void *arg0) { } else { sp2C->unk15 = 0; } - if (gCupCourseSelection == CUP_COURSE_FOUR) { + if (gCupCourseSelection == 3) { sp30->unk15 = 1; if (arg0->unk1C != 3) { arg0->unk1C = 3; + } + } else { + sp30->unk15 = 0; + } + } else { + arg0->unk4 = 3; + sp24->unk15 = 1; + sp24->unk14 = 6; + sp28->unk15 = 1; + sp28->unk14 = 6; + sp2C->unk15 = 1; + sp2C->unk14 = 6; + sp30->unk15 = 1; + sp30->unk14 = 6; + } + } else { + temp_v0 = arg0->unk4; + phi_v0 = temp_v0; + phi_a0 = 1; + switch (temp_v0) { /* irregular */ + case 0: + if (((s32) arg0->unk1C / 4) == gCupSelection) { + temp_t5 = arg0->unk20 + 1; + arg0->unk20 = temp_t5; + if (temp_t5 >= 0x33) { + arg0->unk4 = 1; + arg0->unk20 = 0; + arg0->unk1C = (gCupSelection * 4) + 1; + } + } else { + arg0->unk20 = 0; + arg0->unk1C = gCupSelection * 4; + } + phi_a0 = 1; + if (D_8018EDEC == 3) { + arg0->unk4 = 2; + arg0->unk20 = 0; + } + phi_v0 = arg0->unk4; + break; + case 1: + if (((s32) arg0->unk1C / 4) != gCupSelection) { + arg0->unk4 = 0; + arg0->unk20 = 0; + arg0->unk1C = 0; + phi_v0 = 0; + } else { + temp_t2 = arg0->unk20 + 1; + arg0->unk20 = temp_t2; + if (temp_t2 >= 0x1F) { + arg0->unk20 = 0; + arg0->unk1C = (gCupSelection * 4) + ((s32) (((s32) arg0->unk1C % 4) + 1) % 4); + phi_v0 = arg0->unk4; + } else { + if (D_8018EDEC == 3) { + arg0->unk4 = 2; + arg0->unk20 = 0; + } + phi_v0 = arg0->unk4; + } + } + break; + case 2: + temp_t7 = arg0->unk20 + 1; + arg0->unk20 = temp_t7; + if (temp_t7 >= 0x1A) { + arg0->unk4 = 3; + arg0->unk20 = 0; + } + if (D_8018EDEC != 3) { + arg0->unk4 = 0; + arg0->unk20 = 0; + arg0->unk1C = 0; + } + phi_v0 = arg0->unk4; + break; + case 3: + if (D_8018EDEC != 3) { + arg0->unk4 = 0; + arg0->unk20 = 0; + arg0->unk1C = 0; + phi_v0 = 0; + } + break; + } + if ((phi_v0 != 0) && (phi_v0 != phi_a0)) { + if (phi_v0 != 2) { + if (phi_v0 != 3) { return; } - // Duplicate return node #80. Try simplifying control flow for better match + sp24->unk15 = phi_a0; + sp24->unk14 = 6; + sp28->unk15 = phi_a0; + sp28->unk14 = 6; + sp2C->unk15 = phi_a0; + sp2C->unk14 = 6; + sp30->unk15 = phi_a0; + sp30->unk14 = 6; return; } - sp30->unk15 = 0; + phi_v1_2 = &sp24; + do { + if (phi_a1_2 == ((s32) arg0->unk1C % 4)) { + phi_v1_2->unk0->unk14 = 6; + } else if (arg0->unk20 < (phi_a1_2 * 5)) { + phi_v1_2->unk0->unk14 = 4; + } else { + phi_v1_2->unk0->unk14 = 8; + } + phi_v1_2->unk0->unk15 = phi_a0; + if ((phi_a1_2 + 1) == ((s32) arg0->unk1C % 4)) { + phi_v1_2->unk4->unk14 = 6; + } else if (arg0->unk20 < ((phi_a1_2 * 5) + 5)) { + phi_v1_2->unk4->unk14 = 4; + } else { + phi_v1_2->unk4->unk14 = 8; + } + temp_a1_2 = phi_a1_2 + 2; + phi_v1_2->unk4->unk15 = phi_a0; + phi_a1_2 = temp_a1_2; + phi_v1_2 += 8; + } while (temp_a1_2 != 4); return; } - arg0->unk4 = 3; - sp24->unk15 = 1; - sp24->unk14 = 6; - sp28->unk15 = 1; - sp28->unk14 = 6; - sp2C->unk15 = 1; - sp2C->unk14 = 6; - sp30->unk15 = 1; - sp30->unk14 = 6; - return; - } - temp_v0 = arg0->unk4; - phi_v0 = temp_v0; - phi_a0 = 1; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if (temp_v0 != 3) { - - } else if (D_8018EDEC != 3) { - arg0->unk4 = 0; - arg0->unk20 = 0; - arg0->unk1C = 0; - phi_v0 = 0; - } - } else { - temp_t7 = arg0->unk20 + 1; - arg0->unk20 = temp_t7; - if (temp_t7 >= 0x1A) { - arg0->unk4 = 3; - arg0->unk20 = 0; - } - if (D_8018EDEC != 3) { - arg0->unk4 = 0; - arg0->unk20 = 0; - arg0->unk1C = 0; - } - phi_v0 = arg0->unk4; - } - } else if ((arg0->unk1C / 4) != gCupSelection) { - arg0->unk4 = 0; - arg0->unk20 = 0; - arg0->unk1C = 0; - phi_v0 = 0; - } else { - temp_t2 = arg0->unk20 + 1; - arg0->unk20 = temp_t2; - if (temp_t2 >= 0x1F) { - arg0->unk20 = 0; - arg0->unk1C = (gCupSelection * 4) + (((arg0->unk1C % 4) + 1) % 4); - phi_v0 = arg0->unk4; - } else { - if (D_8018EDEC == 3) { - arg0->unk4 = 2; - arg0->unk20 = 0; - } - phi_v0 = arg0->unk4; - } - } - } else { - if ((arg0->unk1C / 4) == gCupSelection) { - temp_t5 = arg0->unk20 + 1; - arg0->unk20 = temp_t5; - if (temp_t5 >= 0x33) { - arg0->unk4 = 1; - arg0->unk20 = 0; - arg0->unk1C = (gCupSelection * 4) + 1; - } - } else { - arg0->unk20 = 0; - arg0->unk1C = gCupSelection * 4; - } - phi_a0 = 1; - if (D_8018EDEC == 3) { - arg0->unk4 = 2; - arg0->unk20 = 0; - } - phi_v0 = arg0->unk4; - } - if ((phi_v0 != 0) && (phi_v0 != phi_a0)) { - if (phi_v0 != 2) { - if (phi_v0 != 3) { - return; - } + if ((arg0->unk1C & 3) == 0) { sp24->unk15 = phi_a0; - sp24->unk14 = 6; - sp28->unk15 = phi_a0; - sp28->unk14 = 6; - sp2C->unk15 = phi_a0; - sp2C->unk14 = 6; - sp30->unk15 = phi_a0; - sp30->unk14 = 6; - return; + } else { + sp24->unk15 = 0; } - phi_v1_2 = &sp24; - do { - if (phi_a1_2 == (arg0->unk1C % 4)) { - phi_v1_2->unk0->unk14 = 6; - } else if (arg0->unk20 < (phi_a1_2 * 5)) { - phi_v1_2->unk0->unk14 = 4; - } else { - phi_v1_2->unk0->unk14 = 8; - } - phi_v1_2->unk0->unk15 = phi_a0; - if ((phi_a1_2 + 1) == (arg0->unk1C % 4)) { - phi_v1_2->unk4->unk14 = 6; - } else if (arg0->unk20 < ((phi_a1_2 * 5) + 5)) { - phi_v1_2->unk4->unk14 = 4; - } else { - phi_v1_2->unk4->unk14 = 8; - } - temp_a1_2 = phi_a1_2 + 2; - phi_v1_2->unk4->unk15 = phi_a0; - phi_a1_2 = temp_a1_2; - phi_v1_2 += 8; - } while (temp_a1_2 != 4); - return; + sp24->unk14 = 6; + if (((s32) arg0->unk1C % 4) == 1) { + sp28->unk15 = phi_a0; + } else { + sp28->unk15 = 0; + } + sp28->unk14 = 6; + if (((s32) arg0->unk1C % 4) == 2) { + sp2C->unk15 = phi_a0; + } else { + sp2C->unk15 = 0; + } + sp2C->unk14 = 6; + if (((s32) arg0->unk1C % 4) == 3) { + sp30->unk15 = phi_a0; + } else { + sp30->unk15 = 0; + } + sp30->unk14 = 6; } - if ((arg0->unk1C & 3) == 0) { - sp24->unk15 = phi_a0; - } else { - sp24->unk15 = 0; - } - sp24->unk14 = 6; - if ((arg0->unk1C % 4) == 1) { - sp28->unk15 = phi_a0; - } else { - sp28->unk15 = 0; - } - sp28->unk14 = 6; - if ((arg0->unk1C % 4) == 2) { - sp2C->unk15 = phi_a0; - } else { - sp2C->unk15 = 0; - } - sp2C->unk14 = 6; - if ((arg0->unk1C % 4) == 3) { - sp30->unk15 = phi_a0; - } else { - sp30->unk15 = 0; - } - sp30->unk14 = 6; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB314.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800A9208(s16); // extern -extern ? D_800E7248; -extern ? D_800E7258; -extern s8 D_8018EDEC; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(s16); /* extern */ +static ? D_800E7248; /* unable to generate initializer; const */ +static ? D_800E7258; /* unable to generate initializer; const */ -void func_800AB904(void *arg0) { +void func_800AB904(struct_8018D9E0_entry *arg0) { s16 temp_a1; s16 temp_a1_2; s8 temp_v0; temp_v0 = D_8018EDEC; - if (temp_v0 != 1) { - if ((temp_v0 != 2) && (temp_v0 != 3)) { + switch (temp_v0) { /* irregular */ + case 1: + temp_a1 = *((arg0->type * 8) - 0x328 + &D_800E7248); + if (temp_a1 != arg0->column) { + func_800A9208(temp_a1); return; } - temp_a1 = *((arg0->unk0 * 8) - 0x328 + &D_800E7258); - if (temp_a1 != arg0->unkC) { - func_800A9208(temp_a1); - } - // Duplicate return node #8. Try simplifying control flow for better match return; - } - temp_a1_2 = *((arg0->unk0 * 8) - 0x328 + &D_800E7248); - if (temp_a1_2 != arg0->unkC) { - func_800A9208(temp_a1_2); + case 2: + case 3: + temp_a1_2 = *((arg0->type * 8) - 0x328 + &D_800E7258); + if (temp_a1_2 != arg0->column) { + func_800A9208(temp_a1_2); + } + break; } } #else @@ -15406,47 +15257,48 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB904.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009A594(s32, ?, s32); // extern -? func_800A91D8(void *, s16, s16); // extern -s32 func_800B54C0(s8, s32); // extern -void *segmented_to_virtual_dupe(void*); // extern -extern ? D_800E7268; -extern ? D_800E7E20; -extern s8 D_8018EDEC; -extern s8 gCupSelection; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +struct _struct_D_800E7268_0x8 { + /* 0x0 */ s16 unk0; /* inferred */ + /* 0x2 */ s16 unk2; /* inferred */ + /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ +}; /* size = 0x8 */ -void func_800AB9B0(void *arg0) { +? func_800A91D8(struct_8018D9E0_entry *, s16, s16); /* extern */ +static struct _struct_D_800E7268_0x8 D_800E7268[0]; /* unable to generate initializer; const */ +static ? D_800E7E20; /* unable to generate initializer; const */ + +void func_800AB9B0(struct_8018D9E0_entry *arg0) { s32 temp_v0_2; s32 temp_v0_3; s8 temp_v0; - void *temp_v1; + struct _struct_D_800E7268_0x8 *temp_v1; temp_v0 = gCupSelection; if (temp_v0 != arg0->unk1C) { - arg0->unk1C = temp_v0; - temp_v0_2 = func_800B54C0(gCupSelection, gCCSelection); + arg0->unk1C = (s32) temp_v0; + temp_v0_2 = func_800B54C0((s32) gCupSelection, gCCSelection); arg0->unk20 = temp_v0_2; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E20 + (((gCCSelection / 2) * 0x10) + -(temp_v0_2 * 4))))); - arg0->unkC = D_800E7268.unk0; - arg0->unk10 = D_800E7268.unk2; + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(*(&D_800E7E20 + ((((s32) gCCSelection / 2) * 0x10) + -(s32) (temp_v0_2 * 4))))); + arg0->column = (s32) D_800E7268->unk0; + arg0->row = (s32) D_800E7268->unk2; } temp_v0_3 = arg0->unk4; - temp_v1 = &D_800E7268 + (temp_v0_3 * 8); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 1) { + temp_v1 = &D_800E7268[temp_v0_3]; + switch (temp_v0_3) { /* irregular */ + case 0: + func_800A91D8(arg0, temp_v1->unk0, temp_v1->unk2); + if (D_8018EDEC == 3) { + arg0->unk4 = 1; return; } + return; + case 1: func_800A91D8(arg0, temp_v1->unk0, temp_v1->unk2); if (D_8018EDEC == 1) { arg0->unk4 = 0; } - // Duplicate return node #9. Try simplifying control flow for better match - return; - } - func_800A91D8(arg0, temp_v1->unk0, temp_v1->unk2); - if (D_8018EDEC == 3) { - arg0->unk4 = 1; + break; } } #else @@ -15454,47 +15306,58 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB9B0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E7430; +//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 */ -void func_800ABAE8(void *arg0) { +static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ + +void func_800ABAE8(struct_8018D9E0_entry *arg0) { s32 temp_v0; - void *temp_v0_2; + struct _struct_D_800E7430_0x8 *temp_v0_2; s32 phi_v1; - temp_v0 = arg0->unk0; + temp_v0 = arg0->type; if (temp_v0 == 0x8C) { phi_v1 = 4; } else { phi_v1 = temp_v0 - 0x78; } - temp_v0_2 = (phi_v1 * 8) + &D_800E7430; - arg0->unkC = temp_v0_2->unk0; - arg0->unk10 = temp_v0_2->unk2; + temp_v0_2 = &D_800E7430[phi_v1]; + arg0->column = (s32) temp_v0_2->unk0; + arg0->row = (s32) temp_v0_2->unk2; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABAE8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E7430; -extern s8 gTimeTrialDataCourseIndex; +//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 */ -void func_800ABB24(void *arg0) { +static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ + +void func_800ABB24(struct_8018D9E0_entry *arg0) { s32 temp_t7; s8 temp_v0; - void *temp_v1; + struct _struct_D_800E7430_0x8 *temp_v1; temp_v0 = gTimeTrialDataCourseIndex; - temp_v1 = ((temp_v0 / 4) * 8) + &D_800E7430; - arg0->unkC = temp_v1->unk0 - 2; + temp_v1 = &D_800E7430[(s32) temp_v0 / 4]; + arg0->column = temp_v1->unk0 - 2; temp_t7 = arg0->unk1C + 0x10; - arg0->unk10 = temp_v1->unk2 + ((temp_v0 % 4) * 0x32) + 0x13; + arg0->row = temp_v1->unk2 + (((s32) temp_v0 % 4) * 0x32) + 0x13; arg0->unk1C = temp_t7; if (temp_t7 >= 0x100) { arg0->unk1C = temp_t7 - 0x100; - arg0->unk20 = (arg0->unk20 + 1) % 3; + arg0->unk20 = (s32) (arg0->unk20 + 1) % 3; } } #else @@ -15502,111 +15365,122 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABB24.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E7430; +//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 */ -void func_800ABBCC(void *arg0) { +static struct _struct_D_800E7430_0x8 D_800E7430[0]; /* unable to generate initializer; const */ + +void func_800ABBCC(struct_8018D9E0_entry *arg0) { s32 temp_v0; - void *temp_v1; + struct _struct_D_800E7430_0x8 *temp_v1; - temp_v0 = arg0->unk0 - 0x7C; - temp_v1 = ((temp_v0 / 4) * 8) + &D_800E7430; - arg0->unkC = temp_v1->unk0; - arg0->unk10 = temp_v1->unk2 + ((temp_v0 % 4) * 0x32) + 0x14; + 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; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABBCC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800ABCF4(); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800ABCF4(); /* extern */ extern s8 D_8018EE08; -void func_800ABC38(void *arg0) { +void func_800ABC38(struct_8018D9E0_entry *arg0) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; func_800ABCF4(); temp_v0 = D_80164A28; - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { - goto block_13; - } - temp_v0_2 = arg0->unk10; - if (temp_v0_2 >= -0x13) { - arg0->unk10 = temp_v0_2 - 2; - return; - } - goto block_13; - } - temp_v0_3 = arg0->unk10; - if (temp_v0_3 >= -0x13) { - arg0->unk10 = temp_v0_3 - 2; + switch (temp_v0) { /* irregular */ + case 1: + arg0->visible = 1; + return; + case 2: + temp_v0_2 = arg0->row; + if (temp_v0_2 >= -0x13) { + arg0->row = temp_v0_2 - 2; return; } block_13: - arg0->unk0 = 0; + arg0->type = 0; return; + default: + if ((gModeSelection != 0) || (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; + } + goto block_13; } - arg0->unk15 = 1; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABC38.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 get_string_width(s32); // extern -? func_800A9208(void *, s32); // extern -extern s32 D_800DC540; -extern ? D_800E7500; -extern f64 D_800F2630; -extern f64 D_800F2638; -extern f64 D_800F2640; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ +s8 *D_800E7500[9] = { + "mushroom cup", + "flower cup", + "star cup", + "special cup", + "battle", + "mushroom cup", + "flower cup", + "star cup", + "special cup", +}; /* const */ -void func_800ABCF4(void *arg0) { +void func_800ABCF4(struct_8018D9E0_entry *arg0) { f64 temp_f0; s32 temp_t1; s32 temp_t1_2; s32 temp_v0; temp_v0 = arg0->unk4; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - return; - } - func_800A9208(arg0, arg0->unk20); - temp_t1 = arg0->unk18 + 1; - temp_f0 = temp_t1 - 0xA; - arg0->unk1C = (arg0->unk20 - arg0->unkC) / 4; - arg0->unk18 = temp_t1; - arg0->unk24 = (temp_f0 * D_800F2638 * temp_f0) + D_800F2640; - if ((temp_t1 >= 9) && (arg0->unk24 > 1.0)) { - arg0->unk24 = 1.0f; - } - // Duplicate return node #12. Try simplifying control flow for better match + switch (temp_v0) { /* irregular */ + case 0: + arg0->column = 0; + arg0->unk4 = 1; + arg0->unk20 = (get_string_width(D_800E7500[D_800DC540]) / 2) + 0xA0; + /* fallthrough */ + case 1: + func_800A9208(arg0, arg0->unk20); + temp_t1 = (s32) (arg0->unk20 - arg0->column) / 4; + arg0->unk1C = temp_t1; + if (temp_t1 >= 9) { + arg0->unk1C = 8; + } + arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + if (arg0->column >= (arg0->unk20 - 0x14)) { + arg0->unk4 = 2; + arg0->D_8018DEE0_index = 0; return; } - goto block_5; - } - arg0->unkC = 0; - arg0->unk4 = 1; - arg0->unk20 = (get_string_width(*(&D_800E7500 + (D_800DC540 * 4))) / 2) + 0xA0; -block_5: - func_800A9208(arg0, arg0->unk20); - temp_t1_2 = (arg0->unk20 - arg0->unkC) / 4; - arg0->unk1C = temp_t1_2; - if (temp_t1_2 >= 9) { - arg0->unk1C = 8; - } - arg0->unk24 = (arg0->unk1C * D_800F2630) + 1.0; - if (arg0->unkC >= (arg0->unk20 - 0x14)) { - arg0->unk4 = 2; - arg0->unk18 = 0; + return; + case 2: + func_800A9208(arg0, arg0->unk20); + temp_t1_2 = arg0->D_8018DEE0_index + 1; + temp_f0 = (f64) (temp_t1_2 - 0xA); + arg0->unk1C = (s32) (arg0->unk20 - arg0->column) / 4; + arg0->D_8018DEE0_index = temp_t1_2; + arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + if ((temp_t1_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { + arg0->unk24 = 1.0f; + } + break; } } #else @@ -15614,93 +15488,111 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABCF4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800ABF68(); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800ABF68(); /* extern */ extern s8 D_8018EE08; -void func_800ABEAC(void *arg0) { +void func_800ABEAC(struct_8018D9E0_entry *arg0) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; func_800ABF68(); temp_v0 = D_80164A28; - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { - goto block_13; - } - temp_v0_2 = arg0->unk10; - if (temp_v0_2 < 0x104) { - arg0->unk10 = temp_v0_2 + 2; - return; - } - goto block_13; - } - temp_v0_3 = arg0->unk10; - if (temp_v0_3 < 0x104) { - arg0->unk10 = temp_v0_3 + 2; + switch (temp_v0) { /* irregular */ + case 1: + arg0->visible = 1; + return; + case 2: + temp_v0_2 = arg0->row; + if (temp_v0_2 < 0x104) { + arg0->row = temp_v0_2 + 2; return; } block_13: - arg0->unk0 = 0; + arg0->type = 0; return; + default: + if ((gModeSelection != 0) || (gPlayerCountSelection1 != 1U) || (D_8018EE08 != 0)) { + goto block_13; + } + temp_v0_3 = arg0->row; + if (temp_v0_3 < 0x104) { + arg0->row = temp_v0_3 + 2; + return; + } + goto block_13; } - arg0->unk15 = 1; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABEAC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 get_string_width(s32); // extern -? func_800A9208(void *, s32); // extern -extern ? D_800E7524; -extern f64 D_800F2648; -extern f64 D_800F2650; -extern f64 D_800F2658; +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ +s16 gCurrentCourseId; /* unable to generate initializer */ +s8 *D_800E7524[0x14] = { + "mario raceway", + "choco mountain", + "bowser's castle", + "banshee boardwalk", + "yoshi valley", + "frappe snowland", + "koopa troopa beach", + "royal raceway", + "luigi raceway", + "moo moo farm", + "toad's turnpike", + "kalimari desert", + "sherbet land", + "rainbow road", + "wario stadium", + "block fort", + "skyscraper", + "double deck", + "d.k.'s jungle parkway", + "big donut", +}; /* const */ -void func_800ABF68(void *arg0) { +void func_800ABF68(struct_8018D9E0_entry *arg0) { f64 temp_f0; s32 temp_t3; s32 temp_t3_2; s32 temp_v0; temp_v0 = arg0->unk4; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - return; - } - func_800A9208(arg0, arg0->unk20); - temp_t3 = arg0->unk18 + 1; - temp_f0 = temp_t3 - 0xA; - arg0->unk1C = (arg0->unkC - arg0->unk20) / 4; - arg0->unk18 = temp_t3; - arg0->unk24 = (temp_f0 * D_800F2650 * temp_f0) + D_800F2658; - if ((temp_t3 >= 9) && (arg0->unk24 > 1.0)) { - arg0->unk24 = 1.0f; - } - // Duplicate return node #12. Try simplifying control flow for better match + switch (temp_v0) { /* irregular */ + case 0: + arg0->column = 0x140; + arg0->unk4 = 1; + arg0->unk20 = 0xA0 - (get_string_width(D_800E7524[gCurrentCourseId]) / 2); + /* fallthrough */ + case 1: + func_800A9208(arg0, arg0->unk20); + temp_t3 = (s32) (arg0->column - arg0->unk20) / 4; + arg0->unk1C = temp_t3; + if (temp_t3 >= 9) { + arg0->unk1C = 8; + } + arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + if ((arg0->unk20 + 0x14) >= arg0->column) { + arg0->unk4 = 2; + arg0->D_8018DEE0_index = 0; return; } - goto block_5; - } - arg0->unkC = 0x140; - arg0->unk4 = 1; - arg0->unk20 = 0xA0 - (get_string_width(*(&D_800E7524 + (gCurrentCourseId * 4))) / 2); -block_5: - func_800A9208(arg0, arg0->unk20); - temp_t3_2 = (arg0->unkC - arg0->unk20) / 4; - arg0->unk1C = temp_t3_2; - if (temp_t3_2 >= 9) { - arg0->unk1C = 8; - } - arg0->unk24 = (arg0->unk1C * D_800F2648) + 1.0; - if ((arg0->unk20 + 0x14) >= arg0->unkC) { - arg0->unk4 = 2; - arg0->unk18 = 0; + return; + case 2: + func_800A9208(arg0, arg0->unk20); + temp_t3_2 = arg0->D_8018DEE0_index + 1; + temp_f0 = (f64) (temp_t3_2 - 0xA); + arg0->unk1C = (s32) (arg0->column - arg0->unk20) / 4; + arg0->D_8018DEE0_index = temp_t3_2; + arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + if ((temp_t3_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { + arg0->unk24 = 1.0f; + } + break; } } #else @@ -15714,93 +15606,81 @@ void func_800AC300(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800921B4(); // extern -? add_8018D9E0_entry(?, ?, ?, ?); // extern -? func_800A9208(void *, ?); // extern -extern s32 D_800DDB24; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(struct_8018D9E0_entry *, ?); /* extern */ extern s8 D_8018D9D8; +static s32 D_800DDB24 = 1; -void func_800AC324(void *arg0) { +void func_800AC324(struct_8018D9E0_entry *arg0) { s32 temp_t1; s32 temp_v0; s32 temp_v0_2; temp_v0 = arg0->unk4; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - if (temp_v0 != 3) { - return; - } - temp_v0_2 = arg0->unk1C; - arg0->unkC = temp_v0_2; - if (temp_v0_2 < 0x14A) { - if (D_8018D9D8 != 0) { - arg0->unk1C = temp_v0_2 + 0x20; - return; - } - arg0->unk1C = temp_v0_2 + 0x10; - return; - } - arg0->unk0 = 0; - // Duplicate return node #17. Try simplifying control flow for better match - return; - } - temp_t1 = arg0->unk20 + 1; - arg0->unk20 = temp_t1; - if (((D_8018D9D8 != 0) || (temp_t1 >= 0x5B)) && (D_800DDB24 != 0)) { - arg0->unk4 = 3; - arg0->unk1C = arg0->unkC; - add_8018D9E0_entry(0xAB, 0, 0, 0); - return; - } - // Duplicate return node #17. Try simplifying control flow for better match - return; - } + switch (temp_v0) { /* irregular */ + case 0: + arg0->column = 0x14A; + arg0->unk4 = 1; + func_800921B4(); + return; + case 1: func_800A9208(arg0, 0xA0); - if (arg0->unkC == 0xA0) { + if (arg0->column == 0xA0) { arg0->unk4 = 2; arg0->unk20 = 0; return; } return; + case 2: + temp_t1 = arg0->unk20 + 1; + arg0->unk20 = temp_t1; + if (((D_8018D9D8 != 0) || (temp_t1 >= 0x5B)) && (D_800DDB24 != 0)) { + arg0->unk4 = 3; + arg0->unk1C = arg0->column; + add_8018D9E0_entry(0xAB, 0, 0, 0); + return; + } + break; + case 3: + temp_v0_2 = arg0->unk1C; + arg0->column = temp_v0_2; + if (temp_v0_2 < 0x14A) { + if (D_8018D9D8 != 0) { + arg0->unk1C = temp_v0_2 + 0x20; + return; + } + arg0->unk1C = temp_v0_2 + 0x10; + return; + } + arg0->type = 0; + break; } - arg0->unkC = 0x14A; - arg0->unk4 = 1; - func_800921B4(); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AC324.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -s8 *func_800921B4(); /* extern */ -s8 *func_800B536C(s32, s32, s32, void *); /* extern */ -s8 *func_800CA330(?, s32); /* extern */ -s8 *play_sound2(?, s32, u8 *, void *); /* extern */ -extern s8 D_800DC5EC; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800B536C(s32, s32, s32, struct_8018D9E0_entry *); /* extern */ +? func_800CA330(?, s32); /* extern */ +? play_sound2(?, s32, u8 *, struct_8018D9E0_entry *); /* extern */ +extern void *D_800DC5EC; extern void *D_800DC5F0; extern s16 D_8015F894; extern ? D_80164360; extern ? D_80164478; -extern s8 D_8018D9BC; +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 */ +static s8 gGP1stPlaceReward = 9; /* const */ +static s8 gGP2ndPlaceReward = 6; /* const */ +static s8 gGP3rdPlaceReward = 3; /* const */ +static s8 gGP4thPlaceReward = 1; /* const */ - -//Something related to the point allotment screens at the end of a grand prix race -// Its unclear what exactly arg0 is, although unk4 of that struct(?) appears to be -// a form of a "current state" tracker. Each time this function runs it -// advances which "state" its in -s8 *func_800AC458(void *arg0) { - s32 place; +void func_800AC458(struct_8018D9E0_entry *arg0) { + s32 sp1C; s32 sp18; s32 temp_a1; s32 temp_a1_2; @@ -15813,43 +15693,39 @@ s8 *func_800AC458(void *arg0) { s32 temp_t5; s32 temp_t7; s32 temp_t8; + s32 temp_v0; s32 temp_v0_3; - s32 temp_v0_6; - s8 *temp_v0; - s8 *temp_v0_4; - s8 *temp_v0_5; - u16 temp_t4; - u32 temp_v0_2; + s32 temp_v0_4; + s8 *temp_v1_2; + struct_8018D9E0_entry *temp_a3; u8 *temp_a2_2; u8 temp_t0; - void *temp_a3; + void *temp_v0_2; + void *temp_v0_5; void *temp_v1; - void *temp_v1_2; + void *temp_v1_3; s32 phi_a0; - void *phi_a3; + struct_8018D9E0_entry *phi_a3; s32 phi_t1; s8 *phi_v0; s32 phi_a1; - s8 *phi_v0_2; - temp_v0_2 = arg0->unk4; + temp_v0 = arg0->unk4; temp_a3 = arg0; phi_a3 = temp_a3; - phi_v0_2 = temp_v0_2; - switch (temp_v0_2) { + switch (temp_v0) { case 0: - temp_a3->unkC = -0xA0; + temp_a3->column = -0xA0; temp_a3->unk4 = 1; - // Copy point rewards from data to some temp memory - D_8018D9BC->unk0 = gGP1stPlaceReward; - D_8018D9BC->unk1 = gGP2ndPlaceReward; - D_8018D9BC->unk2 = gGP3rdPlaceReward; - D_8018D9BC->unk3 = gGP4thPlaceReward; - temp_a3->unk20 = temp_a3->unkC; - return &D_8018D9BC; + 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; + return; case 1: temp_a1 = temp_a3->unk20; - temp_a3->unkC = temp_a1; + temp_a3->column = temp_a1; phi_a0 = 0x10; if (D_8018D9D8 != 0) { phi_a0 = 0x20; @@ -15857,51 +15733,48 @@ s8 *func_800AC458(void *arg0) { temp_a2 = temp_a1 + phi_a0; if (temp_a2 < 0) { temp_a3->unk20 = temp_a2; - temp_v0 = D_800DC5EC; - temp_v0->unk30 = temp_v0->unk30 + phi_a0; + temp_v0_2 = D_800DC5EC; + temp_v0_2->unk30 = (s16) (temp_v0_2->unk30 + phi_a0); temp_v1 = D_800DC5F0; - temp_v1->unk30 = temp_v1->unk30 - phi_a0; - return temp_v0; + temp_v1->unk30 = (s16) (temp_v1->unk30 - phi_a0); + return; } temp_a3->unk20 = 0; - temp_a3->unkC = 0; + temp_a3->column = 0; temp_a3->unk4 = 2; temp_a3->unk1C = 0; D_800DC5EC->unk30 = 0xF0; D_800DC5F0->unk30 = 0x50; - return &D_800DC5EC; + return; case 2: - temp_a3->unkC = 0; + temp_a3->column = 0; temp_t5 = temp_a3->unk1C + 1; temp_a3->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; - return temp_v0_2; + return; } default: - return phi_v0_2; - // Allocating point rewards for the players that finished the race - // in 1st, 2nd, 3rd and 4th place + return; case 3: case 4: case 5: case 6: temp_t3 = temp_a3->unk1C + 1; - // Using the "state" variable to deduce which player we're allocating points for - temp_a1_2 = temp_v0_2 - 3; + temp_a1_2 = temp_v0 - 3; temp_a3->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 (temp_t0 > 0) { + if ((s32) temp_t0 > 0) { *temp_a2_2 = temp_t0 - 1; - temp_t4 = *(&gPlayers->characterId + (*(&D_80164360 + (temp_a1_2 * 2)) * 0xDD8)); + temp_v1_2 = &gGPPointsByCharacterId[*(&gPlayers->characterId + (*(&D_80164360 + (temp_a1_2 * 2)) * 0xDD8))]; sp18 = 0; arg0 = temp_a3; - gGPPointsByCharacterId[temp_t4] += 1; - place = temp_a1_2; + *temp_v1_2 += 1; + sp1C = temp_a1_2; play_sound2(0x49008017, temp_a1_2, temp_a2_2, temp_a3); phi_a3 = arg0; if ((*(D_8018D9BC + temp_a1_2) == 0) && (arg0->unk20 == 0)) { @@ -15911,34 +15784,30 @@ s8 *func_800AC458(void *arg0) { } } phi_t1 = 0; - phi_v0_2 = &D_8018D9BC; - if ((phi_a3->unk20 != 0) && ((temp_v0_6 = phi_a3->unk1C, phi_v0_2 = temp_v0_6, ((temp_v0_6 < 0xB) == 0)) || ((D_8018D9D8 != 0) && (temp_v0_6 >= 4)))) { + 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 (phi_t1 != 0) { - temp_v0_3 = phi_a3->unk4; + temp_v0_4 = phi_a3->unk4; phi_a3->unk20 = 0; phi_a3->unk1C = 0; - // If not done alloting points - if (temp_v0_3 < 6) { - phi_a3->unk4 = temp_v0_3 + 1; - return temp_v0_3; + if (temp_v0_4 < 6) { + phi_a3->unk4 = temp_v0_4 + 1; + return; } phi_a3->unk4 = 7; - return temp_v0_3; + return; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + 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; - return temp_v0_2; + return; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + break; case 8: temp_t8 = temp_a3->unk1C + 1; temp_a3->unk1C = temp_t8; @@ -15947,61 +15816,64 @@ s8 *func_800AC458(void *arg0) { } if (temp_a3->unk1C >= 0x29) { temp_a3->unk4 = 9; - return temp_v0_2; + return; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + break; case 9: temp_t7 = temp_a3->unk1C - 1; temp_a3->unk1C = temp_t7; if (D_8018D9D8 != 0) { temp_a3->unk1C = temp_t7 - 5; } - if ((temp_a3->unk1C <= 0) && (temp_a3->unk4 = 0xA, temp_a3->unk1C = 0, phi_a1 = 0, phi_v0_2 = gCharacterIdByGPOverallRank, (gCupCourseSelection == CUP_COURSE_FOUR))) { - phi_v0 = gCharacterIdByGPOverallRank; + if (temp_a3->unk1C <= 0) { + temp_a3->unk4 = 0xA; + temp_a3->unk1C = 0; + phi_a1 = 0; + if (gCupCourseSelection == 3) { + phi_v0 = gCharacterIdByGPOverallRank; loop_41: - if (*(&D_80164478 + (*phi_v0 * 2)) < D_8018EDF3) { - return func_800B536C(phi_a1, phi_a1, 8, temp_a3); + if ((s32) *(&D_80164478 + (*phi_v0 * 2)) < (s32) D_8018EDF3) { + func_800B536C(phi_a1, phi_a1, 8, temp_a3); + return; + } + temp_a1_3 = phi_a1 + 1; + phi_v0 += 1; + phi_a1 = temp_a1_3; + if (temp_a1_3 == 8) { + return; + } + goto loop_41; } - temp_a1_3 = phi_a1 + 1; - temp_v0_4 = phi_v0 + 1; - phi_v0 = temp_v0_4; - phi_a1 = temp_a1_3; - if (temp_a1_3 == 8) { - return temp_v0_4; - } - goto loop_41; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + break; case 10: temp_t3_2 = temp_a3->unk1C + 1; temp_a3->unk1C = temp_t3_2; if (temp_t3_2 > 0) { temp_a3->unk4 = 0xB; temp_a3->unk1C = 0; - return func_800921B4(); + func_800921B4(); + return; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + break; case 11: if ((D_8018D9D8 != 0) && (D_800DDB24 != 0)) { temp_a3->unk4 = 0xC; - temp_a3->unk20 = temp_a3->unk10; - return play_sound2(0x49008015); + temp_a3->unk20 = temp_a3->row; + play_sound2(0x49008015); + return; } - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + break; case 12: temp_a1_4 = temp_a3->unk20; - temp_a3->unk10 = temp_a1_4; + 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 = temp_v0_5->unk32 + 0x10; - temp_v1_2 = D_800DC5F0; - temp_v1_2->unk32 = temp_v1_2->unk32 - 0x10; - return temp_v0_5; + 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); + return; } temp_a3->unk20 = 0; temp_a3->unk4 = 0xD; @@ -16009,9 +15881,8 @@ loop_41: D_800DC5EC->unk32 = 0x12C; D_800DC5F0->unk32 = -0x3C; D_8015F894 = 4; - phi_v0_2 = func_800CA330(0x19, temp_a1_4); - /* Duplicate return node #53. Try simplifying control flow for better match */ - return phi_v0_2; + func_800CA330(0x19, temp_a1_4); + break; } } #else @@ -16042,17 +15913,13 @@ void func_800AC978(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009DFE0(?, void *); // extern -s32 func_800B4520(void *); // extern -? func_800CA330(?); // extern -? play_sound2(?, void *); // extern +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_8009DFE0(?, struct_8018D9E0_entry *); /* extern */ +? func_800CA330(?); /* extern */ +? play_sound2(?, struct_8018D9E0_entry *); /* extern */ extern void *gControllerFive; -extern f64 D_800F26C0; -extern f64 D_800F26C8; -extern f64 D_800F26D0; -void func_800ACA14(void *arg0) { +void func_800ACA14(struct_8018D9E0_entry *arg0) { f64 temp_f0; f64 temp_f0_2; f64 temp_f0_3; @@ -16060,92 +15927,31 @@ void func_800ACA14(void *arg0) { s32 temp_v0; 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_a1; - void *temp_a1_2; void *temp_t5; void *temp_v0_2; s32 phi_a0; - void *phi_a1; + struct_8018D9E0_entry *phi_a1; u16 phi_v1; - void *phi_a1_2; + struct_8018D9E0_entry *phi_a1_2; s32 phi_v0; - void *phi_a1_3; - void *phi_a1_4; + struct_8018D9E0_entry *phi_a1_3; + struct_8018D9E0_entry *phi_a1_4; temp_v0 = arg0->unk4; temp_a1 = arg0; phi_a1_3 = temp_a1; phi_a1_4 = temp_a1; - if (temp_v0 != 0) { - if ((temp_v0 != 0xB) && (temp_v0 != 0xC)) { - phi_v0 = arg0->unk20; - } else { - arg0 = temp_a1; - temp_a1_2 = arg0; - phi_a1 = temp_a1_2; - phi_a1_4 = temp_a1_2; - if (func_800B4520(temp_a1) != 0) { - - } 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(0x49008000, temp_a1_2); - temp_f0 = arg0->unk24; - phi_a1 = arg0; - if (temp_f0 < D_800F26C0) { - arg0->unk24 = 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; - } - } - 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(0x49008000, phi_a1); - temp_f0_2 = arg0->unk24; - phi_a1_2 = arg0; - if (temp_f0_2 < D_800F26C8) { - arg0->unk24 = temp_f0_2 + 4.0; - } - arg0->unk8 = 1; - phi_v1 = gControllerFive->unk6; - } - } - 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(0x4900801B); - temp_f0_3 = arg0->unk24; - phi_a1_4 = arg0; - if (temp_f0_3 < D_800F26D0) { - arg0->unk24 = temp_f0_3 + 4.0; - } - } - } - goto block_24; - } - } else { + switch (temp_v0) { /* irregular */ + default: + phi_v0 = arg0->unk20; + break; + case 0: if (temp_a1->unk20 >= 0xB) { - temp_a1->unk1C = temp_a1->unk1C + 3; + temp_a1->unk1C += 3; } if (temp_a1->unk1C >= 0x65) { temp_a1->unk4 = 0xB; @@ -16154,6 +15960,69 @@ void func_800ACA14(void *arg0) { block_24: phi_v0 = phi_a1_4->unk20; phi_a1_3 = phi_a1_4; + 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) { + + } 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(0x49008000, temp_a1_2); + 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; + } + } + 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(0x49008000, phi_a1); + 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; + } + } + 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(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; } if (phi_v0 < 0x28) { phi_a1_3->unk20 = phi_v0 + 1; @@ -16164,72 +16033,78 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ACA14.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009DFE0(?, void *); /* extern */ -? add_8018D9E0_entry(s32, ?, ?, s8); /* extern */ -void *func_800AAEF4(?, void *); /* extern */ -? play_sound2(?, void *); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_8009DFE0(?, struct_8018D9E0_entry *); /* extern */ +? play_sound2(?, struct_8018D9E0_entry *); /* extern */ +extern s8 D_8018EDF3; +extern s8 D_8018EDF4; +extern s8 D_8018EDF6; +extern void *gControllerFive; -void func_800ACC50(void *arg0) { +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_2; s32 temp_v0_3; + struct_8018D9E0_entry *temp_a1; + struct_8018D9E0_entry *temp_a1_2; u16 temp_v1; u16 temp_v1_2; - u32 temp_t6; - u32 temp_v0_2; - void *temp_a1; - void *temp_a1_2; void *temp_t8_2; void *temp_v0; s32 phi_s0; s32 phi_a0; - void *phi_a1; + struct_8018D9E0_entry *phi_a1; u16 phi_v1; - void *phi_a1_2; + struct_8018D9E0_entry *phi_a1_2; + temp_t6 = arg0->unk4; temp_a1 = arg0; switch (temp_t6) { case 0: temp_t8 = temp_a1->unk1C + 3; temp_a1->unk1C = temp_t8; - if ((temp_t8 >= 0x65) && (temp_a1->unk4 = 1, temp_a1->unk1C = 0, phi_s0 = 0, (D_8018EDF3 > ZERO_PLAYERS_SELECTED))) { - do { - add_8018D9E0_entry(phi_s0 + 0xB1, 0, 0, 5 - phi_s0); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 < D_8018EDF3); - return; + if (temp_t8 >= 0x65) { + temp_a1->unk4 = 1; + temp_a1->unk1C = 0; + phi_s0 = 0; + if ((s32) 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); + return; + } } default: return; case 1: arg0 = temp_a1; - if (func_800AAEF4(0xB1, temp_a1)->unk4 >= 2) { + if (func_800AAEF4(0xB1)->unk4 >= 2) { arg0->unk4 = 2; return; } - /* Duplicate return node #30. Try simplifying control flow for better match */ - return; + break; case 2: temp_t9 = temp_a1->unk1C + 0x20; temp_a1->unk1C = temp_t9; if (temp_t9 >= 0x100) { - if (gModeSelection == VERSUS) { - temp_a1->unk4 = D_8018EDF4; + if (gModeSelection == 2) { + temp_a1->unk4 = (s32) D_8018EDF4; } else { - temp_a1->unk4 = D_8018EDF6; + temp_a1->unk4 = (s32) D_8018EDF6; } temp_a1->unk1C = 0; return; } - /* Duplicate return node #30. Try simplifying control flow for better match */ - return; + break; case 10: case 11: case 12: @@ -16237,7 +16112,7 @@ void func_800ACC50(void *arg0) { arg0 = temp_a1; temp_a1_2 = arg0; phi_a1 = temp_a1_2; - if (func_800B4520(arg0) == 0) { + if (func_800B4520(temp_a1) == 0) { temp_v0 = gControllerFive; temp_v1 = temp_v0->unk6; temp_a0 = temp_v1 | temp_v0->unkC; @@ -16249,10 +16124,10 @@ void func_800ACC50(void *arg0) { temp_a1_2->unk4 = temp_v0_2 - 1; arg0 = temp_a1_2; play_sound2(0x49008000, temp_a1_2); - temp_f0 = arg0->unk24; + temp_f0 = (f64) arg0->unk24; phi_a1 = arg0; if (temp_f0 < 4.2) { - arg0->unk24 = temp_f0 + 4.0; + arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; temp_t8_2 = gControllerFive; @@ -16268,10 +16143,10 @@ void func_800ACC50(void *arg0) { phi_a1->unk4 = temp_v0_3 + 1; arg0 = phi_a1; play_sound2(0x49008000, phi_a1); - temp_f0_2 = arg0->unk24; + temp_f0_2 = (f64) arg0->unk24; phi_a1_2 = arg0; if (temp_f0_2 < 4.2) { - arg0->unk24 = temp_f0_2 + 4.0; + arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; phi_v1 = gControllerFive->unk6; @@ -16281,19 +16156,18 @@ void func_800ACC50(void *arg0) { arg0 = phi_a1_2; func_8009DFE0(0x1E, phi_a1_2); play_sound2(0x49008016); - if (gModeSelection == VERSUS) { - D_8018EDF4 = arg0->unk4; + if (gModeSelection == 2) { + D_8018EDF4 = (s8) arg0->unk4; } else { - D_8018EDF6 = arg0->unk4; + D_8018EDF6 = (s8) arg0->unk4; } - temp_f0_3 = arg0->unk24; + temp_f0_3 = (f64) arg0->unk24; if (temp_f0_3 < 4.2) { - arg0->unk24 = temp_f0_3 + 4.0; + arg0->unk24 = (f32) (temp_f0_3 + 4.0); } } } - /* Duplicate return node #30. Try simplifying control flow for better match */ - return; + break; } } #else @@ -16301,25 +16175,42 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ACC50.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009A640(s32, ?, s32, s32); /* extern */ -? func_800A9208(void *, s16, s32); /* extern */ -? func_800A9278(void *, s16); /* extern */ -void *func_800AAEF4(?, s8, s32); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(struct_8018D9E0_entry *, s16, s32); /* extern */ +? func_800A9278(struct_8018D9E0_entry *, s16); /* extern */ ? func_800C90F4(s32, s32, s32); /* extern */ ? func_800CA24C(s32); /* extern */ -extern ? gPlayerPositions; extern ? D_8018DEE4; +extern s8 D_8018EDF3; +extern s32 gPlayerWinningIndex; static ? D_800E72F8; /* unable to generate initializer; const */ static ? D_800E7300; /* unable to generate initializer; const */ -static ? D_800E8380; /* unable to generate initializer; const */ -static ? D_800E83A0; /* unable to generate initializer; const */ -static ? D_800E8440; /* unable to generate initializer; const */ +static MkAnimation *D_800E8380[8] = { + D_02006718, + D_02006900, + D_02006CD0, + D_02006EB8, + D_020070A0, + D_02007290, + D_02007478, + D_02006AE8, +}; /* const */ +static MkAnimation *D_800E83A0[8] = { + D_02006778, + D_02006960, + D_02006D30, + D_02006F18, + D_02007100, + D_020072F0, + D_020074D8, + D_02006B48, +}; /* const */ +static s32 D_800E8440[8] = { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }; /* const */ static ? D_800E85F7; /* unable to generate initializer; const */ -static ? gCharacterSelections; /* unable to generate initializer; const */ static ? D_800EFD64; /* unable to generate initializer; const */ +s8 gCharacterSelections[4]; /* unable to generate initializer; const */ -void func_800ACF40(void *arg0) { +void func_800ACF40(struct_8018D9E0_entry *arg0) { s16 *sp3C; s32 sp38; s32 sp34; @@ -16327,30 +16218,29 @@ void func_800ACF40(void *arg0) { s16 *temp_v0_2; s32 temp_a0; s32 temp_a2; + s32 temp_t7; s32 temp_t7_2; s32 temp_v0; s32 temp_v0_3; - s32 temp_v0_4; s8 temp_a1; - u32 temp_t7; s32 phi_v1; - temp_v0 = arg0->unk0; + temp_v0 = arg0->type; temp_t7 = arg0->unk4; temp_a1 = *(&D_800EFD64 + *(&D_800E85F7 + temp_v0)); temp_a2 = temp_v0 - 0xB1; switch (temp_t7) { case 0: - arg0->unkC = D_800E72F8.unk0; + arg0->column = (s32) D_800E72F8.unk0; arg0->unk4 = 1; - arg0->unk10 = D_800E72F8.unk2; + arg0->row = (s32) D_800E72F8.unk2; return; case 1: temp_v0_2 = ((D_8018EDF3 << 5) + (temp_a2 * 8)) - 0x40 + &D_800E7300; sp3C = temp_v0_2; func_800A9208(arg0, *temp_v0_2, temp_a2); func_800A9278(arg0, sp3C->unk2); - if (sp3C->unk0 == arg0->unkC) { + if (sp3C->unk0 == arg0->column) { arg0->unk4 = 2; arg0->unk20 = 0; return; @@ -16360,37 +16250,45 @@ void func_800ACF40(void *arg0) { case 2: temp_v0_3 = gModeSelection; phi_v1 = 0; - if (temp_v0_3 != 2) { - if (temp_v0_3 != 3) { - - } else if (temp_a2 != gPlayerWinningIndex) { + switch (temp_v0_3) { /* switch 1; irregular */ + case 2: /* switch 1 */ + if (gPlayerPositions[temp_a2] != 0) { +block_11: + phi_v1 = 1; + } + break; + case 3: /* switch 1 */ + if (temp_a2 != gPlayerWinningIndex) { goto block_11; } - } else if (*(&gPlayerPositions + (temp_a2 * 4)) != 0) { -block_11: - phi_v1 = 1; + break; } - if ((phi_v1 == 0) && (temp_t7_2 = arg0->unk20 + 1, arg0->unk20 = temp_t7_2, ((temp_t7_2 < 0x1F) == 0)) && (sp34 = temp_a1, sp38 = temp_a2, ((func_800AAEF4(0xB0, temp_a1, temp_a2)->unk4 < 2) == 0))) { - sp38 = temp_a2; - func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); - arg0->unk4 = 3; - temp_a0 = temp_a2 & 0xFF; - sp24 = temp_a0; - func_800CA24C(temp_a0); - func_800C90F4(temp_a0, (*(&gCharacterSelections + temp_a2) * 0x10) + 0x29008007, temp_a2); - return; + if (phi_v1 == 0) { + temp_t7_2 = arg0->unk20 + 1; + arg0->unk20 = temp_t7_2; + if (temp_t7_2 >= 0x1F) { + sp34 = (s32) temp_a1; + sp38 = temp_a2; + if (func_800AAEF4(0xB0)->unk4 >= 2) { + sp38 = temp_a2; + func_8009A640(arg0->D_8018DEE0_index, 0, temp_a2, segmented_to_virtual_dupe(D_800E8380[temp_a1])); + arg0->unk4 = 3; + temp_a0 = temp_a2 & 0xFF; + sp24 = temp_a0; + func_800CA24C(temp_a0); + func_800C90F4(temp_a0, (gCharacterSelections[temp_a2] * 0x10) + 0x29008007, temp_a2); + return; + } + } } - /* Duplicate return node #18. Try simplifying control flow for better match */ - return; + break; case 3: - temp_v0_4 = temp_a1 * 4; - if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v0_4)) { + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= D_800E8440[temp_a1]) { sp38 = temp_a2; - func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v0_4))); + func_8009A640(arg0->D_8018DEE0_index, 0, temp_a2, segmented_to_virtual_dupe(D_800E83A0[temp_a1])); arg0->unk4 = 4; } - /* Duplicate return node #18. Try simplifying control flow for better match */ - return; + break; } } #else @@ -16398,27 +16296,26 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ACF40.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_800921B4(); /* extern */ -? add_8018D9E0_entry(?, ?, ?, ?); /* extern */ -? func_800A9208(void *, ?); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(struct_8018D9E0_entry *, ?); /* extern */ +extern s8 D_8018D9D8; -void func_800AD1A4(void *arg0) { +void func_800AD1A4(struct_8018D9E0_entry *arg0) { s32 temp_t2; + s32 temp_t6; s32 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: - arg0->unkC = 0x14A; + arg0->column = 0x14A; arg0->unk4 = 1; func_800921B4(); add_8018D9E0_entry(0xBB, 0, 0, 0); return; case 1: func_800A9208(arg0, 0xA0); - if (arg0->unkC == 0xA0) { + if (arg0->column == 0xA0) { arg0->unk4 = 2; arg0->unk20 = 0; return; @@ -16432,21 +16329,19 @@ void func_800AD1A4(void *arg0) { arg0->unk4 = 3; return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 3: if (D_8018D9D8 != 0) { func_800921B4(); arg0->unk4 = 4; - arg0->unk1C = arg0->unkC; + arg0->unk1C = arg0->column; add_8018D9E0_entry(0xBA, 0, 0, 0); return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 4: temp_v0 = arg0->unk1C; - arg0->unkC = temp_v0; + arg0->column = temp_v0; if (temp_v0 < 0x14A) { if (D_8018D9D8 != 0) { arg0->unk1C = temp_v0 + 0x20; @@ -16455,9 +16350,8 @@ void func_800AD1A4(void *arg0) { arg0->unk1C = temp_v0 + 0x10; return; } - arg0->unk0 = 0; - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + arg0->type = 0; + break; } } #else @@ -16465,32 +16359,33 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AD1A4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -s32 func_800B4520(); /* extern */ -s32 func_800B5F30(); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda s32 func_800B6348(s32); /* extern */ ? func_800B6708(); /* extern */ s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ ? play_sound2(?, u16); /* extern */ extern void *D_800DC5EC; extern void *D_800DC5F0; -extern u16 D_80162DD4; extern s32 D_80162DF8; extern void *D_8018D9BC; extern s8 D_8018D9D8; extern ? D_8018E868; extern s32 D_8018EB78; extern s32 D_8018EB7C; -extern s32 gControllerPakNumPagesFree; extern ? D_8018EB84; extern s8 D_8018EDF5; -static u16 D_800E86F0; /* type too large by 2; unable to generate initializer; const */ +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 ? D_800F2E64; /* unable to generate initializer; const */ static ? D_800F2E74; /* unable to generate initializer; const */ +static s8 gGP1stPlaceReward = 9; /* const */ +static s8 gGP2ndPlaceReward = 6; /* const */ +static s8 gGP3rdPlaceReward = 3; /* const */ +static s8 gGP4thPlaceReward = 1; /* const */ -void func_800AD2E8(void *arg0) { +void func_800AD2E8(struct_8018D9E0_entry *arg0) { s32 sp28; f64 temp_f0; f64 temp_f0_2; @@ -16499,22 +16394,22 @@ void func_800AD2E8(void *arg0) { s32 temp_a0; s32 temp_a0_2; s32 temp_a2; + s32 temp_t2; + s32 temp_t9; + s32 temp_v0; + 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; - struct Controller *temp_t6; - struct Controller *temp_v1_2; u16 temp_a1; u16 temp_a1_2; - u32 temp_t2; - u32 temp_t9; - u32 temp_v0; - u32 temp_v0_3; - u32 temp_v0_4; - u32 temp_v0_5; - u32 temp_v0_6; + void *temp_t6; void *temp_v0_2; void *temp_v1; + void *temp_v1_2; s32 phi_a1; s32 phi_a0; u16 phi_a1_2; @@ -16523,209 +16418,198 @@ void func_800AD2E8(void *arg0) { s32 phi_v1_2; temp_v0 = arg0->unk4; - if (temp_v0 < 0x20) { - switch (temp_v0) { /* switch 1 */ - case 0: /* switch 1 */ - arg0->unkC = -0xA0; - arg0->unk4 = 1; - D_8018D9BC->unk0 = gGP1stPlaceReward; - D_8018D9BC->unk1 = gGP2ndPlaceReward; - D_8018D9BC->unk2 = gGP3rdPlaceReward; - D_8018D9BC->unk3 = gGP4thPlaceReward; - arg0->unk20 = arg0->unkC; + switch ((u32) temp_v0) { /* switch 3; irregular */ + case 0: /* switch 3 */ + arg0->column = -0xA0; + arg0->unk4 = 1; + D_8018D9BC->unk0 = (s8) gGP1stPlaceReward; + D_8018D9BC->unk1 = (s8) gGP2ndPlaceReward; + D_8018D9BC->unk2 = (s8) gGP3rdPlaceReward; + D_8018D9BC->unk3 = (s8) gGP4thPlaceReward; + arg0->unk20 = arg0->column; + return; + case 1: /* switch 3 */ + temp_a0 = arg0->unk20; + arg0->column = temp_a0; + phi_a1 = 0x10; + if (D_8018D9D8 != 0) { + phi_a1 = 0x20; + } + temp_a2 = temp_a0 + phi_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); return; - case 1: /* switch 1 */ - temp_a0 = arg0->unk20; - arg0->unkC = temp_a0; - phi_a1 = 0x10; - if (D_8018D9D8 != 0) { - phi_a1 = 0x20; + } + 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; + } + D_800DC5EC->unk30 = 0xF0; + D_800DC5F0->unk30 = 0x50; + return; + case 5: /* switch 3 */ + case 6: /* switch 3 */ + case 7: /* switch 3 */ + case 8: /* switch 3 */ + 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) { + arg0->unk4 = temp_t2; + if ((D_80162DF8 == 1) && (temp_t2 == 9)) { + arg0->unk4 = temp_t2 - 1; + } + play_sound2(0x49008000, temp_a1); + 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; + } } - temp_a2 = temp_a0 + phi_a1; - if (temp_a2 < 0) { - arg0->unk20 = temp_a2; - temp_v0_2 = D_800DC5EC; - temp_v0_2->unk30 = temp_v0_2->unk30 + phi_a1; - temp_v1 = D_800DC5F0; - temp_v1->unk30 = temp_v1->unk30 - phi_a1; - return; - } - arg0->unk20 = 0; - arg0->unkC = 0; - temp_t3 = D_8018EDF5; - arg0->unk4 = temp_t3; - if ((temp_t3 == 9) && (D_80162DF8 == 1)) { - arg0->unk4 = temp_t3 - 1; - } - D_800DC5EC->unk30 = 0xF0; - D_800DC5F0->unk30 = 0x50; - return; - case 5: /* switch 1 */ - case 6: /* switch 1 */ - case 7: /* switch 1 */ - case 8: /* switch 1 */ - case 9: /* switch 1 */ - case 10: /* switch 1 */ - if (func_800B4520() == 0) { - temp_v1_2 = gControllerOne; - temp_a1 = temp_v1_2->buttonPressed; - temp_a0_2 = temp_a1 | temp_v1_2->stickPressed; - 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) { - arg0->unk4 = temp_t2; - if ((D_80162DF8 == 1) && (temp_t2 == 9)) { - arg0->unk4 = temp_t2 - 1; + 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) { + 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; + } else { + play_sound2(0x49008000, phi_a1_2); + temp_f0_2 = (f64) arg0->unk24; + if (temp_f0_2 < 4.2) { + arg0->unk24 = (f32) (temp_f0_2 + 4.0); } - play_sound2(0x49008000, temp_a1); - temp_f0 = arg0->unk24; - if (temp_f0 < 4.2) { - arg0->unk24 = temp_f0 + 4.0; - } - arg0->unk8 = -1; - temp_t6 = gControllerOne; - temp_a1_2 = temp_t6->buttonPressed; - phi_a0 = temp_a1_2 | temp_t6->stickPressed; - phi_a1_2 = temp_a1_2; + arg0->unk8 = 1; + phi_a1_3 = gControllerOne->unk6; } } - 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) { - 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->buttonPressed; - } else { - play_sound2(0x49008000, phi_a1_2); - temp_f0_2 = arg0->unk24; - if (temp_f0_2 < 4.2) { - arg0->unk24 = temp_f0_2 + 4.0; - } - arg0->unk8 = 1; - phi_a1_3 = gControllerOne->buttonPressed; + } + if ((phi_a1_3 & 0x9000) != 0) { + temp_v0_6 = arg0->unk4; + if (temp_v0_6 == 0xA) { + temp_f0_3 = (f64) arg0->unk24; + phi_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 */ + case 0: /* switch 4 */ + func_800B6708(); + arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x11; + sp28 = 1; + play_sound2(0x49008001); + phi_v1 = 1; + break; + case 2: /* switch 4 */ + /* fallthrough */ + default: /* switch 4 */ + D_800E86F8 = 0; + break; } } - } - if ((phi_a1_3 & 0x9000) != 0) { - temp_v0_6 = arg0->unk4; - if (temp_v0_6 == 0xA) { - temp_f0_3 = arg0->unk24; - phi_v1 = 0; - if (temp_f0_3 < 4.2) { - arg0->unk24 = 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); - if (temp_v0_7 != 0) { - if (temp_v0_7 != 2) { - if (temp_v0_7 != 5) { - goto block_42; - } - } else { -block_42: - D_800E86F8 = 0; - } - } else { - func_800B6708(); - arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x11; - sp28 = 1; - play_sound2(0x49008001); - phi_v1 = 1; + case 5: /* switch 4 */ + if (phi_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 */ + case -1: /* switch 2 */ + arg0->unk4 = 0xB; + phi_v1_2 = 1; + break; + case -3: /* switch 2 */ + case -2: /* switch 2 */ + arg0->unk4 = 0xC; + phi_v1_2 = 1; + break; + case 1: /* switch 2 */ + case 11: /* switch 2 */ + arg0->unk4 = 0xB; + phi_v1_2 = 1; + break; + case 10: /* switch 2 */ + arg0->unk4 = 0xC; + phi_v1_2 = 1; + break; + default: /* switch 2 */ + arg0->unk4 = 0xC; + phi_v1_2 = 1; + break; } - } - if (phi_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 */ - case -1: /* switch 2 */ - arg0->unk4 = 0xB; - phi_v1_2 = 1; - break; - case -3: /* switch 2 */ - case -2: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; - break; - case 1: /* switch 2 */ - case 11: /* switch 2 */ - arg0->unk4 = 0xB; - phi_v1_2 = 1; - break; - case 10: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; - break; - default: /* switch 2 */ - arg0->unk4 = 0xC; - phi_v1_2 = 1; - break; - } - if (phi_v1_2 != 0) { - play_sound2(0x4900FF07); - return; - } - 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(0x49008001); - return; - } - goto block_56; - } -block_56: - if (D_8018EB7C >= D_8018EB78) { - arg0->unk4 = 0xE; + if (phi_v1_2 != 0) { play_sound2(0x4900FF07); return; } - if (gControllerPakNumPagesFree >= 0x79) { - arg0->unk4 = 0x13; - arg0->unk1C = 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(0x49008001); return; } + goto block_56; + } +block_56: + if (D_8018EB7C >= D_8018EB78) { arg0->unk4 = 0xE; play_sound2(0x4900FF07); return; } - /* Duplicate return node #127. Try simplifying control flow for better match */ + if (gControllerPakNumPagesFree >= 0x79) { + arg0->unk4 = 0x13; + arg0->unk1C = 0; + play_sound2(0x49008001); + return; + } + arg0->unk4 = 0xE; + play_sound2(0x4900FF07); return; } + } else { arg0->unk1C = temp_v0_6; - D_8018EDF5 = temp_v0_6; + D_8018EDF5 = (s8) temp_v0_6; arg0->unk4 = 0x1E; - arg0->unk20 = arg0->unk10; + arg0->unk20 = arg0->row; play_sound2(0x49008015, phi_a1_3); - temp_f0_4 = arg0->unk24; + temp_f0_4 = (f64) arg0->unk24; if (temp_f0_4 < 4.2) { - arg0->unk24 = temp_f0_4 + 4.0; + arg0->unk24 = (f32) (temp_f0_4 + 4.0); } - /* Duplicate return node #127. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #127. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #127. Try simplifying control flow for better match */ + } else { return; } - } else { - case 2: /* switch 1 */ - case 3: /* switch 1 */ - case 4: /* switch 1 */ + break; } } #else @@ -16733,40 +16617,40 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AD2E8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009DFE0(?, void *, struct Controller *, s32 *); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_8009DFE0(?, struct_8018D9E0_entry *, void *, s32 *); /* extern */ ? func_800C9F90(?); /* extern */ ? func_800CA330(?); /* extern */ -? func_8028DF38(?, void *, struct Controller *, s32 *); /* extern */ -? play_sound2(?, void *, struct Controller *, s32 *); /* extern */ +? func_8028DF38(?, struct_8018D9E0_entry *, void *, s32 *); /* extern */ +extern ? gControllers; static ? D_800F0B50; /* unable to generate initializer; const */ static ? D_800F0B54; /* unable to generate initializer; const */ -void func_800ADF48(void *arg0) { - struct Controller *sp18; +void func_800ADF48(struct_8018D9E0_entry *arg0) { + void *sp18; 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; s8 temp_v0_3; - struct Controller *temp_a2; + struct_8018D9E0_entry *temp_a1; u16 temp_v1; u16 temp_v1_2; - u32 temp_t7; - u32 temp_v0; - void *temp_a1; + void *temp_a2; s32 phi_a0; - void *phi_a1; u16 phi_v1; - void *phi_a1_2; + struct_8018D9E0_entry *phi_a1; + temp_a1 = arg0; if (D_800DC5FC != 0) { temp_t7 = arg0->unk4; switch (temp_t7) { case 0: - arg0->unk4 = *(&D_800F0B50 + gModeSelection); + temp_a1->unk4 = (s32) *(&D_800F0B50 + gModeSelection); return; case 11: case 12: @@ -16783,84 +16667,79 @@ void func_800ADF48(void *arg0) { case 42: case 43: case 44: - arg0 = arg0; - temp_a1 = arg0; - phi_a1 = temp_a1; - if (func_800B4520(arg0) == 0) { + arg0 = temp_a1; + if (func_800B4520(temp_a1) == 0) { temp_t2 = (D_800DC5FC * 0x10) - 0x10; - temp_a2 = temp_t2 + gControllers; - temp_v1 = temp_a2->buttonPressed; - temp_a0 = temp_v1 | temp_a2->stickPressed; + 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) { - temp_v0 = temp_a1->unk4; - if (*(&D_800F0B50 + gModeSelection) < temp_v0) { - temp_a1->unk4 = temp_v0 - 1; + temp_v0 = arg0->unk4; + if ((s32) *(&D_800F0B50 + gModeSelection) < temp_v0) { + arg0->unk4 = temp_v0 - 1; sp18 = temp_a2; - arg0 = temp_a1; - play_sound2(0x49008000, temp_a1, temp_a2, &gModeSelection); - temp_f0 = arg0->unk24; - phi_a1 = arg0; + arg0 = arg0; + play_sound2(0x49008000); + temp_f0 = (f64) arg0->unk24; if (temp_f0 < 4.2) { - arg0->unk24 = temp_f0 + 4.0; + arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; - temp_v1_2 = temp_a2->buttonPressed; - phi_a0 = temp_v1_2 | temp_a2->stickPressed; + temp_v1_2 = temp_a2->unk6; + phi_a0 = temp_v1_2 | temp_a2->unkC; phi_v1 = temp_v1_2; } } - phi_a1_2 = phi_a1; + phi_a1 = arg0; if ((phi_a0 & 0x400) != 0) { - temp_v0_2 = phi_a1->unk4; - if (temp_v0_2 < *(&D_800F0B54 + gModeSelection)) { - phi_a1->unk4 = temp_v0_2 + 1; - sp18 = temp_t2 + gControllers; - arg0 = phi_a1; - play_sound2(0x49008000, phi_a1, temp_t2 + gControllers, &gModeSelection); - temp_f0_2 = arg0->unk24; - phi_a1_2 = arg0; + temp_v0_2 = arg0->unk4; + if (temp_v0_2 < (s32) *(&D_800F0B54 + gModeSelection)) { + arg0->unk4 = temp_v0_2 + 1; + sp18 = temp_t2 + &gControllers; + arg0 = arg0; + play_sound2(0x49008000); + temp_f0_2 = (f64) arg0->unk24; + phi_a1 = arg0; if (temp_f0_2 < 4.2) { - arg0->unk24 = temp_f0_2 + 4.0; + arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; - phi_v1 = (temp_t2 + gControllers)->buttonPressed; + phi_v1 = (temp_t2 + &gControllers)->unk6; } } - if (((phi_v1 & 0x4000) != 0) && (temp_v0_3 = *(&D_800F0B50 + gModeSelection), (phi_a1_2->unk4 != temp_v0_3))) { - phi_a1_2->unk4 = temp_v0_3; - play_sound2(0x49008002, phi_a1_2, temp_t2 + gControllers, &gModeSelection); - return; + if ((phi_v1 & 0x4000) != 0) { + temp_v0_3 = *(&D_800F0B50 + gModeSelection); + if (phi_a1->unk4 != temp_v0_3) { + phi_a1->unk4 = (s32) temp_v0_3; + play_sound2(0x49008002); + return; + } } if ((phi_v1 & 0x9000) != 0) { - if (phi_a1_2->unk4 == *(&D_800F0B50 + gModeSelection)) { - phi_a1_2->unk4 = 0; + if (phi_a1->unk4 == *(&D_800F0B50 + gModeSelection)) { + phi_a1->unk4 = 0; D_800DC5FC = 0; - func_8028DF38(0x1E, phi_a1_2, temp_t2 + gControllers, &gModeSelection); + func_8028DF38(0x1E, phi_a1, temp_t2 + &gControllers, &gModeSelection); func_800C9F90(0); return; } - arg0 = phi_a1_2; - func_8009DFE0(0x1E, phi_a1_2, temp_t2 + gControllers, &gModeSelection); + arg0 = phi_a1; + func_8009DFE0(0x1E, phi_a1, temp_t2 + &gControllers, &gModeSelection); play_sound2(0x4900801B); func_800CA330(0x3C); - temp_f0_3 = arg0->unk24; + temp_f0_3 = (f64) arg0->unk24; if (temp_f0_3 < 4.2) { - arg0->unk24 = temp_f0_3 + 4.0; + arg0->unk24 = (f32) (temp_f0_3 + 4.0); return; } - /* Duplicate return node #24. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #24. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #24. Try simplifying control flow for better match */ - return; + break; } } else { - arg0->unk4 = 0; + temp_a1->unk4 = 0; default: } } @@ -16869,22 +16748,31 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ADF48.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_8009DFE0(?); /* extern */ +s32 func_800B6178(s32); /* extern */ +s32 func_800B6348(s32); /* extern */ +s32 func_800B63F0(s32); /* extern */ ? func_800B6708(); /* extern */ ? func_800CA330(?); /* extern */ ? func_800CA388(?); /* extern */ s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ ? play_sound2(?, s32); /* extern */ +extern s8 D_8018CAE0; extern ? D_8018E868; +extern s32 D_8018EB78; +extern s32 D_8018EB7C; extern ? D_8018EB84; extern ? 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 ? D_800F2E64; /* unable to generate initializer; const */ static ? D_800F2E74; /* unable to generate initializer; const */ -s16 D_800DC5B8; /* unable to generate initializer */ -u16 D_800E86F0; /* unable to generate initializer; const */ -void func_800AE218(void *arg0) { +void func_800AE218(struct_8018D9E0_entry *arg0) { s32 sp28; f64 temp_f0; f64 temp_f0_10; @@ -16934,7 +16822,7 @@ void func_800AE218(void *arg0) { if (arg0->unk4 != 0) { D_800DC5B8 = 0; } - switch (arg0->unk4) { /* switch 1 */ + switch ((u32) arg0->unk4) { /* switch 1 */ case 0: /* switch 1 */ temp_v0 = arg0->unk1C; if (temp_v0 < 0x1E) { @@ -16959,8 +16847,7 @@ void func_800AE218(void *arg0) { arg0->unk4 = 0xF; return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; case 11: /* switch 1 */ case 12: /* switch 1 */ case 13: /* switch 1 */ @@ -16978,9 +16865,9 @@ void func_800AE218(void *arg0) { if (temp_v1 >= 0xC) { arg0->unk4 = temp_v1 - 1; play_sound2(0x49008000, temp_a1); - temp_f0 = arg0->unk24; + temp_f0 = (f64) arg0->unk24; if (temp_f0 < 4.2) { - arg0->unk24 = temp_f0 + 4.0; + arg0->unk24 = (f32) (temp_f0 + 4.0); } arg0->unk8 = -1; temp_t2 = gControllerOne; @@ -16994,9 +16881,9 @@ void func_800AE218(void *arg0) { if (temp_v1_2 < 0x10) { arg0->unk4 = temp_v1_2 + 1; play_sound2(0x49008000, phi_a1); - temp_f0_2 = arg0->unk24; + temp_f0_2 = (f64) arg0->unk24; if (temp_f0_2 < 4.2) { - arg0->unk24 = temp_f0_2 + 4.0; + arg0->unk24 = (f32) (temp_f0_2 + 4.0); } arg0->unk8 = 1; phi_a0 = gControllerOne->unk6; @@ -17004,29 +16891,28 @@ void func_800AE218(void *arg0) { } if ((phi_a0 & 0x9000) != 0) { if (arg0->unk4 == 0x10) { - temp_f0_3 = arg0->unk24; + temp_f0_3 = (f64) arg0->unk24; phi_v1 = 0; if (temp_f0_3 < 4.2) { - arg0->unk24 = temp_f0_3 + 4.0; + 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); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 2) { - if (temp_v0_3 != 5) { - goto block_34; - } - } else { -block_34: - D_800E86F8 = 0; - } - } else { + switch (temp_v0_3) { /* switch 3; irregular */ + case 0: /* switch 3 */ func_800B6708(); arg0->unk4 = func_800B6348((gCupSelection * 4) + gCupCourseSelection) + 0x1E; phi_v1 = 1; + break; + case 2: /* switch 3 */ + /* fallthrough */ + default: /* switch 3 */ + D_800E86F8 = 0; + break; } } + case 5: /* switch 3 */ if (phi_v1 != 0) { play_sound2(0x49008001); return; @@ -17077,7 +16963,7 @@ block_49: play_sound2(0x4900FF07); return; } - if (D_8018EB80 >= 0x79) { + if (gControllerPakNumPagesFree >= 0x79) { arg0->unk4 = 0x20; arg0->unk1C = 0; play_sound2(0x49008001); @@ -17091,19 +16977,14 @@ block_49: play_sound2(0x49008016); func_800CA330(0x19); func_800CA388(0x19); - temp_f0_4 = arg0->unk24; + temp_f0_4 = (f64) arg0->unk24; if (temp_f0_4 < 4.2) { - arg0->unk24 = temp_f0_4 + 4.0; + arg0->unk24 = (f32) (temp_f0_4 + 4.0); return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; case 21: /* switch 1 */ case 22: /* switch 1 */ case 23: /* switch 1 */ @@ -17111,15 +16992,19 @@ block_49: case 25: /* switch 1 */ case 26: /* switch 1 */ case 41: /* switch 1 */ - if (((gControllerOne->unk6 & 0xD000) != 0) && (arg0->unk4 = 0x10, play_sound2(0x49008002), temp_f0_5 = arg0->unk24, (temp_f0_5 < 4.2))) { - arg0->unk24 = temp_f0_5 + 4.0; - return; + if ((gControllerOne->unk6 & 0xD000) != 0) { + arg0->unk4 = 0x10; + play_sound2(0x49008002); + temp_f0_5 = (f64) arg0->unk24; + if (temp_f0_5 < 4.2) { + arg0->unk24 = (f32) (temp_f0_5 + 4.0); + return; + } } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; case 30: /* switch 1 */ case 31: /* switch 1 */ - arg0->unk20 = arg0->unk4 - 0x1E; + 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; @@ -17129,9 +17014,9 @@ block_49: if (temp_v1_3 >= 0x1F) { arg0->unk4 = temp_v1_3 - 1; play_sound2(0x49008000, temp_a1_2); - temp_f0_6 = arg0->unk24; + temp_f0_6 = (f64) arg0->unk24; if (temp_f0_6 < 4.2) { - arg0->unk24 = temp_f0_6 + 4.0; + arg0->unk24 = (f32) (temp_f0_6 + 4.0); } arg0->unk8 = -1; temp_t0 = gControllerOne; @@ -17143,9 +17028,9 @@ block_49: if (temp_v1_4 < 0x1F) { arg0->unk4 = temp_v1_4 + 1; play_sound2(0x49008000, phi_a1_2); - temp_f0_7 = arg0->unk24; + temp_f0_7 = (f64) arg0->unk24; if (temp_f0_7 < 4.2) { - arg0->unk24 = temp_f0_7 + 4.0; + arg0->unk24 = (f32) (temp_f0_7 + 4.0); } arg0->unk8 = 1; } @@ -17168,16 +17053,13 @@ block_49: arg0->unk4 = 0x23; } play_sound2(0x49008001); - temp_f0_8 = arg0->unk24; + temp_f0_8 = (f64) arg0->unk24; if (temp_f0_8 < 4.2) { - arg0->unk24 = temp_f0_8 + 4.0; + arg0->unk24 = (f32) (temp_f0_8 + 4.0); return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; case 32: /* switch 1 */ if ((arg0->unk1C == 1) && (func_800B6A68() != 0)) { arg0->unk4 = 0x19; @@ -17189,8 +17071,7 @@ block_49: arg0->unk4 = 0x1E; return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; case 35: /* switch 1 */ case 36: /* switch 1 */ temp_v0_6 = gControllerOne; @@ -17198,12 +17079,12 @@ block_49: 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) && (arg0->unk4 >= 0x24)) { - arg0->unk4 = arg0->unk4 - 1; + if (((temp_a1_3 & 0x800) != 0) && ((s32) (u32) arg0->unk4 >= 0x24)) { + arg0->unk4 = (u32) arg0->unk4 - 1; play_sound2(0x49008000, temp_a1_3); - temp_f0_9 = arg0->unk24; + temp_f0_9 = (f64) arg0->unk24; if (temp_f0_9 < 4.2) { - arg0->unk24 = temp_f0_9 + 4.0; + arg0->unk24 = (f32) (temp_f0_9 + 4.0); } arg0->unk8 = -1; temp_t6 = gControllerOne; @@ -17216,9 +17097,9 @@ block_49: if (temp_v1_5 < 0x24) { arg0->unk4 = temp_v1_5 + 1; play_sound2(0x49008000, phi_a1_3); - temp_f0_10 = arg0->unk24; + temp_f0_10 = (f64) arg0->unk24; if (temp_f0_10 < 4.2) { - arg0->unk24 = temp_f0_10 + 4.0; + arg0->unk24 = (f32) (temp_f0_10 + 4.0); } arg0->unk8 = 1; phi_a0_2 = gControllerOne->unk6; @@ -17234,20 +17115,18 @@ block_49: arg0->unk4 = 0x28; arg0->unk1C = 0; play_sound2(0x49008001); - temp_f0_11 = arg0->unk24; + temp_f0_11 = (f64) arg0->unk24; if (temp_f0_11 < 4.2) { - arg0->unk24 = temp_f0_11 + 4.0; + arg0->unk24 = (f32) (temp_f0_11 + 4.0); return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ + } else { + arg0->unk4 = arg0->unk20 + 0x1E; + play_sound2(0x49008002); return; } - arg0->unk4 = arg0->unk20 + 0x1E; - play_sound2(0x49008002); - return; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - 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) { @@ -17268,8 +17147,7 @@ block_107: if (temp_t6_2 >= 2) { arg0->unk4 = 0x10; } - /* Duplicate return node #109. Try simplifying control flow for better match */ - return; + break; } } #else @@ -17277,28 +17155,27 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AE218.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -s32 get_string_width(? *); /* extern */ -? func_800A9208(void *, ?); /* extern */ -? func_800A94C8(void *, ?, ?); /* extern */ +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +? func_800A9208(struct_8018D9E0_entry *, ?); /* extern */ +? func_800A94C8(struct_8018D9E0_entry *, ?, ?); /* extern */ ? func_800C90F4(?, s32); /* extern */ -void func_800AEC54(void *arg0) { +void func_800AEC54(struct_8018D9E0_entry *arg0) { s32 temp_t5; + s32 temp_t6; s32 temp_t9; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { case 0: - arg0->unkC = (get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2) + 0x140; - arg0->unk10 = 0xDA; + arg0->column = (get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2) + 0x140; + arg0->row = 0xDA; arg0->unk4 = 1; func_800C90F4(0, (D_80162DE4 * 0x10) + 0x29008001); return; case 1: func_800A9208(arg0, 0xA0); - if (arg0->unkC == 0xA0) { + if (arg0->column == 0xA0) { arg0->unk4 = 2; arg0->unk1C = 0; return; @@ -17313,22 +17190,20 @@ void func_800AEC54(void *arg0) { arg0->unk1C = 0; return; } - /* Duplicate return node #12. Try simplifying control flow for better match */ - return; + break; case 4: temp_t9 = arg0->unk1C + 1; arg0->unk1C = temp_t9; if (temp_t9 >= 6) { - arg0->unk0 = 0; + arg0->type = 0; return; } case 3: func_800A94C8(arg0, 0xA0, -1); - if (((arg0->unkC + 0x14) == -(get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2)) && (arg0->unk4 == 3)) { + if (((arg0->column + 0x14) == -(s32) (get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2)) && (arg0->unk4 == 3)) { arg0->unk4 = 4; } - /* Duplicate return node #12. Try simplifying control flow for better match */ - return; + break; } } #else @@ -17336,85 +17211,82 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEC54.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009A594(s32, ?, s32, void *); // extern -s32 func_800B5B94(); // extern -? func_800B6708(); // extern -void *segmented_to_virtual_dupe(void*); // extern -extern ? D_800E7E34; -extern s8 gTimeTrialDataCourseIndex; +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +s32 func_800B5B94(); /* extern */ +? func_800B6708(); /* extern */ extern ? D_8018EE10; -extern ? gCupCourseOrder; +MkAnimation *D_800E7E34[0x14] = { + D_02001E64, + D_02001E74, + D_02001E84, + D_02001E94, + D_02001EA4, + D_02001EB4, + D_02001EC4, + D_02001ED4, + D_02001EE4, + D_02001EF4, + D_02001F04, + D_02001F14, + D_02001F24, + D_02001F34, + D_02001F44, + D_02001F54, + D_02001F64, + D_02001F74, + D_02001F84, + D_02001F94, +}; /* const */ +s16 gCupCourseOrder[5][4]; /* unable to generate initializer; const */ -void func_800AEDBC(void *arg0) { +void func_800AEDBC(struct_8018D9E0_entry *arg0) { s8 temp_v0; s8 temp_v0_2; - void *temp_a3; temp_v0 = gTimeTrialDataCourseIndex; - temp_a3 = arg0; if (temp_v0 != arg0->unk1C) { - arg0->unk1C = temp_v0; + arg0->unk1C = (s32) temp_v0; temp_v0_2 = gTimeTrialDataCourseIndex; - arg0 = temp_a3; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder + (((temp_v0_2 / 4) * 8) + ((temp_v0_2 % 4) * 2))) * 4))), arg0); + arg0 = arg0; + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E7E34[*(gCupCourseOrder + ((((s32) temp_v0_2 / 4) * 8) + (((s32) temp_v0_2 % 4) * 2)))])); if (func_800B5B94() == 0) { func_800B6708(); return; } D_8018EE10.unk4 = 0; D_8018EE10.unk84 = 0; - // Duplicate return node #4. Try simplifying control flow for better match } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEDBC.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s8 D_8018EDEC; - -void func_800AEE90(void *arg0) { +void func_800AEE90(struct_8018D9E0_entry *arg0) { if (D_8018EDEC != 0xB) { - arg0->unk15 = 0; - return; + arg0->visible = 0; + } + else{ + arg0->visible = 1; } - arg0->unk15 = 1; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEE90.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s8 D_8018EDEC; - -void func_800AEEBC(void *arg0) { +void func_800AEEBC(struct_8018D9E0_entry *arg0) { if (D_8018EDEC != 0xC) { - arg0->unk15 = 0; - return; + arg0->visible = 0; + } + else{ + arg0->visible = 1; } - arg0->unk15 = 1; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEEBC.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s8 D_8018EDEC; - -void func_800AEEE8(void *arg0) { +void func_800AEEE8(struct_8018D9E0_entry *arg0) { if (D_8018EDEC != 0xD) { - arg0->unk15 = 0; - return; + arg0->visible = 0; + } + else{ + arg0->visible = 1; } - arg0->unk15 = 1; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEEE8.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -17436,36 +17308,33 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEF14.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda extern s32 D_80162DF8; extern s8 D_8018CAE0; -void func_800AEF74(void *arg0) { +void func_800AEF74(struct_8018D9E0_entry *arg0) { s32 temp_v0; temp_v0 = arg0->unk4; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - return; - } - // Duplicate return node #10. Try simplifying control flow for better match + switch (temp_v0) { /* irregular */ + case 0: + if (D_80162DF8 == 1) { + arg0->unk4 = 1; + arg0->unk1C = 0; return; } - arg0->unk1C = arg0->unk1C + 1; + if (D_8018CAE0 == 1) { + arg0->unk4 = 2; + return; + } + case 2: + return; + case 1: + arg0->unk1C += 1; if (D_8018CAE0 == 1) { arg0->unk4 = 2; } - // Duplicate return node #10. Try simplifying control flow for better match - return; - } - if (D_80162DF8 == 1) { - arg0->unk4 = 1; - arg0->unk1C = 0; - return; - } - if (D_8018CAE0 == 1) { - arg0->unk4 = 2; + break; } } #else @@ -17473,19 +17342,19 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEF74.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_8009DFE0(?); /* extern */ -? add_8018D9E0_entry(s32, ?, ?, ?); /* extern */ ? func_800CA330(?); /* extern */ ? func_800CA388(?); /* extern */ ? play_sound2(?); /* extern */ +extern void *gControllerFive; -void func_800AF004(void *arg0) { +void func_800AF004(struct_8018D9E0_entry *arg0) { s32 temp_t1; + s32 temp_t6; s32 temp_t6_2; s32 temp_t8; - u32 temp_t6; - u32 temp_t9; + s32 temp_t9; void *temp_v0; temp_t6 = arg0->unk4; @@ -17496,8 +17365,8 @@ void func_800AF004(void *arg0) { if (temp_t8 >= 0x65) { arg0->unk1C = 0; arg0->unk4 = 1; - gCupSelection = gCupSelection % 4; - gCCSelection = gCCSelection % 4; + gCupSelection = (s8) ((s32) gCupSelection % 4); + gCCSelection = (s32) gCCSelection % 4; add_8018D9E0_entry(0x12C, 0, 0, 4); return; } @@ -17516,30 +17385,27 @@ void func_800AF004(void *arg0) { add_8018D9E0_entry(temp_t9 + 0x12B, 0, 0, 4); return; } - /* Duplicate return node #13. Try simplifying control flow for better match */ - return; + 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->unk4 = 6; arg0->unk1C = 0; - if (D_802874F5 < 3) { + if ((s32) D_802874F5 < 3) { play_sound2(0x49008016); return; } play_sound2(0x4900801B); return; } - /* Duplicate return node #13. Try simplifying control flow for better match */ - return; + break; case 6: func_8009DFE0(0x1E); func_800CA330(0x19); func_800CA388(0x19); arg0->unk4 = 7; - /* Duplicate return node #13. Try simplifying control flow for better match */ - return; + break; } } #else @@ -17547,91 +17413,126 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF004.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800A91D8(s16, s16); // extern -extern ? D_800E7458; -extern ? D_800E7480; +//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 */ -void func_800AF1AC(void *arg0) { - void *sp18; +struct _struct_D_800E7480_0x8 { + /* 0x0 */ s16 unk0; /* inferred */ + /* 0x2 */ s16 unk2; /* inferred */ + /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ +}; /* size = 0x8 */ + +? 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 */ + +void func_800AF1AC(struct_8018D9E0_entry *arg0) { + struct _struct_D_800E7480_0x8 *sp18; s32 temp_v0; s32 temp_v1; - void *temp_v0_2; - void *temp_v0_3; + struct _struct_D_800E7458_0x8 *temp_v0_2; + struct _struct_D_800E7480_0x8 *temp_v0_3; temp_v0 = arg0->unk4; - temp_v1 = arg0->unk0 - 0x12C; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 2) { - return; - } - // Duplicate return node #8. Try simplifying control flow for better match - return; - } - temp_v0_2 = (temp_v1 * 8) + &D_800E7480; - sp18 = temp_v0_2; - func_800A91D8(temp_v0_2->unk0, temp_v0_2->unk2); - if ((temp_v0_2->unk0 == arg0->unkC) && (temp_v0_2->unk2 == arg0->unk10)) { + temp_v1 = arg0->type - 0x12C; + switch (temp_v0) { /* irregular */ + case 0: + temp_v0_2 = &D_800E7458[temp_v1]; + arg0->column = (s32) temp_v0_2->unk0; + arg0->unk4 = 1; + arg0->row = (s32) temp_v0_2->unk2; + return; + 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)) { arg0->unk4 = 2; } + /* fallthrough */ + case 2: return; } - temp_v0_3 = (temp_v1 * 8) + &D_800E7458; - arg0->unkC = temp_v0_3->unk0; - arg0->unk4 = 1; - arg0->unk10 = temp_v0_3->unk2; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF1AC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009A640(s32, ?, s32, s32); /* extern */ -? func_800A91D8(void *, s16, s16); /* extern */ +//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 */ + +? func_800A91D8(struct_8018D9E0_entry *, s16, s16); /* extern */ ? func_800C90F4(?, s32); /* extern */ ? func_800CA0A0(); /* extern */ -? func_800CA0B8(? *, ? *); /* extern */ -void *segmented_to_virtual_dupe(void*); /* extern */ extern ? D_8018DEE4; -extern ? D_802874D8; -static ? D_800E7458; /* unable to generate initializer; const */ -static ? D_800E7480; /* unable to generate initializer; const */ -static ? D_800E8380; /* unable to generate initializer; const */ -static ? D_800E83A0; /* unable to generate initializer; const */ -static ? D_800E8440; /* unable to generate initializer; const */ +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 */ +static MkAnimation *D_800E8380[8] = { + D_02006718, + D_02006900, + D_02006CD0, + D_02006EB8, + D_020070A0, + D_02007290, + D_02007478, + D_02006AE8, +}; /* const */ +static MkAnimation *D_800E83A0[8] = { + D_02006778, + D_02006960, + D_02006D30, + D_02006F18, + D_02007100, + D_020072F0, + D_020074D8, + D_02006B48, +}; /* const */ +static s32 D_800E8440[8] = { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }; /* const */ static ? D_800EFD64; /* unable to generate initializer; const */ -void func_800AF270(void *arg0) { +void func_800AF270(struct_8018D9E0_entry *arg0) { s32 sp30; - void *sp20; + struct _struct_D_800E7480_0x8 *sp20; s32 temp_t2; + s32 temp_t8; s32 temp_v1; - s32 temp_v1_2; s8 temp_t6; s8 temp_v0; - u32 temp_t8; - void *temp_v0_2; - void *temp_v0_3; + struct _struct_D_800E7458_0x8 *temp_v0_2; + struct _struct_D_800E7480_0x8 *temp_v0_3; - temp_t6 = D_802874D8.unk1E; - sp30 = temp_t6; + temp_t6 = D_802874D8.unk_1E; + sp30 = (s32) temp_t6; temp_t8 = arg0->unk4; temp_v0 = *(&D_800EFD64 + temp_t6); - temp_v1 = arg0->unk0 - 0x12C; + temp_v1 = arg0->type - 0x12C; switch (temp_t8) { case 0: - temp_v0_2 = (temp_v1 * 8) + &D_800E7458; - arg0->unkC = temp_v0_2->unk0; + temp_v0_2 = &D_800E7458[temp_v1]; + arg0->column = (s32) temp_v0_2->unk0; arg0->unk4 = 1; - arg0->unk10 = temp_v0_2->unk2; + arg0->row = (s32) temp_v0_2->unk2; return; case 1: - temp_v0_3 = (temp_v1 * 8) + &D_800E7480; + temp_v0_3 = &D_800E7480[temp_v1]; sp20 = temp_v0_3; func_800A91D8(arg0, temp_v0_3->unk0, temp_v0_3->unk2); - if ((temp_v0_3->unk0 == arg0->unkC) && (temp_v0_3->unk2 == arg0->unk10)) { + if ((temp_v0_3->unk0 == arg0->column) && (temp_v0_3->unk2 == arg0->row)) { arg0->unk4 = 2; arg0->unk20 = 0; return; @@ -17642,30 +17543,27 @@ void func_800AF270(void *arg0) { temp_t2 = arg0->unk20 + 1; arg0->unk20 = temp_t2; if (temp_t2 >= 0x1F) { - if (D_802874D8.unk1D >= 3) { + if ((s32) D_802874D8.unk_1D >= 3) { arg0->unk4 = 4; - func_800CA0B8(&D_800E8380, &D_802874D8); + func_800CA0B8(); func_800C90F4(0, (sp30 * 0x10) + 0x29008003); func_800CA0A0(); return; } arg0->unk4 = 3; - func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_v0 * 4)))); + func_8009A640(arg0->D_8018DEE0_index, 0, sp30, segmented_to_virtual_dupe(D_800E8380[temp_v0])); func_800CA0B8(); func_800C90F4(0, (sp30 * 0x10) + 0x29008007); func_800CA0A0(); return; } - /* Duplicate return node #12. Try simplifying control flow for better match */ - return; + break; case 3: - temp_v1_2 = temp_v0 * 4; - if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v1_2)) { - func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2))); + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= D_800E8440[temp_v0]) { + func_8009A640(arg0->D_8018DEE0_index, 0, sp30, segmented_to_virtual_dupe(D_800E83A0[temp_v0])); arg0->unk4 = 4; } - /* Duplicate return node #12. Try simplifying control flow for better match */ - return; + break; } } #else @@ -17683,9 +17581,10 @@ void func_800AF480(struct_8018D9E0_entry *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ ? func_800A94C8(struct_8018D9E0_entry *, s32, ?); /* extern */ +extern ? D_802854B0; void func_800AF4DC(struct_8018D9E0_entry *arg0) { struct_802850C0_entry *sp20; @@ -17705,7 +17604,7 @@ void func_800AF4DC(struct_8018D9E0_entry *arg0) { arg0->unk4 = 1; arg0->column = (s32) temp_v1->startingColumn; sp20 = temp_v1; - arg0->unk20 = (s32) ((((f32) get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling) / 2.0f) + (f32) temp_v1->columnExtra); + arg0->unk20 = (s32) ((((f32) get_string_width(*(&D_802854B0 + (temp_v0 * 4))) * temp_v1->textScaling) / 2.0f) + (f32) temp_v1->columnExtra); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); @@ -17714,7 +17613,7 @@ void func_800AF4DC(struct_8018D9E0_entry *arg0) { if (temp_t6 >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (bitwise s32) (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); if (arg0->column >= (arg0->unk20 - 0x14)) { arg0->unk4 = 2; arg0->D_8018DEE0_index = 0; @@ -17728,10 +17627,10 @@ void func_800AF4DC(struct_8018D9E0_entry *arg0) { temp_f0 = (f64) (temp_t6_2 - 0xA); arg0->unk1C = (s32) (arg0->unk20 - arg0->column) / 4; arg0->D_8018DEE0_index = temp_t6_2; - arg0->unk24 = (bitwise s32) (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); if ((temp_t6_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { arg0->unk4 = 3; - arg0->unk24 = 0x3F800000; + arg0->unk24 = 1.0f; return; } break; @@ -17754,9 +17653,10 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF4DC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda ? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ ? func_800A94C8(struct_8018D9E0_entry *, s32, ?); /* extern */ +extern ? D_802854B0; void func_800AF740(struct_8018D9E0_entry *arg0) { struct_802850C0_entry *sp20; @@ -17776,7 +17676,7 @@ void func_800AF740(struct_8018D9E0_entry *arg0) { arg0->unk4 = 1; arg0->column = (s32) temp_v1->startingColumn; sp20 = temp_v1; - arg0->unk20 = (s32) ((f32) temp_v1->columnExtra - (((f32) get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling) / 2.0f)); + arg0->unk20 = (s32) ((f32) temp_v1->columnExtra - (((f32) get_string_width(*(&D_802854B0 + (temp_v0 * 4))) * temp_v1->textScaling) / 2.0f)); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); @@ -17785,7 +17685,7 @@ void func_800AF740(struct_8018D9E0_entry *arg0) { if (temp_t6 >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (bitwise s32) (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); if ((arg0->unk20 + 0x14) >= arg0->column) { arg0->unk4 = 2; arg0->D_8018DEE0_index = 0; @@ -17799,10 +17699,10 @@ void func_800AF740(struct_8018D9E0_entry *arg0) { temp_f0 = (f64) (temp_t6_2 - 0xA); arg0->unk1C = (s32) (arg0->column - arg0->unk20) / 4; arg0->D_8018DEE0_index = temp_t6_2; - arg0->unk24 = (bitwise s32) (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); if ((temp_t6_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { arg0->unk4 = 3; - arg0->unk24 = 0x3F800000; + arg0->unk24 = 1.0f; return; } break; diff --git a/src/code_80091750.h b/src/code_80091750.h index 41037f946..daddcf1cb 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -76,6 +76,9 @@ void func_80093754(s32, s32, char*, s32, f32, f32); void print_text2(s32, s32, char*, s32, f32, f32, s32); void func_800939C8(s32, s32, char*, s32, f32, f32); void text_draw(s32, s32, char*, s32, f32, f32); +void func_80093C1C(s32); +void func_80093C88(); +void func_80093C90(); void func_80093C98(s32); void func_80093E20(); void func_80093E40(); @@ -145,7 +148,6 @@ void get_time_record_seconds(s32 , char*); void get_time_record_centiseconds(s32, char*); void func_800A8230(); void func_800A8250(); -void func_800AB290(struct_8018D9E0_entry*); void func_800A86E8(struct_8018D9E0_entry*); void func_800A8E14(struct_8018D9E0_entry*); void func_800A8EC0(struct_8018D9E0_entry*); @@ -157,7 +159,12 @@ struct_8018D9E0_entry *func_800AAEF4(s32); struct_8018D9E0_entry *func_800AAF30(s32); s32 func_800AAF70(s32); void func_800AAF94(struct_8018D9E0_entry*, s32); +void func_800AB260(struct_8018D9E0_entry*); +void func_800AB290(struct_8018D9E0_entry*); void func_800AC978(struct_8018D9E0_entry*); +void func_800AEE90(struct_8018D9E0_entry*); +void func_800AEEBC(struct_8018D9E0_entry*); +void func_800AEEE8(struct_8018D9E0_entry*); void func_800AF480(struct_8018D9E0_entry*); void func_800AF4DC(struct_8018D9E0_entry*); void func_800AF740(struct_8018D9E0_entry*); @@ -173,18 +180,6 @@ void func_80057CE4(); /* This is where I'd put my static data, if I had any */ -extern Gfx D_02007650[]; -extern Gfx D_020076B0[]; -extern Gfx D_020077A8[]; -extern Gfx D_020077D8[]; -extern Gfx D_02007F18[]; -extern Gfx D_02007F48[]; -extern Gfx D_02007F60[]; -extern Gfx D_02007FC8[]; -extern Gfx D_02008008[]; -extern Gfx D_02008030[]; -extern Gfx D_02008058[]; - extern Gfx D_06009410[]; extern s16 gGlyphDisplayWidth[]; // D_800EF690 diff --git a/src/data_segment2.h b/src/data_segment2.h new file mode 100644 index 000000000..59856fe62 --- /dev/null +++ b/src/data_segment2.h @@ -0,0 +1,80 @@ +#ifndef DATA_SEGMENT2_H +#define DATA_SEGMENT2_H + +extern s32 D_02007B38[]; + +extern Gfx D_02007650[]; +extern Gfx D_020076B0[]; +extern Gfx D_020076E0[]; +extern Gfx D_02007708[]; +extern Gfx D_02007728[]; +extern Gfx D_02007748[]; +extern Gfx D_02007768[]; +extern Gfx D_02007788[]; +extern Gfx D_020077A8[]; +extern Gfx D_020077D8[]; +extern Gfx D_020077F8[]; +extern Gfx D_02007818[]; +extern Gfx D_02007838[]; +extern Gfx D_02007858[]; +extern Gfx D_02007878[]; +extern Gfx D_02007898[]; +extern Gfx D_020078B8[]; +extern Gfx D_020078D8[]; +extern Gfx D_020078F8[]; +extern Gfx D_02007918[]; +extern Gfx D_02007938[]; +extern Gfx D_02007958[]; +extern Gfx D_02007978[]; +extern Gfx D_02007998[]; +extern Gfx D_020079B8[]; +extern Gfx D_020079D8[]; +extern Gfx D_020079F8[]; +extern Gfx D_02007A18[]; +extern Gfx D_02007A38[]; +extern Gfx D_02007A58[]; +extern Gfx D_02007A78[]; +extern Gfx D_02007A98[]; +extern Gfx D_02007AB8[]; +extern Gfx D_02007AD8[]; +extern Gfx D_02007AF8[]; +extern Gfx D_02007B18[]; +extern Gfx D_02007F18[]; +extern Gfx D_02007F48[]; +extern Gfx D_02007F60[]; +extern Gfx D_02007FC8[]; +extern Gfx D_02008008[]; +extern Gfx D_02008030[]; +extern Gfx D_02008058[]; +extern Gfx D_060093F8[]; +extern Gfx D_0D006940[]; + +extern mk_Vtx_Flag D_02007BB8[]; +extern mk_Vtx_Flag D_02007BD8[]; +extern mk_Vtx_Flag D_02007BF8[]; +extern mk_Vtx_Flag D_02007C18[]; +extern mk_Vtx_Flag D_02007C38[]; +extern mk_Vtx_Flag D_02007C58[]; +extern mk_Vtx_Flag D_02007C78[]; +extern mk_Vtx_Flag D_02007C98[]; +extern mk_Vtx_Flag D_02007CB8[]; +extern mk_Vtx_Flag D_02007CD8[]; +extern mk_Vtx_Flag D_02007CF8[]; +extern mk_Vtx_Flag D_02007D18[]; +extern mk_Vtx_Flag D_02007D38[]; +extern mk_Vtx_Flag D_02007D58[]; +extern mk_Vtx_Flag D_02007D78[]; +extern mk_Vtx_Flag D_02007D98[]; +extern mk_Vtx_Flag D_02007DB8[]; +extern mk_Vtx_Flag D_02007DD8[]; +extern mk_Vtx_Flag D_02007DF8[]; +extern mk_Vtx_Flag D_02007E18[]; +extern mk_Vtx_Flag D_02007E38[]; +extern mk_Vtx_Flag D_02007E58[]; +extern mk_Vtx_Flag D_02007E78[]; +extern mk_Vtx_Flag D_02007E98[]; +extern mk_Vtx_Flag D_02007EB8[]; +extern mk_Vtx_Flag D_02007ED8[]; +extern mk_Vtx_Flag D_02007EF8[]; + +#endif diff --git a/src/data_segment2.inc.c b/src/data_segment2.inc.c index 57dedb9b6..2bbc7b091 100644 --- a/src/data_segment2.inc.c +++ b/src/data_segment2.inc.c @@ -2,39 +2,7 @@ #include #include #include - -extern mk_Vtx_Flag D_02007BB8[]; -extern s32 D_800E84C0[]; -extern mk_Vtx_Flag D_02007BD8[]; -extern mk_Vtx_Flag D_02007BF8[]; -extern mk_Vtx_Flag D_02007C18[]; -extern mk_Vtx_Flag D_02007C38[]; -extern mk_Vtx_Flag D_02007C58[]; -extern mk_Vtx_Flag D_02007C78[]; -extern mk_Vtx_Flag D_02007C98[]; -extern mk_Vtx_Flag D_02007CB8[]; -extern mk_Vtx_Flag D_02007CD8[]; -extern mk_Vtx_Flag D_02007CF8[]; -extern mk_Vtx_Flag D_02007D18[]; -extern mk_Vtx_Flag D_02007D38[]; -extern mk_Vtx_Flag D_02007D58[]; -extern mk_Vtx_Flag D_02007D78[]; -extern mk_Vtx_Flag D_02007D98[]; -extern mk_Vtx_Flag D_02007DB8[]; -extern mk_Vtx_Flag D_02007DD8[]; -extern mk_Vtx_Flag D_02007DF8[]; -extern mk_Vtx_Flag D_02007E18[]; -extern mk_Vtx_Flag D_02007E38[]; -extern mk_Vtx_Flag D_02007E58[]; -extern mk_Vtx_Flag D_02007E78[]; -extern mk_Vtx_Flag D_02007E98[]; -extern mk_Vtx_Flag D_02007EB8[]; -extern mk_Vtx_Flag D_02007ED8[]; -extern mk_Vtx_Flag D_02007EF8[]; - -extern Gfx D_060093F8[]; - -extern Gfx D_0D006940[]; +#include "data_segment2.h" Gfx D_02007650[] = { gsDPPipeSync(), @@ -521,4 +489,4 @@ Gfx D_02008058[] = { gsDPPipeSync(), gsDPSetCycleType(G_CYC_1CYCLE), gsSPEndDisplayList(), -}; \ No newline at end of file +};