diff options
Diffstat (limited to 'src/code_800B45E0.c')
| -rw-r--r-- | src/code_800B45E0.c | 162 |
1 files changed, 54 insertions, 108 deletions
diff --git a/src/code_800B45E0.c b/src/code_800B45E0.c index d238f18db..acb30d57c 100644 --- a/src/code_800B45E0.c +++ b/src/code_800B45E0.c @@ -840,95 +840,52 @@ u8 func_800B60E8(s32 arg0) GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B60E8.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 s32 func_800B6178(s32 arg0) { - s32 temp_v0; - s32 var_s0_2; s32 var_v0; - s32 var_v1; - s8 temp_t0; - s8 temp_t1; - s8 temp_t3; - s8 temp_t4; - s8 temp_t5; - s8 temp_t9; - s8 var_s0; - s8 var_s0_3; + s32 var_s0; struct_8018EE10_entry *temp_s3; - struct_8018EE10_entry *var_s1; - struct_8018EE10_entry *var_s1_2; - struct_8018EE10_entry *var_s1_3; - u8 temp_v0_2; - if ((arg0 != 0) && (arg0 != 1)) { - return -1; + switch (arg0) { + case 0: + case 1: + break; + default: + return -1; } if (gGamestate == 4) { func_800051C4(); } temp_s3 = &D_8018EE10[arg0]; temp_s3->ghostDataSaved = 0; - temp_v0 = func_800B6088(arg0); - var_v1 = temp_v0; - if (temp_v0 != 0) { + var_v0 = func_800B6088(arg0); + if (var_v0 != 0) { temp_s3->ghostDataSaved = 0; - var_s0 = 0; - var_s1 = temp_s3; - do { - temp_t9 = var_s0 + 1; - temp_t0 = var_s0 + 2; - temp_t1 = var_s0 + 3; - var_s1->unk_07[0] = var_s0; - var_s0 += 4; - var_s1->unk_07[3] = temp_t1; - var_s1->unk_07[2] = temp_t0; - var_s1->unk_07[1] = temp_t9; - var_s1 += 4; - } while (var_s0 != 0x3C); + for (var_s0 = 0; var_s0 < 0x3C; var_s0++) { + temp_s3->unk_07[var_s0] = var_s0; + } } else { var_v0 = osPfsReadWriteFile(&gControllerPak1FileHandle, gControllerPak1FileNote, 1U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714); - var_v1 = var_v0; if (var_v0 == 0) { temp_s3->ghostDataSaved = 1; if (gGamestate == 4) { temp_s3->courseIndex = (gCupSelection * 4) + gCupCourseSelection; } - var_s0_2 = 0; temp_s3->unk_00 = D_80162DFC; - var_s1_2 = temp_s3; temp_s3->characterId = (u8) D_80162DE0; - do { - temp_v0_2 = func_800B60E8(var_s0_2); - var_s0_2 += 1; - var_s1_2 += 1; - var_s1_2->characterId = temp_v0_2; - } while (var_s0_2 != 0x0000003C); + for (var_s0 = 0; var_s0 < 0x3C; var_s0++) { + temp_s3->unk_07[var_s0] = func_800B60E8(var_s0); + } var_v0 = func_800B6088(arg0); - var_v1 = var_v0; } if (var_v0 != 0) { temp_s3->ghostDataSaved = 0; - var_s0_3 = 0; - var_s1_3 = temp_s3; - do { - temp_t3 = var_s0_3 + 1; - temp_t4 = var_s0_3 + 2; - temp_t5 = var_s0_3 + 3; - var_s1_3->unk_07[0] = var_s0_3; - var_s0_3 += 4; - var_s1_3->unk_07[3] = temp_t5; - var_s1_3->unk_07[2] = temp_t4; - var_s1_3->unk_07[1] = temp_t3; - var_s1_3 += 4; - } while (var_s0_3 != 0x3C); + for (var_s0 = 0; var_s0 < 0x3C; var_s0++) { + temp_s3->unk_07[var_s0] = var_s0; + } } } - return var_v1; + return var_v0; } -#else -GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6178.s") -#endif s32 func_800B6348(s32 arg0) { if ((D_8018EE10[0].ghostDataSaved != 0) && (arg0 == D_8018EE10[0].courseIndex)) { @@ -1022,43 +979,36 @@ s32 func_800B64EC(s32 arg0) { return temp_v0; } -#ifdef MIPS_TO_C -//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-11-2022 +#ifdef NON_MATCHING +// Matching decomp courstesy of Vetri, leaving it as this becasue I'm lazy +// https://decomp.me/scratch/qrC3l s32 func_800B65F4(s32 arg0, s32 arg1) { - s32 sp34; - s32 temp_v0; + s32 stackPadding; s32 var_s0; + s32 temp_v0; struct_8018EE10_entry *temp_s3; - struct_8018EE10_entry *var_s1; - u8 temp_v0_2; - if ((arg0 != 0) && (arg0 != 1)) { - return -1; + switch (arg0) { + case 0: + case 1: + break; + default: + return -1; } temp_v0 = osPfsReadWriteFile(&gControllerPak2FileHandle, gControllerPak2FileNote, 0U, (arg0 * 0x3C00) + 0x100, 0x00003C00, (u8 *) D_800DC714); - sp34 = temp_v0; if (temp_v0 == 0) { temp_s3 = &D_8018D9C0[arg0]; - var_s1 = temp_s3; - var_s0 = 0; -loop_5: - temp_v0_2 = func_800B60E8(var_s0); - var_s0 += 1; - if ((u8) var_s1->unk_07[0] != temp_v0_2) { - temp_s3->ghostDataSaved = 0; - return -2; - } - var_s1 += 1; - if (var_s0 == 0x0000003C) { - D_80162DE0 = (s32) temp_s3->characterId; - D_80162DFC = temp_s3->unk_00; - *(&D_8018EE10->courseIndex + (arg1 << 7)) = temp_s3->courseIndex; - goto block_9; + for (var_s0 = 0; var_s0 < 0x3C; var_s0++) { + if (temp_s3->unk_07[var_s0] != func_800B60E8(var_s0)) { + temp_s3->ghostDataSaved = 0; + return -2; + } } - goto loop_5; + D_80162DE0 = temp_s3->characterId; + D_80162DFC = temp_s3->unk_00; + D_8018EE10[arg1].courseIndex = temp_s3->courseIndex; } -block_9: - return sp34; + return temp_v0; } #else GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B65F4.s") @@ -1095,7 +1045,7 @@ void func_800B6798(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de +//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-08-2023 u8 func_800B6828(s32 arg0) { s32 temp_a2; s32 temp_lo; @@ -1130,30 +1080,26 @@ GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6828.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s32 D_8018D9C0; - -s32 func_800B68F4(s32 arg0) { +//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-08-2023 +u8 func_800B68F4(s32 arg0) { s32 temp_a1; - s32 temp_a2; s32 temp_a3; + s32 var_a1; + s32 var_a2; + struct_8018EE10_entry *temp_v1; 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; + temp_v1 = &D_8018D9C0[arg0]; + var_a2 = 3; + var_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; + temp_v0 = temp_v1 + var_a2; + temp_a1 = var_a1 + ((temp_v0->unk0 * temp_a3) + var_a2) + ((temp_v0->unk1 * temp_a3) + var_a2) + 1 + ((temp_v0->unk2 * temp_a3) + var_a2) + 2 + ((temp_v0->unk3 * temp_a3) + var_a2); + var_a2 += 4; + var_a1 = temp_a1 + 3; + } while (var_a2 != 0x43); + return var_a1 & 0xFF; } #else GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B68F4.s") |
