summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2023-08-15 15:40:01 -0400
committerGitHub <noreply@github.com>2023-08-15 13:40:01 -0600
commit2b0d20a84f539eaae0b7ea7273a331de9903801d (patch)
tree54ccd5df66791c8f7f984adf9e5d37fb277dab07 /src
parent27af470a465475bc6242e6ca6a52a68fa04d89d1 (diff)
Migrate audio/port_eu data (#370)
* All work done in audio * Migrate audio/port_eu data * Refereshed m2c * Got the bss segment matching too Signed-off-by: Taggerung <tyler.taggerung@email.com>
Diffstat (limited to 'src')
-rw-r--r--src/audio/external.c1570
-rw-r--r--src/audio/heap.c317
-rw-r--r--src/audio/load.c475
-rw-r--r--src/audio/load.h3
-rw-r--r--src/audio/port_eu.c461
-rw-r--r--src/audio/port_eu.h28
-rw-r--r--src/audio/seqplayer.c591
-rw-r--r--src/audio/synthesis.c132
8 files changed, 1590 insertions, 1987 deletions
diff --git a/src/audio/external.c b/src/audio/external.c
index d7557518b..0a0d1cabc 100644
--- a/src/audio/external.c
+++ b/src/audio/external.c
@@ -171,11 +171,8 @@ f32 func_800C1934(u8 bank, u8 soundId) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-s8 func_800C15D0(u8, u8, u8); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
s8 func_800C16E8(f32, f32, u8); /* extern */
-? func_800CBB88(s32, f32); /* extern */
-? func_800CBBE8(s32, s8); /* extern */
extern ? D_8018EF18;
extern ? D_80192C48;
@@ -649,52 +646,48 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C2474.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800CBB88(s32, f32, void *); // extern
-void func_800CBBB8(s32, s32, s32); // extern
-extern u8 D_800EA1EC;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
+static u8 D_800EA1EC = 0;
void func_800C284C(u8 arg0, u8 arg1, u8 arg2, s32 arg3) {
s32 sp34;
void *sp30;
f32 temp_f2;
+ s32 temp_at;
s32 temp_t6;
- s32 temp_t6_2;
- s32 temp_t6_3;
s32 temp_v0;
+ s32 var_v1;
void *temp_a2;
void *temp_v0_2;
- s32 phi_v1;
- temp_t6 = arg3 & 0xFFFF;
if ((D_800EA1EC == 0) || (arg0 == 2)) {
temp_v0 = arg0 << 0x10;
sp34 = temp_v0;
- func_800CBBB8(temp_v0 | 0x82000000 | (arg1 << 8), temp_t6, temp_t6);
- temp_t6_2 = arg0 * 0x24C;
- temp_a2 = temp_t6_2 + &D_801930D0;
+ func_800CBBB8(temp_v0 | 0x82000000 | (arg1 << 8), arg3 & 0xFFFF);
+ temp_a2 = (arg0 * 0x24C) + &D_801930D0;
temp_f2 = temp_a2->unk0;
- temp_a2->unk248 = arg1 | (arg2 << 8);
+ temp_a2->unk248 = (s16) (arg1 | (arg2 << 8));
if (temp_f2 != 1.0f) {
sp30 = temp_a2;
- func_800CBB88(temp_v0 | 0x41000000, temp_f2, temp_a2);
+ func_800CBB88(temp_v0 | 0x41000000, temp_f2);
}
- (temp_t6_2 + &D_801930D0)->unk28 = 0;
- (temp_t6_2 + &D_801930D0)->unk18 = 0;
- (temp_t6_2 + &D_801930D0)->unk14 = 0;
- phi_v1 = 0;
+ temp_a2->unk28 = 0;
+ temp_a2->unk18 = 0;
+ temp_a2->unk14 = 0;
+ var_v1 = 0;
do {
- temp_v0_2 = (arg0 * 0x24C) + &D_801930D0 + (phi_v1 << 5);
- temp_t6_3 = (phi_v1 + 1) & 0xFF;
+ temp_v0_2 = (arg0 * 0x24C) + &D_801930D0 + (var_v1 << 5);
+ temp_t6 = (var_v1 + 1) & 0xFF;
+ temp_at = temp_t6 < 0x10;
+ var_v1 = temp_t6;
temp_v0_2->unk44 = 1.0f;
temp_v0_2->unk50 = 0;
temp_v0_2->unk54 = 1.0f;
temp_v0_2->unk60 = 0;
- phi_v1 = temp_t6_3;
- } while (temp_t6_3 < 0x10);
- (temp_t6_2 + &D_801930D0)->unk244 = 0;
- (temp_t6_2 + &D_801930D0)->unk246 = 0;
+ } while (temp_at != 0);
+ temp_a2->unk244 = 0;
+ temp_a2->unk246 = 0;
}
}
#else
@@ -702,8 +695,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C284C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800CBBB8(s32, s32); // extern
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
void func_800C29B4(u8 arg0, s32 arg1) {
@@ -715,22 +707,19 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C29B4.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C13FC(s32, s32); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C284C(u8, u8, u8, u32); /* extern */
? func_800C29B4(u8, s32); /* extern */
? func_800C5C40(); /* extern */
-? func_800CBBB8(?, u8); /* extern */
-? func_800CBBE8(s32, s8, s8, s32); /* extern */
extern ? D_80192CA8;
extern ? D_80192CC6;
extern ? D_801930D0;
-static s8 D_800EA1C0 = 0; /* const */
-static s8 D_800EA1EC = 0; /* const */
-static ? D_800EA1F0; /* unable to generate initializer; const */
-static s8 D_800EA1F4[0x4]; /* const */
+u8 D_800EA1C0 = 0;
+static s8 D_800EA1EC = 0;
+static ? D_800EA1F0; /* unable to generate initializer */
+static s8 D_800EA1F4[0x4F];
-void func_800C2A2C(u16 arg0, void *arg2) {
+void func_800C2A2C(u16 arg0, u16 *arg2) {
u8 sp5B;
u32 sp4C;
s32 sp48;
@@ -752,6 +741,7 @@ void func_800C2A2C(u16 arg0, void *arg2) {
s32 temp_a1;
s32 temp_a2_3;
s32 temp_a2_4;
+ s32 temp_a2_5;
s32 temp_a3;
s32 temp_a3_3;
s32 temp_at;
@@ -777,7 +767,6 @@ void func_800C2A2C(u16 arg0, void *arg2) {
s32 var_v1_3;
s32 var_v1_4;
s32 var_v1_5;
- s8 temp_a2_5;
s8 var_a2;
u32 temp_a3_2;
u32 temp_t6;
@@ -1013,7 +1002,7 @@ block_11:
temp_v0_7 = temp_t6 & 0xFF;
temp_a2_5 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF;
if (!((&D_801930D0 + (temp_v0_7 * 0x24C))->unk24A & (1 << temp_a2_5))) {
- func_800CBBE8(((temp_v0_7 & 0xFF) << 0x10) | 0x06000000 | ((temp_a2_5 & 0xFF) << 8) | (((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF), (s8) arg0, temp_a2_5);
+ func_800CBBE8(((temp_v0_7 & 0xFF) << 0x10) | 0x06000000 | ((temp_a2_5 & 0xFF) << 8) | (((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF), (s8) arg0);
return;
}
break;
@@ -1034,7 +1023,7 @@ block_11:
sp4C = var_a0;
sp5B = var_v1_6;
sp44 = var_a3;
- func_800CBBE8(sp48 | ((var_v1_6 & 0xFF) << 8), var_a2, var_a2, var_a3);
+ func_800CBBE8(sp48 | ((var_v1_6 & 0xFF) << 8), var_a2);
temp_t8_8 = (var_v1_6 + 1) & 0xFF;
temp_at_2 = temp_t8_8 < 0x10;
var_v1_6 = (u8) temp_t8_8;
@@ -1063,7 +1052,7 @@ block_11:
temp_t7_2 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF;
switch (temp_t7_2) { /* switch 1; irregular */
case 0: /* switch 1 */
- func_800CBBB8(0xF0000000, *(&D_800EA1F0 + (arg0 & 0xFF)));
+ func_800CBBB8(0xF0000000U, (s32) *(&D_800EA1F0 + (arg0 & 0xFF)));
return;
case 1: /* switch 1 */
D_800EA1EC = arg0 & 1;
@@ -1072,13 +1061,13 @@ block_11:
break;
case 15:
temp_t6_3 = (u32) (arg0 & 0xFF00) >> 8;
- D_800EA1C0 = (s8) temp_t6_3;
+ D_800EA1C0 = (u8) temp_t6_3;
temp_a0_5 = arg0 & 0xFF;
sp48 = temp_a0_5;
sp4C = temp_t6_3;
- func_800C13FC(temp_a0_5, temp_a1);
+ func_800C13FC((void *) temp_a0_5);
*D_800EA1F4 = (s8) sp48;
- func_800CBBE8(0x46020000, (s8) sp4C);
+ func_800CBBE8(0x46020000U, (s8) sp4C);
func_800C5C40();
break;
}
@@ -1096,17 +1085,20 @@ void func_800C3448(s32 arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C2A2C(s32); // extern
-extern u8 D_800EA1E4;
-extern u8 D_800EA1E8;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C2A2C(s32); /* extern */
extern ? D_80192CD0;
+static u8 D_800EA1E4 = 0;
+static u8 D_800EA1E8 = 0;
void func_800C3478(void) {
- if (D_800EA1E8 != D_800EA1E4) {
+ u8 temp_s0;
+
+ temp_s0 = D_800EA1E8;
+ if (temp_s0 != D_800EA1E4) {
do {
- D_800EA1E8 = D_800EA1E8 + 1;
- func_800C2A2C(*(&D_80192CD0 + (D_800EA1E8 * 4)));
+ D_800EA1E8 = temp_s0 + 1;
+ func_800C2A2C(*(&D_80192CD0 + (temp_s0 * 4)));
} while (D_800EA1E8 != D_800EA1E4);
}
}
@@ -1115,7 +1107,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3478.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
u16 func_800C3508(s32 player) {
@@ -1133,39 +1125,29 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3508.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern u8 D_800EA1E4;
-extern u8 D_800EA1E8;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80192CD0;
+static u8 D_800EA1E4 = 0;
+static u8 D_800EA1E8 = 0;
s32 func_800C357C(s32 arg0) {
- ? sp-10;
s32 temp_t9;
- u8 temp_a1;
- u8 temp_v0;
- u8 phi_v0;
- u8 phi_v0_2;
- ? phi_v1;
- ? phi_v1_2;
-
- temp_a1 = D_800EA1E4;
- temp_v0 = D_800EA1E8;
- phi_v0 = temp_v0;
- phi_v1 = 1;
- phi_v1_2 = 1;
- if (temp_v0 < temp_a1) {
+ s32 var_v1;
+ u8 var_v0;
+
+ var_v0 = D_800EA1E8;
+ var_v1 = 1;
+ if ((s32) var_v0 < (s32) D_800EA1E4) {
do {
- phi_v0_2 = phi_v0;
- if (arg0 == *(&D_80192CD0 + (phi_v0 * 4))) {
- phi_v0_2 = temp_a1 & 0xFF;
- phi_v1_2 = 0;
+ if (arg0 == *(&D_80192CD0 + (var_v0 * 4))) {
+ var_v1 = 0;
+ var_v0 = D_800EA1E4 & 0xFF;
}
- temp_t9 = (phi_v0_2 + 1) & 0xFF;
- phi_v0 = temp_t9;
- phi_v1 = phi_v1_2;
- } while (temp_t9 < temp_a1);
+ temp_t9 = (var_v0 + 1) & 0xFF;
+ var_v0 = (u8) temp_t9;
+ } while (temp_t9 < (s32) D_800EA1E4);
}
- return phi_v1;
+ return var_v1;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C357C.s")
@@ -1179,36 +1161,30 @@ void func_800C35E8(u8 arg0) {
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
void func_800C3608(s32 arg0, s32 arg1) {
- ? sp-10;
s32 temp_t6;
s32 temp_t9;
- u8 temp_a2;
+ s32 var_v0;
void *temp_a3;
void *temp_v1;
- s32 phi_v0;
- s32 phi_a2;
temp_t6 = arg0 & 0xFF;
- sp-10.unk10 = arg0;
- sp-10.unk14 = arg1;
+ unksp-10.unk10 = arg0;
+ unksp-10.unk14 = arg1;
temp_v1 = (temp_t6 * 0x24C) + &D_801930D0;
- temp_a2 = temp_v1->unk41;
- phi_v0 = 0;
- phi_a2 = temp_a2;
- if (temp_a2 > 0) {
+ var_v0 = 0;
+ if ((s32) temp_v1->unk41 > 0) {
do {
- temp_a3 = (temp_t6 * 0x24C) + &D_801930D0 + (phi_v0 * 4);
- temp_t9 = (phi_v0 + 1) & 0xFF;
- if ((arg1 & 0xFF) == (((temp_a3->unk2C & 0xF00000) >> 0x14) & 0xFF)) {
+ temp_a3 = (temp_t6 * 0x24C) + &D_801930D0 + (var_v0 * 4);
+ temp_t9 = (var_v0 + 1) & 0xFF;
+ if ((arg1 & 0xFF) == (((u32) (temp_a3->unk2C & 0xF00000) >> 0x14) & 0xFF)) {
temp_a3->unk2C = 0xFF000000;
- phi_a2 = temp_v1->unk41;
}
- phi_v0 = temp_t9;
- } while (temp_t9 < phi_a2);
+ var_v0 = temp_t9;
+ } while (temp_t9 < (s32) temp_v1->unk41);
}
}
#else
@@ -1216,7 +1192,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3608.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
void func_800C36C4(s32 arg0, u32 arg1, u8 arg2, s8 arg3) {
@@ -1232,11 +1208,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C36C4.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C3448(s32, s8, s32); /* extern */
-? func_800C36C4(s32, ?, ?, ?); /* extern */
-? func_800CBB88(s32, f32, s32); /* extern */
-? func_800CBBB8(s32, s32); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
void func_800C3724(void) {
@@ -1252,8 +1224,6 @@ void func_800C3724(void) {
s32 temp_a0_2;
s32 temp_a0_3;
s32 temp_a1;
- s32 temp_a2;
- s32 temp_a2_2;
s32 temp_a3;
s32 temp_a3_2;
s32 temp_at;
@@ -1412,7 +1382,6 @@ void func_800C3724(void) {
temp_t5 = temp_v1_2 - 1;
if (temp_v1_2 != 0) {
temp_v0_4->unk50 = temp_t5;
- temp_a2 = ((var_s5 & 0xFF) << 0x10) | 0x01000000;
if (temp_t5 & 0xFFFF) {
temp_v0_4->unk44 = (f32) (temp_v0_4->unk44 - temp_v0_4->unk4C);
} else {
@@ -1420,7 +1389,7 @@ void func_800C3724(void) {
temp_v1_3->unk44 = (f32) temp_v1_3->unk48;
temp_s3->unk246 = (u16) (temp_s3->unk246 ^ (1 << var_s0));
}
- func_800CBB88(temp_a2 | ((var_s0 & 0xFF) << 8), temp_v0_4->unk44, temp_a2);
+ func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x01000000 | ((var_s0 & 0xFF) << 8), temp_v0_4->unk44);
}
temp_t7_3 = (var_s0 + 1) & 0xFF;
var_s0 = temp_t7_3;
@@ -1435,7 +1404,6 @@ void func_800C3724(void) {
temp_t2_2 = temp_v1_4 - 1;
if (temp_v1_4 != 0) {
temp_v0_5->unk60 = temp_t2_2;
- temp_a2_2 = ((var_s5 & 0xFF) << 0x10) | 0x04000000;
if (temp_t2_2 & 0xFFFF) {
temp_v0_5->unk54 = (f32) (temp_v0_5->unk54 - temp_v0_5->unk5C);
} else {
@@ -1443,7 +1411,7 @@ void func_800C3724(void) {
temp_v1_5->unk54 = (f32) temp_v1_5->unk58;
temp_s3->unk244 = (u16) (temp_s3->unk244 ^ (1 << var_s0_2));
}
- func_800CBB88(temp_a2_2 | ((var_s0_2 & 0xFF) << 8), temp_v0_5->unk54, temp_a2_2);
+ func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x04000000 | ((var_s0_2 & 0xFF) << 8), temp_v0_5->unk54);
}
temp_t4_2 = (var_s0_2 + 1) & 0xFF;
var_s0_2 = temp_t4_2;
@@ -1471,24 +1439,24 @@ void func_800C3724(void) {
temp_s0->unkF = 0x7F;
break;
case 1:
- func_800C3448(temp_s3->unk248 | 0x30000000 | (var_s5 << 0x18), temp_a1_3, temp_t2_3);
+ func_800C3448(temp_s3->unk248 | 0x30000000 | (var_s5 << 0x18));
break;
case 2:
temp_s0_2 = &D_801930D0 + (temp_s1 * 0x24C);
- func_800C3448(temp_s0_2->unk248 | (temp_s1 << 0x18) | 0x10000, temp_a1_3, temp_t2_3);
+ func_800C3448(temp_s0_2->unk248 | (temp_s1 << 0x18) | 0x10000);
temp_s0_2->unk12 = 1;
temp_s0_2->unkF = 0x7F;
break;
case 3:
- func_800C3448((temp_s1 << 0x18) | 0xB0003000 | (temp_a1_3 << 0x10) | temp_t2_3, temp_a1_3, temp_t2_3);
+ func_800C3448((temp_s1 << 0x18) | 0xB0003000 | (temp_a1_3 << 0x10) | temp_t2_3);
break;
case 4:
- func_800C3448((temp_s1 << 0x18) | 0xB0004000 | (temp_t2_3 << 0x10), temp_a1_3, temp_t2_3);
+ func_800C3448((temp_s1 << 0x18) | 0xB0004000 | (temp_t2_3 << 0x10));
break;
case 5:
temp_s0_3 = &D_801930D0 + (temp_s1 * 0x24C);
- func_800C3448((temp_s0_3->unk42 << 0x10) | (temp_s1 << 0x18) | (temp_v0_7 & 0xFFFF), temp_a1_3, temp_t2_3);
- func_800C36C4(temp_s1 & 0xFF, 1, 0x7F, 0);
+ func_800C3448((temp_s0_3->unk42 << 0x10) | (temp_s1 << 0x18) | (temp_v0_7 & 0xFFFF));
+ func_800C36C4(temp_s1 & 0xFF, 1U, 0x7FU, 0);
temp_s0_3->unk42 = 0U;
break;
case 6:
@@ -1512,21 +1480,25 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3724.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80192CC6;
extern ? D_801930D0;
void func_800C3F70(void) {
- ? sp-10;
+ s32 temp_at;
+ s32 temp_lo;
s32 temp_t8;
+ s32 var_v0;
void *temp_v1;
- s32 phi_v0;
- phi_v0 = 0;
+ var_v0 = 0;
do {
- *(&D_80192CC6 + phi_v0) = 0;
- temp_t8 = (phi_v0 + 1) & 0xFF;
- temp_v1 = &D_801930D0 + (phi_v0 * 0x24C);
+ temp_lo = var_v0 * 0x24C;
+ *(&D_80192CC6 + var_v0) = 0;
+ temp_t8 = (var_v0 + 1) & 0xFF;
+ temp_at = temp_t8 < 3;
+ var_v0 = temp_t8;
+ temp_v1 = &D_801930D0 + temp_lo;
temp_v1->unk248 = 0xFFFF;
temp_v1->unk0 = 1.0f;
temp_v1->unkC = 0;
@@ -1542,29 +1514,32 @@ void func_800C3F70(void) {
temp_v1->unk10 = 0x7F;
temp_v1->unk244 = 0;
temp_v1->unk246 = 0;
- phi_v0 = temp_t8;
- } while (temp_t8 < 3);
+ } while (temp_at != 0);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3F70.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80192CC6;
extern ? D_801930D0;
void func_800C400C(void) {
- ? sp-10;
+ s32 temp_at;
+ s32 temp_lo;
s32 temp_t8;
+ s32 var_v0;
void *temp_v1;
- s32 phi_v0;
- phi_v0 = 0;
+ var_v0 = 0;
do {
- *(&D_80192CC6 + phi_v0) = 0;
- temp_t8 = (phi_v0 + 1) & 0xFF;
- temp_v1 = &D_801930D0 + (phi_v0 * 0x24C);
+ temp_lo = var_v0 * 0x24C;
+ *(&D_80192CC6 + var_v0) = 0;
+ temp_t8 = (var_v0 + 1) & 0xFF;
+ temp_at = temp_t8 < 3;
+ var_v0 = temp_t8;
+ temp_v1 = &D_801930D0 + temp_lo;
temp_v1->unk248 = 0xFFFF;
temp_v1->unk28 = 0;
temp_v1->unk18 = 0;
@@ -1574,8 +1549,7 @@ void func_800C400C(void) {
temp_v1->unk42 = 0;
temp_v1->unk244 = 0;
temp_v1->unk246 = 0;
- phi_v0 = temp_t8;
- } while (temp_t8 < 3);
+ } while (temp_at != 0);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C400C.s")
@@ -1596,18 +1570,17 @@ void func_800C4084(u16 bankMask) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern u16 D_800EA1C4;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
+static u16 D_800EA1C4 = 0;
void func_800C40F0(s32 arg0) {
- ? sp-10;
u16 temp_t1;
- sp-10.unk10 = arg0;
+ unksp-10.unk10 = arg0;
temp_t1 = D_800EA1C4 & ((1 << (arg0 & 0xFF)) ^ 0xFFFF);
D_800EA1C4 = temp_t1;
- if ((temp_t1 & 0xFFFF) == 0) {
+ if (!(temp_t1 & 0xFFFF)) {
D_801930D0.unk12 = 1;
D_801930D0.unk10 = 0x7F;
}
@@ -1694,12 +1667,12 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C41CC.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C40F0(u8, s32, struct Unk_8018FC20 *, u8); /* extern */
-static ? D_800EA1A0; /* unable to generate initializer; const */
-static u8 D_800EA1C0 = 0; /* const */
-static ? D_800EA1C8; /* unable to generate initializer; const */
-u8 sNumProcessedSoundRequests = 0; /* const */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C40F0(u8, u32, struct Unk_8018FC20 *, u8); /* extern */
+static ? D_800EA1A0; /* unable to generate initializer */
+u8 sNumProcessedSoundRequests = 0;
+u8 D_800EA1C0 = 0;
+f32 D_800EA1C8[3] = { 0.0f, 0.0f, 0.0f };
void func_800C4398(void) {
u8 sp4F;
@@ -1709,8 +1682,6 @@ void func_800C4398(void) {
u32 sp3C;
struct Unk_80191420 *sp30;
f32 *temp_v0_3;
- s32 temp_a1;
- s32 temp_a1_2;
struct Unk_8018FC20 *var_a2;
struct Unk_80191420 *temp_s0;
struct Unk_80191420 *temp_s0_2;
@@ -1718,6 +1689,8 @@ void func_800C4398(void) {
struct Unk_80191420 *temp_t0;
struct Unk_80191420 *temp_t1;
struct Unk_80191420 *var_t1;
+ u32 temp_a1;
+ u32 temp_a1_2;
u32 temp_v0;
u32 var_t3;
u8 *temp_a3;
@@ -1787,13 +1760,13 @@ block_11:
sp48 = var_a2;
func_800C40F0(temp_s0_2->unk2C, temp_a1_2, var_a2, var_a3);
}
- temp_s0_2->unk0C = var_a2->cameraId;
- temp_s0_2->soundBits = (u32) var_a2->soundBits;
+ temp_s0_2->cameraId = var_a2->cameraId;
+ temp_s0_2->soundBits = var_a2->soundBits;
temp_s0_2->freshness = 2;
temp_s0_2->soundStatus = (u8) ((u32) (var_a2->soundBits & 0x01000000) >> 0x18);
temp_s0_2->unk10 = var_a2->unk0C;
temp_s0_2->unk14 = var_a2->unk10;
- temp_s0_2->unk18 = var_a2->unk14;
+ temp_s0_2->unk18 = (s8 *) var_a2->unk14;
}
var_v1 = 0;
}
@@ -1822,11 +1795,11 @@ block_11:
temp_s0_3->unk00 = var_a2->position;
temp_s0_3->unk04 = var_a2->position + 4;
temp_s0_3->unk08 = var_a2->position + 8;
- temp_s0_3->unk0C = var_a2->cameraId;
+ temp_s0_3->cameraId = var_a2->cameraId;
temp_s0_3->unk10 = var_a2->unk0C;
temp_s0_3->unk14 = var_a2->unk10;
- temp_s0_3->unk18 = var_a2->unk14;
- temp_s0_3->soundBits = (u32) var_a2->soundBits;
+ temp_s0_3->unk18 = (s8 *) var_a2->unk14;
+ temp_s0_3->soundBits = var_a2->soundBits;
temp_s0_3->freshness = 2;
temp_v0_2 = &sSoundBankUsedListBack[var_t5];
temp_a0_2 = *temp_v0_2;
@@ -1842,7 +1815,7 @@ block_11:
}
if (temp_v1 == 0xFF) {
temp_v0_3 = var_a2->position;
- if (&D_800EA1C8 != temp_v0_3) {
+ if (D_800EA1C8 != temp_v0_3) {
temp_v0_3->unk4 = 100000.0f;
}
}
@@ -1853,9 +1826,9 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4398.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C40F0(u8, u8, struct Unk_80191420 *, u8); /* extern */
-static ? D_800EA1C8; /* unable to generate initializer; const */
+f32 D_800EA1C8[3] = { 0.0f, 0.0f, 0.0f };
// delete_sound_from_bank? Very similar, but has some extra stuff
void func_800C473C(u8 bankId, u8 soundId) {
@@ -1874,7 +1847,7 @@ void func_800C473C(u8 bankId, u8 soundId) {
temp_a2 = sSoundBanks[var_a3];
temp_v0 = &temp_a2[temp_t6];
var_a1 = temp_t6;
- if (&D_800EA1C8 != temp_v0->unk00) {
+ if (D_800EA1C8 != temp_v0->unk00) {
*temp_v0->unk04 = 100000.0f;
}
if (temp_v0->soundBits & 0x80000) {
@@ -1905,13 +1878,12 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C473C.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C473C(s32, u8, void *, u8); /* extern */
-? func_800CBBE8(s32, ?); /* extern */
extern ? D_80192AB8;
-static ? D_800EA188; /* unable to generate initializer; const */
-static u8 D_800EA1C0 = 0; /* const */
-static ? D_800EA1C8; /* unable to generate initializer; const */
+static ? D_800EA188; /* unable to generate initializer */
+u8 D_800EA1C0 = 0;
+f32 D_800EA1C8[3] = { 0.0f, 0.0f, 0.0f };
void func_800C4888(s32 arg0) {
u8 spCE;
@@ -1999,7 +1971,7 @@ void func_800C4888(s32 arg0) {
func_800C473C(temp_s5 & 0xFF, var_s3 & 0xFF);
} else if (temp_t2->soundStatus != 0) {
temp_v0 = temp_t2->unk00;
- if (&D_800EA1C8 == temp_v0) {
+ if (D_800EA1C8 == temp_v0) {
temp_t2->distance = 0.0f;
} else {
temp_f2 = *temp_v0;
@@ -2176,76 +2148,72 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4888.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C19D0(s32, s32, u8); // extern
-void func_800C473C(s32, s32); // extern
-void func_800CBBE8(s32, s8, u8); // extern
-extern ? D_800EA188;
-extern u8 D_800EA1C0;
-extern u16 D_800EA1C4;
-extern ? sSoundBanks;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C19D0(s32, s32, u8); /* extern */
+? func_800C473C(s32, s32); /* extern */
extern ? D_80192AB8;
extern u8 D_80192C38;
extern ? D_801930D0;
-extern s32 D_803B17D0;
+extern ? D_803B17D0;
+static ? D_800EA188; /* unable to generate initializer */
+u8 D_800EA1C0 = 0;
+static u16 D_800EA1C4 = 0;
void func_800C4FE4(s32 arg0) {
void *sp50;
+ s32 temp_at;
s32 temp_s3;
s32 temp_t7;
- u8 temp_a2;
+ s32 var_s4;
+ u8 *var_v1_2;
u8 temp_s1;
u8 temp_v0;
- u8 temp_v1;
+ u8 var_v1;
void *temp_s0;
- s32 phi_s4;
- s32 phi_v1;
- u8 *phi_v1_2;
temp_s3 = arg0 & 0xFF;
- temp_v1 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s3));
- phi_s4 = 0;
- phi_v1 = temp_v1;
- if (temp_v1 > 0) {
+ var_v1 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s3));
+ var_s4 = 0;
+ if ((s32) var_v1 > 0) {
sp50 = (temp_s3 << 6) + &D_80192AB8;
do {
- temp_s1 = (sp50 + (phi_s4 * 8))->unk4;
+ temp_s1 = (sp50 + (var_s4 * 8))->unk4;
if (temp_s1 != 0xFF) {
- temp_a2 = D_80192C38;
- temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + &sSoundBanks;
+ temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + sSoundBanks;
temp_v0 = temp_s0->unk28;
if (temp_v0 == 2) {
- temp_s0->unk2C = temp_a2;
+ temp_s0->unk2C = (u8) D_80192C38;
if (temp_s0->unk24 & 0x80000) {
- D_800EA1C4 = D_800EA1C4 | (1 << D_80192C38);
+ D_800EA1C4 |= 1 << D_80192C38;
D_801930D0.unk12 = 1;
D_801930D0.unk10 = 0x28;
}
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
- func_800CBBE8((D_80192C38 << 8) | 0x6020000, 1);
- func_800CBBE8((D_80192C38 << 8) | 0x6020000 | 4, temp_s0->unk24);
- temp_s0->unk28 = 4;
- phi_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
+ func_800CBBE8((D_80192C38 << 8) | 0x06020000, 1);
+ func_800CBBE8((D_80192C38 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24);
+ temp_s0->unk28 = 4U;
+ var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
- if ((*(&D_803B17D0 + (temp_a2 * 4)))->unk5F == 0x80) {
- func_800CBBE8(((temp_a2 & 0xFF) << 8) | 0x6020000 | 7, 0, temp_a2);
+ if ((*(&D_803B17D0 + (D_80192C38 * 4)))->unk5F == 0x80) {
+ func_800CBBE8(((D_80192C38 & 0xFF) << 8) | 0x06020000 | 7, 0);
func_800C473C(temp_s3 & 0xFF, temp_s1 & 0xFF);
- phi_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
+ var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
if (temp_v0 == 3) {
- func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, temp_a2);
- temp_s0->unk28 = 4;
- phi_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
+ func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
+ temp_s0->unk28 = 4U;
+ var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
block_11:
- phi_v1 = *phi_v1_2;
+ var_v1 = *var_v1_2;
}
}
- temp_t7 = (phi_s4 + 1) & 0xFF;
- D_80192C38 = D_80192C38 + 1;
- phi_s4 = temp_t7;
- } while (temp_t7 < phi_v1);
+ temp_t7 = (var_s4 + 1) & 0xFF;
+ temp_at = temp_t7 < (s32) var_v1;
+ var_s4 = temp_t7;
+ D_80192C38 += 1;
+ } while (temp_at != 0);
}
}
#else
@@ -2253,9 +2221,8 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4FE4.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C473C(s32, s32); /* extern */
-? func_800CBBE8(s32, ?); /* extern */
void func_800C5278(u8 bank) {
struct Unk_80191420 sp60;
@@ -2284,9 +2251,8 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5278.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C473C(s32, s32); /* extern */
-? func_800CBBE8(s32, ?); /* extern */
void func_800C5384(s32 arg0, s32 arg1) {
s32 temp_s5;
@@ -2339,37 +2305,34 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C54B8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C41CC(?, s32 *); // extern
-void func_800C5384(s32, s32); // extern
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C5384(s32, s32); /* extern */
void func_800C550C(s32 arg0) {
s32 sp3C;
s32 temp_t6;
- s32 phi_s0;
+ s32 var_s0;
- phi_s0 = 0;
+ var_s0 = 0;
do {
- func_800C5384(phi_s0 & 0xFF, arg0);
- temp_t6 = (phi_s0 + 1) & 0xFF;
- phi_s0 = temp_t6;
+ func_800C5384(var_s0 & 0xFF, arg0);
+ temp_t6 = (var_s0 + 1) & 0xFF;
+ var_s0 = temp_t6;
} while (temp_t6 < 6);
sp3C = arg0;
- func_800C41CC(2, &sp3C);
+ func_800C41CC(2U, (struct Unk_80191420 *) &sp3C);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C550C.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C41CC(?, s32 *); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C473C(s32, s32); /* extern */
-? func_800CBBE8(s32, ?); /* extern */
-void func_800C5578(s32 arg0, s32 arg1) {
- s32 sp84;
- s32 sp60;
+void func_800C5578(f32 *arg0, u32 arg1) {
+ u32 sp84;
+ f32 *sp60;
s32 temp_t8;
s32 var_s3;
struct Unk_80191420 *temp_s0;
@@ -2405,7 +2368,7 @@ void func_800C5578(s32 arg0, s32 arg1) {
}
sp60 = arg0;
sp84 = arg1;
- func_800C41CC(3, &sp60);
+ func_800C41CC(3U, (struct Unk_80191420 *) &sp60);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5578.s")
@@ -2463,63 +2426,58 @@ void func_800C5848(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80192C48;
-void func_800C58B8(s32 arg0, s32 arg1, s32 arg2) {
- ? sp-10;
+void func_800C58B8(u8 arg0, u8 arg1, u16 arg2) {
f32 temp_f0;
- f32 temp_f8;
+ f32 var_f8;
s16 temp_t8;
+ s16 var_a2;
void *temp_v0;
- s16 phi_a2;
- f32 phi_f8;
- sp-10.unk10 = arg0;
- sp-10.unk14 = arg1;
- sp-10.unk18 = arg2;
+ unksp-10.unk10 = (s32) arg0;
+ unksp-10.unk14 = (s32) arg1;
+ unksp-10.unk18 = (s32) arg2;
temp_t8 = arg2 & 0xFFFF;
- phi_a2 = temp_t8;
+ var_a2 = temp_t8;
if (temp_t8 == 0) {
- phi_a2 = (temp_t8 + 1) & 0xFFFF;
+ var_a2 = (temp_t8 + 1) & 0xFFFF;
}
temp_v0 = ((arg0 & 0xFF) * 0x10) + &D_80192C48;
- temp_f0 = (arg1 & 0xFF) / 127.0f;
- temp_v0->unkC = phi_a2;
- temp_f8 = phi_a2;
+ temp_f0 = (f32) (arg1 & 0xFF) / 127.0f;
+ temp_v0->unkC = var_a2;
+ var_f8 = (f32) var_a2;
temp_v0->unk4 = temp_f0;
- phi_f8 = temp_f8;
- if (phi_a2 < 0) {
- phi_f8 = temp_f8 + 4294967296.0f;
+ if (var_a2 < 0) {
+ var_f8 += 4294967296.0f;
}
- temp_v0->unk8 = (temp_v0->unk0 - temp_f0) / phi_f8;
+ temp_v0->unk8 = (f32) ((temp_v0->unk0 - temp_f0) / var_f8);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C58B8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80192C48;
void func_800C5968(s32 arg0) {
- ? sp-10;
u16 temp_t9;
u16 temp_v1;
void *temp_v0;
- sp-10.unk10 = arg0;
+ unksp-10.unk10 = arg0;
temp_v0 = ((arg0 & 0xFF) * 0x10) + &D_80192C48;
temp_v1 = temp_v0->unkC;
temp_t9 = temp_v1 - 1;
if (temp_v1 != 0) {
temp_v0->unkC = temp_t9;
- if ((temp_t9 & 0xFFFF) != 0) {
- temp_v0->unk0 = temp_v0->unk0 - temp_v0->unk8;
+ if (temp_t9 & 0xFFFF) {
+ temp_v0->unk0 = (f32) (temp_v0->unk0 - temp_v0->unk8);
return;
}
- temp_v0->unk0 = temp_v0->unk4;
- // Duplicate return node #4. Try simplifying control flow for better match
+ temp_v0->unk0 = (f32) temp_v0->unk4;
}
}
#else
@@ -2527,27 +2485,26 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5968.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C4888(s32); // extern
-void func_800C4FE4(s32); // extern
-void func_800C5968(s32); // extern
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C4888(s32); /* extern */
+? func_800C4FE4(s32); /* extern */
+? func_800C5968(s32); /* extern */
extern s8 D_80192C38;
extern s32 D_803B17D0;
-extern ? gSequenceChannelNone;
void func_800C59C4(void) {
s32 temp_t8;
- s32 phi_s0;
+ s32 var_s0;
if (&gSequenceChannelNone != D_803B17D0) {
D_80192C38 = 0;
- phi_s0 = 0;
+ var_s0 = 0;
do {
- func_800C4888(phi_s0 & 0xFF);
- func_800C4FE4(phi_s0 & 0xFF);
- func_800C5968(phi_s0 & 0xFF);
- temp_t8 = (phi_s0 + 1) & 0xFF;
- phi_s0 = temp_t8;
+ func_800C4888(var_s0 & 0xFF);
+ func_800C4FE4(var_s0 & 0xFF);
+ func_800C5968(var_s0 & 0xFF);
+ temp_t8 = (var_s0 + 1) & 0xFF;
+ var_s0 = temp_t8;
} while (temp_t8 < 6);
}
}
@@ -2655,18 +2612,16 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5A3C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800CBBE8(s32, ?); // extern
-extern ? D_800EA154;
-extern u8 D_800EA1C0;
-extern Player gPlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ? D_800EA154; /* unable to generate initializer */
+u8 D_800EA1C0 = 0;
void func_800C5BD0(void) {
if (D_800EA1C0 == 0) {
- func_800CBBE8((*(&D_800EA154 + *(&gPlayers + 0x254)) << 8) | 0xF3000000, 0);
+ func_800CBBE8((*(&D_800EA154 + gPlayers->characterId) << 8) | 0xF3000000, 0);
return;
}
- func_800CBBE8(0xF3004D00, 0);
+ func_800CBBE8(0xF3004D00U, 0);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5BD0.s")
@@ -2706,15 +2661,14 @@ void func_800C5CB8(void) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C94A4(u8); /* extern */
-? func_800C97C4(s32, u8); /* extern */
-static s32 D_800E9E24[4] = { 0, 0, 0, 0 }; /* const */
-static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */
-static ? D_800EA0EC; /* unable to generate initializer; const */
-static u8 D_800EA16C = 0; /* const */
+static s32 D_800E9E24[4] = { 0, 0, 0, 0 };
+static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+u8 D_800EA0EC[1] = { 0 };
+s8 D_800EA16C = 0;
-void func_800C5D04(u8 arg0) {
+void func_800C5D04(u8 playerId) {
s32 *temp_a0;
s32 *temp_v1_2;
s32 temp_a0_2;
@@ -2724,19 +2678,19 @@ void func_800C5D04(u8 arg0) {
u8 temp_a1;
u8 temp_v0;
- temp_a1 = arg0 & 0xFF;
+ temp_a1 = playerId & 0xFF;
if ((*(&gPlayers->unk_044 + (temp_a1 * 0xDD8)) & 0x20) == 0x20) {
D_800E9E34[temp_a1] = 0;
temp_a0 = &D_800E9E24[temp_a1];
var_v1 = *temp_a0;
if (var_v1 < 0x4E20) {
temp_t1 = var_v1 + 1;
- if (D_800EA16C == 0) {
+ if ((u8) D_800EA16C == 0) {
*temp_a0 = temp_t1;
var_v1 = temp_t1;
}
}
- temp_v1 = temp_a1 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a1];
if (var_v1 == 1) {
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
@@ -2746,16 +2700,16 @@ void func_800C5D04(u8 arg0) {
}
} else {
block_8:
- arg0 = temp_a1;
- func_800C97C4(temp_a1 & 0xFF, temp_a1);
- func_800C94A4(arg0);
+ playerId = temp_a1;
+ func_800C97C4(temp_a1 & 0xFF);
+ func_800C94A4(playerId);
}
}
} else {
D_800E9E24[temp_a1] = 0;
temp_v1_2 = &D_800E9E34[temp_a1];
temp_a0_2 = *temp_v1_2;
- if ((temp_a0_2 < 0x4E20) && (D_800EA16C == 0)) {
+ if ((temp_a0_2 < 0x4E20) && ((u8) D_800EA16C == 0)) {
*temp_v1_2 = temp_a0_2 + 1;
}
}
@@ -2765,42 +2719,40 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5D04.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C9018(s32, ?, u8, Player *); /* extern */
-? play_sound(?, void *, u8, void *, s32 *, void *); /* extern */
-static ?32 D_800E9DC4[4] = { 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 }; /* const */
-static ?32 D_800E9DD4[4] = { 0, 0, 0, 0 }; /* const */
-static s32 D_800E9E14[4] = { 0, 0, 0, 0 }; /* const */
-static s32 D_800E9E24[4] = { 0, 0, 0, 0 }; /* const */
-static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */
-static s32 D_800E9F04[4] = { 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 }; /* const */
-static f32 D_800E9F54[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */
-static ? D_800E9F74; /* unable to generate initializer; const */
-static ? D_800E9F7C; /* unable to generate initializer; const */
-static ? D_800E9F8C; /* unable to generate initializer; const */
-static ? D_800EA0EC; /* unable to generate initializer; const */
-static ? D_800EA130; /* unable to generate initializer; const */
-static u8 D_800EA16C = 0; /* const */
-static u8 D_800EA1C0 = 0; /* const */
-s8 D_800EA108 = 0; /* const */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ?32 D_800E9DC4[4] = { 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 };
+static ?32 D_800E9DD4[4] = { 0, 0, 0, 0 };
+static s32 D_800E9E14[4] = { 0, 0, 0, 0 };
+static s32 D_800E9E24[4] = { 0, 0, 0, 0 };
+static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static f32 D_800E9F04[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+f32 D_800E9F54[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+static ? D_800E9F74; /* unable to generate initializer */
+static ? D_800E9F7C; /* unable to generate initializer */
+static ? D_800E9F8C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+static ? D_800EA130; /* unable to generate initializer */
+s8 D_800EA16C = 0;
+u8 D_800EA1C0 = 0;
void func_800C5E38(u8 playerId) {
s32 sp3C;
Player *temp_a3;
+ f32 *temp_a1;
f32 temp_f0;
f32 temp_f2;
s32 temp_v0;
u8 *temp_t0;
u8 temp_v1;
u8 var_a2;
- void *temp_a1;
void *temp_a1_2;
var_a2 = playerId & 0xFF;
- if ((u8) D_800EA108 == 0) {
+ if (D_800EA108 == 0) {
temp_a3 = &gPlayers[var_a2];
temp_v0 = var_a2 * 4;
- if (((temp_a3->unk_044 & 0x20) != 0x20) && (temp_t0 = var_a2 + &D_800EA0EC, (temp_a3->unk_098 > 400.0f))) {
+ if (((temp_a3->unk_044 & 0x20) != 0x20) && (temp_t0 = &D_800EA0EC[var_a2], (temp_a3->unk_098 > 400.0f))) {
D_800E9E14[var_a2] = 1;
temp_v1 = *temp_t0;
if (temp_v1 == 0) {
@@ -2809,7 +2761,7 @@ void func_800C5E38(u8 playerId) {
temp_a1 = (var_a2 * 0x3C) + &D_800E9F7C;
D_800E9DC4[var_a2] = temp_a1->unk30;
D_800E9DD4[var_a2] = temp_a1->unk24;
- if ((D_800E9E34[var_a2] == 1) && (D_800EA16C == 0)) {
+ if ((D_800E9E34[var_a2] == 1) && ((u8) D_800EA16C == 0)) {
if (temp_v1 != 0) {
if (temp_v1 == 2) {
*temp_t0 = 1;
@@ -2819,10 +2771,10 @@ void func_800C5E38(u8 playerId) {
block_10:
if ((*(&D_800E9F74 + var_a2) == 0) && (temp_a3->characterId != 3)) {
if ((s32) D_800EA1C0 < 2) {
- play_sound(0x0100F926, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], temp_a1 + 0x14);
+ play_sound(0x0100F926U, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], temp_a1 + 0x14);
return;
}
- play_sound(0x01008026, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], temp_a1 + 0x14);
+ play_sound(0x01008026U, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], (u8 *) (temp_a1 + 0x14));
}
}
}
@@ -2831,11 +2783,11 @@ block_10:
if ((s32) D_800EA1C0 < 2) {
sp3C = temp_v0;
playerId = var_a2;
- func_800C9018(var_a2 & 0xFF, 0x0100F926, var_a2, temp_a3);
+ func_800C9018(var_a2 & 0xFF, 0x0100F926);
} else {
sp3C = temp_v0;
playerId = var_a2;
- func_800C9018(var_a2 & 0xFF, 0x01008026, var_a2, temp_a3);
+ func_800C9018(var_a2 & 0xFF, 0x01008026);
}
var_a2 = playerId;
}
@@ -3467,31 +3419,21 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C70A8.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C3448(?, ?); /* extern */
-s32 func_800C3508(?); /* extern */
-? func_800C5278(?); /* extern */
-? func_800C5578(void *, s32); /* extern */
-? func_800C9018(u8, ?); /* extern */
-? func_800C97C4(u8); /* extern */
-? func_800C9A88(u8); /* extern */
-? func_800C9D0C(u8); /* extern */
-? func_800CA414(?, ?); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern s8 D_801657E5;
extern u8 D_8018ED90;
-extern s32 gPlayerWinningIndex;
-static ? D_800E9E74; /* unable to generate initializer; const */
-static ? D_800E9E94; /* unable to generate initializer; const */
-static s32 D_800E9EA4[4] = { 0, 0, 0, 0 }; /* const */
-static ? D_800E9F7C; /* unable to generate initializer; const */
-static ? D_800EA0EC; /* unable to generate initializer; const */
-static u8 D_800EA0ED = 0; /* const */
-static u8 D_800EA0EE = 0; /* const */
-static u8 D_800EA0EF = 0; /* const */
-static s8 D_800EA0F0 = 0; /* const */
-static u8 D_800EA104 = 0; /* const */
-static ? D_800EA130; /* unable to generate initializer; const */
-static u8 D_800EA1C0 = 0; /* const */
+s32 D_800E9E74[4] = { 0, 0, 0, 0 };
+static ? D_800E9E94; /* unable to generate initializer */
+static s32 D_800E9EA4[4] = { 0, 0, 0, 0 };
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+static u8 D_800EA0ED = 0;
+static u8 D_800EA0EE = 0;
+static u8 D_800EA0EF = 0;
+u8 D_800EA0F0 = 0;
+u8 D_800EA104 = 0;
+static ? D_800EA130; /* unable to generate initializer */
+u8 D_800EA1C0 = 0;
void func_800C76C0(u8 playerId) {
s32 sp38;
@@ -3501,28 +3443,22 @@ void func_800C76C0(u8 playerId) {
Player *temp_v1_2;
f32 *var_at;
f32 var_f10;
- s16 temp_v0_11;
- s16 temp_v0_12;
+ s16 temp_v0_2;
s16 temp_v0_3;
- s16 temp_v0_4;
+ s16 temp_v0_6;
+ s16 temp_v0_7;
s32 *temp_t0;
s32 temp_t1;
- s32 temp_v0;
- s32 temp_v0_10;
+ s32 temp_v0_5;
s32 temp_v1_3;
s32 temp_v1_4;
s32 temp_v1_5;
s32 temp_v1_6;
s32 var_v1;
- s8 *temp_a2;
- u8 *temp_v0_2;
- u8 *temp_v0_5;
+ u8 *temp_a2;
+ u8 *temp_v0;
+ u8 *temp_v0_4;
u8 temp_t6;
- u8 temp_v0_6;
- u8 temp_v0_7;
- u8 temp_v0_8;
- u8 temp_v0_9;
- u8 var_a0;
u8 var_v0;
temp_t6 = playerId & 0xFF;
@@ -3543,68 +3479,67 @@ void func_800C76C0(u8 playerId) {
func_800C9018(playerId, 0x0100FF2C);
func_800C9018(playerId, 0x0100FA4C);
func_800C5578((playerId * 0x3C) + &D_800E9F7C, *(&D_800E9E94 + sp38));
- temp_v0 = gModeSelection;
- *(&D_800E9E74 + sp38) = 0;
- switch (temp_v0) { /* irregular */
+ *(D_800E9E74 + sp38) = 0;
+ switch (gModeSelection) { /* irregular */
case 0:
- temp_v0_2 = playerId + &D_800EA0EC;
- *temp_v0_2 = 2;
- sp30 = temp_v0_2;
+ temp_v0 = &D_800EA0EC[playerId];
+ *temp_v0 = 2;
+ sp30 = temp_v0;
func_800C9060(playerId, 0x1900F103U);
if (D_800EA1C0 == 0) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C5278(5);
- temp_v0_3 = *(&gPlayers->currentRank + (playerId * 0xDD8));
- if (temp_v0_3 == 0) {
- func_800C97C4(playerId);
+ func_800C5278(5U);
+ temp_v0_2 = *(&gPlayers->currentRank + (playerId * 0xDD8));
+ if (temp_v0_2 == 0) {
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(playerId);
- func_800CA414(0xD, 0x10);
- } else if (temp_v0_3 < 4) {
- func_800C97C4(playerId);
+ func_800CA414(0x000DU, 0x0010U);
+ } else if (temp_v0_2 < 4) {
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(playerId);
- func_800CA414(0xE, 0x10);
+ func_800CA414(0x000EU, 0x0010U);
} else {
- func_800C3448(0xC1606400);
- func_800CA414(0xF, 0x18);
+ func_800C3448(-0x3E9F9C00);
+ func_800CA414(0x000FU, 0x0018U);
}
} else {
*sp30 = 2;
func_800C9060(playerId, 0x1900F103U);
- temp_v0_4 = *(&gPlayers->currentRank + (playerId * 0xDD8));
- if (temp_v0_4 == 0) {
+ temp_v0_3 = *(&gPlayers->currentRank + (playerId * 0xDD8));
+ if (temp_v0_3 == 0) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C97C4(playerId);
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(playerId);
- func_800CA414(0xD, 0x10);
+ func_800CA414(0x000DU, 0x0010U);
goto block_23;
}
- if (temp_v0_4 < 4) {
+ if (temp_v0_3 < 4) {
if (D_800EA104 == 0) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
}
- func_800C97C4(playerId);
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(playerId);
- func_800CA414(0xE, 0x10);
+ func_800CA414(0x000EU, 0x0010U);
goto block_23;
}
var_v0 = D_800EA104;
if (var_v0 == 0) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C3448(0xC1606400);
- func_800CA414(0xF, 0x18);
+ func_800C3448(-0x3E9F9C00);
+ func_800CA414(0x000FU, 0x0018U);
block_23:
var_v0 = D_800EA104;
}
if ((var_v0 != 0) || (*sp30 != 1)) {
- func_800C5278(5);
+ func_800C5278(5U);
}
}
var_v1 = *sp34;
@@ -3612,69 +3547,66 @@ block_23:
case 1:
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C97C4(playerId);
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(0U);
- *(&D_800EA0EC + playerId) = 2;
+ D_800EA0EC[playerId] = 2;
func_800C9060(playerId, 0x1900F103U);
if (D_801657E5 == 1) {
- func_800CA414(0xD, 0x10);
+ func_800CA414(0x000DU, 0x0010U);
} else if (D_8018ED90 == 1) {
- func_800CA414(0xE, 0x10);
+ func_800CA414(0x000EU, 0x0010U);
} else {
- func_800C3448(0x01640010, 0x10);
+ func_800C3448(0x01640010);
}
var_v1 = *sp34;
break;
case 2:
- temp_v0_5 = playerId + &D_800EA0EC;
- *temp_v0_5 = 2;
- sp30 = temp_v0_5;
+ temp_v0_4 = &D_800EA0EC[playerId];
+ *temp_v0_4 = 2;
+ sp30 = temp_v0_4;
func_800C9060(playerId, 0x1900F103U);
- temp_v0_6 = D_800EA1C0;
- switch (temp_v0_6) { /* switch 1; irregular */
+ switch (D_800EA1C0) { /* switch 1; irregular */
case 1: /* switch 1 */
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C97C4(playerId);
+ func_800C97C4((s32) playerId);
D_800EA0F0 = 2;
func_800C9A88(playerId);
- func_800CA414(0xD, 0x17);
+ func_800CA414(0x000DU, 0x0017U);
break;
case 2: /* switch 1 */
- temp_v0_7 = D_800EA104;
- if ((temp_v0_7 == 0) && (*sp30 == 1)) {
+ if ((D_800EA104 == 0) && (*sp30 == 1)) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800CA414(0xD, 0x17);
+ func_800CA414(0x000DU, 0x0017U);
D_800EA104 = 1;
- } else if ((temp_v0_7 == 1) && (*sp30 == 1)) {
- func_800C5278(5);
- if (func_800C3508(1) != 0xD) {
+ } else if ((D_800EA104 == 1) && (*sp30 == 1)) {
+ func_800C5278(5U);
+ if (func_800C3508(1) != 0x000D) {
D_800EA104 = 0;
- func_800CA414(0xE, 0x17);
+ func_800CA414(0x000EU, 0x0017U);
}
D_800EA104 = 2;
}
break;
case 3: /* switch 1 */
- temp_v0_8 = D_800EA104;
- if ((temp_v0_8 == 0) && (*sp30 == 1)) {
+ if ((D_800EA104 == 0) && (*sp30 == 1)) {
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C8EF8(0xD);
+ func_800C8EF8(0x000DU);
D_800EA104 = 1;
- } else if ((temp_v0_8 == 1) && (*sp30 == 1)) {
- if (func_800C3508(1) != 0xD) {
+ } else if ((D_800EA104 == 1) && (*sp30 == 1)) {
+ if (func_800C3508(1) != 0x000D) {
D_800EA104 = 0;
- func_800C8EF8(0xE);
+ func_800C8EF8(0x000EU);
}
D_800EA104 = 2;
- } else if ((temp_v0_8 == 2) && (*sp30 == 1)) {
- func_800C5278(5);
- if (func_800C3508(1) != 0xE) {
+ } else if ((D_800EA104 == 2) && (*sp30 == 1)) {
+ func_800C5278(5U);
+ if (func_800C3508(1) != 0x000E) {
D_800EA104 = 0;
- func_800CA414(0xE, 0x17);
+ func_800CA414(0x000EU, 0x0017U);
}
D_800EA104 = 3;
}
@@ -3685,32 +3617,31 @@ block_76:
var_v1 = *sp34;
break;
case 3:
- temp_v0_9 = D_800EA1C0;
- switch (temp_v0_9) { /* switch 2; irregular */
+ switch (D_800EA1C0) { /* switch 2; irregular */
case 1: /* switch 2 */
func_800C3448(0x100100FF);
func_800C3448(0x110100FF);
- func_800C5278(5);
+ func_800C5278(5U);
func_800C9018(playerId, 0x0100F926);
- func_800C8EF8(0x17);
- *(&D_800EA0EC + playerId) = 2;
+ func_800C8EF8(0x0017U);
+ D_800EA0EC[playerId] = 2;
func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D);
break;
case 2: /* switch 2 */
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1)) {
- func_800C5278(5);
+ if ((D_800EA0EC->unk0 == 1) && (D_800EA0EC->unk1 == 1) && (D_800EA0EC->unk2 == 1)) {
+ func_800C5278(5U);
func_800C9018(playerId, 0x01008026);
- func_800C8EF8(0x17);
- *(&D_800EA0EC + playerId) = 2;
+ func_800C8EF8(0x0017U);
+ D_800EA0EC[playerId] = 2;
func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D);
}
break;
case 3: /* switch 2 */
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0ED == 1) && (D_800EA0EE == 1) && (D_800EA0EF == 1)) {
- func_800C5278(5);
+ if ((D_800EA0EC->unk0 == 1) && (D_800EA0ED == 1) && (D_800EA0EE == 1) && (D_800EA0EF == 1)) {
+ func_800C5278(5U);
func_800C9018(playerId, 0x01008026);
- func_800C8EF8(0x17);
- *(&D_800EA0EC + playerId) = 2;
+ func_800C8EF8(0x0017U);
+ D_800EA0EC[playerId] = 2;
func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D);
}
break;
@@ -3718,65 +3649,52 @@ block_76:
goto block_76;
}
}
- var_a0 = playerId;
- temp_v0_10 = gModeSelection;
+ temp_v0_5 = gModeSelection;
if (var_v1 == 0x0000001E) {
- switch (temp_v0_10) { /* switch 3; irregular */
+ switch (temp_v0_5) { /* switch 3; irregular */
case 3: /* switch 3 */
break;
case 0: /* switch 3 */
- temp_v1 = &gPlayers[var_a0];
- temp_v0_11 = temp_v1->currentRank;
- temp_a2 = var_a0 + &D_800EA0EC;
- if (temp_v0_11 == 0) {
+ temp_v1 = &gPlayers[playerId];
+ temp_v0_6 = temp_v1->currentRank;
+ temp_a2 = &D_800EA0EC[playerId];
+ if (temp_v0_6 == 0) {
*temp_a2 = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x29008007);
- } else if (temp_v0_11 < 4) {
+ func_800C90F4(playerId, (temp_v1->characterId * 0x10) + 0x29008007);
+ } else if (temp_v0_6 < 4) {
*temp_a2 = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x2900800D);
+ func_800C90F4(playerId, (temp_v1->characterId * 0x10) + 0x2900800D);
} else {
*temp_a2 = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x29008003);
+ func_800C90F4(playerId, (temp_v1->characterId * 0x10) + 0x29008003);
}
-block_97:
- var_a0 = playerId;
break;
case 2: /* switch 3 */
- temp_v1_2 = &gPlayers[var_a0];
- playerId = var_a0;
+ temp_v1_2 = &gPlayers[playerId];
if (temp_v1_2->currentRank == 0) {
- *(&D_800EA0EC + var_a0) = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (temp_v1_2->characterId * 0x10) + 0x2900800D);
+ D_800EA0EC[playerId] = 2;
+ func_800C90F4(playerId, (temp_v1_2->characterId * 0x10) + 0x2900800D);
}
- goto block_97;
+ break;
case 1: /* switch 3 */
if (D_801657E5 == 1) {
- *(&D_800EA0EC + var_a0) = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (*(&gPlayers->characterId + (var_a0 * 0xDD8)) * 0x10) + 0x29008007);
- } else {
- playerId = var_a0;
- if (D_8018ED90 == (u8) 1) {
- *(&D_800EA0EC + var_a0) = 2;
- playerId = var_a0;
- func_800C90F4(var_a0, (*(&gPlayers->characterId + (var_a0 * 0xDD8)) * 0x10) + 0x2900800D);
- }
+ D_800EA0EC[playerId] = 2;
+ func_800C90F4(playerId, (*(&gPlayers->characterId + (playerId * 0xDD8)) * 0x10) + 0x29008007);
+ } else if (D_8018ED90 == (u8) 1) {
+ D_800EA0EC[playerId] = 2;
+ func_800C90F4(playerId, (*(&gPlayers->characterId + (playerId * 0xDD8)) * 0x10) + 0x2900800D);
}
- goto block_97;
+ break;
}
}
- switch (gModeSelection) { /* switch 4; irregular */
+ switch (temp_v0_5) { /* switch 4; irregular */
case 0: /* switch 4 */
- temp_v0_12 = *(&gPlayers->currentRank + (var_a0 * 0xDD8));
+ temp_v0_7 = *(&gPlayers->currentRank + (playerId * 0xDD8));
temp_v1_3 = *sp34;
- if (temp_v0_12 == 0) {
+ if (temp_v0_7 == 0) {
if (temp_v1_3 >= 0x15F) {
if (temp_v1_3 == 0x0000015F) {
- func_800C9D0C(var_a0);
+ func_800C9D0C((s32) playerId);
return;
}
} else {
@@ -3785,10 +3703,10 @@ block_97:
block_134:
*var_at = var_f10;
}
- } else if (temp_v0_12 < 4) {
+ } else if (temp_v0_7 < 4) {
if (temp_v1_3 >= 0x15F) {
if (temp_v1_3 == 0x0000015F) {
- func_800C9D0C(var_a0);
+ func_800C9D0C((s32) playerId);
return;
}
} else {
@@ -3797,7 +3715,7 @@ block_134:
}
} else if (temp_v1_3 >= 0x12D) {
if (temp_v1_3 == 0x0000012D) {
- func_800C97C4(var_a0);
+ func_800C97C4((s32) playerId);
return;
}
} else {
@@ -3810,14 +3728,14 @@ block_134:
if (D_800EA1C0 == (u8) 1) {
if (temp_v1_4 >= 0x65) {
if (temp_v1_4 == 0x00000065) {
- func_800C9D0C(var_a0);
+ func_800C9D0C((s32) playerId);
}
} else {
*(&D_800EA130 + sp38) = (f32) temp_v1_4 / 120.0f;
}
} else if (temp_v1_4 >= 0x65) {
if (temp_v1_4 == 0x00000065) {
- func_800C97C4(var_a0);
+ func_800C97C4((s32) playerId);
}
} else {
*(&D_800EA130 + sp38) = (f32) temp_v1_4 / 120.0f;
@@ -3827,7 +3745,7 @@ block_134:
temp_v1_5 = *sp34;
if (temp_v1_5 >= 0x12D) {
if (temp_v1_5 == 0x0000012D) {
- func_800C9D0C(0U);
+ func_800C9D0C(0);
return;
}
} else {
@@ -3839,7 +3757,7 @@ block_134:
temp_v1_6 = *sp34;
if (temp_v1_6 >= 0x65) {
if (temp_v1_6 == 0x00000065) {
- func_800C97C4(var_a0);
+ func_800C97C4((s32) playerId);
return;
}
} else {
@@ -3856,28 +3774,24 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C76C0.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? func_800C9018(s32, ?); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800C94A4(s32); /* extern */
-? func_800C97C4(s32); /* extern */
-? play_sound(s32, void *, s32, ? *, ? *, void *); /* extern */
-static ? D_800E9F74; /* unable to generate initializer; const */
-static ? D_800E9F7C; /* unable to generate initializer; const */
-static ? D_800EA0EC; /* unable to generate initializer; const */
-static u8 D_800EA1C0 = 0; /* const */
-static ? D_800EA1D4; /* unable to generate initializer; const */
s16 gCurrentCourseId; /* unable to generate initializer */
+static ? D_800E9F74; /* unable to generate initializer */
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA1C0 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
void func_800C847C(s32 playerId) {
Player *sp3C;
u8 *sp38;
Player *temp_t8;
- s16 temp_v0_2;
+ f32 *temp_a1;
+ f32 *temp_a1_2;
s32 temp_s0;
u8 *temp_v0;
- u8 *temp_v0_3;
- void *temp_a1;
- void *temp_a1_2;
+ u8 *temp_v0_2;
temp_s0 = playerId & 0xFF;
temp_t8 = &gPlayers[temp_s0];
@@ -3892,27 +3806,25 @@ void func_800C847C(s32 playerId) {
sp38 = temp_v0;
func_800C9018(temp_s0 & 0xFF, 0x01008026);
}
- sp38 = sp38;
func_800C97C4(temp_s0 & 0xFF);
*sp38 = 1;
func_800C94A4(temp_s0 & 0xFF);
- temp_v0_2 = gCurrentCourseId;
- if (((temp_v0_2 == 1) || (temp_v0_2 == 2) || (temp_v0_2 == 3) || (temp_v0_2 == 4) || (temp_v0_2 == 5) || (temp_v0_2 == 6) || (temp_v0_2 == 7) || (temp_v0_2 == 0x000C) || (temp_v0_2 == 0x0012) || (temp_v0_2 == 0x0013)) && (*(&D_800EA0EC + temp_s0) == 0)) {
+ if (((gCurrentCourseId == 1) || (gCurrentCourseId == 2) || (gCurrentCourseId == 3) || (gCurrentCourseId == 4) || (gCurrentCourseId == 5) || (gCurrentCourseId == 6) || (gCurrentCourseId == 7) || (gCurrentCourseId == 0x000C) || (gCurrentCourseId == 0x0012) || (gCurrentCourseId == 0x0013)) && (D_800EA0EC[temp_s0] == 0)) {
temp_a1 = (temp_s0 * 0x3C) + &D_800E9F7C;
- play_sound((sp3C->characterId * 0x10) + 0x29008005, temp_a1, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14);
+ play_sound((sp3C->characterId * 0x10) + 0x29008005, temp_a1, temp_s0 & 0xFF, D_800EA1D4, D_800EA1D4, temp_a1 + 0x14);
}
}
} else {
- temp_v0_3 = temp_s0 + &D_800E9F74;
- if (*temp_v0_3 == 1) {
- sp38 = temp_v0_3;
+ temp_v0_2 = temp_s0 + &D_800E9F74;
+ if (*temp_v0_2 == 1) {
+ sp38 = temp_v0_2;
func_800C97C4(temp_s0 & 0xFF);
- *temp_v0_3 = 2;
+ *temp_v0_2 = 2;
func_800C94A4(temp_s0 & 0xFF);
- *temp_v0_3 = 0;
- if ((gCurrentCourseId == 6) && (*(&D_800EA0EC + temp_s0) == 0)) {
+ *temp_v0_2 = 0;
+ if ((gCurrentCourseId == 6) && (D_800EA0EC[temp_s0] == 0)) {
temp_a1_2 = (temp_s0 * 0x3C) + &D_800E9F7C;
- play_sound((sp3C->characterId * 0x10) + 0x29008008, temp_a1_2, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1_2 + 0x14);
+ play_sound((sp3C->characterId * 0x10) + 0x29008008, temp_a1_2, temp_s0 & 0xFF, D_800EA1D4, D_800EA1D4, temp_a1_2 + 0x14);
}
}
}
@@ -3960,13 +3872,12 @@ void func_800C8770(u8 playerId) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800CAC08(); // extern
-extern u8 D_800EA168;
-extern Player gPlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800CAC08(); /* extern */
+static u8 D_800EA168 = 0;
void func_800C8920(void) {
- if ((D_800EA168 != 0) && ((gPlayers.unkBC & 0x40000000) != 0x40000000) && ((gPlayers.unkE94 & 0x40000000) != 0x40000000) && ((gPlayers.unk1C6C & 0x40000000) != 0x40000000) && ((gPlayers.unk2A44 & 0x40000000) != 0x40000000) && ((gPlayers.unk381C & 0x40000000) != 0x40000000) && ((gPlayers.unk45F4 & 0x40000000) != 0x40000000) && ((gPlayers.unk53CC & 0x40000000) != 0x40000000) && ((gPlayers.unk61A4 & 0x40000000) != 0x40000000)) {
+ if ((D_800EA168 != 0) && ((gPlayers->unk_0BC & 0x40000000) != 0x40000000) && ((gPlayers->unkE94 & 0x40000000) != 0x40000000) && ((gPlayers->unk1C6C & 0x40000000) != 0x40000000) && ((gPlayers->unk2A44 & 0x40000000) != 0x40000000) && ((gPlayers->unk381C & 0x40000000) != 0x40000000) && ((gPlayers->unk45F4 & 0x40000000) != 0x40000000) && ((gPlayers->unk53CC & 0x40000000) != 0x40000000) && ((gPlayers->unk61A4 & 0x40000000) != 0x40000000)) {
func_800CAC08();
}
}
@@ -4061,89 +3972,76 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C8AE4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_800E9F54;
-extern ? D_800EA06C;
-extern ? D_800EA130;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+f32 D_800E9F54[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+struct Unk_800EA06C D_800EA06C[8]; /* unable to generate initializer */
+static f32 D_800EA130[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
void func_800C8C7C(s32 arg0) {
s32 temp_t6;
- s32 temp_v0;
temp_t6 = arg0 & 0xFF;
- temp_v0 = temp_t6 * 4;
- *(&D_800EA06C + 8 + (temp_t6 * 0x10)) = (1.0f - *(&D_800E9F54 + temp_v0)) - *(&D_800EA130 + temp_v0);
+ *(&D_800EA06C->unk00[2] + (temp_t6 * 0x10)) = (1.0f - D_800E9F54[temp_t6]) - D_800EA130[temp_t6];
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C8C7C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C5D04(s32); // extern
-void func_800C5E38(s32); // extern
-void func_800C6108(s32); // extern
-void func_800C64A0(s32); // extern
-void func_800C6758(s32); // extern
-void func_800C683C(s32); // extern
-void func_800C70A8(s32); // extern
-void func_800C76C0(s32); // extern
-void func_800C847C(s32); // extern
-void func_800C86D8(s32); // extern
-void func_800C8770(s32); // extern
-void func_800C8920(); // extern
-void func_800C89E4(); // extern
-void func_800C8AE4(); // extern
-void func_800C8C7C(s32); // extern
-extern u8 D_800EA1C0;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C5D04(s32); /* extern */
+? func_800C5E38(s32); /* extern */
+? func_800C6108(s32); /* extern */
+? func_800C64A0(s32); /* extern */
+? func_800C683C(s32); /* extern */
+? func_800C70A8(s32); /* extern */
+? func_800C76C0(s32); /* extern */
+? func_800C847C(s32); /* extern */
+? func_800C8920(); /* extern */
+? func_800C8AE4(); /* extern */
+? func_800C8C7C(s32); /* extern */
+u8 D_800EA1C0 = 0;
void func_800C8CCC(void) {
s32 temp_t6;
s32 temp_t8;
s32 temp_t9;
- s32 temp_v0;
- s32 temp_v0_2;
- s32 phi_s0;
- s32 phi_s0_2;
- s32 phi_v0;
- s32 phi_s0_3;
-
- temp_v0 = D_800EA1C0 + 1;
- phi_s0 = 0;
- phi_v0 = temp_v0;
- if (temp_v0 > 0) {
+ s32 var_s0;
+ s32 var_v0;
+
+ var_v0 = D_800EA1C0 + 1;
+ var_s0 = 0;
+ if (var_v0 > 0) {
do {
- func_800C5D04(phi_s0 & 0xFF);
- func_800C5E38(phi_s0 & 0xFF);
- func_800C6108(phi_s0 & 0xFF);
- func_800C64A0(phi_s0 & 0xFF);
- func_800C6758(phi_s0 & 0xFF);
- func_800C683C(phi_s0 & 0xFF);
- func_800C70A8(phi_s0 & 0xFF);
- func_800C76C0(phi_s0 & 0xFF);
- func_800C847C(phi_s0 & 0xFF);
- func_800C86D8(phi_s0 & 0xFF);
- temp_t6 = (phi_s0 + 1) & 0xFF;
- temp_v0_2 = D_800EA1C0 + 1;
- phi_s0 = temp_t6;
- phi_v0 = temp_v0_2;
- } while (temp_t6 < temp_v0_2);
+ func_800C5D04(var_s0 & 0xFF);
+ func_800C5E38(var_s0 & 0xFF);
+ func_800C6108(var_s0 & 0xFF);
+ func_800C64A0(var_s0 & 0xFF);
+ func_800C6758(var_s0 & 0xFF);
+ func_800C683C(var_s0 & 0xFF);
+ func_800C70A8(var_s0 & 0xFF);
+ func_800C76C0(var_s0 & 0xFF);
+ func_800C847C(var_s0 & 0xFF);
+ func_800C86D8(var_s0 & 0xFF);
+ temp_t6 = (var_s0 + 1) & 0xFF;
+ var_v0 = D_800EA1C0 + 1;
+ var_s0 = temp_t6;
+ } while (temp_t6 < var_v0);
+ var_s0 = 0;
}
- phi_s0_2 = 0;
- phi_s0_3 = 0;
- if (gModeSelection == GRAND_PRIX) {
+ if (gModeSelection == 0) {
do {
- func_800C8770(phi_s0_2 & 0xFF);
- func_800C8C7C(phi_s0_2 & 0xFF);
- temp_t8 = (phi_s0_2 + 1) & 0xFF;
- phi_s0_2 = temp_t8;
+ func_800C8770(var_s0 & 0xFF);
+ func_800C8C7C(var_s0 & 0xFF);
+ temp_t8 = (var_s0 + 1) & 0xFF;
+ var_s0 = temp_t8;
} while (temp_t8 < 8);
- } else if (phi_v0 > 0) {
+ } else if (var_v0 > 0) {
do {
- func_800C8770(phi_s0_3 & 0xFF);
- func_800C8C7C(phi_s0_3 & 0xFF);
- temp_t9 = (phi_s0_3 + 1) & 0xFF;
- phi_s0_3 = temp_t9;
+ func_800C8770(var_s0 & 0xFF);
+ func_800C8C7C(var_s0 & 0xFF);
+ temp_t9 = (var_s0 + 1) & 0xFF;
+ var_s0 = temp_t9;
} while (temp_t9 < (D_800EA1C0 + 1));
}
func_800C8920();
@@ -4181,22 +4079,21 @@ void func_800C8F44(u8 arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void play_sound(s32, void *, s32, ? *, ? *, ? *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern ? D_800EA1D4;
-extern ? D_800EA1DC;
-
-void func_800C8F80(s32 arg0, s32 arg1) {
- s32 temp_a2;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+u8 D_800EA1DC = 0;
+
+void func_800C8F80(u8 arg0, s32 arg1) {
u8 *temp_v1;
+ u8 temp_a2;
u8 temp_v0;
temp_a2 = arg0 & 0xFF;
if (D_800EA108 == 0) {
- temp_v1 = temp_a2 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a2];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
@@ -4205,7 +4102,7 @@ void func_800C8F80(s32 arg0, s32 arg1) {
}
} else {
block_4:
- play_sound(arg1, (temp_a2 * 0x3C) + &D_800E9F7C, temp_a2, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC);
+ play_sound((u32) arg1, (temp_a2 * 0x3C) + &D_800E9F7C, temp_a2, D_800EA1D4, D_800EA1D4, &D_800EA1DC);
}
}
}
@@ -4232,22 +4129,21 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9018.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void play_sound(s32, void *, s32, ? *, ? *, void *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern ? D_800EA1D4;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
-void func_800C9060(s32 arg0, s32 arg1) {
- s32 temp_a2;
+void func_800C9060(u8 arg0, u32 arg1) {
+ f32 *temp_a1;
u8 *temp_v1;
+ u8 temp_a2;
u8 temp_v0;
- void *temp_a1;
temp_a2 = arg0 & 0xFF;
if (D_800EA108 == 0) {
- temp_v1 = temp_a2 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a2];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
@@ -4257,7 +4153,7 @@ void func_800C9060(s32 arg0, s32 arg1) {
} else {
block_4:
temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
- play_sound(arg1, temp_a1, temp_a2, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14);
+ play_sound(arg1, temp_a1, temp_a2, D_800EA1D4, D_800EA1D4, temp_a1 + 0x14);
}
}
}
@@ -4266,50 +4162,46 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9060.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void play_sound(s32, void *, s32, ? *, ? *, void *); // extern
-extern ? D_800E9F2C;
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern ? D_800EA150;
-extern s16 D_800EA180;
-extern ? D_800EA1D4;
-extern Player gPlayers;
-
-void func_800C90F4(s32 arg0, s32 arg1) {
- s32 temp_a2;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+u8 D_800E9F2C[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+static f32 D_800EA150 = 1.4f;
+u16 D_800EA180 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+
+void func_800C90F4(u8 arg0, u32 arg1) {
+ f32 *temp_a1;
+ f32 *temp_a1_2;
s32 temp_t9;
u8 *temp_v1;
+ u8 temp_a2;
u8 temp_v0;
- void *temp_a1;
- void *temp_a1_2;
temp_a2 = arg0 & 0xFF;
if (D_800EA108 == 0) {
- temp_v1 = temp_a2 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a2];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
*temp_v1 = 1;
goto block_4;
}
- // Duplicate return node #12. Try simplifying control flow for better match
- return;
- }
+ } else {
block_4:
- temp_t9 = arg1 & ~0xF0;
- if ((temp_t9 == 0x29008003) || (temp_t9 == 0x29008004) || (temp_t9 == 0x29008005)) {
- D_800EA180 = 1;
- }
- if (((*(&gPlayers + 0xBC + (temp_a2 * 0xDD8)) & 0x40000000) == 0x40000000) && (*(&D_800E9F2C + temp_a2) >= 0x1F)) {
- temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
- play_sound(arg1, temp_a1, temp_a2, &D_800EA150, &D_800EA1D4, temp_a1 + 0x14);
- return;
+ temp_t9 = arg1 & ~0xF0;
+ if ((temp_t9 == 0x29008003) || (temp_t9 == 0x29008004) || (temp_t9 == 0x29008005)) {
+ D_800EA180 = 1;
+ }
+ if (((*(&gPlayers->unk_0BC + (temp_a2 * 0xDD8)) & 0x40000000) == 0x40000000) && ((s32) D_800E9F2C[temp_a2] >= 0x1F)) {
+ temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
+ play_sound(arg1, temp_a1, temp_a2, &D_800EA150, D_800EA1D4, temp_a1 + 0x14);
+ return;
+ }
+ temp_a1_2 = (temp_a2 * 0x3C) + &D_800E9F7C;
+ play_sound(arg1, temp_a1_2, temp_a2, D_800EA1D4, D_800EA1D4, temp_a1_2 + 0x14);
}
- temp_a1_2 = (temp_a2 * 0x3C) + &D_800E9F7C;
- play_sound(arg1, temp_a1_2, temp_a2, &D_800EA1D4, &D_800EA1D4, temp_a1_2 + 0x14);
- // Duplicate return node #12. Try simplifying control flow for better match
}
}
#else
@@ -4317,16 +4209,12 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C90F4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C90F4(s32, s32); // extern
-extern s32 gAudioRandom;
-extern Player gPlayers;
-
-void func_800C9250(s32 arg0) {
- s32 temp_t6;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+void func_800C9250(u8 arg0) {
+ u8 temp_t6;
temp_t6 = arg0 & 0xFF;
- func_800C90F4(temp_t6, (*(&gPlayers + 0x254 + (temp_t6 * 0xDD8)) * 0x10) + (gAudioRandom & 1) + 0x29008001);
+ func_800C90F4(temp_t6, (*(&gPlayers->characterId + (temp_t6 * 0xDD8)) * 0x10) + (gAudioRandom & 1) + 0x29008001);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9250.s")
@@ -4500,24 +4388,22 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C94A4.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C5578(void *, s32, s32); // extern
-extern ? D_800E9F7C;
-extern Player gPlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ? D_800E9F7C; /* unable to generate initializer */
void func_800C97C4(s32 arg0) {
+ Player *temp_s1;
+ f32 *temp_s0;
s32 temp_a2;
- void *temp_s0;
- void *temp_s1;
temp_a2 = arg0 & 0xFF;
- temp_s1 = (temp_a2 * 0xDD8) + &gPlayers;
+ temp_s1 = &gPlayers[temp_a2];
temp_s0 = (temp_a2 * 0x3C) + &D_800E9F7C;
- func_800C5578(temp_s0, temp_s1->unk254 + 0x104FF00, temp_a2);
- func_800C5578(temp_s0, temp_s1->unk254 + 0x104FF14);
- func_800C5578(temp_s0, temp_s1->unk254 + 0x104FF2E);
- func_800C5578(temp_s0, temp_s1->unk254 + 0x104FF36);
- func_800C5578(temp_s0, temp_s1->unk254 + 0x104FF3E);
+ func_800C5578(temp_s0, temp_s1->characterId + 0x0104FF00);
+ func_800C5578(temp_s0, temp_s1->characterId + 0x0104FF14);
+ func_800C5578(temp_s0, temp_s1->characterId + 0x0104FF2E);
+ func_800C5578(temp_s0, temp_s1->characterId + 0x0104FF36);
+ func_800C5578(temp_s0, temp_s1->characterId + 0x0104FF3E);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C97C4.s")
@@ -4556,27 +4442,25 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C98B8.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800C21E8(s32, ?); // extern
-void func_800C5578(s32, ?); // extern
-extern u8 D_800EA108;
-extern u8 D_800EA1C0;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+u8 D_800EA108 = 0;
+u8 D_800EA1C0 = 0;
-void func_800C99E0(Vec3f arg0, s32 arg1) {
+void func_800C99E0(f32 *arg0, s32 arg1) {
+ f32 *temp_v0;
s32 temp_t9;
- s32 temp_v0;
- s32 phi_s0;
+ s32 var_s0;
if (D_800EA108 == 0) {
- phi_s0 = 0;
+ var_s0 = 0;
if ((D_800EA1C0 + 1) > 0) {
do {
- temp_v0 = func_800C21E8(arg0, arg1);
- if (temp_v0 != 0) {
- func_800C5578(temp_v0, arg1);
+ temp_v0 = func_800C21E8(arg0, (u32) arg1);
+ if (temp_v0 != NULL) {
+ func_800C5578(temp_v0, (u32) arg1);
}
- temp_t9 = (phi_s0 + 1) & 0xFF;
- phi_s0 = temp_t9;
+ temp_t9 = (var_s0 + 1) & 0xFF;
+ var_s0 = temp_t9;
} while (temp_t9 < (D_800EA1C0 + 1));
}
}
@@ -4749,78 +4633,44 @@ void func_800CA0E4(void) {
}
#ifdef MIPS_TO_C
- switch(D_800EA1C0) {
- case 0:
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- break;
- case 1:
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1)) {
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- }
- break;
- case 2:
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1)) {
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- }
- break;
- case 3:
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1) && (D_800EA0EC.unk3 == 1)) {
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- }
- break;
- }
-}
-
-
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800CA0E4(? *, s8); // extern
-extern ? D_800E9EA4;
-extern ? D_800EA0EC;
-extern s8 D_800EA0F0;
-extern u8 D_800EA1C0;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static s32 D_800E9EA4[4] = { 0, 0, 0, 0 };
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA0F0 = 0;
+u8 D_800EA1C0 = 0;
void func_800CA118(s32 arg0) {
s32 temp_t6;
- u8 temp_v0;
temp_t6 = arg0 & 0xFF;
- *(&D_800EA0EC + temp_t6) = 1;
- temp_v0 = D_800EA1C0;
- *(&D_800E9EA4 + (temp_t6 * 4)) = 1;
- if (temp_v0 != 0) {
- if (temp_v0 != 1) {
- if (temp_v0 != 2) {
- if (temp_v0 != 3) {
- return;
- }
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1) && (D_800EA0EC.unk3 == 1)) {
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- }
- // Duplicate return node #18. Try simplifying control flow for better match
- return;
- }
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1)) {
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
- return;
- }
- // Duplicate return node #18. Try simplifying control flow for better match
+ D_800EA0EC[temp_t6] = 1;
+ D_800E9EA4[temp_t6] = 1;
+ switch (D_800EA1C0) { /* irregular */
+ case 0:
+ D_800EA0F0 = 1;
+ func_800CA0E4(D_800EA0EC, 1U);
+ return;
+ case 1:
+ if ((D_800EA0EC->unk0 == (u8) 1) && (D_800EA0EC->unk1 == (u8) 1)) {
+ D_800EA0F0 = 1;
+ func_800CA0E4(D_800EA0EC, 1U);
return;
}
- if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1)) {
+ return;
+ case 2:
+ if ((D_800EA0EC->unk0 == (u8) 1) && (D_800EA0EC->unk1 == (u8) 1) && (D_800EA0EC->unk2 == (u8) 1)) {
D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
+ func_800CA0E4(D_800EA0EC, 1U);
return;
}
- return;
+ break;
+ case 3:
+ if ((D_800EA0EC->unk0 == (u8) 1) && (D_800EA0EC->unk1 == (u8) 1) && (D_800EA0EC->unk2 == (u8) 1) && (D_800EA0EC->unk3 == (u8) 1)) {
+ D_800EA0F0 = 1;
+ func_800CA0E4(D_800EA0EC, 1U);
+ }
+ break;
}
- D_800EA0F0 = 1;
- func_800CA0E4(&D_800EA0EC, 1);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA118.s")
@@ -4897,52 +4747,45 @@ void func_800CA49C(u8 arg0) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C3448(?); // extern
-s32 func_800C3508(?, ?); // extern
-s32 func_800C357C(?); // extern
-void func_800C8EF8(?, ?); // extern
-void func_800C8F80(u8, ?); // extern
-void play_sound(s32, void *, u8, ? *, ? *, void *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA104;
-extern u8 D_800EA108;
-extern ? D_800EA10C;
-extern s8 D_800EA164;
-extern u8 D_800EA1C0;
-extern ? D_800EA1D4;
-extern u8 D_8018FC08;
-extern Player gPlayers;
-
-void func_800CA59C(u8 arg0) {
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s32 func_800C357C(?); /* extern */
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA104 = 0;
+u8 D_800EA108 = 0;
+static ? D_800EA10C; /* unable to generate initializer */
+u8 D_800EA164 = 0;
+u8 D_800EA1C0 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+
+void func_800CA59C(u8 playerId) {
+ f32 *temp_a1;
u8 temp_a2;
- void *temp_a1;
- temp_a2 = arg0 & 0xFF;
- if ((*(&D_800EA0EC + temp_a2) == 0) && (D_800EA108 == 0)) {
+ temp_a2 = playerId & 0xFF;
+ if ((D_800EA0EC[temp_a2] == 0) && (D_800EA108 == 0)) {
temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
- arg0 = temp_a2;
- play_sound((*(&gPlayers + 0x254 + (temp_a2 * 0xDD8)) * 0x10) + 0x29008001, temp_a1, temp_a2, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14);
+ playerId = temp_a2;
+ play_sound((*(&gPlayers->characterId + (temp_a2 * 0xDD8)) * 0x10) + 0x29008001, temp_a1, temp_a2, D_800EA1D4, D_800EA1D4, temp_a1 + 0x14);
D_800EA164 = 1;
- if (D_800EA1C0 >= 2) {
- func_800C8F80(arg0, 0x100FF2C);
+ if ((s32) D_800EA1C0 >= 2) {
+ func_800C8F80(playerId, 0x0100FF2C);
} else {
func_800C3448(0x100100FF);
if (D_800EA104 != 0) {
- func_800C8F80(arg0, 0x100FF2C);
+ func_800C8F80(playerId, 0x0100FF2C);
} else if (D_8018FC08 != 0) {
- if ((func_800C3508(1, 0x100FF2C) == 0xC) || (func_800C357C(0x101000C) == 0)) {
- func_800C3448(0xC1F00000);
- func_800C3448(0xC1510011);
+ if ((func_800C3508(1) == 0x000C) || (func_800C357C(0x0101000C) == 0)) {
+ func_800C3448(-0x3E100000);
+ func_800C3448(-0x3EAEFFEF);
} else {
- func_800C8EF8(0x11);
+ func_800C8EF8(0x0011U);
}
} else {
- func_800C8EF8(0x11, 0x100FF2C);
+ func_800C8EF8(0x0011U);
}
}
- *(&D_800EA10C + arg0) = 1;
+ *(&D_800EA10C + playerId) = 1;
}
}
#else
@@ -4950,65 +4793,58 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA59C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C3448(s32, ?, u8); // extern
-s32 func_800C3508(?, ?, u8); // extern
-s32 func_800C357C(?); // extern
-void func_800C3608(?, ?, u8); // extern
-void func_800C8EAC(u16); // extern
-void func_800C9018(s32, ?, u8); // extern
-void play_sound(s32, void *, u8, ? *, ? *, void *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA104;
-extern u8 D_800EA108;
-extern ? D_800EA10C;
-extern u16 D_800EA15C;
-extern s8 D_800EA164;
-extern u8 D_800EA1C0;
-extern ? D_800EA1D4;
-extern u8 D_8018FC08;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s32 func_800C357C(?); /* extern */
+? func_800C3608(?, ?, u8); /* extern */
extern u32 D_803B1658;
-extern Player gPlayers;
-
-void func_800CA730(u8 arg0) {
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA104 = 0;
+u8 D_800EA108 = 0;
+static ? D_800EA10C; /* unable to generate initializer */
+u16 D_800EA15C = 0;
+u8 D_800EA164 = 0;
+u8 D_800EA1C0 = 0;
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+
+void func_800CA730(u8 playerId) {
u8 *sp3C;
+ f32 *temp_a1;
u8 *temp_v1;
u8 temp_a2;
- void *temp_a1;
- temp_a2 = arg0 & 0xFF;
- if (*(&D_800EA0EC + temp_a2) == 0) {
+ temp_a2 = playerId & 0xFF;
+ if (D_800EA0EC[temp_a2] == 0) {
temp_v1 = &D_800EA10C + temp_a2;
if ((D_800EA108 == 0) && (*temp_v1 != 0)) {
temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
sp3C = temp_v1;
- arg0 = temp_a2;
- play_sound((*(&gPlayers + 0x254 + (temp_a2 * 0xDD8)) * 0x10) + 0x29008008, temp_a1, temp_a2, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14);
+ playerId = temp_a2;
+ play_sound((*(&gPlayers->characterId + (temp_a2 * 0xDD8)) * 0x10) + 0x29008008, temp_a1, temp_a2, D_800EA1D4, D_800EA1D4, temp_a1 + 0x14);
if (*sp3C != 0) {
- if (D_800EA1C0 >= 2) {
- func_800C9018(arg0 & 0xFF, 0x100FF2C, arg0);
+ if ((s32) D_800EA1C0 >= 2) {
+ func_800C9018(playerId & 0xFF, 0x0100FF2C);
} else {
*sp3C = 0;
if (D_800EA104 != 0) {
- func_800C9018(arg0 & 0xFF, 0x100FF2C, arg0);
+ func_800C9018(playerId & 0xFF, 0x0100FF2C);
} else if ((D_800EA10C.unk0 == 0) && (D_800EA10C.unk1 == 0)) {
if (D_8018FC08 != 0) {
- if ((D_803B1658 >> 0x1F) == 0) {
- func_800C3608(1, 5, arg0);
+ if (((u32) D_803B1658 >> 0x1F) == 0) {
+ func_800C3608(1, 5, playerId);
func_800C8EAC(D_800EA15C);
func_800C3448(0xB001307D);
- } else if ((func_800C3508(1, 0x1000000, arg0) == 0xC) || (func_800C357C(0x101000C) == 0)) {
- func_800C3448(0xC1F00000);
+ } else if ((func_800C3508(1) == 0x000C) || (func_800C357C(0x0101000C) == 0)) {
+ func_800C3448(-0x3E100000);
func_800C3448(D_800EA15C | 0xC1500000);
- func_800C3448(0xC130017D);
+ func_800C3448(-0x3ECFFE83);
} else {
func_800C3448(0x110100FF);
func_800C8EAC(D_800EA15C);
func_800C3448(0xB001307D);
}
} else {
- func_800C3448(0x110100FF, 0x1000000, arg0);
+ func_800C3448(0x110100FF);
func_800C8EAC(D_800EA15C);
}
}
@@ -5063,23 +4899,20 @@ void func_800CAACC(u8 playerId) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C36C4(?, ?, ?, ?); // extern
-void func_800C9060(u8, ?); // extern
-void play_sound(?, ? *, ?, ? *, ? *, ? *); // extern
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern s8 D_800EA168;
-extern ? D_800EA1C8;
-extern ? D_800EA1D4;
-extern ? D_800EA1DC;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+static s8 D_800EA168 = 0;
+f32 D_800EA1C8[3] = { 0.0f, 0.0f, 0.0f };
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+u8 D_800EA1DC = 0;
void func_800CAB4C(u8 arg0) {
u8 *temp_v1;
u8 temp_v0;
if (D_800EA108 == 0) {
- temp_v1 = arg0 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[arg0];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
@@ -5088,9 +4921,9 @@ void func_800CAB4C(u8 arg0) {
}
} else {
block_4:
- func_800C36C4(0, 1, 0x55, 5);
- func_800C9060(arg0, 0x1900F013);
- play_sound(SOUND_ITEM_THUNDERBOLT, &D_800EA1C8, 0, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC);
+ func_800C36C4(0, 1U, 0x55U, 5);
+ func_800C9060(arg0, 0x1900F013U);
+ play_sound(0x5101C00CU, D_800EA1C8, 0U, D_800EA1D4, D_800EA1D4, &D_800EA1DC);
}
D_800EA168 = 1;
}
@@ -5100,15 +4933,14 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CAB4C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C36C4(?, ?, ?, ?); // extern
-void func_800C56F0(?); // extern
-extern u8 D_800EA108;
-extern s8 D_800EA168;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C56F0(?); /* extern */
+u8 D_800EA108 = 0;
+static s8 D_800EA168 = 0;
void func_800CAC08(void) {
if (D_800EA108 == 0) {
- func_800C36C4(0, 1, 0x7F, 0x19);
+ func_800C36C4(0, 1U, 0x7FU, 0x19);
func_800C56F0(0x5101C00C);
D_800EA168 = 0;
}
@@ -5148,29 +4980,24 @@ void func_800CAD40(UNUSED s32 arg0) {
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void play_sound(f32, ?, void *, s32, ? *, f32 *, void *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern ? D_800EA110;
-extern ? D_800EA1D4;
-extern f32 D_800F39A8;
-extern f32 D_800F39AC;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+static f32 D_800EA110[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+f32 D_800EA1D4[3]; /* unable to generate initializer */
void func_800CADD0(s32 arg0, f32 arg1) {
+ f32 *temp_a1;
f32 *temp_v0_2;
- f32 temp_f12;
- s32 temp_a2;
+ f32 var_f12;
u8 *temp_v1;
+ u8 temp_a2;
u8 temp_v0;
- void *temp_a1;
- f32 phi_f12;
- f32 phi_f12_2;
temp_a2 = arg0 & 0xFF;
if (D_800EA108 == 0) {
- temp_v1 = temp_a2 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a2];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
@@ -5179,19 +5006,17 @@ void func_800CADD0(s32 arg0, f32 arg1) {
}
} else {
block_4:
- temp_f12 = (arg1 * D_800F39A8) + D_800F39AC;
+ var_f12 = (arg1 * 0.55f) + 0.45f;
temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
- temp_v0_2 = (temp_a2 * 4) + &D_800EA110;
- phi_f12 = temp_f12;
- if (temp_f12 > 1.0f) {
- phi_f12 = 1.0f;
+ temp_v0_2 = &D_800EA110[temp_a2];
+ if (var_f12 > 1.0f) {
+ var_f12 = 1.0f;
}
- phi_f12_2 = phi_f12;
- if (phi_f12 < 0.0f) {
- phi_f12_2 = 0.0f;
+ if (var_f12 < 0.0f) {
+ var_f12 = 0.0f;
}
- *temp_v0_2 = phi_f12_2;
- play_sound(phi_f12_2, 0x1900A209, temp_a1, temp_a2, &D_800EA1D4, temp_v0_2, temp_a1 + 0x14);
+ *temp_v0_2 = var_f12;
+ play_sound(0x1900A209U, temp_a1, temp_a2, D_800EA1D4, temp_v0_2, temp_a1 + 0x14);
}
}
}
@@ -5200,29 +5025,25 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CADD0.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void play_sound(f32, s32, void *, s32, ? *, f32 *, void *); // extern
-extern ? D_800E9F7C;
-extern ? D_800EA0EC;
-extern u8 D_800EA108;
-extern ? D_800EA120;
-extern ? D_800EA1D4;
-extern f32 D_800F39B0;
-extern f32 D_800F39B4;
-
-void func_800CAEC4(s32 arg0, f32 arg1) {
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s16 gCurrentCourseId; /* unable to generate initializer */
+static ? D_800E9F7C; /* unable to generate initializer */
+u8 D_800EA0EC[1] = { 0 };
+u8 D_800EA108 = 0;
+static f32 D_800EA120[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+f32 D_800EA1D4[3]; /* unable to generate initializer */
+
+void func_800CAEC4(u8 arg0, f32 arg1) {
+ f32 *temp_a1;
f32 *temp_v0_2;
- f32 temp_f12;
- s32 temp_a2;
+ f32 var_f12;
u8 *temp_v1;
+ u8 temp_a2;
u8 temp_v0;
- void *temp_a1;
- f32 phi_f12;
- f32 phi_f12_2;
temp_a2 = arg0 & 0xFF;
if (D_800EA108 == 0) {
- temp_v1 = temp_a2 + &D_800EA0EC;
+ temp_v1 = &D_800EA0EC[temp_a2];
temp_v0 = *temp_v1;
if (temp_v0 != 0) {
if (temp_v0 == 2) {
@@ -5231,19 +5052,17 @@ void func_800CAEC4(s32 arg0, f32 arg1) {
}
} else {
block_4:
- temp_f12 = (arg1 * D_800F39B0) + D_800F39B4;
- temp_v0_2 = (temp_a2 * 4) + &D_800EA120;
+ var_f12 = (arg1 * 0.7f) + 0.1f;
+ temp_v0_2 = &D_800EA120[temp_a2];
temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C;
- phi_f12 = temp_f12;
- if (temp_f12 > 1.0f) {
- phi_f12 = 1.0f;
+ if (var_f12 > 1.0f) {
+ var_f12 = 1.0f;
}
- phi_f12_2 = phi_f12;
- if (phi_f12 < 0.0f) {
- phi_f12_2 = 0.0f;
+ if (var_f12 < 0.0f) {
+ var_f12 = 0.0f;
}
- *temp_v0_2 = phi_f12_2;
- play_sound(phi_f12_2, gCurrentCourseId + 0x19007020, temp_a1, temp_a2, &D_800EA1D4, temp_v0_2, temp_a1 + 0x14);
+ *temp_v0_2 = var_f12;
+ play_sound(gCurrentCourseId + 0x19007020, temp_a1, temp_a2, D_800EA1D4, temp_v0_2, temp_a1 + 0x14);
}
}
}
@@ -5271,14 +5090,10 @@ void func_800CAFC0(u8 arg0) {
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C36C4(?, ?, ?, ?); // extern
-void func_800C9018(u8, ?); // extern
-void func_800C90F4(u8, s32); // extern
-extern u8 D_800EA108;
-extern u8 D_800EA168;
-extern ? D_800EA170;
-extern Player gPlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+u8 D_800EA108 = 0;
+static u8 D_800EA168 = 0;
+static ? D_800EA170; /* unable to generate initializer */
void func_800CB064(u8 arg0) {
u8 *sp34;
@@ -5289,10 +5104,10 @@ void func_800CB064(u8 arg0) {
sp34 = temp_t9;
if (*temp_t9 == 1) {
if (D_800EA168 == 0) {
- func_800C36C4(0, 1, 0x7F, 0x19);
+ func_800C36C4(0, 1U, 0x7FU, 0x19);
}
- func_800C90F4(arg0, (*(&gPlayers + 0x254 + (arg0 * 0xDD8)) * 0x10) + 0x29008008);
- func_800C9018(arg0, 0x100FA4C);
+ func_800C90F4(arg0, (*(&gPlayers->characterId + (arg0 * 0xDD8)) * 0x10) + 0x29008008);
+ func_800C9018(arg0, 0x0100FA4C);
*sp34 = 0;
}
}
@@ -5306,74 +5121,55 @@ void func_800CB134() {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800C3448(?); // extern
-void func_800C8EAC(?); // extern
-void func_800C8EF8(?); // extern
-extern u16 D_800EA174;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s16 D_800EA174 = 0;
void func_800CB14C(void) {
- u16 temp_t6;
- u16 temp_v0;
- u16 temp_v1;
- u16 phi_v0;
- u16 phi_v0_2;
- u16 phi_v0_3;
- u16 phi_v0_4;
- u16 phi_v0_5;
- u16 phi_v0_6;
- u16 phi_v0_7;
-
- temp_v1 = D_800EA174;
- if (temp_v1 != 0) {
- temp_t6 = temp_v1 + 1;
- temp_v0 = temp_t6 & 0xFFFF;
+ s16 temp_t6;
+ u16 var_v0;
+
+ if ((u16) D_800EA174 != 0) {
+ temp_t6 = (u16) D_800EA174 + 1;
+ var_v0 = temp_t6 & 0xFFFF;
D_800EA174 = temp_t6;
- phi_v0 = temp_v0;
- if (temp_v0 == 3) {
- func_800C8EAC(0x1A);
+ if (var_v0 == 3) {
+ func_800C8EAC(0x001AU);
func_800C3448(0x4000007F);
- phi_v0 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_2 = phi_v0;
- if (phi_v0 == 0x12C) {
- func_800C8EAC(0x1B);
+ if (var_v0 == 0x012C) {
+ func_800C8EAC(0x001BU);
func_800C3448(0x4000007F);
- func_800C8EF8(0x1D);
+ func_800C8EF8(0x001DU);
func_800C3448(0x41000000);
- phi_v0_2 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_3 = phi_v0_2;
- if (phi_v0_2 == 0x230) {
+ if (var_v0 == 0x0230) {
func_800C3448(0x40640000);
func_800C3448(0xB0640073);
func_800C3448(0x4150007F);
func_800C3448(0xB1640073);
- phi_v0_3 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_4 = phi_v0_3;
- if (phi_v0_3 == 0x2A8) {
+ if (var_v0 == 0x02A8) {
func_800C3448(0x100100FF);
- phi_v0_4 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_5 = phi_v0_4;
- if (phi_v0_4 == 0x41A) {
+ if (var_v0 == 0x041A) {
func_800C3448(0xB1500001);
func_800C3448(0x51500001);
- phi_v0_5 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_6 = phi_v0_5;
- if (phi_v0_5 == 0x46A) {
+ if (var_v0 == 0x046A) {
func_800C3448(0x41320000);
- phi_v0_6 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- phi_v0_7 = phi_v0_6;
- if (phi_v0_6 == 0x4B0) {
+ if (var_v0 == 0x04B0) {
func_800C3448(0x110100FF);
- phi_v0_7 = D_800EA174;
+ var_v0 = (u16) D_800EA174;
}
- if (phi_v0_7 == 0x4CE) {
- func_800C8EAC(0x14);
+ if (var_v0 == 0x04CE) {
+ func_800C8EAC(0x0014U);
func_800C3448(0x4000007F);
}
}
diff --git a/src/audio/heap.c b/src/audio/heap.c
index 97bedd2e3..22f3d036d 100644
--- a/src/audio/heap.c
+++ b/src/audio/heap.c
@@ -198,36 +198,27 @@ void temporary_pools_init(struct PoolSplit *a) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? discard_bank(s16, s32, s16, struct TemporaryPool *); /* extern */
-? discard_sequence(s16, s32); /* extern */
-extern ? gUnkLoadStatus;
-extern ? gBankLoadStatus;
-extern ? gSeqLoadStatus;
-extern void *gNotes;
-extern ? gSequencePlayers;
-extern ? gSequenceChannels;
-
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-15-2023
void *func_800B93BC(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id) {
- ? *sp34;
+ u8 *sp34;
u8 sp33;
struct TemporaryPool *sp28;
struct SoundAllocPool *sp24;
s32 sp20;
- ? *var_v0_4;
- ? *var_v0_5;
s16 temp_a0;
s16 temp_a2;
s16 temp_v1_2;
- s32 temp_a1;
- s32 temp_a1_2;
- s32 temp_a1_3;
- s32 temp_a1_4;
s32 var_a3;
s32 var_v1_2;
s32 var_v1_3;
s32 var_v1_4;
s32 var_v1_5;
+ struct Note *var_v0;
+ struct Note *var_v0_2;
+ struct Note *var_v0_6;
+ struct Note *var_v0_7;
+ struct SequencePlayer *var_v0_4;
+ struct SequencePlayer *var_v0_5;
struct SoundAllocPool *temp_v1_3;
struct SoundAllocPool *temp_v1_4;
struct TemporaryPool *var_a3_2;
@@ -242,55 +233,50 @@ void *func_800B93BC(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s
u8 *var_v1;
u8 var_t1;
u8 var_t2;
- void *var_v0;
- void *var_v0_2;
- void *var_v0_6;
- void *var_v0_7;
var_a3 = arg3;
loop_1:
if (var_a3 == 0) {
var_a3_2 = &arg0->temporary;
if (arg0 == &gSeqLoadedPool) {
- sp34 = &gSeqLoadStatus;
+ sp34 = gSeqLoadStatus;
sp33 = 0;
} else if (arg0 == &gBankLoadedPool) {
sp33 = 1;
- sp34 = &gBankLoadStatus;
+ sp34 = gBankLoadStatus;
} else if (arg0 == &gUnusedLoadedPool) {
sp33 = 2;
- sp34 = &gUnkLoadStatus;
+ sp34 = gUnkLoadStatus;
}
temp_a2 = var_a3_2->entries[0].id;
if (temp_a2 == -1) {
var_t1 = 0;
} else {
- var_t1 = *(temp_a2 + sp34);
+ var_t1 = sp34[temp_a2];
}
temp_a0 = var_a3_2->entries[1].id;
if (temp_a0 == -1) {
var_t2 = 0;
} else {
- var_t2 = *(temp_a0 + sp34);
+ var_t2 = sp34[temp_a0];
}
sp20 = (s32) sp33;
if (sp33 == 1) {
if (var_t1 == 4) {
- temp_a1 = gMaxSimultaneousNotes;
var_v1_2 = 0;
- if (temp_a1 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
var_v0 = gNotes;
loop_18:
- if ((var_v0->unkB2 != temp_a2) || (((u32) var_v0->unkB0 >> 0x1F) == 0)) {
+ if ((var_v0->noteSubEu.bankId != temp_a2) || (((u32) var_v0->unkB0 >> 0x1F) == 0)) {
var_v1_2 += 1;
var_v0 += 0xC0;
- if (var_v1_2 < temp_a1) {
+ if (var_v1_2 < gMaxSimultaneousNotes) {
goto loop_18;
}
}
}
- temp_v0 = &gBankLoadStatus + temp_a2;
- if (var_v1_2 == temp_a1) {
+ temp_v0 = &gBankLoadStatus[temp_a2];
+ if (var_v1_2 == gMaxSimultaneousNotes) {
var_t1 = 3;
if (*temp_v0 != 5) {
*temp_v0 = 3;
@@ -298,21 +284,20 @@ loop_18:
}
}
if (var_t2 == 4) {
- temp_a1_2 = gMaxSimultaneousNotes;
var_v1_3 = 0;
- if (temp_a1_2 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
var_v0_2 = gNotes;
loop_27:
- if ((var_v0_2->unkB2 != var_a3_2->entries[1].id) || (((u32) var_v0_2->unkB0 >> 0x1F) == 0)) {
+ if ((var_v0_2->noteSubEu.bankId != var_a3_2->entries[1].id) || (((u32) var_v0_2->unkB0 >> 0x1F) == 0)) {
var_v1_3 += 1;
var_v0_2 += 0xC0;
- if (var_v1_3 < temp_a1_2) {
+ if (var_v1_3 < gMaxSimultaneousNotes) {
goto loop_27;
}
}
}
- if (var_v1_3 == temp_a1_2) {
- temp_v0_2 = &gBankLoadStatus + var_a3_2->entries[1].id;
+ if (var_v1_3 == gMaxSimultaneousNotes) {
+ temp_v0_2 = &gBankLoadStatus[var_a3_2->entries[1].id];
var_t2 = 3;
if (*temp_v0_2 != 5) {
*temp_v0_2 = 3;
@@ -346,15 +331,15 @@ loop_27:
}
if (sp20 == 0) {
if (var_t1 == 2) {
- var_v0_4 = &gSequencePlayers;
+ var_v0_4 = gSequencePlayers;
loop_47:
- if ((((u32) var_v0_4->unk0 >> 0x1F) == 0) || (var_v0_4->unk4 != var_a3_2->entries[0].id)) {
+ if ((((u32) var_v0_4->unk0 >> 0x1F) == 0) || (var_v0_4->seqId != var_a3_2->entries[0].id)) {
var_v0_4 += 0x148;
- if (var_v0_4 != &gSequenceChannels) {
+ if (var_v0_4 != gSequenceChannels) {
goto loop_47;
}
}
- if (var_v0_4 == &gSequenceChannels) {
+ if (var_v0_4 == gSequenceChannels) {
var_a3_2->nextSide = 0;
var_v0_3 = 0;
goto block_84;
@@ -363,16 +348,16 @@ loop_47:
}
block_52:
if (var_t2 == 2) {
- var_v0_5 = &gSequencePlayers;
+ var_v0_5 = gSequencePlayers;
loop_54:
- if ((((u32) var_v0_5->unk0 >> 0x1F) == 0) || (var_v0_5->unk4 != var_a3_2->entries[1].id)) {
+ if ((((u32) var_v0_5->unk0 >> 0x1F) == 0) || (var_v0_5->seqId != var_a3_2->entries[1].id)) {
var_v0_5 += 0x148;
- if (var_v0_5 != &gSequenceChannels) {
+ if (var_v0_5 != gSequenceChannels) {
goto loop_54;
}
}
var_v0_3 = 1;
- if (var_v0_5 == &gSequenceChannels) {
+ if (var_v0_5 == gSequenceChannels) {
var_a3_2->nextSide = 1;
goto block_84;
}
@@ -382,21 +367,20 @@ loop_54:
}
if (sp20 == (s32) 1U) {
if (var_t1 == 2) {
- temp_a1_3 = gMaxSimultaneousNotes;
var_v1_4 = 0;
- if (temp_a1_3 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
var_v0_6 = gNotes;
loop_63:
- if ((var_v0_6->unkB2 != var_a3_2->entries[0].id) || (((u32) var_v0_6->unkB0 >> 0x1F) == 0)) {
+ if ((var_v0_6->noteSubEu.bankId != var_a3_2->entries[0].id) || (((u32) var_v0_6->unkB0 >> 0x1F) == 0)) {
var_v1_4 += 1;
var_v0_6 += 0xC0;
- if (var_v1_4 < temp_a1_3) {
+ if (var_v1_4 < gMaxSimultaneousNotes) {
goto loop_63;
}
}
}
var_v0_3 = 0;
- if (var_v1_4 == temp_a1_3) {
+ if (var_v1_4 == gMaxSimultaneousNotes) {
var_a3_2->nextSide = 0;
goto block_84;
}
@@ -404,21 +388,20 @@ loop_63:
}
block_68:
if (var_t2 == 2) {
- temp_a1_4 = gMaxSimultaneousNotes;
var_v1_5 = 0;
- if (temp_a1_4 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
var_v0_7 = gNotes;
loop_71:
- if ((var_v0_7->unkB2 != var_a3_2->entries[1].id) || (((u32) var_v0_7->unkB0 >> 0x1F) == 0)) {
+ if ((var_v0_7->noteSubEu.bankId != var_a3_2->entries[1].id) || (((u32) var_v0_7->unkB0 >> 0x1F) == 0)) {
var_v1_5 += 1;
var_v0_7 += 0xC0;
- if (var_v1_5 < temp_a1_4) {
+ if (var_v1_5 < gMaxSimultaneousNotes) {
goto loop_71;
}
}
}
var_v0_3 = 1;
- if (var_v1_5 == temp_a1_4) {
+ if (var_v1_5 == gMaxSimultaneousNotes) {
var_a3_2->nextSide = 1;
goto block_84;
}
@@ -451,10 +434,10 @@ block_83:
block_84:
temp_v1_2 = var_a3_2->entries[var_v0_3].id;
if (temp_v1_2 != -1) {
- *(sp34 + temp_v1_2) = 0;
+ sp34[temp_v1_2] = 0;
if (sp20 == (s32) 1U) {
sp28 = var_a3_2;
- discard_bank(var_a3_2->entries[var_a3_2->nextSide].id, sp20, var_a3_2->entries[0].id, var_a3_2);
+ discard_bank((s32) var_a3_2->entries[var_a3_2->nextSide].id);
}
}
temp_a0_2 = var_a3_2->nextSide;
@@ -469,19 +452,19 @@ block_84:
var_a3_2->entries[1].ptr = var_v0_8;
var_a3_2->entries[1].size = (u32) size;
if ((u32) var_v0_8 < (u32) temp_v1_4->cur) {
- *(sp34 + var_a3_2->entries[0].id) = 0;
+ sp34[var_a3_2->entries[0].id] = 0;
switch (sp20) { /* switch 1; irregular */
case 0: /* switch 1 */
sp28 = var_a3_2;
sp24 = temp_v1_4;
- discard_sequence(var_a3_2->entries[0].id, sp20);
+ discard_sequence((s32) var_a3_2->entries[0].id);
block_106:
var_a3_2 = sp28;
break;
case 1: /* switch 1 */
sp28 = var_a3_2;
sp24 = temp_v1_4;
- discard_bank(var_a3_2->entries[0].id, sp20);
+ discard_bank((s32) var_a3_2->entries[0].id);
goto block_106;
}
var_a3_2->entries[0].id = -1;
@@ -497,19 +480,19 @@ block_106:
temp_v0_3 = &temp_v1_3->start[size];
temp_v1_3->cur = temp_v0_3;
if ((u32) var_a3_2->entries[1].ptr < (u32) temp_v0_3) {
- *(sp34 + var_a3_2->entries[1].id) = 0;
+ sp34[var_a3_2->entries[1].id] = 0;
switch (sp20) { /* irregular */
case 0:
sp28 = var_a3_2;
sp24 = temp_v1_3;
- discard_sequence(var_a3_2->entries[1].id, sp20);
+ discard_sequence((s32) var_a3_2->entries[1].id);
block_96:
var_a3_2 = sp28;
break;
case 1:
sp28 = var_a3_2;
sp24 = temp_v1_3;
- discard_bank(var_a3_2->entries[1].id, sp20);
+ discard_bank((s32) var_a3_2->entries[1].id);
goto block_96;
}
var_a3_2->entries[1].id = -1;
@@ -634,105 +617,86 @@ void func_800B9FB8(void) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-void func_800B9FB8(); /* extern */
-void func_800BA250(); /* extern */
-void sequence_player_disable(? *); /* extern */
-extern u32 gSequencePlayers;
-extern ? gSequenceChannels;
-extern ? gAudioBufferParameters;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800B9FB8(); /* extern */
+? func_800BA250(); /* extern */
+extern u8 D_803B0500;
+extern s32 D_803B0504;
+extern s32 D_803B7180;
+extern ? D_803B718C;
s32 func_800BA00C(void) {
- ? *temp_s0;
- s32 *temp_v1;
- s32 temp_a0;
- s32 temp_a2;
- s32 temp_v0;
- s32 temp_v0_4;
- s32 temp_v0_5;
- s32 temp_v0_6;
- u8 temp_t6;
+ s32 *var_v1_2;
+ s32 var_a0;
+ s32 var_v0;
+ s32 var_v1;
+ struct SequencePlayer *var_s0;
+ void *temp_t1;
+ void *temp_v0;
void *temp_v0_2;
- void *temp_v0_3;
- ? *phi_s0;
- s32 phi_v1;
- s32 phi_a0;
- s32 phi_a2;
- s32 *phi_v1_2;
- s32 phi_v0;
-
- temp_t6 = D_803B0500;
- switch (temp_t6) {
+
+ switch (D_803B0500) {
case 5:
- phi_s0 = &gSequencePlayers;
+ var_s0 = gSequencePlayers;
do {
- sequence_player_disable(phi_s0);
- temp_s0 = phi_s0 + 0x148;
- phi_s0 = temp_s0;
- } while (temp_s0 != &gSequenceChannels);
+ sequence_player_disable(var_s0);
+ var_s0 += 0x148;
+ } while (var_s0 != gSequenceChannels);
D_803B0504 = 4;
- D_803B0500 += -1;
+ D_803B0500 -= 1;
break;
case 4:
- temp_v0 = D_803B0504;
- if (temp_v0 != 0) {
- D_803B0504 = temp_v0 - 1;
+ if (D_803B0504 != 0) {
+ D_803B0504 -= 1;
func_800B9FB8();
} else {
- temp_a2 = gMaxSimultaneousNotes;
- phi_v1 = 0;
- phi_a0 = 0;
- phi_a2 = temp_a2;
- if (temp_a2 > 0) {
+ var_a0 = 0;
+ var_v1 = 0;
+ if (gMaxSimultaneousNotes > 0) {
do {
- temp_a0 = phi_a0 + 1;
- temp_v0_2 = gNotes + phi_v1;
- phi_a0 = temp_a0;
- if (((temp_v0_2->unkB0 >> 0x1F) != 0) && (temp_v0_2->unk59 != 0)) {
- temp_v0_2->unk68 = gAudioBufferParameters.unk18;
- temp_v0_3 = gNotes + phi_v1;
- temp_v0_3->unk58 = temp_v0_3->unk58 | 0x10;
- phi_a2 = gMaxSimultaneousNotes;
+ var_a0 += 1;
+ temp_v0 = gNotes + var_v1;
+ if ((((u32) temp_v0->unkB0 >> 0x1F) != 0) && (temp_v0->unk59 != 0)) {
+ temp_v0->unk68 = (f32) gAudioBufferParameters.updatesPerFrameInv;
+ temp_v0_2 = gNotes + var_v1;
+ temp_v0_2->unk58 = (u8) (temp_v0_2->unk58 | 0x10);
}
- phi_v1 += 0xC0;
- } while (temp_a0 < phi_a2);
+ var_v1 += 0xC0;
+ } while (var_a0 < gMaxSimultaneousNotes);
}
- D_803B0504 = 0x10;
- D_803B0500 += -1;
+ D_803B0504 = 0x00000010;
+ D_803B0500 -= 1;
}
break;
case 3:
- temp_v0_4 = D_803B0504;
- phi_v1_2 = &D_803B7180;
- if (temp_v0_4 != 0) {
- D_803B0504 = temp_v0_4 - 1;
+ var_v1_2 = &D_803B7180;
+ if (D_803B0504 != 0) {
+ D_803B0504 -= 1;
func_800B9FB8();
} else {
do {
- phi_v0 = 0;
+ var_v0 = 0;
loop_18:
- *(*phi_v1_2 + phi_v0) = 0;
- (*phi_v1_2 + phi_v0)->unk2 = 0;
- (*phi_v1_2 + phi_v0)->unk4 = 0;
- temp_v0_5 = phi_v0 + 8;
- (*phi_v1_2 + phi_v0)->unk6 = 0;
- phi_v0 = temp_v0_5;
- if (temp_v0_5 != 0xA00) {
+ *(*var_v1_2 + var_v0) = 0;
+ (*var_v1_2 + var_v0)->unk2 = 0;
+ (*var_v1_2 + var_v0)->unk4 = 0;
+ temp_t1 = *var_v1_2 + var_v0;
+ var_v0 += 8;
+ temp_t1->unk6 = 0;
+ if (var_v0 != 0xA00) {
goto loop_18;
}
- temp_v1 = phi_v1_2 + 4;
- phi_v1_2 = temp_v1;
- } while (temp_v1 != &D_803B718C);
+ var_v1_2 += 4;
+ } while (var_v1_2 != &D_803B718C);
D_803B0504 = 4;
- D_803B0500 += -1;
+ D_803B0500 -= 1;
}
break;
case 2:
- temp_v0_6 = D_803B0504;
- if (temp_v0_6 != 0) {
- D_803B0504 = temp_v0_6 - 1;
+ if (D_803B0504 != 0) {
+ D_803B0504 -= 1;
} else {
- D_803B0500 += -1;
+ D_803B0500 -= 1;
}
break;
case 1:
@@ -740,7 +704,7 @@ loop_18:
D_803B0500 = 0;
break;
}
- if (D_803B0500 < 3) {
+ if ((s32) D_803B0500 < 3) {
return 0;
}
return 1;
@@ -750,38 +714,34 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800BA00C.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? reset_bank_and_seq_load_status(); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-15-2023
? func_800B914C(? *, s16, s16, u16); /* extern */
-? init_note_free_list(); /* extern */
-? note_init_all(); /* extern */
+? reset_bank_and_seq_load_status(); /* extern */
extern s32 D_803AFBD0;
extern ? D_803B0348;
extern struct PoolSplit2 D_803B0358;
extern struct PoolSplit D_803B0360;
extern struct PoolSplit D_803B0370;
extern u8 D_803B0501;
-extern void *gNotes;
extern s32 D_803B70AC;
extern s16 D_803B70B4;
extern ? D_803B70C8;
extern ? D_803B70D0;
extern f32 D_803B7178;
extern s32 D_803B717C;
+extern s32 gSampleDmaNumListItems;
+extern u16 gVolume;
extern ? sAudioSynthesisPad;
-static ? D_800EA4D8; /* unable to generate initializer; const */
-static s16 D_800EA5CC; /* unable to generate initializer; const */
+static ? D_800EA4D8; /* unable to generate initializer */
+static s16 D_800EA5CC; /* unable to generate initializer */
void func_800BA250(void) {
? *var_s0;
f32 temp_f0;
s16 *temp_v0_2;
s16 *temp_v0_3;
- s16 temp_a1;
s16 temp_a2;
s16 temp_t0;
- s16 temp_t1;
- s16 temp_v1;
s32 temp_t2;
s32 temp_t9;
s32 var_s1;
@@ -789,11 +749,10 @@ void func_800BA250(void) {
struct SynthesisReverb *var_s0_2;
struct SynthesisReverb *var_s2;
struct SynthesisReverb *var_s2_2;
- u16 temp_a3;
u16 temp_t7;
u32 temp_s0;
u32 temp_s1;
- u8 temp_v1_2;
+ u8 temp_v1;
void *temp_s6;
void *temp_v0;
@@ -802,38 +761,34 @@ void func_800BA250(void) {
temp_t9 = temp_s6->unk0;
gAudioBufferParameters.frequency = (u16) temp_t9;
gAudioBufferParameters.aiFrequency = osAiSetFrequency(temp_t9 & 0xFFFF);
- temp_a3 = gAudioBufferParameters.frequency;
- gAudioBufferParameters.samplesPerFrameTarget = (((s32) temp_a3 / (s32) D_803B717C) + 0xF) & 0xFFF0;
- temp_v1 = gAudioBufferParameters.samplesPerFrameTarget;
- temp_t0 = temp_v1 + 0x10;
- gAudioBufferParameters.minAiBufferLength = temp_v1 - 0x10;
+ gAudioBufferParameters.samplesPerFrameTarget = (((s32) gAudioBufferParameters.frequency / (s32) D_803B717C) + 0xF) & 0xFFF0;
+ temp_t0 = gAudioBufferParameters.samplesPerFrameTarget + 0x10;
+ gAudioBufferParameters.minAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget - 0x10;
gAudioBufferParameters.maxAiBufferLength = temp_t0;
gAudioBufferParameters.updatesPerFrame = (temp_t0 / 192) + 1;
temp_a2 = gAudioBufferParameters.updatesPerFrame;
- gAudioBufferParameters.samplesPerUpdate = (temp_v1 / temp_a2) & 0xFFF8;
- temp_t1 = gAudioBufferParameters.samplesPerUpdate;
+ gAudioBufferParameters.samplesPerUpdate = ((s16) gAudioBufferParameters.samplesPerFrameTarget / temp_a2) & 0xFFF8;
temp_f0 = (f32) temp_a2;
- gAudioBufferParameters.samplesPerUpdateMax = temp_t1 + 8;
- gAudioBufferParameters.samplesPerUpdateMin = temp_t1 - 8;
- gAudioBufferParameters.resampleRate = 32000.0f / (f32) temp_a3;
+ gAudioBufferParameters.samplesPerUpdateMax = gAudioBufferParameters.samplesPerUpdate + 8;
+ gAudioBufferParameters.samplesPerUpdateMin = gAudioBufferParameters.samplesPerUpdate - 8;
+ gAudioBufferParameters.resampleRate = 32000.0f / (f32) gAudioBufferParameters.frequency;
gAudioBufferParameters.unkUpdatesPerFrameScaled = 0.001171875f / temp_f0;
gAudioBufferParameters.updatesPerFrameInv = 1.0f / temp_f0;
gMaxSimultaneousNotes = (s32) temp_s6->unk5;
- gVolume = (s16) temp_s6->unkC;
+ gVolume = temp_s6->unkC;
D_803B70B4 = (s16) (u32) (((temp_f0 * 2880000.0f) / (f32) D_800EA5CC) / D_803B7178);
gAudioBufferParameters.presetUnk4 = (s16) temp_s6->unk4;
- temp_a1 = gAudioBufferParameters.presetUnk4;
- gAudioBufferParameters.samplesPerFrameTarget = temp_v1 * temp_a1;
- gAudioBufferParameters.maxAiBufferLength *= temp_a1;
- gAudioBufferParameters.minAiBufferLength *= temp_a1;
- gAudioBufferParameters.updatesPerFrame = temp_a2 * temp_a1;
+ gAudioBufferParameters.samplesPerFrameTarget *= gAudioBufferParameters.presetUnk4;
+ gAudioBufferParameters.maxAiBufferLength *= gAudioBufferParameters.presetUnk4;
+ gAudioBufferParameters.minAiBufferLength *= gAudioBufferParameters.presetUnk4;
+ gAudioBufferParameters.updatesPerFrame = temp_a2 * gAudioBufferParameters.presetUnk4;
D_803B70AC = (gMaxSimultaneousNotes * 0x14 * gAudioBufferParameters.updatesPerFrame) + (temp_s6->unk6 << 5) + 0x1E0;
temp_s0 = temp_s6->unk10 + temp_s6->unk14 + temp_s6->unk18;
temp_s1 = temp_s6->unk1C + temp_s6->unk20 + temp_s6->unk24;
temp_t2 = temp_s0 + temp_s1;
D_803B0348.unk0 = (s32) ((D_803AFBD0 - temp_t2) - 0x100);
D_803B0348.unkC = temp_t2;
- func_800B914C(&D_803B0348, temp_a1, temp_a2, temp_a3);
+ func_800B914C(&D_803B0348, gAudioBufferParameters.presetUnk4, temp_a2, gAudioBufferParameters.frequency);
D_803B0358.wantPersistent = temp_s0;
D_803B0358.wantTemporary = temp_s1;
seq_and_bank_pool_init(&D_803B0358);
@@ -872,16 +827,16 @@ void func_800BA250(void) {
var_s2_2->useReverb = 8;
var_s2_2->reverbGain = temp_v0->unk2;
var_s2_2->ringBuffer.left = soundAlloc(&gNotesAndBuffersPool, (temp_t7 & 0xFFFF) * 2);
- temp_v1_2 = var_s2_2->downsampleRate;
+ temp_v1 = var_s2_2->downsampleRate;
var_s2_2->ringBuffer.right = soundAlloc(&gNotesAndBuffersPool, var_s2_2->windowSize * 2);
var_s2_2->nextRingBufferPos = 0;
var_s2_2->unkC = 0;
var_s2_2->curFrame = 0;
var_s2_2->framesLeftToIgnore = 2;
var_s2_2->bufSizePerChannel = (s32) var_s2_2->windowSize;
- if (temp_v1_2 != 1) {
+ if (temp_v1 != 1) {
var_s2_2->resampleFlags = 1;
- var_s2_2->resampleRate = (u16) (0x8000 / (s32) temp_v1_2);
+ var_s2_2->resampleRate = (u16) (0x8000 / (s32) temp_v1);
var_s1 = 0;
var_s2_2->resampleStateLeft = soundAlloc(&gNotesAndBuffersPool, 0x00000020U);
var_s2_2->resampleStateRight = soundAlloc(&gNotesAndBuffersPool, 0x00000020U);
@@ -924,26 +879,22 @@ void *unk_pool1_lookup(s32 poolIdx, s32 id) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? audio_dma_copy_immediate(s32, u8 *, u32, s32); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800BB584(s32); /* extern */
-extern ? gBankLoadStatus;
-extern ? gSeqLoadStatus;
extern s32 D_803B706C;
extern s32 D_803B7070;
extern s32 D_803B7074;
-extern s32 gCtlEntries;
-void func_800BA8B0(s16 arg0, s32 arg1) {
+void func_800BA8B0(s32 arg0, s32 arg1) {
s32 sp3C;
s32 sp38;
u32 sp34;
- s32 sp30;
+ u32 sp30;
void *sp20;
s32 temp_a2;
- s32 var_a3;
s32 var_s1;
u32 temp_a1;
+ u32 var_a3;
u8 *temp_v0_3;
u8 *temp_v0_4;
u8 *temp_v0_5;
@@ -966,7 +917,7 @@ void func_800BA8B0(s16 arg0, s32 arg1) {
if (temp_v0->unk8 == 0) {
var_s1 = temp_v0->unk4;
}
- if (unk_pool1_lookup((s32) arg0, var_s1) == NULL) {
+ if (unk_pool1_lookup(arg0, var_s1) == NULL) {
temp_v0_2 = sp3C + (var_s1 * 8);
temp_a2 = gUnkPool1.pool.numAllocatedEntries;
temp_a1 = temp_v0_2->unk8;
@@ -981,22 +932,22 @@ void func_800BA8B0(s16 arg0, s32 arg1) {
gUnkPool1.entries[temp_a2].ptr = temp_v0_3;
if (temp_v0_3 != NULL) {
sp20 = (temp_a2 * 0xC) + &gUnkPool1;
- audio_dma_copy_immediate(var_a3, temp_v0_3, sp34, var_a3);
- gUnkPool1.entries[temp_a2].poolIndex = arg0;
+ audio_dma_copy_immediate(var_a3, temp_v0_3, sp34);
+ gUnkPool1.entries[temp_a2].poolIndex = (s16) arg0;
gUnkPool1.entries[temp_a2].id = (s16) var_s1;
gUnkPool1.entries[temp_a2].size = sp34;
switch (arg0) { /* switch 1; irregular */
case 0: /* switch 1 */
- temp_v0_4 = var_s1 + &gSeqLoadStatus;
+ temp_v0_4 = &gSeqLoadStatus[var_s1];
if (*temp_v0_4 != 5) {
*temp_v0_4 = 5;
return;
}
break;
case 1: /* switch 1 */
- (gCtlEntries + (var_s1 * 0xC))->unk4 = (u8 *) (gUnkPool1.entries[temp_a2].ptr + 4);
+ gCtlEntries[var_s1].instruments = (struct Instrument **) (gUnkPool1.entries[temp_a2].ptr + 4);
func_800BB584(var_s1);
- temp_v0_5 = var_s1 + &gBankLoadStatus;
+ temp_v0_5 = &gBankLoadStatus[var_s1];
if (*temp_v0_5 != 5) {
*temp_v0_5 = 5;
}
diff --git a/src/audio/load.c b/src/audio/load.c
index 9c4a81095..f88a090c8 100644
--- a/src/audio/load.c
+++ b/src/audio/load.c
@@ -478,28 +478,21 @@ s32 func_800BB388(s32 bankId, s32 instId, s32 arg2) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void func_800BB43C(void *arg0, s32 arg1) {
- s16 temp_v1;
- s32 temp_v0;
- void *phi_a2;
- s32 phi_v0;
- s32 phi_v1;
-
- temp_v1 = arg0->unk2;
- phi_a2 = arg0;
- phi_v0 = 0;
- phi_v1 = temp_v1;
- if (temp_v1 > 0) {
+ s32 var_v0;
+ void *var_a2;
+
+ var_v0 = 0;
+ var_a2 = arg0;
+ if (arg0->unk2 > 0) {
do {
- temp_v0 = phi_v0 + 1;
- phi_v0 = temp_v0;
- if (phi_a2->unk8 != 0) {
- phi_a2->unk4 = phi_a2->unk4 + arg1;
- phi_v1 = arg0->unk2;
+ var_v0 += 1;
+ if (var_a2->unk8 != 0) {
+ var_a2->unk4 = (s32) (var_a2->unk4 + arg1);
}
- phi_a2 += 8;
- } while (temp_v0 < phi_v1);
+ var_a2 += 8;
+ } while (var_v0 < arg0->unk2);
}
}
#else
@@ -541,33 +534,27 @@ void patch_sound(struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void patch_audio_bank(s32, s32, u8, u8); // extern
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern s32 D_803B7074;
-extern s32 gCtlEntries;
void func_800BB584(s32 arg0) {
s32 sp18;
- s32 temp_v1;
- s32 temp_v1_2;
+ s32 var_a1;
+ struct CtlEntry *temp_v0_2;
+ struct CtlEntry *temp_v0_3;
void *temp_v0;
- void *temp_v0_2;
- void *temp_v0_3;
- s32 phi_a1;
- temp_v1 = D_803B7074;
- temp_v0 = temp_v1 + (arg0 * 8);
+ temp_v0 = D_803B7074 + (arg0 * 8);
if (temp_v0->unk8 == 0) {
- phi_a1 = (temp_v1 + (temp_v0->unk4 * 8))->unk4;
+ var_a1 = (D_803B7074 + (temp_v0->unk4 * 8))->unk4;
} else {
- phi_a1 = temp_v0->unk4;
+ var_a1 = temp_v0->unk4;
}
- temp_v1_2 = arg0 * 0xC;
- temp_v0_2 = gCtlEntries + temp_v1_2;
- sp18 = temp_v1_2;
- patch_audio_bank(temp_v0_2->unk4 - 4, phi_a1, temp_v0_2->unk1, temp_v0_2->unk2);
- temp_v0_3 = gCtlEntries + temp_v1_2;
- temp_v0_3->unk8 = temp_v0_3->unk4->unk-4;
+ temp_v0_2 = &gCtlEntries[arg0];
+ sp18 = arg0 * 0xC;
+ patch_audio_bank((struct AudioBank *) (temp_v0_2->instruments - 4), (u8 *) var_a1, (u32) temp_v0_2->numInstruments, (u32) temp_v0_2->numDrums);
+ temp_v0_3 = &gCtlEntries[arg0];
+ temp_v0_3->drums = temp_v0_3->instruments->unk-4;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB584.s")
@@ -642,40 +629,34 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
#undef BASE_OFFSET
}
-
-
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-void audio_dma_copy_immediate(s32, s32, s32); // extern
-void func_800BB584(s32); // extern
-extern u32 gBankLoadedPool;
-extern u8 gBankLoadStatus;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+void *func_800B93BC(struct SoundMultiPool *, ?, u32, s32, s32); /* extern */
+? func_800BB584(s32); /* extern */
extern s32 D_803B7070;
-extern s32 gCtlEntries;
-s32 func_800BB780(s32 arg0, ? arg1) {
- s32 sp54;
- s32 sp2C;
+void *func_800BB780(s32 arg0, s32 arg1) {
+ u32 sp54;
+ void *sp2C;
s32 sp28;
- s32 temp_a2;
- s32 temp_v0_2;
+ u32 temp_a2;
u8 *temp_v0_3;
void *temp_v0;
+ void *temp_v0_2;
temp_v0 = D_803B7070 + (arg0 * 8);
temp_a2 = ((temp_v0->unk8 + 0x1E) & ~0xF) - 0x10;
sp54 = temp_a2;
sp28 = temp_v0->unk4;
temp_v0_2 = func_800B93BC(&gBankLoadedPool, 1, temp_a2, arg1, arg0);
- if (temp_v0_2 == 0) {
- return 0;
+ if (temp_v0_2 == NULL) {
+ return NULL;
}
sp2C = temp_v0_2;
audio_dma_copy_immediate(sp28 + 0x10, temp_v0_2, temp_a2);
- (gCtlEntries + (arg0 * 0xC))->unk4 = sp2C + 4;
+ gCtlEntries[arg0].instruments = sp2C + 4;
func_800BB584(arg0);
- temp_v0_3 = arg0 + &gBankLoadStatus;
+ temp_v0_3 = &gBankLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
@@ -686,23 +667,18 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB780.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-void audio_dma_partial_copy_async(void *, void *, void *, OSMesgQueue *, void *); // extern
-extern u32 gBankLoadedPool;
-extern u8 gBankLoadStatus;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+u8 *func_800B93BC(struct SoundMultiPool *, ?, s32, s32, s32); /* extern */
extern s32 D_803B7070;
-extern s32 gCtlEntries;
-s32 func_800BB864(s32 arg0, ? arg1, void *arg2) {
+s32 func_800BB864(s32 arg0, s32 arg1, struct SequencePlayer *arg2) {
s32 sp64;
- s32 sp3C;
+ u8 *sp3C;
s32 sp38;
OSMesgQueue *sp2C;
OSMesgQueue *temp_a3;
s32 temp_a2;
- s32 temp_v0_2;
- s32 temp_v1;
+ u8 *temp_v0_2;
u8 *temp_v0_3;
void *temp_v0;
@@ -712,46 +688,42 @@ s32 func_800BB864(s32 arg0, ? arg1, void *arg2) {
sp38 = temp_v0->unk4;
temp_v0_2 = func_800B93BC(&gBankLoadedPool, 1, temp_a2, arg1, arg0);
sp3C = temp_v0_2;
- if (temp_v0_2 == 0) {
+ if (temp_v0_2 == NULL) {
return 0;
}
- arg2->unk6 = arg0;
- temp_v1 = arg0 * 0xC;
- (gCtlEntries + temp_v1)->unk4 = temp_v0_2 + 4;
- temp_a3 = arg2 + 0x108;
- (gCtlEntries + temp_v1)->unk8 = 0;
- arg2->unk13C = temp_v0_2;
- arg2->unk144 = temp_a2;
- arg2->unk140 = sp38 + 0x10;
+ arg2->loadingBankId = (u8) arg0;
+ gCtlEntries[arg0].instruments = (struct Instrument **) (temp_v0_2 + 4);
+ temp_a3 = &arg2->bankDmaMesgQueue;
+ gCtlEntries[arg0].drums = NULL;
+ arg2->bankDmaCurrMemAddr = temp_v0_2;
+ arg2->bankDmaRemaining = temp_a2;
+ arg2->bankDmaCurrDevAddr = sp38 + 0x10;
sp2C = temp_a3;
- osCreateMesgQueue(temp_a3, arg2 + 0x120, 1);
- arg2->unk0 = arg2->unk0 | 8;
- audio_dma_partial_copy_async(arg2 + 0x140, arg2 + 0x13C, arg2 + 0x144, temp_a3, arg2 + 0x124);
- temp_v0_3 = arg0 + &gBankLoadStatus;
+ osCreateMesgQueue(temp_a3, &arg2->bankDmaMesg, 1);
+ arg2->unk0 = (u8) (arg2->unk0 | 8);
+ audio_dma_partial_copy_async(&arg2->bankDmaCurrDevAddr, &arg2->bankDmaCurrMemAddr, &arg2->bankDmaRemaining, temp_a3, &arg2->bankDmaIoMesg);
+ temp_v0_3 = &gBankLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 1;
}
- return sp3C;
+ return (s32) sp3C;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB864.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-void audio_dma_copy_immediate(s32, s32, s32); // extern
-extern u32 gSeqLoadedPool;
-extern ? gSeqLoadStatus;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+void *func_800B93BC(struct SoundMultiPool *, ?, u32, s32, s32); /* extern */
extern s32 D_803B706C;
-s32 func_800BB99C(s32 arg0, ? arg1) {
- s32 sp2C;
- s32 sp28;
- s32 sp24;
- s32 temp_t9;
- s32 temp_v0;
+void *func_800BB99C(s32 arg0, s32 arg1) {
+ u32 sp2C;
+ void *sp28;
+ u32 sp24;
+ u32 temp_t9;
u8 *temp_v0_3;
+ void *temp_v0;
void *temp_v0_2;
temp_v0_2 = D_803B706C + (arg0 * 8);
@@ -759,12 +731,12 @@ s32 func_800BB99C(s32 arg0, ? arg1) {
sp2C = temp_t9;
sp24 = temp_v0_2->unk4;
temp_v0 = func_800B93BC(&gSeqLoadedPool, 1, temp_t9, arg1, arg0);
- if (temp_v0 == 0) {
- return 0;
+ if (temp_v0 == NULL) {
+ return NULL;
}
sp28 = temp_v0;
audio_dma_copy_immediate(sp24, temp_v0, sp2C);
- temp_v0_3 = arg0 + &gSeqLoadStatus;
+ temp_v0_3 = &gSeqLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
@@ -775,47 +747,41 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB99C.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-void audio_dma_copy_immediate(s32, s32, s32); // extern
-void audio_dma_copy_async(s32, s32, s32, OSMesgQueue *, void *); // extern
-extern u32 gSeqLoadedPool;
-extern ? gSeqLoadStatus;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+void *func_800B93BC(struct SoundMultiPool *, ?, s32, s32, s32); /* extern */
extern s32 D_803B706C;
-s32 func_800BBA50(s32 arg0, ? arg1, u8 *arg2) {
- s32 sp3C;
+void *func_800BBA50(s32 arg0, s32 arg1, struct SequencePlayer *arg2) {
+ u32 sp3C;
OSMesgQueue *sp34;
OSMesgQueue *temp_a3;
s32 temp_a2;
- s32 temp_s0;
- s32 temp_v0;
u8 *temp_v0_3;
u8 *temp_v0_4;
+ void *temp_v0;
void *temp_v0_2;
temp_v0_2 = D_803B706C + (arg0 * 8);
temp_a2 = (temp_v0_2->unk8 + 0xF) & ~0xF;
- temp_s0 = temp_a2;
sp3C = temp_v0_2->unk4;
temp_v0 = func_800B93BC(&gSeqLoadedPool, 1, temp_a2, arg1, arg0);
- if (temp_v0 == 0) {
- return 0;
+ if (temp_v0 == NULL) {
+ return NULL;
}
- if (temp_s0 < 0x41) {
- audio_dma_copy_immediate(sp3C, temp_v0, temp_s0);
- temp_v0_3 = arg0 + &gSeqLoadStatus;
+ if (temp_a2 < 0x41) {
+ audio_dma_copy_immediate(sp3C, temp_v0, (u32) temp_a2);
+ temp_v0_3 = &gSeqLoadStatus[arg0];
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
} else {
- audio_dma_copy_immediate(sp3C, temp_v0, 0x40);
- temp_a3 = arg2 + 0xD4;
+ audio_dma_copy_immediate(sp3C, temp_v0, 0x00000040U);
+ temp_a3 = &arg2->seqDmaMesgQueue;
sp34 = temp_a3;
- osCreateMesgQueue(temp_a3, arg2 + 0xEC, 1);
- *arg2 = *arg2 | 0x10;
- audio_dma_copy_async(sp3C + 0x40, temp_v0 + 0x40, temp_s0 - 0x40, temp_a3, arg2 + 0xF0);
- temp_v0_4 = arg0 + &gSeqLoadStatus;
+ osCreateMesgQueue(temp_a3, &arg2->seqDmaMesg, 1);
+ *arg2 = (u8) (*arg2 | 0x10);
+ audio_dma_copy_async(sp3C + 0x40, temp_v0 + 0x40, temp_a2 - 0x40, temp_a3, &arg2->seqDmaIoMesg);
+ temp_v0_4 = &gSeqLoadStatus[arg0];
if (*temp_v0_4 != 5) {
*temp_v0_4 = 1;
}
@@ -857,49 +823,42 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
}
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 get_bank_or_seq(s32, ?, u8); // extern
-s32 func_800BB780(u8, ?); // extern
-extern u8 gBankLoadStatus;
-extern s32 gAlBankSets;
-
-s32 func_800BBCD0(s32 arg0, s8 *arg1) {
- s32 sp34;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+void *func_800BB780(u8, ?); /* extern */
+
+void *func_800BBCD0(s32 arg0, s8 *arg1) {
+ void *sp34;
s32 sp30;
- s32 temp_v0;
+ s32 var_s1;
u16 temp_s1;
u8 temp_s0;
- u8 temp_s2;
+ u8 temp_t4;
u8 temp_t6;
- s32 phi_s1;
- s32 phi_v1;
- u8 phi_s2;
- s32 phi_v1_2;
-
- temp_v0 = gAlBankSets;
- temp_s1 = *(temp_v0 + (arg0 * 2));
- temp_s2 = *(temp_s1 + temp_v0);
- phi_s1 = (temp_s1 + 1) & 0xFFFF;
- phi_s2 = temp_s2;
- if (temp_s2 != 0) {
+ u8 var_s2;
+ void *var_v1;
+
+ temp_s1 = *(gAlBankSets + (arg0 * 2));
+ var_s2 = gAlBankSets[temp_s1];
+ var_s1 = (temp_s1 + 1) & 0xFFFF;
+ if (var_s2 != 0) {
do {
- temp_s0 = *(phi_s1 + gAlBankSets);
- phi_s1 = (phi_s1 + 1) & 0xFFFF;
- phi_v1 = 0;
- if (((*(&gBankLoadStatus + temp_s0) < 2) ^ 1) == 1) {
- phi_v1 = get_bank_or_seq(1, 2, temp_s0);
+ temp_s0 = gAlBankSets[var_s1];
+ temp_t4 = gBankLoadStatus[temp_s0];
+ var_s1 = (var_s1 + 1) & 0xFFFF;
+ var_v1 = NULL;
+ if ((((s32) temp_t4 < 2) ^ 1) == 1) {
+ var_v1 = get_bank_or_seq(1, 2, (s32) temp_s0);
}
- phi_v1_2 = phi_v1;
- if (phi_v1 == 0) {
- phi_v1_2 = func_800BB780(temp_s0, 2);
+ if (var_v1 == NULL) {
+ var_v1 = func_800BB780(temp_s0, 2);
}
- temp_t6 = (phi_s2 - 1) & 0xFF;
- phi_s2 = temp_t6;
+ temp_t6 = (var_s2 - 1) & 0xFF;
+ var_s2 = temp_t6;
} while (temp_t6 != 0);
- sp34 = phi_v1_2;
- sp30 = temp_s0;
+ sp34 = var_v1;
+ sp30 = (s32) temp_s0;
}
- *arg1 = sp30;
+ *arg1 = (s8) sp30;
return sp34;
}
#else
@@ -907,49 +866,48 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBCD0.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 get_bank_or_seq(?, ?, u32); // extern
-s32 func_800BB99C(u32, ?, u32); // extern
-s32 func_800BBCD0(u32, ? *, u32); // extern
-extern s32 D_800EA5DC;
-extern u8 gBankLoadStatus;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s32 func_800BB99C(u32, ?, u32); /* extern */
+? func_800BBCD0(u32, ? *, u32); /* extern */
extern s32 D_803B706C;
extern u16 D_803B707C;
+static s32 D_800EA5DC = 0;
void func_800BBDDC(u32 arg0, s32 arg1) {
? sp23;
s32 sp1C;
s32 temp_t6;
+ s32 var_v1;
+ u32 var_a2;
void *temp_v0;
- u32 phi_a2;
- u32 phi_a2_2;
- s32 phi_v1;
- u32 phi_a2_3;
+ void *temp_v0_2;
+ void *var_v1_2;
temp_t6 = arg1 & 0xFF;
- phi_a2 = arg0;
- if (arg0 < D_803B707C) {
+ var_a2 = arg0;
+ if (arg0 < (u16) D_803B707C) {
temp_v0 = D_803B706C + (arg0 * 8);
if (temp_v0->unk8 == 0) {
- phi_a2 = temp_v0->unk4;
+ var_a2 = temp_v0->unk4;
}
D_800EA5DC = 0x19710515;
- phi_a2_2 = phi_a2;
- if ((temp_t6 & 2) != 0) {
- sp1C = temp_t6;
- arg0 = phi_a2;
- func_800BBCD0(phi_a2, &sp23, phi_a2);
- phi_a2_2 = arg0;
+ var_v1 = temp_t6;
+ if (temp_t6 & 2) {
+ sp1C = var_v1;
+ arg0 = var_a2;
+ func_800BBCD0(var_a2, &sp23, var_a2);
+ var_v1 = sp1C;
+ var_a2 = arg0;
}
- phi_a2_3 = phi_a2_2;
- if ((arg1 & 0xFF & 1) != 0) {
- phi_v1 = 0;
- if (((*(&gBankLoadStatus + phi_a2_2) < 2) ^ 1) == 1) {
- arg0 = phi_a2_2;
- phi_v1 = get_bank_or_seq(0, 2, phi_a2_2);
- phi_a2_3 = arg0;
+ if (var_v1 & 1) {
+ var_v1_2 = NULL;
+ if ((((s32) gBankLoadStatus[var_a2] < 2) ^ 1) == 1) {
+ arg0 = var_a2;
+ temp_v0_2 = get_bank_or_seq(0, 2, (s32) var_a2);
+ var_a2 = arg0;
+ var_v1_2 = temp_v0_2;
}
- if ((phi_v1 == 0) && (func_800BB99C(phi_a2_3, 2, phi_a2_3) == 0)) {
+ if ((var_v1_2 == NULL) && (func_800BB99C(var_a2, 2, var_a2) == 0)) {
D_800EA5DC = 0x76557364;
return;
}
@@ -957,15 +915,13 @@ void func_800BBDDC(u32 arg0, s32 arg1) {
}
block_11:
D_800EA5DC = 0x76557364;
- // Duplicate return node #12. Try simplifying control flow for better match
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBDDC.s")
#endif
+
extern volatile s32 D_800EA5DC;
-//load_sequence_internal
-void func_800BBF44(u32 player, u32 seqId, s32 loadAsync);
//load_sequence
void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync) {
if (!loadAsync) {
@@ -976,96 +932,84 @@ void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync) {
D_800EA5DC = AUDIO_LOCK_NOT_LOADING;
}
}
-//GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBEF0.s")
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 get_bank_or_seq(?, ?, s8); // extern
-s32 func_800BB864(s32, ?, void *); // extern
-s32 func_800BB99C(s8, ?); // extern
-s32 func_800BBA50(s8, ?, void *); // extern
-s32 get_missing_bank(s8, s32 *, s32 *); // extern
-s32 func_800BBCD0(s8, void *, s32 *); // extern
-void sequence_player_disable(void *); // extern
-void init_sequence_player(s32); // extern
-extern u32 gSequencePlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s32 func_800BB864(u8, ?, struct SequencePlayer *); /* extern */
+u8 *func_800BB99C(u32, ?); /* extern */
+u8 *func_800BBA50(u32, ?, struct SequencePlayer *); /* extern */
+s32 func_800BBCD0(u32, u8 *, s32 *); /* extern */
extern s32 D_803B706C;
extern u16 D_803B707C;
-void func_800BBF44(s32 arg0, u32 arg1, s32 arg2) {
- s32 sp3C;
+//load_sequence_internal
+void func_800BBF44(u32 arg0, u32 arg1, s32 arg2) {
+ u8 *sp3C;
s32 sp2C;
s32 sp28;
s32 sp24;
- s32 *temp_a1;
- s32 *temp_a2;
- s32 temp_a0;
- s32 temp_v0_2;
- s32 temp_v0_3;
- void *temp_s0;
+ struct SequencePlayer *temp_s0;
+ u32 var_s1;
+ u8 *temp_v0_3;
+ u8 *var_v0;
+ u8 *var_v1;
+ u8 temp_a0;
+ u8 temp_v0_2;
void *temp_v0;
- s8 phi_s1;
- s32 phi_v0;
- s32 phi_v1;
- phi_s1 = arg1;
- if (arg1 < D_803B707C) {
+ var_s1 = arg1;
+ if (arg1 < (u16) D_803B707C) {
temp_v0 = D_803B706C + (arg1 * 8);
if (temp_v0->unk8 == 0) {
- phi_s1 = temp_v0->unk4;
+ var_s1 = temp_v0->unk4;
}
- temp_s0 = (arg0 * 0x148) + &gSequencePlayers;
+ temp_s0 = &gSequencePlayers[arg0];
sequence_player_disable(temp_s0);
- temp_a1 = &sp28;
- temp_a2 = &sp2C;
if (arg2 != 0) {
sp2C = 0;
sp28 = 0;
- temp_v0_2 = get_missing_bank(phi_s1, temp_a1, temp_a2);
+ temp_v0_2 = get_missing_bank(var_s1, &sp28, &sp2C);
temp_a0 = temp_v0_2;
if (sp2C == 1) {
- sp24 = temp_v0_2;
+ sp24 = (s32) temp_v0_2;
if (func_800BB864(temp_a0, 2, temp_s0) != 0) {
- temp_s0->unk5 = sp24;
+ temp_s0->defaultBank[0] = (u8) sp24;
goto block_10;
}
- // Duplicate return node #17. Try simplifying control flow for better match
- return;
- }
- if (func_800BBCD0(phi_s1, temp_s0 + 5) == 0) {
- return;
+ } else {
+ if (func_800BBCD0(var_s1, temp_s0->defaultBank) == 0) {
+ return;
+ }
+ goto block_10;
}
- goto block_10;
- }
- if (func_800BBCD0(phi_s1, temp_s0 + 5, temp_a2) != 0) {
+ } else if (func_800BBCD0(var_s1, temp_s0->defaultBank, &sp2C) != 0) {
block_10:
- temp_s0->unk4 = phi_s1;
- temp_v0_3 = get_bank_or_seq(0, 2, phi_s1);
- phi_v1 = temp_v0_3;
- if (temp_v0_3 == 0) {
- if ((temp_s0->unk0 * 8) >= 0) {
+ temp_s0->seqId = (u8) var_s1;
+ temp_v0_3 = get_bank_or_seq(0, 2, (s32) var_s1);
+ var_v1 = temp_v0_3;
+ if (temp_v0_3 == NULL) {
+ if (!(temp_s0->unk0 & 0x10000000)) {
if (arg2 != 0) {
- phi_v0 = func_800BBA50(phi_s1, 2, temp_s0);
+ var_v0 = func_800BBA50(var_s1, 2, temp_s0);
} else {
- phi_v0 = func_800BB99C(phi_s1, 2);
+ var_v0 = func_800BB99C(var_s1, 2);
}
- phi_v1 = phi_v0;
- if (phi_v0 != 0) {
+ var_v1 = var_v0;
+ if (var_v0 != NULL) {
goto block_16;
}
}
} else {
block_16:
- sp3C = phi_v1;
+ sp3C = var_v1;
init_sequence_player(arg0);
- temp_s0->unk88 = 0;
- temp_s0->unkE = 0;
- temp_s0->unk0 = temp_s0->unk0 | 0x80;
- temp_s0->unk14 = phi_v1;
- temp_s0->unk70 = phi_v1;
+ temp_s0->scriptState.depth = 0;
+ temp_s0->delay = 0;
+ temp_s0->unk0 = (s8) ((u8) temp_s0->unk0 | 0x80);
+ temp_s0->seqData = var_v1;
+ temp_s0->scriptState.pc = var_v1;
}
}
- // Duplicate return node #17. Try simplifying control flow for better match
}
}
#else
@@ -1073,23 +1017,18 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBF44.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? audio_dma_copy_immediate(? *, s32 *, u32, void **); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800B90F0(s32); /* extern */
? func_800BA00C(); /* extern */
? func_800BB43C(s32 *, ? *); /* extern */
-? init_sequence_players(); /* extern */
-? func_800CBF48(u32 *); /* extern */
extern s8 D_803B0500;
extern s8 D_803B0501;
+extern OSMesgQueue D_803B6720;
extern void *D_803B6738;
extern s32 *D_803B706C;
extern s32 *D_803B7070;
extern s32 *D_803B7074;
-extern s32 *gAlBankSets;
extern s16 D_803B707C;
-extern void *gCtlEntries;
-extern s8 gAudioLibSoundMode;
extern s32 D_803B70B8;
extern s32 D_803B70C0;
extern s32 D_803B70C4;
@@ -1106,11 +1045,13 @@ extern ? _audio_banksSegmentRomStart;
extern ? _audio_tablesSegmentRomStart;
extern ? _instrument_setsSegmentRomStart;
extern ? _sequencesSegmentRomStart;
-extern s32 osTvType;
-static s32 D_800EA5D0 = 0x00048C00; /* const */
-static s32 D_800EA5D4 = 0x00002600; /* const */
-static u32 D_800EA5D8 = 0; /* const */
-static s32 D_800EA5DC = 0; /* const */
+extern void *gCurrAudioFrameDmaMesgBufs;
+extern OSMesgQueue gCurrAudioFrameDmaQueue;
+extern s32 gSampleDmaNumListItems;
+static s32 D_800EA5D0 = 0x00048C00;
+static s32 D_800EA5D4 = 0x00002600;
+static u32 D_800EA5D8 = 0;
+static s32 D_800EA5DC = 0;
void audio_init(void) {
s32 sp8C;
@@ -1120,12 +1061,10 @@ void audio_init(void) {
? *var_v0_3;
s16 temp_s3;
s16 temp_t1;
+ s32 *temp_v0;
s32 *temp_v0_2;
s32 *temp_v0_3;
- s32 *temp_v0_4;
- s32 *temp_v0_5;
s32 temp_t7;
- s32 temp_v0;
s32 var_s0_2;
s32 var_s1;
s32 var_v1;
@@ -1135,6 +1074,7 @@ void audio_init(void) {
u32 temp_a1_2;
u32 temp_a1_3;
u32 var_s0;
+ u8 *temp_v0_4;
void **var_a2;
void *temp_t3;
void *temp_t7_2;
@@ -1159,8 +1099,7 @@ void audio_init(void) {
var_v0_2 += 8;
} while ((s32) var_s0 >= 0);
}
- temp_v0 = osTvType;
- switch (temp_v0) { /* irregular */
+ switch (osTvType) { /* irregular */
case 0:
D_803B7178 = 20.03042f;
D_803B717C = 0x00000032;
@@ -1189,7 +1128,7 @@ void audio_init(void) {
D_803B70D8.unk34 = 0;
D_803B70D8.unk84 = 0;
osCreateMesgQueue(&D_803B6720, &D_803B6738, 1);
- osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs, 0x00000040);
+ osCreateMesgQueue(&gCurrAudioFrameDmaQueue, &gCurrAudioFrameDmaMesgBufs, 0x00000040);
gCurrAudioFrameDmaCount = 0;
gSampleDmaNumListItems = 0;
func_800B90F0(D_800EA5D4);
@@ -1214,21 +1153,21 @@ loop_18:
D_803B0500 = 1;
func_800BA00C();
D_803B706C = &sp60;
- audio_dma_copy_immediate(&_sequencesSegmentRomStart, &sp60, 0x00000010U);
+ audio_dma_copy_immediate((u32) &_sequencesSegmentRomStart, &sp60, 0x00000010U);
temp_t1 = D_803B706C->unk2;
temp_a1 = (((temp_t1 & 0xFFFF) * 8) + 0x13) & ~0xF;
D_803B707C = temp_t1;
- temp_v0_2 = soundAlloc(&gAudioInitPool, temp_a1);
- D_803B706C = temp_v0_2;
- audio_dma_copy_immediate(&_sequencesSegmentRomStart, temp_v0_2, temp_a1);
+ temp_v0 = soundAlloc(&gAudioInitPool, temp_a1);
+ D_803B706C = temp_v0;
+ audio_dma_copy_immediate((u32) &_sequencesSegmentRomStart, temp_v0, temp_a1);
func_800BB43C(D_803B706C, &_sequencesSegmentRomStart);
D_803B7070 = &sp60;
- audio_dma_copy_immediate(&_audio_banksSegmentRomStart, &sp60, 0x00000010U);
+ audio_dma_copy_immediate((u32) &_audio_banksSegmentRomStart, &sp60, 0x00000010U);
temp_s3 = D_803B7070->unk2;
temp_a1_2 = ((temp_s3 * 8) + 0x13) & ~0xF;
- temp_v0_3 = soundAlloc(&gAudioInitPool, temp_a1_2);
- D_803B7070 = temp_v0_3;
- audio_dma_copy_immediate(&_audio_banksSegmentRomStart, temp_v0_3, temp_a1_2);
+ temp_v0_2 = soundAlloc(&gAudioInitPool, temp_a1_2);
+ D_803B7070 = temp_v0_2;
+ audio_dma_copy_immediate((u32) &_audio_banksSegmentRomStart, temp_v0_2, temp_a1_2);
func_800BB43C(D_803B7070, &_audio_banksSegmentRomStart);
gCtlEntries = soundAlloc(&gAudioInitPool, temp_s3 * 0xC);
var_v1_2 = 0;
@@ -1237,7 +1176,7 @@ loop_18:
var_s0_2 = 0;
do {
sp8C = var_v1_2;
- audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x00000010U, &gCtlEntries);
+ audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x00000010U);
(gCtlEntries + var_s0_2)->unk1 = (s8) sp60;
var_v1_2 = sp8C + 1;
temp_t3 = gCtlEntries + var_s0_2;
@@ -1247,15 +1186,15 @@ loop_18:
} while (var_v1_2 != temp_s3);
}
D_803B7074 = &sp60;
- audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, &sp60, 0x00000010U, &gCtlEntries);
+ audio_dma_copy_immediate((u32) &_audio_tablesSegmentRomStart, &sp60, 0x00000010U);
temp_a1_3 = ((D_803B7074->unk2 * 8) + 0x13) & ~0xF;
- temp_v0_4 = soundAlloc(&gAudioInitPool, temp_a1_3);
- D_803B7074 = temp_v0_4;
- audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, temp_v0_4, temp_a1_3);
+ temp_v0_3 = soundAlloc(&gAudioInitPool, temp_a1_3);
+ D_803B7074 = temp_v0_3;
+ audio_dma_copy_immediate((u32) &_audio_tablesSegmentRomStart, temp_v0_3, temp_a1_3);
func_800BB43C(D_803B7074, &_audio_tablesSegmentRomStart);
- temp_v0_5 = soundAlloc(&gAudioInitPool, 0x00000100U);
- gAlBankSets = temp_v0_5;
- audio_dma_copy_immediate(&_instrument_setsSegmentRomStart, temp_v0_5, 0x00000100U);
+ temp_v0_4 = soundAlloc(&gAudioInitPool, 0x00000100U);
+ gAlBankSets = temp_v0_4;
+ audio_dma_copy_immediate((u32) &_instrument_setsSegmentRomStart, temp_v0_4, 0x00000100U);
sound_alloc_pool_init(&gUnkPool1.pool, soundAlloc(&gAudioInitPool, D_800EA5D8), D_800EA5D8);
init_sequence_players();
D_800EA5DC = 0x76557364;
diff --git a/src/audio/load.h b/src/audio/load.h
index ee5e1adeb..5d68b41fe 100644
--- a/src/audio/load.h
+++ b/src/audio/load.h
@@ -18,6 +18,9 @@ void decrease_sample_dma_ttls();
void func_800BB030(s32);
s32 func_800BB304(struct AudioBankSample*);
s32 func_800BB388(s32 bankId, s32 instId, s32 arg2);
+void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync);
+void func_800BBF44(u32 player, u32 seqId, s32 loadAsync);
+u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount);
void patch_sound(struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase);
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
diff --git a/src/audio/port_eu.c b/src/audio/port_eu.c
index 1c1762415..fa2106895 100644
--- a/src/audio/port_eu.c
+++ b/src/audio/port_eu.c
@@ -1,26 +1,54 @@
#include <ultra64.h>
#include <macros.h>
-#include "audio/internal.h"
+#include "audio/port_eu.h"
#include "audio/load.h"
+OSMesgQueue D_801937C0;
+OSMesgQueue D_801937D8;
+OSMesgQueue D_801937F0;
+OSMesgQueue D_80193808;
+
+struct EuAudioCmd D_80193820[0x100];
+
+// Seems oversized by 1
+OSMesg D_80194020[2];
+OSMesg D_80194028[4];
+OSMesg D_80194038[1];
+OSMesg D_8019403C[1];
+
+u8 D_800EA3A0[] = { 0, 0, 0, 0 };
+
+u8 D_800EA3A4[] = { 0, 0, 0, 0 };
+
+OSMesgQueue *D_800EA3A8 = &D_801937C0;
+OSMesgQueue *D_800EA3AC = &D_801937D8;
+OSMesgQueue *D_800EA3B0 = &D_801937F0;
+OSMesgQueue *D_800EA3B4 = &D_80193808;
+
+char port_eu_unused_string0[] = "DAC:Lost 1 Frame.\n";
+char port_eu_unused_string1[] = "DMA: Request queue over.( %d )\n";
+char port_eu_unused_string2[] = "DMA [ %d lines] TIMEOUT\n";
+char port_eu_unused_string3[] = "Warning: WaveDmaQ contains %d msgs.\n";
+char port_eu_unused_string4[] = "Audio:now-max tasklen is %d / %d\n";
+char port_eu_unused_string5[] = "Audio:Warning:ABI Tasklist length over (%d)\n";
+
+s32 D_800EA484 = 128;
+
+char port_eu_unused_string6[] = "AudioSend: %d -> %d (%d)\n";
+
+s32 D_800EA4A4 = 0;
+
+char port_eu_unused_string7[] = "Undefined Port Command %d\n";
+
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B70EC(s32, s32 *, s32, s16); // extern
-s32 func_800BA00C(); // extern
-void decrease_sample_dma_ttls(); // extern
-void func_800CBCB0(void *); // extern
-extern OSMesgQueue *D_800EA3A8;
-extern OSMesgQueue *D_800EA3AC;
-extern OSMesgQueue *D_800EA3B0;
-extern OSMesgQueue *D_800EA3B4;
-extern s32 D_800EA484;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+s32 func_800B70EC(s32, s32 *, s32, s16); /* extern */
+s32 func_800BA00C(); /* extern */
+? func_800CBCB0(void *); /* extern */
extern u8 D_803B0500;
extern u8 D_803B0501;
-extern OSMesgQueue gCurrAudioFrameDmaQueue;
-extern ? gAudioBufferParameters;
extern s32 D_803B70B8;
-extern s32 gCurrAudioFrameDmaCount;
extern s32 D_803B70C0;
extern s32 D_803B70C4;
extern ? D_803B70C8;
@@ -29,12 +57,10 @@ extern void *D_803B70D4;
extern ? D_803B70D8;
extern ? D_803B7180;
extern ? D_803B718C;
-extern s32 gAudioRandom;
extern ? aspMainDataEnd;
extern ? aspMainDataStart;
extern ? aspMainTextStart;
-extern ? rspbootTextEnd;
-extern u64 rspbootTextStart;
+extern OSMesgQueue gCurrAudioFrameDmaQueue;
void *create_next_audio_frame_task(void) {
u32 sp74;
@@ -43,132 +69,112 @@ void *create_next_audio_frame_task(void) {
void *sp58;
void *sp54;
s32 *sp40;
- s16 *temp_s1_3;
- s16 temp_a0;
- s16 temp_v0_2;
+ s16 *temp_s1_2;
s16 temp_v1;
s32 *temp_a3;
s32 temp_hi;
- s32 temp_s0;
- s32 temp_s0_2;
- s32 temp_s0_3;
- s32 temp_s0_4;
+ s32 temp_hi_2;
s32 temp_s1;
- s32 temp_s1_2;
s32 temp_t3;
- s32 temp_t5;
- s32 temp_v0;
- void *temp_v1_2;
- s32 phi_s0;
- s32 phi_s1;
- s32 phi_s0_2;
- s32 phi_s0_3;
- s32 phi_s1_2;
- s32 phi_s1_3;
-
- D_803B70B8 = D_803B70B8 + 1;
- if ((D_803B70B8 % gAudioBufferParameters.unk0) != 0) {
+ s32 var_s0;
+ s32 var_s0_2;
+ s32 var_s0_3;
+ s32 var_s1;
+
+ D_803B70B8 += 1;
+ if (((s32) D_803B70B8 % (s16) gAudioBufferParameters.presetUnk4) != 0) {
return NULL;
}
- osSendMesg(D_800EA3A8, D_803B70B8, 0);
+ osSendMesg(D_800EA3A8, (void *) D_803B70B8, 0);
temp_t3 = D_803B70C4 + 1;
- temp_t5 = temp_t3 % 3;
- temp_hi = (temp_t5 + 1) % 3;
+ temp_hi = temp_t3 % 3;
+ temp_hi_2 = (s32) (temp_hi + 1) % 3;
D_803B70C4 = temp_t3;
- D_803B70C0 = D_803B70C0 ^ 1;
- D_803B70C4 = temp_t5;
+ D_803B70C0 ^= 1;
+ D_803B70C4 = temp_hi;
sp74 = osAiGetLength() >> 2;
- temp_v1 = *(&D_803B718C + (temp_hi * 2));
+ temp_v1 = *(&D_803B718C + (temp_hi_2 * 2));
if (temp_v1 != 0) {
- osAiSetNextBuffer(*(&D_803B7180 + (temp_hi * 4)), temp_v1 * 4);
+ osAiSetNextBuffer(*(&D_803B7180 + (temp_hi_2 * 4)), temp_v1 * 4);
}
- temp_s1 = gCurrAudioFrameDmaCount;
- phi_s0 = 0;
- phi_s1 = temp_s1;
- phi_s0_2 = 0;
- phi_s0_3 = 0;
- phi_s1_3 = temp_s1;
- if (temp_s1 > 0) {
+ var_s1 = gCurrAudioFrameDmaCount;
+ var_s0 = 0;
+ if (var_s1 > 0) {
do {
- phi_s1_2 = phi_s1_3;
if (osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0) == 0) {
- phi_s1_2 = phi_s1_3 - 1;
+ var_s1 -= 1;
}
- temp_s0 = phi_s0 + 1;
- phi_s0 = temp_s0;
- phi_s1 = phi_s1_2;
- phi_s1_3 = phi_s1_2;
- } while (temp_s0 < gCurrAudioFrameDmaCount);
+ var_s0 += 1;
+ } while (var_s0 < gCurrAudioFrameDmaCount);
}
- if ((phi_s1 != 0) && (phi_s1 > 0)) {
- do {
- osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 1);
- temp_s0_2 = phi_s0_2 + 1;
- phi_s0_2 = temp_s0_2;
- } while (temp_s0_2 != phi_s1);
+ if (var_s1 != 0) {
+ var_s0_2 = 0;
+ if (var_s1 > 0) {
+ do {
+ osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 1);
+ var_s0_2 += 1;
+ } while (var_s0_2 != var_s1);
+ }
}
- temp_s1_2 = gCurrAudioFrameDmaQueue.validCount;
- if ((temp_s1_2 != 0) && (temp_s1_2 > 0)) {
- do {
- osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0);
- temp_s0_3 = phi_s0_3 + 1;
- phi_s0_3 = temp_s0_3;
- } while (temp_s0_3 != temp_s1_2);
+ temp_s1 = gCurrAudioFrameDmaQueue.validCount;
+ if (temp_s1 != 0) {
+ var_s0_3 = 0;
+ if (temp_s1 > 0) {
+ do {
+ osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0);
+ var_s0_3 += 1;
+ } while (var_s0_3 != temp_s1);
+ }
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(D_800EA3B0, &sp58, 0) != -1) {
- D_803B0501 = sp58;
+ D_803B0501 = (u8) sp58;
D_803B0500 = 5;
}
if ((D_803B0500 != 0) && (func_800BA00C() == 0)) {
if (D_803B0500 == 0) {
- osSendMesg(D_800EA3B4, D_803B0501, 0);
+ osSendMesg(D_800EA3B4, (void *) D_803B0501, 0);
}
return NULL;
}
- temp_v0 = D_803B70C0;
- D_803B70D4 = (temp_v0 * 0x50) + &D_803B70D8;
- temp_s0_4 = D_803B70C4;
- temp_a3 = (temp_s0_4 * 4) + &D_803B7180;
- D_803B70D0 = *(&D_803B70C8 + (temp_v0 * 4));
+ D_803B70D4 = (D_803B70C0 * 0x50) + &D_803B70D8;
+ temp_a3 = (D_803B70C4 * 4) + &D_803B7180;
+ D_803B70D0 = *(&D_803B70C8 + (D_803B70C0 * 4));
sp60 = *temp_a3;
- temp_s1_3 = (temp_s0_4 * 2) + &D_803B718C;
- *temp_s1_3 = (((gAudioBufferParameters.unk6 - sp74) + 0x40) & 0xFFF0) + 0x10;
- temp_a0 = gAudioBufferParameters.unkA;
- if (*temp_s1_3 < temp_a0) {
- *temp_s1_3 = temp_a0;
+ temp_s1_2 = (D_803B70C4 * 2) + &D_803B718C;
+ *temp_s1_2 = (((gAudioBufferParameters.samplesPerFrameTarget - sp74) + 0x40) & 0xFFF0) + 0x10;
+ if (*temp_s1_2 < gAudioBufferParameters.minAiBufferLength) {
+ *temp_s1_2 = gAudioBufferParameters.minAiBufferLength;
}
- temp_v0_2 = gAudioBufferParameters.unk8;
- if (temp_v0_2 < *temp_s1_3) {
- *temp_s1_3 = temp_v0_2;
+ if (gAudioBufferParameters.maxAiBufferLength < *temp_s1_2) {
+ *temp_s1_2 = gAudioBufferParameters.maxAiBufferLength;
}
sp40 = temp_a3;
if (osRecvMesg(D_800EA3AC, &sp54, 0) != -1) {
func_800CBCB0(sp54);
}
- D_803B70D0 = func_800B70EC(D_803B70D0, &sp70, sp60, *temp_s1_3);
+ D_803B70D0 = func_800B70EC(D_803B70D0, &sp70, sp60, *temp_s1_2);
gAudioRandom = osGetCount() * (gAudioRandom + D_803B70B8);
- gAudioRandom = *(*sp40 + ((D_803B70B8 & 0xFF) * 2)) + gAudioRandom;
+ gAudioRandom += *(*sp40 + ((D_803B70B8 & 0xFF) * 2));
D_803B70D4->unk40 = 0;
D_803B70D4->unk44 = 0;
- temp_v1_2 = D_803B70D4;
- temp_v1_2->unk0 = 2;
- temp_v1_2->unk4 = 0;
- temp_v1_2->unk8 = &rspbootTextStart;
- temp_v1_2->unkC = &rspbootTextEnd - &rspbootTextStart;
- temp_v1_2->unk10 = &aspMainTextStart;
- temp_v1_2->unk18 = &aspMainDataStart;
- temp_v1_2->unk14 = 0x1000;
- temp_v1_2->unk1C = ((&aspMainDataEnd - &aspMainDataStart) >> 3) * 8;
- temp_v1_2->unk20 = 0;
- temp_v1_2->unk24 = 0;
- temp_v1_2->unk28 = 0;
- temp_v1_2->unk2C = 0;
- temp_v1_2->unk30 = *(&D_803B70C8 + (D_803B70C0 * 4));
- temp_v1_2->unk38 = 0;
- temp_v1_2->unk3C = 0;
- temp_v1_2->unk34 = sp70 * 8;
+ D_803B70D4->unk0 = 2;
+ D_803B70D4->unk4 = 0;
+ D_803B70D4->unk8 = rspbootTextStart;
+ D_803B70D4->unkC = (s32) (rspbootTextEnd - rspbootTextStart);
+ D_803B70D4->unk10 = &aspMainTextStart;
+ D_803B70D4->unk18 = &aspMainDataStart;
+ D_803B70D4->unk14 = 0x00001000;
+ D_803B70D4->unk1C = (s32) (((s32) (&aspMainDataEnd - &aspMainDataStart) >> 3) * 8);
+ D_803B70D4->unk20 = 0;
+ D_803B70D4->unk24 = 0;
+ D_803B70D4->unk28 = 0;
+ D_803B70D4->unk2C = 0;
+ D_803B70D4->unk30 = (s32) *(&D_803B70C8 + (D_803B70C0 * 4));
+ D_803B70D4->unk38 = 0;
+ D_803B70D4->unk3C = 0;
+ D_803B70D4->unk34 = (s32) (sp70 * 8);
if (D_800EA484 < sp70) {
D_800EA484 = sp70;
}
@@ -179,85 +185,60 @@ GLOBAL_ASM("asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void func_800BB388(u8, u8, u8, void *); // extern
-void func_800BBDDC(u8, ?, void *); // extern
-void func_800BBEF0(u8, u8, u8, void *); // extern
-void sequence_player_disable(u32 *, s32, void *); // extern
-void seq_player_fade_to_zero_volume(u8, s32, void *); // extern
-void func_800CBA64(u8, s32); // extern
-extern u8 gSequencePlayers;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800BBDDC(u8, ?); /* extern */
extern u8 D_803B1658;
extern u8 D_803B17A0;
extern u8 D_803B18E8;
-extern s8 gAudioLibSoundMode;
void func_800CB818(void *arg0) {
s32 temp_a1;
- u32 *temp_a0;
- u8 temp_a0_2;
- u8 temp_a1_2;
- u8 temp_a2;
+ struct SequencePlayer *temp_a0;
u8 temp_v0;
u8 temp_v0_2;
- void *temp_a3;
temp_v0 = arg0->unk0;
- temp_a3 = arg0;
- if (temp_v0 != 0x81) {
- if (temp_v0 != 0x82) {
- if (temp_v0 != 0x83) {
- if (temp_v0 != 0x88) {
- if (temp_v0 != 0xF0) {
- if (temp_v0 != 0xF1) {
- if (temp_v0 != 0xF2) {
- if (temp_v0 != 0xF3) {
- return;
- }
- func_800BB388(temp_a3->unk1, temp_a3->unk2, temp_a3->unk3, temp_a3);
- // Duplicate return node #19. Try simplifying control flow for better match
- return;
- }
- gSequencePlayers = (gSequencePlayers & 0xFFDF) | 4;
- D_803B1658 = (D_803B1658 & 0xFFDF) | 4;
- D_803B17A0 = (D_803B17A0 & 0xFFDF) | 4;
- D_803B18E8 = (D_803B18E8 & 0xFFDF) | 4;
- return;
- }
- gSequencePlayers = gSequencePlayers | 0x24;
- D_803B1658 = D_803B1658 | 0x24;
- D_803B17A0 = D_803B17A0 | 0x24;
- D_803B18E8 = D_803B18E8 | 0x24;
- return;
- }
- gAudioLibSoundMode = temp_a3->unk4;
- return;
- }
- goto block_10;
- }
- temp_v0_2 = temp_a3->unk1;
- temp_a0 = (temp_v0_2 * 0x148) + &gSequencePlayers;
- if ((*temp_a0 >> 0x1F) != 0) {
- temp_a1 = temp_a3->unk4;
- if (temp_a1 == 0) {
- sequence_player_disable(temp_a0, temp_a1, temp_a3);
- return;
- }
- seq_player_fade_to_zero_volume(temp_v0_2, temp_a1, temp_a3);
+ switch (temp_v0) { /* irregular */
+ case 0x81:
+ func_800BBDDC(arg0->unk2, 3);
+ return;
+ case 0x82:
+ case 0x88:
+ func_800BBEF0((u32) arg0->unk1, (u32) arg0->unk2, (s32) arg0->unk3);
+ func_800CBA64((s32) arg0->unk1, arg0->unk4);
+ return;
+ case 0x83:
+ temp_v0_2 = arg0->unk1;
+ temp_a0 = &gSequencePlayers[temp_v0_2];
+ if (((u32) *temp_a0 >> 0x1F) != 0) {
+ temp_a1 = arg0->unk4;
+ if (temp_a1 == 0) {
+ sequence_player_disable(temp_a0);
return;
}
+ seq_player_fade_to_zero_volume((s32) temp_v0_2, temp_a1);
return;
}
-block_10:
- temp_a0_2 = temp_a3->unk1;
- temp_a1_2 = temp_a3->unk2;
- temp_a2 = temp_a3->unk3;
- arg0 = temp_a3;
- func_800BBEF0(temp_a0_2, temp_a1_2, temp_a2, temp_a3);
- func_800CBA64(arg0->unk1, arg0->unk4);
return;
+ case 0xF0:
+ gAudioLibSoundMode = (s8) arg0->unk4;
+ return;
+ case 0xF1:
+ *gSequencePlayers |= 0x24;
+ D_803B1658 |= 0x24;
+ D_803B17A0 |= 0x24;
+ D_803B18E8 |= 0x24;
+ return;
+ case 0xF2:
+ *gSequencePlayers = (*gSequencePlayers & 0xFFDF) | 4;
+ D_803B1658 = (D_803B1658 & 0xFFDF) | 4;
+ D_803B17A0 = (D_803B17A0 & 0xFFDF) | 4;
+ D_803B18E8 = (D_803B18E8 & 0xFFDF) | 4;
+ return;
+ case 0xF3:
+ func_800BB388((s32) arg0->unk1, (s32) arg0->unk2, (s32) arg0->unk3);
+ break;
}
- func_800BBDDC(temp_a3->unk2, 3, temp_a3);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CB818.s")
@@ -288,31 +269,20 @@ void func_800CBA64(s32 playerIndex, s32 fadeInTime) {
}
}
-extern u8 D_800EA3A0;
-extern u8 D_800EA3A4;
-
-extern OSMesgQueue *D_800EA3A8[4];
-extern void *D_80194020;
-extern void *D_80194028;
-extern void *D_80194038;
-extern void *D_8019403C;
-
void func_800CBAB4(void) {
- D_800EA3A0 = 0;
- D_800EA3A4 = 0;
- osCreateMesgQueue(D_800EA3A8[0], &D_80194020, 1);
- osCreateMesgQueue(D_800EA3A8[1], &D_80194028, 4);
- osCreateMesgQueue(D_800EA3A8[2], &D_80194038, 1);
- osCreateMesgQueue(D_800EA3A8[3], &D_8019403C, 1);
+ D_800EA3A0[0] = 0;
+ D_800EA3A4[0] = 0;
+ osCreateMesgQueue(D_800EA3A8, D_80194020, 1);
+ osCreateMesgQueue(D_800EA3AC, D_80194028, 4);
+ osCreateMesgQueue(D_800EA3B0, D_80194038, 1);
+ osCreateMesgQueue(D_800EA3B4, D_8019403C, 1);
}
-extern struct EuAudioCmd D_80193820[0x100];
-
-void func_800CBB48(s32 arg0, s32 *arg1){
- struct EuAudioCmd *cmd = &D_80193820[D_800EA3A0 & 0xff];
+void func_800CBB48(s32 arg0, s32 *arg1) {
+ struct EuAudioCmd *cmd = &D_80193820[D_800EA3A0[0] & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
- D_800EA3A0++;
+ D_800EA3A0[0]++;
}
void func_800CBB88(u32 arg0, f32 arg1) {
@@ -354,96 +324,86 @@ GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CBC24.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-void func_800CB818(void *); /* extern */
-extern ? D_80193820;
-extern u32 gSequencePlayers;
-extern ? gSequenceChannelNone;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800CB818(struct EuAudioCmd *); /* extern */
void func_800CBCB0(u32 arg0) {
- s32 temp_s1;
- s32 temp_t1;
s32 temp_t8;
+ s32 var_s1;
+ s32 var_v0;
+ struct EuAudioCmd *temp_s0;
+ struct SequenceChannel *temp_v0_2;
+ struct SequencePlayer *temp_v1;
u8 temp_a0;
u8 temp_a1;
u8 temp_v0;
u8 temp_v1_2;
- void *temp_s0;
- void *temp_v0_2;
- void *temp_v1;
- s32 phi_v0;
- s32 phi_s1;
temp_t8 = arg0 & 0xFF;
- temp_s1 = (arg0 >> 8) & 0xFF;
- phi_v0 = temp_s1;
- phi_s1 = temp_s1;
- if (temp_t8 != temp_s1) {
+ var_s1 = (arg0 >> 8) & 0xFF;
+ var_v0 = var_s1;
+ if (temp_t8 != var_s1) {
do {
- temp_s0 = &D_80193820 + ((phi_v0 & 0xFF) * 8);
- temp_a0 = temp_s0->unk0;
- temp_t1 = (phi_s1 + 1) & 0xFF;
- phi_s1 = temp_t1;
+ temp_s0 = &D_80193820[var_v0 & 0xFF];
+ temp_a0 = temp_s0->u.s.arg3;
+ var_s1 = (var_s1 + 1) & 0xFF;
if ((temp_a0 & 0xF0) == 0xF0) {
func_800CB818(temp_s0);
} else {
- temp_v0 = temp_s0->unk1;
- if (temp_v0 < 4) {
- temp_v1 = &gSequencePlayers + (temp_v0 * 0x148);
- if ((temp_a0 & 0x80) != 0) {
+ temp_v0 = temp_s0->u.s.arg2;
+ if ((s32) temp_v0 < 4) {
+ temp_v1 = &gSequencePlayers[temp_v0];
+ if (temp_a0 & 0x80) {
func_800CB818(temp_s0);
- } else if ((temp_a0 & 0x40) != 0) {
- if (temp_a0 != 0x41) {
- if (temp_a0 != 0x46) {
- if (temp_a0 != 0x47) {
- if (temp_a0 != 0x48) {
-
- } else {
- temp_v1->unkC = temp_s0->unk4;
- }
- } else {
- temp_v1->unk8 = temp_s0->unk4 * 0x30;
- }
- } else {
- (temp_v1 + temp_s0->unk3)->unk7 = temp_s0->unk4;
- }
- } else {
- temp_v1->unk0 = temp_v1->unk0 | 4;
- temp_v1->unk28 = temp_s0->unk4;
+ } else if (temp_a0 & 0x40) {
+ switch (temp_a0) { /* switch 1; irregular */
+ case 0x41: /* switch 1 */
+ temp_v1->unk0 = (u8) (temp_v1->unk0 | 4);
+ temp_v1->fadeVolumeScale = (bitwise f32) temp_s0->u2.as_s32;
+ break;
+ case 0x47: /* switch 1 */
+ temp_v1->tempo = temp_s0->u2.as_s32 * 0x30;
+ break;
+ case 0x48: /* switch 1 */
+ temp_v1->transposition = (s16) (s8) temp_s0->u2.pad0[0];
+ break;
+ case 0x46: /* switch 1 */
+ temp_v1->seqVariationEu[temp_s0->u.s.op] = (s8) temp_s0->u2.pad0[0];
+ break;
}
- } else if ((temp_v1->unk0 >> 0x1F) != 0) {
- temp_a1 = temp_s0->unk2;
- if (temp_a1 < 0x10) {
- temp_v0_2 = (temp_v1 + (temp_a1 * 4))->unk30;
+ } else if (((u32) temp_v1->unk0 >> 0x1F) != 0) {
+ temp_a1 = temp_s0->u.s.arg1;
+ if ((s32) temp_a1 < 0x10) {
+ temp_v0_2 = temp_v1->channels[temp_a1];
if (temp_v0_2 != &gSequenceChannelNone) {
switch (temp_a0) {
case 1:
- temp_v0_2->unk1 = temp_v0_2->unk1 | 0x40;
- temp_v0_2->unk20 = temp_s0->unk4;
+ temp_v0_2->changes.as_u8 |= 0x40;
+ temp_v0_2->volumeScale = (bitwise f32) temp_s0->u2.as_s32;
break;
case 2:
- temp_v0_2->unk1 = temp_v0_2->unk1 | 0x40;
- temp_v0_2->unk24 = temp_s0->unk4;
+ temp_v0_2->changes.as_u8 |= 0x40;
+ temp_v0_2->volume = (bitwise f32) temp_s0->u2.as_s32;
break;
case 3:
- temp_v0_2->unk1 = temp_v0_2->unk1 | 0x20;
- temp_v0_2->unk9 = temp_s0->unk4;
+ temp_v0_2->changes.as_u8 |= 0x20;
+ temp_v0_2->newPan = (u8) (s8) temp_s0->u2.pad0[0];
break;
case 4:
- temp_v0_2->unk1 = temp_v0_2->unk1 | 0x80;
- temp_v0_2->unk30 = temp_s0->unk4;
+ temp_v0_2->changes.as_u8 |= 0x80;
+ temp_v0_2->freqScale = (bitwise f32) temp_s0->u2.as_s32;
break;
case 5:
- temp_v0_2->unk4 = temp_s0->unk4;
+ temp_v0_2->reverbVol = (u8) (s8) temp_s0->u2.pad0[0];
break;
case 6:
- temp_v1_2 = temp_s0->unk3;
- if (temp_v1_2 < 8) {
- (temp_v0_2 + temp_v1_2)->unk58 = temp_s0->unk4;
+ temp_v1_2 = temp_s0->u.s.op;
+ if ((s32) temp_v1_2 < 8) {
+ temp_v0_2->soundScriptIO[temp_v1_2] = (s8) temp_s0->u2.pad0[0];
}
break;
case 8:
- temp_v0_2->unk0 = ((temp_s0->unk4 * 0x10) & 0x10) | (temp_v0_2->unk0 & 0xFFEF);
+ temp_v0_2->unk0 = (u8) ((((s8) temp_s0->u2.pad0[0] * 0x10) & 0x10) | (temp_v0_2->unk0 & 0xFFEF));
break;
}
}
@@ -451,16 +411,15 @@ void func_800CBCB0(u32 arg0) {
}
}
}
- temp_s0->unk0 = 0;
- phi_v0 = temp_t1;
- } while (temp_t8 != temp_t1);
+ var_v0 = var_s1;
+ temp_s0->u.s.arg3 = 0;
+ } while (temp_t8 != var_s1);
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/port_eu/func_800CBCB0.s")
#endif
-
void func_800CBF48() {
func_800CBAB4();
}
diff --git a/src/audio/port_eu.h b/src/audio/port_eu.h
index 69726b384..4f47adf47 100644
--- a/src/audio/port_eu.h
+++ b/src/audio/port_eu.h
@@ -1,8 +1,36 @@
#ifndef AUDIO_PORT_EU_H
#define AUDIO_PORT_EU_H
+#include "audio/internal.h"
+
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime);
void func_800CBA64(s32 playerIndex, s32 fadeInTime);
+void func_800CBAB4();
+void func_800CBB48(s32, s32*);
+void func_800CBB88(u32, f32);
void func_800CBBB8(u32, s32);
+void func_800CBBE8(u32, s8);
+void func_800CBF48();
+
+extern OSMesgQueue D_801937C0;
+extern OSMesgQueue D_801937D8;
+extern OSMesgQueue D_801937F0;
+extern OSMesgQueue D_80193808;
+
+extern struct EuAudioCmd D_80193820[0x100];
+
+extern OSMesg D_80194020[];
+extern OSMesg D_80194028[];
+extern OSMesg D_80194038[];
+extern OSMesg D_8019403C[];
+
+extern u8 D_800EA3A0[];
+extern u8 D_800EA3A4[];
+extern OSMesgQueue *D_800EA3A8;
+extern OSMesgQueue *D_800EA3AC;
+extern OSMesgQueue *D_800EA3B0;
+extern OSMesgQueue *D_800EA3B4;
+extern s32 D_800EA484;
+extern s32 D_800EA4A4;
#endif \ No newline at end of file
diff --git a/src/audio/seqplayer.c b/src/audio/seqplayer.c
index 111a84a15..944fe2353 100644
--- a/src/audio/seqplayer.c
+++ b/src/audio/seqplayer.c
@@ -287,8 +287,7 @@ u16 m64_read_compressed_u16(struct M64ScriptState *state) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-struct Note *alloc_note(struct SequenceChannelLayer *); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern s16 D_803B70B4;
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
@@ -760,10 +759,7 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume)
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-? seq_channel_layer_process_script(struct SequenceChannelLayer *); /* extern */
-extern s32 gAlBankSets;
-
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
void func_800BFD90(struct SequenceChannel *seqChannel) {
u8 sp55;
s16 sp52;
@@ -780,9 +776,7 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
s32 temp_s0_5;
s32 temp_t3;
s32 temp_v0_2;
- s32 temp_v1_3;
- s32 temp_v1_5;
- s32 temp_v1_9;
+ s32 temp_v1_7;
s32 var_s0;
s32 var_s0_2;
s8 var_s3;
@@ -792,18 +786,18 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
struct SequenceChannel *var_s1_2;
struct SequenceChannelLayer *temp_a0;
struct SequenceChannelLayer *temp_a0_5;
- struct SequenceChannelLayer *temp_v1_8;
+ struct SequenceChannelLayer *temp_v1_6;
struct SequencePlayer *temp_s4;
u16 temp_a3;
u16 temp_a3_2;
u16 temp_t5;
u16 temp_v1;
- u16 temp_v1_4;
+ u16 temp_v1_3;
u16 var_v0;
u32 temp_t6;
u32 temp_v0;
u8 *temp_v0_6;
- u8 *temp_v1_7;
+ u8 *temp_v1_5;
u8 temp_a0_2;
u8 temp_a0_3;
u8 temp_s0_3;
@@ -813,9 +807,9 @@ void func_800BFD90(struct SequenceChannel *seqChannel) {
u8 temp_v0_5;
u8 temp_v0_7;
void *temp_v0_3;
- void *temp_v1_10;
void *temp_v1_2;
- void *temp_v1_6;
+ void *temp_v1_4;
+ void *temp_v1_8;
temp_v0 = seqChannel->unk0;
if ((temp_v0 >> 0x1F) != 0) {
@@ -932,9 +926,8 @@ loop_12:
}
goto loop_12;
case 0xEB: /* switch 3 */
- temp_v1_3 = gAlBankSets;
- temp_a3 = *(temp_v1_3 + (temp_s4->seqId * 2));
- temp_s0_3 = *(((temp_a3 + *(temp_a3 + temp_v1_3)) - m64_read_u8(temp_s1)) + temp_v1_3);
+ temp_a3 = *(gAlBankSets + (temp_s4->seqId * 2));
+ temp_s0_3 = gAlBankSets[(temp_a3 + gAlBankSets[temp_a3]) - m64_read_u8(temp_s1)];
if (get_bank_or_seq(1, 2, (s32) temp_s0_3) != NULL) {
seqChannel->bankId = temp_s0_3;
}
@@ -992,9 +985,9 @@ loop_12:
seqChannel->vibratoExtentChangeDelay = 0;
goto loop_12;
case 0xD7: /* switch 3 */
- temp_v1_4 = m64_read_u8(temp_s1) << 5;
- seqChannel->vibratoRateTarget = temp_v1_4;
- seqChannel->vibratoRateStart = temp_v1_4;
+ temp_v1_3 = m64_read_u8(temp_s1) << 5;
+ seqChannel->vibratoRateTarget = temp_v1_3;
+ seqChannel->vibratoRateStart = temp_v1_3;
seqChannel->vibratoRateChangeDelay = 0;
goto loop_12;
case 0xE2: /* switch 3 */
@@ -1014,9 +1007,8 @@ loop_12:
seqChannel->reverbVol = m64_read_u8(temp_s1);
goto loop_12;
case 0xC6: /* switch 3 */
- temp_v1_5 = gAlBankSets;
- temp_a3_2 = *(temp_v1_5 + (temp_s4->seqId * 2));
- temp_s0_4 = *(((temp_a3_2 + *(temp_a3_2 + temp_v1_5)) - m64_read_u8(temp_s1)) + temp_v1_5);
+ temp_a3_2 = *(gAlBankSets + (temp_s4->seqId * 2));
+ temp_s0_4 = gAlBankSets[(temp_a3_2 + gAlBankSets[temp_a3_2]) - m64_read_u8(temp_s1)];
if (get_bank_or_seq(1, 2, (s32) temp_s0_4) != NULL) {
seqChannel->bankId = temp_s0_4;
}
@@ -1059,25 +1051,25 @@ loop_12:
case 0xE4: /* switch 3 */
if (var_s3 != -1) {
temp_s1->stack[temp_s1->depth] = temp_s1->pc;
- temp_v1_6 = seqChannel->dynTable + (var_s3 * 2);
+ temp_v1_4 = seqChannel->dynTable + (var_s3 * 2);
temp_s1->depth += 1;
- temp_s1->pc = &temp_s4->seqData[(temp_v1_6->unk1 + (temp_v1_6->unk0 << 8)) & 0xFFFF];
+ temp_s1->pc = &temp_s4->seqData[(temp_v1_4->unk1 + (temp_v1_4->unk0 << 8)) & 0xFFFF];
}
goto loop_12;
case 0xE6: /* switch 3 */
seqChannel->bookOffset = m64_read_u8(temp_s1);
goto loop_12;
case 0xE7: /* switch 3 */
- temp_v1_7 = &temp_s4->seqData[m64_read_s16(temp_s1) & 0xFFFF];
- seqChannel->muteBehavior = *temp_v1_7;
- seqChannel->noteAllocPolicy = temp_v1_7[7].unk-6;
- seqChannel->notePriority = temp_v1_7[7].unk-5;
- seqChannel->transposition = (s16) temp_v1_7[7].unk-4;
- seqChannel->newPan = temp_v1_7[7].unk-3;
- seqChannel->panChannelWeight = temp_v1_7[7].unk-2;
- seqChannel->reverbVol = temp_v1_7[7].unk-1;
+ temp_v1_5 = &temp_s4->seqData[m64_read_s16(temp_s1) & 0xFFFF];
+ seqChannel->muteBehavior = *temp_v1_5;
+ seqChannel->noteAllocPolicy = temp_v1_5[7].unk-6;
+ seqChannel->notePriority = temp_v1_5[7].unk-5;
+ seqChannel->transposition = (s16) temp_v1_5[7].unk-4;
+ seqChannel->newPan = temp_v1_5[7].unk-3;
+ seqChannel->panChannelWeight = temp_v1_5[7].unk-2;
+ seqChannel->reverbVol = temp_v1_5[7].unk-1;
seqChannel->changes.as_u8 |= 0x20;
- seqChannel->reverbIndex = temp_v1_7[7];
+ seqChannel->reverbIndex = temp_v1_5[7];
goto loop_12;
case 0xE8: /* switch 3 */
seqChannel->muteBehavior = m64_read_u8(temp_s1);
@@ -1112,9 +1104,9 @@ loop_12:
temp_t0 = temp_a0_4 & 0xFF;
switch (temp_t6) { /* switch 2 */
case 0x0: /* switch 2 */
- temp_v1_8 = seqChannel->layers[temp_a0_4 & 0xFF];
- if (temp_v1_8 != NULL) {
- var_s3 = (s8) ((u32) (*temp_v1_8 * 2) >> 0x1F);
+ temp_v1_6 = seqChannel->layers[temp_a0_4 & 0xFF];
+ if (temp_v1_6 != NULL) {
+ var_s3 = (s8) ((u32) (*temp_v1_6 * 2) >> 0x1F);
} else {
var_s3 = -1;
}
@@ -1123,10 +1115,10 @@ loop_12:
seqChannel->soundScriptIO[temp_a0_4 & 0xFF] = var_s3;
goto loop_12;
case 0x80: /* switch 2 */
- temp_v1_9 = temp_a0_4 & 0xFF;
- var_s3 = seqChannel->soundScriptIO[temp_v1_9];
- if (temp_v1_9 < 4) {
- seqChannel->soundScriptIO[temp_v1_9] = -1;
+ temp_v1_7 = temp_a0_4 & 0xFF;
+ var_s3 = seqChannel->soundScriptIO[temp_v1_7];
+ if (temp_v1_7 < 4) {
+ seqChannel->soundScriptIO[temp_v1_7] = -1;
}
goto loop_12;
case 0x50: /* switch 2 */
@@ -1152,8 +1144,8 @@ loop_12:
temp_a1_2 = temp_s0 & 0xF;
sp34 = temp_a1_2;
if (seq_channel_set_layer(seqChannel, temp_a1_2) != -1) {
- temp_v1_10 = seqChannel->dynTable + (var_s3 * 2);
- seqChannel->layers[sp34]->scriptState.pc = &temp_s4->seqData[(temp_v1_10->unk1 + (temp_v1_10->unk0 << 8)) & 0xFFFF];
+ temp_v1_8 = seqChannel->dynTable + (var_s3 * 2);
+ seqChannel->layers[sp34]->scriptState.pc = &temp_s4->seqData[(temp_v1_8->unk1 + (temp_v1_8->unk0 << 8)) & 0xFFFF];
}
}
goto loop_12;
@@ -1193,357 +1185,320 @@ GLOBAL_ASM("asm/non_matchings/audio/seqplayer/func_800BFD90.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-void audio_dma_partial_copy_async(void *, void *, void *, void *, void *); /* extern */
-void func_800BB584(u8, void *, void *); /* extern */
-void note_pool_clear(void *); /* extern */
-void note_pool_fill(void *, s8); /* extern */
-void sequence_player_init_channels(void *, s32); /* extern */
-void sequence_player_disable_channels(void *, s32); /* extern */
-void sequence_channel_enable(void *, s32, s32); /* extern */
-void sequence_player_disable(void *, u8, s32); /* extern */
-void func_800BFD90(s32); /* extern */
-s32 osRecvMesg(void *, ?, ?); /* extern */
-extern u8 gBankLoadStatus;
-extern ? gSeqLoadStatus;
-extern ? gSequenceChannelNone;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800BB584(u8, u8 **, s32 *); /* extern */
+? func_800BFD90(s32); /* extern */
+extern s16 D_803B70B4;
-void func_800C08CC(void *arg0) {
- void *sp38;
+void func_800C08CC(struct SequencePlayer *arg0) {
+ struct NotePool *sp38;
s32 sp34;
- void *sp30;
- f32 temp_f16;
- s16 temp_v1_3;
- s16 temp_v1_5;
- s32 temp_a0_6;
+ struct SequencePlayer *sp30;
+ OSMesgQueue *temp_s0;
+ s16 temp_v0_10;
+ s16 temp_v0_7;
+ s32 *temp_a2;
s32 temp_s2;
s32 temp_t2_2;
- s32 temp_v0_13;
+ s32 temp_v0_3;
s32 temp_v0_5;
- s32 temp_v0_7;
- s32 temp_v1_4;
- s32 temp_v1_8;
- s8 temp_v0_12;
- s8 temp_v0_6;
- s8 temp_v0_9;
- u16 temp_a0_2;
+ s32 temp_v1_3;
+ s32 var_s3;
+ s32 var_v0_3;
+ struct M64ScriptState *temp_s0_2;
+ struct NotePool *temp_a0_4;
+ struct SequenceChannel *temp_a0_5;
+ struct SequencePlayer *var_v1;
+ u16 temp_a0;
u16 temp_t2;
- u16 temp_v0_10;
- u16 temp_v0_11;
- u16 temp_v1_7;
+ u16 temp_v1_5;
+ u16 var_v0_2;
u32 temp_v0;
+ u8 **temp_a1;
u8 *temp_v0_2;
- u8 *temp_v0_3;
- u8 *temp_v0_4;
u8 *temp_v1;
u8 *temp_v1_2;
- u8 temp_a0;
+ u8 *temp_v1_6;
+ u8 *var_v0;
+ u8 temp_a0_2;
u8 temp_a0_3;
- u8 temp_a0_4;
u8 temp_a1_2;
u8 temp_s2_2;
u8 temp_t9;
- u8 temp_v1_6;
- void *temp_a0_5;
- void *temp_a1;
- void *temp_a2;
- void *temp_s0;
- void *temp_s0_2;
- void *temp_v0_8;
- u8 phi_a0;
- u8 *phi_v0;
- s32 phi_s3;
- s16 phi_v0_2;
- void *phi_v1;
- s32 phi_v0_3;
+ u8 temp_v0_11;
+ u8 temp_v0_4;
+ u8 temp_v0_8;
+ u8 temp_v0_9;
+ u8 temp_v1_4;
+ u8 var_a0;
+ void *temp_v0_6;
temp_v0 = arg0->unk0;
if ((temp_v0 >> 0x1F) != 0) {
- if (((temp_v0 * 0x10) >> 0x1F) == 1) {
- temp_s0 = arg0 + 0x108;
- if (osRecvMesg(temp_s0, 0, 0) != -1) {
- temp_a1 = arg0 + 0x13C;
- temp_a2 = arg0 + 0x144;
- if (arg0->unk144 == 0) {
- arg0->unk0 = arg0->unk0 & 0xFFF7;
- func_800BB584(arg0->unk6, temp_a1, temp_a2);
- temp_v0_2 = arg0->unk6 + &gBankLoadStatus;
+ if (((u32) (temp_v0 * 0x10) >> 0x1F) == 1) {
+ temp_s0 = &arg0->bankDmaMesgQueue;
+ if (osRecvMesg(temp_s0, NULL, 0) != -1) {
+ temp_a1 = &arg0->bankDmaCurrMemAddr;
+ temp_a2 = &arg0->bankDmaRemaining;
+ if (arg0->bankDmaRemaining == 0) {
+ arg0->unk0 = (s8) ((u8) arg0->unk0 & 0xFFF7);
+ func_800BB584(arg0->loadingBankId, temp_a1, temp_a2);
+ temp_v0_2 = &gBankLoadStatus[arg0->loadingBankId];
if (*temp_v0_2 != 5) {
*temp_v0_2 = 2;
- return;
}
- /* Duplicate return node #110. Try simplifying control flow for better match */
- return;
+ } else {
+ audio_dma_partial_copy_async(&arg0->bankDmaCurrDevAddr, temp_a1, temp_a2, temp_s0, &arg0->bankDmaIoMesg);
}
- audio_dma_partial_copy_async(arg0 + 0x140, temp_a1, temp_a2, temp_s0, arg0 + 0x124);
- return;
}
- /* Duplicate return node #110. Try simplifying control flow for better match */
- return;
- }
- if (((temp_v0 * 8) >> 0x1F) == 1) {
- if (osRecvMesg(arg0 + 0xD4, 0, 0) != -1) {
- arg0->unk0 = arg0->unk0 & 0xFFEF;
- temp_v1 = arg0->unk4 + &gSeqLoadStatus;
+ } else if (((u32) (temp_v0 * 8) >> 0x1F) == 1) {
+ if (osRecvMesg(&arg0->seqDmaMesgQueue, NULL, 0) != -1) {
+ arg0->unk0 = (s8) ((u8) arg0->unk0 & 0xFFEF);
+ temp_v1 = &gSeqLoadStatus[arg0->seqId];
if (*temp_v1 != 5) {
*temp_v1 = 2;
}
goto block_11;
}
- /* Duplicate return node #110. Try simplifying control flow for better match */
- return;
- }
+ } else {
block_11:
- temp_v1_2 = arg0->unk4 + &gSeqLoadStatus;
- temp_a1_2 = *temp_v1_2;
- if ((temp_a1_2 < 2) || (temp_v0_3 = arg0->unk5 + &gBankLoadStatus, temp_a0 = *temp_v0_3, phi_a0 = temp_a0, phi_v0 = temp_v0_3, ((temp_a0 < 2) != 0))) {
- sequence_player_disable(arg0, temp_a1_2, 5);
- return;
- }
- if (temp_a1_2 != 5) {
- *temp_v1_2 = 2;
- temp_v0_4 = arg0->unk5 + &gBankLoadStatus;
- phi_a0 = *temp_v0_4;
- phi_v0 = temp_v0_4;
- }
- if (phi_a0 != 5) {
- *phi_v0 = 2;
- }
- if (((arg0->unk0 * 4) >= 0) || ((arg0->unk3 & 0x80) == 0)) {
- temp_t2 = arg0->unkA + arg0->unk8;
- arg0->unkA = temp_t2;
- temp_v1_3 = D_803B70B4;
- temp_v0_5 = temp_t2 & 0xFFFF;
- if (temp_v0_5 >= temp_v1_3) {
- temp_a0_2 = arg0->unkE;
- arg0->unkA = temp_v0_5 - temp_v1_3;
- if (temp_a0_2 >= 2) {
- arg0->unkE = temp_a0_2 - 1;
- } else {
- temp_s0_2 = arg0 + 0x70;
- arg0->unk0 = arg0->unk0 | 4;
- phi_s3 = sp58;
+ temp_v1_2 = &gSeqLoadStatus[arg0->seqId];
+ temp_a1_2 = *temp_v1_2;
+ if (((s32) temp_a1_2 < 2) || (var_v0 = &gBankLoadStatus[arg0->defaultBank[0]], var_a0 = *var_v0, (((s32) var_a0 < 2) != 0))) {
+ sequence_player_disable(arg0);
+ return;
+ }
+ if (temp_a1_2 != 5) {
+ *temp_v1_2 = 2;
+ var_v0 = &gBankLoadStatus[arg0->defaultBank[0]];
+ var_a0 = *var_v0;
+ }
+ if (var_a0 != 5) {
+ *var_v0 = 2;
+ }
+ if (!(arg0->unk0 & 0x20000000) || !(arg0->muteBehavior & 0x80)) {
+ temp_t2 = arg0->tempoAcc + arg0->tempo;
+ arg0->tempoAcc = temp_t2;
+ temp_v0_3 = temp_t2 & 0xFFFF;
+ if (temp_v0_3 >= D_803B70B4) {
+ temp_a0 = arg0->delay;
+ arg0->tempoAcc = temp_v0_3 - D_803B70B4;
+ if ((s32) temp_a0 >= 2) {
+ arg0->delay = temp_a0 - 1;
+ } else {
+ temp_s0_2 = &arg0->scriptState;
+ arg0->unk0 = (s8) ((u8) arg0->unk0 | 4);
+ var_s3 = sp58;
loop_24:
- temp_v0_6 = m64_read_u8(temp_s0_2);
- temp_s2 = temp_v0_6 & 0xFF;
- if (temp_v0_6 == 0xFF) {
- temp_a0_3 = temp_s0_2->unk18;
- if (temp_a0_3 == 0) {
- sequence_player_disable(arg0);
+ temp_v0_4 = m64_read_u8(temp_s0_2);
+ temp_s2 = temp_v0_4 & 0xFF;
+ if (temp_v0_4 == 0xFF) {
+ temp_a0_2 = temp_s0_2->depth;
+ if (temp_a0_2 == 0) {
+ sequence_player_disable(arg0);
+ } else {
+ temp_t9 = (temp_a0_2 - 1) & 0xFF;
+ temp_s0_2->depth = temp_t9;
+ temp_s0_2->pc = temp_s0_2->stack[temp_t9];
+ goto block_28;
+ }
} else {
- temp_t9 = (temp_a0_3 - 1) & 0xFF;
- temp_s0_2->unk18 = temp_t9;
- temp_s0_2->unk0 = (temp_s0_2 + (temp_t9 * 4))->unk4;
- goto block_28;
- }
- } else {
block_28:
- temp_v1_4 = temp_v0_6 & 0xFF;
- temp_v0_7 = temp_v1_4 & 0xF0;
- if (temp_v1_4 == 0xFD) {
- arg0->unkE = m64_read_compressed_u16(temp_s0_2);
- } else if (temp_v1_4 == 0xFE) {
- arg0->unkE = 1;
- } else {
- if (temp_v1_4 >= 0xC0) {
- switch (temp_v1_4) { /* switch 1 */
- case 0xFC: /* switch 1 */
+ temp_v1_3 = temp_v0_4 & 0xFF;
+ temp_v0_5 = temp_v1_3 & 0xF0;
+ if (temp_v1_3 == 0xFD) {
+ arg0->delay = m64_read_compressed_u16(temp_s0_2);
+ } else if (temp_v1_3 == 0xFE) {
+ arg0->delay = 1;
+ } else {
+ switch (temp_v1_3) { /* switch 3; irregular */
+ case 0xFC: /* switch 3 */
temp_t2_2 = m64_read_s16(temp_s0_2) & 0xFFFF;
- (temp_s0_2 + (temp_s0_2->unk18 * 4))->unk4 = temp_s0_2->unk0;
- temp_s0_2->unk18 = temp_s0_2->unk18 + 1;
- temp_s0_2->unk0 = arg0->unk14 + temp_t2_2;
+ temp_s0_2->stack[temp_s0_2->depth] = temp_s0_2->pc;
+ temp_s0_2->depth += 1;
+ temp_s0_2->pc = &arg0->seqData[temp_t2_2];
break;
- case 0xF8: /* switch 1 */
- (temp_s0_2 + temp_s0_2->unk18)->unk14 = m64_read_u8(temp_s0_2);
- (temp_s0_2 + (temp_s0_2->unk18 * 4))->unk4 = temp_s0_2->unk0;
- temp_s0_2->unk18 = temp_s0_2->unk18 + 1;
+ case 0xF8: /* switch 3 */
+ temp_s0_2->remLoopIters[temp_s0_2->depth] = m64_read_u8(temp_s0_2);
+ temp_s0_2->stack[temp_s0_2->depth] = temp_s0_2->pc;
+ temp_s0_2->depth += 1;
break;
- case 0xF7: /* switch 1 */
- temp_v0_8 = temp_s0_2 + temp_s0_2->unk18;
- temp_v0_8->unk13 = temp_v0_8->unk13 - 1;
- temp_a0_4 = temp_s0_2->unk18;
- if ((temp_s0_2 + temp_a0_4)->unk13 != 0) {
- temp_s0_2->unk0 = *(temp_s0_2 + (temp_a0_4 * 4));
+ case 0xF7: /* switch 3 */
+ temp_v0_6 = temp_s0_2 + temp_s0_2->depth;
+ temp_v0_6->unk13 = (u8) (temp_v0_6->unk13 - 1);
+ temp_a0_3 = temp_s0_2->depth;
+ if ((temp_s0_2 + temp_a0_3)->unk13 != 0) {
+ temp_s0_2->pc = *(temp_s0_2 + (temp_a0_3 * 4));
} else {
- temp_s0_2->unk18 = temp_a0_4 - 1;
+ temp_s0_2->depth = temp_a0_3 - 1;
}
break;
- case 0xF5: /* switch 1 */
- case 0xF9: /* switch 1 */
- case 0xFA: /* switch 1 */
- case 0xFB: /* switch 1 */
- if (((temp_s2 != 0xFA) || (phi_s3 == 0)) && ((temp_s2 != 0xF9) || (phi_s3 < 0)) && ((temp_s2 != 0xF5) || (phi_s3 >= 0))) {
- temp_s0_2->unk0 = arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF);
+ case 0xF5: /* switch 3 */
+ case 0xF9: /* switch 3 */
+ case 0xFA: /* switch 3 */
+ case 0xFB: /* switch 3 */
+ temp_v0_7 = m64_read_s16(temp_s0_2);
+ if (((temp_s2 != 0xFA) || (var_s3 == 0)) && ((temp_s2 != 0xF9) || (var_s3 < 0)) && ((temp_s2 != 0xF5) || (var_s3 >= 0))) {
+ temp_s0_2->pc = &arg0->seqData[temp_v0_7 & 0xFFFF];
}
break;
- case 0xF2: /* switch 1 */
- case 0xF3: /* switch 1 */
- case 0xF4: /* switch 1 */
- if (((temp_s2 != 0xF3) || (phi_s3 == 0)) && ((temp_s2 != 0xF2) || (phi_s3 < 0))) {
- temp_s0_2->unk0 = temp_s0_2->unk0 + m64_read_u8(temp_s0_2);
+ case 0xF2: /* switch 3 */
+ case 0xF3: /* switch 3 */
+ case 0xF4: /* switch 3 */
+ temp_v0_8 = m64_read_u8(temp_s0_2);
+ if (((temp_s2 != 0xF3) || (var_s3 == 0)) && ((temp_s2 != 0xF2) || (var_s3 < 0))) {
+ temp_s0_2->pc = &temp_s0_2->pc[(s8) temp_v0_8];
}
break;
- case 0xF1: /* switch 1 */
- temp_a0_5 = arg0 + 0x94;
- sp38 = temp_a0_5;
- note_pool_clear(temp_a0_5);
- note_pool_fill(temp_a0_5, m64_read_u8(temp_s0_2));
+ case 0xF1: /* switch 3 */
+ temp_a0_4 = &arg0->notePool;
+ sp38 = temp_a0_4;
+ note_pool_clear(temp_a0_4);
+ note_pool_fill(temp_a0_4, m64_read_u8(temp_s0_2));
break;
- case 0xF0: /* switch 1 */
- note_pool_clear(arg0 + 0x94);
+ case 0xF0: /* switch 3 */
+ note_pool_clear(&arg0->notePool);
break;
- case 0xDF: /* switch 1 */
- arg0->unkC = 0;
+ case 0xDF: /* switch 3 */
+ arg0->transposition = 0;
/* fallthrough */
- case 0xDE: /* switch 1 */
- arg0->unkC = arg0->unkC + m64_read_u8(temp_s0_2);
+ case 0xDE: /* switch 3 */
+ arg0->transposition += m64_read_u8(temp_s0_2);
break;
- case 0xDC: /* switch 1 */
- case 0xDD: /* switch 1 */
+ case 0xDC: /* switch 3 */
+ case 0xDD: /* switch 3 */
temp_v0_9 = m64_read_u8(temp_s0_2);
if (temp_s2 == 0xDD) {
- arg0->unk8 = (temp_v0_9 & 0xFF) * 0x30;
+ arg0->tempo = (temp_v0_9 & 0xFF) * 0x30;
} else {
- arg0->unk8 = arg0->unk8 + (temp_v0_9 * 0x30);
+ arg0->tempo += (s8) temp_v0_9 * 0x30;
}
- temp_v1_5 = D_803B70B4;
- temp_v0_10 = arg0->unk8;
- phi_v0_2 = temp_v0_10;
- if (temp_v1_5 < temp_v0_10) {
- arg0->unk8 = temp_v1_5;
- phi_v0_2 = temp_v1_5 & 0xFFFF;
+ var_v0_2 = arg0->tempo;
+ if (D_803B70B4 < (s32) var_v0_2) {
+ arg0->tempo = (u16) D_803B70B4;
+ var_v0_2 = D_803B70B4 & 0xFFFF;
}
- if (phi_v0_2 <= 0) {
- arg0->unk8 = 1;
+ if ((s16) var_v0_2 <= 0) {
+ arg0->tempo = 1;
}
break;
- case 0xDA: /* switch 1 */
+ case 0xDA: /* switch 3 */
temp_s2_2 = m64_read_u8(temp_s0_2) & 0xFF;
- temp_v0_11 = m64_read_s16(temp_s0_2);
- if ((temp_s2_2 != 0) && (temp_s2_2 != 1)) {
- if (temp_s2_2 != 2) {
-
- } else {
- temp_f16 = temp_v0_11 & 0xFFFF;
- arg0->unk10 = temp_v0_11;
- arg0->unk1 = temp_s2_2;
- arg0->unk1C = (0.0f - arg0->unk18) / temp_f16;
+ temp_v0_10 = m64_read_s16(temp_s0_2);
+ switch (temp_s2_2) { /* switch 4; irregular */
+ case 0: /* switch 4 */
+ case 1: /* switch 4 */
+ if (arg0->state != 2) {
+ arg0->fadeTimerUnkEu = (u16) temp_v0_10;
+ arg0->state = temp_s2_2;
}
- } else if (arg0->unk1 != 2) {
- arg0->unk12 = temp_v0_11;
- arg0->unk1 = temp_s2_2;
+ break;
+ case 2: /* switch 4 */
+ arg0->fadeRemainingFrames = (u16) temp_v0_10;
+ arg0->state = temp_s2_2;
+ arg0->fadeVelocity = (0.0f - arg0->fadeVolume) / (f32) (temp_v0_10 & 0xFFFF);
+ break;
}
break;
- case 0xDB: /* switch 1 */
- temp_v0_12 = m64_read_u8(temp_s0_2);
- temp_v1_6 = arg0->unk1;
- if (temp_v1_6 != 0) {
- if (temp_v1_6 != 1) {
- if (temp_v1_6 != 2) {
-
- }
- } else {
- arg0->unk1 = 0;
- arg0->unk18 = 0.0f;
- goto block_76;
- }
- } else {
-block_76:
- temp_v1_7 = arg0->unk12;
- arg0->unk10 = temp_v1_7;
- if (temp_v1_7 != 0) {
- arg0->unk1C = ((temp_v0_12 / 127.0f) - arg0->unk18) / (temp_v1_7 & 0xFFFF);
+ case 0xDB: /* switch 3 */
+ temp_v0_11 = m64_read_u8(temp_s0_2);
+ temp_v1_4 = arg0->state;
+ switch (temp_v1_4) { /* switch 5; irregular */
+ case 2: /* switch 5 */
+ break;
+ case 1: /* switch 5 */
+ arg0->state = 0;
+ arg0->fadeVolume = 0.0f;
+ /* fallthrough */
+ case 0: /* switch 5 */
+ temp_v1_5 = arg0->fadeTimerUnkEu;
+ arg0->fadeRemainingFrames = temp_v1_5;
+ if (temp_v1_5 != 0) {
+ arg0->fadeVelocity = (((f32) temp_v0_11 / 127.0f) - arg0->fadeVolume) / (f32) (temp_v1_5 & 0xFFFF);
} else {
- arg0->unk18 = temp_v0_12 / 127.0f;
+ arg0->fadeVolume = (f32) temp_v0_11 / 127.0f;
}
+ break;
}
break;
- case 0xD9: /* switch 1 */
- arg0->unk28 = m64_read_u8(temp_s0_2) / 127.0f;
+ case 0xD9: /* switch 3 */
+ arg0->fadeVolumeScale = (f32) m64_read_u8(temp_s0_2) / 127.0f;
break;
- case 0xD7: /* switch 1 */
+ case 0xD7: /* switch 3 */
sequence_player_init_channels(arg0, m64_read_s16(temp_s0_2) & 0xFFFF);
break;
- case 0xD6: /* switch 1 */
+ case 0xD6: /* switch 3 */
sequence_player_disable_channels(arg0, m64_read_s16(temp_s0_2) & 0xFFFF);
break;
- case 0xD5: /* switch 1 */
- arg0->unk24 = m64_read_u8(temp_s0_2) / 127.0f;
+ case 0xD5: /* switch 3 */
+ arg0->muteVolumeScale = (f32) m64_read_u8(temp_s0_2) / 127.0f;
break;
- case 0xD4: /* switch 1 */
- arg0->unk0 = arg0->unk0 | 0x20;
+ case 0xD4: /* switch 3 */
+ arg0->unk0 = (s8) ((u8) arg0->unk0 | 0x20);
break;
- case 0xD3: /* switch 1 */
- arg0->unk3 = m64_read_u8(temp_s0_2);
+ case 0xD3: /* switch 3 */
+ arg0->muteBehavior = m64_read_u8(temp_s0_2);
break;
- case 0xD1: /* switch 1 */
- case 0xD2: /* switch 1 */
- temp_v1_8 = arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF);
+ case 0xD1: /* switch 3 */
+ case 0xD2: /* switch 3 */
+ temp_v1_6 = &arg0->seqData[m64_read_s16(temp_s0_2) & 0xFFFF];
if (temp_s2 == 0xD2) {
- arg0->unk8C = temp_v1_8;
+ arg0->shortNoteVelocityTable = temp_v1_6;
} else {
- arg0->unk90 = temp_v1_8;
+ arg0->shortNoteDurationTable = temp_v1_6;
}
break;
- case 0xD0: /* switch 1 */
- arg0->unk2 = m64_read_u8(temp_s0_2);
+ case 0xD0: /* switch 3 */
+ arg0->noteAllocPolicy = m64_read_u8(temp_s0_2);
break;
- case 0xCC: /* switch 1 */
- phi_s3 = m64_read_u8(temp_s0_2);
+ case 0xCC: /* switch 3 */
+ var_s3 = m64_read_u8(temp_s0_2);
break;
- case 0xC9: /* switch 1 */
- phi_s3 &= m64_read_u8(temp_s0_2);
+ case 0xC9: /* switch 3 */
+ var_s3 &= m64_read_u8(temp_s0_2);
break;
- case 0xC8: /* switch 1 */
- phi_s3 -= m64_read_u8(temp_s0_2);
+ case 0xC8: /* switch 3 */
+ var_s3 -= m64_read_u8(temp_s0_2);
break;
- }
- } else if (temp_v0_7 >= 0x11) {
- if (temp_v0_7 >= 0x21) {
- switch (temp_v0_7) { /* switch 2 */
- case 0x50: /* switch 2 */
- phi_s3 -= arg0->unk7;
+ default: /* switch 3 */
+ switch (temp_v0_5) { /* switch 6; irregular */
+ case 0x0: /* switch 6 */
+ var_s3 = (s32) ((u32) (*arg0->channels[temp_v1_3 & 0xF] * 2) >> 0x1F);
+ break;
+ case 0x50: /* switch 6 */
+ var_s3 -= arg0->seqVariationEu[0];
break;
- case 0x70: /* switch 2 */
- arg0->unk7 = phi_s3;
+ case 0x70: /* switch 6 */
+ arg0->seqVariationEu[0] = (s8) var_s3;
break;
- case 0x80: /* switch 2 */
- phi_s3 = arg0->unk7;
+ case 0x80: /* switch 6 */
+ var_s3 = (s32) arg0->seqVariationEu[0];
break;
- case 0x90: /* switch 2 */
- sequence_channel_enable(arg0, temp_s2 & 0xF, arg0->unk14 + (m64_read_s16(temp_s0_2) & 0xFFFF));
+ case 0x90: /* switch 6 */
+ sequence_channel_enable(arg0, temp_s2 & 0xF, &arg0->seqData[m64_read_s16(temp_s0_2) & 0xFFFF]);
break;
}
- } else if (temp_v0_7 != 0x20) {
-
- }
- } else if (temp_v0_7 != 0) {
- if (temp_v0_7 != 0x10) {
-
+ break;
}
- } else {
- phi_s3 = (*(arg0 + ((temp_v1_4 & 0xF) * 4))->unk30 * 2) >> 0x1F;
+ goto loop_24;
}
- goto loop_24;
}
}
+ var_v1 = arg0;
+ var_v0_3 = 0;
+ do {
+ temp_a0_5 = var_v1->channels[0];
+ if (((s32) &gSequenceChannelNone != (s32) temp_a0_5) == 1) {
+ sp34 = var_v0_3;
+ sp30 = var_v1;
+ func_800BFD90((s32) temp_a0_5);
+ }
+ var_v0_3 += 4;
+ var_v1 += 4;
+ } while (var_v0_3 != 0x00000040);
}
- phi_v1 = arg0;
- phi_v0_3 = 0;
- do {
- temp_a0_6 = phi_v1->unk30;
- if ((&gSequenceChannelNone != temp_a0_6) == 1) {
- sp34 = phi_v0_3;
- sp30 = phi_v1;
- func_800BFD90(temp_a0_6);
- }
- temp_v0_13 = phi_v0_3 + 4;
- phi_v1 += 4;
- phi_v0_3 = temp_v0_13;
- } while (temp_v0_13 != 0x40);
}
}
- /* Duplicate return node #110. Try simplifying control flow for better match */
}
}
#else
@@ -1551,26 +1506,20 @@ GLOBAL_ASM("asm/non_matchings/audio/seqplayer/func_800C08CC.s")
#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-void process_notes(); // extern
-void sequence_player_process_sound(u32 *); // extern
-void func_800C08CC(u32 *); // extern
-extern u32 gSequencePlayers;
-extern ? gSequenceChannels;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+? func_800C08CC(struct SequencePlayer *); /* extern */
void func_800C1138(s32 arg0) {
- u32 *temp_s0;
- u32 *phi_s0;
+ struct SequencePlayer *var_s0;
- phi_s0 = &gSequencePlayers;
+ var_s0 = gSequencePlayers;
do {
- if ((*phi_s0 >> 0x1F) == 1) {
- func_800C08CC(phi_s0);
- sequence_player_process_sound(phi_s0);
+ if (((u32) *var_s0 >> 0x1F) == 1) {
+ func_800C08CC(var_s0);
+ sequence_player_process_sound(var_s0);
}
- temp_s0 = phi_s0 + 0x148;
- phi_s0 = temp_s0;
- } while (temp_s0 != &gSequenceChannels);
+ var_s0 += 0x148;
+ } while (var_s0 != gSequenceChannels);
process_notes();
}
#else
diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c
index f6dec69ec..14b907820 100644
--- a/src/audio/synthesis.c
+++ b/src/audio/synthesis.c
@@ -158,29 +158,26 @@ void synthesis_load_note_subs_eu(s32 updateIndex) {
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-Acmd *func_800B775C(s16 *, s16, Acmd *, s32); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+Acmd *func_800B775C(s16 *, s32, Acmd *, s32); /* extern */
? func_800C1138(s16); /* extern */
-? prepare_reverb_ring_buffer(s16, s32, s32); /* extern */
-Acmd *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
+void *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
Acmd *temp_v0;
Acmd *var_fp;
s16 *var_s7;
s16 temp_s0;
- s16 temp_v1;
- s16 temp_v1_2;
+ s16 temp_s2;
s16 var_s4;
s16 var_s4_2;
s32 temp_lo;
s32 var_s1;
s32 var_s3;
s32 var_s6;
- s8 temp_v0_2;
struct SynthesisReverb *var_s0;
struct SynthesisReverb *var_s0_2;
u8 temp_t4;
- u8 temp_v0_3;
+ u8 temp_v0_2;
var_s4 = gAudioBufferParameters.updatesPerFrame;
var_s6 = bufLen;
@@ -199,52 +196,48 @@ Acmd *func_800B70EC(Acmd *acmd, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
var_fp = acmd + 8;
if (var_s4_2 > 0) {
do {
+ temp_s2 = gAudioBufferParameters.updatesPerFrame;
var_s1 = 0;
if (var_s4_2 == 1) {
var_s3 = var_s6;
} else {
temp_lo = var_s6 / var_s4_2;
- temp_v1 = gAudioBufferParameters.samplesPerUpdateMax;
- if (temp_lo >= temp_v1) {
- var_s3 = (s32) temp_v1;
+ if (temp_lo >= gAudioBufferParameters.samplesPerUpdateMax) {
+ var_s3 = (s32) gAudioBufferParameters.samplesPerUpdateMax;
+ } else if (gAudioBufferParameters.samplesPerUpdateMin >= temp_lo) {
+ var_s3 = (s32) gAudioBufferParameters.samplesPerUpdateMin;
} else {
- temp_v1_2 = gAudioBufferParameters.samplesPerUpdateMin;
- if (temp_v1_2 >= temp_lo) {
- var_s3 = (s32) temp_v1_2;
- } else {
- var_s3 = (s32) gAudioBufferParameters.samplesPerUpdate;
- }
+ var_s3 = (s32) gAudioBufferParameters.samplesPerUpdate;
}
}
if (gNumSynthesisReverbs > 0) {
var_s0 = gSynthesisReverbs;
do {
if (var_s0->useReverb != 0) {
- prepare_reverb_ring_buffer((s16) var_s3, gAudioBufferParameters.updatesPerFrame - var_s4_2, var_s1);
+ prepare_reverb_ring_buffer(var_s3, temp_s2 - var_s4_2, var_s1);
}
var_s1 += 1;
var_s0 += 0x108;
} while (var_s1 < gNumSynthesisReverbs);
}
- temp_v0 = func_800B775C(var_s7, (s16) var_s3, var_fp, gAudioBufferParameters.updatesPerFrame - var_s4_2);
+ temp_v0 = func_800B775C(var_s7, var_s3, var_fp, temp_s2 - var_s4_2);
var_s4_2 -= 1;
var_fp = temp_v0;
var_s6 -= var_s3;
var_s7 += var_s3 * 4;
} while (var_s4_2 > 0);
}
- temp_v0_2 = gNumSynthesisReverbs;
var_s0_2 = gSynthesisReverbs;
- if (temp_v0_2 > 0) {
+ if (gNumSynthesisReverbs > 0) {
do {
- temp_v0_3 = var_s0_2->framesLeftToIgnore;
- if (temp_v0_3 != 0) {
- var_s0_2->framesLeftToIgnore = temp_v0_3 - 1;
+ temp_v0_2 = var_s0_2->framesLeftToIgnore;
+ if (temp_v0_2 != 0) {
+ var_s0_2->framesLeftToIgnore = temp_v0_2 - 1;
}
temp_t4 = var_s0_2->curFrame;
var_s0_2 += 0x108;
var_s0_2->unk-105 = (s8) (temp_t4 ^ 1);
- } while ((u32) var_s0_2 < (u32) &gSynthesisReverbs[temp_v0_2]);
+ } while ((u32) var_s0_2 < (u32) &gSynthesisReverbs[gNumSynthesisReverbs]);
}
*writtenCmds = (s32) (var_fp - acmd) >> 3;
return var_fp;
@@ -310,8 +303,9 @@ Acmd *synthesis_load_reverb_samples(Acmd *acmd, s16 reverbIndex, s16 updateIndex
}
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-Acmd *func_800B7C30(u8, struct NoteSub *, struct NoteSynthesisState *, s16 *, s32, Acmd *, s32); /* extern */
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+Acmd *func_800B7C30(u8, struct NoteSubEu *, struct NoteSynthesisState *, s16 *, s32, Acmd *, s32); /* extern */
+extern u8 gUseReverb;
Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
? sp84;
@@ -321,9 +315,6 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
Acmd *var_s4;
s16 var_s2;
s16 var_s3;
- s32 temp_a0;
- s32 temp_a0_2;
- s32 temp_a0_3;
s32 temp_lo;
s32 temp_lo_2;
s32 temp_t3_2;
@@ -332,14 +323,11 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
s8 *temp_t4;
s8 *temp_t5;
s8 *temp_t8;
- s8 temp_t1;
s8 var_s1;
s8 var_s1_2;
- struct NoteSub *temp_t0;
- struct NoteSub *temp_t0_2;
- struct NoteSub *temp_v0;
- struct NoteSub *temp_v0_2;
- struct NoteSub *var_v0;
+ struct NoteSubEu *temp_v0;
+ struct NoteSubEu *temp_v0_2;
+ struct NoteSubEu *var_v0;
struct SynthesisReverb *temp_t9;
u8 *var_s0;
u8 *var_s0_2;
@@ -348,13 +336,11 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
u8 temp_v1;
u8 temp_v1_2;
- temp_t1 = gNumSynthesisReverbs;
var_s2 = 0;
- if (temp_t1 == 0) {
- temp_a0 = gMaxSimultaneousNotes;
+ if (gNumSynthesisReverbs == 0) {
var_s1 = 0;
- if (temp_a0 > 0) {
- var_v0 = &gNoteSubsEu[temp_a0 * updateIndex];
+ if (gMaxSimultaneousNotes > 0) {
+ var_v0 = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex];
do {
temp_t4 = &sp84 + var_s2;
if (((u32) *var_v0 >> 0x1F) != 0) {
@@ -363,18 +349,17 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
}
var_s1 += 1;
var_v0 += 0x10;
- } while (var_s1 < temp_a0);
+ } while (var_s1 < gMaxSimultaneousNotes);
var_s1 = 0;
}
var_s3 = 0;
} else {
var_s3 = 0;
- if (temp_t1 > 0) {
- temp_a0_2 = gMaxSimultaneousNotes;
+ if (gNumSynthesisReverbs > 0) {
do {
var_s1_2 = 0;
- if (temp_a0_2 > 0) {
- var_v1 = temp_a0_2 * updateIndex;
+ if (gMaxSimultaneousNotes > 0) {
+ var_v1 = gMaxSimultaneousNotes * updateIndex;
do {
temp_v0 = &gNoteSubsEu[var_v1];
if (((u32) temp_v0->unk0 >> 0x1F) != 0) {
@@ -386,28 +371,27 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
}
var_s1_2 += 1;
var_v1 += 1;
- } while (var_s1_2 < temp_a0_2);
+ } while (var_s1_2 < gMaxSimultaneousNotes);
}
var_s3 += 1;
- } while (var_s3 < temp_t1);
+ } while (var_s3 < gNumSynthesisReverbs);
var_s3 = 0;
}
- temp_a0_3 = gMaxSimultaneousNotes;
var_s1 = 0;
- if (temp_a0_3 > 0) {
- var_v1_2 = temp_a0_3 * updateIndex;
+ if (gMaxSimultaneousNotes > 0) {
+ var_v1_2 = gMaxSimultaneousNotes * updateIndex;
do {
temp_v0_2 = &gNoteSubsEu[var_v1_2];
if (((u32) temp_v0_2->unk0 >> 0x1F) != 0) {
temp_t8 = &sp84 + var_s2;
- if ((s32) ((u8) temp_v0_2->unk1 >> 5) >= temp_t1) {
+ if ((s32) ((u8) temp_v0_2->unk1 >> 5) >= gNumSynthesisReverbs) {
var_s2 += 1;
*temp_t8 = var_s1;
}
}
var_s1 += 1;
var_v1_2 += 1;
- } while (var_s1 < temp_a0_3);
+ } while (var_s1 < gMaxSimultaneousNotes);
var_s1 = 0;
}
}
@@ -419,7 +403,7 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
temp_t9 = &gSynthesisReverbs[var_s3];
sp64 = temp_t9;
temp_t3 = temp_t9->useReverb;
- gUseReverb = (s8) temp_t3;
+ gUseReverb = temp_t3;
if ((s8) temp_t3 != 0) {
var_s4 = synthesis_resample_and_mix_reverb(var_s4, bufLen, var_s3, (s16) updateIndex);
}
@@ -427,11 +411,10 @@ Acmd *func_800B775C(s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
var_s0 = var_s1 + &sp84;
loop_31:
temp_v1 = *var_s0;
- temp_t0 = gNoteSubsEu;
temp_lo = updateIndex * gMaxSimultaneousNotes;
- if (var_s3 == ((u8) (&temp_t0[temp_v1])[temp_lo].unk1 >> 5)) {
+ if (var_s3 == ((u8) (&gNoteSubsEu[temp_v1])[temp_lo].unk1 >> 5)) {
var_s1 += 1;
- var_s4 = func_800B7C30(temp_v1, &temp_t0[temp_v1 + temp_lo], &gNotes[temp_v1].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
+ var_s4 = func_800B7C30(temp_v1, &gNoteSubsEu[temp_v1 + temp_lo], &gNotes[temp_v1].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
var_s0 += 1;
if (var_s1 < var_s2) {
goto loop_31;
@@ -448,11 +431,10 @@ loop_31:
var_s0_2 = var_s1 + &sp84;
do {
temp_v1_2 = *var_s0_2;
- temp_t0_2 = gNoteSubsEu;
temp_lo_2 = updateIndex * gMaxSimultaneousNotes;
- temp_a1 = (&temp_t0_2[temp_v1_2])[temp_lo_2].bankId;
+ temp_a1 = (&gNoteSubsEu[temp_v1_2])[temp_lo_2].bankId;
if ((((s32) gBankLoadStatus[temp_a1] < 2) ^ 1) == 1) {
- var_s4 = func_800B7C30(temp_v1_2, &temp_t0_2[temp_v1_2 + temp_lo_2], &gNotes[temp_v1_2].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
+ var_s4 = func_800B7C30(temp_v1_2, &gNoteSubsEu[temp_v1_2 + temp_lo_2], &gNotes[temp_v1_2].synthesisState, aiBuf, bufLen, var_s4, updateIndex);
} else {
gAudioErrorFlags = temp_a1 + (var_s1 << 8) + 0x10000000;
}
@@ -476,21 +458,17 @@ GLOBAL_ASM("asm/non_matchings/audio/synthesis/func_800B775C.s")
#endif
#ifdef MIPS_TO_C
-//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
-Acmd *load_wave_samples(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, u32); /* extern */
-s32 final_resample(Acmd *, struct NoteSynthesisState *, s32, u16, s32, s32); /* extern */
-Acmd *func_800B86A0(s32, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32, s32); /* extern */
-Acmd *note_apply_headset_pan_effects(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32); /* extern */
-s32 func_800BAD0C(s32, s32, s32, u8 *); /* extern */
-extern ? gUnknownData_800F6290;
+//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
+Acmd *func_800B86A0(Acmd *, struct NoteSubEu *, struct NoteSynthesisState *, s32, s32, s32, u32); /* extern */
+s32 func_800BAD0C(s32, s32, u32, u8 *); /* extern */
Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s16 *aiBuf, s32 bufLen, Acmd *acmd, s32 updateIndex) {
void *sp130;
void *sp12C;
- ? *sp128;
+ s32 *sp128;
s32 sp11C;
s32 sp118;
- s32 sp114;
+ u32 sp114;
u16 sp112;
s32 spFC;
s32 spEC;
@@ -503,7 +481,7 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
u16 sp9E;
struct Note *sp8C;
u32 sp50;
- ? *temp_a2_2;
+ Acmd *temp_a0_2;
Acmd *temp_s2;
Acmd *temp_s2_2;
Acmd *temp_s2_3;
@@ -516,8 +494,8 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
Acmd *var_s2;
Acmd *var_s2_2;
s16 var_t1;
+ s32 *temp_a2_2;
s32 temp_a0;
- s32 temp_a0_2;
s32 temp_a1_2;
s32 temp_a1_3;
s32 temp_a2;
@@ -544,15 +522,15 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
s32 var_t2;
s32 var_t3;
s32 var_t4;
- s32 var_v1;
- s32 var_v1_3;
u16 temp_t7;
u16 temp_v0;
u32 temp_s0;
u32 temp_t7_3;
u32 var_t5;
u32 var_t6;
+ u32 var_v1;
u32 var_v1_2;
+ u32 var_v1_3;
void *temp_a1;
void *temp_t7_2;
void *temp_t9;
@@ -578,7 +556,7 @@ Acmd *func_800B7C30(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynth
temp_s0 = temp_v0 >> 0x10;
var_a0 = noteSubEu->unk0;
if (var_a0 & 0x20000) {
- temp_v0_2 = load_wave_samples(acmd, noteSubEu, synthesisState, temp_s0);
+ temp_v0_2 = load_wave_samples(acmd, noteSubEu, synthesisState, (s32) temp_s0);
temp_a2 = synthesisState->samplePosInt;
sp9E = (temp_a2 * 2) + 0x1A0;
synthesisState->samplePosInt = temp_a2 + temp_s0;
@@ -619,7 +597,7 @@ loop_6:
sp128 = temp_a2_2;
}
if (((u32) (var_a0 << 0xB) >> 0x1D) != 0) {
- sp128 = &gUnknownData_800F6290;
+ sp128 = gUnknownData_800F6290;
}
if (var_t5 != 0) {
loop_15:
@@ -810,7 +788,7 @@ block_60:
}
temp_a2_4 = bufLen * 2;
sp114 = var_v1_3;
- temp_a0_2 = final_resample(acmd, synthesisState, temp_a2_4, sp112, (s32) sp9E, var_v1_3);
+ temp_a0_2 = final_resample(acmd, synthesisState, temp_a2_4, sp112, (u16) (s32) sp9E, var_v1_3);
if ((noteSubEu->headsetPanRight != 0) || (synthesisState->prevHeadsetPanRight != 0)) {
var_s0_2 = 1;
} else if ((noteSubEu->headsetPanLeft != 0) || (var_s0_2 = 0, (synthesisState->prevHeadsetPanLeft != 0))) {
@@ -819,7 +797,7 @@ block_60:
temp_v0_8 = func_800B86A0(temp_a0_2, noteSubEu, synthesisState, bufLen, 0, var_s0_2, sp114);
var_s2 = temp_v0_8;
if ((u8) noteSubEu->unk0 & 1) {
- var_s2 = note_apply_headset_pan_effects(temp_v0_8, noteSubEu, synthesisState, temp_a2_4, sp114, var_s0_2);
+ var_s2 = note_apply_headset_pan_effects(temp_v0_8, noteSubEu, synthesisState, temp_a2_4, (s32) sp114, var_s0_2);
}
return var_s2;
}