summaryrefslogtreecommitdiff
path: root/src/code_800AF9B0.c
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2021-11-23 04:47:54 -0500
committerGitHub <noreply@github.com>2021-11-23 01:47:54 -0800
commita2dc62ccf8856863da8d0f2f95a8b75986f63c3a (patch)
tree0f9bb2b0ae2f783fd81dc07d6f29729c7afa2e97 /src/code_800AF9B0.c
parentbed14f61c389675e11f5364b5c00c9a73f043106 (diff)
Jump Table Related Disassembly (#60)
* Part 1, Commit 1 of 24 audio/effects Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 2 of 24 audio/external Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 3 of 24 audio/heap Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 4 of 24 audio/port_eu Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 5 of 24 audio/seqplayer Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 6 of 24 code_80005FD0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 7 of 24 code_8001C4D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 8 of 24 code_80027D00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 9 of 24 code_800393C0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 10 of 24 code_8003DC40 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 11 of 24 code_800431B0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 12 of 24 code_80057C60 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 13 of 24 code_8006E9C0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 14 of 24 code_80071F00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 15 of 24 code_80086E70 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 16 of 24 code_8008C1D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 17 of 24 code_80091750 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 18 of 24 code_800AF9B0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 19 of 24 code_8028DF00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 20 of 24 code_80290C20 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 21 of 24 code_802B0210 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 22 of 24 code_actors Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 23 of 24 memory Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 24 of 24 os/__osException Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 1 of 20 audio/effects.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 2 of 20 audio/external.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 3 of 24 audio/heap.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 4 of 20 audio/port_eu.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 5 of 20 audio/seqplayer.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 6 of 20 code_80005FD0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 7 of 20 code_8001C4D0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 8 of 20 code_80027D00.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 9 of 20 code_8003DC40.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 10 of 20 code_800431B0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 11 of 20 code_80057C60.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 12 of 20 code_8006E9C0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 13 of 20 code_80071F00.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 14 of 20 code_80086E70.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 15 of 20 code_80091750.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 16 of 20 code_800AF9B0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 17 of 20 code_80290C20.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 18 of 20 code_802B0210.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 19 of 20 code_80296A50.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 20 of 20 memory.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 1 of 4 code_8008C1D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 2 of 4 code_8028DF00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 3 of 4 math_util Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 4 of 4 crash_screen Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Recreated disassemblies with a context file Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src/code_800AF9B0.c')
-rw-r--r--src/code_800AF9B0.c1730
1 files changed, 1684 insertions, 46 deletions
diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c
index 7a7744265..81192d352 100644
--- a/src/code_800AF9B0.c
+++ b/src/code_800AF9B0.c
@@ -391,29 +391,659 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0004.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B0350:
-
-Unable to determine jump table for jr instruction at func_800B0350.s line 63.
+//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;
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ if (D_800E86A4 == 0) {
+ phi_s0 = 0;
+ do {
+ if ((func_800B4520() == 0) && (gEnableDebugMode != 0) && ((gControllers[phi_s0].buttonPressed & 0x1000) != 0)) {
+ temp_v0 = D_800E86A0;
+ if ((temp_v0 != 0xB) && (temp_v0 != 0xC)) {
+ if (temp_v0 == 0xD) {
+ func_800CA330(0x19);
+ goto block_9;
+ }
+ } else {
+block_9:
+ play_sound2(0x49008016);
+ }
+ if ((D_800E86A0 != 9) && (D_800E86A0 != 0xA)) {
+ func_8009E1C0();
+ }
+ }
+ osViSetSpecialFeatures(D_800E86E4);
+ temp_t2 = D_800E86A0;
+ switch (temp_t2) {
+ case 5:
+ func_800B053C(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 6:
+ func_800B13B0(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 7:
+ func_800B15AC(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 8:
+ func_800B1C40(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 9:
+ if (phi_s0 == 0) {
+ func_800B1C90(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ }
+ break;
+ case 0:
+ case 10:
+ func_800B20F4(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 1:
+ case 11:
+ func_800B29D8(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 2:
+ case 12:
+ func_800B3554(&gControllers[phi_s0], phi_s0 & 0xFFFF);
+ break;
+ case 3:
+ case 13:
+ 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 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B053C:
-
-Unable to determine jump table for jr instruction at func_800B053C.s line 42.
+//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;
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ 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) {
+ temp_v0_2 = D_8018EDF2;
+ if (temp_t0->unk4 != temp_v0_2) {
+ D_8018ED14 = temp_v0_2;
+ sp20 = phi_a1;
+ sp38 = temp_t0;
+ func_800B4670();
+ func_800B5948();
+ temp_t0->unk4 = D_8018EDF2;
+ phi_t1 = &D_8018EDEC;
+ }
+ }
+ if ((phi_a1 & 0x4000) != 0) {
+ sp38 = temp_t0;
+ func_8009E280();
+ play_sound2(0x49008002);
+ temp_v0_3 = D_8018EDF2;
+ if (temp_t0->unk4 != temp_v0_3) {
+ D_8018ED14 = temp_v0_3;
+ sp38 = temp_t0;
+ func_800B4670();
+ func_800B5948();
+ temp_t0->unk4 = D_8018EDF2;
+ 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;
+ }
+ temp_v0_7 = D_8018EDF2;
+ if (temp_v0_7 < 3) {
+ D_8018EDF2 = temp_v0_7 + 1;
+ } else {
+ D_8018EDF2 = 0;
+ }
+ if (D_8018EDF2 == 2) {
+ D_8018EDF2 = 3;
+ }
+ func_800B44BC();
+ temp_v0_8 = D_8018EDF2;
+ if (temp_v0_8 != 0) {
+ if (temp_v0_8 != 1) {
+ if (temp_v0_8 != 3) {
+ return;
+ }
+ play_sound2(0x49008029);
+ return;
+ }
+ play_sound2(0x49008025);
+ return;
+ }
+ play_sound2(0x49008024);
+ 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
@@ -798,29 +1428,470 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B1C40.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B1C90:
-
-Unable to determine jump table for jr instruction at func_800B1C90.s line 22.
+//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;
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ sp36 = arg0->unk6 | arg0->unkC;
+ if (func_800B4520() == 0) {
+ temp_t9 = gPlayerCountSelection2;
+ switch (temp_t9) {
+ case 1:
+ if ((sp36 & 0x9000) != 0) {
+ gPlayerCountSelection2 = 5;
+ play_sound2(0x49008001);
+ return;
+ }
+ if ((sp36 & 0x300) != 0) {
+ gPlayerCountSelection2 = 2;
+ play_sound2(0x49008000);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ case 2:
+ if ((sp36 & 0x9000) != 0) {
+ play_sound2(0x49008001);
+ func_8009E1C0();
+ D_800E86F8 = 0;
+ return;
+ }
+ if ((sp36 & 0x300) != 0) {
+ gPlayerCountSelection2 = 1;
+ play_sound2(0x49008000);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ case 5:
+ if ((sp36 & 0x9000) != 0) {
+ if (*(&D_8018EB38 + ((*(&D_800E86C6 + D_800E86C0) - 1) * 4)) == 0) {
+ gPlayerCountSelection2 = 4;
+ play_sound2(0x49008001);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ }
+ if ((sp36 & 0x4000) != 0) {
+ if (*D_800E86D0 == 0) {
+ gPlayerCountSelection2 = 1;
+ play_sound2(0x49008002);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ }
+ if ((sp36 & 0x800) != 0) {
+ if (*D_800E86D0 == 0) {
+ D_800E86C0 += -1;
+ if (D_800E86C0 < 0) {
+ D_800E86C0 = 0;
+ if (*(&D_800E86C6 + D_800E86C0) != 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)) {
+ D_800E86C0 += 1;
+ if (D_800E86C0 >= 5) {
+ D_800E86C0 = 4;
+ if (*(&D_800E86C6 + D_800E86C0) != 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 4:
+ if ((sp36 & 0xD000) != 0) {
+ gPlayerCountSelection2 = 5;
+ play_sound2(0x49008002);
+ return;
+ }
+ if ((sp36 & 0x300) != 0) {
+ gPlayerCountSelection2 = 3;
+ play_sound2(0x49008000);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ case 3:
+ if ((sp36 & 0x9000) != 0) {
+ gPlayerCountSelection2 = 6;
+ play_sound2(0x49008001);
+ return;
+ }
+ if ((sp36 & 0x4000) != 0) {
+ gPlayerCountSelection2 = 5;
+ play_sound2(0x49008002);
+ return;
+ }
+ if ((sp36 & 0x300) != 0) {
+ gPlayerCountSelection2 = 4;
+ play_sound2(0x49008000);
+ return;
+ }
+ /* Duplicate return node #49. Try simplifying control flow for better match */
+ return;
+ case 6:
+ gPlayerCountSelection2 = 7;
+ return;
+ case 7:
+ temp_t0 = *(&D_800E86C6 + D_800E86C0) - 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 != 1) {
+ if (temp_v0 != 2) {
+ gPlayerCountSelection2 = 8;
+ return;
+ }
+ gPlayerCountSelection2 = 0xA;
+ return;
+ }
+ gPlayerCountSelection2 = 9;
+ return;
+ }
+ *(&D_8018EB38 + (temp_t0 * 4)) = -1;
+ D_8018EB80 = D_8018EB80 + (((temp_v1->unk0 + 0xFF) >> 8) & 0xFF);
+ gPlayerCountSelection2 = 5;
+ return;
+ case 8:
+ case 9:
+ case 10:
+ if ((sp36 & 0x9000) != 0) {
+ gPlayerCountSelection2 = 5;
+ }
+ /* 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 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B20F4:
-
-Unable to determine jump table for jr instruction at func_800B20F4.s line 34.
+//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;
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ sp28 = 1;
+ sp2E = arg0->unk6 | arg0->unkC;
+ if (func_800B4520() == 0) {
+ if ((arg1 & 0xFFFF) == 0) {
+ D_8018EE04 += 1;
+ }
+ temp_t2 = D_8018EDEF;
+ switch (temp_t2) {
+ case 1:
+ sp28 = 0;
+ if ((D_8018EE04 >= 0x2E) && ((sp2E & 0x9000) != 0)) {
+ func_8009E1C0();
+ func_800CA330(0x19);
+ play_sound2(0x4900801A);
+ }
+ break;
+ case 2:
+ if ((sp2E & 0x300) != 0) {
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ if (gEnableDebugMode != 0) {
+ gEnableDebugMode = 0;
+ } else {
+ gEnableDebugMode = 1;
+ }
+ }
+ if ((sp2E & 0x400) != 0) {
+ play_sound2(0x49008000);
+ D_8018EDEF = 3;
+ }
+ break;
+ case 3:
+ 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);
+ D_8018EDEF = 2;
+ }
+ if ((sp2E & 0x400) != 0) {
+ play_sound2(0x49008000);
+ D_8018EDEF = 4;
+ }
+ break;
+ case 4:
+ 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);
+ D_800DC530 = *(&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);
+ D_800DC530 = *(&D_800F2B50 + D_8018EDF1);
+ }
+ }
+ if ((sp2E & 0x800) != 0) {
+ D_8018EDEF = 3;
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ }
+ if ((sp2E & 0x400) != 0) {
+ D_8018EDEF = 5;
+ play_sound2(0x49008000);
+ }
+ break;
+ case 5:
+ if ((sp2E & 0x100) != 0) {
+ temp_v0_5 = D_800E86A8;
+ if (temp_v0_5 < 7) {
+ D_800E86A8 = temp_v0_5 + 1;
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ }
+ }
+ if ((sp2E & 0x200) != 0) {
+ temp_v0_6 = D_800E86A8;
+ if (temp_v0_6 > 0) {
+ D_800E86A8 = temp_v0_6 - 1;
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ }
+ }
+ if ((sp2E & 0x800) != 0) {
+ D_8018EDEF = 4;
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ }
+ if ((sp2E & 0x400) != 0) {
+ D_8018EDEF = 6;
+ play_sound2(0x49008000);
+ }
+ break;
+ case 6:
+ if ((sp2E & 0x100) != 0) {
+ temp_v0_7 = D_8018EDF2;
+ temp_t2_2 = temp_v0_7 + 1;
+ if (temp_v0_7 < 3) {
+ D_8018EDF2 = temp_t2_2;
+ if ((temp_t2_2 & 0xFF) == 2) {
+ D_8018EDF2 = 3;
+ }
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ func_800B44BC();
+ D_8018ED14 = D_8018EDF2;
+ func_800B4670();
+ func_800B5948();
+ }
+ }
+ if ((sp2E & 0x200) != 0) {
+ temp_v0_8 = D_8018EDF2;
+ temp_t7 = temp_v0_8 - 1;
+ if (temp_v0_8 > 0) {
+ D_8018EDF2 = temp_t7;
+ if ((temp_t7 & 0xFF) == 2) {
+ D_8018EDF2 = 1;
+ }
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ func_800B44BC();
+ D_8018ED14 = D_8018EDF2;
+ func_800B4670();
+ }
+ }
+ if ((sp2E & 0x800) != 0) {
+ D_8018EDEF = 5;
+ sp24 = sp2E;
+ play_sound2(0x49008000);
+ }
+ if ((sp2E & 0x400) != 0) {
+ D_8018EDEF = 7;
+ play_sound2(0x49008000);
+ }
+ break;
+ case 7:
+ if ((sp2E & 0x800) != 0) {
+ D_8018EDEF = 6;
+ 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) {
+ sp24 = sp2E;
+ func_8009E1C0();
+ func_800CA330(0x19);
+ D_8018EDEF = 0x40;
+ if ((arg0->unk4 & 0x20) != 0) {
+ D_800DC51C = 1;
+ } else {
+ D_800DC51C = 0;
+ }
+ if ((arg0->unk4 & 0x2000) != 0) {
+ if ((sp2E & 0x8000) != 0) {
+ D_8018EDFA = 1;
+ } else {
+ D_8018EDFA = 3;
+ }
+ }
+ play_sound2(0x49008016);
+ return;
+ }
+ if (((sp2E & 0x4000) != 0) && ((arg0->unk4 & 0x2000) != 0)) {
+ func_8009E1C0();
+ func_800CA330(0x19);
+ D_8018EDEF = 0x40;
+ D_8018EDFA = 2;
+ play_sound2(0x49008016);
+ return;
+ }
+ if ((sp2E & 0x10) != 0) {
+ D_8018EDEF = 1;
+ 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
@@ -882,15 +1953,358 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B28C8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B29D8:
+//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 = D_8018EDED;
+ switch (temp_t4) {
+ case 0:
+ temp_t5 = D_8018EDF3;
+ phi_v1_3 = &D_800F2B70 + ((temp_t5 * 0xC) + (*(&D_800E86AB + temp_t5) * 4));
+ break;
+ case 3:
+ 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 = &D_8018EDED;
+ 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 = &D_8018EDED;
+ }
+ gPlayerCountSelection1 = phi_v0;
+ phi_a0 = &gPlayerCountSelection1;
+ if (phi_v0 != 1) {
+ phi_a0 = 3;
+ if (phi_v0 != 2) {
+ if ((phi_v0 != 3) && (phi_v0 != 4)) {
-Unable to determine jump table for jr instruction at func_800B29D8.s line 39.
+ } else {
+ D_800DC530 = 3;
+ }
+ } else {
+ D_800DC530 = 1;
+ }
+ } else {
+ D_800DC530 = 0;
+ }
+ 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 = 4;
+ 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 = 1;
+ 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 = 2;
+ 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 4:
+ 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 = &D_8018EDED;
+ 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 = &D_8018EDED;
+ }
+ }
+ if ((phi_v1 & 0x4000) != 0) {
+ *phi_t0_2 = 3;
+ 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 = 6;
+ } else {
+ *phi_t0_2 = 6;
+ play_sound2(0x4900900D);
+ }
+ } else {
+ *phi_t0_2 = 5;
+ play_sound2(0x4900900C);
+ }
+ } else {
+ *phi_t0_2 = 5;
+ play_sound2(0x4900900B);
+ }
+ } else {
+ *phi_t0_2 = 5;
+ play_sound2(0x4900900A);
+ }
+ func_800B44AC();
+ temp_t7_2 = D_8018EDF3;
+ D_8018EE00 = 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 5:
+ case 8:
+ if ((arg1 == 0) && ((temp_t7_3 = D_8018EE00 + 1, D_8018EE00 = 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) {
+ D_8018EDED = 4;
+ 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 {
+ D_8018EDED = 6;
+ play_sound2(0x49008001, temp_a1);
+ D_8018EE00 = 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 6:
+ case 7:
+ if ((arg1 == 0) && ((temp_t7_5 = D_8018EE00 + 1, D_8018EE00 = 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) {
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ }
+ D_8018EDED = 4;
+ } else {
+ D_8018EDED = 5;
+ }
+ func_800B44AC();
+ play_sound2(0x49008002);
+ temp_t7_6 = D_8018EDF3;
+ D_8018EE00 = 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 1:
+ case 2:
+ 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
@@ -1107,15 +2521,239 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B3B58.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function func_800B3F74:
+//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 ? D_8018D9C8;
+extern ? D_8018D9D0;
+static ? D_800F2BDF; /* unable to generate initializer; const */
+
+void func_800B3F74(u32 arg0) {
+ ? *temp_v0_5;
+ s32 temp_v0;
+ s32 temp_v0_3;
+ s32 temp_v0_4;
+ s8 *temp_a1;
+ s8 *temp_a2;
+ 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;
+ ? *phi_v0_2;
+
+ D_8018EDEF = 1;
+ D_8018EE00 = 0;
+ D_8018EE04 = 0;
+ D_8018EE08 = 0;
+ D_8015F890 = 0;
+ D_8015F892 = 0;
+ D_8018EDFA = 0;
+ D_8018EDFB = 0;
+ D_8016556E = 0;
+ D_80162DD4 = 1;
+ D_80162DD8 = 1;
+ D_80162E00 = 0;
+ D_80162DC8 = 1;
+ D_80162DCC = 0;
+ switch (arg0) {
+ case 5:
+ D_8018EDEC = 0x15;
+ break;
+ case 6:
+ D_8018EDEC = 1;
+ break;
+ case 7:
+ D_8018EDEC = 0xB;
+ break;
+ case 8:
+ func_800CA008(0, 0);
+ break;
+ case 9:
+ gPlayerCountSelection2 = 1;
+ func_800CA008(0, 0);
+ break;
+ case 0:
+ case 10:
+ gIsMirrorMode = 0;
+ gEnableDebugMode = 0;
+ gCupSelection = 0;
+ gCourseSelection = 0;
+ D_8018EDF7 = 0;
+ 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 1:
+ case 11:
+ 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) {
-Unable to determine jump table for jr instruction at func_800B3F74.s line 40.
+ } else {
+ D_8018EDED = 3;
+ }
+ } else {
+ temp_v0_2 = D_8018EDED;
+ if ((temp_v0_2 != 1) && (temp_v0_2 != 2)) {
+ D_8018EDED = 8;
+ } else {
+ D_8018EDED = 3;
+ }
+ }
+ } else {
+ D_8018EDED = 7;
+ }
+ } else {
+ D_8018EDED = 3;
+ func_800C8EAC(2, &D_8018EDED, 3);
+ temp_v0_3 = D_800DC530;
+ D_8018EDF3 = 1;
+ if ((temp_v0_3 >= 4) || (temp_v0_3 < 0)) {
+ D_800DC530 = 0;
+ }
+ }
+ break;
+ case 2:
+ case 12:
+ temp_v0_4 = D_8018EDE0;
+ if (temp_v0_4 != 0) {
+ if (temp_v0_4 != 1) {
-There must be a read of a variable in the same block as
-the instruction, which has a name starting with "jtbl"/"jpt_".
-*/
+ } 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 = &gCharacterSelections;
+ phi_a2 = &D_800E86A8;
+ 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 3:
+ case 13:
+ if (gModeSelection == 3) {
+ gCupSelection = 4;
+ D_800DC540 = 4;
+ D_8018EDEC = 4;
+ } else {
+ if (gCupSelection == 4) {
+ gCupSelection = 0;
+ }
+ 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 == 0) {
+ gCourseSelection = 0;
+ }
+ phi_v0_2 = &D_8018D9C8;
+ 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 != &D_8018D9D0);
+ break;
+ }
+ func_800B44AC();
+}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B3F74.s")
#endif