diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2022-06-18 03:49:53 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-18 02:49:53 -0700 |
| commit | 9ac748b0d022987fc1137ae4ac7b3a0c42f0ef23 (patch) | |
| tree | d8aeefd7730a540282dc8c6e7ec87be229dad915 /src/code_800AF9B0.c | |
| parent | 22ca23f32c239127d8e379e0ba3b0bc12f063e35 (diff) | |
Match func in staff_ghosts.c and name menus file (#227)
* name some code files
* staff ghost func match
* Update README.md
Diffstat (limited to 'src/code_800AF9B0.c')
| -rw-r--r-- | src/code_800AF9B0.c | 4113 |
1 files changed, 0 insertions, 4113 deletions
diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c deleted file mode 100644 index 5d4b81183..000000000 --- a/src/code_800AF9B0.c +++ /dev/null @@ -1,4113 +0,0 @@ -#include <ultra64.h> -#include <macros.h> -#include <defines.h> -#include "global.h" - -#include "code_80091750.h" -#include "code_800AF9B0.h" - -void func_800AF9B0(void) { - D_8018EDB8 = func_802A7B70(7680); - D_8018EDBC = func_802A7B70(7680); -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800F2B30; -extern void *gDisplayListHead; - -void func_800AF9E4(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s16 arg5, s32 arg6, s32 arg7) { - f32 temp_f0; - s32 temp_a1; - s32 temp_lo; - s32 temp_t1; - s32 temp_v0; - void *temp_a3; - void *temp_a3_2; - void *temp_a3_3; - void *temp_a3_4; - void *temp_a3_5; - void *temp_v1; - s32 phi_v0; - s16 phi_t6; - s32 phi_a1; - s32 phi_v1; - s32 phi_v0_2; - - temp_lo = arg2 * arg3; - temp_f0 = D_800F2B30; - phi_v0 = 0; - phi_v0_2 = 0; - do { - temp_v1 = arg0 + (phi_v0 * 0x10); - temp_a1 = phi_v0 % 2; - temp_t1 = arg1 + 1; - temp_v1->unk0 = ((temp_a1 * arg7) + arg6) - 0x1F8; - temp_v0 = phi_v0 + 1; - phi_v0 = temp_v0; - if ((phi_v0 / 2) == 0) { - temp_v1->unk2 = temp_lo - 0x1A4; - } else { - temp_v1->unk2 = (temp_lo + arg3) - 0x1A4; - } - if (temp_a1 == 0) { - phi_t6 = temp_v1->unk2 + ((arg1 * arg1) * temp_f0); - } else { - phi_t6 = temp_v1->unk2 + ((temp_t1 * temp_t1) * temp_f0); - } - temp_v1->unk2 = phi_t6; - temp_v1->unkC = 0; - temp_v1->unkD = 0; - temp_v1->unkE = 0x78; - temp_v1->unkF = 0xFF; - if (temp_a1 == 0) { - temp_v1->unk4 = arg4; - } else { - temp_v1->unk4 = arg5; - } - } while (temp_v0 != 4); - if ((((arg1 / 2) + (arg2 / 2)) & 1) == 0) { - phi_a1 = 0; - phi_v1 = 0; - } else { - phi_a1 = 0xFF; - phi_v1 = 0xFF; - phi_v0_2 = 0xFF; - } - temp_a3 = gDisplayListHead; - gDisplayListHead = temp_a3 + 8; - temp_a3->unk0 = 0xFA000000; - temp_a3->unk4 = (phi_a1 << 0x18) | ((phi_v1 & 0xFF) << 0x10) | ((phi_v0_2 & 0xFF) << 8) | 0xFF; - temp_a3_2 = gDisplayListHead; - gDisplayListHead = temp_a3_2 + 8; - temp_a3_2->unk4 = 0; - temp_a3_2->unk0 = 0xE7000000; - temp_a3_3 = gDisplayListHead; - gDisplayListHead = temp_a3_3 + 8; - temp_a3_3->unk0 = 0x400103F; - temp_a3_3->unk4 = arg0 + 0x80000000; - temp_a3_4 = gDisplayListHead; - gDisplayListHead = temp_a3_4 + 8; - temp_a3_4->unk4 = 0x20400; - temp_a3_4->unk0 = 0xBF000000; - temp_a3_5 = gDisplayListHead; - gDisplayListHead = temp_a3_5 + 8; - temp_a3_5->unk4 = 0x60402; - temp_a3_5->unk0 = 0xBF000000; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AF9E4.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f64 D_800F2B38; -extern f32 D_800F2B40; - -void func_800AFC54(s32 arg0, s32 arg1, s32 arg2, s32 arg3, void *arg4) { - s32 sp3C; - s32 sp38; - s32 sp34; - f32 sp20; - f32 sp1C; - f32 sp18; - f32 temp_f0; - f32 temp_f14; - f32 temp_f16; - f32 temp_f18; - f32 temp_f2; - s16 temp_t1; - s16 temp_t2; - s16 temp_t3; - s16 temp_t6; - s16 temp_t7; - s16 temp_t9; - s32 temp_a0; - s32 temp_a1; - s32 temp_a2; - s32 temp_a3; - s32 temp_v0_2; - s32 temp_v1_2; - void *temp_t0; - void *temp_v0; - void *temp_v1; - f32 phi_f2; - - temp_v0 = (arg1 * 0x10) + arg0; - temp_v1 = (arg2 * 0x10) + arg0; - temp_t0 = (arg3 * 0x10) + arg0; - temp_t9 = temp_t0->unk0; - temp_t1 = temp_v1->unk0; - temp_t2 = temp_v1->unk2; - temp_t3 = temp_v1->unk4; - sp3C = temp_t9; - temp_t6 = temp_t0->unk2; - temp_v0_2 = temp_t2 - temp_v0->unk2; - temp_a0 = temp_t3 - temp_v0->unk4; - sp38 = temp_t6; - temp_t7 = temp_t0->unk4; - temp_a1 = temp_t6 - temp_t2; - temp_v1_2 = temp_t7 - temp_t3; - sp34 = temp_t7; - temp_a2 = temp_t9 - temp_t1; - temp_a3 = temp_t1 - temp_v0->unk0; - temp_f14 = (temp_v0_2 * temp_v1_2) - (temp_a0 * temp_a1); - sp20 = temp_f14; - temp_f16 = (temp_a0 * temp_a2) - (temp_a3 * temp_v1_2); - sp1C = temp_f16; - temp_f18 = (temp_a3 * temp_a1) - (temp_v0_2 * temp_a2); - sp18 = temp_f18; - temp_f0 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f18 * temp_f18)); - phi_f2 = temp_f0; - if (temp_f0 < D_800F2B38) { - phi_f2 = D_800F2B40; - } - temp_f2 = 1.0 / phi_f2; - arg4->unk0 = temp_f14 * temp_f2 * 120.0f; - arg4->unk2 = temp_f16 * temp_f2 * 120.0f; - arg4->unk4 = temp_f18 * temp_f2 * 120.0f; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFC54.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800AFE00(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { - s16 sp1A; - s16 sp14; - s16 *temp_a1; - s16 *temp_a3; - s32 temp_v0; - s32 temp_v1; - void *temp_a1_2; - void *temp_a3_2; - void *temp_t1; - void *temp_t3; - s16 *phi_a3; - s16 *phi_t0; - s16 *phi_a1; - s16 *phi_t1; - s32 phi_v1; - s32 phi_v0; - s32 phi_v1_2; - - if (arg2 == 0) { - phi_v0 = 0; - } else { - phi_v0 = arg2 - 1; - } - phi_a1 = &sp14; - if (arg2 == arg3) { - phi_v1_2 = arg3; - } else { - phi_v1_2 = arg2 + 1; - } - phi_a3 = arg1 + (arg2 * 6); - phi_t0 = arg1 + (phi_v0 * 6); - phi_t1 = arg1 + (phi_v1_2 * 6); - do { - temp_a1 = phi_a1 + 2; - temp_a3 = phi_a3 + 2; - temp_a1->unk-2 = (*phi_a3 + *phi_t0) / 2; - temp_a1->unk4 = (temp_a3->unk-2 + *phi_t1) / 2; - phi_a3 = temp_a3; - phi_t0 += 2; - phi_a1 = temp_a1; - phi_t1 += 2; - } while (temp_a1 != &sp1A); - phi_v1 = 0; - do { - temp_v0 = phi_v1 * 0x10; - temp_a1_2 = arg0 + temp_v0; - temp_a1_2->unkC = sp14; - temp_a3_2 = arg0 + 0x10 + temp_v0; - temp_t1 = arg0 + 0x20 + temp_v0; - temp_a1_2->unkD = sp16; - temp_t3 = arg0 + 0x30 + temp_v0; - temp_v1 = phi_v1 + 0x30; - temp_a1_2->unkE = sp18; - temp_a3_2->unkC = sp1A; - temp_a3_2->unkD = sp1C; - temp_a3_2->unkE = sp1E; - temp_t1->unkC = sp14; - temp_t1->unkD = sp16; - temp_t1->unkE = sp18; - temp_t3->unkC = sp1A; - temp_t3->unkD = sp1C; - temp_t3->unkE = sp1E; - phi_v1 = temp_v1; - } while (temp_v1 != 0x1E0); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFE00.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800AFC54(s32, ?, ?, ?, ? *); // extern -? func_800AFE00(s32, ? *, s32, ?); // extern - -void func_800AFF58(s32 arg0) { - ? sp88; - ? sp40; - s32 temp_s0; - u32 temp_s2; - s32 phi_s1; - ? *phi_s2; - s32 phi_s1_2; - s32 phi_s0; - - phi_s1 = 0; - phi_s2 = &sp40; - phi_s1_2 = 0; - do { - func_800AFC54((phi_s1 * 0x10) + arg0, 1, 2, 0, phi_s2); - temp_s2 = phi_s2 + 6; - phi_s1 += 4; - phi_s2 = temp_s2; - } while (temp_s2 < &sp88); - phi_s0 = 0; - do { - func_800AFE00((phi_s1_2 * 0x10) + arg0, &sp40, phi_s0, 0xB); - temp_s0 = phi_s0 + 1; - phi_s1_2 += 4; - phi_s0 = temp_s0; - } while (temp_s0 != 0xC); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFF58.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800AF9E4(s32, s32, s32, ?, s32, s32, s32, s32); // extern -? func_800AFF58(s32); // extern -f32 sins(s32); // extern -extern ? D_800E8680; -extern ? D_800E8688; -extern f32 D_800F2B44; -extern s16 D_8018EDB0; -extern s16 D_8018EDB2; -extern s16 D_8018EDB4; -extern s32 D_8018EDB8; -extern s32 D_8018EDBC; -extern void *gDisplayListHead; - -void func_800B0004(void) { - s32 spBC; - s32 sp64; - f32 temp_f22; - s32 temp_fp; - s32 temp_s1; - s32 temp_s4; - void *temp_a0; - void *temp_a1; - void *temp_a2; - void *temp_a3; - void *temp_t0; - void *temp_t1; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - void *temp_v0_4; - s32 phi_s0; - s32 phi_s3; - s32 phi_fp; - s32 phi_s2; - - temp_a0 = gDisplayListHead; - gDisplayListHead = temp_a0 + 8; - temp_a0->unk0 = 0x3860010; - temp_a0->unk4 = &D_800E8688 - 0x80000000; - temp_a1 = gDisplayListHead; - gDisplayListHead = temp_a1 + 8; - temp_a1->unk0 = 0x3880010; - temp_a1->unk4 = &D_800E8680 - 0x80000000; - temp_a2 = gDisplayListHead; - gDisplayListHead = temp_a2 + 8; - temp_a2->unk4 = 0x80000040; - temp_a2->unk0 = 0xBC000002; - temp_a3 = gDisplayListHead; - gDisplayListHead = temp_a3 + 8; - temp_a3->unk4 = 0x204; - temp_a3->unk0 = 0xB7000000; - temp_t0 = gDisplayListHead; - gDisplayListHead = temp_t0 + 8; - temp_t0->unk4 = -0x604; - temp_t0->unk0 = 0xFC327E64; - temp_t1 = gDisplayListHead; - gDisplayListHead = temp_t1 + 8; - temp_t1->unk4 = 0x2000; - temp_t1->unk0 = 0xB6000000; - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->unk4 = 0x20000; - temp_v0->unk0 = 0xB7000000; - if ((D_8018EDB4 % 2) != 0) { - spBC = D_8018EDB8; - } else { - spBC = D_8018EDBC; - } - D_8018EDB2 = 0x9C0; - temp_f22 = D_800F2B44; - sp64 = 0; - phi_fp = 0; - do { - phi_s0 = 0; - phi_s3 = 0; - phi_s2 = 0; -loop_5: - temp_s1 = phi_s0 + 1; - temp_s4 = sins((D_8018EDB0 - (phi_s0 * D_8018EDB2)) & 0xFFFF) * 84.0f * phi_s0 * temp_f22; - func_800AF9E4((phi_s3 * 0x10) + spBC + (sp64 * 0x10), phi_s0, phi_fp, 0x54, temp_s4, sins((D_8018EDB0 - (temp_s1 * D_8018EDB2)) & 0xFFFF) * 84.0f * temp_s1 * temp_f22, phi_s2, 0x54); - phi_s0 = temp_s1; - phi_s3 += 4; - phi_s2 += 0x54; - if (temp_s1 != 0xC) { - goto loop_5; - } - temp_fp = phi_fp + 1; - sp64 += 0x30; - phi_fp = temp_fp; - } while (temp_fp != 0xA); - func_800AFF58(spBC); - D_8018EDB0 = D_8018EDB0 + D_8018EDB2; - D_8018EDB4 = D_8018EDB4 + 1; - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xB7000000; - temp_v0_2->unk4 = 0x2000; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0x80000040; - temp_v0_3->unk0 = 0xBC000002; - temp_v0_4 = gDisplayListHead; - gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->unk4 = 0x20000; - temp_v0_4->unk0 = 0xB6000000; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0004.s") -#endif - - -#if NEEDS_RODATA -void func_800B0350(void) { - u16 controllerIdx; - - if (D_800E86A4 == 0) { - for (controllerIdx = 0; controllerIdx < 4; controllerIdx++) { - if ((func_800B4520() == 0) && (gEnableDebugMode != 0) && ((gControllers[controllerIdx].buttonPressed & 0x1000) != 0)) { - if ((gMenuSelection != MAIN_MENU) && (gMenuSelection != PLAYER_SELECT_MENU)) { - if (gMenuSelection == COURSE_SELECT_MENU) { - func_800CA330(0x19); - } - } - play_sound2(0x49008016); - if ((gMenuSelection != CONTROLLER_PAK_MENU) && (gMenuSelection != START_MENU)) { - func_8009E1C0(); - } - } - osViSetSpecialFeatures(D_800E86E4); - switch (gMenuSelection) { - case OPTIONS_MENU: - func_800B053C(&gControllers[controllerIdx], controllerIdx); - break; - case DATA_MENU: - func_800B13B0(&gControllers[controllerIdx], controllerIdx); - break; - case COURSE_DATA_MENU: - func_800B15AC(&gControllers[controllerIdx], controllerIdx); - break; - case LOGO_INTRO_MENU: - func_800B1C40(&gControllers[controllerIdx], controllerIdx); - break; - case CONTROLLER_PAK_MENU: - if (controllerIdx == 0) { - func_800B1C90(&gControllers[controllerIdx], controllerIdx); - } - break; - case START_MENU_FROM_QUIT: - case START_MENU: - func_800B20F4(&gControllers[controllerIdx], controllerIdx); - break; - case MAIN_MENU_FROM_QUIT: - case MAIN_MENU: - func_800B29D8(&gControllers[controllerIdx], controllerIdx); - break; - case PLAYER_SELECT_MENU_FROM_QUIT: - case PLAYER_SELECT_MENU: - func_800B3554(&gControllers[controllerIdx], controllerIdx); - break; - case COURSE_SELECT_MENU_FROM_QUIT: - case COURSE_SELECT_MENU: - func_800B3B58(&gControllers[controllerIdx], controllerIdx); - break; - } - } - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0350.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -? func_8009E280(); /* extern */ -s32 func_800B5B94(); /* extern */ -s32 func_800B5DA4(); /* extern */ -? func_800B6088(s32); /* extern */ -s32 func_800B6178(s32); /* extern */ -s32 func_800B65F4(s32, s32); /* extern */ -? func_800B6708(); /* extern */ -? func_800B6798(); /* extern */ -s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ -? play_sound2(?, u16, u16); /* extern */ -extern void *D_8018D9C0; -extern ? D_8018E868; -extern ? D_8018EB84; -extern ? D_8018EE10; -extern ? D_8018EE14; -extern ? D_8018EE15; -extern u8 D_8018EE94; -extern s8 D_8018EE95; -static s32 D_800DC5AC = 0; -static u16 D_800E86F0; /* unable to generate initializer; const */ -static s32 D_800E86F4 = 0x4E4B544A; /* const */ -static ? D_800F2E64; /* unable to generate initializer; const */ -static ? D_800F2E74; /* unable to generate initializer; const */ - -void func_800B053C(struct Controller *arg0, u16 arg1) { - u16 sp3E; - struct_8018D9E0_entry *sp38; - void *sp30; - s32 sp2C; - s32 sp20; - f64 temp_f0; - f64 temp_f0_10; - f64 temp_f0_2; - f64 temp_f0_3; - f64 temp_f0_4; - f64 temp_f0_5; - f64 temp_f0_6; - f64 temp_f0_7; - f64 temp_f0_8; - f64 temp_f0_9; - s32 temp_t7; - s32 temp_t9_2; - s32 temp_v0_10; - s32 temp_v0_11; - s32 temp_v0_7; - s32 temp_v0_8; - s8 temp_v0_4; - s8 temp_v0_9; - s8 temp_v1; - s8 temp_v1_2; - s8 temp_v1_3; - s8 temp_v1_4; - s8 temp_v1_5; - s8 temp_v1_6; - struct_8018D9E0_entry *temp_t0; - struct_8018D9E0_entry *temp_v0; - u16 temp_t8; - u32 temp_t9; - u8 temp_v0_2; - u8 temp_v0_3; - u8 temp_v0_5; - u8 temp_v0_6; - void *temp_a0; - u16 phi_a2; - s32 phi_a1; - s8 *phi_t1; - s32 phi_a1_2; - s8 *phi_t1_2; - s32 phi_a1_3; - s8 *phi_t1_3; - u16 phi_a1_4; - struct_8018D9E0_entry *phi_t0; - s8 *phi_t1_4; - s32 phi_a1_5; - s8 *phi_t1_5; - s32 phi_v0; - s32 phi_v0_2; - - temp_t8 = (arg0->buttonPressed | arg0->stickPressed) & 0xFFFF; - phi_a2 = temp_t8; - if ((gEnableDebugMode == 0) && ((temp_t8 & 0x1000) != 0)) { - phi_a2 = (temp_t8 | 0x8000) & 0xFFFF; - } - sp3E = phi_a2; - if (func_800B4520(phi_a2) == 0) { - sp3E = phi_a2; - temp_v0 = find_8018D9E0_entry_dupe(0xF0); - temp_v1 = D_8018EDEC; - temp_t0 = temp_v0; - sp30 = D_8018D9C0; - phi_t1_4 = &D_8018EDEC; - switch (temp_v1) { /* switch 1 */ - case 0x15: /* switch 1 */ - case 0x16: /* switch 1 */ - case 0x17: /* switch 1 */ - case 0x18: /* switch 1 */ - sp2C = 0; - phi_a1 = (s32) phi_a2; - if (((phi_a2 & 0x400) != 0) && ((s32) temp_v1 < 0x18)) { - D_8018EDEC = temp_v1 + 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, phi_a2, phi_a2); - temp_f0 = (f64) temp_t0->unk24; - phi_a1 = sp20; - if (temp_f0 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0 + 4.0); - } - temp_t0->unk8 = 1; - sp2C = 1; - } - phi_t1 = &D_8018EDEC; - if ((phi_a1 & 0x800) != 0) { - temp_v1_2 = D_8018EDEC; - if ((s32) temp_v1_2 >= 0x16) { - D_8018EDEC = temp_v1_2 - 1; - sp2C = 1; - sp20 = phi_a1; - sp38 = temp_t0; - play_sound2(0x49008000, (u16) phi_a1); - temp_f0_2 = (f64) temp_t0->unk24; - phi_t1 = &D_8018EDEC; - if (temp_f0_2 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_2 + 4.0); - } - temp_t0->unk8 = -1; - } - } - if (sp2C != 0) { - temp_v0_2 = gSoundMode; - if (temp_t0->unk4 != temp_v0_2) { - gSaveDataSoundMode = temp_v0_2; - sp20 = phi_a1; - sp38 = temp_t0; - write_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); - temp_t0->unk4 = (s32) gSoundMode; - phi_t1 = &D_8018EDEC; - } - } - if (((u16) phi_a1 & 0x4000) != 0) { - sp38 = temp_t0; - func_8009E280(); - play_sound2(0x49008002); - temp_v0_3 = gSoundMode; - if (temp_t0->unk4 != temp_v0_3) { - gSaveDataSoundMode = temp_v0_3; - sp38 = temp_t0; - write_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); - temp_t0->unk4 = (s32) gSoundMode; - return; - } - } else if (((u16) phi_a1 & 0x8000) != 0) { - temp_v0_4 = *phi_t1; - switch (temp_v0_4) { /* switch 3; irregular */ - case 22: /* switch 3 */ - temp_v0_5 = gSoundMode; - if ((s32) temp_v0_5 < 3) { - gSoundMode = temp_v0_5 + 1; - } else { - gSoundMode = 0; - } - if (gSoundMode == 2) { - gSoundMode = 3; - } - func_800B44BC(); - temp_v0_6 = gSoundMode; - switch (temp_v0_6) { /* switch 4; irregular */ - case 0: /* switch 4 */ - play_sound2(0x49008024); - return; - case 1: /* switch 4 */ - play_sound2(0x49008025); - return; - case 3: /* switch 4 */ - play_sound2(0x49008029); - return; - } - break; - case 23: /* switch 3 */ - sp38 = temp_t0; - temp_v0_7 = func_800B5DA4(); - switch (temp_v0_7) { /* switch 5; irregular */ - case -1: /* switch 5 */ - D_8018EDEC = 0x2B; - play_sound2(0x4900FF07); - return; - case 0: /* switch 5 */ - sp38 = temp_t0; - func_800B6798(); - temp_v0_8 = func_800B5B94(); - temp_t9 = temp_v0_8 + 1; - sp2C = temp_v0_8; - switch (temp_t9) { /* switch 2 */ - case 0: /* switch 2 */ - D_8018EDEC = 0x46; - temp_t0->unk4 = 0; - play_sound2(0x49008001); - break; - case 1: /* switch 2 */ - func_800B6708(); - break; - case 2: /* switch 2 */ - D_8018EDEC = 0x34; - play_sound2(0x4900FF07); - break; - case 5: /* switch 2 */ - D_8018EDEC = 0x37; - play_sound2(0x4900FF07); - break; - default: /* switch 2 */ - D_8018EDEC = 0x35; - play_sound2(0x4900FF07); - break; - } - if ((sp2C == -1) && (sp30->unk4 == 0) && (sp30->unk84 == 0)) { - D_8018EDEC = 0x2A; - play_sound2(0x4900FF07); - return; - } - if (sp2C == 0) { - if (sp30->unk4 != 0) { - D_8018EDEC = 0x28; - play_sound2(0x49008001); - return; - } - if (sp30->unk84 != 0) { - D_8018EDEC = 0x29; - play_sound2(0x49008001); - return; - } - D_8018EDEC = 0x2A; - play_sound2(0x4900FF07); - return; - } - break; - case 1: /* switch 5 */ - D_8018EDEC = 0x2C; - play_sound2(0x4900FF07); - return; - default: /* switch 5 */ - case 2: /* switch 5 */ - D_8018EDEC = 0x2D; - play_sound2(0x4900FF07); - return; - } - break; - case 24: /* switch 3 */ - *phi_t1 = 0x1E; - play_sound2(0x49008001, (u16) phi_a1); - return; - case 21: /* switch 3 */ - func_8009E280(); - play_sound2(0x49008002); - return; - } - } - break; - case 0x1E: /* switch 1 */ - case 0x1F: /* switch 1 */ - phi_a1_2 = (s32) phi_a2; - if (((phi_a2 & 0x400) != 0) && ((s32) temp_v1 < 0x1F)) { - D_8018EDEC = temp_v1 + 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, phi_a2, phi_a2); - temp_f0_3 = (f64) temp_t0->unk24; - phi_a1_2 = sp20; - if (temp_f0_3 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_3 + 4.0); - } - temp_t0->unk8 = 1; - } - phi_t1_2 = &D_8018EDEC; - if ((phi_a1_2 & 0x800) != 0) { - temp_v1_3 = D_8018EDEC; - if ((s32) temp_v1_3 >= 0x1F) { - D_8018EDEC = temp_v1_3 - 1; - sp20 = phi_a1_2; - sp38 = temp_t0; - play_sound2(0x49008000, (u16) phi_a1_2); - temp_f0_4 = (f64) temp_t0->unk24; - phi_t1_2 = &D_8018EDEC; - if (temp_f0_4 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_4 + 4.0); - } - temp_t0->unk8 = -1; - } - } - if (((u16) phi_a1_2 & 0x4000) != 0) { - *phi_t1_2 = 0x18; - play_sound2(0x49008002, (u16) phi_a1_2); - return; - } - if (((u16) phi_a1_2 & 0x8000) != 0) { - temp_v0_9 = *phi_t1_2; - switch (temp_v0_9) { /* switch 6; irregular */ - case 30: /* switch 6 */ - *phi_t1_2 = 0x18; - play_sound2(0x49008002, (u16) phi_a1_2); - return; - case 31: /* switch 6 */ - *phi_t1_2 = 0x20; - func_800B46D0(0x49000000, (u16) phi_a1_2); - D_800DC5AC = 0; - play_sound2(0x4900801D); - return; - } - } - break; - case 0x20: /* switch 1 */ - if ((phi_a2 & 0xD000) != 0) { - D_8018EDEC = 0x18; - play_sound2(0x49008002); - return; - } - break; - case 0x28: /* switch 1 */ - case 0x29: /* switch 1 */ - phi_a1_3 = (s32) phi_a2; - if (((phi_a2 & 0x400) != 0) && ((s32) temp_v1 < 0x29) && (sp30->unk84 != 0)) { - D_8018EDEC = temp_v1 + 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, phi_a2, phi_a2); - temp_f0_5 = (f64) temp_t0->unk24; - phi_a1_3 = sp20; - if (temp_f0_5 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_5 + 4.0); - } - temp_t0->unk8 = 1; - } - phi_t1_3 = &D_8018EDEC; - if ((phi_a1_3 & 0x800) != 0) { - temp_v1_4 = D_8018EDEC; - if (((s32) temp_v1_4 >= 0x29) && (sp30->unk4 != 0)) { - D_8018EDEC = temp_v1_4 - 1; - sp20 = phi_a1_3; - sp38 = temp_t0; - play_sound2(0x49008000, (u16) phi_a1_3); - temp_f0_6 = (f64) temp_t0->unk24; - phi_t1_3 = &D_8018EDEC; - if (temp_f0_6 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_6 + 4.0); - } - temp_t0->unk8 = -1; - } - } - if (((u16) phi_a1_3 & 0x4000) != 0) { - *phi_t1_3 = 0x17; - play_sound2(0x49008002, (u16) phi_a1_3); - return; - } - if (((u16) phi_a1_3 & 0x8000) != 0) { - temp_t9_2 = *phi_t1_3 - 0x28; - temp_t0->unk20 = temp_t9_2; - if (((sp30 + (temp_t9_2 << 7))->unk5 == D_8018EE95) && (D_8018EE94 != 0)) { - *phi_t1_3 = 0x33; - } else { - *phi_t1_3 = 0x32; - } - play_sound2(0x49008001, (u16) phi_a1_3); - return; - } - break; - case 0x32: /* switch 1 */ - case 0x33: /* switch 1 */ - temp_a0 = ((temp_v1 - 0x32) << 7) + &D_8018EE10; - phi_a1_4 = phi_a2; - if (((sp30 + (temp_v0->unk20 << 7))->unk5 != temp_a0->unk5) || (phi_t0 = temp_t0, (temp_a0->unk4 == 0))) { - if (((phi_a2 & 0x400) != 0) && ((s32) temp_v1 < 0x33)) { - D_8018EDEC = temp_v1 + 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, phi_a2, phi_a2); - temp_f0_7 = (f64) temp_t0->unk24; - if (temp_f0_7 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_7 + 4.0); - } - temp_t0->unk8 = 1; - } - phi_a1_4 = (u16) (s32) phi_a2; - phi_t0 = temp_t0; - phi_t1_4 = &D_8018EDEC; - if (((s32) phi_a2 & 0x800) != 0) { - temp_v1_5 = D_8018EDEC; - if ((s32) temp_v1_5 >= 0x33) { - D_8018EDEC = temp_v1_5 - 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, (u16) (s32) phi_a2); - temp_f0_8 = (f64) temp_t0->unk24; - phi_a1_4 = (u16) (s32) phi_a2; - phi_t0 = temp_t0; - phi_t1_4 = &D_8018EDEC; - if (temp_f0_8 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_8 + 4.0); - } - temp_t0->unk8 = -1; - } - } - } - if ((phi_a1_4 & 0x4000) != 0) { - *phi_t1_4 = phi_t0->unk20 + 0x28; - play_sound2(0x49008002, phi_a1_4); - return; - } - if ((phi_a1_4 & 0x8000) != 0) { - temp_t7 = *phi_t1_4 - 0x32; - phi_t0->unk1C = temp_t7; - if (*(&D_8018EE14 + (temp_t7 << 7)) != 0) { - *phi_t1_4 = 0x38; - } else { - *phi_t1_4 = 0x3A; - phi_t0->unk4 = 0; - } - play_sound2(0x49008001, phi_a1_4); - return; - } - break; - case 0x2A: /* switch 1 */ - case 0x2B: /* switch 1 */ - case 0x2C: /* switch 1 */ - case 0x2D: /* switch 1 */ - case 0x34: /* switch 1 */ - case 0x35: /* switch 1 */ - case 0x37: /* switch 1 */ - case 0x3C: /* switch 1 */ - case 0x41: /* switch 1 */ - case 0x42: /* switch 1 */ - if ((phi_a2 & 0xD000) != 0) { - D_8018EDEC = 0x17; - play_sound2(0x49008002); - return; - } - break; - case 0x38: /* switch 1 */ - case 0x39: /* switch 1 */ - phi_a1_5 = (s32) phi_a2; - if (((phi_a2 & 0x100) != 0) && ((s32) temp_v1 < 0x39)) { - D_8018EDEC = temp_v1 + 1; - sp20 = (s32) phi_a2; - sp38 = temp_t0; - play_sound2(0x49008000, phi_a2, phi_a2); - temp_f0_9 = (f64) temp_t0->unk24; - phi_a1_5 = sp20; - if (temp_f0_9 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_9 + 4.0); - } - temp_t0->unk8 = 1; - } - phi_t1_5 = &D_8018EDEC; - if ((phi_a1_5 & 0x200) != 0) { - temp_v1_6 = D_8018EDEC; - if ((s32) temp_v1_6 >= 0x39) { - D_8018EDEC = temp_v1_6 - 1; - sp20 = phi_a1_5; - sp38 = temp_t0; - play_sound2(0x49008000, (u16) phi_a1_5); - temp_f0_10 = (f64) temp_t0->unk24; - phi_t1_5 = &D_8018EDEC; - if (temp_f0_10 < 4.2) { - temp_t0->unk24 = (f32) (temp_f0_10 + 4.0); - } - temp_t0->unk8 = -1; - } - } - if (((u16) phi_a1_5 & 0x4000) != 0) { - *phi_t1_5 = temp_t0->unk1C + 0x32; - play_sound2(0x49008002, (u16) phi_a1_5); - return; - } - if (((u16) phi_a1_5 & 0x8000) != 0) { - if (*phi_t1_5 == 0x38) { - *phi_t1_5 = 0x17; - play_sound2(0x49008002, (u16) phi_a1_5); - return; - } - *phi_t1_5 = 0x3A; - sp38 = temp_t0; - play_sound2(0x49008001, (u16) phi_a1_5); - temp_t0->unk4 = 0; - return; - } - break; - case 0x3A: /* switch 1 */ - if (arg1 == 0) { - temp_v0->unk4 += 1; - } - if (temp_v0->unk4 >= 3) { - D_8018EDEC = 0x3B; - return; - } - break; - case 0x3B: /* switch 1 */ - sp38 = temp_t0; - temp_v0_10 = func_800B5DA4(); - phi_v0 = temp_v0_10; - if (temp_v0_10 == 0) { - sp38 = temp_t0; - phi_v0 = func_800B65F4(temp_t0->unk20, temp_t0->unk1C); - } - if (phi_v0 != 0) { - D_8018EDEC = 0x42; - play_sound2(0x4900FF07); - return; - } - sp38 = temp_t0; - temp_v0_11 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84); - phi_v0_2 = temp_v0_11; - if (temp_v0_11 == 0) { - sp38 = temp_t0; - phi_v0_2 = func_800B6178(temp_t0->unk1C); - } - if (phi_v0_2 != 0) { - D_8018EDEC = 0x41; - play_sound2(0x4900FF07); - return; - } - D_8018EDEC = 0x3C; - *(&D_8018EE15 + (temp_t0->unk1C << 7)) = ((temp_t0->unk20 << 7) + sp30)->unk5; - func_800B6088(temp_t0->unk1C); - return; - case 0x46: /* switch 1 */ - if (arg1 == 0) { - temp_v0->unk4 += 1; - } - if (temp_v0->unk4 >= 3) { - D_8018EDEC = 0x47; - return; - } - break; - case 0x47: /* switch 1 */ - if (func_800B6A68() != 0) { - D_8018EDEC = 0x36; - play_sound2(0x4900FF07); - return; - } - if (sp30->unk4 != 0) { - D_8018EDEC = 0x28; - return; - } - D_8018EDEC = 0x29; - break; - } - } else { - default: /* switch 1 */ - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B053C.s") -#endif - -// Handle navigating the data menu interface -void func_800B13B0(struct Controller *controller, UNUSED u16 arg1) { - u16 buttonAndStickPress = (controller->buttonPressed | controller->stickPressed); - - // Make pressing Start have the same effect as pressing A - if ((gEnableDebugMode == 0) && ((buttonAndStickPress & 0x1000) != 0)) { - buttonAndStickPress |= 0x8000; - } - - if (func_800B4520() == 0) { - if (D_8018EDEC == 1) { - // If DPad/Stick down pressed, move selection down if not already in bottom row - if ((buttonAndStickPress & 0x400) != 0) { - if ((gTimeTrialDataCourseIndex % 4) != 3) { - ++gTimeTrialDataCourseIndex; - play_sound2(0x49008000); - } - } - // If DPad/Stick up pressed, move selection up if not already in top row - if ((buttonAndStickPress & 0x800) != 0) { - if ((gTimeTrialDataCourseIndex & 3) != 0) { - --gTimeTrialDataCourseIndex; - play_sound2(0x49008000); - } - } - // If DPad/Stick right pressed, move selection right if not already in right-most column - if ((buttonAndStickPress & 0x100) != 0) { - if ((gTimeTrialDataCourseIndex / 4) != 3) { - gTimeTrialDataCourseIndex += 4; - play_sound2(0x49008000); - } - } - // If DPad/Stick left pressed, move selection left if not already in left-most column - if ((buttonAndStickPress & 0x200) != 0) { - if ((gTimeTrialDataCourseIndex / 4) != 0) { - gTimeTrialDataCourseIndex -= 4; - play_sound2(0x49008000); - } - } - // If B pressed, go to main menu - if ((buttonAndStickPress & 0x4000) != 0) { - func_8009E258(); - play_sound2(0x49008002); - return; - } - // If A pressed, go to selected course's records - if ((buttonAndStickPress & 0x8000) != 0) { - gCourseRecordsMenuSelection = 0; - func_8009E1C0(); - play_sound2(0x49008016); - } - } - // If D_8018EDEC != 1 and A pressed, go to main menu - // (Will D_8018EDEC ever not equal 1 when entering the data menu?) - else if ((buttonAndStickPress & 0x8000) != 0) { - func_8009E258(); - play_sound2(0x49008016); - } - } -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -? play_sound2(?, s32); /* extern */ -extern s8 D_8018EDF9; - -void func_800B15AC(struct Controller *arg0, u16 arg1) { - u16 sp2E; - struct_8018D9E0_entry *sp28; - u8 *sp24; - s32 sp20; - s32 sp18; - f64 temp_f0; - f64 temp_f0_2; - f64 temp_f0_3; - f64 temp_f0_4; - f64 temp_f0_5; - s32 temp_a1_4; - s32 temp_t4; - s32 temp_v0_11; - s8 temp_a1; - s8 temp_a1_2; - s8 temp_a1_3; - s8 temp_v0; - s8 temp_v0_10; - s8 temp_v0_3; - s8 temp_v0_4; - s8 temp_v0_5; - s8 temp_v0_6; - s8 temp_v0_7; - s8 temp_v0_8; - s8 temp_v0_9; - struct_8018D9E0_entry *temp_a2; - struct_8018D9E0_entry *temp_a2_2; - struct_8018D9E0_entry *temp_v0_2; - u16 temp_t8; - u16 phi_v1; - s32 phi_a1; - s32 phi_a3; - struct_8018D9E0_entry *phi_a2; - s8 *phi_v1_2; - s32 phi_a3_2; - struct_8018D9E0_entry *phi_a2_2; - s8 *phi_v1_3; - - temp_t8 = (arg0->buttonPressed | arg0->stickPressed) & 0xFFFF; - phi_v1 = temp_t8; - if ((gEnableDebugMode == 0) && ((temp_t8 & 0x1000) != 0)) { - phi_v1 = (temp_t8 | 0x8000) & 0xFFFF; - } - sp2E = phi_v1; - if (func_800B4520() == 0) { - temp_v0 = D_8018EDEC; - switch (temp_v0) { /* irregular */ - case 11: - phi_a3 = (s32) phi_v1; - if ((phi_v1 & 0x200) != 0) { - temp_a1 = gTimeTrialDataCourseIndex; - if ((s32) temp_a1 > 0) { - gTimeTrialDataCourseIndex = temp_a1 - 1; - sp18 = (s32) phi_v1; - play_sound2(0x49008000, (s32) temp_a1); - phi_a3 = sp18; - } - } - if ((phi_a3 & 0x100) != 0) { - temp_a1_2 = gTimeTrialDataCourseIndex; - if ((s32) temp_a1_2 < 0xF) { - gTimeTrialDataCourseIndex = temp_a1_2 + 1; - sp18 = phi_a3; - play_sound2(0x49008000, (s32) temp_a1_2); - } - } - sp18 = phi_a3; - temp_v0_2 = find_8018D9E0_entry_dupe(0xE8); - temp_a1_3 = gTimeTrialDataCourseIndex; - temp_t4 = (((s32) temp_a1_3 / 4) * 0x60) + (((s32) temp_a1_3 % 4) * 0x18); - phi_a2 = temp_v0_2; - if (gCourseRecordsMenuSelection == 2) { - sp28 = temp_v0_2; - sp18 = phi_a3; - sp24 = &D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4]; - temp_a2 = temp_v0_2; - phi_a2 = temp_a2; - if (func_800B639C((s32) temp_a1_3) < 0) { - gCourseRecordsMenuSelection += -1; - } - } - temp_v0_3 = gCourseRecordsMenuSelection; - phi_v1_2 = &gCourseRecordsMenuSelection; - if ((temp_v0_3 == 1) && (D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4].unk12 == 0)) { - gCourseRecordsMenuSelection = temp_v0_3 - 1; - } - if ((phi_a3 & 0x800) != 0) { - temp_v0_4 = gCourseRecordsMenuSelection; - if ((s32) temp_v0_4 > 0) { - gCourseRecordsMenuSelection = temp_v0_4 - 1; - temp_v0_5 = gCourseRecordsMenuSelection; - if ((temp_v0_5 == 1) && (D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4].unk12 == 0)) { - gCourseRecordsMenuSelection = temp_v0_5 - 1; - } - sp28 = phi_a2; - sp18 = phi_a3; - sp24 = &D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4]; - play_sound2(0x49008000); - temp_f0 = (f64) phi_a2->unk24; - phi_v1_2 = &gCourseRecordsMenuSelection; - if (temp_f0 < 4.2) { - phi_a2->unk24 = (f32) (temp_f0 + 4.0); - } - phi_a2->unk8 = -1; - } - } - phi_a3_2 = phi_a3; - phi_a2_2 = phi_a2; - phi_v1_3 = phi_v1_2; - if ((phi_a3 & 0x400) != 0) { - temp_v0_6 = *phi_v1_2; - if ((s32) temp_v0_6 < 2) { - *phi_v1_2 = temp_v0_6 + 1; - temp_v0_7 = *phi_v1_2; - if ((temp_v0_7 == 1) && (D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4].unk12 == 0)) { - *phi_v1_2 = temp_v0_7 + 1; - } - if ((*phi_v1_2 == 2) && (sp28 = phi_a2, sp18 = phi_a3, sp24 = &D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4], phi_a3_2 = phi_a3, phi_a2_2 = phi_a2, phi_v1_3 = &gCourseRecordsMenuSelection, (func_800B639C((s32) gTimeTrialDataCourseIndex) < 0))) { - if (D_8018EB90.allCourseTimeTrialRecords.cupRecords[0].courseRecords[0].records[0][temp_t4].unk12 == 0) { - gCourseRecordsMenuSelection = 0; - } else { - gCourseRecordsMenuSelection = 1; - } - } else { - sp28 = phi_a2; - sp18 = phi_a3; - play_sound2(0x49008000); - temp_f0_2 = (f64) phi_a2->unk24; - phi_a3_2 = phi_a3; - phi_a2_2 = phi_a2; - phi_v1_3 = &gCourseRecordsMenuSelection; - if (temp_f0_2 < 4.2) { - phi_a2->unk24 = (f32) (temp_f0_2 + 4.0); - } - phi_a2->unk8 = 1; - } - } - } - if ((phi_a3_2 & 0x4000) != 0) { - func_8009E208(); - play_sound2(0x49008002); - return; - } - if ((phi_a3_2 & 0x8000) != 0) { - temp_f0_3 = (f64) phi_a2_2->unk24; - if (temp_f0_3 < 4.2) { - phi_a2_2->unk24 = (f32) (temp_f0_3 + 4.0); - } - if (*phi_v1_3 == 0) { - func_8009E208(0x49008001); - play_sound2(0x49008002); - return; - } - D_8018EDEC = 0xC; - D_8018EDF9 = 0; - play_sound2(0x49008001); - return; - } - break; - case 12: - sp18 = (s32) phi_v1; - temp_a2_2 = find_8018D9E0_entry_dupe(0xE9); - if ((sp18 & 0x800) != 0) { - temp_v0_8 = D_8018EDF9; - if ((s32) temp_v0_8 > 0) { - D_8018EDF9 = temp_v0_8 - 1; - sp28 = temp_a2_2; - sp18 = sp18; - play_sound2(0x49008000); - temp_f0_4 = (f64) temp_a2_2->unk24; - if (temp_f0_4 < 4.2) { - temp_a2_2->unk24 = (f32) (temp_f0_4 + 4.0); - } - temp_a2_2->unk8 = -1; - } - } - if ((sp18 & 0x400) != 0) { - temp_v0_9 = D_8018EDF9; - if ((s32) temp_v0_9 <= 0) { - D_8018EDF9 = temp_v0_9 + 1; - sp28 = temp_a2_2; - sp18 = sp18; - play_sound2(0x49008000); - temp_f0_5 = (f64) temp_a2_2->unk24; - if (temp_f0_5 < 4.2) { - temp_a2_2->unk24 = (f32) (temp_f0_5 + 4.0); - } - temp_a2_2->unk8 = 1; - } - } - if ((sp18 & 0x4000) != 0) { - D_8018EDEC = 0xB; - play_sound2(0x49008002); - return; - } - if ((sp18 & 0x8000) != 0) { - if (D_8018EDF9 != 0) { - temp_v0_10 = gCourseRecordsMenuSelection; - phi_a1 = 0; - switch (temp_v0_10) { /* switch 1; irregular */ - case 1: /* switch 1 */ - func_800B4728((s32) gTimeTrialDataCourseIndex); - func_800B559C((s32) gTimeTrialDataCourseIndex); - play_sound2(0x4900801D); - phi_a1 = -1; - break; - case 2: /* switch 1 */ - temp_v0_11 = func_800B639C((s32) gTimeTrialDataCourseIndex); - phi_a1 = temp_v0_11; - if (temp_v0_11 >= 0) { - sp20 = temp_v0_11; - func_800B69BC(temp_v0_11); - temp_a1_4 = sp20; - if (MIPS2C_ERROR(Read from unset register $v0) != 0) { - D_8018EDEC = 0xD; - sp20 = temp_a1_4; - play_sound2(0x4900FF07, temp_a1_4); - phi_a1 = temp_a1_4; - } else { - sp20 = temp_a1_4; - play_sound2(0x4900801D, temp_a1_4); - D_8018EDEC = 0xB; - phi_a1 = temp_a1_4; - } - } - break; - } - if ((phi_a1 + 1) == 0) { - D_8018EDEC = 0xB; - return; - } - } else { - play_sound2(0x49008002); - D_8018EDEC = 0xB; - return; - } - } - break; - case 13: - if ((phi_v1 & 0xD000) != 0) { - D_8018EDEC = 0xB; - } - break; - } - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B15AC.s") -#endif - -// Handle controller input during the logo screen -void func_800B1C40(struct Controller *arg0, UNUSED u16 arg1) { - u16 sp1E = arg0->buttonPressed | arg0->stickPressed; - - if ((func_800B4520() == 0) && (sp1E != 0)) { - func_800CA388(0x3C); - func_8009E1E4(); - } -} - -#ifdef NEEDS_RODATA -void func_800B1C90(struct Controller* controller, u16 arg1) { - u16 buttonAndStickPress; - OSPfsState* osPfsState; - s32 selectedTableRow; - s8 pad; - - buttonAndStickPress = controller->buttonPressed | controller->stickPressed; - if (func_800B4520() == 0) { - switch (gControllerPakMenuSelection) { - case CONTROLLER_PAK_MENU_SELECT_RECORD: - if ((buttonAndStickPress & 0x9000) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; - play_sound2(0x49008001); - return; - } - if ((buttonAndStickPress & 0x300) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_END; - play_sound2(0x49008000); - return; - } - break; - case CONTROLLER_PAK_MENU_END: - if ((buttonAndStickPress & 0x9000) != 0) { - play_sound2(0x49008001); - func_8009E1C0(); - D_800E86F8 = 0; - return; - } - if ((buttonAndStickPress & 0x300) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; - play_sound2(0x49008000); - return; - } - break; - case CONTROLLER_PAK_MENU_TABLE_GAME_DATA: - if ((buttonAndStickPress & 0x9000) != 0) { - selectedTableRow = gDisplayedControllerPakTableRows[gControllerPakSelectedTableRow] - 1; - if (D_8018EB38[selectedTableRow] == 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT; - play_sound2(0x49008001); - return; - } - } else if ((buttonAndStickPress & 0x4000) != 0) { - if (D_800E86D0 == 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; - play_sound2(0x49008002); - return; - } - } else if ((buttonAndStickPress & 0x800) != 0) { - if (D_800E86D0 == 0) { - --gControllerPakSelectedTableRow; - if (gControllerPakSelectedTableRow < 0) { - gControllerPakSelectedTableRow = 0; - if (gDisplayedControllerPakTableRows[gControllerPakSelectedTableRow] != 1) { - D_800E86D0 = 2; - play_sound2(0x49008000); - return; - } - } else { - play_sound2(0x49008000); - return; - } - } - } else if (((buttonAndStickPress & 0x400) != 0) && (D_800E86D0 == 0)) { - ++gControllerPakSelectedTableRow; - if (gControllerPakSelectedTableRow >= CONTROLLER_PAK_MENU_TABLE_GAME_DATA) { - gControllerPakSelectedTableRow = CONTROLLER_PAK_MENU_QUIT; - if (gDisplayedControllerPakTableRows[gControllerPakSelectedTableRow] != 0x10) { - D_800E86D0 = 1; - play_sound2(0x49008000); - return; - } - } else { - play_sound2(0x49008000); - return; - } - } - break; - case CONTROLLER_PAK_MENU_QUIT: - if ((buttonAndStickPress & 0xD000) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; - play_sound2(0x49008002); - return; - } - if ((buttonAndStickPress & 0x300) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE; - play_sound2(0x49008000); - return; - } - break; - case CONTROLLER_PAK_MENU_ERASE: - if ((buttonAndStickPress & 0x9000) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_GO_TO_ERASING; - play_sound2(0x49008001); - return; - } - if ((buttonAndStickPress & 0x4000) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; - play_sound2(0x49008002); - return; - } - if ((buttonAndStickPress & 0x300) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT; - play_sound2(0x49008000); - return; - } - break; - case CONTROLLER_PAK_MENU_GO_TO_ERASING: - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASING; - return; - case CONTROLLER_PAK_MENU_ERASING: - selectedTableRow = gDisplayedControllerPakTableRows[gControllerPakSelectedTableRow] - 1; - osPfsState = &D_8018E938[selectedTableRow]; - - switch (osPfsDeleteFile(&D_8018E868, osPfsState->company_code, osPfsState->game_code, &osPfsState->game_name, &osPfsState->ext_name)) { - default: - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED; - return; - case 0: - D_8018EB38[selectedTableRow] = -1; - gControllerPakNumPagesFree += (((osPfsState->file_size + 0xFF) >> 8) & 0xFF); - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; - return; - case PFS_ERR_NOPACK: - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK; - return; - case PFS_ERR_NEW_PACK: /* switch 1 */ - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED; - return; - } - break; - case CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED: - case CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK: - case CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED: - if ((buttonAndStickPress & 0x9000) != 0) { - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; - } - break; - } - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B1C90.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009E1C0(); /* extern */ -? func_800B44BC(); /* extern */ -? write_save_data_grand_prix_points_and_sound_mode(); /* extern */ -? reset_save_data_grand_prix_points_and_sound_mode(); /* extern */ -? func_800B5404(s32, s32); /* extern */ -? update_save_data_backup(); /* extern */ -? func_800CA330(?); /* extern */ -? play_sound2(?, s32); /* extern */ -static ? D_800F2B50; /* unable to generate initializer; const */ -static ? D_800F2B58; /* unable to generate initializer; const */ -s16 gCurrentCourseId; /* unable to generate initializer */ - -void func_800B20F4(void *arg0, s32 arg1) { - u16 sp2E; - s32 sp28; - s32 sp24; - s16 temp_v0; - s16 temp_v0_2; - s32 temp_a1; - s32 temp_a1_2; - s32 temp_a1_3; - s8 temp_t2; - s8 temp_v0_3; - s8 temp_v0_4; - s8 temp_v0_5; - s8 temp_v0_6; - u8 temp_t2_2; - u8 temp_t7; - u8 temp_v0_7; - u8 temp_v0_8; - s32 phi_a1; - s32 phi_s0; - s32 phi_a1_2; - s32 phi_s0_2; - s32 phi_a1_3; - s32 phi_s0_3; - - sp28 = 1; - sp2E = arg0->unk6 | arg0->unkC; - if (func_800B4520() == 0) { - if ((arg1 & 0xFFFF) == 0) { - D_8018EE04 += 1; - } - temp_t2 = gDebugMenuSelection; - switch (temp_t2) { - case DEBUG_MENU_DISABLED: - sp28 = 0; - if ((D_8018EE04 >= 0x2E) && ((sp2E & 0x9000) != 0)) { - func_8009E1C0(); - func_800CA330(0x19); - play_sound2(0x4900801A); - } - break; - case DEBUG_MENU_DEBUG_MODE: - if ((sp2E & 0x300) != 0) { - sp24 = sp2E; - play_sound2(0x49008000); - if (gEnableDebugMode != 0) { - gEnableDebugMode = 0; - } else { - gEnableDebugMode = 1; - } - } - if ((sp2E & 0x400) != 0) { - play_sound2(0x49008000); - gDebugMenuSelection = DEBUG_MENU_COURSE; - } - break; - case DEBUG_MENU_COURSE: - if ((sp2E & 0x100) != 0) { - sp24 = sp2E; - play_sound2(0x49008000); - temp_v0 = gCurrentCourseId; - if (temp_v0 < 0x13) { - gCurrentCourseId = temp_v0 + 1; - } else { - gCurrentCourseId = 0; - } - } - if ((sp2E & 0x200) != 0) { - sp24 = sp2E; - play_sound2(0x49008000); - temp_v0_2 = gCurrentCourseId; - if (temp_v0_2 > 0) { - gCurrentCourseId = temp_v0_2 - 1; - } else { - gCurrentCourseId = 0x13; - } - } - if ((sp2E & 0x800) != 0) { - sp24 = sp2E; - play_sound2(0x49008000); - gDebugMenuSelection = DEBUG_MENU_DEBUG_MODE; - } - if ((sp2E & 0x400) != 0) { - play_sound2(0x49008000); - gDebugMenuSelection = DEBUG_MENU_SCREEN_MODE; - } - break; - case DEBUG_MENU_SCREEN_MODE: - if ((sp2E & 0x100) != 0) { - temp_v0_3 = D_8018EDF1; - if (temp_v0_3 < 4) { - D_8018EDF1 = temp_v0_3 + 1; - sp24 = sp2E; - play_sound2(0x49008000); - gScreenModeSelection = *(&D_800F2B50 + D_8018EDF1); - } - } - if ((sp2E & 0x200) != 0) { - temp_v0_4 = D_8018EDF1; - if (temp_v0_4 > 0) { - D_8018EDF1 = temp_v0_4 - 1; - sp24 = sp2E; - play_sound2(0x49008000); - gScreenModeSelection = *(&D_800F2B50 + D_8018EDF1); - } - } - if ((sp2E & 0x800) != 0) { - gDebugMenuSelection = DEBUG_MENU_COURSE; - sp24 = sp2E; - play_sound2(0x49008000); - } - if ((sp2E & 0x400) != 0) { - gDebugMenuSelection = DEBUG_MENU_PLAYER; - play_sound2(0x49008000); - } - break; - case DEBUG_MENU_PLAYER: - if ((sp2E & 0x100) != 0) { - temp_v0_5 = gCharacterSelections; - if (temp_v0_5 < 7) { - gCharacterSelections = temp_v0_5 + 1; - sp24 = sp2E; - play_sound2(0x49008000); - } - } - if ((sp2E & 0x200) != 0) { - temp_v0_6 = gCharacterSelections; - if (temp_v0_6 > 0) { - gCharacterSelections = temp_v0_6 - 1; - sp24 = sp2E; - play_sound2(0x49008000); - } - } - if ((sp2E & 0x800) != 0) { - gDebugMenuSelection = DEBUG_MENU_SCREEN_MODE; - sp24 = sp2E; - play_sound2(0x49008000); - } - if ((sp2E & 0x400) != 0) { - gDebugMenuSelection = DEBUG_MENU_SOUND_MODE; - play_sound2(0x49008000); - } - break; - case DEBUG_MENU_SOUND_MODE: - if ((sp2E & 0x100) != 0) { - if (gSoundMode < SOUND_MONO) { - gSoundMode += 1; - if ((gSoundMode & 0xFF) == SOUND_UNUSED) { - gSoundMode = SOUND_MONO; - } - sp24 = sp2E; - play_sound2(0x49008000); - func_800B44BC(); - gSaveDataSoundMode = gSoundMode; - write_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); - } - } - if ((sp2E & 0x200) != 0) { - if (gSoundMode > SOUND_STEREO) { - gSoundMode -= 1; - if ((gSoundMode & 0xFF) == SOUND_UNUSED) { - gSoundMode = SOUND_HEADPHONES; - } - sp24 = sp2E; - play_sound2(0x49008000); - func_800B44BC(); - gSaveDataSoundMode = gSoundMode; - write_save_data_grand_prix_points_and_sound_mode(); - } - } - if ((sp2E & 0x800) != 0) { - gDebugMenuSelection = DEBUG_MENU_PLAYER; - sp24 = sp2E; - play_sound2(0x49008000); - } - if ((sp2E & 0x400) != 0) { - gDebugMenuSelection = DEBUG_MENU_GIVE_ALL_GOLD_CUP; - play_sound2(0x49008000); - } - break; - case DEBUG_MENU_GIVE_ALL_GOLD_CUP: - if ((sp2E & 0x800) != 0) { - gDebugMenuSelection = DEBUG_MENU_SOUND_MODE; - sp24 = sp2E; - play_sound2(0x49008000); - } - if ((sp2E & 0x4000) != 0) { - phi_a1 = 0; - phi_s0 = 0; - do { - func_800B5404(0, phi_a1); - temp_a1 = (phi_s0 + 1) & 0xFFFF; - phi_a1 = temp_a1; - phi_s0 = temp_a1; - } while (temp_a1 < 0x10); - play_sound2(0x49008001, temp_a1); - } else if ((sp2E & 0x20) != 0) { - reset_save_data_grand_prix_points_and_sound_mode(); - phi_a1_2 = 0; - phi_s0_2 = 0; - do { - func_800B5404(phi_a1_2 / 4, phi_a1_2); - temp_a1_2 = (phi_s0_2 + 1) & 0xFFFF; - phi_a1_2 = temp_a1_2; - phi_s0_2 = temp_a1_2; - } while (temp_a1_2 < 0x10); - play_sound2(0x49008001, temp_a1_2); - } else if ((sp2E & 0x200) != 0) { - reset_save_data_grand_prix_points_and_sound_mode(); - phi_a1_3 = 0; - phi_s0_3 = 0; - do { - if ((phi_a1_3 % 4) == 2) { - func_800B5404(0, phi_a1_3); - } else { - func_800B5404(phi_a1_3 / 4, phi_a1_3); - } - temp_a1_3 = (phi_s0_3 + 1) & 0xFFFF; - phi_a1_3 = temp_a1_3; - phi_s0_3 = temp_a1_3; - } while (temp_a1_3 < 0x10); - play_sound2(0x49008001, temp_a1_3); - } - break; - default: - break; - } - D_8018EDF3 = *(&D_800F2B58 + D_8018EDF1); - gPlayerCountSelection1 = D_8018EDF3; - if (sp28 != 0) { - if ((sp2E & 0x9000) != 0) { // A or Start pressed - sp24 = sp2E; - func_8009E1C0(); - func_800CA330(0x19); - gDebugMenuSelection = DEBUG_MENU_EXITED; - if ((arg0->unk4 & 0x20) != 0) { // L held - D_800DC51C = 1; - } else { - D_800DC51C = 0; - } - if ((arg0->unk4 & 0x2000) != 0) { // Z is held - if ((sp2E & 0x8000) != 0) { - gDebugGotoScene = DEBUG_GOTO_ENDING_SEQUENCE; // Go to ending ceremony if A is not pressed - } else { - gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA; // Go to credits, set gCCSelection to CC_EXTRA - } - } - play_sound2(0x49008016); - return; - } - if (((sp2E & 0x4000) != 0) && ((arg0->unk4 & 0x2000) != 0)) { // B pressed and Z held - func_8009E1C0(); - func_800CA330(0x19); - gDebugMenuSelection = DEBUG_MENU_EXITED; - gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_CC_50; // Go to credits, set gCCSelection to CC_50 - play_sound2(0x49008016); - return; - } - if ((sp2E & 0x10) != 0) { // R pressed - gDebugMenuSelection = DEBUG_MENU_DISABLED; // Close out of debug menu - play_sound2(0x49008001); - } - /* Duplicate return node #100. Try simplifying control flow for better match */ - return; - } - /* Duplicate return node #100. Try simplifying control flow for better match */ - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B20F4.s") -#endif - -void func_800B28C8(void) { - // For Grand Prix and Versus, this will be the CC mode selected. For Time Trials, it will - // be whether 'Begin' or 'Data' is selected. Not used for Battle. - s8 temp_v0 = gGameModeSubMenuRowSelectionForNumPlayers[D_8018EDF3][gGameModeRowSelectionForNumPlayers[D_8018EDF3]]; - - // Determine which game mode was selected based on the number of players and the row selected on the main menu - switch (gGameModeFromNumPlayersAndRowSelection[D_8018EDF3][gGameModeRowSelectionForNumPlayers[D_8018EDF3]]) { - case GRAND_PRIX: - gCCSelection = temp_v0; - gPlaceItemBoxes = 1; - gIsMirrorMode = (temp_v0 == CC_EXTRA) ? 1 : 0; - break; - case VERSUS: - gCCSelection = temp_v0; - gPlaceItemBoxes = 1; - gIsMirrorMode = (temp_v0 == CC_EXTRA) ? 1 : 0; - break; - case BATTLE: - gPlaceItemBoxes = 1; - gIsMirrorMode = 0; - break; - case TIME_TRIALS: - gCCSelection = CC_100; - gIsMirrorMode = 0; - gPlaceItemBoxes = 0; - - if ((temp_v0 && temp_v0) && temp_v0) { - - } - - break; - } -} - - -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009E0F0(?); /* extern */ -? func_8009E1C0(); /* extern */ -? func_8009E258(s8); /* extern */ -? func_8009E280(s8); /* extern */ -? func_800B28C8(); /* extern */ -? func_800B44AC(s8, u16, u16); /* extern */ -? func_800CA330(?); /* extern */ -? play_sound2(?, u16, u16); /* extern */ -static ? gGameModeRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? D_800E86AC; /* unable to generate initializer; const */ -static ? gGameModeSubMenuRowSelectionForNumPlayers; /* unable to generate initializer; const */ -static ? D_800E86B0; /* unable to generate initializer; const */ -static ? D_800F2B5F; /* unable to generate initializer; const */ -static ? D_800F2B61; /* unable to generate initializer; const */ -static ? D_800F2B6D; /* unable to generate initializer; const */ -static ? gGameModeFromNumPlayersAndRowSelection; /* unable to generate initializer; const */ - -void func_800B29D8(void *arg0, u16 arg1) { - u16 sp2E; - s32 sp28; - s32 sp24; - s32 sp1C; - s32 temp_t7_3; - s32 temp_t7_5; - s32 temp_v1_3; - s32 temp_v1_4; - s32 temp_v1_7; - s8 temp_a0; - s8 temp_a0_2; - s8 temp_a0_3; - s8 temp_a0_4; - s8 temp_a0_5; - s8 temp_a0_6; - s8 temp_a0_7; - s8 temp_a1; - s8 temp_t1; - s8 temp_t1_2; - s8 temp_t2; - s8 temp_t4_2; - s8 temp_t4_3; - s8 temp_t5; - s8 temp_t5_2; - s8 temp_t6; - s8 temp_t6_2; - s8 temp_t7; - s8 temp_t7_2; - s8 temp_t7_4; - s8 temp_t7_6; - s8 temp_t8; - s8 temp_v0; - s8 temp_v0_10; - s8 temp_v0_11; - s8 temp_v0_2; - s8 temp_v0_3; - s8 temp_v0_4; - s8 temp_v0_5; - s8 temp_v0_6; - s8 temp_v0_7; - s8 temp_v0_8; - s8 temp_v0_9; - u16 temp_t9; - u8 temp_t4; - void *temp_v1; - void *temp_v1_2; - void *temp_v1_5; - void *temp_v1_6; - u16 phi_v1; - s32 phi_a2; - s32 phi_v0; - u8 *phi_t0; - s8 phi_a0; - u8 *phi_t0_2; - s32 phi_a1; - s32 phi_v1_2; - s8 phi_v0_2; - s8 phi_a0_2; - s32 *phi_v1_3; - - temp_t9 = (arg0->unk6 | arg0->unkC) & 0xFFFF; - phi_v1 = temp_t9; - if ((gEnableDebugMode == 0) && ((temp_t9 & 0x1000) != 0)) { - phi_v1 = (temp_t9 | 0x8000) & 0xFFFF; - } - sp2E = phi_v1; - arg1 &= 0xFFFF; - if (func_800B4520(arg0) == 0) { - temp_t4 = gMainMenuSelectionDepth; - switch (temp_t4) { - case BLANK_MAIN_MENU: - temp_t5 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t5 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t5) * 4)); - break; - case PLAYER_NUM_SELECTION: - phi_a2 = phi_v1; - if ((phi_v1 & 0x100) != 0) { - temp_v0 = D_8018EDF3; - if (temp_v0 < 4) { - D_8018EDF3 = temp_v0 + 1; - sp1C = phi_v1; - func_800B44AC(); - play_sound2(0x49008000); - phi_a2 = sp1C; - } - } - temp_v0_2 = D_8018EDF3; - phi_v0 = temp_v0_2; - phi_t0 = &gMainMenuSelectionDepth; - if (((phi_a2 & 0x200) != 0) && (temp_v0_2 >= 2)) { - D_8018EDF3 = temp_v0_2 - 1; - sp1C = phi_a2; - func_800B44AC(); - play_sound2(0x49008000); - phi_v0 = D_8018EDF3; - phi_t0 = &gMainMenuSelectionDepth; - } - gPlayerCountSelection1 = phi_v0; - phi_a0 = &gPlayerCountSelection1; - if (phi_v0 != 1) { - phi_a0 = 3; - if (phi_v0 != 2) { - if ((phi_v0 != 3) && (phi_v0 != 4)) { - - } else { - gScreenModeSelection = SCREEN_MODE_3P_4P_SPLITSCREEN; - } - } else { - gScreenModeSelection = SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL; - } - } else { - gScreenModeSelection = SCREEN_MODE_1P; - } - if ((phi_a2 & 0x4000) != 0) { - func_8009E0F0(0x14); - func_800CA330(0x19); - D_8018EDE0 = 1; - play_sound2(0x49008002); - temp_t7 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t7 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t7) * 4)); - } else if ((phi_a2 & 0x8000) != 0) { - *phi_t0 = GAME_MODE_SELECTION; - func_800B44AC(phi_a0); - play_sound2(0x49008001); - temp_t4_2 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t4_2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t4_2) * 4)); - } else if ((phi_a2 & 0x20) != 0) { - *phi_t0 = OPTIONS_SELECTION; - func_8009E280(phi_a0); - play_sound2(0x49009010); - temp_t1 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t1 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t1) * 4)); - } else if ((phi_a2 & 0x10) != 0) { - *phi_t0 = DATA_SELECTION; - func_8009E258(phi_a0); - play_sound2(0x49009011); - temp_t6 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t6 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t6) * 4)); - } else { - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((phi_v0 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + phi_v0) * 4)); - } - break; - case GAME_MODE_SELECTION: - if ((phi_v1 & 0x400) != 0) { - temp_v0_3 = D_8018EDF3; - temp_v1 = temp_v0_3 + &D_800E86AC; - temp_a0 = temp_v1->unk-1; - if (temp_a0 < *(&D_800F2B5F + temp_v0_3)) { - temp_v1->unk-1 = temp_a0 + 1; - sp1C = phi_v1; - func_800B44AC(temp_a0, arg1, phi_v1); - play_sound2(0x49008000); - } - } - phi_t0_2 = &gMainMenuSelectionDepth; - if ((phi_v1 & 0x800) != 0) { - temp_v1_2 = D_8018EDF3 + &D_800E86AC; - temp_a0_2 = temp_v1_2->unk-1; - if (temp_a0_2 > 0) { - temp_v1_2->unk-1 = temp_a0_2 - 1; - sp1C = phi_v1; - func_800B44AC(temp_a0_2); - play_sound2(0x49008000); - phi_t0_2 = &gMainMenuSelectionDepth; - } - } - if ((phi_v1 & 0x4000) != 0) { - *phi_t0_2 = PLAYER_NUM_SELECTION; - func_800B44AC(3); - play_sound2(0x49008002); - temp_t6_2 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t6_2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t6_2) * 4)); - } else { - temp_v0_4 = D_8018EDF3; - temp_a0_3 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_4); - if ((phi_v1 & 0x8000) != 0) { - temp_v1_3 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0_4 * 0xC) + (temp_a0_3 * 4))); - if (temp_v1_3 != 0) { - if (temp_v1_3 != 1) { - if (temp_v1_3 != 2) { - if (temp_v1_3 != 3) { - *phi_t0_2 = CONFIRM_OK_SELECTION; - } else { - *phi_t0_2 = CONFIRM_OK_SELECTION; - play_sound2(0x4900900D); - } - } else { - *phi_t0_2 = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; - play_sound2(0x4900900C); - } - } else { - *phi_t0_2 = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; - play_sound2(0x4900900B); - } - } else { - *phi_t0_2 = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; - play_sound2(0x4900900A); - } - func_800B44AC(); - temp_t7_2 = D_8018EDF3; - gMenuTimingCounter = 0; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t7_2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t7_2) * 4)); - } else { - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_v0_4 * 0xC) + (temp_a0_3 * 4)); - } - } - break; - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: - case TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT: - if ((arg1 == 0) && ((temp_t7_3 = gMenuTimingCounter + 1, gMenuTimingCounter = temp_t7_3, (temp_t7_3 == 0x64)) || ((temp_t7_3 % 300) == 0)) && ((temp_v0_5 = D_8018EDF3, temp_v1_4 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0_5 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_v0_5) * 4))), (temp_v1_4 == 0)) || (temp_v1_4 == 2))) { - sp1C = phi_v1; - play_sound2(0x4900900E, arg1, phi_v1); - } - temp_v0_6 = D_8018EDF3; - temp_v1_5 = (temp_v0_6 * 3) + *(&gGameModeRowSelectionForNumPlayers + temp_v0_6) + &D_800E86B0; - temp_a0_4 = temp_v1_5->unk-3; - phi_a1 = temp_a0_4; - if (((phi_v1 & 0x800) != 0) && (temp_a0_4 > 0)) { - temp_v1_5->unk-3 = temp_a0_4 - 1; - sp28 = temp_a0_4; - sp1C = phi_v1; - func_800B44AC(temp_a0_4, temp_a0_4, phi_v1); - play_sound2(0x49008000); - phi_a1 = sp28; - } - if ((phi_v1 & 0x400) != 0) { - sp24 = 0; - sp28 = phi_a1; - sp1C = phi_v1; - phi_v1_2 = sp24; - if (func_800B555C() != 0) { - temp_v0_7 = D_8018EDF3; - temp_a0_5 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_7); - phi_v0_2 = temp_v0_7; - phi_a0_2 = temp_a0_5; - phi_v0_2 = temp_v0_7; - phi_a0_2 = temp_a0_5; - if (phi_a1 < *(&D_800F2B6D + ((temp_v0_7 * 3) + temp_a0_5))) { - goto block_64; - } - } else { - temp_v0_8 = D_8018EDF3; - temp_a0_6 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_8); - phi_v0_2 = temp_v0_8; - phi_a0_2 = temp_a0_6; - phi_v0_2 = temp_v0_8; - phi_a0_2 = temp_a0_6; - if (phi_a1 < *(&D_800F2B61 + ((temp_v0_8 * 3) + temp_a0_6))) { -block_64: - phi_v1_2 = 1; - } - } - if (phi_v1_2 != 0) { - temp_v1_6 = (phi_v0_2 * 3) + phi_a0_2 + &D_800E86B0; - sp1C = phi_v1; - temp_v1_6->unk-3 = temp_v1_6->unk-3 + 1; - func_800B44AC(phi_a0_2, phi_a1, phi_v1); - play_sound2(0x49008000); - } - } - temp_v0_9 = D_8018EDF3; - temp_a0_7 = *(&gGameModeRowSelectionForNumPlayers + temp_v0_9); - temp_a1 = *(&gGameModeSubMenuRowSelectionForNumPlayers + ((temp_v0_9 * 3) + temp_a0_7)); - if ((phi_v1 & 0x4000) != 0) { - gMainMenuSelectionDepth = GAME_MODE_SELECTION; - func_800B44AC(temp_a0_7, temp_a1, phi_v1); - play_sound2(0x49008002); - temp_t5_2 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t5_2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t5_2) * 4)); - } else if ((phi_v1 & 0x8000) != 0) { - sp28 = temp_a1; - func_800B44AC(temp_a0_7, temp_a1, phi_v1); - temp_v0_10 = D_8018EDF3; - if ((temp_v0_10 == 1) && (*(&gGameModeRowSelectionForNumPlayers + temp_v0_10) == 1) && (temp_a1 == 1)) { - func_8009E258(); - play_sound2(0x49009011); - } else { - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION; - play_sound2(0x49008001, temp_a1); - gMenuTimingCounter = 0; - } - temp_t7_4 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t7_4 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t7_4) * 4)); - } else { - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_v0_9 * 0xC) + (temp_a0_7 * 4)); - } - break; - case CONFIRM_OK_SELECTION: - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: - if ((arg1 == 0) && ((temp_t7_5 = gMenuTimingCounter + 1, gMenuTimingCounter = temp_t7_5, (temp_t7_5 == 0x3C)) || ((temp_t7_5 % 300) == 0))) { - sp1C = phi_v1; - play_sound2(0x4900900F, arg1, phi_v1); - } - if ((phi_v1 & 0x4000) != 0) { - temp_v0_11 = D_8018EDF3; - temp_v1_7 = *(&gGameModeFromNumPlayersAndRowSelection + ((temp_v0_11 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_v0_11) * 4))); - if ((temp_v1_7 != 0) && (temp_v1_7 != 1) && (temp_v1_7 != 2)) { - if (temp_v1_7 != 3) { - - } - gMainMenuSelectionDepth = GAME_MODE_SELECTION; - } else { - gMainMenuSelectionDepth = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; - } - func_800B44AC(); - play_sound2(0x49008002); - temp_t7_6 = D_8018EDF3; - gMenuTimingCounter = 0; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t7_6 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t7_6) * 4)); - } else if ((phi_v1 & 0x8000) != 0) { - func_8009E1C0(); - play_sound2(0x49008016); - func_800B28C8(); - temp_t1_2 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t1_2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t1_2) * 4)); - } else { - temp_t4_3 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t4_3 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t4_3) * 4)); - } - break; - case OPTIONS_SELECTION: - case DATA_SELECTION: - temp_t2 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t2 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t2) * 4)); - break; - default: - temp_t8 = D_8018EDF3; - phi_v1_3 = &gGameModeFromNumPlayersAndRowSelection + ((temp_t8 * 0xC) + (*(&gGameModeRowSelectionForNumPlayers + temp_t8) * 4)); - break; - } - gModeSelection = *phi_v1_3; - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B29D8.s") -#endif - -s32 func_800B34E8(s32 arg0) { - s32 i; - for (i =0; i < 4; i++) { - if (arg0 == gCharacterGridSelections[i]) { - return 0; - } - } - return 1; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -/* -Failed to decompile function func_800B3554: - -Label L800B3A94 refers to a delay slot; this is currently not supported. -Please modify the assembly to work around it (e.g. copy the instruction -to all jump sources and move the label, or add a nop to the delay slot). -*/ -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B3554.s") -#endif - -// Handle navigating the course menu interface -void func_800B3B58(struct Controller *arg0, u16 arg1) { - u16 buttonAndStickPress = (arg0->buttonPressed | arg0->stickPressed); - - if ((gEnableDebugMode == 0) && ((buttonAndStickPress & 0x1000) != 0)) { - buttonAndStickPress |= 0x8000; - } - - if (func_800B4520() == 0) { - switch (D_8018EDEC) { - case 1: - if ((buttonAndStickPress & 0x100) != 0) { - if (gCupSelection < SPECIAL_CUP) { - D_8018EE0A = gCupSelection; - ++gCupSelection; - func_800B44AC(); - play_sound2(0x49008000); - } - } - if (((buttonAndStickPress & 0x200) != 0) && (gCupSelection > MUSHROOM_CUP)) { - D_8018EE0A = gCupSelection; - --gCupSelection; - func_800B44AC(); - play_sound2(0x49008000); - } - - D_800DC540 = gCupSelection; - gCurrentCourseId = gCupCourseOrder[gCupSelection][gCupCourseSelection]; - if ((buttonAndStickPress & 0x4000) != 0) { - func_8009E208(); - play_sound2(0x49008002); - } - else if ((buttonAndStickPress & 0x8000) != 0) { - if (gModeSelection != GRAND_PRIX) { - D_8018EDEC = 2; - play_sound2(0x49008001); - } else { - D_8018EDEC = 3; - play_sound2(0x49008001); - gCurrentCourseId = gCupCourseOrder[gCupSelection][CUP_COURSE_ONE]; - gMenuTimingCounter = 0; - } - func_800B44AC(); - } - break; - case 2: - case 4: - if (((buttonAndStickPress & 0x400) != 0) && (gCupCourseSelection < CUP_COURSE_FOUR)) { - ++gCupCourseSelection; - func_800B44AC(); - play_sound2(0x49008000); - } - if (((buttonAndStickPress & 0x800) != 0) && (gCupCourseSelection > CUP_COURSE_ONE)) { - --gCupCourseSelection; - func_800B44AC(); - play_sound2(0x49008000); - } - - gCurrentCourseId = gCupCourseOrder[gCupSelection][gCupCourseSelection]; - if ((buttonAndStickPress & 0x4000) != 0) { - if (D_8018EDEC == 2) { - D_8018EDEC = 1; - } else { - func_8009E208(); - } - func_800B44AC(); - play_sound2(0x49008002); - return; - } - if ((buttonAndStickPress & 0x8000) != 0) { - D_8018EDEC = 3; - play_sound2(0x49008001); - func_800B44AC(); - gMenuTimingCounter = 0; - } - break; - case 3: - - if ((arg1 == 0) && ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { - play_sound2(0x4900900F); - } - - if ((buttonAndStickPress & 0x4000) != 0) { - switch(gModeSelection) - { - case GRAND_PRIX: - D_8018EDEC = 1; - break; - case BATTLE: - D_8018EDEC = 4; - break; - default: - D_8018EDEC = 2; - break; - } - - func_800B44AC(); - play_sound2(0x49008002); - return; - } - if ((buttonAndStickPress & 0x8000) != 0) { - func_8009E1C0(); - func_800CA330(0x19); - play_sound2(0x49008016); - } - break; - } - } -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8000F0E0(); /* extern */ -? func_800B44AC(); /* extern */ -? func_800B5F30(); /* extern */ -? func_800C8EAC(?, s8 *, s8); /* extern */ -? func_800CA008(?, ?, s32); /* extern */ -? func_800CB2C4(); /* extern */ -? play_sound2(?, s8 *, s8 *, s8); /* extern */ -extern s32 D_800DC50C; -extern s32 D_800DC524; -extern s32 gScreenModeSelection; -extern s32 D_800DC540; -extern s16 D_8015F890; -extern s16 D_8015F892; -extern s32 D_80162DC8; -extern s32 D_80162DCC; -extern s16 D_80162DD4; -extern s16 D_80162DD8; -extern s32 D_80162E00; -extern s16 D_8016556E; -extern s32 D_8018EDE0; -extern s8 D_8018EDE8; -extern s8 D_8018EDE9; -extern s8 D_8018EDEA; -extern s8 D_8018EDEB; -extern s8 D_8018EDEC; -extern s8 gMainMenuSelectionDepth; -extern s8 D_8018EDEE; -extern s8 gDebugMenuSelection; -extern s8 D_8018EDF1; -extern s8 D_8018EDF3; -extern s8 gTimeTrialDataCourseIndex; -extern s8 gDebugGotoScene; -extern s8 D_8018EDFB; -extern s8 D_8018EDFC; -extern s32 gMenuTimingCounter; -extern s32 D_8018EE04; -extern s8 D_8018EE08; -extern s8 D_8018EE0A; -extern s16 gEnableDebugMode; -static s8 gCharacterSelections = 0; /* const */ -static ? D_800F2BDF; /* unable to generate initializer; const */ -s32 gIsMirrorMode = 0; - -void func_800B3F74(u32 arg0) { - s32 temp_v0; - s32 temp_v0_3; - s32 temp_v0_4; - s8 *temp_a1; - s8 *temp_a2; - s8 *temp_v0_5; - s8 temp_a0; - s8 temp_a3; - s8 temp_a3_2; - s8 temp_v0_2; - s32 phi_a3; - s32 phi_v1; - s8 *phi_v0; - s8 *phi_a2; - s8 *phi_a1; - s32 phi_a0; - s8 *phi_v0_2; - - gDebugMenuSelection = DEBUG_MENU_DISABLED; - gMenuTimingCounter = 0; - D_8018EE04 = 0; - D_8018EE08 = 0; - D_8015F890 = 0; - D_8015F892 = 0; - gDebugGotoScene = DEBUG_GOTO_RACING; - D_8018EDFB = 0; - D_8016556E = 0; - D_80162DD4 = 1; - D_80162DD8 = 1; - D_80162E00 = 0; - D_80162DC8 = 1; - D_80162DCC = 0; - switch (arg0) { - case OPTIONS_MENU: - D_8018EDEC = 0x15; - break; - case DATA_MENU: - D_8018EDEC = 1; - break; - case COURSE_DATA_MENU: - D_8018EDEC = 0xB; - break; - case LOGO_INTRO_MENU: - func_800CA008(0, 0); - break; - case CONTROLLER_PAK_MENU: - gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; - func_800CA008(0, 0); - break; - case START_MENU_FROM_QUIT: - case START_MENU: - gIsMirrorMode = 0; - gEnableDebugMode = 0; - gCupSelection = MUSHROOM_CUP; - gCupCourseSelection = CUP_COURSE_ONE; - gTimeTrialDataCourseIndex = TIME_TRIAL_DATA_LUIGI_RACEWAY; - if (D_8018EDF3 <= ZERO_PLAYERS_SELECTED) { - D_8018EDF3 = ONE_PLAYERS_SELECTED; - } - phi_a3 = D_8018EDF3; - if (D_8018EDF3 >= SELECTED_PLAYER_DEFINES_TOTAL) { - D_8018EDF3 = FOUR_PLAYERS_SELECTED; - phi_a3 = D_8018EDF3; - } - D_8018EDF1 = *(&D_800F2BDF + phi_a3); - func_800CA008(0, 0); - func_800C8EAC(1); - D_8018EDFC = 0; - break; - case MAIN_MENU_FROM_QUIT: - case MAIN_MENU: - gEnableDebugMode = 0; - gIsMirrorMode = 0; - D_8018EDFC = 0; - func_800B5F30(); - func_8000F0E0(); - if (D_800DC50C != 0) { - func_800CA008(0, 0); - func_800CB2C4(); - D_800DC50C = 0; - D_800DC524 = 0; - func_800C8EAC(2); - } - temp_v0 = D_8018EDE0; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 3) { - if (temp_v0 != 4) { - - } else { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; - } - } else { - temp_v0_2 = gMainMenuSelectionDepth; - if ((temp_v0_2 != OPTIONS_SELECTION) && (temp_v0_2 != DATA_SELECTION)) { - gMainMenuSelectionDepth = TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT; - } else { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; - } - } - } else { - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION_FROM_BACK_OUT; - } - } else { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; - func_800C8EAC(2, &gMainMenuSelectionDepth, 3); - temp_v0_3 = gScreenModeSelection; - D_8018EDF3 = ONE_PLAYERS_SELECTED; - if ((temp_v0_3 >= NUM_SCREEN_MODES) || (temp_v0_3 < SCREEN_MODE_1P)) { - gScreenModeSelection = SCREEN_MODE_1P; - } - } - break; - case PLAYER_SELECT_MENU_FROM_QUIT: - case PLAYER_SELECT_MENU: - temp_v0_4 = D_8018EDE0; - if (temp_v0_4 != 0) { - if (temp_v0_4 != 1) { - - } else { - D_8018EDEE = 3; - temp_a3 = D_8018EDF3; - if (temp_a3 > 0) { - D_8018EDE8 = 1; - } else { - D_8018EDE8 = 0; - } - if ((temp_a3 - 1) > 0) { - D_8018EDE9 = 1; - } else { - D_8018EDE9 = 0; - } - if ((temp_a3 - 2) > 0) { - D_8018EDEA = 1; - } else { - D_8018EDEA = 0; - } - if ((temp_a3 - 3) > 0) { - D_8018EDEB = 1; - } else { - D_8018EDEB = 0; - } - } - } else { - D_8018EDEE = 1; - if (D_800DC50C == 0) { - temp_a3_2 = D_8018EDF3; - phi_v1 = 0; - phi_v0 = &gCharacterGridSelections; - phi_a2 = &gCharacterSelections; - phi_a1 = &D_8018EDE8; - do { - phi_a0 = phi_v1 + 1; - if (phi_v1 < temp_a3_2) { - temp_a0 = phi_v1 + 1; - *phi_v0 = temp_a0; - phi_a0 = temp_a0; - } else { - *phi_v0 = 0; - } - *phi_a2 = phi_v1; - temp_a1 = phi_a1 + 1; - temp_a2 = phi_a2 + 1; - temp_a1->unk-1 = 0; - phi_v1 = phi_a0; - phi_v0 += 1; - phi_a2 = temp_a2; - phi_a1 = temp_a1; - } while (phi_a0 != 4); - play_sound2(0x49009012, temp_a1, temp_a2, temp_a3_2); - } else { - func_800CA008(0, 0); - func_800CB2C4(); - D_800DC50C = 0; - D_800DC524 = 0; - func_800C8EAC(2); - D_8018EDE8 = 0; - D_8018EDE8 = 0; - D_8018EDE8 = 0; - D_8018EDE8 = 0; - } - } - break; - case COURSE_SELECT_MENU_FROM_QUIT: - case COURSE_SELECT_MENU: - if (gModeSelection == BATTLE) { - gCupSelection = BATTLE_CUP; - D_800DC540 = 4; - D_8018EDEC = 4; - } else { - if (gCupSelection == BATTLE_CUP) { - gCupSelection = MUSHROOM_CUP; - } - D_8018EDEC = 1; - } - if (D_800DC50C != 0) { - func_800CA008(0, 0, 3); - func_800CB2C4(); - D_800DC50C = 0; - D_800DC524 = 0; - func_800C8EAC(2); - } - play_sound2(0x49009013); - D_8018EE0A = 0; - if (gModeSelection == GRAND_PRIX) { - gCupCourseSelection = CUP_COURSE_ONE; - } - phi_v0_2 = gGPPointsByCharacterId; - do { - temp_v0_5 = phi_v0_2 + 4; - temp_v0_5->unk-3 = 0; - temp_v0_5->unk-2 = 0; - temp_v0_5->unk-1 = 0; - temp_v0_5->unk-4 = 0; - phi_v0_2 = temp_v0_5; - } while (temp_v0_5 != gCharacterIdByGPOverallRank); - break; - } - func_800B44AC(); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B3F74.s") -#endif - -void func_800B44AC(void) { - D_8018E7A8 = 0x20; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800C3448(s32, s32 *); // extern -extern s32 D_800F2BE4; -extern u8 gSoundMode; - -void func_800B44BC(void) { - s32 sp20; - - sp20 = D_800F2BE4; - if ((gSoundMode == SOUND_STEREO) || (gSoundMode == SOUND_HEADPHONES) || (gSoundMode == SOUND_MONO)) { - func_800C3448(*(&sp20 + temp_v1) | 0xE0000000, &sp20); - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B44BC.s") -#endif - -s32 func_800B4520(void) { - - if ((D_8018E7B0 == 2) || (D_8018E7B0 == 3) || (D_8018E7B0 == 4) || (D_8018E7B0 == 7)) { - return 1; - } - return 0; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit cc33060578851a93591ed035e96ffd1f15c765f1 -? rmonPrintf(? *, s32); /* extern */ -extern ? D_800F2BE8; -extern ? D_800F2BF8; -extern ? D_800F2C0C; -extern s32 D_80162DE0; -extern s32 D_8018D9C0; -extern ? D_8018EE16; - -// Separated from assembly in code_800AF9B0/func_800B4520.s -UNUSED void func_800B4560(s32 arg0, s32 arg1) { - s32 sp18; - - sp18 = D_8018D9C0; - rmonPrintf(&D_800F2BE8, D_80162DE0); - rmonPrintf(&D_800F2BF8, (s32) *(&D_8018EE16 + (arg0 << 7))); - rmonPrintf(&D_800F2C0C, (s32) ((arg1 << 7) + sp18)->unk6); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4560.s") -#endif - -void func_800B45E0(s32 arg0) { - CourseTimeTrialRecords* courseTimeTrialRecordsPtr = &D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[arg0 / 4] \ - .courseRecords[arg0 % 4]; - - courseTimeTrialRecordsPtr->unknownBytes[5] = func_800B4874(arg0); - osEepromLongWrite(&gSIEventMesgQueue, ((u32)courseTimeTrialRecordsPtr - (u32)&D_8018EB90) >> 3, (u8*) courseTimeTrialRecordsPtr, sizeof(CourseTimeTrialRecords)); -} - -void write_save_data_grand_prix_points_and_sound_mode(void) { - D_8018ED16 = compute_save_data_checksum_1(); - D_8018ED17 = compute_save_data_checksum_2(); - osEepromLongWrite(&gSIEventMesgQueue, (((u32)&D_8018ED10 - (u32)&D_8018EB90) >> 3), (u8*) &D_8018ED10, 8); -} - -void func_800B46D0(void) { - s32 temp_s0; - s32 phi_s0; - - phi_s0 = 0; - do { - func_800B4728(phi_s0); - func_800B559C(phi_s0); - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (phi_s0 != 0x10); - reset_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); -} - -void func_800B4728(s32 arg0) { - s32 temp_a2; - s32 temp_v0; - CourseTimeTrialRecords* courseTimeTrialRecords; - - courseTimeTrialRecords = &D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[arg0 / 4] \ - .courseRecords[arg0 % 4]; - - for (temp_a2 = 0; temp_a2 < 5; ++temp_a2) - { - for (temp_v0 = 0; temp_v0 < 3; ++temp_v0) - { - courseTimeTrialRecords->records[temp_a2][temp_v0] = D_800F2E60[temp_v0]; - } - } - - for (temp_a2 = 0; temp_a2 < 3; ++temp_a2) - { - courseTimeTrialRecords->records[5][temp_a2] = D_800F2E60[temp_a2]; - } - - courseTimeTrialRecords->unknownBytes[0] = 0; - courseTimeTrialRecords->unknownBytes[5] = func_800B4874(arg0); - func_800B45E0(arg0); -} - -void reset_save_data_grand_prix_points_and_sound_mode(void) { - D_8018ED10.grandPrixPointsMushroomCup = 0; - D_8018ED11 = 0; - D_8018ED12 = 0; - D_8018ED13 = 0; - gSaveDataSoundMode = SOUND_STEREO; - gSoundMode = SOUND_STEREO; - func_800B44BC(); - write_save_data_grand_prix_points_and_sound_mode(); -} - -s32 func_800B4874(s32 arg0) { - s32 temp_a0; - s32 temp_a1; - s32 temp_v1; - u8* records = &D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[arg0 / 4] \ - .courseRecords[arg0 % 4] \ - .records[0][0]; - - temp_v1 = 0; - temp_a1 = 0; - while (temp_a1 < 7) - { - temp_a0 = 0; - while (temp_a0 < 3) - { - temp_v1 += (*((records + 3*temp_a1 + temp_a0)) * (temp_a0 + 1)) + temp_a1; - ++temp_a0; - } - ++temp_a1; - } - - return (temp_v1 % 256) & 0xFF; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern union GrandPrixPointsUnion D_8018ED10; - -s32 compute_save_data_checksum_1(void) { - void *temp_a0; - - temp_a0 = &D_8018ED10 + 1; - return ((D_8018ED10.grandPrixPointsMushroomCup + 1 + ((temp_a0->unk0 + 1) * 2) + 1 + ((temp_a0->unk1 + 1) * 3) + 1 + 1 + ((temp_a0->unk2 + 1) * 4) + 1 + 2 + ((temp_a0->unk3 + 1) * 5) + 1 + 3) % 0x100) & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B492C.s") -#endif - -s32 compute_save_data_checksum_2(void) { - s32 tmp = D_8018ED16 + 90; - return (tmp % 256) & 0xFF; -} - -void load_save_data(void) { - s32 temp_s0; - - osEepromLongRead(&gSIEventMesgQueue, 0, (u8*) &D_8018EB90, sizeof(SaveData)); - temp_s0 = 0; - while (temp_s0 < 16) // 16: 4 cup records * 4 course records? - { - func_800B4A9C(temp_s0); - ++temp_s0; - } - - validate_save_data(); - - gSoundMode = gSaveDataSoundMode; - if (gSoundMode >= NUM_SOUND_MODES) { - gSoundMode = SOUND_MONO; - } -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800B45E0(s32, u8 *, u8, s32); // extern -? func_800B4728(s32); // extern -s32 func_800B4874(s32); // extern -s32 func_800B4EB4(?, s32); // extern -? func_800B4FB0(s32); // extern -? func_800B559C(s32); // extern -s32 func_800B58C4(s32); // extern -extern u8 D_800F2E60; -extern ? D_8018EB90; -extern ? D_8018EBA2; - -void func_800B4A9C(s32 arg0) { - void *sp24; - s32 temp_v1; - u8 *temp_a1; - u8 temp_a2; - u8 temp_t6; - u8 temp_t8; - void *temp_a0; - void *temp_t2; - void *temp_v0; - s32 phi_v1; - u8 *phi_a1; - s32 phi_a3; - s32 phi_a3_2; - - if ((func_800B4EB4(0, arg0) & 0xFFFFF) < MAX_TIME) { - *(&D_8018EBA2 + (((arg0 / 4) * 0x60) + ((arg0 % 4) * 0x18))) = 1; - } - temp_t2 = ((arg0 / 4) * 0x60) + ((arg0 % 4) * 0x18) + &D_8018EB90; - sp24 = temp_t2; - func_800B4FB0(arg0); - sp24 = temp_t2; - if (temp_t2->unk17 != func_800B4874(arg0)) { - sp24 = temp_t2; - func_800B4728(arg0); - if (func_800B58C4(arg0) == 0) { - phi_v1 = 0; - phi_a1 = &D_800F2E60; - phi_a3_2 = 0; - do { - temp_v0 = ((arg0 / 8) * 0x38) + ((arg0 % 8) * 3) + 0x188 + &D_8018EB90 + phi_v1; - temp_t6 = temp_v0->unk0; - temp_a0 = temp_t2 + phi_v1; - temp_v1 = phi_v1 + 1; - temp_a0->unk0 = temp_t6; - temp_t8 = temp_v0->unk18; - temp_a0->unkF = temp_t8; - temp_a2 = *phi_a1; - phi_v1 = temp_v1; - phi_a3 = phi_a3_2; - if (((temp_t6 & 0xFF) == temp_a2) && ((temp_t8 & 0xFF) == temp_a2)) { - phi_a3 = phi_a3_2 + 1; - } - temp_a1 = phi_a1 + 1; - phi_a1 = temp_a1; - phi_a3_2 = phi_a3; - } while (temp_v1 != 3); - if (phi_a3 == 3) { - temp_t2->unk12 = 0; - } else { - temp_t2->unk12 = 1; - } - func_800B45E0(arg0, temp_a1, temp_a2, phi_a3); - } - func_800B559C(arg0); - return; - } - if (func_800B58C4(arg0) != 0) { - func_800B559C(arg0); - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4A9C.s") -#endif - -void validate_save_data(void) { - if ((D_8018ED16 != (compute_save_data_checksum_1() & 0xFFFFFFFF)) || (D_8018ED17 != (compute_save_data_checksum_2() & 0xFFFFFFFF))) { - - reset_save_data_grand_prix_points_and_sound_mode(); - - if (validate_save_data_checksum_backup() == 0) { - D_8018ED10.grandPrixPointsMushroomCup = D_8018ED88.grandPrixPointsMushroomCup; - if ((D_8018ED16 && D_8018ED16) && D_8018ED16) - { - } - - D_8018ED11 = D_8018ED89; - if ((D_8018ED16 && D_8018ED16) && D_8018ED16) - { - } - - D_8018ED12 = D_8018ED8A; - if ((D_8018ED16 && D_8018ED16) && D_8018ED16) - { - } - - D_8018ED13 = D_8018ED8B; - if ((D_8018ED16 && D_8018ED16) && D_8018ED16) - { - } - - gSaveDataSoundMode = gSaveDataSoundModeBackup; - D_8018ED16 = compute_save_data_checksum_backup_1(); - D_8018ED17 = compute_save_data_checksum_backup_2(); - osEepromLongWrite(&gSIEventMesgQueue, (((u32) &D_8018ED10 - (u32) &D_8018EB90) >> 3), (u8*) &D_8018ED10, 8); - } - update_save_data_backup(); - return; - } - - if (validate_save_data_checksum_backup() != 0) { - update_save_data_backup(); - } -} - -void populate_time_trial_record(u8 *timeTrialRecord, u32 time, s32 characterId) -{ - u32 timeRightShift8 = time >> 8; - u32 timeRightShift16 = timeRightShift8 >> 8; - s16 timeRightShift8Duplicate; - u16 timeRightShift16Duplicate; - - timeRightShift16Duplicate = timeRightShift16; - - timeTrialRecord[0] = time & 0xFF; - timeTrialRecord[1] = (timeRightShift8Duplicate = timeRightShift8); - timeTrialRecord[2] = (timeRightShift16Duplicate & 0xF) + ((characterId & 7) << 4); -} - -#ifdef NON_MATCHING -//generated by mips_to_c commit 99fec197b8c557ea7cc0d78f1b263a0de6e59168 -s32 func_800B4DF4(u8 *arg0) { - return ((arg0[1] << 8) + arg0[0] + (arg0[2] << 0x10)) & 0xFFFFFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4DF4.s") -#endif - -// Get a time trial record, infer course index -s32 func_800B4E24(s32 recordIndex) { - return func_800B4DF4( - D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[(((gCupSelection * 4) + gCupCourseSelection) / 4)] \ - .courseRecords[(((gCupSelection * 4) + gCupCourseSelection) % 4)] \ - .records[recordIndex] - ); -} - -// Get a time trial record, but take the course index as an argument -s32 func_800B4EB4(s32 recordIndex, s32 courseIndex) { - return func_800B4DF4( - D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[(courseIndex / 4)] \ - .courseRecords[(courseIndex % 4)] \ - .records[recordIndex] - ); -} - -// Get Best Lap record of the inferred course index -s32 func_800B4F2C(void) { - return func_800B4DF4( - D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[(((gCupSelection * 4) + gCupCourseSelection) / 4)] \ - .courseRecords[(((gCupSelection * 4) + gCupCourseSelection) % 4)] \ - .records[TIME_TRIAL_1LAP_RECORD] - ); -} - -// Get the best single lap time record of the given course index -s32 func_800B4FB0(s32 courseIndex) { - return func_800B4DF4( - D_8018EB90.allCourseTimeTrialRecords \ - .cupRecords[(courseIndex / 4)] \ - .courseRecords[(courseIndex % 4)] \ - .records[TIME_TRIAL_1LAP_RECORD] - ); -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800B45E0(s32); // extern -? populate_time_trial_record(void *, u32, s32, void *); // extern -s32 func_800B4DF4(void *); // extern -extern ? D_8018EB90; -extern s8 gCupSelection; - -s32 func_800B5020(u32 arg0, s32 arg1) { - s32 sp30; - s32 temp_a0; - s32 temp_s0; - s32 temp_s1; - s32 temp_v0; - s32 temp_v0_2; - s32 temp_v1; - u8 temp_t3; - u8 temp_t8; - u8 temp_t9; - void *temp_a3; - void *temp_s2; - void *temp_v0_3; - void *temp_v0_4; - s32 phi_s0; - s32 phi_s1; - s32 phi_s1_2; - s32 phi_v1; - s32 phi_a0; - s32 phi_v1_2; - s32 phi_s0_2; - s32 phi_a0_2; - - temp_v0 = (gCupSelection * 4) + gCupCourseSelection; - temp_s2 = ((temp_v0 / 4) * 0x60) + ((temp_v0 % 4) * 0x18) + &D_8018EB90; - sp30 = temp_v0; - phi_s0 = 0; - phi_s1 = 0; -loop_1: - phi_s1_2 = phi_s1; - phi_s0_2 = phi_s0; - if (arg0 >= (func_800B4DF4(temp_s2 + phi_s0) & 0xFFFFF)) { - temp_s1 = phi_s1 + 1; - temp_s0 = phi_s0 + 3; - phi_s0 = temp_s0; - phi_s1 = temp_s1; - phi_s1_2 = temp_s1; - phi_s0_2 = temp_s0; - if (temp_s1 != 5) { - goto loop_1; - } - } - phi_a0 = 4; - phi_a0_2 = 4; - if (phi_s1_2 >= 5) { - return -1; - } - temp_a3 = temp_s2 + phi_s0_2; - if (phi_s1_2 < 4) { - temp_v0_2 = -((4 - phi_s1_2) & 3); - if (temp_v0_2 != 0) { - phi_v1 = 4 * 3; - do { - temp_v0_3 = temp_s2 + phi_v1; - temp_a0 = phi_a0 - 1; - temp_v0_3->unk0 = temp_v0_3->unk-3; - temp_v0_3->unk1 = temp_v0_3->unk-2; - temp_v0_3->unk2 = temp_v0_3->unk-1; - phi_v1 += -3; - phi_a0 = temp_a0; - phi_a0_2 = temp_a0; - } while ((temp_v0_2 + 4) != temp_a0); - if (phi_s1_2 != temp_a0) { - goto block_10; - } - } else { -block_10: - phi_v1_2 = phi_a0_2 * 3; - do { - temp_v0_4 = temp_s2 + phi_v1_2; - temp_v0_4->unk0 = temp_v0_4->unk-3; - temp_v0_4->unk1 = temp_v0_4->unk-2; - temp_t8 = temp_v0_4->unk-8; - temp_t9 = temp_v0_4->unk-7; - temp_t3 = temp_v0_4->unk-1; - temp_v1 = phi_v1_2 - 0xC; - temp_v0_4->unk-3 = temp_v0_4->unk-6; - temp_v0_4->unk-7 = temp_v0_4->unk-A; - temp_v0_4->unk-8 = temp_v0_4->unk-B; - temp_v0_4->unk-2 = temp_v0_4->unk-5; - temp_v0_4->unk-1 = temp_v0_4->unk-4; - temp_v0_4->unk-6 = temp_v0_4->unk-9; - temp_v0_4->unk-5 = temp_t8; - temp_v0_4->unk-4 = temp_t9; - temp_v0_4->unk-9 = temp_v0_4->unk-C; - temp_v0_4->unk2 = temp_t3; - phi_v1_2 = temp_v1; - } while ((phi_s1_2 * 3) != temp_v1); - } - } - populate_time_trial_record(temp_a3, arg0, arg1, temp_a3); - temp_s2->unk12 = 1; - func_800B45E0(sp30); - return phi_s1_2; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5020.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -? populate_time_trial_record(u8 *, u32, s32, s32); /* extern */ -extern ? D_8018CA74; -s8 gCharacterSelections[4]; /* unable to generate initializer; const */ - -s32 func_800B5218(void) { - s32 sp38; - s32 sp28; - s32 sp24; - u8 *sp20; - struct_8018CA70_entry *sp18; - ? *temp_a1; - s32 temp_a0; - s32 temp_v0; - s32 temp_v1; - u32 temp_a1_2; - u8 *temp_v0_2; - ? *phi_a1; - struct_8018CA70_entry *phi_a2; - s32 phi_v0; - struct_8018CA70_entry *phi_a2_2; - s32 phi_a3; - s32 phi_v0_2; - s32 phi_a3_2; - - sp38 = (gCupSelection * 4) + gCupCourseSelection; - sp28 = (s32) *gCharacterSelections; - phi_a1 = &D_8018CA74; - phi_a2 = D_8018CA70; - phi_v0 = 1; - phi_a3_2 = 1; - do { - temp_v1 = phi_a1->unk20; - temp_a0 = phi_a2->lap1Duration; - phi_a2_2 = phi_a2; - phi_a3 = phi_a3_2; - if (temp_v1 < temp_a0) { - phi_a2_2 = (phi_v0 * 4) + D_8018CA70; - phi_a3 = 1 << phi_v0; - } else if (temp_a0 == temp_v1) { - phi_a3 = phi_a3_2 | (1 << phi_v0); - } - temp_v0 = phi_v0 + 1; - temp_a1 = phi_a1 + 4; - phi_a1 = temp_a1; - phi_a2 = phi_a2_2; - phi_v0 = temp_v0; - phi_a3_2 = phi_a3; - } while (temp_v0 != 3); - sp18 = phi_a2_2; - sp24 = phi_a3; - temp_a1_2 = phi_a2_2->lap1Duration; - phi_v0_2 = 0; - if (temp_a1_2 < (u32) (func_800B4F2C(temp_a0, temp_a1, phi_a2_2, phi_a3) & 0xFFFFF)) { - temp_v0_2 = &D_8018EB90.allCourseTimeTrialRecords.cupRecords[sp38].courseRecords[sp38].records[0]; - sp20 = temp_v0_2; - sp24 = phi_a3; - populate_time_trial_record(temp_v0_2 + 0xF, temp_a1_2, sp28, phi_a3); - temp_v0_2->unk12 = 1; - func_800B45E0(sp38); - phi_v0_2 = sp24; - } - return phi_v0_2; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5218.s") -#endif - -void func_800B536C(s32 arg0) { - u8* points; - u8 tmp; - s32 tmp2; - - if (arg0 >= 0) { - points = &D_8018EB90.grandPrixPoints[gCCSelection]; - - tmp = func_800B54EC(gCupSelection, *points); - tmp2 = 3 - arg0; - if ((arg0 < 3) && (tmp < (3-arg0))) { - *points = func_800B5508(gCupSelection, *points, tmp2); - write_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); - } - } -} - -void func_800B5404(s32 arg0, s32 arg1) -{ - u8 *points; - s32 temp_a0; - s32 temp; - int temp2; - UNUSED s32 pad; - - if (arg0 >= 0) { - temp2 = arg1 / 4; - points = &D_8018EB90.grandPrixPoints[arg1 % 4]; - temp = func_800B54EC(temp2, *points); - - if ((arg0 < 3) && (temp < (temp_a0 = 3 - arg0))) { - *points = func_800B5508(temp2, *points, temp_a0); - - write_save_data_grand_prix_points_and_sound_mode(); - update_save_data_backup(); - } - } -} - -// Get Grand Prix points for a given cup and CC mode -u8 func_800B54C0(s32 cup, s32 cc_mode) { - return func_800B54EC(cup, D_8018ED10.grandPrixPointsArray[cc_mode]); -} - -// Get Grand Prix points scored for a given cup -u8 func_800B54EC(s32 cup, s32 ccGrandPrixPoints) { - s32 cup_index = cup * 2; - u32 cup_points = ccGrandPrixPoints; - - cup_points &= (3 << cup_index); - cup_points >>= cup_index; - cup_points &= 0xFF; - - return cup_points; -} - -// Generate a new CC Grand Prix Points entry with points_scored -// placed in the given cup's location -u8 func_800B5508(s32 cup, s32 ccGrandPrixPoints, s32 points_scored) { - s32 cup_index = cup * 2; - - points_scored <<= cup_index; - ccGrandPrixPoints &= ~(3 << cup_index); - - return (ccGrandPrixPoints | points_scored); -} - -// Check if all 4 cups have gold cups scored -// for a given CC mode -s32 func_800B5530(s32 cc_mode) { - if (D_8018ED10.grandPrixPointsArray[cc_mode] == 0xFF) { - return 1; - } - return 0; -} - -// Check if the 150CC mode has all 4 gold cups -s32 func_800B555C(void) { - return func_800B5530(CC_150); -} - -// Check if the Extra mode has all 4 gold cups -s32 func_800B557C(void) { - return func_800B5530(CC_EXTRA); -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800B4874(s32, void *, void *); // extern -s8 func_800B578C(s32, void *, void *); // extern -s8 func_800B5888(s32); // extern -extern u8 D_800F2E60; -extern ? D_8018EB90; -extern OSMesgQueue gSIEventMesgQueue; - -void func_800B559C(s32 arg0, void *arg1, void *arg2) { - s32 temp_s1; - s32 temp_s1_2; - s32 temp_s6; - s32 temp_v0; - s32 temp_v0_2; - u8 *temp_s2_2; - void *temp_a0; - void *temp_a1; - void *temp_a1_2; - void *temp_a2; - void *temp_s2; - void *temp_v1; - void *temp_v1_2; - s32 phi_s1; - void *phi_a1; - void *phi_a2; - u8 *phi_a0; - s32 phi_v0; - s32 phi_v0_2; - void *phi_a1_2; - void *phi_a2_2; - void *phi_a1_3; - - temp_s6 = arg0 / 8; - temp_s1 = temp_s6 * 8; - phi_s1 = temp_s1; - phi_a1 = arg1; - phi_a2 = arg2; - phi_a1_2 = arg1; - phi_a2_2 = arg2; - if (temp_s1 < (temp_s1 + 8)) { - temp_s2 = (temp_s6 * 0x38) + 0x188 + &D_8018EB90; - do { - temp_a2 = &D_8018EB90 + ((phi_s1 / 4) * 0x60) + ((phi_s1 % 4) * 0x18); - phi_a2 = temp_a2; - phi_a0 = &D_800F2E60; - phi_v0 = 0; - phi_v0_2 = 0; - phi_a2_2 = temp_a2; - if (temp_a2->unk17 != func_800B4874(phi_s1, phi_a1, phi_a2)) { - temp_a1 = temp_s2 + ((phi_s1 % 8) * 3); - phi_a1_3 = temp_a1; - do { - temp_v1 = temp_a1 + phi_v0; - temp_v0 = phi_v0 + 1; - temp_v1->unk0 = *phi_a0; - temp_v1->unk18 = *phi_a0; - phi_a0 += 1; - phi_v0 = temp_v0; - } while (temp_v0 != 3); - } else { - temp_a1_2 = temp_s2 + ((phi_s1 % 8) * 3); - phi_a1_3 = temp_a1_2; - do { - temp_a0 = temp_a2 + phi_v0_2; - temp_v1_2 = temp_a1_2 + phi_v0_2; - temp_v0_2 = phi_v0_2 + 1; - temp_v1_2->unk0 = temp_a0->unk0; - temp_v1_2->unk18 = temp_a0->unkF; - phi_v0_2 = temp_v0_2; - } while (temp_v0_2 != 3); - } - temp_s1_2 = phi_s1 + 1; - phi_s1 = temp_s1_2; - phi_a1 = phi_a1_3; - phi_a1_2 = phi_a1_3; - } while (temp_s1_2 < ((temp_s6 * 8) + 8)); - } - temp_s2_2 = &D_8018EB90 + (temp_s6 * 0x38) + 0x188; - temp_s2_2->unk36 = func_800B578C(temp_s6, phi_a1_2, phi_a2_2); - temp_s2_2->unk37 = func_800B5888(temp_s6); - osEepromLongWrite(&gSIEventMesgQueue, ((temp_s2_2 - &D_8018EB90) >> 3) & 0xFF, temp_s2_2, 0x38); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B559C.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_8018EB90; - -s32 func_800B578C(s32 arg0) { - s32 temp_a0; - s32 temp_a1; - s32 temp_v1; - u8 *temp_a2; - void *temp_a3; - s32 phi_a0; - s32 phi_v0; - s32 phi_v1; - void *phi_a3; - s32 phi_v1_2; - u8 *phi_t0; - u8 *phi_a2; - - temp_a2 = (arg0 * 0x38) + 0x188 + &D_8018EB90; - phi_v0 = 0; - phi_v1_2 = 0; - phi_t0 = temp_a2; - phi_a2 = temp_a2; - do { - temp_a1 = phi_v0 + 1; - phi_a0 = 1; - phi_v0 = temp_a1; - phi_v1 = phi_v1_2 + ((*phi_t0 + 1) * temp_a1); - phi_a3 = phi_a2 + 1; - phi_a2 += 0x11; -loop_2: - temp_a3 = phi_a3 + 4; - temp_a0 = phi_a0 + 4; - temp_v1 = phi_v1 + ((phi_a3->unk0 + 1) * temp_a1) + phi_a0 + ((phi_a3->unk1 + 1) * temp_a1) + phi_a0 + 1 + ((temp_a3->unk-2 + 1) * temp_a1) + phi_a0 + 2 + ((temp_a3->unk-1 + 1) * temp_a1) + phi_a0 + 3; - phi_a0 = temp_a0; - phi_v1 = temp_v1; - phi_a3 = temp_a3; - phi_v1_2 = temp_v1; - if (temp_a0 != 0x11) { - goto loop_2; - } - phi_t0 += 0x11; - } while (temp_a1 != 3); - return (temp_v1 % 0x100) & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B578C.s") -#endif - -s32 func_800B5888(s32 arg0) { - s32 tmp = ((*(&D_8018ED4E + (arg0 * sizeof(OnlyBestTimeTrialRecords))) + 90)); - return (tmp % 256) & 0xFF; -} - -s32 func_800B58C4(s32 arg0) -{ - UNUSED s32 pad1; - OnlyBestTimeTrialRecords *temp_v1; - UNUSED s32 pad2; - UNUSED s32 pad3; - - temp_v1 = &D_8018EB90.onlyBestTimeTrialRecords[arg0 / 8]; - if ((temp_v1->unknownBytes[6] != (func_800B578C(arg0 / 8) ^ 0)) || (temp_v1->unknownBytes[7] != (func_800B5888(arg0 / 8) ^ 0))) - { - return 1; - } - - return 0; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s8 compute_save_data_checksum_backup_1(); // extern -s8 compute_save_data_checksum_backup_2(); // extern -extern ? D_8018EB90; -extern union GrandPrixPointsUnion D_8018ED10; -extern u8 D_8018ED11; -extern u8 D_8018ED12; -extern u8 D_8018ED13; -extern u8 gSaveDataSoundMode; -extern union GrandPrixPointsUnion D_8018ED88; -extern u8 D_8018ED89; -extern u8 D_8018ED8A; -extern u8 D_8018ED8B; -extern u8 gSaveDataSoundModeBackup; -extern s8 D_8018ED8E; -extern s8 D_8018ED8F; -extern OSMesgQueue gSIEventMesgQueue; - -void update_save_data_backup(void) { - D_8018ED88.grandPrixPointsMushroomCup = D_8018ED10.grandPrixPointsMushroomCup; - D_8018ED89 = D_8018ED11; - D_8018ED8A = D_8018ED12; - D_8018ED8B = D_8018ED13; - gSaveDataSoundModeBackup = gSaveDataSoundMode; - D_8018ED8E = compute_save_data_checksum_backup_1(); - D_8018ED8F = compute_save_data_checksum_backup_2(); - osEepromLongWrite(&gSIEventMesgQueue, ((&D_8018ED88 - &D_8018EB90) >> 3) & 0xFF, &D_8018ED88, 8); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5948.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern union GrandPrixPointsUnion D_8018ED88; - -s32 compute_save_data_checksum_backup_1(void) { - void *temp_a0; - - temp_a0 = &D_8018ED88 + 1; - return ((D_8018ED88.grandPrixPointsMushroomCup + 1 + ((temp_a0->unk0 + 1) * 2) + 1 + ((temp_a0->unk1 + 1) * 3) + 1 + 1 + ((temp_a0->unk2 + 1) * 4) + 1 + 2 + ((temp_a0->unk3 + 1) * 5) + 1 + 3) % 0x100) & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B59F4.s") -#endif - -s32 compute_save_data_checksum_backup_2(void) { - s32 tmp = D_8018ED8E + 90; - return (tmp % 256) & 0xFF; -} - -s32 validate_save_data_checksum_backup(void) -{ - if ((D_8018ED8E != (compute_save_data_checksum_backup_1() ^ 0)) || (D_8018ED8F != (compute_save_data_checksum_backup_2() ^ 0))) { - return 1; - } - - return 0; -} - -// Check if controller has a Controller Pak connected. -// Return 1 if it does, otherwise return 0. -s32 check_for_controller_pak(s32 controller) { - u8 sp1F; - UNUSED s32 phi_v0; - - if ((controller >= 4) || (controller < 0)) { - return 0; - } - - osPfsIsPlug(&gSIEventMesgQueue, &sp1F); - - if ((sp1F & (1 << controller)) != 0) { - return 1; - } - - return 0; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 check_for_controller_pak(s32); // extern -s32 osPfsInit(? *, OSPfs *, ?); // extern -extern u16 D_800E86F0; -extern u32 D_800E86F4; -extern s8 D_800E86F8; -extern u8 D_800F2E64; -extern u8 D_800F2E74; -extern OSPfs D_8018E868; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; -extern s32 gControllerPakNumPagesFree; -extern s32 D_8018EB84; -extern ? gSIEventMesgQueue; - -? func_800B5B94(void) { - s32 temp_v0_2; - s32 temp_v0_3; - s8 temp_v0; - s8 phi_v0; - ? phi_v0_2; - - temp_v0 = D_800E86F8; - phi_v0 = temp_v0; - if (temp_v0 != 0) { - temp_v0_2 = osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84); - if (temp_v0_2 != 0) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 5) { - D_800E86F8 = 0; - goto block_8; - } - phi_v0 = D_800E86F8; - } else { - D_800E86F8 = 0; -block_8: - phi_v0 = 0; - } - goto block_9; - } - return 0; - } -block_9: - if (phi_v0 == 0) { - if (check_for_controller_pak(0) == 0) { - return 1; - } - temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 1) { - if (temp_v0_3 != 4) { - if (temp_v0_3 != 0xA) { - if (temp_v0_3 == 0xB) { - goto block_17; - } - goto block_19; - } - return 2; - } -block_19: - return 2; - } -block_17: - return 1; - } - D_800E86F8 = 1; - if (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) == 0) { - return 0; - } - if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { - return 2; - } - if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { - return 2; - } - gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; - goto block_27; - } -block_27: - if (D_8018EB7C >= D_8018EB78) { - return 4; - } - phi_v0_2 = 4; - if (gControllerPakNumPagesFree >= 0x79) { - phi_v0_2 = -1; - } - return phi_v0_2; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5B94.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 check_for_controller_pak(?); // extern -s32 osPfsInit(? *, OSPfs *, ?); // extern -extern u16 D_800E86F0; -extern u32 D_800E86F4; -extern s8 D_800E86FC; -extern u8 D_800F2E64; -extern u8 D_800F2E74; -extern OSPfs D_8018E8D0; -extern s32 D_8018EB88; -extern ? gSIEventMesgQueue; - -s8 func_800B5DA4(void) { - s32 temp_v0_2; - s32 temp_v0_3; - s32 temp_v0_4; - s8 temp_v0; - s8 phi_v0; - s8 phi_v0_2; - - temp_v0 = D_800E86FC; - phi_v0 = temp_v0; - if (temp_v0 != 0) { - temp_v0_2 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB88); - if (temp_v0_2 != 0) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 5) { - goto block_7; - } - return -1; - } -block_7: - D_800E86FC = 0; - phi_v0 = 0; - goto block_8; - } - return 0; - } -block_8: - phi_v0_2 = phi_v0; - if (phi_v0 == 0) { - if (check_for_controller_pak(1) == 0) { - return 1; - } - temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1); - if (temp_v0_3 != 0) { - if (temp_v0_3 != 1) { - if (temp_v0_3 != 4) { - if (temp_v0_3 != 0xA) { - if (temp_v0_3 == 0xB) { - goto block_16; - } - goto block_18; - } - goto block_25; - } -block_18: - goto block_25; - } -block_16: - return 1; - } - D_800E86FC = 1; - temp_v0_4 = osPfsFindFile(&D_8018E8D0, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB88); - if (temp_v0_4 != 0) { - if (temp_v0_4 != 2) { - if (temp_v0_4 != 5) { - goto block_25; - } - return -1; - } -block_25: - phi_v0_2 = 2; - // Duplicate return node #26. Try simplifying control flow for better match - return phi_v0_2; - } - return 0; - } - return phi_v0_2; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5DA4.s") -#endif - -s32 func_800B5F30(void) { - s32 sp1C; - - if (D_800E86F8 != 0) { - return -4; - } - if (check_for_controller_pak(0) != 0) { - sp1C = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0); - if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { - D_800E86F8 = 0; - return -2; - } - if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { - D_800E86F8 = 0; - return -3; - } - gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; - if (sp1C == 0) { - D_800E86F8 = 1; - } - return sp1C; - } - return -1; -} - -s32 func_800B6014(void) { - s32 temp_v0; - - if (D_800E86FC != 0) { - return -4; - } - if (check_for_controller_pak(1) != 0) { - temp_v0 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1); - if (temp_v0 == 0) { - D_800E86FC = 1; - } - return temp_v0; - } - return -1; -} - -s32 func_800B6088(s32 arg0) { - struct_8018EE10_entry* temp_v1; - - temp_v1 = &D_8018EE10[arg0]; - temp_v1->checksum = func_800B6828(arg0); - return osPfsReadWriteFile(&D_8018E868, D_8018EB84, PFS_WRITE, arg0 * 0x80 /* 0x80 == sizeof(struct_8018EE10_entry) */, sizeof(struct_8018EE10_entry), (u8*) temp_v1); -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s32 D_800DC714; - -s32 func_800B60E8(s32 arg0) { - s32 temp_a2; - s32 temp_v0; - s32 temp_v1; - s32 phi_v0; - s32 phi_v1; - void *phi_a1; - - temp_a2 = arg0 + 1; - phi_v0 = 0; - phi_v1 = 0; - phi_a1 = D_800DC714 + (arg0 << 8); - do { - temp_v0 = phi_v0 + 4; - temp_v1 = phi_v1 + ((phi_a1->unk0 * temp_a2) + phi_v0) + ((phi_a1->unk1 * temp_a2) + phi_v0) + 1 + ((phi_a1->unk2 * temp_a2) + phi_v0) + 2 + ((phi_a1->unk3 * temp_a2) + phi_v0) + 3; - phi_v0 = temp_v0; - phi_v1 = temp_v1; - phi_a1 += 4; - } while (temp_v0 != 0x100); - return temp_v1 & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B60E8.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800051C4(); // extern -s32 func_800B6088(s32); // extern -s8 func_800B60E8(s32); // extern -extern u8 *D_800DC714; -extern s32 D_80162DFC; -extern OSPfs D_8018E868; -extern s32 D_8018EB84; -extern ? D_8018EE10; -extern s8 gCupSelection; - -s32 func_800B6178(s32 arg0) { - s32 temp_s0_2; - s32 temp_v0; - s32 temp_v0_2; - s32 temp_v0_3; - s32 temp_v1; - s8 temp_s0; - s8 temp_s0_3; - void *temp_s1; - void *temp_s3; - s8 phi_s0; - void *phi_s1; - s32 phi_s0_2; - void *phi_s1_2; - s32 phi_v0; - s8 phi_s0_3; - void *phi_s1_3; - s32 phi_v1; - - if ((arg0 != 0) && (arg0 != 1)) { - return -1; - } - if (D_800DC50C == RACING) { - func_800051C4(); - } - temp_s3 = (arg0 << 7) + &D_8018EE10; - temp_s3->unk4 = 0; - temp_v0 = func_800B6088(arg0); - temp_v1 = temp_v0; - phi_v1 = temp_v1; - if (temp_v0 != 0) { - temp_s3->unk4 = 0; - phi_s0 = 0; - phi_s1 = temp_s3; - do { - phi_s1->unk7 = phi_s0; - temp_s0 = phi_s0 + 4; - phi_s1->unkA = phi_s0 + 3; - phi_s1->unk9 = phi_s0 + 2; - phi_s1->unk8 = phi_s0 + 1; - phi_s0 = temp_s0; - phi_s1 += 4; - } while (temp_s0 != 0x3C); - } else { - temp_v0_2 = osPfsReadWriteFile(&D_8018E868, D_8018EB84, 1, (arg0 * 0x3C00) + 0x100, 0x3C00, D_800DC714); - phi_v0 = temp_v0_2; - phi_v1 = temp_v0_2; - if (temp_v0_2 == 0) { - temp_s3->unk4 = 1; - if (D_800DC50C == RACING) { - temp_s3->unk5 = (gCupSelection * 4) + gCupCourseSelection; - } - temp_s3->unk0 = D_80162DFC; - temp_s3->unk6 = D_80162DE0; - phi_s0_2 = 0; - phi_s1_2 = temp_s3; - do { - temp_s0_2 = phi_s0_2 + 1; - temp_s1 = phi_s1_2 + 1; - temp_s1->unk6 = func_800B60E8(phi_s0_2); - phi_s0_2 = temp_s0_2; - phi_s1_2 = temp_s1; - } while (temp_s0_2 != 0x3C); - temp_v0_3 = func_800B6088(arg0); - phi_v0 = temp_v0_3; - phi_v1 = temp_v0_3; - } - if (phi_v0 != 0) { - temp_s3->unk4 = 0; - phi_s0_3 = 0; - phi_s1_3 = temp_s3; - do { - phi_s1_3->unk7 = phi_s0_3; - temp_s0_3 = phi_s0_3 + 4; - phi_s1_3->unkA = phi_s0_3 + 3; - phi_s1_3->unk9 = phi_s0_3 + 2; - phi_s1_3->unk8 = phi_s0_3 + 1; - phi_s0_3 = temp_s0_3; - phi_s1_3 += 4; - } while (temp_s0_3 != 0x3C); - } - } - return phi_v1; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6178.s") -#endif - -s32 func_800B6348(s32 arg0) { - if ((D_8018EE10[0].ghostDataSaved != 0) && (arg0 == D_8018EE10[0].courseIndex)) { - return 0; - } - if ((D_8018EE10[1].ghostDataSaved != 0) && (arg0 == D_8018EE10[1].courseIndex)) { - return 1; - } - return 0; -} - -s32 func_800B639C(s32 arg0) { - if ((D_8018EE10[0].ghostDataSaved != 0) && (arg0 == D_8018EE10[0].courseIndex)) { - return 0; - } - if ((D_8018EE10[1].ghostDataSaved != 0) && (arg0 == D_8018EE10[1].courseIndex)) { - return 1; - } - return -1; -} - -s32 func_800B63F0(s32 arg0) { - s32 temp_s0; - u8* phi_s1; - s32 phi_s3; - - func_800051C4(); - D_80162DD6 = 1; - func_80005AE8(gPlayerThree); - - phi_s3 = 0; - if (((gCupSelection * 4) + gCupCourseSelection) != D_8018EE10[arg0].courseIndex) { - phi_s3 = 2; - } else if (D_80162DFC != D_8018EE10[arg0].unk_00) { - phi_s3 = 3; - } else { - if (D_80162DE0 != (u8) D_8018EE10[arg0].characterId) { - phi_s3 = 4; - } else { - temp_s0 = 0; - phi_s1 = (u8*) &D_8018EE10[arg0]; - - while (temp_s0 < 0x3C) - { - if (phi_s1[7] != func_800B60E8(temp_s0)) { - phi_s3 = 1; - break; - } - - ++phi_s1; - ++temp_s0; - } - } - } - - return phi_s3; -} - -s32 func_800B64EC(s32 arg0) { - s32 temp_s0; - s32 temp_v0; - u8 *phi_s1; - - if ((arg0 != 0) && (arg0 != 1)) - { - return -1; - } - - temp_v0 = osPfsReadWriteFile(&D_8018E868, D_8018EB84, PFS_READ, (arg0 * 0x3C00) + 0x100, 0x3C00, (u8 *) D_800DC714); - if (temp_v0 == 0) - { - phi_s1 = (u8 *) &D_8018EE10[arg0]; temp_s0 = 0; while (1) { - - if (phi_s1[7] != func_800B60E8(temp_s0)) { - D_8018EE10[arg0].ghostDataSaved = 0; - return -2; - } - - ++phi_s1; - if ((++temp_s0) == 0x3C) { - func_8000522C(); - D_80162DD4[0] = 0; - D_80162DE0 = (s32) D_8018EE10[arg0].characterId; - D_80162DFC = D_8018EE10[arg0].unk_00; - break; - } - } - - } - - return temp_v0; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800B60E8(s32); // extern -extern u8 *D_800DC714; -extern s32 D_80162DFC; -extern s32 D_8018D9C0; -extern OSPfs D_8018E8D0; -extern s32 D_8018EB88; -extern ? D_8018EE15; - -s32 func_800B65F4(s32 arg0, s32 arg1) { - s32 sp34; - s32 temp_s0; - s32 temp_v0; - void *temp_s3; - s32 phi_s0; - void *phi_s1; - - if ((arg0 != 0) && (arg0 != 1)) { - return -1; - } - temp_v0 = osPfsReadWriteFile(&D_8018E8D0, D_8018EB88, 0, (arg0 * 0x3C00) + 0x100, 0x3C00, D_800DC714); - sp34 = temp_v0; - if (temp_v0 == 0) { - temp_s3 = D_8018D9C0 + (arg0 << 7); - phi_s0 = 0; - phi_s1 = temp_s3; -loop_5: - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - if (phi_s1->unk7 != func_800B60E8(phi_s0)) { - temp_s3->unk4 = 0; - return -2; - } - phi_s1 += 1; - if (temp_s0 == 0x3C) { - D_80162DE0 = temp_s3->unk6; - D_80162DFC = temp_s3->unk0; - *(&D_8018EE15 + (arg1 << 7)) = temp_s3->unk5; - goto block_9; - } - goto loop_5; - } -block_9: - return sp34; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B65F4.s") -#endif - -void func_800B6708(void) { - s32 temp_s0; - - osPfsReadWriteFile(&D_8018E868, D_8018EB84, PFS_READ, 0, 0x100 /* 2*sizeof(struct_8018EE10_entry) ? */, (u8*) &D_8018EE10); - - for (temp_s0 = 0; temp_s0 < 2; ++temp_s0) { - if (D_8018EE10[temp_s0].checksum != func_800B6828(temp_s0)) { - D_8018EE10[temp_s0].ghostDataSaved = 0; - } - } -} - -void func_800B6798(void) { - s32 temp_s0; - u8* tmp; - - tmp = (u8*) D_8018D9C0; - - osPfsReadWriteFile(&D_8018E8D0, D_8018EB88, PFS_READ, 0, 0x100 /* 2*sizeof(struct_8018EE10_entry) ? */, tmp); - - for (temp_s0 = 0; temp_s0 < 2; ++temp_s0) { - // if (D_8018D9C0[temp_s0]->checksum != func_800B68F4(temp_s0)) { - // D_8018D9C0[temp_s0]->ghostDataSaved = 0; - // } - if ( ((struct_8018EE10_entry*) (tmp + (temp_s0 << 7)))->checksum != func_800B68F4(temp_s0)) { - ((struct_8018EE10_entry*) (tmp + (temp_s0 << 7)))->ghostDataSaved = 0; - } - } -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_8018EE10; - -s32 func_800B6828(s32 arg0) { - s32 temp_a1; - s32 temp_a2; - s32 temp_v1; - void *temp_v0; - s32 phi_a1; - s32 phi_v1; - void *phi_a3; - - temp_v0 = (arg0 << 7) + &D_8018EE10; - temp_a2 = arg0 + 1; - phi_a1 = 3; - phi_v1 = (temp_v0->unk0 * temp_a2) + (temp_v0->unk1 * temp_a2) + 1 + (temp_v0->unk2 * temp_a2) + 2; - phi_a3 = temp_v0 + 3; - do { - temp_a1 = phi_a1 + 4; - temp_v1 = phi_v1 + ((phi_a3->unk0 * temp_a2) + phi_a1) + ((phi_a3->unk1 * temp_a2) + phi_a1) + 1 + ((phi_a3->unk2 * temp_a2) + phi_a1) + 2 + ((phi_a3->unk3 * temp_a2) + phi_a1) + 3; - phi_a1 = temp_a1; - phi_v1 = temp_v1; - phi_a3 += 4; - } while (temp_a1 != 0x43); - return temp_v1 & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6828.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s32 D_8018D9C0; - -s32 func_800B68F4(s32 arg0) { - s32 temp_a1; - s32 temp_a2; - s32 temp_a3; - void *temp_v0; - void *temp_v1; - s32 phi_a2; - s32 phi_a1; - - temp_a3 = arg0 + 1; - temp_v1 = (arg0 << 7) + D_8018D9C0; - phi_a2 = 3; - phi_a1 = (temp_v1->unk0 * temp_a3) + (temp_v1->unk1 * temp_a3) + 1 + (temp_v1->unk2 * temp_a3) + 2; - do { - temp_v0 = temp_v1 + phi_a2; - temp_a2 = phi_a2 + 4; - temp_a1 = phi_a1 + ((temp_v0->unk0 * temp_a3) + phi_a2) + ((temp_v0->unk1 * temp_a3) + phi_a2) + 1 + ((temp_v0->unk2 * temp_a3) + phi_a2) + 2 + ((temp_v0->unk3 * temp_a3) + phi_a2) + 3; - phi_a2 = temp_a2; - phi_a1 = temp_a1; - } while (temp_a2 != 0x43); - return temp_a1 & 0xFF; -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B68F4.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s8 func_800B6828(s32, s32, s32); // extern -extern OSPfs D_8018E868; -extern s32 D_8018EB84; -extern ? D_8018EE10; - -void func_800B69BC(s32 arg0) { - s32 sp24; - u8 *sp20; - s32 temp_a3; - s8 temp_v0; - u8 *temp_t0; - s8 phi_v0; - u8 *phi_v1; - - temp_a3 = arg0 << 7; - temp_t0 = temp_a3 + &D_8018EE10; - temp_t0->unk4 = 0; - temp_t0->unk5 = 0; - temp_t0->unk6 = 0; - phi_v0 = 0; - phi_v1 = temp_t0; - do { - phi_v1->unk7 = phi_v0; - temp_v0 = phi_v0 + 4; - phi_v1->unkA = phi_v0 + 3; - phi_v1->unk9 = phi_v0 + 2; - phi_v1->unk8 = phi_v0 + 1; - phi_v0 = temp_v0; - phi_v1 += 4; - } while (temp_v0 != 0x3C); - sp24 = temp_a3; - sp20 = temp_t0; - temp_t0->unk7F = func_800B6828(arg0, arg0, temp_a3); - osPfsReadWriteFile(&D_8018E868, D_8018EB84, 1, temp_a3, 0x80, temp_t0); -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B69BC.s") -#endif - -s32 func_800B6A68(void) { - UNUSED s32 pad; - s32 sp30; - s32 temp_s0; - - sp30 = osPfsAllocateFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, 0x7900, &D_8018EB84); - if (sp30 == 0) { - temp_s0 = 0; - while (temp_s0 < 2) - { - func_800B69BC(temp_s0); - ++temp_s0; - } - } - - return sp30; -} - -#ifdef MIPS_TO_C -//generated by mips_to_c commit cc33060578851a93591ed035e96ffd1f15c765f1 -s32 check_for_controller_pak(?); /* extern */ -? func_800B6A68(); /* extern */ -s32 osPfsInit(? *, ? *, ?); /* extern */ -s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */ -s32 osPfsFreeBlocks(? *, s32 *); /* extern */ -s32 osPfsNumFiles(? *, s32 *, s32 *); /* extern */ -extern u16 D_800E86F0; -extern s32 D_800E86F4; -extern ? D_800F2E64; -extern ? D_800F2E74; -extern ? D_8018E868; -extern s32 D_8018EB78; -extern s32 D_8018EB7C; -extern ? D_8018EB84; -extern s32 gControllerPakNumPagesFree; -extern ? gSIEventMesgQueue; - -// Separated from assembly in code_800AF9B0/func_800B6A68.s -UNUSED void func_800B6AF8(void) { - s32 temp_t1; - - if ((check_for_controller_pak(0) != 0) && (osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0) == 0) && (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) != 0) && (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) == 0) && (D_8018EB7C < D_8018EB78) && (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) == 0)) { - temp_t1 = (s32) gControllerPakNumPagesFree >> 8; - gControllerPakNumPagesFree = temp_t1; - if (temp_t1 >= 0x79) { - func_800B6A68(); - } - } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6AF8.s") -#endif |
