Files
SpaghettiKart/src/audio/playback.c
T
2022-04-16 23:11:40 -07:00

1232 lines
36 KiB
C

#include <ultra64.h>
#include <macros.h>
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern f32 D_800F2EB0;
extern f32 D_800F2EB4;
extern s8 D_803B70B6;
extern ? gDefaultPanVolume;
extern ? gHeadsetPanQuantization;
extern ? gHeadsetPanVolume;
extern ? gStereoPanVolume;
void func_800BC5D0(void *arg0, f32 arg1, s32 arg2, u8 arg3) {
f32 temp_f14;
f32 temp_f2;
s32 temp_a1;
s32 temp_a3;
s32 temp_t4;
s32 temp_t8;
s8 temp_t3;
s8 temp_v1;
u8 temp_t1;
u8 temp_t8_2;
void *temp_v0;
void *temp_v0_2;
s32 phi_a1;
s32 phi_a0;
s32 phi_a1_2;
f32 phi_f12;
f32 phi_f12_2;
f32 phi_f0;
void *phi_v0;
f32 phi_f2;
temp_t8 = arg2 & 0x7F;
phi_f12 = arg1;
if ((arg0->unkB0 & 0x2000000) && (temp_a1 = temp_t8 >> 3, temp_v0 = arg0 + 0xB0, phi_a1 = temp_a1, phi_v0 = temp_v0, (D_803B70B6 == 1))) {
if (temp_a1 >= 0x10) {
phi_a1 = 0xF;
}
temp_a3 = phi_a1 * 2;
temp_v0->unk4 = *(&gHeadsetPanQuantization + temp_a3);
temp_t8_2 = temp_v0->unk0 & 0xFFF7;
temp_t1 = temp_t8_2 & 0xFB;
temp_v0->unk0 = temp_t8_2;
temp_v0->unk0 = temp_t1;
temp_v0->unk0 = temp_t1 | 1;
temp_v0->unk3 = *(&gHeadsetPanQuantization + 0x1E + -temp_a3);
phi_f0 = *(&gHeadsetPanVolume + (temp_t8 * 4));
phi_f2 = *(&gHeadsetPanVolume + 0x1FC + -(temp_t8 * 4));
} else {
temp_v0_2 = arg0 + 0xB0;
temp_v1 = D_803B70B6;
phi_v0 = temp_v0_2;
if ((temp_v0_2->unk0 & 0x2000000) && (phi_a0 = 0, (temp_v1 == 0))) {
temp_v0_2->unk3 = 0;
temp_v0_2->unk4 = 0;
temp_v0_2->unk0 = temp_v0_2->unk0 & 0xFFFE;
phi_a1_2 = 0;
phi_f0 = *(&gStereoPanVolume + (temp_t8 * 4));
phi_f2 = *(&gStereoPanVolume + 0x1FC + -(temp_t8 * 4));
if (temp_t8 < 0x20) {
phi_a1_2 = 1;
} else if (temp_t8 >= 0x61) {
phi_a0 = 1;
}
temp_t3 = ((phi_a0 * 8) & 8) | (temp_v0_2->unk0 & 0xFFF7);
temp_t4 = temp_t3 & 0xFB;
temp_v0_2->unk0 = temp_t3;
temp_v0_2->unk0 = ((phi_a1_2 * 4) & 4) | temp_t4;
} else if (temp_v1 == 3) {
temp_f2 = D_800F2EB0;
phi_f0 = temp_f2;
phi_f2 = temp_f2;
} else {
phi_f0 = *(&gDefaultPanVolume + (temp_t8 * 4));
phi_f2 = *(&gDefaultPanVolume + 0x1FC + -(temp_t8 * 4));
}
}
if (arg1 < 0.0f) {
phi_f12 = 0.0f;
}
phi_f12_2 = phi_f12;
if (phi_f12 > 1.0f) {
phi_f12_2 = 1.0f;
}
temp_f14 = D_800F2EB4;
phi_v0->unk6 = phi_f12_2 * phi_f0 * temp_f14;
phi_v0->unk8 = phi_f12_2 * phi_f2 * temp_f14;
if (arg3 != phi_v0->unk5) {
phi_v0->unk5 = arg3;
phi_v0->unk0 = phi_v0->unk0 | 0x10;
return;
}
if ((phi_v0->unk0 * 2) < 0) {
phi_v0->unk0 = phi_v0->unk0 | 0x10;
return;
}
phi_v0->unk0 = phi_v0->unk0 & 0xFFEF;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BC5D0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern f32 D_800F2EB8;
extern f32 D_800F2EBC;
extern f32 D_800F2EC0;
void func_800BC840(void *arg0, f32 arg1) {
f32 temp_f2;
void *temp_v0;
void *temp_v0_2;
f32 phi_f12;
f32 phi_f0;
temp_v0 = arg0 + 0xB0;
phi_f12 = arg1;
if (arg1 < 0.0f) {
phi_f12 = 0.0f;
}
if (phi_f12 < 2.0f) {
temp_f2 = D_800F2EB8;
temp_v0_2 = arg0 + 0xB0;
temp_v0_2->unk1 = temp_v0_2->unk1 & 0xFFFE;
if (temp_f2 < phi_f12) {
phi_f0 = temp_f2;
} else {
phi_f0 = phi_f12;
}
} else {
temp_v0->unk1 = temp_v0->unk1 | 1;
if (D_800F2EBC < phi_f12) {
phi_f0 = D_800F2EC0;
} else {
phi_f0 = phi_f12 * 0.5f;
}
}
arg0->unkBA = phi_f0 * 32768.0f;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BC840.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void *func_800BC90C(void *arg0, s32 arg1) {
if (arg1 < arg0->unk1) {
return arg0 + 8;
}
if (arg0->unk2 >= arg1) {
return arg0 + 0x10;
}
return arg0 + 0x18;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BC90C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern ? D_803B03C0;
extern s32 D_803B7080;
extern s32 D_803B7198;
s32 func_800BC948(s32 arg0, s32 arg1) {
s32 temp_v1;
void *temp_v0;
if (*(&D_803B03C0 + arg0) < 2) {
D_803B7198 = arg0 + 0x10000000;
return 0;
}
temp_v0 = D_803B7080 + (arg0 * 0xC);
if (arg1 >= temp_v0->unk1) {
D_803B7198 = (arg0 << 8) + arg1 + 0x3000000;
return 0;
}
temp_v1 = *(temp_v0->unk4 + (arg1 * 4));
if (temp_v1 == 0) {
D_803B7198 = (arg0 << 8) + arg1 + 0x1000000;
return temp_v1;
}
return temp_v1;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BC948.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern ? D_803B03C0;
extern s32 D_803B7080;
extern s32 D_803B7198;
s32 func_800BC9F8(s32 arg0, s32 arg1) {
s32 temp_a2;
u32 temp_v1;
void *temp_v0;
if (*(&D_803B03C0 + arg0) < 2) {
D_803B7198 = arg0 + 0x10000000;
return 0;
}
temp_v0 = D_803B7080 + (arg0 * 0xC);
if (arg1 >= temp_v0->unk2) {
D_803B7198 = (arg0 << 8) + arg1 + 0x4000000;
return 0;
}
temp_v1 = temp_v0->unk8;
if (temp_v1 < 0x80000000) {
return 0;
}
temp_a2 = *(temp_v1 + (arg1 * 4));
if (temp_a2 == 0) {
D_803B7198 = (arg0 << 8) + arg1 + 0x5000000;
}
return temp_a2;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BC9F8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BE5BC(void *, s32, void *, void *); // extern
extern ? gDefaultNoteSub;
void func_800BCAB4(void *arg0) {
s32 temp_a1;
void *temp_a0;
void *temp_a2;
void *temp_a3;
void *temp_v0;
temp_v0 = arg0->unk44;
temp_a3 = arg0;
if (temp_v0->unk18 == 0) {
temp_a0 = arg0 + 0x58;
temp_a2 = temp_a3 + 0x34;
temp_a1 = temp_v0->unk4C->unk80;
arg0 = temp_a3;
func_800BE5BC(temp_a0, temp_a1, temp_a2, temp_a3);
} else {
arg0 = temp_a3;
func_800BE5BC(temp_a3 + 0x58, temp_v0->unk1C, temp_a3 + 0x34, temp_a3);
}
arg0->unk59 = 1;
arg0->unkB0 = gDefaultNoteSub.unk0;
arg0->unkB4 = gDefaultNoteSub.unk4;
arg0->unkB8 = gDefaultNoteSub.unk8;
arg0->unkBC = gDefaultNoteSub.unkC;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BCAB4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BC5D0(?, ?, ?); // extern
void func_800BCB48(void *arg0) {
if (((arg0->unkB0 * 2) >> 0x1F) == 1) {
arg0->unkB0 = arg0->unkB0 & 0xFFBF;
} else {
func_800BC5D0(0, 0x40, 0);
}
arg0->unk30 = 0;
arg0->unkB0 = arg0->unkB0 & 0xFF7F;
arg0->unk44 = -1;
arg0->unk40 = -1;
arg0->unkB0 = arg0->unkB0 & 0xFFDF;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BCB48.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BC5D0(void *, f32, u8, u8); // extern
? func_800BC840(void *, f32, u8, u8); // extern
? func_800BCB48(void *, void *); // extern
? func_800BD140(u32, u32); // extern
? func_800BD6B4(s32, void *); // extern
? func_800BD6F4(void *); // extern
? func_800BD7C0(void *, void *); // extern
? func_800BE468(void *); // extern
? func_800BE4D4(void *); // extern
f32 func_800BE5E0(void *); // extern
? func_800BEBA4(void *, u32); // extern
? func_800BF004(s32, void *); // extern
extern s32 D_803B1508;
extern s32 gMaxSimultaneousNotes;
void func_800BCBC4(void) {
u8 sp4B;
u8 sp49;
f32 temp_f22;
s32 *temp_s3;
s32 *temp_s3_2;
s32 *temp_v0;
s32 temp_s5;
s32 temp_v1;
s32 temp_v1_2;
s32 temp_v1_3;
u32 temp_a1;
u8 *temp_s1;
u8 *temp_s1_2;
u8 temp_v0_2;
void *temp_a0;
void *temp_a0_2;
void *temp_a1_2;
void *temp_a1_3;
void *temp_s0;
void *temp_v0_3;
s32 phi_s5;
u8 phi_v0;
u8 *phi_s1;
u8 phi_a3;
u8 phi_a2;
f32 phi_f0;
f32 phi_f20;
s32 phi_s2;
s32 *phi_s3;
s32 phi_v0_2;
s32 phi_v1;
temp_v1 = gMaxSimultaneousNotes;
phi_v1 = temp_v1;
if (temp_v1 > 0) {
phi_s5 = 0;
do {
temp_s0 = phi_s5 + D_803B1508;
temp_s1 = temp_s0 + 0x30;
phi_s1 = temp_s1;
if (temp_s0->unk44 != -1) {
temp_s1_2 = temp_s0 + 0x30;
temp_a1 = temp_s1_2->unk14;
phi_s1 = temp_s1_2;
if (temp_a1 < 0x7FFFFFFF) {
phi_v0_2 = phi_v1 * 3;
} else if (((temp_a1->unk0 >> 0x1F) != 0) || (temp_s1_2->unk0 < 2)) {
temp_a0 = temp_a1->unk4C;
temp_v0 = temp_a0->unk44;
if (temp_v0 == 0) {
func_800BEBA4(temp_a0, temp_a1);
temp_s1_2->unk0 = 1;
temp_v1_2 = gMaxSimultaneousNotes;
phi_v0_2 = temp_v1_2 * 3;
phi_v1 = temp_v1_2;
} else {
if (((*temp_v0 * 4) >= 0) || ((temp_a0->unk3 & 0xC0) == 0)) {
phi_v0 = temp_s1_2->unk0;
} else {
goto block_12;
}
goto block_15;
}
} else {
block_12:
func_800BD140(temp_a1, temp_a1);
func_800BD6F4(temp_s0);
func_800BD6B4(temp_s0->unkC + 0x10, temp_s0);
temp_s1_2->unk0 = 1;
phi_v0 = 1 & 0xFF;
goto block_15;
}
} else {
temp_v0_2 = *temp_s1;
phi_v0 = temp_v0_2;
if (temp_v0_2 >= 2) {
phi_v0_2 = phi_v1 * 3;
} else {
block_15:
if (phi_v0 != 0) {
temp_s3 = temp_s0 + 0xB0;
phi_s3 = temp_s3;
if ((phi_v0 == 1) || ((*temp_s3 * 4) < 0)) {
temp_s3_2 = temp_s0 + 0xB0;
phi_s3 = temp_s3_2;
if ((phi_s1->unk29 == 0) || ((*temp_s3_2 * 4) < 0)) {
if (phi_s1->unk18 != -1) {
func_800BCB48(temp_s0);
temp_a1_2 = phi_s1->unk18;
if (temp_a1_2->unk4C != 0) {
func_800BD7C0(temp_s0, temp_a1_2);
func_800BE4D4(temp_s0);
func_800BD6F4(temp_s0);
func_800BF004(temp_s0->unkC + 0x30, temp_s0);
phi_s1->unk18 = -1;
phi_s3 = temp_s0 + 0xB0;
goto block_27;
}
func_800BCB48(temp_s0, temp_a1_2);
func_800BD6F4(temp_s0);
func_800BF004(temp_s0->unkC, temp_s0);
phi_s1->unk18 = -1;
} else {
func_800BCB48(temp_s0);
func_800BD6F4(temp_s0);
func_800BF004(temp_s0->unkC, temp_s0);
}
} else {
goto block_27;
}
} else if (phi_s1->unk29 == 0) {
func_800BCB48(temp_s0);
func_800BD6F4(temp_s0);
func_800BF004(temp_s0->unkC, temp_s0);
} else {
block_27:
temp_f22 = func_800BE5E0(phi_s1 + 0x28);
func_800BE468(temp_s0);
temp_v0_3 = phi_s1 + 0x1C;
if (phi_s1->unk0 == 1) {
phi_a3 = temp_v0_3->unk0;
phi_a2 = temp_v0_3->unk1;
phi_f0 = temp_v0_3->unk4;
phi_f20 = temp_v0_3->unk8;
phi_s2 = ((phi_s3->unk0 << 0xB) >> 0x1D) & 0xFF;
} else {
temp_a1_3 = phi_s1->unk14;
temp_a0_2 = temp_a1_3->unk4C;
phi_a3 = temp_a0_2->unk4;
phi_a2 = temp_a1_3->unk6;
phi_f0 = temp_a1_3->unk30;
phi_f20 = temp_a1_3->unk2C;
phi_s2 = temp_a0_2->unk8 & 7;
}
sp4B = phi_a3;
sp49 = phi_a2;
func_800BC840(temp_s0, phi_f0 * (phi_s1->unkC * phi_s1->unk8), phi_a2, phi_a3);
func_800BC5D0(temp_s0, phi_f20 * temp_f22, phi_a2, phi_a3);
phi_s3->unk1 = ((phi_s2 * 4) & 0x1C) | (phi_s3->unk1 & 0xFFE3);
}
}
temp_v1_3 = gMaxSimultaneousNotes;
phi_v0_2 = temp_v1_3 * 3;
phi_v1 = temp_v1_3;
}
}
temp_s5 = phi_s5 + 0xC0;
phi_s5 = temp_s5;
} while (temp_s5 < (phi_v0_2 << 6));
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BCBC4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD6B4(s32, void *); // extern
? func_800BD6F4(void *, void *, s32, s32); // extern
extern f32 D_803B70A0;
extern f32 D_803B70A4;
void func_800BCF44(void *arg0, s32 arg1) {
void *sp1C;
f32 temp_f16;
f32 temp_f18;
s32 temp_t6;
s32 temp_v0_2;
u8 temp_t3;
u8 temp_v0_4;
void *temp_v0;
void *temp_v0_3;
void *temp_v1;
f32 phi_f18;
f32 phi_f16;
if ((arg0 != -1) && (temp_v0 = arg0->unk40, (temp_v0 != 0))) {
if (arg0 == temp_v0->unk48) {
temp_v0->unk48 = -1;
}
temp_v0_2 = temp_v0->unk44;
if (arg0 != temp_v0_2) {
if ((temp_v0_2 == -1) && (temp_v0->unk48 == -1) && (arg0 == temp_v0->unk40) && (arg1 != 6)) {
temp_v0->unk58 = temp_v0->unk58 | 0x10;
temp_v0->unk68 = D_803B70A0;
return;
}
// Duplicate return node #25. Try simplifying control flow for better match
return;
}
arg0->unk2 = 0;
if (temp_v0->unk59 != 6) {
temp_v0_3 = temp_v0 + 0x4C;
temp_v0_3->unk4 = arg0->unk30;
temp_v0_3->unk8 = arg0->unk2C;
temp_v0_3->unk1 = arg0->unk6;
temp_v1 = arg0->unk4C;
if (temp_v1 != 0) {
temp_v0_3->unk0 = temp_v1->unk4;
}
temp_t6 = temp_v0->unk44;
temp_v0->unk30 = 1;
temp_v0->unk44 = -1;
temp_v0->unk40 = temp_t6;
if (arg1 == 7) {
temp_v0->unk58 = temp_v0->unk58 | 0x10;
temp_v0->unk68 = D_803B70A0;
} else {
temp_v0->unk58 = temp_v0->unk58 | 0x20;
temp_v0_4 = arg0->unk18;
if (temp_v0_4 == 0) {
temp_t3 = arg0->unk4C->unk7C;
temp_f18 = temp_t3;
phi_f18 = temp_f18;
if (temp_t3 < 0) {
phi_f18 = temp_f18 + 4294967296.0f;
}
temp_v0->unk68 = phi_f18 * D_803B70A4;
} else {
temp_f16 = temp_v0_4;
phi_f16 = temp_f16;
if (temp_v0_4 < 0) {
phi_f16 = temp_f16 + 4294967296.0f;
}
temp_v0->unk68 = phi_f16 * D_803B70A4;
}
temp_v0->unk60 = arg0->unk4C->unk7D * temp_v0->unk6C * 0.00390625f;
}
}
if (arg1 == 6) {
sp1C = temp_v0;
func_800BD6F4(temp_v0, temp_v0, -1, arg1);
func_800BD6B4(temp_v0->unkC + 0x10, temp_v0);
}
// Duplicate return node #25. Try simplifying control flow for better match
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BCF44.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BCF44(?); // extern
void func_800BD120(void) {
func_800BCF44(6);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD120.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BCF44(?); // extern
void func_800BD140(void) {
func_800BCF44(7);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD140.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern f32 D_800F2EC4;
extern f32 D_800F2EC8;
extern f32 D_800F2ECC;
extern f32 D_800F2ED0;
extern ? gUnknownWave7;
s8 func_800BD160(void *arg0, void *arg1, s32 arg2) {
f32 temp_f12;
f32 temp_f2;
f32 phi_f0;
f32 phi_f0_2;
s8 phi_a2;
s8 phi_v1;
phi_a2 = arg2;
phi_v1 = 0;
if (arg2 < 0x80) {
phi_a2 = 0x80;
}
temp_f2 = arg1->unk24;
phi_f0 = temp_f2;
if (arg1->unk8 != 0) {
temp_f12 = arg1->unk14;
if (temp_f12 > 0.0f) {
phi_f0 = temp_f2 * (temp_f12 + 1.0f);
}
}
if (phi_f0 < 1.0f) {
phi_f0_2 = D_800F2EC4;
} else {
phi_v1 = 1;
if (phi_f0 < 2.0f) {
phi_f0_2 = D_800F2EC8;
} else {
phi_v1 = 3;
if (phi_f0 < 4.0f) {
phi_f0_2 = D_800F2ECC;
phi_v1 = 2;
} else {
phi_f0_2 = D_800F2ED0;
}
}
}
arg1->unk24 = temp_f2 * phi_f0_2;
arg0->unk31 = phi_a2;
arg0->unk32 = phi_v1;
arg0->unkBC = *(&gUnknownWave7 + (phi_a2 * 4)) + (phi_v1 << 7);
return phi_v1;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD160.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800BD160(u8); // extern
extern ? D_800E98F4;
void func_800BD264(void *arg0, void *arg1) {
s32 sp1C;
u8 temp_a2;
u8 phi_a2;
temp_a2 = arg1->unk1;
phi_a2 = temp_a2;
if (temp_a2 == 0xFF) {
phi_a2 = arg1->unk4C->unk1C;
}
sp1C = arg0->unk32;
arg0->unk18 = (arg0->unk18 * *(&D_800E98F4 + func_800BD160(phi_a2))) / *(&D_800E98F4 + sp1C);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD264.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void func_800BD308(void *arg0) {
arg0->unk0 = arg0;
arg0->unk4 = arg0;
arg0->unk8 = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD308.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD308(s32); // extern
void func_800BD318(void *arg0) {
func_800BD308();
func_800BD308(arg0 + 0x10);
func_800BD308(arg0 + 0x20);
func_800BD308(arg0 + 0x30);
arg0->unkC = arg0;
arg0->unk1C = arg0;
arg0->unk2C = arg0;
arg0->unk3C = arg0;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD318.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD318(? *); // extern
? func_800BF004(? *, s32); // extern
extern s32 D_803B1508;
extern ? D_803B5FC8;
extern s32 gMaxSimultaneousNotes;
void func_800BD368(void) {
s32 temp_s1;
s32 temp_v0;
s32 phi_s0;
s32 phi_s1;
func_800BD318(&D_803B5FC8);
phi_s0 = 0;
phi_s1 = 0;
if (gMaxSimultaneousNotes > 0) {
do {
temp_v0 = D_803B1508;
(temp_v0 + phi_s0)->unk8 = phi_s0 + temp_v0;
*(D_803B1508 + phi_s0) = 0;
func_800BF004(&D_803B5FC8, phi_s0 + D_803B1508);
temp_s1 = phi_s1 + 1;
phi_s0 += 0xC0;
phi_s1 = temp_s1;
} while (temp_s1 < gMaxSimultaneousNotes);
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD368.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD6F4(s32, ? *, ? *); // extern
? func_800BF004(? *, s32); // extern
extern ? D_803B5FC8;
extern ? D_803B5FD8;
extern ? D_803B5FE8;
extern ? D_803B5FF8;
void func_800BD418(void *arg0) {
void *sp48;
? *sp40;
s32 temp_s0;
s32 temp_s3;
s32 phi_s3;
s32 phi_s0;
void *phi_s1;
s32 phi_s0_2;
? *phi_a1;
? *phi_a2;
? *phi_s2;
void *phi_s1_2;
? *phi_a1_2;
? *phi_a2_2;
? *phi_v1;
? *phi_v0;
phi_s3 = 0;
phi_a1_2 = &D_803B5FD8;
phi_a2_2 = &D_803B5FC8;
phi_s1_2 = sp48;
phi_s2 = sp40;
phi_v1 = &D_803B5FE8;
phi_v0 = &D_803B5FF8;
do {
phi_a1 = phi_a1_2;
phi_a2 = phi_a2_2;
if (phi_s3 != 0) {
if (phi_s3 != 1) {
if (phi_s3 != 2) {
if (phi_s3 != 3) {
} else {
phi_s1_2 = arg0 + 0x30;
phi_s2 = phi_v0;
}
} else {
phi_s1_2 = arg0 + 0x20;
phi_s2 = phi_v1;
}
} else {
phi_s1_2 = arg0 + 0x10;
phi_s2 = phi_a1_2;
}
phi_s0 = phi_s1_2->unk4;
phi_s1 = phi_s1_2;
} else {
phi_s0 = arg0->unk4;
phi_s1 = arg0;
phi_s2 = phi_a2_2;
}
phi_s0_2 = phi_s0;
phi_s1_2 = phi_s1;
if (phi_s0 != phi_s1) {
loop_12:
phi_a1_2 = phi_a1;
phi_a2_2 = phi_a2;
if (phi_s0_2 != 0) {
func_800BD6F4(phi_s0_2, phi_a1, phi_a2);
func_800BF004(phi_s2, phi_s0_2);
temp_s0 = phi_s1->unk4;
phi_s0_2 = temp_s0;
phi_a1 = &D_803B5FD8;
phi_a2 = &D_803B5FC8;
phi_a1_2 = &D_803B5FD8;
phi_a2_2 = &D_803B5FC8;
phi_v1 = &D_803B5FE8;
phi_v0 = &D_803B5FF8;
phi_v1 = &D_803B5FE8;
phi_v0 = &D_803B5FF8;
if (temp_s0 != phi_s1) {
goto loop_12;
}
}
}
temp_s3 = phi_s3 + 1;
phi_s3 = temp_s3;
} while (temp_s3 != 4);
sp40 = phi_s2;
sp48 = phi_s1;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD418.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD418(); // extern
? func_800BF004(s32, s32); // extern
s32 func_800BF044(? *); // extern
extern ? D_803B5FC8;
extern ? D_803B5FD8;
extern ? D_803B5FE8;
extern ? D_803B5FF8;
void func_800BD578(s32 arg0, s32 arg1) {
? *sp48;
s32 sp44;
s32 temp_s0;
s32 temp_v0;
s32 phi_s4;
s32 phi_s0;
? *phi_s1;
s32 phi_s2;
s32 phi_s0_2;
s32 phi_s0_3;
func_800BD418();
phi_s4 = 0;
phi_s0 = 0;
if (arg1 > 0) {
phi_s1 = sp48;
phi_s2 = sp44;
loop_2:
phi_s0_2 = phi_s0;
phi_s0_3 = phi_s0;
if (phi_s4 != 4) {
if (phi_s4 != 0) {
if (phi_s4 != 1) {
if (phi_s4 != 2) {
if (phi_s4 != 3) {
} else {
phi_s1 = &D_803B5FF8;
phi_s2 = arg0 + 0x30;
}
} else {
phi_s1 = &D_803B5FE8;
phi_s2 = arg0 + 0x20;
}
} else {
phi_s1 = &D_803B5FD8;
phi_s2 = arg0 + 0x10;
}
} else {
phi_s1 = &D_803B5FC8;
phi_s2 = arg0;
}
if (phi_s0 < arg1) {
loop_13:
temp_v0 = func_800BF044(phi_s1);
phi_s0_3 = phi_s0_2;
if (temp_v0 != 0) {
func_800BF004(phi_s2, temp_v0);
temp_s0 = phi_s0_2 + 1;
phi_s0_2 = temp_s0;
phi_s0_3 = temp_s0;
if (temp_s0 < arg1) {
goto loop_13;
}
}
}
phi_s4 += 1;
phi_s0 = phi_s0_3;
if (phi_s0_3 >= arg1) {
sp44 = phi_s2;
sp48 = phi_s1;
} else {
goto loop_2;
}
}
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD578.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void func_800BD6B4(void *arg0, ? *arg1) {
if (arg1->unk0 == 0) {
arg1->unk0 = arg0;
arg1->unk4 = arg0->unk4;
*arg0->unk4 = arg1;
arg0->unk4 = arg1;
arg0->unk8 = arg0->unk8 + 1;
arg1->unkC = arg0->unkC;
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD6B4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void func_800BD6F4(void *arg0) {
void *temp_v0;
temp_v0 = arg0->unk0;
if (temp_v0 != 0) {
temp_v0->unk4 = arg0->unk4;
*arg0->unk4 = arg0->unk0;
arg0->unk0 = NULL;
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD6F4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD6F4(void *, void *); // extern
void *func_800BD720(void *arg0, s32 arg1) {
void *sp18;
void *temp_v0;
void *temp_v0_2;
void *phi_a0;
void *phi_v0;
void *phi_a0_2;
void *phi_a0_3;
temp_v0 = arg0->unk4;
phi_v0 = temp_v0;
if (temp_v0 == arg0) {
return NULL;
}
phi_a0 = temp_v0;
phi_a0_2 = temp_v0;
if (temp_v0 != arg0) {
do {
phi_a0_3 = phi_a0;
if (phi_a0->unk8->unk30 >= phi_v0->unk8->unk30) {
phi_a0_3 = phi_v0;
}
temp_v0_2 = phi_v0->unk4;
phi_a0 = phi_a0_3;
phi_v0 = temp_v0_2;
phi_a0_2 = phi_a0_3;
} while (temp_v0_2 != arg0);
}
if (phi_a0_2 == 0) {
return NULL;
}
if (phi_a0_2->unk8->unk30 >= arg1) {
return NULL;
}
sp18 = phi_a0_2;
func_800BD6F4(phi_a0_2, arg0);
return phi_a0_2->unk8;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD720.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BCAB4(); // extern
? func_800BD160(void *, void *, s32); // extern
void func_800BD7C0(void *arg0, void *arg1) {
void *sp1C;
u8 temp_a2;
void *temp_a1;
void *temp_v0;
s32 phi_a2;
void *phi_a1;
arg0->unk40 = -1;
arg0->unk44 = arg1;
arg0->unk30 = arg1->unk4C->unk5;
arg1->unk2 = 3;
arg1->unk0 = arg1->unk0 | 4;
arg1->unk40 = arg0;
arg1->unk4C->unk38 = arg0;
arg1->unk4C->unk3C = arg1;
arg1->unk2C = 0.0f;
func_800BCAB4();
temp_a1 = arg1;
temp_a2 = temp_a1->unk1;
temp_v0 = arg0 + 0xB0;
phi_a2 = temp_a2;
phi_a1 = temp_a1;
if (temp_a2 == 0xFF) {
phi_a2 = temp_a1->unk4C->unk1C;
}
temp_v0->unkC = temp_a1->unk48;
if (phi_a2 >= 0x80) {
temp_v0->unk1 = temp_v0->unk1 | 2;
} else {
temp_v0->unk1 = temp_v0->unk1 & 0xFFFD;
}
if (temp_v0->unk0 & 0x20000) {
sp1C = temp_v0;
arg1 = temp_a1;
func_800BD160(arg0, temp_a1, phi_a2);
phi_a1 = arg1;
}
(arg0 + 0xB0)->unk2 = phi_a1->unk4C->unk6;
(arg0 + 0xB0)->unk0 = ((((phi_a1->unk4C->unk0 << 5) >> 0x1F) * 2) & 2) | ((arg0 + 0xB0)->unk0 & 0xFFFD);
(arg0 + 0xB0)->unk1 = ((phi_a1->unk4C->unk7 & 3) << 5) | ((arg0 + 0xB0)->unk1 & 0xFF1F);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD7C0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD140(s32); // extern
void func_800BD8F4(void *arg0, s32 arg1) {
func_800BD140(arg0->unk44);
arg0->unk48 = arg1;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD8F4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern f32 D_803B70A0;
void func_800BD928(void *arg0, s32 arg1) {
arg0->unk48 = arg1;
arg0->unk30 = 1;
arg0->unk58 = arg0->unk58 | 0x10;
arg0->unk68 = D_803B70A0;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD928.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD6B4(s32, s32); // extern
? func_800BD7C0(s32, s32); // extern
s32 func_800BF044(); // extern
s32 func_800BD950(s32 arg0, s32 arg1) {
s32 sp1C;
s32 temp_v0;
temp_v0 = func_800BF044();
sp1C = temp_v0;
if (temp_v0 != 0) {
func_800BD7C0(temp_v0, arg1);
func_800BD6B4(arg0 + 0x30, sp1C);
}
return sp1C;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD950.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD928(s32, s32); // extern
? func_800BF004(s32, s32); // extern
s32 func_800BF044(s32); // extern
s32 func_800BD99C(s32 arg0, s32 arg1) {
s32 sp1C;
s32 temp_v0;
temp_v0 = func_800BF044(arg0 + 0x10);
sp1C = temp_v0;
if (temp_v0 != 0) {
func_800BD928(temp_v0, arg1);
func_800BF004(arg0 + 0x20, sp1C);
}
return sp1C;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD99C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800BD720(s32, u8); // extern
? func_800BD8F4(s32, void *); // extern
? func_800BF004(s32, s32); // extern
s32 func_800BD9EC(s32 arg0, void *arg1) {
s32 sp1C;
s32 temp_v0;
temp_v0 = func_800BD720(arg0 + 0x30, arg1->unk4C->unk5);
sp1C = temp_v0;
if (temp_v0 != 0) {
func_800BD8F4(temp_v0, arg1);
func_800BF004(arg0 + 0x20, sp1C);
}
return sp1C;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD9EC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800BD6F4(void *); // extern
? func_800BD928(void *, void *, void *); // extern
void *func_800BD950(? *, void *, void *); // extern
void *func_800BD99C(? *, void *, void *); // extern
void *func_800BD9EC(? *, void *, void *); // extern
? func_800BF004(s32, void *); // extern
extern ? D_803B5FC8;
void *func_800BDA44(void *arg0, void *arg2) {
void *sp24;
u8 temp_v0;
void *temp_a2;
void *temp_v0_10;
void *temp_v0_11;
void *temp_v0_12;
void *temp_v0_13;
void *temp_v0_14;
void *temp_v0_15;
void *temp_v0_16;
void *temp_v0_17;
void *temp_v0_18;
void *temp_v0_19;
void *temp_v0_20;
void *temp_v0_21;
void *temp_v0_22;
void *temp_v0_2;
void *temp_v0_3;
void *temp_v0_4;
void *temp_v0_5;
void *temp_v0_6;
void *temp_v0_7;
void *temp_v0_8;
void *temp_v0_9;
void *temp_v1;
void *phi_a2;
void *phi_a2_2;
temp_v1 = arg0->unk4C;
temp_v0 = temp_v1->unk2;
phi_a2 = arg2;
if (((temp_v0 & 1) != 0) && (temp_a2 = arg0->unk40, phi_a2 = temp_a2, (temp_a2 != 0)) && (arg0 == temp_a2->unk40) && (temp_a2->unk48 == -1)) {
sp24 = temp_a2;
func_800BD928(temp_a2, arg0, temp_a2);
func_800BD6F4(sp24);
func_800BF004(sp24->unkC + 0x20, sp24);
return sp24;
}
if ((temp_v0 & 2) != 0) {
temp_v0_2 = func_800BD950(temp_v1 + 0x84, arg0, phi_a2);
phi_a2_2 = temp_v0_2;
if ((temp_v0_2 == 0) && (temp_v0_3 = func_800BD99C(arg0->unk4C + 0x84, arg0, temp_v0_2), phi_a2_2 = temp_v0_3, (temp_v0_3 == 0)) && (temp_v0_4 = func_800BD9EC(arg0->unk4C + 0x84, arg0, temp_v0_3), phi_a2_2 = temp_v0_4, (temp_v0_4 == 0))) {
arg0->unk2 = 0;
return NULL;
}
goto block_36;
}
if ((temp_v0 & 4) != 0) {
temp_v0_5 = func_800BD950(temp_v1 + 0x84, arg0, phi_a2);
phi_a2_2 = temp_v0_5;
if ((temp_v0_5 == 0) && (temp_v0_6 = func_800BD950(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_5), phi_a2_2 = temp_v0_6, (temp_v0_6 == 0)) && (temp_v0_7 = func_800BD99C(arg0->unk4C + 0x84, arg0, temp_v0_6), phi_a2_2 = temp_v0_7, (temp_v0_7 == 0)) && (temp_v0_8 = func_800BD99C(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_7), phi_a2_2 = temp_v0_8, (temp_v0_8 == 0)) && (temp_v0_9 = func_800BD9EC(arg0->unk4C + 0x84, arg0, temp_v0_8), phi_a2_2 = temp_v0_9, (temp_v0_9 == 0)) && (temp_v0_10 = func_800BD9EC(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_9), phi_a2_2 = temp_v0_10, (temp_v0_10 == 0))) {
arg0->unk2 = 0;
return NULL;
}
goto block_36;
}
if ((temp_v0 & 8) != 0) {
temp_v0_11 = func_800BD950(&D_803B5FC8, arg0, phi_a2);
phi_a2_2 = temp_v0_11;
if ((temp_v0_11 == 0) && (temp_v0_12 = func_800BD99C(&D_803B5FC8, arg0, temp_v0_11), phi_a2_2 = temp_v0_12, (temp_v0_12 == 0)) && (temp_v0_13 = func_800BD9EC(&D_803B5FC8, arg0, temp_v0_12), phi_a2_2 = temp_v0_13, (temp_v0_13 == 0))) {
arg0->unk2 = 0;
return NULL;
}
goto block_36;
}
temp_v0_14 = func_800BD950(temp_v1 + 0x84, arg0, phi_a2);
phi_a2_2 = temp_v0_14;
if ((temp_v0_14 == 0) && (temp_v0_15 = func_800BD950(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_14), phi_a2_2 = temp_v0_15, (temp_v0_15 == 0)) && (temp_v0_16 = func_800BD950(&D_803B5FC8, arg0, temp_v0_15), phi_a2_2 = temp_v0_16, (temp_v0_16 == 0)) && (temp_v0_17 = func_800BD99C(arg0->unk4C + 0x84, arg0, temp_v0_16), phi_a2_2 = temp_v0_17, (temp_v0_17 == 0)) && (temp_v0_18 = func_800BD99C(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_17), phi_a2_2 = temp_v0_18, (temp_v0_18 == 0)) && (temp_v0_19 = func_800BD99C(&D_803B5FC8, arg0, temp_v0_18), phi_a2_2 = temp_v0_19, (temp_v0_19 == 0)) && (temp_v0_20 = func_800BD9EC(arg0->unk4C + 0x84, arg0, temp_v0_19), phi_a2_2 = temp_v0_20, (temp_v0_20 == 0)) && (temp_v0_21 = func_800BD9EC(arg0->unk4C->unk44 + 0x94, arg0, temp_v0_20), phi_a2_2 = temp_v0_21, (temp_v0_21 == 0)) && (temp_v0_22 = func_800BD9EC(&D_803B5FC8, arg0, temp_v0_21), phi_a2_2 = temp_v0_22, (temp_v0_22 == 0))) {
arg0->unk2 = 0;
return NULL;
}
block_36:
return phi_a2_2;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BDA44.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 soundAlloc(? *, ?); // extern
extern ? gNotesAndBuffersPool;
extern s32 D_803B1508;
extern s32 gMaxSimultaneousNotes;
extern ? gZeroNoteSub;
void func_800BDD34(void) {
s32 temp_s1;
void *temp_s0;
s32 phi_s2;
s32 phi_s1;
phi_s1 = 0;
if (gMaxSimultaneousNotes > 0) {
phi_s2 = 0;
do {
temp_s0 = phi_s2 + D_803B1508;
temp_s0->unkB0 = gZeroNoteSub.unk0;
temp_s0->unkB4 = gZeroNoteSub.unk4;
temp_s0->unkB8 = gZeroNoteSub.unk8;
temp_s0->unk30 = 0;
temp_s0->unk44 = -1;
temp_s0->unk48 = -1;
temp_s0->unk40 = -1;
temp_s0->unk31 = 0;
temp_s0->unk54 = 0.0f;
temp_s0->unk34 = 0;
temp_s0->unk59 = 0;
temp_s0->unk58 = 0;
temp_s0->unkA0 = 0;
temp_s0->unk80 = 0.0f;
temp_s0->unk84 = 0.0f;
temp_s0->unkBC = gZeroNoteSub.unkC;
temp_s0->unk1C = soundAlloc(&gNotesAndBuffersPool, 0xA0);
temp_s1 = phi_s1 + 1;
phi_s2 += 0xC0;
phi_s1 = temp_s1;
} while (temp_s1 < gMaxSimultaneousNotes);
}
}
#else
GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BDD34.s")
#endif