diff --git a/src/audio/external.c b/src/audio/external.c index 66295fd0e..6b7408d64 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -32,7 +32,7 @@ u8 D_80192AB8[SOUND_BANK_COUNT][8][8]; u8 D_80192C38; ubool8 sSoundBankDisabled[SOUND_BANK_COUNT]; struct ChannelVolumeScaleFade D_80192C48[SOUND_BANK_COUNT]; -u8 D_80192CA8[3][10]; +struct_D_80192CA8_entry D_80192CA8[3][5]; u8 D_80192CC6[3]; u32 D_80192CD0[256]; struct_D_801930D0_entry D_801930D0[3]; @@ -315,6 +315,7 @@ s8 func_800C15D0(u8 bank, u8 soundId, u8 channel) { // This is likely functionally equivallent. #ifdef NON_MATCHING +// https://decomp.me/scratch/99CQl s8 func_800C16E8(f32 arg0, f32 arg1, u8 cameraId) { f32 var_f0; f32 var_f14; @@ -712,14 +713,20 @@ void func_800C2474(void) { } #ifdef NON_MATCHING +// https://decomp.me/scratch/B9kUf +// No idea what's up with this function. `arg1_copy` is a huge improvement but feels very silly +// Presumably there's some macro being used to do all the or'ing (creating soundbits), that might +// matter for match purposes void func_800C284C(u8 arg0, u8 arg1, u8 arg2, u16 arg3) { u8 var_v1; + u8 *arg1_copy = &arg1; if ((D_800EA1EC == 0) || (arg0 == 2)) { - func_800CBBB8(0x82000000 | (arg0 << 0x10) | (arg1 << 8), arg3); - D_801930D0[arg0].unk_248 = arg1 | (arg2 << 8); + if (1) {} + func_800CBBB8(0x82000000 | (arg0 << 0x10) | (*arg1_copy << 8), arg3); + D_801930D0[arg0].unk_248 = *arg1_copy | (arg2 << 8); if (D_801930D0[arg0].unk_000 != 1.0f) { - func_800CBB88((arg0 << 0x10) | 0x41000000, D_801930D0[arg0].unk_000); + func_800CBB88(0x41000000 | (arg0 << 0x10), D_801930D0[arg0].unk_000); } D_801930D0[arg0].unk_028 = 0; D_801930D0[arg0].unk_018 = 0; @@ -743,357 +750,196 @@ void func_800C29B4(u8 arg0, u16 arg1) { D_801930D0[arg0].unk_248 = 0xFFFF; } -#ifdef MIPS_TO_C -//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-18-2023 +#ifdef NON_MATCHING +/** + * https://decomp.me/scratch/TS7EW + * The last big thing is the for loop in `case 10`. For some reason the 0 used for loop initialization is saved to 2 variables? + * I speculate that this is functionally equivalent although its hard to tell with all the register allocation differences + * `arg0` is almost certainly `soundbits`, so all the `why*` variables are probably the results of macros pulling out + * the different parts of the full sound specification. +**/ void func_800C2A2C(u32 arg0) { - u8 sp5B; - u32 sp4C; - s32 sp48; - s32 sp44; - s32 sp3C; - u8 *sp34; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f2; - f32 temp_f4; - f32 var_f16; - f32 var_f8; - s32 temp_a0; - 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_3; - s32 temp_at; - s32 temp_at_2; - s32 temp_t6_2; - s32 temp_t7_2; - s32 temp_t8_2; - s32 temp_t8_3; - s32 temp_t8_4; - s32 temp_t8_5; - s32 temp_t8_6; - s32 temp_t8_8; - s32 temp_v0_6; - s32 temp_v1; - s32 temp_v1_2; - s32 temp_v1_3; - s32 var_a1; - s32 var_a1_3; - s32 var_a3; - s32 var_t0; - s32 var_v0; - s32 var_v0_2; - s32 var_v1; - s32 var_v1_2; - s32 var_v1_3; - 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; + u16 var_a3; + u16 var_a0; + s32 var_a2; + u8 var_a1; + u8 var_t0; + u8 var_v1; 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_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; - u8 temp_t9; - u8 var_t0_2; - u8 var_t3; - u8 var_v1_6; - void *temp_a0_2; - void *temp_a0_3; - void *temp_a1_2; - void *temp_a1_3; - void *temp_v0; - void *temp_v0_4; + u8 test; + u8 why; + u16 why2; + u8 why3; + u8 why4; + u8 why5; + u8 temp_a1; - temp_t8 = (arg0 >> 0x1C) & 0xFF; - temp_t6 = (u32) (arg0 & 0x0F000000) >> 0x18; - temp_a1 = temp_t6 & 0xFF; - switch (temp_t8) { - case 0: - func_800C284C(temp_t6 & 0xFF, arg0 & 0xFF, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); - return; - case 1: - func_800C29B4(temp_t6 & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); - return; - case 2: - temp_t8_2 = temp_t6 & 0xFF; - temp_t4 = &D_80192CC6[temp_t8_2]; - sp3C = temp_t8_2; - temp_t1 = *temp_t4; - var_v1 = 0; - var_t3 = temp_t1; - if ((s32) temp_t1 > 0) { - temp_a0 = arg0 & 0xFF; - sp48 = temp_a0; - loop_6: - 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; - } - } else { - temp_t6_2 = (var_v1 + 1) & 0xFF; - var_v1 = temp_t6_2; - if (temp_t6_2 >= (s32) D_80192CC6[temp_a1]) { - var_v1 = 0; - goto block_11; - } - goto loop_6; + test = arg0 & 0xFF; + why = (arg0 & 0xFF00) >> 8; + why2 = (arg0 & 0xFF0000) >> 0xD; + why3 = (arg0 & 0xFF0000) >> 0xF; + why4 = (arg0 & 0xFF0000) >> 0x10; + why5 = (arg0 & 0xF00) >> 8; + temp_a1 = (arg0 & 0x0F000000) >> 0x18; + switch ((arg0 >> 0x1C) & 0xFF) { + case 0: + func_800C284C(temp_a1, arg0 & 0xFF, why, why2); + break; + case 1: + func_800C29B4(temp_a1, why2); + break; + case 2: + for (var_v1 = 0; var_v1 < D_80192CC6[temp_a1]; var_v1++) { + if (test == D_80192CA8[temp_a1][var_v1].thing0) { + if (var_v1 == 0) { + func_800C284C(temp_a1, test, why, why2); } + return; + } + } + var_t0 = D_80192CC6[temp_a1]; + for (var_v1 = 0; var_v1 < D_80192CC6[temp_a1]; var_v1++) { + if (why >= D_80192CA8[temp_a1][var_v1].thing1) { + var_t0 = var_v1; + var_v1 = D_80192CC6[temp_a1]; + } + } + if ((var_t0 != D_80192CC6[temp_a1]) || (var_t0 == 0)) { + if (D_80192CC6[temp_a1] < 5) { + D_80192CC6[temp_a1]++; + } + for (var_v1 = D_80192CC6[temp_a1] - 1; var_v1 != var_t0; var_v1--) { + D_80192CA8[temp_a1][var_v1].thing1 = D_80192CA8[temp_a1][var_v1 - 1].thing1; + D_80192CA8[temp_a1][var_v1].thing0 = D_80192CA8[temp_a1][var_v1 - 1].thing0; + } + D_80192CA8[temp_a1][var_t0].thing1 = why; + D_80192CA8[temp_a1][var_t0].thing0 = test; + } + if (var_t0 == 0) { + func_800C284C(temp_a1, test, why, why2); + } + break; + case 3: + var_t0 = D_80192CC6[temp_a1]; + for (var_v1 = 0; var_v1 < D_80192CC6[temp_a1]; var_v1++) { + if (test == D_80192CA8[temp_a1][var_v1].thing0) { + var_t0 = var_v1; + var_v1 = D_80192CC6[temp_a1]; + } + } + if (var_t0 != D_80192CC6[temp_a1]) { + for (var_v1 = var_t0; var_v1 < D_80192CC6[temp_a1] - 1; var_v1++) { + D_80192CA8[temp_a1][var_v1].thing1 = D_80192CA8[temp_a1][var_v1 + 1].thing1; + D_80192CA8[temp_a1][var_v1].thing0 = D_80192CA8[temp_a1][var_v1 + 1].thing0; + } + D_80192CC6[temp_a1]--; + } + if (var_t0 == 0) { + func_800C29B4(temp_a1, why2); + if (D_80192CC6[temp_a1] != 0) { + func_800C284C(temp_a1, D_80192CA8[temp_a1][0].thing0, D_80192CA8[temp_a1][0].thing1, why2); + } + } + break; + case 4: + var_a1 = why3; + if (var_a1 == 0) { + var_a1++; + } + + temp_v0_3 = &D_801930D0[temp_a1 & 0xFF]; + temp_v0_3->unk_004 = (arg0 & 0xFF) / 127.0f; + if (temp_v0_3->unk_000 != temp_v0_3->unk_004) { + temp_v0_3->unk_008 = (temp_v0_3->unk_000 - temp_v0_3->unk_004) / var_a1; + temp_v0_3->unk_00C = var_a1; + } + break; + case 5: + var_a1 = why3; + if (var_a1 == 0) { + var_a1++; + } + + temp_v0_3 = &D_801930D0[var_a1 & 0xFF]; + for (var_v1 = 0; var_v1 < 0x10; var_v1++) { + temp_v0_3->unk_044[var_v1].unk_14 = ((arg0 & 0xFFFF) / 1000.0f); + temp_v0_3->unk_044[var_v1].unk_18 = (temp_v0_3->unk_044[var_v1].unk_10 - temp_v0_3->unk_044[var_v1].unk_14) / var_a1; + temp_v0_3->unk_044[var_v1].unk_1C = var_a1; + } + D_801930D0[var_a1].unk_244 = 0xFFFF; + break; + case 6: + var_a1 = why3; + if (var_a1 == 0) { + var_a1++; + } + var_v1 = ((arg0 & 0xF00) >> 8) & 0xFF; + + D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_04 = test / 127.0f; + if (D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_00 != D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_04) { + D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_08 = (D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_00 - D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_04) / var_a1; + D_801930D0[var_a1 & 0xFF].unk_044[var_v1].unk_0C = var_a1; + D_801930D0[var_a1 & 0xFF].unk_244 |= 1 << var_v1; + } + break; + case 7: + func_800CBBE8(0x46000000 | (temp_a1 & 0xFF) << 0x10 | (why4 & 0xFF) << 8, (u64)arg0); + break; + case 8: + if (!(D_801930D0[temp_a1].unk_24A & (1 << why5))) { + func_800CBBE8(0x06000000 | ((temp_a1 & 0xFF) << 0x10) | (why5 & 0xFF) << 8 | (why4 & 0xFF), (u64)arg0); + } + break; + case 9: + D_801930D0[temp_a1].unk_24A = arg0; + break; + case 10: + var_a0 = 1; + var_a3 = arg0 & 0xFFFF; + for (var_v1 = 0; var_v1 < 0x10; var_v1++) { + if (var_a3 & var_a0) { + var_a2 = 1; } else { - block_11: - var_t0 = temp_t1 & 0xFF; - if ((s32) var_t3 > 0) { - do { - if ((((u32) (arg0 & 0xFF00) >> 8) & 0xFF) >= (s32) (D_80192CA8[sp3C] + (var_v1 * 2))->unk1) { - var_t0 = var_v1 & 0xFF; - var_v1 = temp_t1 & 0xFF; - } - temp_t8_3 = (var_v1 + 1) & 0xFF; - var_v1 = temp_t8_3; - } while (temp_t8_3 < (s32) D_80192CC6[temp_a1]); - } - if ((var_t0 != var_t3) || (var_t0 == 0)) { - temp_a2 = D_80192CA8[sp3C]; - if ((s32) var_t3 < 5) { - temp_t9 = temp_t1 + 1; - *temp_t4 = temp_t9; - var_t3 = temp_t9 & 0xFF; - } - var_v0 = (var_t3 - 1) & 0xFF; - var_v1_2 = var_v0; - if (var_t0 != var_v0) { - do { - temp_a1_2 = temp_a2 + (var_v0 * 2); - temp_a0_2 = temp_a2 + (var_v1_2 * 2); - temp_a0_2->unk1 = (u8) temp_a1_2->unk-1; - var_v0 = (var_v1_2 - 1) & 0xFF; - var_v1_2 = var_v0; - temp_a0_2->unk0 = (u8) temp_a1_2->unk-2; - } while (var_t0 != var_v0); - } - temp_v0 = temp_a2 + (var_t0 * 2); - temp_v0->unk1 = (s8) (((u32) (arg0 & 0xFF00) >> 8) & 0xFF); - temp_v0->unk0 = (s8) (arg0 & 0xFF); - } - if (var_t0 == 0) { - func_800C284C(unksp3F, arg0 & 0xFF, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); - return; - } - default: - return; + var_a2 = 0; } + func_800CBBE8(((temp_a1 & 0xFF) << 0x10) | 0x08000000 | ((var_v1 & 0xFF) << 8), var_a2); + var_a0 *= 2; + } + break; + case 11: + D_801930D0[temp_a1].unk_014 = arg0; + break; + case 12: + temp_v0_3 = &D_801930D0[temp_a1 & 0xFF]; + if ((((arg0 & 0xF00000) >> 0x14) & 0xFF) != 0xF) { + var_t0 = temp_v0_3->unk_041++; + if (var_t0 < 5) { + temp_v0_3->unk_02C[var_t0] = arg0; + temp_v0_3->unk_040 = 2; + } + } else { + temp_v0_3->unk_041 = 0; + } + break; + case 14: + switch (why5) { /* switch 1; irregular */ + case 0: /* switch 1 */ + func_800CBBB8(0xF0000000U, D_800EA1F0[arg0 & 0xFF]); break; - case 3: - temp_t8_4 = temp_t6 & 0xFF; - temp_t4_2 = &D_80192CC6[temp_t8_4]; - sp3C = temp_t8_4; - temp_t1_2 = *temp_t4_2; - var_v1_3 = 0; - var_t0_2 = temp_t1_2; - if ((s32) temp_t1_2 > 0) { - do { - 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; - } - temp_t8_5 = (var_v1_3 + 1) & 0xFF; - var_v1_3 = temp_t8_5; - } while (temp_t8_5 < (s32) D_80192CC6[temp_a1]); - } - if (var_t0_2 != temp_t1_2) { - temp_a3 = temp_t1_2 - 1; - var_v1_4 = var_t0_2 & 0xFF; - if ((s32) var_t0_2 < temp_a3) { - temp_a2_2 = D_80192CA8[sp3C]; - var_v0_2 = var_v1_4; - do { - temp_a1_3 = temp_a2_2 + (var_v0_2 * 2); - temp_a0_3 = temp_a2_2 + (var_v1_4 * 2); - temp_a0_3->unk1 = (u8) temp_a1_3->unk3; - var_v0_2 = (var_v1_4 + 1) & 0xFF; - var_v1_4 = var_v0_2; - temp_a0_3->unk0 = (u8) temp_a1_3->unk2; - } while (var_v0_2 < temp_a3); - } - *temp_t4_2 = temp_t1_2 - 1; - } - if (var_t0_2 == 0) { - temp_a3_2 = ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF; - sp4C = temp_a3_2; - sp34 = temp_t4_2; - func_800C29B4(unksp3F, temp_a3_2 & 0xFFFF); - if (*temp_t4_2 != 0) { - temp_v0_2 = D_80192CA8[sp3C]; - func_800C284C((u8) sp3C, temp_v0_2->unk0, temp_v0_2->unk1, (u16) temp_a3_2); - return; - } - } - break; - case 4: - temp_t9_2 = (u32) (arg0 & 0xFF0000) >> 0xF; - temp_v1 = temp_t9_2 & 0xFF; - var_a1 = temp_t9_2 & 0xFF; - if (temp_v1 == 0) { - var_a1 = (temp_v1 + 1) & 0xFF; - } - 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->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->unk_00C = (u16) var_a1; - temp_v0_3->unk_008 = (temp_f2 - temp_v0_3->unk_004) / var_f8; - return; - } - break; - case 5: - temp_t7 = (u32) (arg0 & 0xFF0000) >> 0xF; - temp_v1_2 = temp_t7 & 0xFF; - var_a1_2 = temp_t7 & 0xFF; - if (temp_v1_2 == 0) { - var_a1_2 = (temp_v1_2 + 1) & 0xFF; - } - 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_a0_4 + (var_v1_5 << 5); - temp_t8_6 = (var_v1_5 + 1) & 0xFF; - 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].unk_244 = 0xFFFF; - return; - case 6: - temp_t8_7 = (u32) (arg0 & 0xFF0000) >> 0xF; - temp_v1_3 = temp_t8_7 & 0xFF; - var_a1_3 = temp_t8_7 & 0xFF; - if (temp_v1_3 == 0) { - var_a1_3 = (temp_v1_3 + 1) & 0xFF; - } - temp_a3_3 = temp_t6 & 0xFF; - temp_a2_4 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; - temp_t6_3 = &D_801930D0[temp_a3_3]; - temp_f0_3 = (f32) (arg0 & 0xFF) / 127.0f; - 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_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; - case 7: - func_800CBBE8(((temp_t6 & 0xFF) << 0x10) | 0x46000000 | ((((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF) << 8), (s8) arg0); - return; - case 8: - temp_v0_6 = temp_t6 & 0xFF; - temp_a2_5 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; - 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].unk_24A = arg0; - return; - case 10: - var_a0 = 1; - sp48 = ((temp_t6 & 0xFF) << 0x10) | 0x08000000; - var_a3 = arg0 & 0xFFFF; - var_v1_6 = 0; - do { - if (var_a3 & var_a0) { - var_a2 = 1; - } else { - var_a2 = 0; - } - sp4C = var_a0; - sp5B = var_v1_6; - sp44 = var_a3; - func_800CBBE8(sp48 | ((var_v1_6 & 0xFF) << 8), var_a2); - temp_t8_8 = (var_v1_6 + 1) & 0xFF; - temp_at_2 = temp_t8_8 < 0x10; - var_v1_6 = (u8) temp_t8_8; - var_a0 = (var_a0 * 2) & 0xFFFF; - } while (temp_at_2 != 0); - return; - case 11: - D_801930D0[temp_t6 & 0xFF].unk_014 = (s32) arg0; - return; - case 12: - if ((((u32) (arg0 & 0xF00000) >> 0x14) & 0xFF) != 0xF) { - 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_7->unk_02C[temp_t0] = (u32) arg0; - temp_v0_7->unk_040 = 2; - return; - } - } else { - D_801930D0[temp_t6 & 0xFF].unk_041 = 0; - return; - } - break; - case 14: - temp_t7_2 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; - switch (temp_t7_2) { /* switch 1; irregular */ - case 0: /* switch 1 */ - func_800CBBB8(0xF0000000U, (u32) D_800EA1F0[arg0 & 0xFF]); - return; - case 1: /* switch 1 */ - D_800EA1EC = arg0 & 1; - return; - } - break; - case 15: - 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_4; - audio_reset_session_eu((void *) temp_a0_5); - *D_800EA1F4 = (u8) sp48; - func_800CBBE8(0x46020000U, (s8) sp4C); - func_800C5C40(); + case 1: /* switch 1 */ + D_800EA1EC = arg0 & 1; break; + } + break; + case 15: + D_800EA1C0 = (arg0 & 0xFF00) >> 8; + audio_reset_session_eu((void *) test); + D_800EA1F4[0] = test; + func_800CBBE8(0x46020000U, why); + func_800C5C40(); + break; + default: + break; } } #else diff --git a/src/audio/external.h b/src/audio/external.h index caf2455bf..14c4c7640 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -126,13 +126,13 @@ struct Unk_800EA06C { typedef struct { /* 0x00 */ f32 unk_00; - /* 0x04 */ u16 unk_04; + /* 0x04 */ f32 unk_04; /* 0x06 */ // u16 compilerPadding; /* 0x08 */ f32 unk_08; /* 0x0C */ u16 unk_0C; /* 0x0E */ // u16 compilerPadding; /* 0x10 */ f32 unk_10; - /* 0x14 */ u16 unk_14; + /* 0x14 */ f32 unk_14; /* 0x16 */ // u16 compilerPadding; /* 0x18 */ f32 unk_18; /* 0x1C */ u16 unk_1C; @@ -188,6 +188,11 @@ typedef struct { u8 unk9; } UnkStruct8018EF18; // size = 0xC +typedef struct { + u8 thing0; + u8 thing1; +} struct_D_80192CA8_entry; + /** @cond */ void func_800C94A4(u8); @@ -342,7 +347,7 @@ extern u8 D_80192AB8[SOUND_BANK_COUNT][8][8]; extern u8 D_80192C38; extern u8 sSoundBankDisabled[SOUND_BANK_COUNT]; extern struct ChannelVolumeScaleFade D_80192C48[SOUND_BANK_COUNT]; -extern u8 D_80192CA8[3][10]; +extern struct_D_80192CA8_entry D_80192CA8[3][5]; extern u8 D_80192CC6[3]; extern u32 D_80192CD0[256]; extern struct_D_801930D0_entry D_801930D0[3]; diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index f7b64c056..a719a7adb 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -196,11 +196,12 @@ void func_800AFF58(Vtx *arg0) { } #ifdef NON_MATCHING +// Credit to SpazzyLemon for the updated and better attempt void func_800B0004(void) { + Vtx* vtxs; + s32 res1, res2; + UNUSED u32 pad[0x5]; s32 i, j; - Vtx *spBC; - UNUSED u32 pad[0x10]; - u32 sp64; // offset? gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8688), LIGHT_1); gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8680), LIGHT_2); @@ -210,34 +211,18 @@ void func_800B0004(void) { gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK); gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING); - spBC = D_8018EDB4 % 2 ? (void *)D_8018EDB8 : (void *)D_8018EDBC; - + vtxs = D_8018EDB4 % 2 ? D_8018EDB8 : D_8018EDBC; D_8018EDB2 = 0x9C0; - - for (i = 0, sp64 = 0; i < 10; i++, sp64 += 0x30) { - // L800B018C + for (i = 0; i < 10; i++) { for (j = 0; j < 12; j++) { - f32 res1, res2; - // L800B01A0 - res1 = sins((u16)(D_8018EDB0 - (j * D_8018EDB2))) * 84.0f * (f32)j * 0.18f; - res2 = sins((u16)(D_8018EDB0 - ((j+1) * D_8018EDB2))) * 84.0f * (f32)(j+1) * 0.18f; - func_800AF9E4( - spBC + j + sp64, - j, - i, - 84, - res1, - res2, - j * 84, - 84 - ); + res1 = sins(D_8018EDB0 - (j * D_8018EDB2)) * 84.0f * j * 0.18f; + res2 = sins(D_8018EDB0 - ((j + 1) * D_8018EDB2)) * 84.0f * (j + 1) * 0.18f; + func_800AF9E4(&(&vtxs[j * 4])[i * 48], j, i, 84, res1, res2, (j * 84), 84); } } - // will probably have to retype this function - func_800AFF58((void *)spBC); + func_800AFF58(vtxs); D_8018EDB0 += D_8018EDB2; - D_8018EDB4 += 1; - + ++D_8018EDB4; gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); gSPNumLights(gDisplayListHead++, NUMLIGHTS_1); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);