mirror of https://github.com/n64decomp/mk64.git
4482 lines
142 KiB
C
4482 lines
142 KiB
C
#include <ultra64.h>
|
|
#include <macros.h>
|
|
#include <defines.h>
|
|
#include <PR/os.h>
|
|
#include <types.h>
|
|
#include "global.h"
|
|
#include "common_structs.h"
|
|
|
|
void func_8009E1C0();
|
|
void func_8009E208();
|
|
void func_8009E258();
|
|
void func_800B44AC(void);
|
|
void func_800B44BC(void);
|
|
s32 func_800B4520(void);
|
|
void func_800B4670(void);
|
|
void func_800B4728(s32 arg0);
|
|
void func_800B4820(void);
|
|
s32 func_800B492C(void);
|
|
s32 func_800B49E4(void);
|
|
void func_800B559C(s32 arg0);
|
|
void func_800B5948(void);
|
|
void play_sound2(s32);
|
|
void func_800CA330(s32);
|
|
u32 func_802A7B70(u16 x);
|
|
|
|
extern u16 gEnableDebugMode; // D_800DC520
|
|
extern s32 gModeSelection; // D_800DC53C
|
|
extern s32 D_800DC540;
|
|
extern s16 gCurrentCourseId; // D_800DC5A0
|
|
extern u16 D_800E86F0;
|
|
extern s32 D_800E86F4;
|
|
extern s8 D_800E86F8;
|
|
extern s8 D_800E86FC;
|
|
extern s16 gCupCourseOrder[NUM_CUPS][NUM_COURSES_PER_CUP]; // D_800F2BB4
|
|
extern u8 D_800F2E64;
|
|
extern u8 D_800F2E74;
|
|
extern OSMesgQueue gSIEventMesgQueue; // D_8014F0B8
|
|
extern s32 D_8018E7A8;
|
|
extern s8 D_8018E7B0;
|
|
extern OSPfs D_8018E868;
|
|
extern OSPfs D_8018E8D0;
|
|
extern s32 D_8018EB78;
|
|
extern s32 D_8018EB7C;
|
|
extern s32 D_8018EB84;
|
|
extern SaveData D_8018EB90;
|
|
extern u8 D_8018ED10[4]; // Direct reference to the grandPrixPoints section of save data
|
|
extern u8 D_8018ED11;
|
|
extern u8 D_8018ED12;
|
|
extern u8 D_8018ED13;
|
|
extern s8 D_8018ED16;
|
|
extern s8 D_8018ED17;
|
|
extern u32 D_8018EDB8;
|
|
extern u32 D_8018EDBC;
|
|
extern s8 D_8018EDE5;
|
|
extern s8 D_8018EDE6;
|
|
extern s8 D_8018EDE7;
|
|
extern s8 D_8018EDEC;
|
|
extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7
|
|
extern s8 gCourseRecordsMenuSelection; // D_8018EDF8
|
|
extern s32 gMenuTimingCounter; // D_8018EE00
|
|
extern s8 gCupSelection; // D_8018EE09
|
|
extern s8 D_8018EE0A;
|
|
extern s8 gCupCourseSelection; // D_8018EE0B
|
|
|
|
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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
|
? func_8009E1C0(); /* extern */
|
|
? func_800B053C(struct Controller *, s32); /* extern */
|
|
? func_800B13B0(struct Controller *, s32); /* extern */
|
|
? func_800B15AC(struct Controller *, s32); /* extern */
|
|
? func_800B1C40(struct Controller *, s32); /* extern */
|
|
? func_800B1C90(struct Controller *, s32); /* extern */
|
|
? func_800B20F4(struct Controller *, s32); /* extern */
|
|
? func_800B29D8(struct Controller *, s32); /* extern */
|
|
? func_800B3554(struct Controller *, s32); /* extern */
|
|
? func_800B3B58(struct Controller *, s32); /* extern */
|
|
? func_800CA330(?); /* extern */
|
|
? osViSetSpecialFeatures(s32); /* extern */
|
|
? play_sound2(?); /* extern */
|
|
|
|
void func_800B0350(void) {
|
|
s32 temp_t2_2;
|
|
u32 temp_t2;
|
|
u32 temp_v0;
|
|
s32 phi_s0;
|
|
|
|
if (D_800E86A4 == 0) {
|
|
phi_s0 = 0;
|
|
do {
|
|
if ((func_800B4520() == 0) && (gEnableDebugMode != 0) && ((gControllers[phi_s0].buttonPressed & 0x1000) != 0)) {
|
|
temp_v0 = gMenuSelection;
|
|
if ((temp_v0 != MAIN_MENU) && (temp_v0 != PLAYER_SELECT_MENU)) {
|
|
if (temp_v0 == COURSE_SELECT_MENU) {
|
|
func_800CA330(0x19);
|
|
goto block_9;
|
|
}
|
|
} else {
|
|
block_9:
|
|
play_sound2(0x49008016);
|
|
}
|
|
if ((gMenuSelection != CONTROLLER_PAK_MENU) && (gMenuSelection != START_MENU)) {
|
|
func_8009E1C0();
|
|
}
|
|
}
|
|
osViSetSpecialFeatures(D_800E86E4);
|
|
temp_t2 = gMenuSelection;
|
|
switch (temp_t2) {
|
|
case OPTIONS_MENU:
|
|
func_800B053C(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case DATA_MENU:
|
|
func_800B13B0(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case COURSE_DATA_MENU:
|
|
func_800B15AC(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case LOGO_INTRO_MENU:
|
|
func_800B1C40(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case CONTROLLER_PAK_MENU:
|
|
if (phi_s0 == 0) {
|
|
func_800B1C90(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
}
|
|
break;
|
|
case START_MENU_FROM_QUIT:
|
|
case START_MENU:
|
|
func_800B20F4(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case MAIN_MENU_FROM_QUIT:
|
|
case MAIN_MENU:
|
|
func_800B29D8(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case PLAYER_SELECT_MENU_FROM_QUIT:
|
|
case PLAYER_SELECT_MENU:
|
|
func_800B3554(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
case COURSE_SELECT_MENU_FROM_QUIT:
|
|
case COURSE_SELECT_MENU:
|
|
func_800B3B58(&gControllers[phi_s0], phi_s0 & 0xFFFF);
|
|
break;
|
|
}
|
|
temp_t2_2 = (phi_s0 + 1) & 0xFFFF;
|
|
phi_s0 = temp_t2_2;
|
|
} while (temp_t2_2 < 4);
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0350.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
|
? func_8009E280(); /* extern */
|
|
void *func_800AAEF4(?); /* extern */
|
|
? func_800B44BC(); /* extern */
|
|
? func_800B4670(); /* extern */
|
|
? func_800B46D0(?, u16); /* extern */
|
|
? func_800B5948(); /* extern */
|
|
? func_800B6088(s32); /* extern */
|
|
? func_800B6708(); /* extern */
|
|
? func_800B6798(); /* extern */
|
|
s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */
|
|
? play_sound2(?, u16, u16); /* extern */
|
|
extern ? D_8018E868;
|
|
extern ? D_8018EB84;
|
|
extern ? D_8018EE10;
|
|
extern ? D_8018EE14;
|
|
extern ? D_8018EE15;
|
|
static ? D_800F2E64; /* unable to generate initializer; const */
|
|
static ? D_800F2E74; /* unable to generate initializer; const */
|
|
u16 D_800E86F0; /* unable to generate initializer; const */
|
|
|
|
void func_800B053C(void *arg0, u16 arg1) {
|
|
u16 sp3E;
|
|
void *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_5;
|
|
s32 temp_v0_6;
|
|
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;
|
|
u16 temp_t8;
|
|
u32 temp_t9;
|
|
u8 temp_v0_2;
|
|
u8 temp_v0_3;
|
|
u8 temp_v0_7;
|
|
u8 temp_v0_8;
|
|
void *temp_a0;
|
|
void *temp_t0;
|
|
void *temp_v0;
|
|
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;
|
|
void *phi_t0;
|
|
s8 *phi_t1_4;
|
|
s32 phi_a1_5;
|
|
s8 *phi_t1_5;
|
|
s32 phi_v0;
|
|
s32 phi_v0_2;
|
|
|
|
temp_t8 = (arg0->unk6 | arg0->unkC) & 0xFFFF;
|
|
phi_a2 = temp_t8;
|
|
if ((gEnableDebugMode == 0) && ((temp_t8 & 0x1000) != 0)) {
|
|
phi_a2 = (temp_t8 | 0x8000) & 0xFFFF;
|
|
}
|
|
sp3E = phi_a2;
|
|
if (func_800B4520(arg0) == 0) {
|
|
sp3E = phi_a2;
|
|
temp_v0 = func_800AAEF4(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 = phi_a2;
|
|
if (((phi_a2 & 0x400) != 0) && (temp_v1 < 0x18)) {
|
|
D_8018EDEC = temp_v1 + 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2, phi_a2);
|
|
temp_f0 = temp_t0->unk24;
|
|
phi_a1 = sp20;
|
|
if (temp_f0 < 4.2) {
|
|
temp_t0->unk24 = 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 (temp_v1_2 >= 0x16) {
|
|
D_8018EDEC = temp_v1_2 - 1;
|
|
sp2C = 1;
|
|
sp20 = phi_a1;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a1);
|
|
temp_f0_2 = temp_t0->unk24;
|
|
phi_t1 = &D_8018EDEC;
|
|
if (temp_f0_2 < 4.2) {
|
|
temp_t0->unk24 = temp_f0_2 + 4.0;
|
|
}
|
|
temp_t0->unk8 = -1;
|
|
}
|
|
}
|
|
if (sp2C != 0) {
|
|
if (temp_t0->unk4 != gSoundMode) {
|
|
gSaveDataSoundMode = gSoundMode;
|
|
sp20 = phi_a1;
|
|
sp38 = temp_t0;
|
|
func_800B4670();
|
|
func_800B5948();
|
|
temp_t0->unk4 = gSoundMode;
|
|
phi_t1 = &D_8018EDEC;
|
|
}
|
|
}
|
|
if ((phi_a1 & 0x4000) != 0) {
|
|
sp38 = temp_t0;
|
|
func_8009E280();
|
|
play_sound2(0x49008002);
|
|
if (temp_t0->unk4 != gSoundMode) {
|
|
gSaveDataSoundMode = gSoundMode;
|
|
sp38 = temp_t0;
|
|
func_800B4670();
|
|
func_800B5948();
|
|
temp_t0->unk4 = gSoundMode;
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
if ((phi_a1 & 0x8000) != 0) {
|
|
temp_v0_4 = *phi_t1;
|
|
if (temp_v0_4 != 0x15) {
|
|
if (temp_v0_4 != 0x16) {
|
|
if (temp_v0_4 != 0x17) {
|
|
if (temp_v0_4 != 0x18) {
|
|
return;
|
|
}
|
|
*phi_t1 = 0x1E;
|
|
play_sound2(0x49008001, phi_a1);
|
|
return;
|
|
}
|
|
sp38 = temp_t0;
|
|
temp_v0_5 = func_800B5DA4();
|
|
if (temp_v0_5 != -1) {
|
|
if (temp_v0_5 != 0) {
|
|
if (temp_v0_5 != 1) {
|
|
if (temp_v0_5 != 2) {
|
|
|
|
}
|
|
D_8018EDEC = 0x2D;
|
|
play_sound2(0x4900FF07);
|
|
return;
|
|
}
|
|
D_8018EDEC = 0x2C;
|
|
play_sound2(0x4900FF07);
|
|
return;
|
|
}
|
|
sp38 = temp_t0;
|
|
func_800B6798();
|
|
temp_v0_6 = func_800B5B94();
|
|
temp_t9 = temp_v0_6 + 1;
|
|
sp2C = temp_v0_6;
|
|
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;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
D_8018EDEC = 0x2B;
|
|
play_sound2(0x4900FF07);
|
|
return;
|
|
}
|
|
if (gSoundMode < SOUND_MONO) {
|
|
gSoundMode += 1;
|
|
} else {
|
|
gSoundMode = SOUND_STEREO;
|
|
}
|
|
if (gSoundMode == SOUND_UNUSED) {
|
|
gSoundMode = SOUND_MONO;
|
|
}
|
|
func_800B44BC();
|
|
switch(gSoundMode){
|
|
case SOUND_STEREO:
|
|
play_sound2(0x49008024);
|
|
break;
|
|
case SOUND_HEADPHONES:
|
|
play_sound2(0x49008025);
|
|
break;
|
|
case SOUND_MONO:
|
|
play_sound2(0x49008029);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
func_8009E280();
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
case 0x1E: /* switch 1 */
|
|
case 0x1F: /* switch 1 */
|
|
phi_a1_2 = phi_a2;
|
|
if (((phi_a2 & 0x400) != 0) && (temp_v1 < 0x1F)) {
|
|
D_8018EDEC = temp_v1 + 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2, phi_a2);
|
|
temp_f0_3 = temp_t0->unk24;
|
|
phi_a1_2 = sp20;
|
|
if (temp_f0_3 < 4.2) {
|
|
temp_t0->unk24 = 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 (temp_v1_3 >= 0x1F) {
|
|
D_8018EDEC = temp_v1_3 - 1;
|
|
sp20 = phi_a1_2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a1_2);
|
|
temp_f0_4 = temp_t0->unk24;
|
|
phi_t1_2 = &D_8018EDEC;
|
|
if (temp_f0_4 < 4.2) {
|
|
temp_t0->unk24 = temp_f0_4 + 4.0;
|
|
}
|
|
temp_t0->unk8 = -1;
|
|
}
|
|
}
|
|
if ((phi_a1_2 & 0x4000) != 0) {
|
|
*phi_t1_2 = 0x18;
|
|
play_sound2(0x49008002, phi_a1_2);
|
|
return;
|
|
}
|
|
if ((phi_a1_2 & 0x8000) != 0) {
|
|
temp_v0_9 = *phi_t1_2;
|
|
if (temp_v0_9 != 0x1E) {
|
|
if (temp_v0_9 != 0x1F) {
|
|
return;
|
|
}
|
|
*phi_t1_2 = 0x20;
|
|
func_800B46D0(0x49000000, phi_a1_2);
|
|
D_800DC5AC = 0;
|
|
play_sound2(0x4900801D);
|
|
return;
|
|
}
|
|
*phi_t1_2 = 0x18;
|
|
play_sound2(0x49008002, phi_a1_2);
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
case 0x20: /* switch 1 */
|
|
if ((phi_a2 & 0xD000) != 0) {
|
|
D_8018EDEC = 0x18;
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
case 0x28: /* switch 1 */
|
|
case 0x29: /* switch 1 */
|
|
phi_a1_3 = phi_a2;
|
|
if (((phi_a2 & 0x400) != 0) && (temp_v1 < 0x29) && (sp30->unk84 != 0)) {
|
|
D_8018EDEC = temp_v1 + 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2, phi_a2);
|
|
temp_f0_5 = temp_t0->unk24;
|
|
phi_a1_3 = sp20;
|
|
if (temp_f0_5 < 4.2) {
|
|
temp_t0->unk24 = 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 ((temp_v1_4 >= 0x29) && (sp30->unk4 != 0)) {
|
|
D_8018EDEC = temp_v1_4 - 1;
|
|
sp20 = phi_a1_3;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a1_3);
|
|
temp_f0_6 = temp_t0->unk24;
|
|
phi_t1_3 = &D_8018EDEC;
|
|
if (temp_f0_6 < 4.2) {
|
|
temp_t0->unk24 = temp_f0_6 + 4.0;
|
|
}
|
|
temp_t0->unk8 = -1;
|
|
}
|
|
}
|
|
if ((phi_a1_3 & 0x4000) != 0) {
|
|
*phi_t1_3 = 0x17;
|
|
play_sound2(0x49008002, phi_a1_3);
|
|
return;
|
|
}
|
|
if ((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, phi_a1_3);
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
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) && (temp_v1 < 0x33)) {
|
|
D_8018EDEC = temp_v1 + 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2, phi_a2);
|
|
temp_f0_7 = temp_t0->unk24;
|
|
if (temp_f0_7 < 4.2) {
|
|
temp_t0->unk24 = temp_f0_7 + 4.0;
|
|
}
|
|
temp_t0->unk8 = 1;
|
|
}
|
|
phi_a1_4 = phi_a2;
|
|
phi_t0 = temp_t0;
|
|
phi_t1_4 = &D_8018EDEC;
|
|
if ((phi_a2 & 0x800) != 0) {
|
|
temp_v1_5 = D_8018EDEC;
|
|
if (temp_v1_5 >= 0x33) {
|
|
D_8018EDEC = temp_v1_5 - 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2);
|
|
temp_f0_8 = temp_t0->unk24;
|
|
phi_a1_4 = phi_a2;
|
|
phi_t0 = temp_t0;
|
|
phi_t1_4 = &D_8018EDEC;
|
|
if (temp_f0_8 < 4.2) {
|
|
temp_t0->unk24 = 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;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
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;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
case 0x38: /* switch 1 */
|
|
case 0x39: /* switch 1 */
|
|
phi_a1_5 = phi_a2;
|
|
if (((phi_a2 & 0x100) != 0) && (temp_v1 < 0x39)) {
|
|
D_8018EDEC = temp_v1 + 1;
|
|
sp20 = phi_a2;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a2, phi_a2);
|
|
temp_f0_9 = temp_t0->unk24;
|
|
phi_a1_5 = sp20;
|
|
if (temp_f0_9 < 4.2) {
|
|
temp_t0->unk24 = 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 (temp_v1_6 >= 0x39) {
|
|
D_8018EDEC = temp_v1_6 - 1;
|
|
sp20 = phi_a1_5;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008000, phi_a1_5);
|
|
temp_f0_10 = temp_t0->unk24;
|
|
phi_t1_5 = &D_8018EDEC;
|
|
if (temp_f0_10 < 4.2) {
|
|
temp_t0->unk24 = temp_f0_10 + 4.0;
|
|
}
|
|
temp_t0->unk8 = -1;
|
|
}
|
|
}
|
|
if ((phi_a1_5 & 0x4000) != 0) {
|
|
*phi_t1_5 = temp_t0->unk1C + 0x32;
|
|
play_sound2(0x49008002, phi_a1_5);
|
|
return;
|
|
}
|
|
if ((phi_a1_5 & 0x8000) != 0) {
|
|
if (*phi_t1_5 == 0x38) {
|
|
*phi_t1_5 = 0x17;
|
|
play_sound2(0x49008002, phi_a1_5);
|
|
return;
|
|
}
|
|
*phi_t1_5 = 0x3A;
|
|
sp38 = temp_t0;
|
|
play_sound2(0x49008001, phi_a1_5);
|
|
temp_t0->unk4 = 0;
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
case 0x3A: /* switch 1 */
|
|
if (arg1 == 0) {
|
|
temp_v0->unk4 = temp_v0->unk4 + 1;
|
|
}
|
|
if (temp_v0->unk4 >= 3) {
|
|
D_8018EDEC = 0x3B;
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
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 = temp_v0->unk4 + 1;
|
|
}
|
|
if (temp_v0->unk4 >= 3) {
|
|
D_8018EDEC = 0x47;
|
|
return;
|
|
}
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
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;
|
|
/* Duplicate return node #166. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
} 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, s32 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 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_8009E208(?); // extern
|
|
void *func_800AAEF4(?, s8); // extern
|
|
s32 func_800B4520(); // extern
|
|
? func_800B4728(s8, s8, void *, s32); // extern
|
|
? func_800B559C(s8); // extern
|
|
s32 func_800B639C(s8, s8, void *, s32); // extern
|
|
s32 func_800B69BC(s32, s32); // extern
|
|
? play_sound2(?, s32); // extern
|
|
extern f64 D_800F2D90;
|
|
extern f64 D_800F2D98;
|
|
extern f64 D_800F2DA0;
|
|
extern f64 D_800F2DA8;
|
|
extern f64 D_800F2DB0;
|
|
extern ? D_8018EB90;
|
|
extern s8 D_8018EDEC;
|
|
extern s8 gTimeTrialDataCourseIndex;
|
|
extern s8 gCourseRecordsMenuSelection;
|
|
extern s8 D_8018EDF9;
|
|
|
|
void func_800B15AC(void *arg0, ? arg1) {
|
|
u16 sp2E;
|
|
void *sp28;
|
|
void *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;
|
|
s32 temp_t4;
|
|
s32 temp_v0_5;
|
|
s8 temp_a1_2;
|
|
s8 temp_a1_3;
|
|
s8 temp_a1_4;
|
|
s8 temp_v0;
|
|
s8 temp_v0_10;
|
|
s8 temp_v0_2;
|
|
s8 temp_v0_3;
|
|
s8 temp_v0_4;
|
|
s8 temp_v0_6;
|
|
s8 temp_v0_7;
|
|
s8 temp_v0_8;
|
|
s8 temp_v0_9;
|
|
u16 temp_t8;
|
|
void *temp_a2;
|
|
void *temp_a2_2;
|
|
u16 phi_v1;
|
|
s8 phi_a1;
|
|
s32 phi_a3;
|
|
s8 *phi_v1_2;
|
|
s32 phi_a3_2;
|
|
void *phi_a2;
|
|
s8 *phi_v1_3;
|
|
|
|
temp_t8 = (arg0->unk6 | arg0->unkC) & 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;
|
|
if (temp_v0 != 0xB) {
|
|
if (temp_v0 != 0xC) {
|
|
if (temp_v0 != 0xD) {
|
|
return;
|
|
}
|
|
if ((phi_v1 & 0xD000) != 0) {
|
|
D_8018EDEC = 0xB;
|
|
}
|
|
// Duplicate return node #76. Try simplifying control flow for better match
|
|
return;
|
|
}
|
|
sp18 = phi_v1;
|
|
temp_a2 = func_800AAEF4(0xE9, 0xB);
|
|
if ((sp18 & 0x800) != 0) {
|
|
temp_v0_2 = D_8018EDF9;
|
|
if (temp_v0_2 > 0) {
|
|
D_8018EDF9 = temp_v0_2 - 1;
|
|
sp28 = temp_a2;
|
|
sp18 = sp18;
|
|
play_sound2(0x49008000);
|
|
temp_f0 = temp_a2->unk24;
|
|
if (temp_f0 < D_800F2DA8) {
|
|
temp_a2->unk24 = temp_f0 + 4.0;
|
|
}
|
|
temp_a2->unk8 = -1;
|
|
}
|
|
}
|
|
if ((sp18 & 0x400) != 0) {
|
|
temp_v0_3 = D_8018EDF9;
|
|
if (temp_v0_3 <= 0) {
|
|
D_8018EDF9 = temp_v0_3 + 1;
|
|
sp28 = temp_a2;
|
|
sp18 = sp18;
|
|
play_sound2(0x49008000);
|
|
temp_f0_2 = temp_a2->unk24;
|
|
if (temp_f0_2 < D_800F2DB0) {
|
|
temp_a2->unk24 = temp_f0_2 + 4.0;
|
|
}
|
|
temp_a2->unk8 = 1;
|
|
}
|
|
}
|
|
if ((sp18 & 0x4000) != 0) {
|
|
D_8018EDEC = 0xB;
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
if ((sp18 & 0x8000) != 0) {
|
|
if (D_8018EDF9 != 0) {
|
|
temp_v0_4 = gCourseRecordsMenuSelection;
|
|
phi_a1 = 0;
|
|
if (temp_v0_4 != 1) {
|
|
if (temp_v0_4 != 2) {
|
|
|
|
} else {
|
|
temp_v0_5 = func_800B639C(gTimeTrialDataCourseIndex, 0, temp_a2, sp18);
|
|
phi_a1 = temp_v0_5;
|
|
if (temp_v0_5 >= 0) {
|
|
sp20 = temp_v0_5;
|
|
temp_a1 = sp20;
|
|
if (func_800B69BC(temp_v0_5, temp_v0_5) != 0) {
|
|
D_8018EDEC = 0xD;
|
|
sp20 = temp_a1;
|
|
play_sound2(0x4900FF07, temp_a1);
|
|
phi_a1 = temp_a1;
|
|
} else {
|
|
sp20 = temp_a1;
|
|
play_sound2(0x4900801D, temp_a1);
|
|
D_8018EDEC = 0xB;
|
|
phi_a1 = temp_a1;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
func_800B4728(gTimeTrialDataCourseIndex, 0, temp_a2, sp18);
|
|
func_800B559C(gTimeTrialDataCourseIndex);
|
|
play_sound2(0x4900801D);
|
|
phi_a1 = -1;
|
|
}
|
|
if ((phi_a1 + 1) == 0) {
|
|
D_8018EDEC = 0xB;
|
|
return;
|
|
}
|
|
// Duplicate return node #76. Try simplifying control flow for better match
|
|
return;
|
|
}
|
|
play_sound2(0x49008002);
|
|
D_8018EDEC = 0xB;
|
|
return;
|
|
}
|
|
// Duplicate return node #76. Try simplifying control flow for better match
|
|
return;
|
|
}
|
|
phi_a3 = phi_v1;
|
|
if ((phi_v1 & 0x200) != 0) {
|
|
temp_a1_2 = gTimeTrialDataCourseIndex;
|
|
if (temp_a1_2 > 0) {
|
|
gTimeTrialDataCourseIndex = temp_a1_2 - 1;
|
|
sp18 = phi_v1;
|
|
play_sound2(0x49008000, temp_a1_2);
|
|
phi_a3 = sp18;
|
|
}
|
|
}
|
|
if ((phi_a3 & 0x100) != 0) {
|
|
temp_a1_3 = gTimeTrialDataCourseIndex;
|
|
if (temp_a1_3 < 0xF) {
|
|
gTimeTrialDataCourseIndex = temp_a1_3 + 1;
|
|
sp18 = phi_a3;
|
|
play_sound2(0x49008000, temp_a1_3);
|
|
}
|
|
}
|
|
sp18 = phi_a3;
|
|
temp_a1_4 = gTimeTrialDataCourseIndex;
|
|
temp_a2_2 = func_800AAEF4(0xE8);
|
|
temp_t4 = ((temp_a1_4 / 4) * 0x60) + ((temp_a1_4 % 4) * 0x18);
|
|
if (gCourseRecordsMenuSelection == 2) {
|
|
sp28 = temp_a2_2;
|
|
sp18 = phi_a3;
|
|
sp24 = temp_t4 + &D_8018EB90;
|
|
if (func_800B639C(temp_a1_4, temp_a1_4, temp_a2_2, phi_a3) < 0) {
|
|
gCourseRecordsMenuSelection = gCourseRecordsMenuSelection - 1;
|
|
}
|
|
}
|
|
temp_v0_6 = gCourseRecordsMenuSelection;
|
|
phi_v1_2 = &gCourseRecordsMenuSelection;
|
|
if ((temp_v0_6 == 1) && ((temp_t4 + &D_8018EB90)->unk12 == 0)) {
|
|
gCourseRecordsMenuSelection = temp_v0_6 - 1;
|
|
}
|
|
if ((phi_a3 & 0x800) != 0) {
|
|
temp_v0_7 = gCourseRecordsMenuSelection;
|
|
if (temp_v0_7 > 0) {
|
|
gCourseRecordsMenuSelection = temp_v0_7 - 1;
|
|
temp_v0_8 = gCourseRecordsMenuSelection;
|
|
if ((temp_v0_8 == 1) && ((temp_t4 + &D_8018EB90)->unk12 == 0)) {
|
|
gCourseRecordsMenuSelection = temp_v0_8 - 1;
|
|
}
|
|
sp28 = temp_a2_2;
|
|
sp18 = phi_a3;
|
|
sp24 = temp_t4 + &D_8018EB90;
|
|
play_sound2(0x49008000);
|
|
temp_f0_3 = temp_a2_2->unk24;
|
|
phi_v1_2 = &gCourseRecordsMenuSelection;
|
|
if (temp_f0_3 < D_800F2D90) {
|
|
temp_a2_2->unk24 = temp_f0_3 + 4.0;
|
|
}
|
|
temp_a2_2->unk8 = -1;
|
|
}
|
|
}
|
|
phi_a3_2 = phi_a3;
|
|
phi_a2 = temp_a2_2;
|
|
phi_v1_3 = phi_v1_2;
|
|
if ((phi_a3 & 0x400) != 0) {
|
|
temp_v0_9 = *phi_v1_2;
|
|
if (temp_v0_9 < 2) {
|
|
*phi_v1_2 = temp_v0_9 + 1;
|
|
temp_v0_10 = *phi_v1_2;
|
|
if ((temp_v0_10 == 1) && ((temp_t4 + &D_8018EB90)->unk12 == 0)) {
|
|
*phi_v1_2 = temp_v0_10 + 1;
|
|
}
|
|
if ((*phi_v1_2 == 2) && (sp28 = temp_a2_2, sp18 = phi_a3, sp24 = temp_t4 + &D_8018EB90, phi_a3_2 = phi_a3, phi_a2 = temp_a2_2, phi_v1_3 = &gCourseRecordsMenuSelection, (func_800B639C(gTimeTrialDataCourseIndex) < 0))) {
|
|
if ((temp_t4 + &D_8018EB90)->unk12 == 0) {
|
|
gCourseRecordsMenuSelection = 0;
|
|
} else {
|
|
gCourseRecordsMenuSelection = 1;
|
|
}
|
|
} else {
|
|
sp28 = temp_a2_2;
|
|
sp18 = phi_a3;
|
|
play_sound2(0x49008000);
|
|
temp_f0_4 = temp_a2_2->unk24;
|
|
phi_a3_2 = phi_a3;
|
|
phi_a2 = temp_a2_2;
|
|
phi_v1_3 = &gCourseRecordsMenuSelection;
|
|
if (temp_f0_4 < D_800F2D98) {
|
|
temp_a2_2->unk24 = temp_f0_4 + 4.0;
|
|
}
|
|
temp_a2_2->unk8 = 1;
|
|
}
|
|
}
|
|
}
|
|
if ((phi_a3_2 & 0x4000) != 0) {
|
|
func_8009E208();
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
if ((phi_a3_2 & 0x8000) != 0) {
|
|
temp_f0_5 = phi_a2->unk24;
|
|
if (temp_f0_5 < D_800F2DA0) {
|
|
phi_a2->unk24 = temp_f0_5 + 4.0;
|
|
}
|
|
if (*phi_v1_3 == 0) {
|
|
func_8009E208(0x49008001);
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
D_8018EDEC = 0xC;
|
|
D_8018EDF9 = 0;
|
|
play_sound2(0x49008001);
|
|
return;
|
|
}
|
|
// Duplicate return node #76. Try simplifying control flow for better match
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B15AC.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_8009E1E4(); // extern
|
|
s32 func_800B4520(); // extern
|
|
? func_800CA388(?); // extern
|
|
|
|
void func_800B1C40(void *arg0, ? arg1) {
|
|
u16 sp1E;
|
|
|
|
sp1E = arg0->unk6 | arg0->unkC;
|
|
if ((func_800B4520() == 0) && (sp1E != 0)) {
|
|
func_800CA388(0x3C);
|
|
func_8009E1E4();
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B1C40.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
|
? func_8009E1C0(); /* extern */
|
|
s32 osPfsDeleteFile(? *, u16, s32, void *, void *); /* extern */
|
|
? play_sound2(?); /* extern */
|
|
extern ? D_8018E868;
|
|
extern ? D_8018E938;
|
|
extern ? D_8018EB38;
|
|
static ? D_800E86C6; /* unable to generate initializer; const */
|
|
|
|
void func_800B1C90(void *arg0, s32 arg1) {
|
|
u16 sp36;
|
|
s32 sp2C;
|
|
void *sp20;
|
|
s32 temp_t0;
|
|
s32 temp_v0;
|
|
s8 temp_t9;
|
|
void *temp_v1;
|
|
|
|
sp36 = arg0->unk6 | arg0->unkC;
|
|
if (func_800B4520() == 0) {
|
|
temp_t9 = gControllerPakMenuSelection;
|
|
switch (temp_t9) {
|
|
case CONTROLLER_PAK_MENU_SELECT_RECORD:
|
|
if ((sp36 & 0x9000) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
|
|
play_sound2(0x49008001);
|
|
return;
|
|
}
|
|
if ((sp36 & 0x300) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_END;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
case CONTROLLER_PAK_MENU_END:
|
|
if ((sp36 & 0x9000) != 0) {
|
|
play_sound2(0x49008001);
|
|
func_8009E1C0();
|
|
D_800E86F8 = 0;
|
|
return;
|
|
}
|
|
if ((sp36 & 0x300) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
case CONTROLLER_PAK_MENU_TABLE_GAME_DATA:
|
|
if ((sp36 & 0x9000) != 0) {
|
|
if (*(&D_8018EB38 + ((*(&D_800E86C6 + gControllerPakSelectedTableRow) - 1) * 4)) == 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT;
|
|
play_sound2(0x49008001);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
if ((sp36 & 0x4000) != 0) {
|
|
if (*D_800E86D0 == 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD;
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
if ((sp36 & 0x800) != 0) {
|
|
if (*D_800E86D0 == 0) {
|
|
gControllerPakSelectedTableRow += -1;
|
|
if (gControllerPakSelectedTableRow < 0) {
|
|
gControllerPakSelectedTableRow = 0;
|
|
if (*(&D_800E86C6 + gControllerPakSelectedTableRow) != 1) {
|
|
*D_800E86D0 = 2;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
if (((sp36 & 0x400) != 0) && (*D_800E86D0 == 0)) {
|
|
gControllerPakSelectedTableRow += 1;
|
|
if (gControllerPakSelectedTableRow >= 5) {
|
|
gControllerPakSelectedTableRow = 4;
|
|
if (*(&D_800E86C6 + gControllerPakSelectedTableRow) != 0x10) {
|
|
*D_800E86D0 = 1;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
case CONTROLLER_PAK_MENU_QUIT:
|
|
if ((sp36 & 0xD000) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
if ((sp36 & 0x300) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
case CONTROLLER_PAK_MENU_ERASE:
|
|
if ((sp36 & 0x9000) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_GO_TO_ERASING;
|
|
play_sound2(0x49008001);
|
|
return;
|
|
}
|
|
if ((sp36 & 0x4000) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
|
|
play_sound2(0x49008002);
|
|
return;
|
|
}
|
|
if ((sp36 & 0x300) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT;
|
|
play_sound2(0x49008000);
|
|
return;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
case CONTROLLER_PAK_MENU_GO_TO_ERASING:
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASING;
|
|
return;
|
|
case CONTROLLER_PAK_MENU_ERASING:
|
|
temp_t0 = *(&D_800E86C6 + gControllerPakSelectedTableRow) - 1;
|
|
temp_v1 = (temp_t0 << 5) + &D_8018E938;
|
|
sp20 = temp_v1;
|
|
sp2C = temp_t0;
|
|
temp_v0 = osPfsDeleteFile(&D_8018E868, temp_v1->unk8, temp_v1->unk4, temp_v1 + 0xE, temp_v1 + 0xA);
|
|
if (temp_v0 != 0) {
|
|
if (temp_v0 != PFS_ERR_NOPACK) {
|
|
if (temp_v0 != PFS_ERR_NEW_PACK) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED;
|
|
return;
|
|
}
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED;
|
|
return;
|
|
}
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK;
|
|
return;
|
|
}
|
|
*(&D_8018EB38 + (temp_t0 * 4)) = -1;
|
|
gControllerPakNumPagesFree = gControllerPakNumPagesFree + (((temp_v1->unk0 + 0xFF) >> 8) & 0xFF);
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
|
|
return;
|
|
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 ((sp36 & 0x9000) != 0) {
|
|
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
|
|
}
|
|
/* Duplicate return node #49. Try simplifying control flow for better match */
|
|
return;
|
|
}
|
|
} else {
|
|
default:
|
|
}
|
|
}
|
|
#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 */
|
|
? func_800B4670(); /* extern */
|
|
? func_800B4820(); /* extern */
|
|
? func_800B5404(s32, s32); /* extern */
|
|
? func_800B5948(); /* 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;
|
|
func_800B4670();
|
|
func_800B5948();
|
|
}
|
|
}
|
|
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;
|
|
func_800B4670();
|
|
}
|
|
}
|
|
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) {
|
|
func_800B4820();
|
|
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) {
|
|
func_800B4820();
|
|
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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern s16 D_800DC648;
|
|
extern ? D_800E86AB;
|
|
extern ? D_800E86AD;
|
|
extern ? D_800F2B70;
|
|
|
|
void func_800B28C8(void) {
|
|
s32 temp_a1;
|
|
s8 temp_a0;
|
|
s8 temp_v0;
|
|
s8 temp_v1;
|
|
|
|
temp_v1 = D_8018EDF3;
|
|
temp_a0 = *(&D_800E86AB + temp_v1);
|
|
temp_a1 = *(&D_800F2B70 + ((temp_v1 * 0xC) + (temp_a0 * 4)));
|
|
temp_v0 = *(&D_800E86AD + ((temp_v1 * 3) + temp_a0));
|
|
if (temp_a1 != 0) {
|
|
if (temp_a1 != 1) {
|
|
if (temp_a1 != 2) {
|
|
if (temp_a1 != 3) {
|
|
return;
|
|
}
|
|
D_800DC648 = 1;
|
|
gIsMirrorMode = 0;
|
|
return;
|
|
}
|
|
gCCSelection = temp_v0;
|
|
D_800DC648 = 1;
|
|
if (temp_v0 == CC_EXTRA) {
|
|
gIsMirrorMode = 1;
|
|
return;
|
|
}
|
|
gIsMirrorMode = 0;
|
|
return;
|
|
}
|
|
gCCSelection = CC_100;
|
|
gIsMirrorMode = 0;
|
|
D_800DC648 = 0;
|
|
if (temp_v0 != 0) {
|
|
|
|
}
|
|
return;
|
|
}
|
|
gCCSelection = temp_v0;
|
|
D_800DC648 = 1;
|
|
if (temp_v0 == CC_EXTRA) {
|
|
gIsMirrorMode = 1;
|
|
return;
|
|
}
|
|
gIsMirrorMode = 0;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B28C8.s")
|
|
#endif
|
|
|
|
#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 ? D_800E86AB; /* unable to generate initializer; const */
|
|
static ? D_800E86AC; /* unable to generate initializer; const */
|
|
static ? D_800E86AD; /* 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 ? D_800F2B70; /* 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 = &D_800F2B70 + ((temp_t5 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t7 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t4_2 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t1 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t6 * 0xC) + (*(&D_800E86AB + temp_t6) * 4));
|
|
} else {
|
|
phi_v1_3 = &D_800F2B70 + ((phi_v0 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t6_2 * 0xC) + (*(&D_800E86AB + temp_t6_2) * 4));
|
|
} else {
|
|
temp_v0_4 = D_8018EDF3;
|
|
temp_a0_3 = *(&D_800E86AB + temp_v0_4);
|
|
if ((phi_v1 & 0x8000) != 0) {
|
|
temp_v1_3 = *(&D_800F2B70 + ((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 = &D_800F2B70 + ((temp_t7_2 * 0xC) + (*(&D_800E86AB + temp_t7_2) * 4));
|
|
} else {
|
|
phi_v1_3 = &D_800F2B70 + ((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 = *(&D_800F2B70 + ((temp_v0_5 * 0xC) + (*(&D_800E86AB + 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) + *(&D_800E86AB + 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 = *(&D_800E86AB + 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 = *(&D_800E86AB + 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 = *(&D_800E86AB + temp_v0_9);
|
|
temp_a1 = *(&D_800E86AD + ((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 = &D_800F2B70 + ((temp_t5_2 * 0xC) + (*(&D_800E86AB + 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) && (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t7_4 * 0xC) + (*(&D_800E86AB + temp_t7_4) * 4));
|
|
} else {
|
|
phi_v1_3 = &D_800F2B70 + ((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 = *(&D_800F2B70 + ((temp_v0_11 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t7_6 * 0xC) + (*(&D_800E86AB + 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 = &D_800F2B70 + ((temp_t1_2 * 0xC) + (*(&D_800E86AB + temp_t1_2) * 4));
|
|
} else {
|
|
temp_t4_3 = D_8018EDF3;
|
|
phi_v1_3 = &D_800F2B70 + ((temp_t4_3 * 0xC) + (*(&D_800E86AB + temp_t4_3) * 4));
|
|
}
|
|
break;
|
|
case OPTIONS_SELECTION:
|
|
case DATA_SELECTION:
|
|
temp_t2 = D_8018EDF3;
|
|
phi_v1_3 = &D_800F2B70 + ((temp_t2 * 0xC) + (*(&D_800E86AB + temp_t2) * 4));
|
|
break;
|
|
default:
|
|
temp_t8 = D_8018EDF3;
|
|
phi_v1_3 = &D_800F2B70 + ((temp_t8 * 0xC) + (*(&D_800E86AB + 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) {
|
|
if (arg0 == gCharacterGridSelections[0]) {
|
|
return 0;
|
|
}
|
|
if (arg0 == D_8018EDE5) {
|
|
return 0;
|
|
}
|
|
if (arg0 == D_8018EDE6) {
|
|
return 0;
|
|
}
|
|
if (arg0 == D_8018EDE7) {
|
|
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 <= 0) {
|
|
D_8018EDF3 = 1;
|
|
}
|
|
phi_a3 = D_8018EDF3;
|
|
if (D_8018EDF3 >= 5) {
|
|
D_8018EDF3 = 4;
|
|
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 = 1;
|
|
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
|
|
? func_800CF774(? *, 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;
|
|
func_800CF774(&D_800F2BE8, D_80162DE0);
|
|
func_800CF774(&D_800F2BF8, (s32) *(&D_8018EE16 + (arg0 << 7)));
|
|
func_800CF774(&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();
|
|
osEepromLongWrite(&gSIEventMesgQueue, ((u32)courseTimeTrialRecordsPtr - (u32)&D_8018EB90) >> 3, (u8*) courseTimeTrialRecordsPtr, sizeof(CourseTimeTrialRecords));
|
|
}
|
|
|
|
void func_800B4670(void) {
|
|
D_8018ED16 = func_800B492C();
|
|
D_8018ED17 = func_800B49E4();
|
|
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);
|
|
func_800B4820();
|
|
func_800B5948();
|
|
}
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800B45E0(s32); // extern
|
|
s8 func_800B4874(s32, s32, s32, void *); // extern
|
|
extern u8 D_800F2E60;
|
|
extern ? D_8018EB90;
|
|
|
|
void func_800B4728(s32 arg0) {
|
|
void *sp18;
|
|
s32 temp_a2;
|
|
s32 temp_a2_2;
|
|
s32 temp_v0;
|
|
void *temp_a3;
|
|
u8 *phi_v1;
|
|
s32 phi_a2;
|
|
s32 phi_v0;
|
|
u8 *phi_v0_2;
|
|
s32 phi_a2_2;
|
|
|
|
temp_a3 = ((arg0 / 4) * 0x60) + ((arg0 % 4) * 0x18) + &D_8018EB90;
|
|
phi_a2 = 0;
|
|
phi_a2_2 = 0;
|
|
do {
|
|
phi_v1 = &D_800F2E60;
|
|
phi_v0 = 0;
|
|
loop_2:
|
|
temp_v0 = phi_v0 + 1;
|
|
*(temp_a3 + (phi_a2 * 3) + phi_v0) = *phi_v1;
|
|
phi_v1 += 1;
|
|
phi_v0 = temp_v0;
|
|
if (temp_v0 != 3) {
|
|
goto loop_2;
|
|
}
|
|
temp_a2 = phi_a2 + 1;
|
|
phi_a2 = temp_a2;
|
|
} while (temp_a2 < 5);
|
|
phi_v0_2 = &D_800F2E60;
|
|
do {
|
|
temp_a2_2 = phi_a2_2 + 1;
|
|
(temp_a3 + phi_a2_2)->unkF = *phi_v0_2;
|
|
phi_v0_2 += 1;
|
|
phi_a2_2 = temp_a2_2;
|
|
} while (temp_a2_2 != 3);
|
|
temp_a3->unk12 = 0;
|
|
sp18 = temp_a3;
|
|
temp_a3->unk17 = func_800B4874(arg0, 3, temp_a2_2, temp_a3);
|
|
func_800B45E0(arg0);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4728.s")
|
|
#endif
|
|
|
|
void func_800B4820(void) {
|
|
D_8018ED10[0] = 0;
|
|
D_8018ED11 = 0;
|
|
D_8018ED12 = 0;
|
|
D_8018ED13 = 0;
|
|
gSaveDataSoundMode = SOUND_STEREO;
|
|
gSoundMode = SOUND_STEREO;
|
|
func_800B44BC();
|
|
func_800B4670();
|
|
}
|
|
|
|
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 u8 D_8018ED10;
|
|
|
|
s32 func_800B492C(void) {
|
|
void *temp_a0;
|
|
|
|
temp_a0 = &D_8018ED10 + 1;
|
|
return ((D_8018ED10 + 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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern u8 D_8018ED16;
|
|
|
|
s32 func_800B49E4(void) {
|
|
return ((D_8018ED16 + 0x5A) % 0x100) & 0xFF;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B49E4.s")
|
|
#endif
|
|
|
|
void func_800B4A10(void) {
|
|
s32 temp_s0;
|
|
|
|
osEepromLongRead(&gSIEventMesgQueue, 0, (u8*) &D_8018EB90, 0x200); //0x200: sizeof(SaveData)?
|
|
temp_s0 = 0;
|
|
while (temp_s0 < 16) // 16: 4 cup records * 4 course records?
|
|
{
|
|
func_800B4A9C(temp_s0);
|
|
++temp_s0;
|
|
}
|
|
|
|
func_800B4CB4();
|
|
|
|
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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800B4820(); // extern
|
|
s32 func_800B492C(); // extern
|
|
s32 func_800B49E4(); // extern
|
|
? func_800B5948(); // extern
|
|
u8 func_800B59F4(); // extern
|
|
u8 func_800B5AAC(); // extern
|
|
s32 func_800B5AD8(); // extern
|
|
extern ? D_8018EB90;
|
|
extern u8 D_8018ED10;
|
|
extern u8 D_8018ED11;
|
|
extern u8 D_8018ED12;
|
|
extern u8 D_8018ED13;
|
|
extern u8 gSaveDataSoundMode;
|
|
extern u8 D_8018ED16;
|
|
extern u8 D_8018ED17;
|
|
extern u8 D_8018ED88;
|
|
extern u8 D_8018ED89;
|
|
extern u8 D_8018ED8A;
|
|
extern u8 D_8018ED8B;
|
|
extern u8 gSaveDataSoundModeBackup;
|
|
extern OSMesgQueue gSIEventMesgQueue;
|
|
|
|
void func_800B4CB4(void) {
|
|
if ((D_8018ED16 != func_800B492C()) || (D_8018ED17 != func_800B49E4())) {
|
|
func_800B4820();
|
|
if (func_800B5AD8() == 0) {
|
|
D_8018ED10 = D_8018ED88;
|
|
D_8018ED11 = D_8018ED89;
|
|
D_8018ED12 = D_8018ED8A;
|
|
D_8018ED13 = D_8018ED8B;
|
|
gSaveDataSoundMode = gSaveDataSoundModeBackup;
|
|
D_8018ED16 = func_800B59F4();
|
|
D_8018ED17 = func_800B5AAC();
|
|
osEepromLongWrite(&gSIEventMesgQueue, ((&D_8018ED10 - &D_8018EB90) >> 3) & 0xFF, &D_8018ED10, 8);
|
|
}
|
|
func_800B5948();
|
|
return;
|
|
}
|
|
if (func_800B5AD8() != 0) {
|
|
func_800B5948();
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4CB4.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
void func_800B4DCC(void *arg0, u32 arg1, s32 arg2) {
|
|
u32 temp_t8;
|
|
|
|
temp_t8 = arg1 >> 8;
|
|
arg0->unk0 = arg1;
|
|
arg0->unk1 = temp_t8;
|
|
arg0->unk2 = ((temp_t8 >> 8) & 0xF) + ((arg2 & 7) * 0x10);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4DCC.s")
|
|
#endif
|
|
|
|
#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
|
|
? func_800B4DCC(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);
|
|
}
|
|
}
|
|
func_800B4DCC(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 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800B45E0(s32); // extern
|
|
? func_800B4DCC(void *, u32, s32, s32); // extern
|
|
s32 func_800B4F2C(s32, ? *, ? *, s32); // extern
|
|
extern ? D_8018CA70;
|
|
extern ? D_8018CA74;
|
|
extern ? D_8018EB90;
|
|
extern s8 gCupSelection;
|
|
|
|
s32 func_800B5218(void) {
|
|
s32 sp38;
|
|
s32 sp28;
|
|
s32 sp24;
|
|
void *sp20;
|
|
? *sp18;
|
|
? *temp_a1;
|
|
s32 temp_a0;
|
|
s32 temp_v0;
|
|
s32 temp_v1;
|
|
u32 temp_a1_2;
|
|
void *temp_v0_2;
|
|
? *phi_a1;
|
|
? *phi_a2;
|
|
s32 phi_v0;
|
|
? *phi_a2_2;
|
|
s32 phi_a3;
|
|
s32 phi_v0_2;
|
|
s32 phi_a3_2;
|
|
|
|
sp38 = (gCupSelection * 4) + gCupCourseSelection;
|
|
sp28 = *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->unk20;
|
|
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->unk20;
|
|
phi_v0_2 = 0;
|
|
if (temp_a1_2 < (func_800B4F2C(temp_a0, temp_a1, phi_a2_2, phi_a3) & 0xFFFFF)) {
|
|
temp_v0_2 = ((sp38 / 4) * 0x60) + ((sp38 % 4) * 0x18) + &D_8018EB90;
|
|
sp20 = temp_v0_2;
|
|
sp24 = phi_a3;
|
|
func_800B4DCC(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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800B4670(); // extern
|
|
s32 func_800B54EC(s8, u8, s32); // extern
|
|
u8 func_800B5508(s8, u8, s32); // extern
|
|
? func_800B5948(); // extern
|
|
extern ? D_8018EB90;
|
|
extern s8 gCupSelection;
|
|
|
|
void func_800B536C(s32 arg0) {
|
|
u8 *sp1C;
|
|
s32 temp_a2;
|
|
s32 temp_v1;
|
|
u8 *temp_v0;
|
|
|
|
temp_a2 = arg0;
|
|
if (arg0 >= 0) {
|
|
temp_v0 = gCCSelection + 0x180 + &D_8018EB90;
|
|
arg0 = temp_a2;
|
|
sp1C = temp_v0;
|
|
temp_v1 = 3 - arg0;
|
|
if ((arg0 < 3) && (func_800B54EC(gCupSelection, *temp_v0, temp_a2) < temp_v1)) {
|
|
*sp1C = func_800B5508(gCupSelection, *sp1C, temp_v1);
|
|
func_800B4670();
|
|
func_800B5948();
|
|
}
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B536C.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800B4670(); // extern
|
|
s32 func_800B54EC(s32, u8, s32, void *); // extern
|
|
u8 func_800B5508(s32, u8, s32, void *); // extern
|
|
? func_800B5948(); // extern
|
|
extern ? D_8018EB90;
|
|
|
|
void func_800B5404(s32 arg0, s32 arg1) {
|
|
s32 sp30;
|
|
s32 sp20;
|
|
void *sp1C;
|
|
u8 *sp18;
|
|
s32 temp_a0;
|
|
s32 temp_a2;
|
|
s32 temp_v1;
|
|
u8 *temp_v1_2;
|
|
void *temp_a3;
|
|
|
|
temp_a2 = arg0;
|
|
if (arg0 >= 0) {
|
|
temp_a0 = arg1 / 4;
|
|
temp_a3 = (arg1 % 4) + &D_8018EB90;
|
|
sp1C = temp_a3;
|
|
sp20 = temp_a0;
|
|
arg0 = temp_a2;
|
|
if (arg0 < 3) {
|
|
temp_v1 = 3 - arg0;
|
|
sp30 = temp_v1;
|
|
if (func_800B54EC(temp_a0, temp_a3->unk180, temp_a2, temp_a3) < temp_v1) {
|
|
temp_v1_2 = temp_a3 + 0x180;
|
|
sp18 = temp_v1_2;
|
|
*temp_v1_2 = func_800B5508(temp_a0, *temp_v1_2, sp30, temp_a3);
|
|
func_800B4670();
|
|
func_800B5948();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5404.s")
|
|
#endif
|
|
|
|
u8 func_800B54EC(s32, s32);
|
|
u8 func_800B5508(s32, s32, s32);
|
|
|
|
// 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[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[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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern ? D_8018ED4E;
|
|
|
|
s32 func_800B5888(s32 arg0) {
|
|
return ((*(&D_8018ED4E + (arg0 * 0x38)) + 0x5A) % 0x100) & 0xFF;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5888.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s32 func_800B578C(s32, s32); // extern
|
|
s32 func_800B5888(s32); // extern
|
|
extern ? D_8018EB90;
|
|
|
|
? func_800B58C4(s32 arg0) {
|
|
s32 sp1C;
|
|
void *sp18;
|
|
s32 temp_a0;
|
|
void *temp_v1;
|
|
|
|
temp_a0 = arg0 / 8;
|
|
sp1C = temp_a0;
|
|
temp_v1 = (temp_a0 * 0x38) + 0x188 + &D_8018EB90;
|
|
if ((temp_v1->unk36 != func_800B578C(temp_a0, arg0)) || (sp18 = temp_v1, (temp_v1->unk37 != func_800B5888(temp_a0)))) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B58C4.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s8 func_800B59F4(); // extern
|
|
s8 func_800B5AAC(); // extern
|
|
extern ? D_8018EB90;
|
|
extern u8 D_8018ED10;
|
|
extern u8 D_8018ED11;
|
|
extern u8 D_8018ED12;
|
|
extern u8 D_8018ED13;
|
|
extern u8 gSaveDataSoundMode;
|
|
extern u8 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 func_800B5948(void) {
|
|
D_8018ED88 = D_8018ED10;
|
|
D_8018ED89 = D_8018ED11;
|
|
D_8018ED8A = D_8018ED12;
|
|
D_8018ED8B = D_8018ED13;
|
|
gSaveDataSoundModeBackup = gSaveDataSoundMode;
|
|
D_8018ED8E = func_800B59F4();
|
|
D_8018ED8F = func_800B5AAC();
|
|
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 u8 D_8018ED88;
|
|
|
|
s32 func_800B59F4(void) {
|
|
void *temp_a0;
|
|
|
|
temp_a0 = &D_8018ED88 + 1;
|
|
return ((D_8018ED88 + 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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern u8 D_8018ED8E;
|
|
|
|
s32 func_800B5AAC(void) {
|
|
return ((D_8018ED8E + 0x5A) % 0x100) & 0xFF;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5AAC.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s32 func_800B59F4(); // extern
|
|
s32 func_800B5AAC(); // extern
|
|
extern u8 D_8018ED8E;
|
|
extern u8 D_8018ED8F;
|
|
|
|
? func_800B5AD8(void) {
|
|
if ((D_8018ED8E != func_800B59F4()) || (D_8018ED8F != func_800B5AAC())) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5AD8.s")
|
|
#endif
|
|
|
|
s32 func_800B5B2C(s32 arg0) {
|
|
u8 sp1F;
|
|
s32 phi_v0;
|
|
|
|
if ((arg0 >= 4) || (arg0 < 0)) {
|
|
return 0;
|
|
}
|
|
|
|
osPfsIsPlug(&gSIEventMesgQueue, &sp1F);
|
|
|
|
if ((sp1F & (1 << arg0)) != 0) {
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s32 func_800B5B2C(?); // extern
|
|
s32 func_800CE720(? *, 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 (func_800B5B2C(0) == 0) {
|
|
return 1;
|
|
}
|
|
temp_v0_3 = func_800CE720(&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 func_800B5B2C(?); // extern
|
|
s32 func_800CE720(? *, 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 (func_800B5B2C(1) == 0) {
|
|
return 1;
|
|
}
|
|
temp_v0_3 = func_800CE720(&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 (func_800B5B2C(0) != 0) {
|
|
sp1C = func_800CE720(&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 (func_800B5B2C(1) != 0) {
|
|
temp_v0 = func_800CE720(&gSIEventMesgQueue, &D_8018E8D0, 1);
|
|
if (temp_v0 == 0) {
|
|
D_800E86FC = 1;
|
|
}
|
|
return temp_v0;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s8 func_800B6828(); // extern
|
|
extern OSPfs D_8018E868;
|
|
extern s32 D_8018EB84;
|
|
extern ? D_8018EE10;
|
|
|
|
void func_800B6088(s32 arg0) {
|
|
s32 temp_t6;
|
|
u8 *temp_v1;
|
|
|
|
temp_t6 = arg0 << 7;
|
|
temp_v1 = temp_t6 + &D_8018EE10;
|
|
temp_v1->unk7F = func_800B6828();
|
|
osPfsReadWriteFile(&D_8018E868, D_8018EB84, 1, temp_t6, 0x80, temp_v1);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6088.s")
|
|
#endif
|
|
|
|
#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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern ? D_8018EE10;
|
|
|
|
? func_800B6348(s32 arg0) {
|
|
if ((D_8018EE10.unk4 != 0) && (arg0 == D_8018EE10.unk5)) {
|
|
return 0;
|
|
}
|
|
if ((D_8018EE10.unk84 != 0) && (arg0 == D_8018EE10.unk85)) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6348.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
extern ? D_8018EE10;
|
|
|
|
? func_800B639C(s32 arg0) {
|
|
if ((D_8018EE10.unk4 != 0) && (arg0 == D_8018EE10.unk5)) {
|
|
return 0;
|
|
}
|
|
if ((D_8018EE10.unk84 != 0) && (arg0 == D_8018EE10.unk85)) {
|
|
return 1;
|
|
}
|
|
return -1;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B639C.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_800051C4(); // extern
|
|
? func_80005AE8(Player *); // extern
|
|
s32 func_800B60E8(s32); // extern
|
|
extern s16 D_80162DD6;
|
|
extern s32 D_80162DFC;
|
|
extern ? D_8018EE10;
|
|
extern s8 gCupSelection;
|
|
|
|
? func_800B63F0(s32 arg0) {
|
|
s32 temp_s0;
|
|
void *temp_v0;
|
|
s32 phi_s0;
|
|
void *phi_s1;
|
|
? phi_s3;
|
|
|
|
func_800051C4();
|
|
D_80162DD6 = 1;
|
|
func_80005AE8(gPlayerThree);
|
|
temp_v0 = (arg0 << 7) + &D_8018EE10;
|
|
phi_s3 = 0;
|
|
if (((gCupSelection * 4) + gCupCourseSelection) != temp_v0->unk5) {
|
|
phi_s3 = 2;
|
|
} else if (D_80162DFC != temp_v0->unk0) {
|
|
phi_s3 = 3;
|
|
} else {
|
|
phi_s0 = 0;
|
|
phi_s1 = temp_v0;
|
|
if (D_80162DE0 != temp_v0->unk6) {
|
|
phi_s3 = 4;
|
|
} else {
|
|
loop_6:
|
|
temp_s0 = phi_s0 + 1;
|
|
phi_s0 = temp_s0;
|
|
if (phi_s1->unk7 != func_800B60E8(phi_s0)) {
|
|
phi_s3 = 1;
|
|
} else {
|
|
phi_s1 += 1;
|
|
if (temp_s0 != 0x3C) {
|
|
goto loop_6;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return phi_s3;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B63F0.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
? func_8000522C(); // extern
|
|
s32 func_800B60E8(s32); // extern
|
|
extern u8 *D_800DC714;
|
|
extern s32 D_80162DFC;
|
|
extern OSPfs D_8018E868;
|
|
extern s32 D_8018EB84;
|
|
extern ? D_8018EE10;
|
|
|
|
s32 func_800B64EC(s32 arg0) {
|
|
s32 sp30;
|
|
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_8018E868, D_8018EB84, 0, (arg0 * 0x3C00) + 0x100, 0x3C00, D_800DC714);
|
|
sp30 = temp_v0;
|
|
if (temp_v0 == 0) {
|
|
temp_s3 = (arg0 << 7) + &D_8018EE10;
|
|
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) {
|
|
func_8000522C();
|
|
*D_80162DD4 = 0;
|
|
D_80162DE0 = temp_s3->unk6;
|
|
D_80162DFC = temp_s3->unk0;
|
|
goto block_9;
|
|
}
|
|
goto loop_5;
|
|
}
|
|
block_9:
|
|
return sp30;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B64EC.s")
|
|
#endif
|
|
|
|
#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
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s32 func_800B6828(s32); // extern
|
|
extern OSPfs D_8018E868;
|
|
extern s32 D_8018EB84;
|
|
extern u8 D_8018EE10;
|
|
|
|
void func_800B6708(void) {
|
|
s32 temp_s0;
|
|
s32 phi_s0;
|
|
u8 *phi_s1;
|
|
|
|
osPfsReadWriteFile(&D_8018E868, D_8018EB84, 0, 0, 0x100, &D_8018EE10);
|
|
phi_s0 = 0;
|
|
phi_s1 = &D_8018EE10;
|
|
do {
|
|
temp_s0 = phi_s0 + 1;
|
|
phi_s0 = temp_s0;
|
|
if (phi_s1->unk7F != func_800B6828(phi_s0)) {
|
|
phi_s1->unk4 = 0;
|
|
}
|
|
phi_s1 += 0x80;
|
|
} while (temp_s0 != 2);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6708.s")
|
|
#endif
|
|
|
|
#ifdef MIPS_TO_C
|
|
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
|
s32 func_800B68F4(s32); // extern
|
|
extern u8 *D_8018D9C0;
|
|
extern OSPfs D_8018E8D0;
|
|
extern s32 D_8018EB88;
|
|
|
|
void func_800B6798(void) {
|
|
s32 temp_s0;
|
|
u8 *temp_s2;
|
|
void *temp_v1;
|
|
s32 phi_s0;
|
|
|
|
temp_s2 = D_8018D9C0;
|
|
osPfsReadWriteFile(&D_8018E8D0, D_8018EB88, 0, 0, 0x100, temp_s2);
|
|
phi_s0 = 0;
|
|
do {
|
|
temp_v1 = temp_s2 + (phi_s0 << 7);
|
|
temp_s0 = phi_s0 + 1;
|
|
phi_s0 = temp_s0;
|
|
if (temp_v1->unk7F != func_800B68F4(phi_s0)) {
|
|
temp_v1->unk4 = 0;
|
|
}
|
|
} while (temp_s0 != 2);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B6798.s")
|
|
#endif
|
|
|
|
#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) {
|
|
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 func_800B5B2C(?); /* extern */
|
|
? func_800B6A68(); /* extern */
|
|
s32 func_800CE720(? *, ? *, ?); /* 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 ((func_800B5B2C(0) != 0) && (func_800CE720(&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
|