diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2023-10-19 19:26:14 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-19 17:26:14 -0600 |
| commit | 291c1d40d67487597e5e8708ec7ee1e28fbbe40c (patch) | |
| tree | 2d25e261db46e3e056188f3445aae37a7e0f8bcb /src | |
| parent | 318bf3a6c221f38731fc02abc8665282bbefe871 (diff) | |
Lots of mcathes in audio/external (#473)
Required making some changes to a the signatures of a couple
functions in other files
Signed-off-by: Taggerung <tyler.taggerung@email.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio/external.c | 1413 | ||||
| -rw-r--r-- | src/audio/external.h | 98 | ||||
| -rw-r--r-- | src/audio/port_eu.c | 2 | ||||
| -rw-r--r-- | src/audio/port_eu.h | 2 | ||||
| -rw-r--r-- | src/code_80005FD0.h | 1 |
5 files changed, 555 insertions, 961 deletions
diff --git a/src/audio/external.c b/src/audio/external.c index eff82ea7d..5315cffc6 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -12,32 +12,24 @@ #include "code_80091750.h" s8 D_8018EF10; - -typedef struct { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; -} UnkStruct8018EF18; - -UnkStruct8018EF18 D_8018EF18[12]; // probably wrong +UnkStruct8018EF18 D_8018EF18[16]; struct Unk_8018EFD8 D_8018EFD8[50]; u8 D_8018FB90; u8 D_8018FB91; -Camera *D_8018FB98[4]; // Is this real? +Camera *D_8018FB98[4]; Vec3f D_8018FBA8[4]; Vec3f D_8018FBD8[4]; u8 D_8018FC08; -s32 D_8018FC10[4]; // probably wrong. +u16 D_8018FC10[4][2]; struct Unk_8018FC20 sSoundRequests[0x100]; struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20]; u8 sSoundBankUsedListBack[SOUND_BANK_COUNT]; u8 sSoundBankFreeListFront[SOUND_BANK_COUNT]; u8 sNumSoundsInBank[SOUND_BANK_COUNT]; -struct_D_80192AB8_entry D_80192AB8[SOUND_BANK_COUNT][8]; +u8 D_80192AB8[SOUND_BANK_COUNT][8][8]; u8 D_80192C38; u8 sSoundBankDisabled[SOUND_BANK_COUNT]; -f32 D_80192C48[SOUND_BANK_COUNT][4]; +struct ChannelVolumeScaleFade D_80192C48[SOUND_BANK_COUNT]; u8 D_80192CA8[3][10]; u8 D_80192CC6[3]; u32 D_80192CD0[256]; @@ -308,32 +300,23 @@ s8 func_800C15D0(u8 bank, u8 soundId, u8 channel) { return var_a0; } -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023 -u8 D_800EA0F4 = 0; -u8 D_800EA1C0 = 0; - -s8 func_800C16E8(f32 arg0, f32 arg1, s32 arg2) { - f32 temp_f6; +#ifdef NON_MATCHING +s8 func_800C16E8(f32 arg0, f32 arg1, u8 arg2) { f32 var_f0; f32 var_f14; f32 var_f16; f32 var_f18; f32 var_f20; f32 var_f2; - f32 var_f2_2; - unksp-18.unk10 = (f64) saved_reg_f20; - unksp-18.unk1C = arg1; - unksp-18.unk20 = arg2; if (D_800EA1C0 == 0) { if (D_800EA0F4 != 0) { - var_f16 = 10.0f; + var_f2 = 10.0f; var_f14 = 20.0f; + var_f16 = 10.0f; var_f18 = 2.5f; - var_f2_2 = 10.0f; } else { - var_f2_2 = 100.0f; + var_f2 = 100.0f; var_f14 = 200.0f; var_f16 = 5.0f; var_f18 = 3.3333333f; @@ -343,19 +326,18 @@ s8 func_800C16E8(f32 arg0, f32 arg1, s32 arg2) { } else { var_f20 = arg0; } - if (var_f2_2 < var_f20) { - var_f20 = var_f2_2; + if (var_f2 < var_f20) { + var_f20 = var_f2; } - temp_f6 = unksp-18.unk1C; - if (temp_f6 < 0.0f) { - var_f0 = -temp_f6; + if (arg1 < 0.0f) { + var_f0 = -arg1; } else { - var_f0 = unksp-18.unk1C; + var_f0 = arg1; } - if (var_f2_2 < var_f0) { - var_f0 = var_f2_2; + if (var_f2 < var_f0) { + var_f0 = var_f2; } - if ((arg0 == 0.0f) && (unksp-18.unk1C == 0.0f)) { + if ((arg0 == 0.0f) && (arg1 == 0.0f)) { var_f2 = 0.5f; } else if ((arg0 >= 0.0f) && (var_f0 <= var_f20)) { var_f2 = 1.0f - ((var_f14 - var_f20) / (var_f16 * (var_f14 - var_f0))); @@ -372,7 +354,7 @@ s8 func_800C16E8(f32 arg0, f32 arg1, s32 arg2) { } return (s8) (s32) ((var_f2 * 127.0f) + 0.5f); } - return (s8) ((arg2 & 0xFF & 1) * 0x7F); + return (arg2 & 1) * 0x7F; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C16E8.s") @@ -388,81 +370,65 @@ f32 func_800C1934(u8 bank, u8 soundId) { return phi_f2; } -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -s8 func_800C16E8(f32, f32, u8); /* extern */ -extern ? D_8018EF18; -extern ? D_80192C48; - void func_800C19D0(u8 arg0, u8 arg1, u8 arg2) { f32 sp3C; s8 sp3B; f32 sp34; s8 sp33; - u8 temp_t6; - void *temp_s0; - void *temp_s0_2; + UnkStruct8018EF18 *temp_s0_2; + struct Unk_80191420 *temp_s0; - temp_t6 = arg0 & 0xFF; sp3B = 0; sp33 = 0x40; sp3C = 1.0f; sp34 = 1.0f; - switch (temp_t6) { + switch (arg0) { case 0: case 1: case 2: case 3: case 5: - temp_s0 = (temp_t6 * 0x3C0) + (arg1 * 0x30) + sSoundBanks; - arg0 = temp_t6; - temp_s0->unk1C = sqrtf(temp_s0->unk1C); - sp3C = *(&D_80192C48 + (arg0 * 0x10)) * (func_800C1480(arg0, arg1) * *temp_s0->unk14); + temp_s0 = &sSoundBanks[arg0][arg1]; + temp_s0->distance = sqrtf(temp_s0->distance); + sp3C = (func_800C1480(arg0, arg1) * *temp_s0->unk14) * D_80192C48[arg0].current; sp3B = func_800C15D0(arg0, arg1, arg2); - sp34 = *temp_s0->unk10 * func_800C1934(arg0, arg1); - sp33 = func_800C16E8(*temp_s0->unk0, *temp_s0->unk8, temp_s0->unkC); + sp34 = func_800C1934(arg0, arg1) * *temp_s0->unk10; + sp33 = func_800C16E8(*temp_s0->unk00, *temp_s0->unk08, temp_s0->cameraId); break; } - temp_s0_2 = (arg2 * 0xC) + &D_8018EF18; + temp_s0_2 = &D_8018EF18[arg2]; if (sp3C != temp_s0_2->unk0) { - func_800CBBE8(((arg2 & 0xFF) << 8) | 0x06020000 | 3, (s8) (u32) (sp3C * 127.0f)); + func_800CBBE8(((arg2 & 0xFF) << 8) | 0x06020000 | 3, (u8)(u32)(sp3C * 127.0f)); temp_s0_2->unk0 = sp3C; } - if (sp3B != temp_s0_2->unk8) { - func_800CBBE8((arg2 << 8) | 0x05020000, sp3B); - temp_s0_2->unk8 = sp3B; + if (sp3B != (s8) temp_s0_2->unk8) { + func_800CBBE8(((arg2 & 0xFF) << 8) | 0x05020000, sp3B); + temp_s0_2->unk8 = (u8) sp3B; } if (sp34 != temp_s0_2->unk4) { - func_800CBB88((arg2 << 8) | 0x04020000, sp34); + func_800CBB88(((arg2 & 0xFF) << 8) | 0x04020000, sp34); temp_s0_2->unk4 = sp34; } - if (sp33 != temp_s0_2->unk9) { - func_800CBBE8((arg2 << 8) | 0x03020000, sp33); - temp_s0_2->unk9 = sp33; + if (sp33 != (s8) temp_s0_2->unk9) { + func_800CBBE8(((arg2 & 0xFF) << 8) | 0x03020000, sp33); + temp_s0_2->unk9 = (u8) sp33; } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C19D0.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-16-2023 struct Unk_8018EFD8 *func_800C1C88(u8 arg0, f32 *position, f32 *velocity, f32 *arg3, u8 arg4, u32 soundBits) { struct Unk_8018EFD8 *temp_a1; struct Unk_8018EFD8 *temp_v1; - u8 temp_a2; u8 temp_t7; - u8 temp_v0; - temp_v0 = D_8018FB90; - temp_v1 = &D_8018EFD8[temp_v0]; + temp_v1 = &D_8018EFD8[D_8018FB90]; if (temp_v1->next != 0xFF) { - temp_a2 = D_8018FB91; - temp_a1 = &D_8018EFD8[temp_v0 & 0xFF]; - temp_a1->prev = temp_a2; - D_8018EFD8[temp_a2].next = temp_v0; + temp_a1 = &D_8018EFD8[D_8018FB90 & 0xFF]; + temp_a1->prev = D_8018FB91; + D_8018EFD8[D_8018FB91].next = D_8018FB90; temp_t7 = temp_v1->next; - D_8018FB91 = temp_v0; + D_8018FB91 = D_8018FB90; D_8018FB90 = temp_t7; D_8018EFD8[temp_t7 & 0xFF].prev = 0xFF; temp_a1->posY = position + 4; @@ -474,7 +440,7 @@ struct Unk_8018EFD8 *func_800C1C88(u8 arg0, f32 *position, f32 *velocity, f32 *a temp_a1->velZ = velocity + 8; temp_a1->unk24 = arg3; temp_a1->unk18[1] = 0.0f; - temp_a1->unk28 = arg4; + temp_a1->cameraId = arg4; temp_a1->unk30 = arg0; temp_a1->soundBits = soundBits; return temp_a1; @@ -606,11 +572,7 @@ f32 *func_800C21E8(Vec3f arg0, u32 arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c -? func_8001AAAC(s16, s16, s16); /* extern */ -? func_800CBBE8(s32, ?, s32, s32); /* extern */ -extern ? D_8018FC10; - +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-18-2023 void func_800C2274(s32 player) { s16 sp46; s16 sp44; @@ -620,19 +582,17 @@ void func_800C2274(s32 player) { s16 var_s0; s16 var_s1; s32 temp_a3; - s32 temp_v0; s32 var_a2; - struct SequenceChannel *temp_v0_2; + struct SequenceChannel *temp_v0; + u16 *temp_s1; + u16 *temp_v0_2; + u16 *temp_v0_3; u8 temp_s0; - void *temp_s1; - void *temp_v0_3; - void *temp_v0_4; temp_a3 = player & 0xFF; var_a2 = 0xF; if (((u32) gSequencePlayers[temp_a3] >> 0x1F) != 0) { - temp_v0 = gScreenModeSelection; - switch (temp_v0) { /* irregular */ + switch (gScreenModeSelection) { /* irregular */ case 0: break; case 1: @@ -645,28 +605,28 @@ void func_800C2274(s32 player) { } break; } - temp_v0_2 = gSequencePlayers[temp_a3].channels[var_a2]; - temp_s0 = (u8) temp_v0_2->soundScriptIO[0]; - if (temp_s0 != (u8) 0x00FF) { - sp46 = temp_v0_2->soundScriptIO[1] & 3; - var_s1 = temp_v0_2->soundScriptIO[2] & 0xF; + temp_v0 = gSequencePlayers[temp_a3].channels[var_a2]; + temp_s0 = (u8) temp_v0->soundScriptIO[0]; + if (temp_s0 != (u8) 0x00FFU) { + sp46 = temp_v0->soundScriptIO[1] & 3; + var_s1 = temp_v0->soundScriptIO[2] & 0xF; if (var_s1 >= 0xA) { var_s1 = 9; } - sp42 = temp_v0_2->soundScriptIO[3] & 7; - func_800CBBE8(((temp_a3 & 0xFF) << 0x10) | 0x06000000 | ((var_a2 & 0xFF) << 8), -1, var_a2, temp_a3); + sp42 = temp_v0->soundScriptIO[3] & 7; + func_800CBBE8(((temp_a3 & 0xFF) << 0x10) | 0x06000000 | ((var_a2 & 0xFF) << 8), -1); sp44 = var_s1; } switch (temp_s0) { /* switch 1; irregular */ case 1: /* switch 1 */ - temp_v0_3 = &D_8018FC10 + (sp46 * 4); - temp_v0_3->unk0 = sp44; + temp_v0_2 = D_8018FC10[sp46]; + temp_v0_2->unk0 = (u16) sp44; var_s0 = 0; - temp_v0_3->unk2 = sp42; + temp_v0_2->unk2 = sp42; do { - temp_s1 = &D_8018FC10 + (var_s0 * 4); - temp_a1 = temp_s1->unk0; - if (temp_a1 != 0x00FF) { + temp_s1 = D_8018FC10[var_s0]; + temp_a1 = (s16) temp_s1->unk0; + if (temp_a1 != (s16) 0x00FFU) { func_8001AAAC(var_s0, temp_a1, temp_s1->unk2); temp_s1->unk0 = 0x00FF; } @@ -675,9 +635,9 @@ void func_800C2274(s32 player) { } while (temp_t2 < 4); return; case 2: /* switch 1 */ - temp_v0_4 = &D_8018FC10 + (sp46 * 4); - temp_v0_4->unk0 = sp44; - temp_v0_4->unk2 = sp42; + temp_v0_3 = D_8018FC10[sp46]; + temp_v0_3->unk0 = (u16) sp44; + temp_v0_3->unk2 = sp42; break; } } @@ -686,70 +646,14 @@ void func_800C2274(s32 player) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C2274.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023 -extern ? D_8018EF18; -extern ? D_8018FC10; -static s32 D_800E9DB4[4] = { 0, 0, 0, 0 }; -static ?32 D_800E9DF4[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -s32 D_800E9E74[4] = { 0, 0, 0, 0 }; -static s32 D_800E9E84[4] = { 0, 0, 0, 0 }; -static s32 D_800E9E94[4] = { 0, 0, 0, 0 }; -static s32 D_800E9EA4[4] = { 0, 0, 0, 0 }; -u8 D_800E9F24[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -u8 D_800E9F2C[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -f32 D_800E9F34[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; -f32 D_800E9F54[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; -static ? D_800E9F74; /* unable to generate initializer */ -static ? D_800E9F78; /* unable to generate initializer */ -struct Unk_800E9F7C D_800E9F7C[4]; /* unable to generate initializer */ -struct Unk_800EA06C D_800EA06C[8]; /* unable to generate initializer */ -u8 D_800EA0EC[1] = { 0 }; -u8 D_800EA0F0 = 0; -u8 D_800EA0F4 = 0; -u8 D_800EA104 = 0; -u8 D_800EA108 = 0; -u8 D_800EA10C[4] = { 0, 0, 0, 0 }; -static f32 D_800EA130[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; -u16 D_800EA15C = 0; -u16 D_800EA160 = 0; -u8 D_800EA164 = 0; -s8 D_800EA16C = 0; -f32 D_800EA178 = 1.0f; -f32 D_800EA17C = 0.85f; -u16 D_800EA180 = 0; -static s16 D_800EA184 = 0; - void func_800C2474(void) { - Player *temp_a2; - Player *temp_t7; - f32 *temp_a0; - f32 *temp_a1; - s32 temp_at; - s32 temp_at_2; - s32 temp_lo; - s32 temp_lo_2; - s32 temp_t6; - s32 temp_t6_2; - s32 temp_t6_3; - s32 temp_t8; - s32 var_v0; - s32 var_v0_2; - s32 var_v0_3; - s32 var_v0_4; - s32 var_v1; - s8 temp_t8_2; - s8 temp_t9; - struct Unk_8018EFD8 *temp_a0_4; - void *temp_a0_2; - void *temp_a0_3; - void *temp_v1; + u8 var_v0; D_8018EF10 = 0; - D_8018FB98->unk0 = camera1; - D_8018FB98->unk4 = (Camera *) camera2; - D_8018FB98->unk8 = (Camera *) camera3; - D_8018FB98->unkC = (Camera *) camera4; + D_8018FB98[0] = camera1; + D_8018FB98[1] = camera2; + D_8018FB98[2] = camera3; + D_8018FB98[3] = camera4; D_8018FB91 = 0; D_8018FB90 = 1; D_800EA0F4 = 0; @@ -767,164 +671,96 @@ void func_800C2474(void) { D_800EA17C = 0.85f; D_800EA180 = 0; D_800EA184 = 0; - var_v0 = 0; - do { + for (var_v0 = 0; var_v0 < 4; var_v0++) { D_800E9DB4[var_v0] = 0; - D_800E9DF4[var_v0] = 0; + D_800E9DF4[var_v0] = 0; // This is an f32 FYI, but 0.0f doesn't match right :) + D_8018FBA8[var_v0][0] = 0.0f; + D_8018FBA8[var_v0][1] = 0.0f; + D_8018FBA8[var_v0][2] = 0.0f; + D_8018FBD8[var_v0][0] = 0.0f; + D_8018FBD8[var_v0][1] = 0.0f; + D_8018FBD8[var_v0][2] = 0.0f; D_800EA0EC[var_v0] = 0; D_800E9EA4[var_v0] = 0; - temp_a0 = D_8018FBA8[var_v0]; - temp_a1 = D_8018FBD8[var_v0]; - temp_a0->unk0 = 0.0f; - temp_a0->unk4 = 0.0f; - temp_a0->unk8 = 0.0f; - temp_a1->unk0 = 0.0f; - temp_a1->unk4 = 0.0f; - temp_a1->unk8 = 0.0f; - temp_a0_2 = &D_8018FC10 + (var_v0 * 4); D_800E9F7C[var_v0].unk_14 = 0; D_800E9E74[var_v0] = 0; D_800E9E84[var_v0] = 0; D_800E9E94[var_v0] = 0; - temp_a2 = &gPlayers[var_v0]; - temp_a2->boundingBoxCorners[2].surfaceType = 0; - temp_a2->boundingBoxCorners[3].surfaceType = 0; - temp_a2->effects = 0; - temp_a2->unk_20C = 0.0f; - temp_a2->unk_0C0 = 0; - temp_a2->unk_098 = 0.0f; - temp_a2->unk_0DE = 0; - temp_a0_2->unk0 = 0x00FF; - temp_a0_2->unk2 = 0; + gPlayers[var_v0].boundingBoxCorners[2].surfaceType = 0; + gPlayers[var_v0].boundingBoxCorners[3].surfaceType = 0; + gPlayers[var_v0].effects = 0; + gPlayers[var_v0].unk_20C = 0.0f; + gPlayers[var_v0].unk_0C0 = 0; + gPlayers[var_v0].unk_098 = 0.0f; + gPlayers[var_v0].unk_0DE = 0; + D_8018FC10[var_v0][0] = 0x00FF; + D_8018FC10[var_v0][1] = 0; D_800EA10C[var_v0] = 0; - *(&D_800E9F74 + var_v0) = 0; - temp_t6 = (var_v0 + 1) & 0xFF; - *(&D_800E9F78 + var_v0) = 0; - var_v0 = temp_t6; - } while (temp_t6 < 4); - var_v0_2 = 0; - do { - D_800E9F24[var_v0_2] = 0; - D_800E9F2C[var_v0_2] = 0; - D_800E9F34[var_v0_2] = 0.0f; - D_800E9F54[var_v0_2] = 0.0f; - D_800EA130[var_v0_2] = 0.0f; - temp_t8 = (var_v0_2 + 1) & 0xFF; - temp_at = temp_t8 < 8; - D_800EA06C[var_v0_2].unk0C = 0; - temp_t7 = &gPlayers[var_v0_2]; - var_v0_2 = temp_t8; - temp_t7->effects = 0; - } while (temp_at != 0); - var_v0_3 = 0; - do { - temp_lo = var_v0_3 * 0xC; - temp_t6_2 = (var_v0_3 + 1) & 0xFF; - temp_at_2 = temp_t6_2 < 0x10; - var_v0_3 = temp_t6_2; - temp_v1 = &D_8018EF18 + temp_lo; - temp_v1->unk0 = 1.0f; - temp_v1->unk4 = 1.0f; - temp_v1->unk8 = 0; - temp_v1->unk9 = 0x40; - } while (temp_at_2 != 0); - D_8018EFD8->prev = 0xFF; - D_8018EFD8->next = 0xFF; - var_v0_4 = 1; - var_v1 = 1; - do { - temp_lo_2 = var_v0_4 * 0x3C; - temp_t6_3 = (var_v0_4 + 1) & 0xFF; - temp_t8_2 = var_v1 - 1; - temp_t9 = var_v1 + 1; - var_v1 = temp_t6_3; - var_v0_4 = temp_t6_3; - temp_a0_3 = D_8018EFD8 + temp_lo_2; - temp_a0_3->unk29 = temp_t8_2; - temp_a0_3->unk2A = temp_t9; - } while (temp_t6_3 < 0x31); - temp_a0_4 = &D_8018EFD8[temp_t6_3]; - temp_a0_4->prev = temp_t6_3 - 1; - temp_a0_4->next = 0xFF; + D_800E9F74[var_v0] = 0; + D_800E9F78[var_v0] = 0; + } + for (var_v0 = 0; var_v0 < 8; var_v0++) { + D_800E9F24[var_v0] = 0; + D_800E9F2C[var_v0] = 0; + D_800E9F34[var_v0] = 0.0f; + D_800E9F54[var_v0] = 0.0f; + D_800EA130[var_v0] = 0.0f; + D_800EA06C[var_v0].unk0C = 0; + gPlayers[var_v0].effects = 0; + } + for (var_v0 = 0; var_v0 < 16; var_v0++) { + D_8018EF18[var_v0].unk0 = 1.0f; + D_8018EF18[var_v0].unk4 = 1.0f; + D_8018EF18[var_v0].unk8 = 0; + D_8018EF18[var_v0].unk9 = 0x40; + } + D_8018EFD8[0].prev = 0xFF; + D_8018EFD8[0].next = 0xFF; + for (var_v0 = 1; var_v0 < 49; var_v0++) { + D_8018EFD8[var_v0].prev = var_v0 - 1; + D_8018EFD8[var_v0].next = var_v0 + 1; + } + D_8018EFD8[var_v0].prev = var_v0 - 1; + D_8018EFD8[var_v0].next = 0xFF; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C2474.s") -#endif -#ifdef MIPS_TO_C -//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_v0; - s32 var_v1; - void *temp_a2; - void *temp_v0_2; +#ifdef NON_MATCHING +void func_800C284C(u8 arg0, u8 arg1, u8 arg2, u16 arg3) { + u8 var_v1; if ((D_800EA1EC == 0) || (arg0 == 2)) { - temp_v0 = arg0 << 0x10; - sp34 = temp_v0; - func_800CBBB8(temp_v0 | 0x82000000 | (arg1 << 8), arg3 & 0xFFFF); - temp_a2 = (arg0 * 0x24C) + &D_801930D0; - temp_f2 = temp_a2->unk0; - temp_a2->unk248 = (s16) (arg1 | (arg2 << 8)); - if (temp_f2 != 1.0f) { - sp30 = temp_a2; - func_800CBB88(temp_v0 | 0x41000000, temp_f2); + func_800CBBB8(0x82000000 | (arg0 << 0x10) | (arg1 << 8), arg3); + D_801930D0[arg0].unk_248 = arg1 | (arg2 << 8); + if (D_801930D0[arg0].unk_000 != 1.0f) { + func_800CBB88((arg0 << 0x10) | 0x41000000, D_801930D0[arg0].unk_000); } - temp_a2->unk28 = 0; - temp_a2->unk18 = 0; - temp_a2->unk14 = 0; - var_v1 = 0; - do { - 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; - } while (temp_at != 0); - temp_a2->unk244 = 0; - temp_a2->unk246 = 0; + D_801930D0[arg0].unk_028 = 0; + D_801930D0[arg0].unk_018 = 0; + D_801930D0[arg0].unk_014 = 0; + for (var_v1 = 0; var_v1 < 16; var_v1++) { + D_801930D0[arg0].unk_044[var_v1].unk_00 = 1.0f; + D_801930D0[arg0].unk_044[var_v1].unk_0C = 0; + D_801930D0[arg0].unk_044[var_v1].unk_10 = 1.0f; + D_801930D0[arg0].unk_044[var_v1].unk_1C = 0; + } + D_801930D0[arg0].unk_244 = 0; + D_801930D0[arg0].unk_246 = 0; } } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C284C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -//extern ? D_80193318; - -void func_800C29B4(u8 arg0, s32 arg1) { - func_800CBBB8((arg0 << 0x10) | 0x83000000, arg1 & 0xFFFF); - *(&D_801930D0 + (arg0 * 0x24C)) = 0xFFFF; +void func_800C29B4(u8 arg0, u16 arg1) { + func_800CBBB8(((arg0 & 0xFF) << 0x10) | 0x83000000, arg1); + D_801930D0[arg0].unk_248 = 0xFFFF; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C29B4.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-10-2023 -? func_800C29B4(u8, s32); /* extern */ -extern ? D_80192CA8; -extern ? D_801930D0; -u8 D_800EA1C0 = 0; -static s8 D_800EA1EC = 0; -static ? D_800EA1F0; /* unable to generate initializer */ -static s8 D_800EA1F4[0x4F]; - -void func_800C2A2C(u32 arg0) { +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-18-2023 +void func_800C2A2C(u16 arg0) { u8 sp5B; - s32 sp4C; /* compiler-managed */ + u32 sp4C; s32 sp48; s32 sp44; s32 sp3C; @@ -936,17 +772,13 @@ void func_800C2A2C(u32 arg0) { f32 temp_f4; f32 var_f16; f32 var_f8; - s16 var_a1; - s16 var_a1_3; s32 temp_a0; - s32 temp_a0_4; s32 temp_a0_5; s32 temp_a1; s32 temp_a2_3; s32 temp_a2_4; s32 temp_a2_5; s32 temp_a3; - s32 temp_a3_2; s32 temp_a3_3; s32 temp_at; s32 temp_at_2; @@ -958,11 +790,12 @@ void func_800C2A2C(u32 arg0) { s32 temp_t8_5; s32 temp_t8_6; s32 temp_t8_8; - s32 temp_v0_7; + s32 temp_v0_6; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; - s32 var_a0; + s32 var_a1; + s32 var_a1_3; s32 var_a3; s32 var_t0; s32 var_v0; @@ -973,15 +806,25 @@ void func_800C2A2C(u32 arg0) { s32 var_v1_4; s32 var_v1_5; s8 var_a2; + struct_D_801930D0_entry *temp_a0_4; + struct_D_801930D0_entry *temp_t6_3; + struct_D_801930D0_entry *temp_v0_3; + struct_D_801930D0_entry *temp_v0_5; + struct_D_801930D0_entry *temp_v0_7; + u32 temp_a3_2; u32 temp_t6; - u32 temp_t6_3; + u32 temp_t6_4; u32 temp_t7; u32 temp_t8; u32 temp_t8_7; u32 temp_t9_2; + u32 var_a0; u32 var_a1_2; + u8 *temp_a2; + u8 *temp_a2_2; u8 *temp_t4; u8 *temp_t4_2; + u8 *temp_v0_2; u8 temp_t0; u8 temp_t1; u8 temp_t1_2; @@ -993,16 +836,8 @@ void func_800C2A2C(u32 arg0) { void *temp_a0_3; void *temp_a1_2; void *temp_a1_3; - void *temp_a2; - void *temp_a2_2; void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; void *temp_v0_4; - void *temp_v0_5; - void *temp_v0_6; - void *temp_v0_8; - void *temp_v1_4; temp_t8 = (arg0 >> 0x1C) & 0xFF; temp_t6 = (u32) (arg0 & 0x0F000000) >> 0x18; @@ -1025,7 +860,7 @@ void func_800C2A2C(u32 arg0) { temp_a0 = arg0 & 0xFF; sp48 = temp_a0; loop_6: - if (temp_a0 == *((temp_t8_2 * 0xA) + &D_80192CA8 + (var_v1 * 2))) { + if (temp_a0 == *(D_80192CA8[temp_t8_2] + (var_v1 * 2))) { if (var_v1 == 0) { func_800C284C(unksp3F, unksp4B, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); return; @@ -1044,7 +879,7 @@ block_11: var_t0 = temp_t1 & 0xFF; if ((s32) var_t3 > 0) { do { - if ((((u32) (arg0 & 0xFF00) >> 8) & 0xFF) >= (s32) ((sp3C * 0xA) + &D_80192CA8 + (var_v1 * 2))->unk1) { + if ((((u32) (arg0 & 0xFF00) >> 8) & 0xFF) >= (s32) (D_80192CA8[sp3C] + (var_v1 * 2))->unk1) { var_t0 = var_v1 & 0xFF; var_v1 = temp_t1 & 0xFF; } @@ -1053,7 +888,7 @@ block_11: } while (temp_t8_3 < (s32) D_80192CC6[temp_a1]); } if ((var_t0 != var_t3) || (var_t0 == 0)) { - temp_a2 = (sp3C * 0xA) + &D_80192CA8; + temp_a2 = D_80192CA8[sp3C]; if ((s32) var_t3 < 5) { temp_t9 = temp_t1 + 1; *temp_t4 = temp_t9; @@ -1092,7 +927,7 @@ block_11: var_t0_2 = temp_t1_2; if ((s32) temp_t1_2 > 0) { do { - if ((arg0 & 0xFF) == *((temp_t8_4 * 0xA) + &D_80192CA8 + (var_v1_3 * 2))) { + if ((arg0 & 0xFF) == *(D_80192CA8[temp_t8_4] + (var_v1_3 * 2))) { var_t0_2 = var_v1_3 & 0xFF; var_v1_3 = temp_t1_2 & 0xFF; } @@ -1104,7 +939,7 @@ block_11: temp_a3 = temp_t1_2 - 1; var_v1_4 = var_t0_2 & 0xFF; if ((s32) var_t0_2 < temp_a3) { - temp_a2_2 = (sp3C * 0xA) + &D_80192CA8; + temp_a2_2 = D_80192CA8[sp3C]; var_v0_2 = var_v1_4; do { temp_a1_3 = temp_a2_2 + (var_v0_2 * 2); @@ -1123,8 +958,8 @@ block_11: sp34 = temp_t4_2; func_800C29B4(unksp3F, temp_a3_2 & 0xFFFF); if (*temp_t4_2 != 0) { - temp_v0_2 = (sp3C * 0xA) + &D_80192CA8; - func_800C284C((u8) sp3C, temp_v0_2->unk0, temp_v0_2->unk1, temp_a3_2); + temp_v0_2 = D_80192CA8[sp3C]; + func_800C284C((u8) sp3C, temp_v0_2->unk0, temp_v0_2->unk1, (u16) temp_a3_2); return; } } @@ -1136,17 +971,17 @@ block_11: if (temp_v1 == 0) { var_a1 = (temp_v1 + 1) & 0xFF; } - temp_v0_3 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); - temp_f2 = temp_v0_3->unk0; + temp_v0_3 = &D_801930D0[temp_t6 & 0xFF]; + temp_f2 = temp_v0_3->unk_000; temp_f0 = (f32) (arg0 & 0xFF) / 127.0f; - temp_v0_3->unk4 = temp_f0; + temp_v0_3->unk_004 = temp_f0; if (temp_f2 != temp_f0) { var_f8 = (f32) var_a1; if (var_a1 < 0) { var_f8 += 4294967296.0f; } - temp_v0_3->unkC = var_a1; - temp_v0_3->unk8 = (f32) ((temp_f2 - temp_v0_3->unk4) / var_f8); + temp_v0_3->unk_00C = (u16) var_a1; + temp_v0_3->unk_008 = (temp_f2 - temp_v0_3->unk_004) / var_f8; return; } break; @@ -1159,18 +994,19 @@ block_11: } var_v1_5 = 0; temp_a2_3 = temp_t6 & 0xFF; + temp_a0_4 = &D_801930D0[temp_a2_3]; temp_f0_2 = (f32) (arg0 & 0xFFFF) / 1000.0f; do { - temp_v0_4 = (temp_a2_3 * 0x24C) + &D_801930D0 + (var_v1_5 << 5); + temp_v0_4 = temp_a0_4 + (var_v1_5 << 5); temp_t8_6 = (var_v1_5 + 1) & 0xFF; - temp_f4 = temp_v0_4->unk54 - temp_f0_2; + temp_f4 = temp_a0_4->unk_044[var_v1_5].unk_10 - temp_f0_2; temp_at = temp_t8_6 < 0x10; var_v1_5 = temp_t8_6; temp_v0_4->unk58 = temp_f0_2; temp_v0_4->unk60 = (s16) var_a1_2; temp_v0_4->unk5C = (f32) (temp_f4 / (f32) var_a1_2); } while (temp_at != 0); - (&D_801930D0 + (temp_a2_3 * 0x24C))->unk244 = 0xFFFF; + D_801930D0[temp_a2_3].unk_244 = 0xFFFF; return; case 6: temp_t8_7 = (u32) (arg0 & 0xFF0000) >> 0xF; @@ -1181,20 +1017,18 @@ block_11: } temp_a3_3 = temp_t6 & 0xFF; temp_a2_4 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; - temp_a0_4 = temp_a2_4 << 5; - temp_v0_5 = &D_801930D0 + (temp_a3_3 * 0x24C) + temp_a0_4; + temp_t6_3 = &D_801930D0[temp_a3_3]; temp_f0_3 = (f32) (arg0 & 0xFF) / 127.0f; - temp_v0_5->unk48 = temp_f0_3; - if (temp_v0_5->unk44 != temp_f0_3) { - temp_v0_6 = &D_801930D0 + (temp_a3_3 * 0x24C); - temp_v1_4 = temp_v0_6 + temp_a0_4; + temp_t6_3->unk_044[temp_a2_4].unk4 = temp_f0_3; + if (temp_t6_3->unk_044[temp_a2_4].unk_00 != temp_f0_3) { + temp_v0_5 = &D_801930D0[temp_a3_3]; var_f16 = (f32) var_a1_3; if (var_a1_3 < 0) { var_f16 += 4294967296.0f; } - temp_v1_4->unk50 = var_a1_3; - temp_v1_4->unk4C = (f32) ((temp_v1_4->unk44 - temp_v1_4->unk48) / var_f16); - temp_v0_6->unk244 = (u16) (temp_v0_6->unk244 | (1 << temp_a2_4)); + temp_v0_5->unk_044[temp_a2_4].unk_0C = (u16) var_a1_3; + temp_v0_5->unk_044[temp_a2_4].unk_08 = (temp_v0_5->unk_044[temp_a2_4].unk_00 - temp_v0_5->unk_044[temp_a2_4].unk4) / var_f16; + temp_v0_5->unk_244 |= 1 << temp_a2_4; return; } break; @@ -1202,15 +1036,15 @@ block_11: func_800CBBE8(((temp_t6 & 0xFF) << 0x10) | 0x46000000 | ((((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF) << 8), (s8) arg0); return; case 8: - temp_v0_7 = temp_t6 & 0xFF; + temp_v0_6 = 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); + if (!(D_801930D0[temp_v0_6].unk_24A & (1 << temp_a2_5))) { + func_800CBBE8(((temp_v0_6 & 0xFF) << 0x10) | 0x06000000 | ((temp_a2_5 & 0xFF) << 8) | (((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF), (s8) arg0); return; } break; case 9: - (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk24A = (s16) arg0; + D_801930D0[temp_t6 & 0xFF].unk_24A = arg0; return; case 10: var_a0 = 1; @@ -1234,20 +1068,20 @@ block_11: } while (temp_at_2 != 0); return; case 11: - (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk14 = arg0; + D_801930D0[temp_t6 & 0xFF].unk_014 = (s32) arg0; return; case 12: if ((((u32) (arg0 & 0xF00000) >> 0x14) & 0xFF) != 0xF) { - temp_v0_8 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); - temp_t0 = temp_v0_8->unk41; - temp_v0_8->unk41 = (u8) (temp_t0 + 1); + temp_v0_7 = &D_801930D0[temp_t6 & 0xFF]; + temp_t0 = temp_v0_7->unk_041; + temp_v0_7->unk_041 = temp_t0 + 1; if ((s32) temp_t0 < 5) { - (temp_v0_8 + (temp_t0 * 4))->unk2C = arg0; - temp_v0_8->unk40 = 2; + temp_v0_7->unk_02C[temp_t0] = (u32) arg0; + temp_v0_7->unk_040 = 2; return; } } else { - (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk41 = 0; + D_801930D0[temp_t6 & 0xFF].unk_041 = 0; return; } break; @@ -1255,7 +1089,7 @@ block_11: temp_t7_2 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; switch (temp_t7_2) { /* switch 1; irregular */ case 0: /* switch 1 */ - func_800CBBB8(0xF0000000U, (s32) *(&D_800EA1F0 + (arg0 & 0xFF))); + func_800CBBB8(0xF0000000U, (u32) D_800EA1F0[arg0 & 0xFF]); return; case 1: /* switch 1 */ D_800EA1EC = arg0 & 1; @@ -1263,13 +1097,13 @@ block_11: } break; case 15: - temp_t6_3 = (u32) (arg0 & 0xFF00) >> 8; - D_800EA1C0 = (u8) temp_t6_3; + temp_t6_4 = (u32) (arg0 & 0xFF00) >> 8; + D_800EA1C0 = (u8) temp_t6_4; temp_a0_5 = arg0 & 0xFF; sp48 = temp_a0_5; - sp4C = temp_t6_3; + sp4C = temp_t6_4; func_800C13FC((void *) temp_a0_5); - *D_800EA1F4 = (s8) sp48; + *D_800EA1F4 = (u8) sp48; func_800CBBE8(0x46020000U, (s8) sp4C); func_800C5C40(); break; @@ -1290,23 +1124,12 @@ void func_800C3478(void) { } } -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -//extern ? D_80193318; - -u16 func_800C3508(s32 player) { - s32 temp_t6; - - temp_t6 = player & 0xFF; - unksp-10.unk10 = player; - if (((u32) gSequencePlayers[temp_t6] >> 0x1F) == 0) { +u16 func_800C3508(u8 player) { + if (!gSequencePlayers[player].enabled) { return 0xFFFFU; } - return *(&D_801930D0 + (temp_t6 * 0x24C)); + return D_801930D0[player].unk_248; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3508.s") -#endif u8 func_800C357C(s32 arg0) { u8 var_v1; @@ -1328,58 +1151,26 @@ void func_800C35E8(u8 arg0) { D_80192CC6[arg0] = 0; } +void func_800C3608(u8 arg0, u8 arg1) { + u8 var_v0; + u8 thing; -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_801930D0; - -void func_800C3608(s32 arg0, s32 arg1) { - s32 temp_t6; - s32 temp_t9; - s32 var_v0; - void *temp_a3; - void *temp_v1; - - temp_t6 = arg0 & 0xFF; - unksp-10.unk10 = arg0; - unksp-10.unk14 = arg1; - temp_v1 = (temp_t6 * 0x24C) + &D_801930D0; - var_v0 = 0; - if ((s32) temp_v1->unk41 > 0) { - do { - 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; - } - var_v0 = temp_t9; - } while (temp_t9 < (s32) temp_v1->unk41); + for (var_v0 = 0; var_v0 < D_801930D0[arg0].unk_041; var_v0++) { + thing = (D_801930D0[arg0].unk_02C[var_v0] & 0xF00000) >> 0x14; + if (thing == arg1) { + D_801930D0[arg0].unk_02C[var_v0] = 0xFF000000; + } } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3608.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_801930D0; - -void func_800C36C4(s32 arg0, u32 arg1, u8 arg2, s8 arg3) { - void *temp_v0; - temp_v0 = ((arg0 & 0xFF) * 0x24C) + &D_801930D0; - (temp_v0 + (arg1 & 0xFF))->unkE = arg2; - temp_v0->unk11 = arg3; - temp_v0->unk12 = 1; +void func_800C36C4(u8 arg0, u8 arg1, u8 arg2, u8 arg3) { + D_801930D0[arg0].unk_00E[arg1] = arg2; + D_801930D0[arg0].unk_011 = arg3; + D_801930D0[arg0].unk_012 = 1; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C36C4.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -//extern ? D_801930D0; - +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-17-2023 void func_800C3724(void) { f32 temp_f2; f32 var_f0; @@ -1387,11 +1178,7 @@ void func_800C3724(void) { f32 var_f16; f32 var_f6; f32 var_f8; - s16 temp_t7_2; - s16 var_t0; s32 temp_a0; - s32 temp_a0_2; - s32 temp_a0_3; s32 temp_a1; s32 temp_a3; s32 temp_a3_2; @@ -1405,7 +1192,6 @@ void func_800C3724(void) { s32 temp_t7; s32 temp_t7_3; s32 temp_t9_2; - s32 temp_v0_7; s32 temp_v1; s32 var_a2; s32 var_s0; @@ -1413,38 +1199,39 @@ void func_800C3724(void) { s32 var_s2; s32 var_s2_2; s32 var_s5; - s8 temp_a1_3; + s32 var_t0; struct SequencePlayer *temp_a1_2; + struct_D_801930D0_entry *temp_s0; + struct_D_801930D0_entry *temp_s0_2; + struct_D_801930D0_entry *temp_s0_3; + struct_D_801930D0_entry *temp_s3; + struct_D_801930D0_entry *temp_s4; + struct_D_801930D0_entry *temp_s4_2; u16 temp_t2_2; u16 temp_t4; u16 temp_t5; + u16 temp_t7_2; u16 temp_v0; u16 temp_v0_2; u16 temp_v0_3; u16 temp_v1_2; - u16 temp_v1_4; + u16 temp_v1_3; u32 temp_t5_3; u32 temp_t9; + u32 temp_v0_5; + u8 temp_a1_3; u8 temp_t2; - u8 temp_v0_6; - u8 temp_v1_6; - void *temp_s0; - void *temp_s0_2; - void *temp_s0_3; - void *temp_s3; - void *temp_v0_4; - void *temp_v0_5; - void *temp_v1_3; - void *temp_v1_5; + u8 temp_v0_4; + u8 temp_v1_4; var_s5 = 0; do { - temp_s3 = &D_801930D0 + (var_s5 * 0x24C); - if (temp_s3->unk12 != 0) { + temp_s3 = &D_801930D0[var_s5]; + if (temp_s3->unk_012 != 0) { var_f0 = 1.0f; var_s2 = 0; do { - temp_t2 = (&D_801930D0 + (var_s5 * 0x24C) + var_s2)->unkE; + temp_t2 = D_801930D0[var_s5].unk_00E[var_s2]; var_f6 = (f32) temp_t2; if ((s32) temp_t2 < 0) { var_f6 += 4294967296.0f; @@ -1454,21 +1241,21 @@ void func_800C3724(void) { var_s2 = temp_t3; var_f0 *= var_f6 / 127.0f; } while (temp_at != 0); - func_800C3448((temp_s3->unk11 << 0x10) | 0x40000000 | (var_s5 << 0x18) | ((u32) (var_f0 * 127.0f) & 0xFF)); - temp_s3->unk12 = 0U; + func_800C3448((temp_s3->unk_011 << 0x10) | 0x40000000 | (var_s5 << 0x18) | ((u32) (var_f0 * 127.0f) & 0xFF)); + temp_s3->unk_012 = 0; } - temp_v0 = temp_s3->unkC; + temp_v0 = temp_s3->unk_00C; temp_t4 = temp_v0 - 1; if (temp_v0 != 0) { - temp_s3->unkC = temp_t4; + temp_s3->unk_00C = temp_t4; if (temp_t4 & 0xFFFF) { - temp_s3->unk0 = (f32) (temp_s3->unk0 - temp_s3->unk8); + temp_s3->unk_000 -= temp_s3->unk_008; } else { - temp_s3->unk0 = (f32) temp_s3->unk4; + temp_s3->unk_000 = temp_s3->unk_004; } - func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x41000000, temp_s3->unk0); + func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x41000000, temp_s3->unk_000); } - temp_a1 = temp_s3->unk14; + temp_a1 = temp_s3->unk_014; if (temp_a1 != 0) { temp_t9 = (u32) (temp_a1 & 0xFF0000) >> 0xF; temp_a0 = temp_a1 & 0xFFF; @@ -1499,7 +1286,7 @@ void func_800C3724(void) { var_a2 = (u32) (var_f16 * ((f32) (temp_a0 & 0xFFFF) / 100.0f)) & 0xFFFF; break; case 4: /* switch 1 */ - temp_v0_2 = temp_s3->unk18; + temp_v0_2 = temp_s3->unk_018; var_a2 = temp_a3_2 & 0xFFFF; if (temp_v0_2 != 0) { var_a2 = temp_v0_2 & 0xFFFF; @@ -1513,108 +1300,104 @@ void func_800C3724(void) { if (var_a2 >= 0x12D) { var_a2 = 0x12C; } - if (temp_s3->unk18 == 0) { - temp_s3->unk18 = (u16) temp_a3_2; + if (temp_s3->unk_018 == 0) { + temp_s3->unk_018 = (u16) temp_a3_2; } var_f0_2 = (f32) var_a2; if (var_a2 < 0) { var_f0_2 += 4294967296.0f; } - temp_s3->unk20 = var_f0_2; - temp_s3->unk1C = temp_f2; + temp_s3->unk_020 = (bitwise s32) var_f0_2; + temp_s3->unk_01C = (bitwise s32) temp_f2; var_f8 = (f32) var_t0; if (var_t0 < 0) { var_f8 += 4294967296.0f; } - temp_s3->unk28 = var_t0; - temp_s3->unk24 = (f32) ((temp_f2 - var_f0_2) / var_f8); + temp_s3->unk_028 = (u16) var_t0; + temp_s3->unk_024 = (bitwise s32) ((temp_f2 - var_f0_2) / var_f8); } - temp_s3->unk14 = 0; + temp_s3->unk_014 = 0; } - temp_v0_3 = (u16) temp_s3->unk28; + temp_v0_3 = temp_s3->unk_028; temp_t7_2 = temp_v0_3 - 1; if (temp_v0_3 != 0) { - temp_s3->unk28 = temp_t7_2; + temp_s3->unk_028 = temp_t7_2; if (temp_t7_2 & 0xFFFF) { - temp_s3->unk1C = (f32) (temp_s3->unk1C - temp_s3->unk24); + temp_s3->unk_01C = (bitwise s32) ((bitwise f32) temp_s3->unk_01C - (bitwise f32) temp_s3->unk_024); } else { - temp_s3->unk1C = (f32) temp_s3->unk20; + temp_s3->unk_01C = temp_s3->unk_020; } - func_800CBBB8(((var_s5 & 0xFF) << 0x10) | 0x47000000, (s32) temp_s3->unk1C); + func_800CBBB8(((var_s5 & 0xFF) << 0x10) | 0x47000000, (u32) (s32) temp_s3->unk_01C); } - if (temp_s3->unk246 != 0) { + if (temp_s3->unk_246 != 0) { + temp_s4 = &D_801930D0[var_s5]; var_s0 = 0; do { - temp_a0_2 = var_s0 << 5; - temp_v0_4 = &D_801930D0 + (var_s5 * 0x24C) + temp_a0_2; - temp_v1_2 = temp_v0_4->unk50; + temp_v1_2 = temp_s4->unk_044[var_s0].unk_0C; temp_t5 = temp_v1_2 - 1; if (temp_v1_2 != 0) { - temp_v0_4->unk50 = temp_t5; + temp_s4->unk_044[var_s0].unk_0C = temp_t5; if (temp_t5 & 0xFFFF) { - temp_v0_4->unk44 = (f32) (temp_v0_4->unk44 - temp_v0_4->unk4C); + temp_s4->unk_044[var_s0].unk_00 -= temp_s4->unk_044[var_s0].unk_08; } else { - temp_v1_3 = temp_s3 + temp_a0_2; - temp_v1_3->unk44 = (f32) temp_v1_3->unk48; - temp_s3->unk246 = (u16) (temp_s3->unk246 ^ (1 << var_s0)); + temp_s3->unk_044[var_s0].unk_00 = temp_s3->unk_044[var_s0].unk4; + temp_s3->unk_246 ^= 1 << var_s0; } - func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x01000000 | ((var_s0 & 0xFF) << 8), temp_v0_4->unk44); + func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x01000000 | ((var_s0 & 0xFF) << 8), temp_s4->unk_044[var_s0].unk_00); } temp_t7_3 = (var_s0 + 1) & 0xFF; var_s0 = temp_t7_3; } while (temp_t7_3 < 0x10); } - if (temp_s3->unk244 != 0) { + if (temp_s3->unk_244 != 0) { + temp_s4_2 = &D_801930D0[var_s5]; var_s0_2 = 0; do { - temp_a0_3 = var_s0_2 << 5; - temp_v0_5 = &D_801930D0 + (var_s5 * 0x24C) + temp_a0_3; - temp_v1_4 = temp_v0_5->unk60; - temp_t2_2 = temp_v1_4 - 1; - if (temp_v1_4 != 0) { - temp_v0_5->unk60 = temp_t2_2; + temp_v1_3 = temp_s4_2->unk_044[var_s0_2].unk_1C; + temp_t2_2 = temp_v1_3 - 1; + if (temp_v1_3 != 0) { + temp_s4_2->unk_044[var_s0_2].unk_1C = temp_t2_2; if (temp_t2_2 & 0xFFFF) { - temp_v0_5->unk54 = (f32) (temp_v0_5->unk54 - temp_v0_5->unk5C); + temp_s4_2->unk_044[var_s0_2].unk_10 -= temp_s4_2->unk_044[var_s0_2].unk_18; } else { - temp_v1_5 = temp_s3 + temp_a0_3; - temp_v1_5->unk54 = (f32) temp_v1_5->unk58; - temp_s3->unk244 = (u16) (temp_s3->unk244 ^ (1 << var_s0_2)); + temp_s3->unk_044[var_s0_2].unk_10 = temp_s3->unk_044[var_s0_2].unk14; + temp_s3->unk_244 ^= 1 << var_s0_2; } - func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x04000000 | ((var_s0_2 & 0xFF) << 8), temp_v0_5->unk54); + func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x04000000 | ((var_s0_2 & 0xFF) << 8), temp_s4_2->unk_044[var_s0_2].unk_10); } temp_t4_2 = (var_s0_2 + 1) & 0xFF; var_s0_2 = temp_t4_2; } while (temp_t4_2 < 0x10); } - temp_v0_6 = temp_s3->unk41; - if (temp_v0_6 != 0) { - temp_v1_6 = temp_s3->unk40; - if (temp_v1_6 != 0) { - temp_s3->unk40 = (u8) (temp_v1_6 - 1); + temp_v0_4 = temp_s3->unk_041; + if (temp_v0_4 != 0) { + temp_v1_4 = temp_s3->unk_040; + if (temp_v1_4 != 0) { + temp_s3->unk_040 = temp_v1_4 - 1; } else { var_s2_2 = 0; if (((u32) gSequencePlayers[var_s5].unk0 >> 0x1F) == 0) { - if ((s32) temp_v0_6 > 0) { + if ((s32) temp_v0_4 > 0) { do { - temp_v0_7 = (&D_801930D0 + (var_s5 * 0x24C) + (var_s2_2 * 4))->unk2C; - temp_t5_3 = ((u32) (temp_v0_7 & 0xF00000) >> 0x14) & 0xFF; - temp_t2_3 = temp_v0_7 & 0xFF; - temp_s1 = ((u32) (temp_v0_7 & 0xF0000) >> 0x10) & 0xFF; - temp_a1_3 = ((u32) (temp_v0_7 & 0xFF00) >> 8) & 0xFF; + temp_v0_5 = D_801930D0[var_s5].unk_02C[var_s2_2]; + temp_t5_3 = ((u32) (temp_v0_5 & 0xF00000) >> 0x14) & 0xFF; + temp_t2_3 = temp_v0_5 & 0xFF; + temp_s1 = ((u32) (temp_v0_5 & 0xF0000) >> 0x10) & 0xFF; + temp_a1_3 = ((u32) (temp_v0_5 & 0xFF00) >> 8) & 0xFF; switch (temp_t5_3) { case 0: - temp_s0 = &D_801930D0 + (temp_s1 * 0x24C); - temp_s0->unk12 = 1; - temp_s0->unkF = 0x7F; + temp_s0 = &D_801930D0[temp_s1]; + temp_s0->unk_012 = 1; + temp_s0->unk_00E[1] = 0x7F; break; case 1: - func_800C3448(temp_s3->unk248 | 0x30000000 | (var_s5 << 0x18)); + func_800C3448(temp_s3->unk_248 | 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_s0_2->unk12 = 1; - temp_s0_2->unkF = 0x7F; + temp_s0_2 = &D_801930D0[temp_s1]; + func_800C3448(temp_s0_2->unk_248 | (temp_s1 << 0x18) | 0x10000); + temp_s0_2->unk_012 = 1; + temp_s0_2->unk_00E[1] = 0x7F; break; case 3: func_800C3448((temp_s1 << 0x18) | 0xB0003000 | (temp_a1_3 << 0x10) | temp_t2_3); @@ -1623,20 +1406,20 @@ void func_800C3724(void) { 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)); - func_800C36C4(temp_s1 & 0xFF, 1U, 0x7FU, 0); - temp_s0_3->unk42 = 0U; + temp_s0_3 = &D_801930D0[temp_s1]; + func_800C3448((temp_s0_3->unk_042 << 0x10) | (temp_s1 << 0x18) | (temp_v0_5 & 0xFFFF)); + func_800C36C4(temp_s1 & 0xFF, 1U, 0x7FU, 0U); + temp_s0_3->unk_042 = 0; break; case 6: - temp_s3->unk42 = temp_a1_3; + temp_s3->unk_042 = temp_a1_3; break; } temp_t5_2 = (var_s2_2 + 1) & 0xFF; var_s2_2 = temp_t5_2; - } while (temp_t5_2 < (s32) temp_s3->unk41); + } while (temp_t5_2 < (s32) temp_s3->unk_041); } - temp_s3->unk41 = 0U; + temp_s3->unk_041 = 0; } } } @@ -1648,81 +1431,45 @@ void func_800C3724(void) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3724.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_80192CC6; -extern ? D_801930D0; - void func_800C3F70(void) { - s32 temp_at; - s32 temp_lo; - s32 temp_t8; - s32 var_v0; - void *temp_v1; + u8 var_v0; - var_v0 = 0; - do { - 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; - temp_v1->unk28 = 0; - temp_v1->unk18 = 0; - temp_v1->unk14 = 0; - temp_v1->unk24A = 0; - temp_v1->unk41 = 0; - temp_v1->unk42 = 0; - temp_v1->unk12 = 0; - temp_v1->unkE = 0x7F; - temp_v1->unkF = 0x7F; - temp_v1->unk10 = 0x7F; - temp_v1->unk244 = 0; - temp_v1->unk246 = 0; - } while (temp_at != 0); + for (var_v0 = 0; var_v0 < 3; var_v0++) { + D_80192CC6[var_v0] = 0; + D_801930D0[var_v0].unk_248 = 0xFFFF; + D_801930D0[var_v0].unk_000 = 1.0f; + D_801930D0[var_v0].unk_00C = 0; + D_801930D0[var_v0].unk_028 = 0; + D_801930D0[var_v0].unk_018 = 0; + D_801930D0[var_v0].unk_014 = 0; + D_801930D0[var_v0].unk_24A = 0; + D_801930D0[var_v0].unk_041 = 0; + D_801930D0[var_v0].unk_042 = 0; + D_801930D0[var_v0].unk_012 = 0; + D_801930D0[var_v0].unk_00E[0] = 0x7F; + D_801930D0[var_v0].unk_00E[1] = 0x7F; + D_801930D0[var_v0].unk_00E[2] = 0x7F; + D_801930D0[var_v0].unk_244 = 0; + D_801930D0[var_v0].unk_246 = 0; + } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3F70.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_80192CC6; -extern ? D_801930D0; void func_800C400C(void) { - s32 temp_at; - s32 temp_lo; - s32 temp_t8; - s32 var_v0; - void *temp_v1; + u8 var_v0; - var_v0 = 0; - do { - 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; - temp_v1->unk14 = 0; - temp_v1->unk24A = 0; - temp_v1->unk41 = 0; - temp_v1->unk42 = 0; - temp_v1->unk244 = 0; - temp_v1->unk246 = 0; - } while (temp_at != 0); + for (var_v0 = 0; var_v0 < 3; var_v0++) { + D_80192CC6[var_v0] = 0; + D_801930D0[var_v0].unk_248 = 0xFFFF; + D_801930D0[var_v0].unk_028 = 0; + D_801930D0[var_v0].unk_018 = 0; + D_801930D0[var_v0].unk_014 = 0; + D_801930D0[var_v0].unk_24A = 0; + D_801930D0[var_v0].unk_041 = 0; + D_801930D0[var_v0].unk_042 = 0; + D_801930D0[var_v0].unk_244 = 0; + D_801930D0[var_v0].unk_246 = 0; + } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C400C.s") -#endif // Appears to be an unused combo of sound_banks_enable and sound_banks_disable void func_800C4084(u16 bankMask) { @@ -1738,18 +1485,14 @@ void func_800C4084(u16 bankMask) { } } -extern u16 D_800EA1C4; -//extern u8 D_801930D0[]; - void func_800C40F0(u8 arg0) { D_800EA1C4 &= ((1 << (arg0)) ^ (u16) -1); if (!D_800EA1C4) { - D_801930D0[0].some_innards[18] = 1; - D_801930D0[0].some_innards[16] = 0x7F; + D_801930D0[0].unk_012 = 1; + D_801930D0[0].unk_00E[2] = 0x7F; } } - void play_sound(u32 soundBits, f32 *position, u8 arg2, f32 *arg3, f32 *arg4, u8 *arg5) { u8 bank; struct Unk_8018FC20 *temp_v0; @@ -1816,14 +1559,9 @@ void func_800C41CC(u8 arg0, struct Unk_80191420 *arg1) { } } +// Probably a variant of `process_sound_request` from SM64 #ifdef MIPS_TO_C -//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 }; - +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-18-2023 void func_800C4398(void) { u8 sp4F; u8 sp4D; @@ -1875,7 +1613,7 @@ loop_4: if (var_a2->position == temp_s0->unk00) { temp_a1_2 = var_a2->soundBits; temp_v0 = temp_s0->soundBits; - temp_a0 = *(&D_800EA1A0 + ((D_800EA1C0 * 6) + var_t5)); + temp_a0 = (*D_800EA1A0)[(D_800EA1C0 * 6) + var_t5]; if (temp_a1_2 == temp_v0) { var_a3 = temp_a0 & 0xFF; var_v0_2 = var_a3; @@ -1908,7 +1646,7 @@ block_11: sp30 = var_t1; sp4D = var_a3; sp48 = var_a2; - func_800C40F0(temp_s0_2->unk2C, temp_a1_2, var_a2, var_a3); + func_800C40F0(temp_s0_2->unk2C); } temp_s0_2->cameraId = var_a2->cameraId; temp_s0_2->soundBits = var_a2->soundBits; @@ -1975,71 +1713,36 @@ block_11: GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4398.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -? func_800C40F0(u8, u8, struct Unk_80191420 *, u8); /* extern */ -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) { - struct Unk_80191420 *sp34; - struct Unk_80191420 *sp30; - struct Unk_80191420 *temp_a2; - struct Unk_80191420 *temp_v0; - u8 *temp_v1; - u8 *temp_v1_2; - u8 temp_t6; - u8 var_a1; - u8 var_a3; - - temp_t6 = soundId & 0xFF; - var_a3 = bankId & 0xFF; - temp_a2 = sSoundBanks[var_a3]; - temp_v0 = &temp_a2[temp_t6]; - var_a1 = temp_t6; - if (D_800EA1C8 != temp_v0->unk00) { - *temp_v0->unk04 = 100000.0f; +void delete_sound_from_bank(u8 bankId, u8 soundId) { + s32 stackPadding; + struct Unk_80191420 *temp = &sSoundBanks[bankId][soundId]; + if (temp->unk00 != D_800EA1C8) { + *temp->unk04 = 100000.0f; } - if (temp_v0->soundBits & 0x80000) { - bankId = var_a3; - sp34 = temp_a2; - soundId = var_a1; - sp30 = temp_v0; - func_800C40F0(temp_v0->unk2C, var_a1, temp_a2, var_a3); - var_a1 = soundId; - var_a3 = bankId; + if (temp->soundBits & 0x80000) { + func_800C40F0(temp->unk2C); } - temp_v1 = &sSoundBankUsedListBack[var_a3]; - if (var_a1 == *temp_v1) { - *temp_v1 = temp_v0->prev; + if (soundId == sSoundBankUsedListBack[bankId]) { + sSoundBankUsedListBack[bankId] = temp->prev; } else { - temp_a2[temp_v0->next].prev = temp_v0->prev; + sSoundBanks[bankId][temp->next].prev = temp->prev; } - temp_v1_2 = &sSoundBankFreeListFront[var_a3]; - temp_a2[temp_v0->prev].next = temp_v0->next; - temp_v0->prev = 0xFF; - temp_v0->next = *temp_v1_2; - temp_a2[*temp_v1_2].prev = var_a1; - *temp_v1_2 = var_a1; - temp_v0->soundStatus = 0; + sSoundBanks[bankId][temp->prev].next = temp->next; + temp->next = sSoundBankFreeListFront[bankId]; + temp->prev = 0xFF; + sSoundBanks[bankId][sSoundBankFreeListFront[bankId]].prev = soundId; + sSoundBankFreeListFront[bankId] = soundId; + temp->soundStatus = 0; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C473C.s") -#endif +// Guessing this is `select_current_sounds`? #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -? func_800C473C(s32, u8, void *, u8); /* extern */ -extern ? D_80192AB8; -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) { +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-17-2023 +void func_800C4888(u8 bankId) { u8 spCE; u8 spCC; ? sp7C; - void *sp70; + struct_D_80192AB8_entry *sp70; struct Unk_80191420 *sp6C; struct Unk_80191420 *sp68; s32 sp60; @@ -2076,6 +1779,8 @@ void func_800C4888(s32 arg0) { struct Unk_80191420 *temp_a0_2; struct Unk_80191420 *temp_t2; struct Unk_80191420 *temp_v0_7; + struct_D_80192AB8_entry *temp_s3; + struct_D_80192AB8_entry *var_a2; u32 temp_t8_2; u32 temp_v0_2; u8 temp_a1; @@ -2093,11 +1798,9 @@ void func_800C4888(s32 arg0) { void *temp_a0_4; void *temp_a3; void *temp_a3_2; - void *temp_s3; void *temp_v0_6; - void *var_a2; - temp_s5 = arg0 & 0xFF; + temp_s5 = bankId & 0xFF; var_s2 = 0; var_t3 = 0; do { @@ -2118,7 +1821,7 @@ void func_800C4888(s32 arg0) { temp_t2->freshness -= 1; } if (temp_t2->freshness == 0) { - func_800C473C(temp_s5 & 0xFF, var_s3 & 0xFF); + delete_sound_from_bank(temp_s5 & 0xFF, var_s3 & 0xFF); } else if (temp_t2->soundStatus != 0) { temp_v0 = temp_t2->unk00; if (D_800EA1C8 == temp_v0) { @@ -2153,13 +1856,13 @@ void func_800C4888(s32 arg0) { sp68 = temp_t2; func_800CBBE8((temp_t2->unk2C << 8) | 0x06020000, 0); if (temp_t2->soundBits & 0x08000000) { - func_800C473C(temp_s5 & 0xFF, var_s3 & 0xFF); + delete_sound_from_bank(temp_s5 & 0xFF, var_s3 & 0xFF); var_s3 = var_s0 & 0xFF; } } } else { var_t3_2 = 0; - temp_t4 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s5)); + temp_t4 = (*D_800EA188)[(D_800EA1C0 * 6) + temp_s5]; if ((s32) temp_t4 > 0) { do { temp_a3_2 = &sp7C + (var_t3_2 * 8); @@ -2195,7 +1898,7 @@ void func_800C4888(s32 arg0) { var_s3 = sp6C[var_s0].next; } while (var_s3 != 0xFF); } - var_t1 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s5)); + var_t1 = (*D_800EA188)[(D_800EA1C0 * 6) + temp_s5]; var_t3_3 = 0; if (var_s2 > 0) { sp6C = sSoundBanks[temp_s5]; @@ -2214,9 +1917,9 @@ void func_800C4888(s32 arg0) { } var_t0 = var_t1; if ((s32) var_t1 > 0) { - var_a2 = (temp_s5 << 6) + &D_80192AB8; + var_a2 = D_80192AB8[temp_s5]; do { - temp_s3 = var_a2 + (var_t3_3 * 8); + temp_s3 = &var_a2[var_t3_3]; temp_a1 = temp_s3->unk4; var_v1_2 = 0; if (temp_a1 == 0xFF) { @@ -2230,7 +1933,7 @@ void func_800C4888(s32 arg0) { sp60 = (s32) var_t0; spCE = var_t1; spCC = (u8) var_t3_3; - func_800C473C(temp_s5 & 0xFF, temp_a1, var_a2, temp_a3_3); + delete_sound_from_bank(temp_s5 & 0xFF, temp_a1); var_v1_2 = 1; } else { temp_a0_2->soundStatus = 1; @@ -2265,7 +1968,7 @@ void func_800C4888(s32 arg0) { var_s0_2 = 0; if ((s32) var_t0 > 0) { do { - if (temp_a3_4 == (var_a2 + (var_s0_2 * 8))->unk4) { + if (temp_a3_4 == var_a2[var_s0_2].unk4) { var_v1_2 = 0; var_s0_2 = var_t1 & 0xFF; } @@ -2297,73 +2000,41 @@ void func_800C4888(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4888.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -? func_800C19D0(s32, s32, u8); /* extern */ -? func_800C473C(s32, s32); /* extern */ -extern ? D_80192AB8; -//extern ? D_801930D0; -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; - s32 var_s4; - u8 *var_v1_2; - u8 temp_s1; - u8 temp_v0; - u8 var_v1; - void *temp_s0; - - temp_s3 = arg0 & 0xFF; - 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 + (var_s4 * 8))->unk4; - if (temp_s1 != 0xFF) { - temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + sSoundBanks; - temp_v0 = temp_s0->unk28; - if (temp_v0 == 2) { - temp_s0->unk2C = (u8) D_80192C38.unk0; - if (temp_s0->unk24 & 0x80000) { - D_800EA1C4 |= 1 << D_80192C38.unk0; - D_801930D0.unk12 = 1; - D_801930D0.unk10 = 0x28; - } - func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38); - func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000, 1); - func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24); - temp_s0->unk28 = 4U; - var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3); - goto block_11; - } - // gSequencePlayers + 0x2C0 gSequencePlayers[1].channels - if ((*(&D_803B17D0 + (D_80192C38.unk0 * 4)))->unk5F == 0x80) { - func_800CBBE8(((D_80192C38.unk0 & 0xFF) << 8) | 0x06020000 | 7, 0); - func_800C473C(temp_s3 & 0xFF, temp_s1 & 0xFF); - 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, D_80192C38.unk0); - temp_s0->unk28 = 4U; - var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3); -block_11: - var_v1 = *var_v1_2; +#ifdef NON_MATCHING +// https://decomp.me/scratch/Lm9EX +/* ~*~*~* UwU Resgister allocation OwO *~*~*~ */ +void func_800C4FE4(u8 bankId) { + u8 soundId; + u8 var_s4; + u32 cmd; + struct Unk_80191420 *temp_s0; + struct SequenceChannel *thing; + + for (var_s4 = 0; var_s4 < D_800EA188[D_800EA1C0][bankId]; var_s4++) { + soundId = D_80192AB8[bankId][var_s4][4]; + if (soundId != 0xFF) { + temp_s0 = &sSoundBanks[bankId][soundId]; + thing = gSequencePlayers[2].channels[D_80192C38]; + if (temp_s0->soundStatus == 2) { + temp_s0->unk2C = D_80192C38; + if (temp_s0->soundBits & 0x80000) { + D_800EA1C4 |= 1 << D_80192C38; + D_801930D0->unk_012 = 1; + D_801930D0->unk_00E[2] = 0x28; } + func_800C19D0(bankId, soundId, D_80192C38); + func_800CBBE8((D_80192C38 << 8) | 0x06020000, 1); + func_800CBBE8((D_80192C38 << 8) | 0x06020000 | 4, temp_s0->soundBits & 0xFF); + temp_s0->soundStatus = 4U; + } else if (((u8)thing->soundScriptIO[7]) == 0x80) { + func_800CBBE8(((D_80192C38 & 0xFF) << 8) | 0x06020000 | 7, 0); + delete_sound_from_bank(bankId, soundId); + } else if (temp_s0->soundStatus == 3) { + func_800C19D0(bankId, soundId, D_80192C38); + temp_s0->soundStatus = 4U; } - temp_t7 = (var_s4 + 1) & 0xFF; - temp_at = temp_t7 < (s32) var_v1; - var_s4 = temp_t7; - D_80192C38.unk0 += 1; - } while (temp_at != 0); + } + D_80192C38 += 1; } } #else @@ -2371,16 +2042,14 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4FE4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -? func_800C473C(s32, s32); /* extern */ - -void func_800C5278(u8 bank) { +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-17-2023 +void func_800C5278(u8 bankId) { struct Unk_80191420 sp60; s32 temp_s7; struct Unk_80191420 *temp_s0; struct Unk_80191420 *temp_s2; - temp_s7 = bank & 0xFF; + temp_s7 = bankId & 0xFF; temp_s2 = sSoundBanks[temp_s7]; if (temp_s2->next != 0xFF) { do { @@ -2389,7 +2058,7 @@ void func_800C5278(u8 bank) { func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } if (temp_s0->soundStatus != 0) { - func_800C473C(temp_s7 & 0xFF, temp_s2->next & 0xFF); + delete_sound_from_bank(temp_s7 & 0xFF, temp_s2->next & 0xFF); } } while (temp_s2->next != 0xFF); } @@ -2415,7 +2084,7 @@ void func_800C5384(u8 arg0, f32 *arg1) } if (sSoundBanks[arg0][next].soundStatus != 0) { - func_800C473C(arg0, next); + delete_sound_from_bank(arg0, next); } } else { curr = next; @@ -2425,22 +2094,14 @@ void func_800C5384(u8 arg0, f32 *arg1) } } -struct UnkStruct { - s32 unk0; - char filler4[0x20]; - s32 unk24; - char filler28[0x8]; -}; - -void func_800C54B8(u8 arg0, s32 arg1) { - struct UnkStruct unk; +void func_800C54B8(u8 arg0, f32 *arg1) { + struct Unk_80191420 unk; func_800C5384(arg0, arg1); - unk.unk24 = arg0 << 0x1C; - unk.unk0 = arg1; - func_800C41CC(1, (void*)&unk); + unk.soundBits = arg0 << 0x1C; + unk.unk00 = arg1; + func_800C41CC(1, &unk); } - void func_800C550C(s32 arg0) { UNUSED s32 pad[11]; u8 i; @@ -2454,9 +2115,8 @@ void func_800C550C(s32 arg0) { func_800C41CC(2U, (struct Unk_80191420*) &sp3C); } - #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-10-2023 +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-18-2023 void func_800C5578(f32 *arg0, u32 arg1) { u32 sp84; f32 *sp60; @@ -2480,7 +2140,7 @@ void func_800C5578(f32 *arg0, u32 arg1) { func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } if (temp_s0->soundStatus != 0) { - func_800C473C(temp_t8 & 0xFF, var_s1 & 0xFF); + delete_sound_from_bank(temp_t8 & 0xFF, var_s1 & 0xFF); } var_s1 = 0xFF; var_v0 = 0xFF; @@ -2502,7 +2162,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5578.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-10-2023 +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-17-2023 void func_800C56F0(u32 arg0) { struct Unk_80191420 sp68; s32 temp_t8; @@ -2523,7 +2183,7 @@ void func_800C56F0(u32 arg0) { func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } if (temp_s0->soundStatus != 0) { - func_800C473C(temp_t8 & 0xFF, var_s1 & 0xFF); + delete_sound_from_bank(temp_t8 & 0xFF, var_s1 & 0xFF); } var_s1 = temp_s3[var_s2].next; } else { @@ -2547,67 +2207,32 @@ void func_800C5848(void) { } } -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_80192C48; - -void func_800C58B8(u8 arg0, u8 arg1, u16 arg2) { - f32 temp_f0; - f32 var_f8; - s16 temp_t8; - s16 var_a2; - void *temp_v0; +// EXTREMELY similar to `fade_channel_volume_scale` from SM64 +void fade_channel_volume_scale(u8 player, u8 targetScale, u16 fadeDuration) { + struct ChannelVolumeScaleFade *temp_v0; - unksp-10.unk10 = (s32) arg0; - unksp-10.unk14 = (s32) arg1; - unksp-10.unk18 = (s32) arg2; - temp_t8 = arg2 & 0xFFFF; - var_a2 = temp_t8; - if (temp_t8 == 0) { - var_a2 = (temp_t8 + 1) & 0xFFFF; - } - temp_v0 = ((arg0 & 0xFF) * 0x10) + &D_80192C48; - temp_f0 = (f32) (arg1 & 0xFF) / 127.0f; - temp_v0->unkC = var_a2; - var_f8 = (f32) var_a2; - temp_v0->unk4 = temp_f0; - if (var_a2 < 0) { - var_f8 += 4294967296.0f; + if (fadeDuration == 0) { + fadeDuration++; } - temp_v0->unk8 = (f32) ((temp_v0->unk0 - temp_f0) / var_f8); + temp_v0 = &D_80192C48[player]; + temp_v0->target = targetScale / US_FLOAT(127.0); + temp_v0->remainingFrames = fadeDuration; + temp_v0->velocity = (temp_v0->current - temp_v0->target) / fadeDuration; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C58B8.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023 -extern ? D_80192C48; - -void func_800C5968(s32 arg0) { - u16 temp_t9; - u16 temp_v1; - void *temp_v0; +void func_800C5968(u8 arg0) { + struct ChannelVolumeScaleFade *temp_v0; - 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) { - temp_v0->unk0 = (f32) (temp_v0->unk0 - temp_v0->unk8); - return; + temp_v0 = &D_80192C48[arg0]; + if (temp_v0->remainingFrames != 0) { + temp_v0->remainingFrames--; + if (temp_v0->remainingFrames != 0) { + temp_v0->current -= temp_v0->velocity; + } else { + temp_v0->current = temp_v0->target; } - temp_v0->unk0 = (f32) temp_v0->unk4; } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5968.s") -#endif - - -extern s32 D_803B17D0; void func_800C59C4(void) { @@ -2623,104 +2248,38 @@ void func_800C59C4(void) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c -extern ? D_80192AB8; -extern ? D_80192C48; -static s16 D_800EA1C4 = 0; /* const */ -u8 sNumProcessedSoundRequests = 0; /* const */ -u8 sSoundRequestCount = 0; /* const */ - // Looks EXTEREMELY similar to sound_init from SM64 -// Its not quite the same but some very similar loops are found in each -void func_800C5A3C(void) { - s32 temp_at; - s32 temp_at_2; - s32 temp_at_3; - s32 temp_lo; - s32 temp_t3; - s32 temp_t4; - s32 temp_t4_2; - s32 temp_t4_3; - s32 temp_t8; - s32 var_a0; - s32 var_v0; - s32 var_v0_2; - s32 var_v0_3; - s32 var_v1; - s32 var_v1_2; - s8 temp_t3_2; - s8 temp_t9_2; - struct Unk_80191420 *temp_a1; - struct Unk_80191420 *temp_a1_3; - struct Unk_80191420 *temp_a2; - void *temp_a1_2; - void *temp_t9; - void *temp_v1; +void sound_init(void) { + u8 var_v0; + u8 var_v1; sSoundRequestCount = 0; sNumProcessedSoundRequests = 0; D_800EA1C4 = 0; - var_v0 = 0; - do { + for (var_v0 = 0; var_v0 < 6; var_v0++) { sSoundBankUsedListBack[var_v0] = 0; sSoundBankFreeListFront[var_v0] = 1; - temp_t4 = (var_v0 + 1) & 0xFF; sNumSoundsInBank[var_v0] = 0; - temp_at = temp_t4 < 6; sSoundBankDisabled[var_v0] = 0; - temp_v1 = &D_80192C48 + (var_v0 * 0x10); - var_v0 = temp_t4; - temp_v1->unk0 = 1.0f; - temp_v1->unkC = 0; - } while (temp_at != 0); - var_v0_2 = 0; - do { - var_v1 = 0; -loop_4: - temp_t3 = (var_v1 + 1) & 0xFF; - temp_at_2 = temp_t3 < 8; - temp_t9 = (var_v0_2 << 6) + &D_80192AB8 + (var_v1 * 8); - var_v1 = temp_t3; - temp_t9->unk4 = 0xFFU; - if (temp_at_2 != 0) { - goto loop_4; + D_80192C48[var_v0].current = 1.0f; + D_80192C48[var_v0].remainingFrames = 0; + } + for (var_v0 = 0; var_v0 < 6; var_v0++) { + for (var_v1 = 0; var_v1 < 8; var_v1++) { + D_80192AB8[var_v0][var_v1][4] = 0xFF; } - temp_t4_2 = (var_v0_2 + 1) & 0xFF; - var_v0_2 = temp_t4_2; - } while (temp_t4_2 < 6); - var_v0_3 = 0; - do { - temp_a2 = sSoundBanks[var_v0_3]; - var_v1_2 = 1; - var_a0 = 1; - temp_a1 = sSoundBanks[var_v0_3]; - temp_a1->prev = 0xFF; - temp_a1->next = 0xFF; -loop_8: - temp_lo = var_v1_2 * 0x30; - temp_t4_3 = (var_v1_2 + 1) & 0xFF; - temp_t9_2 = var_a0 - 1; - temp_t3_2 = var_a0 + 1; - var_a0 = temp_t4_3; - var_v1_2 = temp_t4_3; - temp_a1_2 = temp_a2 + temp_lo; - temp_a1_2->unk2A = temp_t9_2; - temp_a1_2->unk2B = temp_t3_2; - if (temp_t4_3 < 0x13) { - goto loop_8; + } + for (var_v0 = 0; var_v0 < 6; var_v0++) { + sSoundBanks[var_v0][0].prev = 0xFF; + sSoundBanks[var_v0][0].next = 0xFF; + for (var_v1 = 1; var_v1 < 19; var_v1++) { + sSoundBanks[var_v0][var_v1].prev = var_v1 - 1; + sSoundBanks[var_v0][var_v1].next = var_v1 + 1; } - temp_t8 = (var_v0_3 + 1) & 0xFF; - temp_at_3 = temp_t8 < 6; - var_v0_3 = temp_t8; - temp_a1_3 = &temp_a2[temp_t4_3]; - temp_a1_3->prev = temp_t4_3 - 1; - temp_a1_3->next = 0xFF; - } while (temp_at_3 != 0); + sSoundBanks[var_v0][var_v1].prev = var_v1 - 1; + sSoundBanks[var_v0][var_v1].next = 0xFF; + } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5A3C.s") -#endif void func_800C5BD0(void) { if (D_800EA1C0 == 0) { @@ -2730,7 +2289,6 @@ void func_800C5BD0(void) { } } - void func_800C5C40(void) { func_800C2474(); @@ -2740,7 +2298,7 @@ void func_800C5C40(void) { D_800E9DA0++; func_800C3F70(); } - func_800C5A3C(); + sound_init(); func_800C284C(2, 0, 0xFF, 1); func_800C5BD0(); } @@ -2749,7 +2307,7 @@ void func_800C5C40(void) { void func_800C5CB8(void) { func_800C2474(); func_800C3F70(); - func_800C5A3C(); + sound_init(); func_800C284C(2, 0, 0xFF, 1); } @@ -4156,11 +3714,11 @@ void func_800CA330(u8 arg0) { void func_800CA388(u8 arg0) { arg0 *= 2; - func_800C58B8(0, 0, arg0); - func_800C58B8(1, 0, arg0); - func_800C58B8(2, 0, arg0); - func_800C58B8(3, 0, arg0); - func_800C58B8(5, 0, arg0); + fade_channel_volume_scale(0, 0, arg0); + fade_channel_volume_scale(1, 0, arg0); + fade_channel_volume_scale(2, 0, arg0); + fade_channel_volume_scale(3, 0, arg0); + fade_channel_volume_scale(5, 0, arg0); } void func_800CA414(u16 arg0, u16 arg1) { @@ -4330,26 +3888,21 @@ void func_800CAD40(UNUSED s32 arg0) { } -#ifdef NON_MATCHING -// There's some bad ordering of the commands. This ought to be -// functionally equivalent - void func_800CADD0(u8 arg0, f32 arg1) { - f32 var_f12; - if (D_800EA108 == 0) { switch(D_800EA0EC[arg0]) { case 2: D_800EA0EC[arg0] = 1; + // Purposeful fallthrough case 0: - var_f12 = (arg1 * 0.55f) + 0.45f; - if (var_f12 > 1.0f) { - var_f12 = 1.0f; + arg1 = (arg1 * 0.55f) + 0.45f; + if (arg1 > 1.0f) { + arg1 = 1.0f; } - if (var_f12 < 0.0f) { - var_f12 = 0.0f; + if (arg1 < 0.0f) { + arg1 = 0.0f; } - D_800EA110[arg0] = var_f12; + D_800EA110[arg0] = arg1; play_sound(0x1900A209U, D_800E9F7C[arg0].pos, arg0, &D_800EA1D4, &D_800EA110[arg0], (u8 *) &D_800E9F7C[arg0].unk_14); break; default: @@ -4357,55 +3910,29 @@ void func_800CADD0(u8 arg0, f32 arg1) { } } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800CADD0.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023 -s16 gCurrentCourseId; /* unable to generate initializer */ -struct Unk_800E9F7C D_800E9F7C[4]; /* 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_v0_2; - f32 var_f12; - struct Unk_800E9F7C *temp_a1; - u8 *temp_v1; - u8 temp_a2; - u8 temp_v0; - - temp_a2 = arg0 & 0xFF; if (D_800EA108 == 0) { - temp_v1 = &D_800EA0EC[temp_a2]; - temp_v0 = *temp_v1; - if (temp_v0 != 0) { - if (temp_v0 == 2) { - *temp_v1 = 1; - goto block_4; - } - } else { -block_4: - var_f12 = (arg1 * 0.7f) + 0.1f; - temp_v0_2 = &D_800EA120[temp_a2]; - temp_a1 = &D_800E9F7C[temp_a2]; - if (var_f12 > 1.0f) { - var_f12 = 1.0f; + switch (D_800EA0EC[arg0]) { + case 2: + D_800EA0EC[arg0] = 1; + // Purposeful fallthrough + case 0: + arg1 = (arg1 * 0.7f) + 0.1f; + if (arg1 > 1.0f) { + arg1 = 1.0f; } - if (var_f12 < 0.0f) { - var_f12 = 0.0f; + if (arg1 < 0.0f) { + arg1 = 0.0f; } - *temp_v0_2 = var_f12; - play_sound(gCurrentCourseId + 0x19007020, temp_a1->pos, temp_a2, D_800EA1D4, temp_v0_2, (u8 *) &temp_a1->unk_14); + D_800EA120[arg0] = arg1; + play_sound(gCurrentCourseId + 0x19007020, D_800E9F7C[arg0].pos, arg0, &D_800EA1D4, &D_800EA120[arg0], (u8 *) &D_800E9F7C[arg0].unk_14); + break; + default: + break; } } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800CAEC4.s") -#endif void func_800CAFC0(u8 arg0) { diff --git a/src/audio/external.h b/src/audio/external.h index 2a3e104b8..fedc173e9 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -122,66 +122,123 @@ struct Unk_800EA06C { /* 0x00 */ Vec3f unk00; /* 0x0C */ u8 unk0C; /* 0x0D */ // u8 compilerPadding0[3]; -}; +}; // size = 0x10 typedef struct { - /* 0x00 */ s32 unk_0; - /* 0x04 */ s32 unk_4; -} struct_D_80192AB8_entry; // size = 0x8 + /* 0x00 */ f32 unk_00; + /* 0x04 */ u16 unk_04; + /* 0x06 */ // u16 compilerPadding; + /* 0x08 */ f32 unk_08; + /* 0x0C */ u16 unk_0C; + /* 0x0E */ // u16 compilerPadding; + /* 0x10 */ f32 unk_10; + /* 0x14 */ u16 unk_14; + /* 0x16 */ // u16 compilerPadding; + /* 0x18 */ f32 unk_18; + /* 0x1C */ u16 unk_1C; + /* 0x1E */ // u16 compilerPadding; +} struct_D_801930D0_inner; // size = 0x20 typedef struct { // This will need lots of expanding/documenting // Its 147 words of space being used - u8 some_innards[0x24C]; + /* 0x000 */ f32 unk_000; + /* 0x004 */ f32 unk_004; + /* 0x008 */ f32 unk_008; + /* 0x00C */ u16 unk_00C; + /* 0x00E */ u8 unk_00E[3]; // Array size guessed + /* 0x011 */ u8 unk_011; + /* 0x012 */ u8 unk_012; + /* 0x013 */ u8 unk_013; + /* 0x014 */ s32 unk_014; + /* 0x018 */ u16 unk_018; + /* 0x01A */ u16 unk_01A; + /* 0x01C */ s32 unk_01C; + /* 0x020 */ s32 unk_020; + /* 0x024 */ s32 unk_024; + /* 0x028 */ u16 unk_028; + /* 0x02A */ u16 unk_02A; + /* 0x02C */ u32 unk_02C[5]; // Array size guessed + /* 0x040 */ u8 unk_040; + /* 0x041 */ u8 unk_041; + /* 0x042 */ u8 unk_042; + /* 0x043 */ u8 unk_043; + /* 0x044 */ struct_D_801930D0_inner unk_044[16]; + /* 0x244 */ u16 unk_244; + /* 0x246 */ u16 unk_246; + /* 0x248 */ u16 unk_248; + /* 0x24A */ u16 unk_24A; } struct_D_801930D0_entry; // size = 0x24C +// Not quite the same as the struct found in SM64, +// not even sure that the struct or its members are even +// correct in the MK64 context +struct ChannelVolumeScaleFade { + /* 0x000 */ f32 current; + /* 0x004 */ f32 target; + /* 0x008 */ f32 velocity; + /* 0x00C */ u16 remainingFrames; + /* 0x00A */ // u16 compilerPadding; +}; // size = 0x10 + +typedef struct { + f32 unk0; + f32 unk4; + u8 unk8; + u8 unk9; +} UnkStruct8018EF18; // size = 0xC + void func_800C94A4(u8); void func_800CADD0(u8, f32); void func_800C13F0(void); void func_800C13FC(OSMesg); f32 func_800C1480(u8, u8); s8 func_800C15D0(u8, u8, u8); +s8 func_800C16E8(f32, f32, u8); f32 func_800C1934(u8, u8); +void func_800C19D0(u8, u8, u8); struct Unk_8018EFD8 *func_800C1C88(u8, Vec3f, Vec3f, f32*, u8, u32); void func_800C1DA4(Camera*, Vec3s, struct Unk_8018EFD8*); void func_800C1E2C(Camera*, Vec3f, struct Unk_8018EFD8*); void func_800C1F8C(void); f32 *func_800C21E8(Vec3f, u32); -void func_800C2274(s32); +void func_800C2274(u8); void func_800C2474(void); -void func_800C284C(u8, u8, u8, s32); +void func_800C284C(u8, u8, u8, u16); +void func_800C29B4(u8, u16); void func_800C3724(void); void func_800C3448(u32); void func_800C3478(void); -u16 func_800C3508(s32); -void func_800C3608(s32, s32); +u16 func_800C3508(u8); +void func_800C3608(u8, u8); u8 func_800C357C(s32); void func_800C35E8(u8); -void func_800C36C4(s32, u32, u8, s8); +void func_800C36C4(u8, u8, u8, u8); void func_800C3F70(void); void func_800C400C(void); void func_800C4084(u16); +void func_800C40F0(u8); void play_sound(u32, f32*, u8, f32*, f32*, u8*); void func_800C41CC(u8, struct Unk_80191420*); void func_800C4398(void); -void func_800C473C(u8, u8); +void delete_sound_from_bank(u8, u8); void func_800C4888(u8); void func_800C4FE4(u8); void func_800C5278(u8); void func_800C5384(u8, f32*); -void func_800C54B8(u8, s32); +void func_800C54B8(u8, f32*); void func_800C550C(s32); void func_800C5578(Vec3f, u32); u8 func_800C56F0(u32); void func_800C5848(void); -void func_800C58B8(u8, u8, u16); +void fade_channel_volume_scale(u8, u8, u16); void func_800C5968(u8); void func_800C59C4(void); -void func_800C5A3C(void); +void sound_init(void); void func_800C5BD0(void); void func_800C5C40(void); void func_800C5CB8(void); @@ -263,6 +320,7 @@ extern s8 D_801657E5; extern s32 gAudioErrorFlags; extern s8 D_8018EF10; +extern UnkStruct8018EF18 D_8018EF18[16]; extern struct Unk_8018EFD8 D_8018EFD8[]; // These are indexes for D_8018EFD8, but their purpose is unknown extern u8 D_8018FB90; @@ -271,15 +329,16 @@ extern Camera *D_8018FB98[4]; extern Vec3f D_8018FBA8[4]; extern Vec3f D_8018FBD8[4]; extern u8 D_8018FC08; +extern u16 D_8018FC10[4][2]; extern struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20]; extern u8 sSoundBankUsedListBack[SOUND_BANK_COUNT]; extern u8 sSoundBankFreeListFront[SOUND_BANK_COUNT]; extern u8 sNumSoundsInBank[SOUND_BANK_COUNT]; -extern struct_D_80192AB8_entry D_80192AB8[SOUND_BANK_COUNT][8]; +extern u8 D_80192AB8[SOUND_BANK_COUNT][8][8]; extern u8 D_80192C38; extern u8 sSoundBankDisabled[SOUND_BANK_COUNT]; -extern f32 D_80192C48[SOUND_BANK_COUNT][4]; +extern struct ChannelVolumeScaleFade D_80192C48[SOUND_BANK_COUNT]; extern u8 D_80192CA8[3][10]; extern u8 D_80192CC6[3]; extern u32 D_80192CD0[256]; @@ -290,6 +349,7 @@ extern struct Unk_8018FC20 sSoundRequests[0x100]; // Data entries extern u8 D_800E9DA0; +extern s32 D_800E9DB4[]; extern f32 D_800E9DC4[4];// = { 1.0f, 1.0f, 1.0f, 1.0f }; extern f32 D_800E9DD4[4];// = { 0.0f, 0.0f, 0.0f, 0.0f }; extern f32 D_800E9DE4[4];// = { 0.0f, 0.0f, 0.0f, 0.0f }; @@ -340,7 +400,10 @@ extern f32 D_800EA178; extern f32 D_800EA17C; extern u16 D_800EA180;// = 0; /* const */ extern u16 D_800EA184; +extern u8 D_800EA188[][6]; +extern u8 D_800EA1A0[][6]; extern u8 D_800EA1C0;// = 0; +extern u16 D_800EA1C4; // Most similar to gGlobalSoundSource from SM64, but I don't know if its really // a sound source, its usage makes it look like a 0'd Vec3f for general usage extern Vec3f D_800EA1C8;// = {0.0f, 0.0f, 0.0f} @@ -348,6 +411,9 @@ extern f32 D_800EA1D4; extern u8 D_800EA1DC;// = 0; extern u8 D_800EA1E4; extern u8 D_800EA1E8; +extern u8 D_800EA1EC; +extern u8 D_800EA1F0[]; +extern u8 D_800EA1F4[]; extern u8 D_800EA244; extern s8 D_800EA16C; diff --git a/src/audio/port_eu.c b/src/audio/port_eu.c index 6e1015824..02791190e 100644 --- a/src/audio/port_eu.c +++ b/src/audio/port_eu.c @@ -264,7 +264,7 @@ void func_800CBB88(u32 arg0, f32 arg1) { func_800CBB48(arg0, (s32*) &arg1); } -void func_800CBBB8(u32 arg0, s32 arg1) { +void func_800CBBB8(u32 arg0, u32 arg1) { func_800CBB48(arg0, &arg1); } diff --git a/src/audio/port_eu.h b/src/audio/port_eu.h index 852f981fb..f3ab8eb49 100644 --- a/src/audio/port_eu.h +++ b/src/audio/port_eu.h @@ -9,7 +9,7 @@ void func_800CBA64(s32 playerIndex, s32 fadeInTime); void func_800CBAB4(void); void func_800CBB48(s32, s32*); void func_800CBB88(u32, f32); -void func_800CBBB8(u32, s32); +void func_800CBBB8(u32, u32); void func_800CBBE8(u32, s8); void func_800CBC24(void); void func_800CBCB0(u32 arg0); diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 3a0b1842d..447dc11a1 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -211,6 +211,7 @@ void func_8001A3D8(s32, f32, s32); void func_8001A450(s32, s32, s32); void func_8001A518(s32, s32, s32); void func_8001A588(u16*, Camera*, Player*, s8, s32); +void func_8001AAAC(s16, s16, s16); void func_8001AB00(void); void func_8001AB74(s32, s16*, s32); void func_8001ABE0(s32, D_801642D8_entry*); |
