summaryrefslogtreecommitdiff
path: root/src/audio/load.c
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2022-07-11 01:02:41 -0600
committerGitHub <noreply@github.com>2022-07-11 00:02:41 -0700
commitfd7941e84162c26b3f3f879bf4aaa6120f5b17db (patch)
treef2f4c65c6ff664af7fe1eef9c829236dc148f1ed /src/audio/load.c
parenta8e984d2fd99150f5c9fe08af67f17edc6d8a0d3 (diff)
Split out some unused asm and documented main.c (#242)
* Splitting out unused asm * Documented main.c
Diffstat (limited to 'src/audio/load.c')
-rw-r--r--src/audio/load.c161
1 files changed, 154 insertions, 7 deletions
diff --git a/src/audio/load.c b/src/audio/load.c
index c0f39c0a4..22031fbda 100644
--- a/src/audio/load.c
+++ b/src/audio/load.c
@@ -1150,14 +1150,161 @@ block_16:
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBF44.s")
#endif
+// L800BC170 is in a delay slot
+// m2c may be inaccurate.
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-/*
-Failed to decompile function audio_init:
-
-Last instruction is missing a delay slot:
-jr $ra
-*/
+void audio_init(void) {
+ s32 sp8C;
+ s32 sp60;
+ s32 **sp3C;
+ ? *var_v0;
+ ? *var_v0_2;
+ ? *var_v0_3;
+ s16 temp_s3;
+ s16 temp_t1;
+ s32 **var_a2;
+ s32 *temp_v0_2;
+ s32 *temp_v0_3;
+ s32 *temp_v0_4;
+ s32 *temp_v0_5;
+ s32 temp_a1;
+ s32 temp_a1_2;
+ s32 temp_a1_3;
+ s32 temp_s0;
+ s32 temp_s0_2;
+ s32 temp_t7;
+ s32 temp_v0;
+ s32 var_s0_2;
+ s32 var_s1;
+ s32 var_v1;
+ s32 var_v1_2;
+ u32 var_s0;
+ void *temp_t3;
+ void *temp_t7_2;
+
+ D_800EA5DC = 0;
+ temp_t7 = (s32) D_800EA5D0 / 8;
+ if (temp_t7 > 0) {
+ var_v0 = &D_803B71B0;
+ do {
+ var_v0 += 8;
+ var_v0->unk-4 = 0;
+ var_v0->unk-8 = 0;
+ } while ((u32) var_v0 < (u32) ((temp_t7 * 8) + &D_803B71B0));
+ }
+ var_v0_2 = &gGfxSPTaskOutputBufferSize;
+ var_s0 = (u32) (&D_803B71A0 - &gGfxSPTaskOutputBufferSize) >> 3;
+ if ((s32) var_s0 >= 0) {
+ do {
+ var_s0 -= 1;
+ var_v0_2->unk4 = 0;
+ var_v0_2->unk0 = 0;
+ var_v0_2 += 8;
+ } while ((s32) var_s0 >= 0);
+ }
+ temp_v0 = osTvType;
+ switch (temp_v0) { /* irregular */
+ case 0:
+ D_803B7178 = D_800F2EA0;
+ D_803B717C = 0x32;
+ break;
+ case 2:
+ D_803B7178 = D_800F2EA4;
+ D_803B717C = 0x3C;
+ break;
+ default:
+ case 1:
+ D_803B7178 = D_800F2EA8;
+ D_803B717C = 0x3C;
+ break;
+ }
+ func_800CBF48(&gGfxSPTaskOutputBufferSize);
+ var_v0_3 = &D_803B718C;
+ do {
+ var_v0_3 += 2;
+ var_v0_3->unk-2 = 0xA0;
+ } while ((u32) var_v0_3 < (u32) &D_803B7192);
+ D_803B70B8 = 0;
+ D_803B70C0 = 0;
+ D_803B70C4 = 0;
+ D_803B70B6 = 0;
+ D_803B70D4 = 0;
+ D_803B70D8.unk34 = 0;
+ D_803B70D8.unk84 = 0;
+ osCreateMesgQueue(&D_803B6720, &D_803B6738, 1);
+ osCreateMesgQueue(&gCurrAudioFrameDmaQueue, &gCurrAudioFrameDmaMesgBufs, 0x40);
+ gCurrAudioFrameDmaCount = 0;
+ gSampleDmaNumListItems = 0;
+ func_800B90F0(D_800EA5D4);
+ var_a2 = &D_803B7180;
+ do {
+ sp3C = var_a2;
+ var_v1 = 0;
+ *var_a2 = soundAlloc(&D_803AFBD8, 0xA00, var_a2);
+loop_16:
+ *(*var_a2 + var_v1) = 0;
+ (*var_a2 + var_v1)->unk2 = 0;
+ (*var_a2 + var_v1)->unk4 = 0;
+ temp_t7_2 = *var_a2 + var_v1;
+ var_v1 += 8;
+ temp_t7_2->unk6 = 0;
+ if (var_v1 != 0xA00) {
+ goto loop_16;
+ }
+ var_a2 += 4;
+ } while ((u32) var_a2 < (u32) &D_803B718C);
+ D_803B0501 = 0;
+ D_803B0500 = 1;
+ func_800BA00C();
+ D_803B706C = &sp60;
+ audio_dma_copy_immediate(&_sequencesSegmentRomStart, &sp60, 0x10);
+ temp_t1 = D_803B706C->unk2;
+ temp_a1 = (((temp_t1 & 0xFFFF) * 8) + 0x13) & ~0xF;
+ D_803B707C = temp_t1;
+ temp_v0_2 = soundAlloc(&D_803AFBD8, temp_a1);
+ D_803B706C = temp_v0_2;
+ audio_dma_copy_immediate(&_sequencesSegmentRomStart, temp_v0_2, temp_a1);
+ func_800BB43C(D_803B706C, &_sequencesSegmentRomStart);
+ D_803B7070 = &sp60;
+ audio_dma_copy_immediate(&_audio_banksSegmentRomStart, &sp60, 0x10);
+ temp_s3 = D_803B7070->unk2;
+ temp_a1_2 = ((temp_s3 * 8) + 0x13) & ~0xF;
+ temp_s0 = temp_a1_2;
+ temp_v0_3 = soundAlloc(&D_803AFBD8, temp_a1_2);
+ D_803B7070 = temp_v0_3;
+ audio_dma_copy_immediate(&_audio_banksSegmentRomStart, temp_v0_3, temp_s0);
+ func_800BB43C(D_803B7070, &_audio_banksSegmentRomStart);
+ D_803B7080 = soundAlloc(&D_803AFBD8, temp_s3 * 0xC);
+ var_v1_2 = 0;
+ if (temp_s3 > 0) {
+ var_s1 = 0;
+ var_s0_2 = 0;
+ do {
+ sp8C = var_v1_2;
+ audio_dma_copy_immediate((D_803B7070 + var_s1)->unk4, &sp60, 0x10, &D_803B7080);
+ (D_803B7080 + var_s0_2)->unk1 = (s8) sp60;
+ var_v1_2 = sp8C + 1;
+ temp_t3 = D_803B7080 + var_s0_2;
+ var_s0_2 += 0xC;
+ var_s1 += 8;
+ temp_t3->unk2 = (s8) sp64;
+ } while (var_v1_2 != temp_s3);
+ }
+ D_803B7074 = &sp60;
+ audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, &sp60, 0x10, &D_803B7080);
+ temp_a1_3 = ((D_803B7074->unk2 * 8) + 0x13) & ~0xF;
+ temp_s0_2 = temp_a1_3;
+ temp_v0_4 = soundAlloc(&D_803AFBD8, temp_a1_3);
+ D_803B7074 = temp_v0_4;
+ audio_dma_copy_immediate(&_audio_tablesSegmentRomStart, temp_v0_4, temp_s0_2);
+ func_800BB43C(D_803B7074, &_audio_tablesSegmentRomStart);
+ temp_v0_5 = soundAlloc(&D_803AFBD8, 0x100);
+ D_803B7078 = temp_v0_5;
+ audio_dma_copy_immediate(&_instrument_setsSegmentRomStart, temp_v0_5, 0x100);
+ func_800B907C(&D_803B01B8, soundAlloc(&D_803AFBD8, D_800EA5D8), D_800EA5D8);
+ func_800C125C();
+ D_800EA5DC = 0x76557364;
+}
#else
GLOBAL_ASM("asm/non_matchings/audio/load/audio_init.s")
#endif