summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2022-04-17 00:11:40 -0600
committerGitHub <noreply@github.com>2022-04-16 23:11:40 -0700
commite4e5f91be58aa5a08eb3b05ca1ea7803c8d91afa (patch)
treeeb9017e043bff83a3f3e1b1398db5cba5b5f657c
parent13a11f0ffa97db0efee0e3ba5ab187d9f537aa92 (diff)
audio load.c decomp (#176)
-rw-r--r--asm/bss_audio.s2
-rw-r--r--asm/bss_sptask_audio.s30
-rw-r--r--asm/non_matchings/audio/effects/func_800BE5E0.s4
-rw-r--r--asm/non_matchings/audio/heap/func_800B8EA8.s8
-rw-r--r--asm/non_matchings/audio/heap/func_800B914C.s8
-rw-r--r--asm/non_matchings/audio/heap/func_800B91C8.s4
-rw-r--r--asm/non_matchings/audio/heap/func_800B9244.s6
-rw-r--r--asm/non_matchings/audio/heap/func_800B9300.s6
-rw-r--r--asm/non_matchings/audio/heap/func_800B93BC.s18
-rw-r--r--asm/non_matchings/audio/heap/func_800BA00C.s12
-rw-r--r--asm/non_matchings/audio/heap/func_800BA250.s50
-rw-r--r--asm/non_matchings/audio/heap/func_800BA858.s4
-rw-r--r--asm/non_matchings/audio/heap/soundAlloc.s (renamed from asm/non_matchings/audio/heap/func_800B8FFC.s)2
-rw-r--r--asm/non_matchings/audio/load/audio_init.s46
-rw-r--r--asm/non_matchings/audio/load/func_800BAA80.s31
-rw-r--r--asm/non_matchings/audio/load/func_800BAAF8.s25
-rw-r--r--asm/non_matchings/audio/load/func_800BAB58.s45
-rw-r--r--asm/non_matchings/audio/load/func_800BAC04.s73
-rw-r--r--asm/non_matchings/audio/load/func_800BAD0C.s84
-rw-r--r--asm/non_matchings/audio/load/func_800BB030.s196
-rw-r--r--asm/non_matchings/audio/load/func_800BB304.s37
-rw-r--r--asm/non_matchings/audio/load/func_800BB484.s8
-rw-r--r--asm/non_matchings/audio/load/func_800BB780.s2
-rw-r--r--asm/non_matchings/audio/load/func_800BB99C.s2
-rw-r--r--asm/non_matchings/audio/load/func_800BBA50.s4
-rw-r--r--asm/non_matchings/audio/load/func_800BBEF0.s24
-rw-r--r--asm/non_matchings/audio/playback/func_800BCBC4.s12
-rw-r--r--asm/non_matchings/audio/playback/func_800BD368.s4
-rw-r--r--asm/non_matchings/audio/playback/func_800BDD34.s10
-rw-r--r--asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s28
-rw-r--r--asm/non_matchings/audio/synthesis/func_800B7034.s4
-rw-r--r--asm/non_matchings/audio/synthesis/func_800B70EC.s4
-rw-r--r--asm/non_matchings/audio/synthesis/func_800B775C.s20
-rw-r--r--asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s8
-rw-r--r--data/data_0DD0A0_1_1.s298
-rw-r--r--data/data_0DD0A0_1_2.s106
-rw-r--r--data/data_0DD0A0_2.s772
-rw-r--r--data/data_0DD0A0_2_1_0.s699
-rw-r--r--include/PR/ultratypes.h1
-rw-r--r--include/common_structs.h2
-rw-r--r--mk64.ld4
-rw-r--r--src/audio/data.h7
-rw-r--r--src/audio/effects.c4
-rw-r--r--src/audio/heap.c153
-rw-r--r--src/audio/heap.h27
-rw-r--r--src/audio/internal.h75
-rw-r--r--src/audio/load.c721
-rw-r--r--src/audio/load.h12
-rw-r--r--src/audio/playback.c26
-rw-r--r--src/audio/port_eu.c28
-rw-r--r--src/audio/synthesis.c64
-rw-r--r--src/code_80027040.c459
-rw-r--r--src/framebuffers.c4
-rw-r--r--src/internal.h565
54 files changed, 2061 insertions, 2787 deletions
diff --git a/asm/bss_audio.s b/asm/bss_audio.s
index e8b8d28c4..5510354aa 100644
--- a/asm/bss_audio.s
+++ b/asm/bss_audio.s
@@ -9,7 +9,7 @@ glabel D_803AFBD0
glabel D_803AFBD8
.skip 16
-glabel D_803AFBE8
+glabel gNotesAndBuffersPool
.skip 48
glabel D_803AFC18
diff --git a/asm/bss_sptask_audio.s b/asm/bss_sptask_audio.s
index 2250678fb..41e748561 100644
--- a/asm/bss_sptask_audio.s
+++ b/asm/bss_sptask_audio.s
@@ -99,13 +99,13 @@ glabel D_803B5FE8
glabel D_803B5FF8
.skip 16
-glabel D_803B6008
+glabel gCurrAudioFrameDmaQueue
.skip 24
-glabel D_803B6020
+glabel gCurrAudioFrameDmaMesgBufs
.skip 256
-glabel D_803B6120
+glabel gCurrAudioFrameDmaIoMesgBufs
.skip 1536
glabel D_803B6720
@@ -117,34 +117,34 @@ glabel D_803B6738
glabel D_803B6740
.skip 24
-glabel D_803B6758
+glabel sSampleDmas
.skip 1792
-glabel D_803B6E58
+glabel gSampleDmaNumListItems
.skip 4
-glabel D_803B6E5C
+glabel sSampleDmaListSize1
.skip 4
glabel D_803B6E60
.skip 8
-glabel D_803B6E68
+glabel sSampleDmaReuseQueue1
.skip 256
-glabel D_803B6F68
+glabel sSampleDmaReuseQueue2
.skip 256
-glabel D_803B7068
+glabel sSampleDmaReuseQueueTail1
.skip 1
-glabel D_803B7069
+glabel sSampleDmaReuseQueueTail2
.skip 1
-glabel D_803B706A
+glabel sSampleDmaReuseQueueHead1
.skip 1
-glabel D_803B706B
+glabel sSampleDmaReuseQueueHead2
.skip 1
glabel D_803B706C
@@ -165,7 +165,7 @@ glabel D_803B707C
glabel D_803B7080
.skip 8
-glabel D_803B7088
+glabel gAudioBufferParameters
.skip 24
glabel D_803B70A0
@@ -180,7 +180,7 @@ glabel D_803B70A8
glabel D_803B70AC
.skip 4
-glabel D_803B70B0
+glabel gMaxSimultaneousNotes
.skip 4
glabel D_803B70B4
@@ -192,7 +192,7 @@ glabel D_803B70B6
glabel D_803B70B8
.skip 4
-glabel D_803B70BC
+glabel gCurrAudioFrameDmaCount
.skip 4
glabel D_803B70C0
diff --git a/asm/non_matchings/audio/effects/func_800BE5E0.s b/asm/non_matchings/audio/effects/func_800BE5E0.s
index 3a7995fc7..e74b05943 100644
--- a/asm/non_matchings/audio/effects/func_800BE5E0.s
+++ b/asm/non_matchings/audio/effects/func_800BE5E0.s
@@ -61,8 +61,8 @@ glabel L800BE638
/* 0BF2A4 800BE6A4 A08E0001 */ sb $t6, 1($a0)
.L800BE6A8:
/* 0BF2A8 800BE6A8 14200019 */ bnez $at, .L800BE710
-/* 0BF2AC 800BE6AC 3C03803B */ lui $v1, %hi(D_803B7088) # $v1, 0x803b
-/* 0BF2B0 800BE6B0 24637088 */ addiu $v1, %lo(D_803B7088) # addiu $v1, $v1, 0x7088
+/* 0BF2AC 800BE6AC 3C03803B */ lui $v1, %hi(gAudioBufferParameters) # $v1, 0x803b
+/* 0BF2B0 800BE6B0 24637088 */ addiu $v1, %lo(gAudioBufferParameters) # addiu $v1, $v1, 0x7088
/* 0BF2B4 800BE6B4 846F000C */ lh $t7, 0xc($v1)
/* 0BF2B8 800BE6B8 84790000 */ lh $t9, ($v1)
/* 0BF2BC 800BE6BC 00CF0019 */ multu $a2, $t7
diff --git a/asm/non_matchings/audio/heap/func_800B8EA8.s b/asm/non_matchings/audio/heap/func_800B8EA8.s
index 62fccdadc..cd7f081e8 100644
--- a/asm/non_matchings/audio/heap/func_800B8EA8.s
+++ b/asm/non_matchings/audio/heap/func_800B8EA8.s
@@ -1,7 +1,7 @@
glabel func_800B8EA8
/* 0B9AA8 800B8EA8 27BDFFD0 */ addiu $sp, $sp, -0x30
-/* 0B9AAC 800B8EAC 3C02803B */ lui $v0, %hi(D_803B70B0) # $v0, 0x803b
-/* 0B9AB0 800B8EB0 8C4270B0 */ lw $v0, %lo(D_803B70B0)($v0)
+/* 0B9AAC 800B8EAC 3C02803B */ lui $v0, %hi(gMaxSimultaneousNotes) # $v0, 0x803b
+/* 0B9AB0 800B8EB0 8C4270B0 */ lw $v0, %lo(gMaxSimultaneousNotes)($v0)
/* 0B9AB4 800B8EB4 AFB50028 */ sw $s5, 0x28($sp)
/* 0B9AB8 800B8EB8 AFB2001C */ sw $s2, 0x1c($sp)
/* 0B9ABC 800B8EBC 0080A825 */ move $s5, $a0
@@ -43,8 +43,8 @@ glabel func_800B8EA8
/* 0B9B44 800B8F44 02802025 */ move $a0, $s4
/* 0B9B48 800B8F48 0C02FC01 */ jal func_800BF004
/* 0B9B4C 800B8F4C 02002825 */ move $a1, $s0
-/* 0B9B50 800B8F50 3C02803B */ lui $v0, %hi(D_803B70B0) # $v0, 0x803b
-/* 0B9B54 800B8F54 8C4270B0 */ lw $v0, %lo(D_803B70B0)($v0)
+/* 0B9B50 800B8F50 3C02803B */ lui $v0, %hi(gMaxSimultaneousNotes) # $v0, 0x803b
+/* 0B9B54 800B8F54 8C4270B0 */ lw $v0, %lo(gMaxSimultaneousNotes)($v0)
/* 0B9B58 800B8F58 26520001 */ addiu $s2, $s2, 1
.L800B8F5C:
/* 0B9B5C 800B8F5C 0242082A */ slt $at, $s2, $v0
diff --git a/asm/non_matchings/audio/heap/func_800B914C.s b/asm/non_matchings/audio/heap/func_800B914C.s
index 3fe4f7ce6..25f046dd1 100644
--- a/asm/non_matchings/audio/heap/func_800B914C.s
+++ b/asm/non_matchings/audio/heap/func_800B914C.s
@@ -7,18 +7,18 @@ glabel func_800B914C
/* 0B9D60 800B9160 8FAF0018 */ lw $t7, 0x18($sp)
/* 0B9D64 800B9164 AFBF0014 */ sw $ra, 0x14($sp)
/* 0B9D68 800B9168 AC8E0004 */ sw $t6, 4($a0)
-/* 0B9D6C 800B916C 0C02E3FF */ jal func_800B8FFC
+/* 0B9D6C 800B916C 0C02E3FF */ jal soundAlloc
/* 0B9D70 800B9170 8DE50000 */ lw $a1, ($t7)
/* 0B9D74 800B9174 8FB80018 */ lw $t8, 0x18($sp)
-/* 0B9D78 800B9178 3C04803B */ lui $a0, %hi(D_803AFBE8) # $a0, 0x803b
-/* 0B9D7C 800B917C 2484FBE8 */ addiu $a0, %lo(D_803AFBE8) # addiu $a0, $a0, -0x418
+/* 0B9D78 800B9178 3C04803B */ lui $a0, %hi(gNotesAndBuffersPool) # $a0, 0x803b
+/* 0B9D7C 800B917C 2484FBE8 */ addiu $a0, %lo(gNotesAndBuffersPool) # addiu $a0, $a0, -0x418
/* 0B9D80 800B9180 00402825 */ move $a1, $v0
/* 0B9D84 800B9184 0C02E41F */ jal func_800B907C
/* 0B9D88 800B9188 8F060000 */ lw $a2, ($t8)
/* 0B9D8C 800B918C 8FB90018 */ lw $t9, 0x18($sp)
/* 0B9D90 800B9190 3C04803B */ lui $a0, %hi(gLeftVolRampings) # $a0, 0x803b
/* 0B9D94 800B9194 2484FBC8 */ addiu $a0, %lo(gLeftVolRampings) # addiu $a0, $a0, -0x438
-/* 0B9D98 800B9198 0C02E3FF */ jal func_800B8FFC
+/* 0B9D98 800B9198 0C02E3FF */ jal soundAlloc
/* 0B9D9C 800B919C 8F25000C */ lw $a1, 0xc($t9)
/* 0B9DA0 800B91A0 8FA80018 */ lw $t0, 0x18($sp)
/* 0B9DA4 800B91A4 3C04803B */ lui $a0, %hi(D_803AFC18) # $a0, 0x803b
diff --git a/asm/non_matchings/audio/heap/func_800B91C8.s b/asm/non_matchings/audio/heap/func_800B91C8.s
index 4f3745627..6596bdff6 100644
--- a/asm/non_matchings/audio/heap/func_800B91C8.s
+++ b/asm/non_matchings/audio/heap/func_800B91C8.s
@@ -7,7 +7,7 @@ glabel func_800B91C8
/* 0B9DDC 800B91DC 8FAF0018 */ lw $t7, 0x18($sp)
/* 0B9DE0 800B91E0 AFBF0014 */ sw $ra, 0x14($sp)
/* 0B9DE4 800B91E4 AC8E0004 */ sw $t6, 4($a0)
-/* 0B9DE8 800B91E8 0C02E3FF */ jal func_800B8FFC
+/* 0B9DE8 800B91E8 0C02E3FF */ jal soundAlloc
/* 0B9DEC 800B91EC 8DE50000 */ lw $a1, ($t7)
/* 0B9DF0 800B91F0 8FB80018 */ lw $t8, 0x18($sp)
/* 0B9DF4 800B91F4 3C04803B */ lui $a0, %hi(D_803AFC28) # $a0, 0x803b
@@ -18,7 +18,7 @@ glabel func_800B91C8
/* 0B9E08 800B9208 8FB90018 */ lw $t9, 0x18($sp)
/* 0B9E0C 800B920C 3C04803B */ lui $a0, %hi(D_803AFC18) # $a0, 0x803b
/* 0B9E10 800B9210 2484FC18 */ addiu $a0, %lo(D_803AFC18) # addiu $a0, $a0, -0x3e8
-/* 0B9E14 800B9214 0C02E3FF */ jal func_800B8FFC
+/* 0B9E14 800B9214 0C02E3FF */ jal soundAlloc
/* 0B9E18 800B9218 8F250004 */ lw $a1, 4($t9)
/* 0B9E1C 800B921C 8FA80018 */ lw $t0, 0x18($sp)
/* 0B9E20 800B9220 3C04803B */ lui $a0, %hi(D_803AFC38) # $a0, 0x803b
diff --git a/asm/non_matchings/audio/heap/func_800B9244.s b/asm/non_matchings/audio/heap/func_800B9244.s
index 756e5367e..01f0674c6 100644
--- a/asm/non_matchings/audio/heap/func_800B9244.s
+++ b/asm/non_matchings/audio/heap/func_800B9244.s
@@ -7,7 +7,7 @@ glabel func_800B9244
/* 0B9E58 800B9258 8C8E0000 */ lw $t6, ($a0)
/* 0B9E5C 800B925C AFBF001C */ sw $ra, 0x1c($sp)
/* 0B9E60 800B9260 AC8E0004 */ sw $t6, 4($a0)
-/* 0B9E64 800B9264 0C02E3FF */ jal func_800B8FFC
+/* 0B9E64 800B9264 0C02E3FF */ jal soundAlloc
/* 0B9E68 800B9268 8E050000 */ lw $a1, ($s0)
/* 0B9E6C 800B926C 3C04803B */ lui $a0, %hi(D_803AFC4C) # $a0, 0x803b
/* 0B9E70 800B9270 2484FC4C */ addiu $a0, %lo(D_803AFC4C) # addiu $a0, $a0, -0x3b4
@@ -16,7 +16,7 @@ glabel func_800B9244
/* 0B9E7C 800B927C 8E060000 */ lw $a2, ($s0)
/* 0B9E80 800B9280 3C04803B */ lui $a0, %hi(D_803AFC28) # $a0, 0x803b
/* 0B9E84 800B9284 2484FC28 */ addiu $a0, %lo(D_803AFC28) # addiu $a0, $a0, -0x3d8
-/* 0B9E88 800B9288 0C02E3FF */ jal func_800B8FFC
+/* 0B9E88 800B9288 0C02E3FF */ jal soundAlloc
/* 0B9E8C 800B928C 8E050004 */ lw $a1, 4($s0)
/* 0B9E90 800B9290 3C04803B */ lui $a0, %hi(D_803AFE1C) # $a0, 0x803b
/* 0B9E94 800B9294 2484FE1C */ addiu $a0, %lo(D_803AFE1C) # addiu $a0, $a0, -0x1e4
@@ -25,7 +25,7 @@ glabel func_800B9244
/* 0B9EA0 800B92A0 8E060004 */ lw $a2, 4($s0)
/* 0B9EA4 800B92A4 3C04803B */ lui $a0, %hi(D_803AFC28) # $a0, 0x803b
/* 0B9EA8 800B92A8 2484FC28 */ addiu $a0, %lo(D_803AFC28) # addiu $a0, $a0, -0x3d8
-/* 0B9EAC 800B92AC 0C02E3FF */ jal func_800B8FFC
+/* 0B9EAC 800B92AC 0C02E3FF */ jal soundAlloc
/* 0B9EB0 800B92B0 8E050008 */ lw $a1, 8($s0)
/* 0B9EB4 800B92B4 3C04803B */ lui $a0, %hi(D_803AFFEC) # $a0, 0x803b
/* 0B9EB8 800B92B8 2484FFEC */ addiu $a0, %lo(D_803AFFEC) # addiu $a0, $a0, -0x14
diff --git a/asm/non_matchings/audio/heap/func_800B9300.s b/asm/non_matchings/audio/heap/func_800B9300.s
index 293e778d7..4ef246a87 100644
--- a/asm/non_matchings/audio/heap/func_800B9300.s
+++ b/asm/non_matchings/audio/heap/func_800B9300.s
@@ -7,7 +7,7 @@ glabel func_800B9300
/* 0B9F14 800B9314 8C8E0000 */ lw $t6, ($a0)
/* 0B9F18 800B9318 AFBF001C */ sw $ra, 0x1c($sp)
/* 0B9F1C 800B931C AC8E0004 */ sw $t6, 4($a0)
-/* 0B9F20 800B9320 0C02E3FF */ jal func_800B8FFC
+/* 0B9F20 800B9320 0C02E3FF */ jal soundAlloc
/* 0B9F24 800B9324 8E050000 */ lw $a1, ($s0)
/* 0B9F28 800B9328 3C04803B */ lui $a0, %hi(D_803AFDE0) # $a0, 0x803b
/* 0B9F2C 800B932C 2484FDE0 */ addiu $a0, %lo(D_803AFDE0) # addiu $a0, $a0, -0x220
@@ -16,7 +16,7 @@ glabel func_800B9300
/* 0B9F38 800B9338 8E060000 */ lw $a2, ($s0)
/* 0B9F3C 800B933C 3C04803B */ lui $a0, %hi(D_803AFC38) # $a0, 0x803b
/* 0B9F40 800B9340 2484FC38 */ addiu $a0, %lo(D_803AFC38) # addiu $a0, $a0, -0x3c8
-/* 0B9F44 800B9344 0C02E3FF */ jal func_800B8FFC
+/* 0B9F44 800B9344 0C02E3FF */ jal soundAlloc
/* 0B9F48 800B9348 8E050004 */ lw $a1, 4($s0)
/* 0B9F4C 800B934C 3C04803B */ lui $a0, %hi(D_803AFFB0) # $a0, 0x803b
/* 0B9F50 800B9350 2484FFB0 */ addiu $a0, %lo(D_803AFFB0) # addiu $a0, $a0, -0x50
@@ -25,7 +25,7 @@ glabel func_800B9300
/* 0B9F5C 800B935C 8E060004 */ lw $a2, 4($s0)
/* 0B9F60 800B9360 3C04803B */ lui $a0, %hi(D_803AFC38) # $a0, 0x803b
/* 0B9F64 800B9364 2484FC38 */ addiu $a0, %lo(D_803AFC38) # addiu $a0, $a0, -0x3c8
-/* 0B9F68 800B9368 0C02E3FF */ jal func_800B8FFC
+/* 0B9F68 800B9368 0C02E3FF */ jal soundAlloc
/* 0B9F6C 800B936C 8E050008 */ lw $a1, 8($s0)
/* 0B9F70 800B9370 3C04803B */ lui $a0, %hi(D_803B0180) # $a0, 0x803b
/* 0B9F74 800B9374 24840180 */ addiu $a0, %lo(D_803B0180) # addiu $a0, $a0, 0x180
diff --git a/asm/non_matchings/audio/heap/func_800B93BC.s b/asm/non_matchings/audio/heap/func_800B93BC.s
index 8961d6fec..d3276735e 100644
--- a/asm/non_matchings/audio/heap/func_800B93BC.s
+++ b/asm/non_matchings/audio/heap/func_800B93BC.s
@@ -68,8 +68,8 @@ glabel func_800B93BC
/* 0BA0A4 800B94A4 AFB90020 */ sw $t9, 0x20($sp)
/* 0BA0A8 800B94A8 24040004 */ li $a0, 4
/* 0BA0AC 800B94AC 1489001A */ bne $a0, $t1, .L800B9518
-/* 0BA0B0 800B94B0 3C05803B */ lui $a1, %hi(D_803B70B0) # $a1, 0x803b
-/* 0BA0B4 800B94B4 8CA570B0 */ lw $a1, %lo(D_803B70B0)($a1)
+/* 0BA0B0 800B94B0 3C05803B */ lui $a1, %hi(gMaxSimultaneousNotes) # $a1, 0x803b
+/* 0BA0B4 800B94B4 8CA570B0 */ lw $a1, %lo(gMaxSimultaneousNotes)($a1)
/* 0BA0B8 800B94B8 00001825 */ move $v1, $zero
/* 0BA0BC 800B94BC 3C02803B */ lui $v0, %hi(D_803B1508) # $v0, 0x803b
/* 0BA0C0 800B94C0 18A0000D */ blez $a1, .L800B94F8
@@ -99,8 +99,8 @@ glabel func_800B93BC
/* 0BA114 800B9514 A04E0000 */ sb $t6, ($v0)
.L800B9518:
/* 0BA118 800B9518 148A001E */ bne $a0, $t2, .L800B9594
-/* 0BA11C 800B951C 3C05803B */ lui $a1, %hi(D_803B70B0) # $a1, 0x803b
-/* 0BA120 800B9520 8CA570B0 */ lw $a1, %lo(D_803B70B0)($a1)
+/* 0BA11C 800B951C 3C05803B */ lui $a1, %hi(gMaxSimultaneousNotes) # $a1, 0x803b
+/* 0BA120 800B9520 8CA570B0 */ lw $a1, %lo(gMaxSimultaneousNotes)($a1)
/* 0BA124 800B9524 00001825 */ move $v1, $zero
/* 0BA128 800B9528 3C02803B */ lui $v0, %hi(D_803B1508) # $v0, 0x803b
/* 0BA12C 800B952C 18A0000E */ blez $a1, .L800B9568
@@ -224,8 +224,8 @@ glabel func_800B93BC
/* 0BA2C0 800B96C0 558F0032 */ bnel $t4, $t7, .L800B978C
/* 0BA2C4 800B96C4 8CE20000 */ lw $v0, ($a3)
/* 0BA2C8 800B96C8 150B0017 */ bne $t0, $t3, .L800B9728
-/* 0BA2CC 800B96CC 3C05803B */ lui $a1, %hi(D_803B70B0) # $a1, 0x803b
-/* 0BA2D0 800B96D0 8CA570B0 */ lw $a1, %lo(D_803B70B0)($a1)
+/* 0BA2CC 800B96CC 3C05803B */ lui $a1, %hi(gMaxSimultaneousNotes) # $a1, 0x803b
+/* 0BA2D0 800B96D0 8CA570B0 */ lw $a1, %lo(gMaxSimultaneousNotes)($a1)
/* 0BA2D4 800B96D4 00001825 */ move $v1, $zero
/* 0BA2D8 800B96D8 3C02803B */ lui $v0, %hi(D_803B1508) # $v0, 0x803b
/* 0BA2DC 800B96DC 18A0000E */ blez $a1, .L800B9718
@@ -252,8 +252,8 @@ glabel func_800B93BC
/* 0BA324 800B9724 ACE00000 */ sw $zero, ($a3)
.L800B9728:
/* 0BA328 800B9728 15090017 */ bne $t0, $t1, .L800B9788
-/* 0BA32C 800B972C 3C05803B */ lui $a1, %hi(D_803B70B0) # $a1, 0x803b
-/* 0BA330 800B9730 8CA570B0 */ lw $a1, %lo(D_803B70B0)($a1)
+/* 0BA32C 800B972C 3C05803B */ lui $a1, %hi(gMaxSimultaneousNotes) # $a1, 0x803b
+/* 0BA330 800B9730 8CA570B0 */ lw $a1, %lo(gMaxSimultaneousNotes)($a1)
/* 0BA334 800B9734 00001825 */ move $v1, $zero
/* 0BA338 800B9738 3C02803B */ lui $v0, %hi(D_803B1508) # $v0, 0x803b
/* 0BA33C 800B973C 18A0000E */ blez $a1, .L800B9778
@@ -445,7 +445,7 @@ glabel func_800B93BC
/* 0BA5CC 800B99CC 01CF0019 */ multu $t6, $t7
/* 0BA5D0 800B99D0 AFA7005C */ sw $a3, 0x5c($sp)
/* 0BA5D4 800B99D4 00002812 */ mflo $a1
-/* 0BA5D8 800B99D8 0C02E3FF */ jal func_800B8FFC
+/* 0BA5D8 800B99D8 0C02E3FF */ jal soundAlloc
/* 0BA5DC 800B99DC 00000000 */ nop
/* 0BA5E0 800B99E0 8E180000 */ lw $t8, ($s0)
/* 0BA5E4 800B99E4 240D000C */ li $t5, 12
diff --git a/asm/non_matchings/audio/heap/func_800BA00C.s b/asm/non_matchings/audio/heap/func_800BA00C.s
index d30b4c1a2..de51c5eac 100644
--- a/asm/non_matchings/audio/heap/func_800BA00C.s
+++ b/asm/non_matchings/audio/heap/func_800BA00C.s
@@ -39,7 +39,7 @@ glabel L800BA094
/* 0BAC94 800BA094 3C08803B */ lui $t0, %hi(D_803B0504) # $t0, 0x803b
/* 0BAC98 800BA098 25080504 */ addiu $t0, %lo(D_803B0504) # addiu $t0, $t0, 0x504
/* 0BAC9C 800BA09C 8D020000 */ lw $v0, ($t0)
-/* 0BACA0 800BA0A0 3C06803B */ lui $a2, %hi(D_803B70B0) # $a2, 0x803b
+/* 0BACA0 800BA0A0 3C06803B */ lui $a2, %hi(gMaxSimultaneousNotes) # $a2, 0x803b
/* 0BACA4 800BA0A4 10400005 */ beqz $v0, .L800BA0BC
/* 0BACA8 800BA0A8 2449FFFF */ addiu $t1, $v0, -1
/* 0BACAC 800BA0AC 0C02E7EE */ jal func_800B9FB8
@@ -47,14 +47,14 @@ glabel L800BA094
/* 0BACB4 800BA0B4 1000005A */ b .L800BA220
/* 0BACB8 800BA0B8 924E0000 */ lbu $t6, ($s2)
.L800BA0BC:
-/* 0BACBC 800BA0BC 8CC670B0 */ lw $a2, %lo(D_803B70B0)($a2)
+/* 0BACBC 800BA0BC 8CC670B0 */ lw $a2, %lo(gMaxSimultaneousNotes)($a2)
/* 0BACC0 800BA0C0 00002025 */ move $a0, $zero
/* 0BACC4 800BA0C4 00001825 */ move $v1, $zero
/* 0BACC8 800BA0C8 18C0001A */ blez $a2, .L800BA134
-/* 0BACCC 800BA0CC 3C07803B */ lui $a3, %hi(D_803B7088) # $a3, 0x803b
+/* 0BACCC 800BA0CC 3C07803B */ lui $a3, %hi(gAudioBufferParameters) # $a3, 0x803b
/* 0BACD0 800BA0D0 3C05803B */ lui $a1, %hi(D_803B1508) # $a1, 0x803b
/* 0BACD4 800BA0D4 24A51508 */ addiu $a1, %lo(D_803B1508) # addiu $a1, $a1, 0x1508
-/* 0BACD8 800BA0D8 24E77088 */ addiu $a3, %lo(D_803B7088) # addiu $a3, $a3, 0x7088
+/* 0BACD8 800BA0D8 24E77088 */ addiu $a3, %lo(gAudioBufferParameters) # addiu $a3, $a3, 0x7088
.L800BA0DC:
/* 0BACDC 800BA0DC 8CAA0000 */ lw $t2, ($a1)
/* 0BACE0 800BA0E0 24840001 */ addiu $a0, $a0, 1
@@ -67,14 +67,14 @@ glabel L800BA094
/* 0BACFC 800BA0FC 51A0000B */ beql $t5, $zero, .L800BA12C
/* 0BAD00 800BA100 0086082A */ slt $at, $a0, $a2
/* 0BAD04 800BA104 C4E40018 */ lwc1 $f4, 0x18($a3)
-/* 0BAD08 800BA108 3C06803B */ lui $a2, %hi(D_803B70B0) # $a2, 0x803b
+/* 0BAD08 800BA108 3C06803B */ lui $a2, %hi(gMaxSimultaneousNotes) # $a2, 0x803b
/* 0BAD0C 800BA10C E4440068 */ swc1 $f4, 0x68($v0)
/* 0BAD10 800BA110 8CAE0000 */ lw $t6, ($a1)
/* 0BAD14 800BA114 01C31021 */ addu $v0, $t6, $v1
/* 0BAD18 800BA118 904F0058 */ lbu $t7, 0x58($v0)
/* 0BAD1C 800BA11C 35F80010 */ ori $t8, $t7, 0x10
/* 0BAD20 800BA120 A0580058 */ sb $t8, 0x58($v0)
-/* 0BAD24 800BA124 8CC670B0 */ lw $a2, %lo(D_803B70B0)($a2)
+/* 0BAD24 800BA124 8CC670B0 */ lw $a2, %lo(gMaxSimultaneousNotes)($a2)
/* 0BAD28 800BA128 0086082A */ slt $at, $a0, $a2
.L800BA12C:
/* 0BAD2C 800BA12C 1420FFEB */ bnez $at, .L800BA0DC
diff --git a/asm/non_matchings/audio/heap/func_800BA250.s b/asm/non_matchings/audio/heap/func_800BA250.s
index c756fb1e5..6c2c0f519 100644
--- a/asm/non_matchings/audio/heap/func_800BA250.s
+++ b/asm/non_matchings/audio/heap/func_800BA250.s
@@ -8,7 +8,7 @@ glabel func_800BA250
/* 0BAE68 800BA268 01EE7821 */ addu $t7, $t7, $t6
/* 0BAE6C 800BA26C 000F78C0 */ sll $t7, $t7, 3
/* 0BAE70 800BA270 2718A4D8 */ addiu $t8, %lo(D_800EA4D8) # addiu $t8, $t8, -0x5b28
-/* 0BAE74 800BA274 3C01803B */ lui $at, %hi(D_803B6E58) # $at, 0x803b
+/* 0BAE74 800BA274 3C01803B */ lui $at, %hi(gSampleDmaNumListItems) # $at, 0x803b
/* 0BAE78 800BA278 AFBF003C */ sw $ra, 0x3c($sp)
/* 0BAE7C 800BA27C AFBE0038 */ sw $fp, 0x38($sp)
/* 0BAE80 800BA280 AFB70034 */ sw $s7, 0x34($sp)
@@ -19,10 +19,10 @@ glabel func_800BA250
/* 0BAE94 800BA294 AFB1001C */ sw $s1, 0x1c($sp)
/* 0BAE98 800BA298 AFB00018 */ sw $s0, 0x18($sp)
/* 0BAE9C 800BA29C 01F8B021 */ addu $s6, $t7, $t8
-/* 0BAEA0 800BA2A0 AC206E58 */ sw $zero, %lo(D_803B6E58)($at)
+/* 0BAEA0 800BA2A0 AC206E58 */ sw $zero, %lo(gSampleDmaNumListItems)($at)
/* 0BAEA4 800BA2A4 8ED90000 */ lw $t9, ($s6)
-/* 0BAEA8 800BA2A8 3C14803B */ lui $s4, %hi(D_803B7088) # $s4, 0x803b
-/* 0BAEAC 800BA2AC 26947088 */ addiu $s4, %lo(D_803B7088) # addiu $s4, $s4, 0x7088
+/* 0BAEA8 800BA2A8 3C14803B */ lui $s4, %hi(gAudioBufferParameters) # $s4, 0x803b
+/* 0BAEAC 800BA2AC 26947088 */ addiu $s4, %lo(gAudioBufferParameters) # addiu $s4, $s4, 0x7088
/* 0BAEB0 800BA2B0 A6990002 */ sh $t9, 2($s4)
/* 0BAEB4 800BA2B4 0C0343E0 */ jal osAiSetFrequency
/* 0BAEB8 800BA2B8 3324FFFF */ andi $a0, $t9, 0xffff
@@ -30,8 +30,8 @@ glabel func_800BA250
/* 0BAEC0 800BA2C0 3C0D803B */ lui $t5, %hi(D_803B717C) # $t5, 0x803b
/* 0BAEC4 800BA2C4 8DAD717C */ lw $t5, %lo(D_803B717C)($t5)
/* 0BAEC8 800BA2C8 96870002 */ lhu $a3, 2($s4)
-/* 0BAECC 800BA2CC 3C0C803B */ lui $t4, %hi(D_803B70B0) # $t4, 0x803b
-/* 0BAED0 800BA2D0 258C70B0 */ addiu $t4, %lo(D_803B70B0) # addiu $t4, $t4, 0x70b0
+/* 0BAECC 800BA2CC 3C0C803B */ lui $t4, %hi(gMaxSimultaneousNotes) # $t4, 0x803b
+/* 0BAED0 800BA2D0 258C70B0 */ addiu $t4, %lo(gMaxSimultaneousNotes) # addiu $t4, $t4, 0x70b0
/* 0BAED4 800BA2D4 00ED001A */ div $zero, $a3, $t5
/* 0BAED8 800BA2D8 00007012 */ mflo $t6
/* 0BAEDC 800BA2DC 25CF000F */ addiu $t7, $t6, 0xf
@@ -227,28 +227,28 @@ glabel func_800BA250
/* 0BB1B8 800BA5B8 AC8D0008 */ sw $t5, 8($a0)
/* 0BB1BC 800BA5BC 0C02E378 */ jal func_800B8DE0
/* 0BB1C0 800BA5C0 00000000 */ nop
-/* 0BB1C4 800BA5C4 3C05803B */ lui $a1, %hi(D_803B70B0) # $a1, 0x803b
-/* 0BB1C8 800BA5C8 8CA570B0 */ lw $a1, %lo(D_803B70B0)($a1)
-/* 0BB1CC 800BA5CC 3C13803B */ lui $s3, %hi(D_803AFBE8) # $s3, 0x803b
-/* 0BB1D0 800BA5D0 2673FBE8 */ addiu $s3, %lo(D_803AFBE8) # addiu $s3, $s3, -0x418
+/* 0BB1C4 800BA5C4 3C05803B */ lui $a1, %hi(gMaxSimultaneousNotes) # $a1, 0x803b
+/* 0BB1C8 800BA5C8 8CA570B0 */ lw $a1, %lo(gMaxSimultaneousNotes)($a1)
+/* 0BB1CC 800BA5CC 3C13803B */ lui $s3, %hi(gNotesAndBuffersPool) # $s3, 0x803b
+/* 0BB1D0 800BA5D0 2673FBE8 */ addiu $s3, %lo(gNotesAndBuffersPool) # addiu $s3, $s3, -0x418
/* 0BB1D4 800BA5D4 00057880 */ sll $t7, $a1, 2
/* 0BB1D8 800BA5D8 01E57823 */ subu $t7, $t7, $a1
/* 0BB1DC 800BA5DC 000F2980 */ sll $a1, $t7, 6
-/* 0BB1E0 800BA5E0 0C02E3FF */ jal func_800B8FFC
+/* 0BB1E0 800BA5E0 0C02E3FF */ jal soundAlloc
/* 0BB1E4 800BA5E4 02602025 */ move $a0, $s3
/* 0BB1E8 800BA5E8 3C01803B */ lui $at, %hi(D_803B1508) # $at, 0x803b
/* 0BB1EC 800BA5EC 0C02F74D */ jal func_800BDD34
/* 0BB1F0 800BA5F0 AC221508 */ sw $v0, %lo(D_803B1508)($at)
/* 0BB1F4 800BA5F4 0C02F4DA */ jal func_800BD368
/* 0BB1F8 800BA5F8 00000000 */ nop
-/* 0BB1FC 800BA5FC 3C18803B */ lui $t8, %hi(D_803B70B0) # $t8, 0x803b
-/* 0BB200 800BA600 8F1870B0 */ lw $t8, %lo(D_803B70B0)($t8)
+/* 0BB1FC 800BA5FC 3C18803B */ lui $t8, %hi(gMaxSimultaneousNotes) # $t8, 0x803b
+/* 0BB200 800BA600 8F1870B0 */ lw $t8, %lo(gMaxSimultaneousNotes)($t8)
/* 0BB204 800BA604 868E000C */ lh $t6, 0xc($s4)
/* 0BB208 800BA608 02602025 */ move $a0, $s3
/* 0BB20C 800BA60C 01D80019 */ multu $t6, $t8
/* 0BB210 800BA610 00002812 */ mflo $a1
/* 0BB214 800BA614 0005C900 */ sll $t9, $a1, 4
-/* 0BB218 800BA618 0C02E3FF */ jal func_800B8FFC
+/* 0BB218 800BA618 0C02E3FF */ jal soundAlloc
/* 0BB21C 800BA61C 03202825 */ move $a1, $t9
/* 0BB220 800BA620 3C01803B */ lui $at, %hi(gNoteSubsEu) # $at, 0x803b
/* 0BB224 800BA624 3C10803B */ lui $s0, %hi(D_803B70C8) # $s0, 0x803b
@@ -260,7 +260,7 @@ glabel func_800BA250
/* 0BB238 800BA638 8E450000 */ lw $a1, ($s2)
/* 0BB23C 800BA63C 02602025 */ move $a0, $s3
/* 0BB240 800BA640 000568C0 */ sll $t5, $a1, 3
-/* 0BB244 800BA644 0C02E3FF */ jal func_800B8FFC
+/* 0BB244 800BA644 0C02E3FF */ jal soundAlloc
/* 0BB248 800BA648 01A02825 */ move $a1, $t5
/* 0BB24C 800BA64C 26100004 */ addiu $s0, $s0, 4
/* 0BB250 800BA650 1611FFF9 */ bne $s0, $s1, .L800BA638
@@ -299,13 +299,13 @@ glabel func_800BA250
/* 0BB2CC 800BA6CC 94580002 */ lhu $t8, 2($v0)
/* 0BB2D0 800BA6D0 A25E0001 */ sb $fp, 1($s2)
/* 0BB2D4 800BA6D4 03202825 */ move $a1, $t9
-/* 0BB2D8 800BA6D8 0C02E3FF */ jal func_800B8FFC
+/* 0BB2D8 800BA6D8 0C02E3FF */ jal soundAlloc
/* 0BB2DC 800BA6DC A6580008 */ sh $t8, 8($s2)
/* 0BB2E0 800BA6E0 96450006 */ lhu $a1, 6($s2)
/* 0BB2E4 800BA6E4 AE420018 */ sw $v0, 0x18($s2)
/* 0BB2E8 800BA6E8 02602025 */ move $a0, $s3
/* 0BB2EC 800BA6EC 00056840 */ sll $t5, $a1, 1
-/* 0BB2F0 800BA6F0 0C02E3FF */ jal func_800B8FFC
+/* 0BB2F0 800BA6F0 0C02E3FF */ jal soundAlloc
/* 0BB2F4 800BA6F4 01A02825 */ move $a1, $t5
/* 0BB2F8 800BA6F8 92430004 */ lbu $v1, 4($s2)
/* 0BB2FC 800BA6FC 964F0006 */ lhu $t7, 6($s2)
@@ -337,19 +337,19 @@ glabel func_800BA250
/* 0BB35C 800BA75C A64D000A */ sh $t5, 0xa($s2)
/* 0BB360 800BA760 02602025 */ move $a0, $s3
/* 0BB364 800BA764 24050020 */ li $a1, 32
-/* 0BB368 800BA768 0C02E3FF */ jal func_800B8FFC
+/* 0BB368 800BA768 0C02E3FF */ jal soundAlloc
/* 0BB36C 800BA76C 00008825 */ move $s1, $zero
/* 0BB370 800BA770 AE420020 */ sw $v0, 0x20($s2)
/* 0BB374 800BA774 02602025 */ move $a0, $s3
-/* 0BB378 800BA778 0C02E3FF */ jal func_800B8FFC
+/* 0BB378 800BA778 0C02E3FF */ jal soundAlloc
/* 0BB37C 800BA77C 24050020 */ li $a1, 32
/* 0BB380 800BA780 AE420024 */ sw $v0, 0x24($s2)
/* 0BB384 800BA784 02602025 */ move $a0, $s3
-/* 0BB388 800BA788 0C02E3FF */ jal func_800B8FFC
+/* 0BB388 800BA788 0C02E3FF */ jal soundAlloc
/* 0BB38C 800BA78C 24050020 */ li $a1, 32
/* 0BB390 800BA790 AE420028 */ sw $v0, 0x28($s2)
/* 0BB394 800BA794 02602025 */ move $a0, $s3
-/* 0BB398 800BA798 0C02E3FF */ jal func_800B8FFC
+/* 0BB398 800BA798 0C02E3FF */ jal soundAlloc
/* 0BB39C 800BA79C 24050020 */ li $a1, 32
/* 0BB3A0 800BA7A0 868F000C */ lh $t7, 0xc($s4)
/* 0BB3A4 800BA7A4 AE42002C */ sw $v0, 0x2c($s2)
@@ -358,13 +358,13 @@ glabel func_800BA250
/* 0BB3B0 800BA7B0 02408025 */ move $s0, $s2
/* 0BB3B4 800BA7B4 02602025 */ move $a0, $s3
.L800BA7B8:
-/* 0BB3B8 800BA7B8 0C02E3FF */ jal func_800B8FFC
+/* 0BB3B8 800BA7B8 0C02E3FF */ jal soundAlloc
/* 0BB3BC 800BA7BC 24050300 */ li $a1, 768
/* 0BB3C0 800BA7C0 244E0180 */ addiu $t6, $v0, 0x180
/* 0BB3C4 800BA7C4 AE020034 */ sw $v0, 0x34($s0)
/* 0BB3C8 800BA7C8 AE0E0038 */ sw $t6, 0x38($s0)
/* 0BB3CC 800BA7CC 02602025 */ move $a0, $s3
-/* 0BB3D0 800BA7D0 0C02E3FF */ jal func_800B8FFC
+/* 0BB3D0 800BA7D0 0C02E3FF */ jal soundAlloc
/* 0BB3D4 800BA7D4 24050300 */ li $a1, 768
/* 0BB3D8 800BA7D8 24580180 */ addiu $t8, $v0, 0x180
/* 0BB3DC 800BA7DC AE020098 */ sw $v0, 0x98($s0)
@@ -384,9 +384,9 @@ glabel func_800BA250
/* 0BB40C 800BA80C 5420FFA5 */ bnel $at, $zero, .L800BA6A4
/* 0BB410 800BA810 8ED80008 */ lw $t8, 8($s6)
.L800BA814:
-/* 0BB414 800BA814 3C04803B */ lui $a0, %hi(D_803B70B0) # $a0, 0x803b
+/* 0BB414 800BA814 3C04803B */ lui $a0, %hi(gMaxSimultaneousNotes) # $a0, 0x803b
/* 0BB418 800BA818 0C02EC0C */ jal func_800BB030
-/* 0BB41C 800BA81C 8C8470B0 */ lw $a0, %lo(D_803B70B0)($a0)
+/* 0BB41C 800BA81C 8C8470B0 */ lw $a0, %lo(gMaxSimultaneousNotes)($a0)
/* 0BB420 800BA820 0C033624 */ jal osWritebackDCacheAll
/* 0BB424 800BA824 00000000 */ nop
/* 0BB428 800BA828 8FBF003C */ lw $ra, 0x3c($sp)
diff --git a/asm/non_matchings/audio/heap/func_800BA858.s b/asm/non_matchings/audio/heap/func_800BA858.s
index 05c5b4783..0de5718e6 100644
--- a/asm/non_matchings/audio/heap/func_800BA858.s
+++ b/asm/non_matchings/audio/heap/func_800BA858.s
@@ -81,7 +81,7 @@ glabel func_800BA858
.L800BA968:
/* 0BB568 800BA968 AFA50034 */ sw $a1, 0x34($sp)
/* 0BB56C 800BA96C AFA60038 */ sw $a2, 0x38($sp)
-/* 0BB570 800BA970 0C02E3FF */ jal func_800B8FFC
+/* 0BB570 800BA970 0C02E3FF */ jal soundAlloc
/* 0BB574 800BA974 AFA70030 */ sw $a3, 0x30($sp)
/* 0BB578 800BA978 8FA60038 */ lw $a2, 0x38($sp)
/* 0BB57C 800BA97C 3C0D803B */ lui $t5, %hi(D_803B01B8) # $t5, 0x803b
@@ -96,7 +96,7 @@ glabel func_800BA858
/* 0BB5A0 800BA9A0 00E02025 */ move $a0, $a3
/* 0BB5A4 800BA9A4 00402825 */ move $a1, $v0
/* 0BB5A8 800BA9A8 8FA60034 */ lw $a2, 0x34($sp)
-/* 0BB5AC 800BA9AC 0C02EAA0 */ jal func_800BAA80
+/* 0BB5AC 800BA9AC 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BB5B0 800BA9B0 AFA30020 */ sw $v1, 0x20($sp)
/* 0BB5B4 800BA9B4 8FA30020 */ lw $v1, 0x20($sp)
/* 0BB5B8 800BA9B8 8FAE0034 */ lw $t6, 0x34($sp)
diff --git a/asm/non_matchings/audio/heap/func_800B8FFC.s b/asm/non_matchings/audio/heap/soundAlloc.s
index d855f9be2..d284678ea 100644
--- a/asm/non_matchings/audio/heap/func_800B8FFC.s
+++ b/asm/non_matchings/audio/heap/soundAlloc.s
@@ -1,4 +1,4 @@
-glabel func_800B8FFC
+glabel soundAlloc
/* 0B9BFC 800B8FFC 8C860004 */ lw $a2, 4($a0)
/* 0B9C00 800B9000 8C8F0000 */ lw $t7, ($a0)
/* 0B9C04 800B9004 8C980008 */ lw $t8, 8($a0)
diff --git a/asm/non_matchings/audio/load/audio_init.s b/asm/non_matchings/audio/load/audio_init.s
index 456ed90b6..d1111d01e 100644
--- a/asm/non_matchings/audio/load/audio_init.s
+++ b/asm/non_matchings/audio/load/audio_init.s
@@ -118,17 +118,17 @@ glabel audio_init
/* 0BCE84 800BC284 24846720 */ addiu $a0, %lo(D_803B6720) # addiu $a0, $a0, 0x6720
/* 0BCE88 800BC288 0C033358 */ jal osCreateMesgQueue
/* 0BCE8C 800BC28C 24060001 */ li $a2, 1
-/* 0BCE90 800BC290 3C04803B */ lui $a0, %hi(D_803B6008) # $a0, 0x803b
-/* 0BCE94 800BC294 3C05803B */ lui $a1, %hi(D_803B6020) # $a1, 0x803b
-/* 0BCE98 800BC298 24A56020 */ addiu $a1, %lo(D_803B6020) # addiu $a1, $a1, 0x6020
-/* 0BCE9C 800BC29C 24846008 */ addiu $a0, %lo(D_803B6008) # addiu $a0, $a0, 0x6008
+/* 0BCE90 800BC290 3C04803B */ lui $a0, %hi(gCurrAudioFrameDmaQueue) # $a0, 0x803b
+/* 0BCE94 800BC294 3C05803B */ lui $a1, %hi(gCurrAudioFrameDmaMesgBufs) # $a1, 0x803b
+/* 0BCE98 800BC298 24A56020 */ addiu $a1, %lo(gCurrAudioFrameDmaMesgBufs) # addiu $a1, $a1, 0x6020
+/* 0BCE9C 800BC29C 24846008 */ addiu $a0, %lo(gCurrAudioFrameDmaQueue) # addiu $a0, $a0, 0x6008
/* 0BCEA0 800BC2A0 0C033358 */ jal osCreateMesgQueue
/* 0BCEA4 800BC2A4 24060040 */ li $a2, 64
-/* 0BCEA8 800BC2A8 3C01803B */ lui $at, %hi(D_803B70BC) # $at, 0x803b
-/* 0BCEAC 800BC2AC AC2070BC */ sw $zero, %lo(D_803B70BC)($at)
-/* 0BCEB0 800BC2B0 3C01803B */ lui $at, %hi(D_803B6E58) # $at, 0x803b
+/* 0BCEA8 800BC2A8 3C01803B */ lui $at, %hi(gCurrAudioFrameDmaCount) # $at, 0x803b
+/* 0BCEAC 800BC2AC AC2070BC */ sw $zero, %lo(gCurrAudioFrameDmaCount)($at)
+/* 0BCEB0 800BC2B0 3C01803B */ lui $at, %hi(gSampleDmaNumListItems) # $at, 0x803b
/* 0BCEB4 800BC2B4 3C04800F */ lui $a0, %hi(D_800EA5D4) # $a0, 0x800f
-/* 0BCEB8 800BC2B8 AC206E58 */ sw $zero, %lo(D_803B6E58)($at)
+/* 0BCEB8 800BC2B8 AC206E58 */ sw $zero, %lo(gSampleDmaNumListItems)($at)
/* 0BCEBC 800BC2BC 0C02E43C */ jal func_800B90F0
/* 0BCEC0 800BC2C0 8C84A5D4 */ lw $a0, %lo(D_800EA5D4)($a0)
/* 0BCEC4 800BC2C4 3C06803B */ lui $a2, %hi(D_803B7180) # $a2, 0x803b
@@ -141,7 +141,7 @@ glabel audio_init
/* 0BCEE0 800BC2E0 02802025 */ move $a0, $s4
.L800BC2E4:
/* 0BCEE4 800BC2E4 24050A00 */ li $a1, 2560
-/* 0BCEE8 800BC2E8 0C02E3FF */ jal func_800B8FFC
+/* 0BCEE8 800BC2E8 0C02E3FF */ jal soundAlloc
/* 0BCEEC 800BC2EC AFA6003C */ sw $a2, 0x3c($sp)
/* 0BCEF0 800BC2F0 8FA6003C */ lw $a2, 0x3c($sp)
/* 0BCEF4 800BC2F4 00001825 */ move $v1, $zero
@@ -180,7 +180,7 @@ glabel audio_init
/* 0BCF74 800BC374 AE350000 */ sw $s5, ($s1)
/* 0BCF78 800BC378 02A02825 */ move $a1, $s5
/* 0BCF7C 800BC37C 02402025 */ move $a0, $s2
-/* 0BCF80 800BC380 0C02EAA0 */ jal func_800BAA80
+/* 0BCF80 800BC380 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BCF84 800BC384 24060010 */ li $a2, 16
/* 0BCF88 800BC388 8E280000 */ lw $t0, ($s1)
/* 0BCF8C 800BC38C 3C02803B */ lui $v0, %hi(D_803B707C) # $v0, 0x803b
@@ -194,12 +194,12 @@ glabel audio_init
/* 0BCFAC 800BC3AC 26100013 */ addiu $s0, $s0, 0x13
/* 0BCFB0 800BC3B0 02012824 */ and $a1, $s0, $at
/* 0BCFB4 800BC3B4 00A08025 */ move $s0, $a1
-/* 0BCFB8 800BC3B8 0C02E3FF */ jal func_800B8FFC
+/* 0BCFB8 800BC3B8 0C02E3FF */ jal soundAlloc
/* 0BCFBC 800BC3BC A4490000 */ sh $t1, ($v0)
/* 0BCFC0 800BC3C0 AE220000 */ sw $v0, ($s1)
/* 0BCFC4 800BC3C4 02402025 */ move $a0, $s2
/* 0BCFC8 800BC3C8 00402825 */ move $a1, $v0
-/* 0BCFCC 800BC3CC 0C02EAA0 */ jal func_800BAA80
+/* 0BCFCC 800BC3CC 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BCFD0 800BC3D0 02003025 */ move $a2, $s0
/* 0BCFD4 800BC3D4 8E240000 */ lw $a0, ($s1)
/* 0BCFD8 800BC3D8 0C02ED0F */ jal func_800BB43C
@@ -211,7 +211,7 @@ glabel audio_init
/* 0BCFF0 800BC3F0 AE550000 */ sw $s5, ($s2)
/* 0BCFF4 800BC3F4 02202025 */ move $a0, $s1
/* 0BCFF8 800BC3F8 02A02825 */ move $a1, $s5
-/* 0BCFFC 800BC3FC 0C02EAA0 */ jal func_800BAA80
+/* 0BCFFC 800BC3FC 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD000 800BC400 24060010 */ li $a2, 16
/* 0BD004 800BC404 8E4C0000 */ lw $t4, ($s2)
/* 0BD008 800BC408 2401FFF0 */ li $at, -16
@@ -220,12 +220,12 @@ glabel audio_init
/* 0BD014 800BC414 001380C0 */ sll $s0, $s3, 3
/* 0BD018 800BC418 26100013 */ addiu $s0, $s0, 0x13
/* 0BD01C 800BC41C 02012824 */ and $a1, $s0, $at
-/* 0BD020 800BC420 0C02E3FF */ jal func_800B8FFC
+/* 0BD020 800BC420 0C02E3FF */ jal soundAlloc
/* 0BD024 800BC424 00A08025 */ move $s0, $a1
/* 0BD028 800BC428 AE420000 */ sw $v0, ($s2)
/* 0BD02C 800BC42C 02202025 */ move $a0, $s1
/* 0BD030 800BC430 00402825 */ move $a1, $v0
-/* 0BD034 800BC434 0C02EAA0 */ jal func_800BAA80
+/* 0BD034 800BC434 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD038 800BC438 02003025 */ move $a2, $s0
/* 0BD03C 800BC43C 8E440000 */ lw $a0, ($s2)
/* 0BD040 800BC440 0C02ED0F */ jal func_800BB43C
@@ -233,7 +233,7 @@ glabel audio_init
/* 0BD048 800BC448 00132880 */ sll $a1, $s3, 2
/* 0BD04C 800BC44C 00B32823 */ subu $a1, $a1, $s3
/* 0BD050 800BC450 00052880 */ sll $a1, $a1, 2
-/* 0BD054 800BC454 0C02E3FF */ jal func_800B8FFC
+/* 0BD054 800BC454 0C02E3FF */ jal soundAlloc
/* 0BD058 800BC458 02802025 */ move $a0, $s4
/* 0BD05C 800BC45C 3C07803B */ lui $a3, %hi(D_803B7080) # $a3, 0x803b
/* 0BD060 800BC460 24E77080 */ addiu $a3, %lo(D_803B7080) # addiu $a3, $a3, 0x7080
@@ -248,7 +248,7 @@ glabel audio_init
/* 0BD080 800BC480 24060010 */ li $a2, 16
/* 0BD084 800BC484 01D17821 */ addu $t7, $t6, $s1
/* 0BD088 800BC488 8DE40004 */ lw $a0, 4($t7)
-/* 0BD08C 800BC48C 0C02EAA0 */ jal func_800BAA80
+/* 0BD08C 800BC48C 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD090 800BC490 AFA3008C */ sw $v1, 0x8c($sp)
/* 0BD094 800BC494 3C07803B */ lui $a3, %hi(D_803B7080) # $a3, 0x803b
/* 0BD098 800BC498 24E77080 */ addiu $a3, %lo(D_803B7080) # addiu $a3, $a3, 0x7080
@@ -273,7 +273,7 @@ glabel audio_init
/* 0BD0E0 800BC4E0 AE350000 */ sw $s5, ($s1)
/* 0BD0E4 800BC4E4 02402025 */ move $a0, $s2
/* 0BD0E8 800BC4E8 02A02825 */ move $a1, $s5
-/* 0BD0EC 800BC4EC 0C02EAA0 */ jal func_800BAA80
+/* 0BD0EC 800BC4EC 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD0F0 800BC4F0 24060010 */ li $a2, 16
/* 0BD0F4 800BC4F4 8E2C0000 */ lw $t4, ($s1)
/* 0BD0F8 800BC4F8 2401FFF0 */ li $at, -16
@@ -283,18 +283,18 @@ glabel audio_init
/* 0BD108 800BC508 01A08025 */ move $s0, $t5
/* 0BD10C 800BC50C 26100013 */ addiu $s0, $s0, 0x13
/* 0BD110 800BC510 02012824 */ and $a1, $s0, $at
-/* 0BD114 800BC514 0C02E3FF */ jal func_800B8FFC
+/* 0BD114 800BC514 0C02E3FF */ jal soundAlloc
/* 0BD118 800BC518 00A08025 */ move $s0, $a1
/* 0BD11C 800BC51C AE220000 */ sw $v0, ($s1)
/* 0BD120 800BC520 02402025 */ move $a0, $s2
/* 0BD124 800BC524 00402825 */ move $a1, $v0
-/* 0BD128 800BC528 0C02EAA0 */ jal func_800BAA80
+/* 0BD128 800BC528 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD12C 800BC52C 02003025 */ move $a2, $s0
/* 0BD130 800BC530 8E240000 */ lw $a0, ($s1)
/* 0BD134 800BC534 0C02ED0F */ jal func_800BB43C
/* 0BD138 800BC538 02402825 */ move $a1, $s2
/* 0BD13C 800BC53C 02802025 */ move $a0, $s4
-/* 0BD140 800BC540 0C02E3FF */ jal func_800B8FFC
+/* 0BD140 800BC540 0C02E3FF */ jal soundAlloc
/* 0BD144 800BC544 24050100 */ li $a1, 256
/* 0BD148 800BC548 3C03803B */ lui $v1, %hi(D_803B7078) # $v1, 0x803b
/* 0BD14C 800BC54C 24637078 */ addiu $v1, %lo(D_803B7078) # addiu $v1, $v1, 0x7078
@@ -302,12 +302,12 @@ glabel audio_init
/* 0BD154 800BC554 AC620000 */ sw $v0, ($v1)
/* 0BD158 800BC558 248490E0 */ addiu $a0, %lo(_instrument_setsSegmentRomStart) # addiu $a0, $a0, -0x6f20
/* 0BD15C 800BC55C 00402825 */ move $a1, $v0
-/* 0BD160 800BC560 0C02EAA0 */ jal func_800BAA80
+/* 0BD160 800BC560 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BD164 800BC564 24060100 */ li $a2, 256
/* 0BD168 800BC568 3C10800F */ lui $s0, %hi(D_800EA5D8) # $s0, 0x800f
/* 0BD16C 800BC56C 2610A5D8 */ addiu $s0, %lo(D_800EA5D8) # addiu $s0, $s0, -0x5a28
/* 0BD170 800BC570 8E050000 */ lw $a1, ($s0)
-/* 0BD174 800BC574 0C02E3FF */ jal func_800B8FFC
+/* 0BD174 800BC574 0C02E3FF */ jal soundAlloc
/* 0BD178 800BC578 02802025 */ move $a0, $s4
/* 0BD17C 800BC57C 3C04803B */ lui $a0, %hi(D_803B01B8) # $a0, 0x803b
/* 0BD180 800BC580 248401B8 */ addiu $a0, %lo(D_803B01B8) # addiu $a0, $a0, 0x1b8
diff --git a/asm/non_matchings/audio/load/func_800BAA80.s b/asm/non_matchings/audio/load/func_800BAA80.s
deleted file mode 100644
index 68620349b..000000000
--- a/asm/non_matchings/audio/load/func_800BAA80.s
+++ /dev/null
@@ -1,31 +0,0 @@
-glabel func_800BAA80
-/* 0BB680 800BAA80 27BDFFD8 */ addiu $sp, $sp, -0x28
-/* 0BB684 800BAA84 AFA40028 */ sw $a0, 0x28($sp)
-/* 0BB688 800BAA88 AFBF0024 */ sw $ra, 0x24($sp)
-/* 0BB68C 800BAA8C AFA5002C */ sw $a1, 0x2c($sp)
-/* 0BB690 800BAA90 00A02025 */ move $a0, $a1
-/* 0BB694 800BAA94 AFA60030 */ sw $a2, 0x30($sp)
-/* 0BB698 800BAA98 0C0336E0 */ jal osInvalDCache
-/* 0BB69C 800BAA9C 00C02825 */ move $a1, $a2
-/* 0BB6A0 800BAAA0 8FAE002C */ lw $t6, 0x2c($sp)
-/* 0BB6A4 800BAAA4 8FAF0030 */ lw $t7, 0x30($sp)
-/* 0BB6A8 800BAAA8 3C18803B */ lui $t8, %hi(D_803B6720) # $t8, 0x803b
-/* 0BB6AC 800BAAAC 27186720 */ addiu $t8, %lo(D_803B6720) # addiu $t8, $t8, 0x6720
-/* 0BB6B0 800BAAB0 3C04803B */ lui $a0, %hi(D_803B6740) # $a0, 0x803b
-/* 0BB6B4 800BAAB4 24846740 */ addiu $a0, %lo(D_803B6740) # addiu $a0, $a0, 0x6740
-/* 0BB6B8 800BAAB8 AFB80018 */ sw $t8, 0x18($sp)
-/* 0BB6BC 800BAABC 24050001 */ li $a1, 1
-/* 0BB6C0 800BAAC0 00003025 */ move $a2, $zero
-/* 0BB6C4 800BAAC4 8FA70028 */ lw $a3, 0x28($sp)
-/* 0BB6C8 800BAAC8 AFAE0010 */ sw $t6, 0x10($sp)
-/* 0BB6CC 800BAACC 0C03370C */ jal osPiStartDma
-/* 0BB6D0 800BAAD0 AFAF0014 */ sw $t7, 0x14($sp)
-/* 0BB6D4 800BAAD4 3C04803B */ lui $a0, %hi(D_803B6720) # $a0, 0x803b
-/* 0BB6D8 800BAAD8 24846720 */ addiu $a0, %lo(D_803B6720) # addiu $a0, $a0, 0x6720
-/* 0BB6DC 800BAADC 00002825 */ move $a1, $zero
-/* 0BB6E0 800BAAE0 0C0335D4 */ jal osRecvMesg
-/* 0BB6E4 800BAAE4 24060001 */ li $a2, 1
-/* 0BB6E8 800BAAE8 8FBF0024 */ lw $ra, 0x24($sp)
-/* 0BB6EC 800BAAEC 27BD0028 */ addiu $sp, $sp, 0x28
-/* 0BB6F0 800BAAF0 03E00008 */ jr $ra
-/* 0BB6F4 800BAAF4 00000000 */ nop
diff --git a/asm/non_matchings/audio/load/func_800BAAF8.s b/asm/non_matchings/audio/load/func_800BAAF8.s
deleted file mode 100644
index bac9582bf..000000000
--- a/asm/non_matchings/audio/load/func_800BAAF8.s
+++ /dev/null
@@ -1,25 +0,0 @@
-glabel func_800BAAF8
-/* 0BB6F8 800BAAF8 27BDFFD8 */ addiu $sp, $sp, -0x28
-/* 0BB6FC 800BAAFC AFA40028 */ sw $a0, 0x28($sp)
-/* 0BB700 800BAB00 AFBF0024 */ sw $ra, 0x24($sp)
-/* 0BB704 800BAB04 AFA5002C */ sw $a1, 0x2c($sp)
-/* 0BB708 800BAB08 00A02025 */ move $a0, $a1
-/* 0BB70C 800BAB0C AFA60030 */ sw $a2, 0x30($sp)
-/* 0BB710 800BAB10 AFA70034 */ sw $a3, 0x34($sp)
-/* 0BB714 800BAB14 0C0336E0 */ jal osInvalDCache
-/* 0BB718 800BAB18 00C02825 */ move $a1, $a2
-/* 0BB71C 800BAB1C 8FAE002C */ lw $t6, 0x2c($sp)
-/* 0BB720 800BAB20 8FAF0030 */ lw $t7, 0x30($sp)
-/* 0BB724 800BAB24 8FB80034 */ lw $t8, 0x34($sp)
-/* 0BB728 800BAB28 8FA40038 */ lw $a0, 0x38($sp)
-/* 0BB72C 800BAB2C 00002825 */ move $a1, $zero
-/* 0BB730 800BAB30 00003025 */ move $a2, $zero
-/* 0BB734 800BAB34 8FA70028 */ lw $a3, 0x28($sp)
-/* 0BB738 800BAB38 AFAE0010 */ sw $t6, 0x10($sp)
-/* 0BB73C 800BAB3C AFAF0014 */ sw $t7, 0x14($sp)
-/* 0BB740 800BAB40 0C03370C */ jal osPiStartDma
-/* 0BB744 800BAB44 AFB80018 */ sw $t8, 0x18($sp)
-/* 0BB748 800BAB48 8FBF0024 */ lw $ra, 0x24($sp)
-/* 0BB74C 800BAB4C 27BD0028 */ addiu $sp, $sp, 0x28
-/* 0BB750 800BAB50 03E00008 */ jr $ra
-/* 0BB754 800BAB54 00000000 */ nop
diff --git a/asm/non_matchings/audio/load/func_800BAB58.s b/asm/non_matchings/audio/load/func_800BAB58.s
deleted file mode 100644
index 32d2232fc..000000000
--- a/asm/non_matchings/audio/load/func_800BAB58.s
+++ /dev/null
@@ -1,45 +0,0 @@
-glabel func_800BAB58
-/* 0BB758 800BAB58 27BDFFD0 */ addiu $sp, $sp, -0x30
-/* 0BB75C 800BAB5C AFBF002C */ sw $ra, 0x2c($sp)
-/* 0BB760 800BAB60 AFB00028 */ sw $s0, 0x28($sp)
-/* 0BB764 800BAB64 AFA40030 */ sw $a0, 0x30($sp)
-/* 0BB768 800BAB68 AFA50034 */ sw $a1, 0x34($sp)
-/* 0BB76C 800BAB6C AFA7003C */ sw $a3, 0x3c($sp)
-/* 0BB770 800BAB70 8CC20000 */ lw $v0, ($a2)
-/* 0BB774 800BAB74 28411000 */ slti $at, $v0, 0x1000
-/* 0BB778 800BAB78 14200003 */ bnez $at, .L800BAB88
-/* 0BB77C 800BAB7C 00408025 */ move $s0, $v0
-/* 0BB780 800BAB80 10000001 */ b .L800BAB88
-/* 0BB784 800BAB84 24101000 */ li $s0, 4096
-.L800BAB88:
-/* 0BB788 800BAB88 00507023 */ subu $t6, $v0, $s0
-/* 0BB78C 800BAB8C ACCE0000 */ sw $t6, ($a2)
-/* 0BB790 800BAB90 8FAF0034 */ lw $t7, 0x34($sp)
-/* 0BB794 800BAB94 02002825 */ move $a1, $s0
-/* 0BB798 800BAB98 0C0336E0 */ jal osInvalDCache
-/* 0BB79C 800BAB9C 8DE40000 */ lw $a0, ($t7)
-/* 0BB7A0 800BABA0 8FB80030 */ lw $t8, 0x30($sp)
-/* 0BB7A4 800BABA4 8FB90034 */ lw $t9, 0x34($sp)
-/* 0BB7A8 800BABA8 8FA9003C */ lw $t1, 0x3c($sp)
-/* 0BB7AC 800BABAC 8F070000 */ lw $a3, ($t8)
-/* 0BB7B0 800BABB0 8F280000 */ lw $t0, ($t9)
-/* 0BB7B4 800BABB4 AFB00014 */ sw $s0, 0x14($sp)
-/* 0BB7B8 800BABB8 8FA40040 */ lw $a0, 0x40($sp)
-/* 0BB7BC 800BABBC 00002825 */ move $a1, $zero
-/* 0BB7C0 800BABC0 00003025 */ move $a2, $zero
-/* 0BB7C4 800BABC4 AFA90018 */ sw $t1, 0x18($sp)
-/* 0BB7C8 800BABC8 0C03370C */ jal osPiStartDma
-/* 0BB7CC 800BABCC AFA80010 */ sw $t0, 0x10($sp)
-/* 0BB7D0 800BABD0 8FA30030 */ lw $v1, 0x30($sp)
-/* 0BB7D4 800BABD4 8FA20034 */ lw $v0, 0x34($sp)
-/* 0BB7D8 800BABD8 8C6A0000 */ lw $t2, ($v1)
-/* 0BB7DC 800BABDC 01505821 */ addu $t3, $t2, $s0
-/* 0BB7E0 800BABE0 AC6B0000 */ sw $t3, ($v1)
-/* 0BB7E4 800BABE4 8C4C0000 */ lw $t4, ($v0)
-/* 0BB7E8 800BABE8 01906821 */ addu $t5, $t4, $s0
-/* 0BB7EC 800BABEC AC4D0000 */ sw $t5, ($v0)
-/* 0BB7F0 800BABF0 8FBF002C */ lw $ra, 0x2c($sp)
-/* 0BB7F4 800BABF4 8FB00028 */ lw $s0, 0x28($sp)
-/* 0BB7F8 800BABF8 27BD0030 */ addiu $sp, $sp, 0x30
-/* 0BB7FC 800BABFC 03E00008 */ jr $ra
-/* 0BB800 800BAC00 00000000 */ nop
diff --git a/asm/non_matchings/audio/load/func_800BAC04.s b/asm/non_matchings/audio/load/func_800BAC04.s
deleted file mode 100644
index 520053a9b..000000000
--- a/asm/non_matchings/audio/load/func_800BAC04.s
+++ /dev/null
@@ -1,73 +0,0 @@
-glabel func_800BAC04
-/* 0BB804 800BAC04 3C05803B */ lui $a1, %hi(D_803B6E5C) # $a1, 0x803b
-/* 0BB808 800BAC08 24A56E5C */ addiu $a1, %lo(D_803B6E5C) # addiu $a1, $a1, 0x6e5c
-/* 0BB80C 800BAC0C 8CA30000 */ lw $v1, ($a1)
-/* 0BB810 800BAC10 3C04803B */ lui $a0, %hi(D_803B6758) # $a0, 0x803b
-/* 0BB814 800BAC14 24846758 */ addiu $a0, %lo(D_803B6758) # addiu $a0, $a0, 0x6758
-/* 0BB818 800BAC18 10600018 */ beqz $v1, .L800BAC7C
-/* 0BB81C 800BAC1C 00001025 */ move $v0, $zero
-/* 0BB820 800BAC20 3C07803B */ lui $a3, %hi(D_803B6E68) # $a3, 0x803b
-/* 0BB824 800BAC24 3C06803B */ lui $a2, %hi(D_803B706A) # $a2, 0x803b
-/* 0BB828 800BAC28 24C6706A */ addiu $a2, %lo(D_803B706A) # addiu $a2, $a2, 0x706a
-/* 0BB82C 800BAC2C 24E76E68 */ addiu $a3, %lo(D_803B6E68) # addiu $a3, $a3, 0x6e68
-/* 0BB830 800BAC30 9083000E */ lbu $v1, 0xe($a0)
-.L800BAC34:
-/* 0BB834 800BAC34 1060000B */ beqz $v1, .L800BAC64
-/* 0BB838 800BAC38 246EFFFF */ addiu $t6, $v1, -1
-/* 0BB83C 800BAC3C 31CF00FF */ andi $t7, $t6, 0xff
-/* 0BB840 800BAC40 15E00008 */ bnez $t7, .L800BAC64
-/* 0BB844 800BAC44 A08E000E */ sb $t6, 0xe($a0)
-/* 0BB848 800BAC48 90C30000 */ lbu $v1, ($a2)
-/* 0BB84C 800BAC4C 90D80000 */ lbu $t8, ($a2)
-/* 0BB850 800BAC50 00E3C821 */ addu $t9, $a3, $v1
-/* 0BB854 800BAC54 A3220000 */ sb $v0, ($t9)
-/* 0BB858 800BAC58 24680001 */ addiu $t0, $v1, 1
-/* 0BB85C 800BAC5C A0C80000 */ sb $t0, ($a2)
-/* 0BB860 800BAC60 A098000D */ sb $t8, 0xd($a0)
-.L800BAC64:
-/* 0BB864 800BAC64 8CA30000 */ lw $v1, ($a1)
-/* 0BB868 800BAC68 24420001 */ addiu $v0, $v0, 1
-/* 0BB86C 800BAC6C 24840010 */ addiu $a0, $a0, 0x10
-/* 0BB870 800BAC70 0043082B */ sltu $at, $v0, $v1
-/* 0BB874 800BAC74 5420FFEF */ bnel $at, $zero, .L800BAC34
-/* 0BB878 800BAC78 9083000E */ lbu $v1, 0xe($a0)
-.L800BAC7C:
-/* 0BB87C 800BAC7C 3C05803B */ lui $a1, %hi(D_803B6E58) # $a1, 0x803b
-/* 0BB880 800BAC80 24A56E58 */ addiu $a1, %lo(D_803B6E58) # addiu $a1, $a1, 0x6e58
-/* 0BB884 800BAC84 8CA90000 */ lw $t1, ($a1)
-/* 0BB888 800BAC88 00601025 */ move $v0, $v1
-/* 0BB88C 800BAC8C 00035100 */ sll $t2, $v1, 4
-/* 0BB890 800BAC90 0069082B */ sltu $at, $v1, $t1
-/* 0BB894 800BAC94 1020001A */ beqz $at, .L800BAD00
-/* 0BB898 800BAC98 3C0B803B */ lui $t3, %hi(D_803B6758) # $t3, 0x803b
-/* 0BB89C 800BAC9C 256B6758 */ addiu $t3, %lo(D_803B6758) # addiu $t3, $t3, 0x6758
-/* 0BB8A0 800BACA0 3C07803B */ lui $a3, %hi(D_803B6F68) # $a3, 0x803b
-/* 0BB8A4 800BACA4 3C06803B */ lui $a2, %hi(D_803B706B) # $a2, 0x803b
-/* 0BB8A8 800BACA8 24C6706B */ addiu $a2, %lo(D_803B706B) # addiu $a2, $a2, 0x706b
-/* 0BB8AC 800BACAC 24E76F68 */ addiu $a3, %lo(D_803B6F68) # addiu $a3, $a3, 0x6f68
-/* 0BB8B0 800BACB0 014B2021 */ addu $a0, $t2, $t3
-/* 0BB8B4 800BACB4 9083000E */ lbu $v1, 0xe($a0)
-.L800BACB8:
-/* 0BB8B8 800BACB8 1060000B */ beqz $v1, .L800BACE8
-/* 0BB8BC 800BACBC 246CFFFF */ addiu $t4, $v1, -1
-/* 0BB8C0 800BACC0 318D00FF */ andi $t5, $t4, 0xff
-/* 0BB8C4 800BACC4 15A00008 */ bnez $t5, .L800BACE8
-/* 0BB8C8 800BACC8 A08C000E */ sb $t4, 0xe($a0)
-/* 0BB8CC 800BACCC 90C30000 */ lbu $v1, ($a2)
-/* 0BB8D0 800BACD0 90CE0000 */ lbu $t6, ($a2)
-/* 0BB8D4 800BACD4 00E37821 */ addu $t7, $a3, $v1
-/* 0BB8D8 800BACD8 A1E20000 */ sb $v0, ($t7)
-/* 0BB8DC 800BACDC 24780001 */ addiu $t8, $v1, 1
-/* 0BB8E0 800BACE0 A0D80000 */ sb $t8, ($a2)
-/* 0BB8E4 800BACE4 A08E000D */ sb $t6, 0xd($a0)
-.L800BACE8:
-/* 0BB8E8 800BACE8 8CB90000 */ lw $t9, ($a1)
-/* 0BB8EC 800BACEC 24420001 */ addiu $v0, $v0, 1
-/* 0BB8F0 800BACF0 24840010 */ addiu $a0, $a0, 0x10
-/* 0BB8F4 800BACF4 0059082B */ sltu $at, $v0, $t9
-/* 0BB8F8 800BACF8 5420FFEF */ bnel $at, $zero, .L800BACB8
-/* 0BB8FC 800BACFC 9083000E */ lbu $v1, 0xe($a0)
-.L800BAD00:
-/* 0BB900 800BAD00 3C01803B */ lui $at, %hi(D_803B6E60)
-/* 0BB904 800BAD04 03E00008 */ jr $ra
-/* 0BB908 800BAD08 AC206E60 */ sw $zero, %lo(D_803B6E60)($at)
diff --git a/asm/non_matchings/audio/load/func_800BAD0C.s b/asm/non_matchings/audio/load/func_800BAD0C.s
index b2c794cf4..64f9c3981 100644
--- a/asm/non_matchings/audio/load/func_800BAD0C.s
+++ b/asm/non_matchings/audio/load/func_800BAD0C.s
@@ -8,20 +8,20 @@ glabel func_800BAD0C
/* 0BB924 800BAD24 AFA70054 */ sw $a3, 0x54($sp)
/* 0BB928 800BAD28 14C00008 */ bnez $a2, .L800BAD4C
/* 0BB92C 800BAD2C 00005825 */ move $t3, $zero
-/* 0BB930 800BAD30 3C05803B */ lui $a1, %hi(D_803B6E5C) # $a1, 0x803b
-/* 0BB934 800BAD34 8CA56E5C */ lw $a1, %lo(D_803B6E5C)($a1)
+/* 0BB930 800BAD30 3C05803B */ lui $a1, %hi(sSampleDmaListSize1) # $a1, 0x803b
+/* 0BB934 800BAD34 8CA56E5C */ lw $a1, %lo(sSampleDmaListSize1)($a1)
/* 0BB938 800BAD38 90E20000 */ lbu $v0, ($a3)
/* 0BB93C 800BAD3C 00001825 */ move $v1, $zero
/* 0BB940 800BAD40 0045082B */ sltu $at, $v0, $a1
/* 0BB944 800BAD44 14200055 */ bnez $at, .L800BAE9C
/* 0BB948 800BAD48 00026900 */ sll $t5, $v0, 4
.L800BAD4C:
-/* 0BB94C 800BAD4C 3C03803B */ lui $v1, %hi(D_803B6E5C) # $v1, 0x803b
-/* 0BB950 800BAD50 3C05803B */ lui $a1, %hi(D_803B6E58) # $a1, 0x803b
-/* 0BB954 800BAD54 8CA56E58 */ lw $a1, %lo(D_803B6E58)($a1)
-/* 0BB958 800BAD58 8C636E5C */ lw $v1, %lo(D_803B6E5C)($v1)
-/* 0BB95C 800BAD5C 3C18803B */ lui $t8, %hi(D_803B6758) # $t8, 0x803b
-/* 0BB960 800BAD60 27186758 */ addiu $t8, %lo(D_803B6758) # addiu $t8, $t8, 0x6758
+/* 0BB94C 800BAD4C 3C03803B */ lui $v1, %hi(sSampleDmaListSize1) # $v1, 0x803b
+/* 0BB950 800BAD50 3C05803B */ lui $a1, %hi(gSampleDmaNumListItems) # $a1, 0x803b
+/* 0BB954 800BAD54 8CA56E58 */ lw $a1, %lo(gSampleDmaNumListItems)($a1)
+/* 0BB958 800BAD58 8C636E5C */ lw $v1, %lo(sSampleDmaListSize1)($v1)
+/* 0BB95C 800BAD5C 3C18803B */ lui $t8, %hi(sSampleDmas) # $t8, 0x803b
+/* 0BB960 800BAD60 27186758 */ addiu $t8, %lo(sSampleDmas) # addiu $t8, $t8, 0x6758
/* 0BB964 800BAD64 0065082B */ sltu $at, $v1, $a1
/* 0BB968 800BAD68 10200034 */ beqz $at, .L800BAE3C
/* 0BB96C 800BAD6C 00037900 */ sll $t7, $v1, 4
@@ -38,26 +38,26 @@ glabel func_800BAD0C
/* 0BB994 800BAD94 54200025 */ bnel $at, $zero, .L800BAE2C
/* 0BB998 800BAD98 24630001 */ addiu $v1, $v1, 1
/* 0BB99C 800BAD9C 908F000E */ lbu $t7, 0xe($a0)
-/* 0BB9A0 800BADA0 3C09803B */ lui $t1, %hi(D_803B7069) # $t1, 0x803b
-/* 0BB9A4 800BADA4 25297069 */ addiu $t1, %lo(D_803B7069) # addiu $t1, $t1, 0x7069
+/* 0BB9A0 800BADA0 3C09803B */ lui $t1, %hi(sSampleDmaReuseQueueTail2) # $t1, 0x803b
+/* 0BB9A4 800BADA4 25297069 */ addiu $t1, %lo(sSampleDmaReuseQueueTail2) # addiu $t1, $t1, 0x7069
/* 0BB9A8 800BADA8 15E00016 */ bnez $t7, .L800BAE04
-/* 0BB9AC 800BADAC 3C18803B */ lui $t8, %hi(D_803B706B) # $t8, 0x803b
+/* 0BB9AC 800BADAC 3C18803B */ lui $t8, %hi(sSampleDmaReuseQueueHead2) # $t8, 0x803b
/* 0BB9B0 800BADB0 91250000 */ lbu $a1, ($t1)
-/* 0BB9B4 800BADB4 9318706B */ lbu $t8, %lo(D_803B706B)($t8)
+/* 0BB9B4 800BADB4 9318706B */ lbu $t8, %lo(sSampleDmaReuseQueueHead2)($t8)
/* 0BB9B8 800BADB8 53050013 */ beql $t8, $a1, .L800BAE08
/* 0BB9BC 800BADBC 8FB80054 */ lw $t8, 0x54($sp)
/* 0BB9C0 800BADC0 9087000D */ lbu $a3, 0xd($a0)
-/* 0BB9C4 800BADC4 3C0C803B */ lui $t4, %hi(D_803B6F68) # $t4, 0x803b
-/* 0BB9C8 800BADC8 258C6F68 */ addiu $t4, %lo(D_803B6F68) # addiu $t4, $t4, 0x6f68
+/* 0BB9C4 800BADC4 3C0C803B */ lui $t4, %hi(sSampleDmaReuseQueue2) # $t4, 0x803b
+/* 0BB9C8 800BADC8 258C6F68 */ addiu $t4, %lo(sSampleDmaReuseQueue2) # addiu $t4, $t4, 0x6f68
/* 0BB9CC 800BADCC 10A7000B */ beq $a1, $a3, .L800BADFC
/* 0BB9D0 800BADD0 01851021 */ addu $v0, $t4, $a1
/* 0BB9D4 800BADD4 90590000 */ lbu $t9, ($v0)
/* 0BB9D8 800BADD8 01876821 */ addu $t5, $t4, $a3
-/* 0BB9DC 800BADDC 3C06803B */ lui $a2, %hi(D_803B6758) # $a2, 0x803b
+/* 0BB9DC 800BADDC 3C06803B */ lui $a2, %hi(sSampleDmas) # $a2, 0x803b
/* 0BB9E0 800BADE0 A1B90000 */ sb $t9, ($t5)
/* 0BB9E4 800BADE4 904F0000 */ lbu $t7, ($v0)
/* 0BB9E8 800BADE8 908E000D */ lbu $t6, 0xd($a0)
-/* 0BB9EC 800BADEC 24C66758 */ addiu $a2, %lo(D_803B6758) # addiu $a2, $a2, 0x6758
+/* 0BB9EC 800BADEC 24C66758 */ addiu $a2, %lo(sSampleDmas) # addiu $a2, $a2, 0x6758
/* 0BB9F0 800BADF0 000FC100 */ sll $t8, $t7, 4
/* 0BB9F4 800BADF4 00D8C821 */ addu $t9, $a2, $t8
/* 0BB9F8 800BADF8 A32E000D */ sb $t6, 0xd($t9)
@@ -82,21 +82,21 @@ glabel func_800BAD0C
/* 0BBA34 800BAE34 24840010 */ addiu $a0, $a0, 0x10
/* 0BBA38 800BAE38 AFA80040 */ sw $t0, 0x40($sp)
.L800BAE3C:
-/* 0BBA3C 800BAE3C 3C09803B */ lui $t1, %hi(D_803B7069) # $t1, 0x803b
-/* 0BBA40 800BAE40 25297069 */ addiu $t1, %lo(D_803B7069) # addiu $t1, $t1, 0x7069
-/* 0BBA44 800BAE44 3C0F803B */ lui $t7, %hi(D_803B706B) # $t7, 0x803b
-/* 0BBA48 800BAE48 91EF706B */ lbu $t7, %lo(D_803B706B)($t7)
+/* 0BBA3C 800BAE3C 3C09803B */ lui $t1, %hi(sSampleDmaReuseQueueTail2) # $t1, 0x803b
+/* 0BBA40 800BAE40 25297069 */ addiu $t1, %lo(sSampleDmaReuseQueueTail2) # addiu $t1, $t1, 0x7069
+/* 0BBA44 800BAE44 3C0F803B */ lui $t7, %hi(sSampleDmaReuseQueueHead2) # $t7, 0x803b
+/* 0BBA48 800BAE48 91EF706B */ lbu $t7, %lo(sSampleDmaReuseQueueHead2)($t7)
/* 0BBA4C 800BAE4C 91250000 */ lbu $a1, ($t1)
/* 0BBA50 800BAE50 8FA80040 */ lw $t0, 0x40($sp)
/* 0BBA54 800BAE54 11E5000E */ beq $t7, $a1, .L800BAE90
/* 0BBA58 800BAE58 00000000 */ nop
/* 0BBA5C 800BAE5C 10C0000C */ beqz $a2, .L800BAE90
-/* 0BBA60 800BAE60 3C0C803B */ lui $t4, %hi(D_803B6F68) # $t4, 0x803b
-/* 0BBA64 800BAE64 258C6F68 */ addiu $t4, %lo(D_803B6F68) # addiu $t4, $t4, 0x6f68
+/* 0BBA60 800BAE60 3C0C803B */ lui $t4, %hi(sSampleDmaReuseQueue2) # $t4, 0x803b
+/* 0BBA64 800BAE64 258C6F68 */ addiu $t4, %lo(sSampleDmaReuseQueue2) # addiu $t4, $t4, 0x6f68
/* 0BBA68 800BAE68 0185C021 */ addu $t8, $t4, $a1
/* 0BBA6C 800BAE6C 930A0000 */ lbu $t2, ($t8)
-/* 0BBA70 800BAE70 3C06803B */ lui $a2, %hi(D_803B6758) # $a2, 0x803b
-/* 0BBA74 800BAE74 24C66758 */ addiu $a2, %lo(D_803B6758) # addiu $a2, $a2, 0x6758
+/* 0BBA70 800BAE70 3C06803B */ lui $a2, %hi(sSampleDmas) # $a2, 0x803b
+/* 0BBA74 800BAE74 24C66758 */ addiu $a2, %lo(sSampleDmas) # addiu $a2, $a2, 0x6758
/* 0BBA78 800BAE78 24AE0001 */ addiu $t6, $a1, 1
/* 0BBA7C 800BAE7C 000AC900 */ sll $t9, $t2, 4
/* 0BBA80 800BAE80 A12E0000 */ sb $t6, ($t1)
@@ -104,12 +104,12 @@ glabel func_800BAD0C
/* 0BBA88 800BAE88 240B0001 */ li $t3, 1
/* 0BBA8C 800BAE8C AFAA0030 */ sw $t2, 0x30($sp)
.L800BAE90:
-/* 0BBA90 800BAE90 3C06803B */ lui $a2, %hi(D_803B6758) # $a2, 0x803b
+/* 0BBA90 800BAE90 3C06803B */ lui $a2, %hi(sSampleDmas) # $a2, 0x803b
/* 0BBA94 800BAE94 1000002F */ b .L800BAF54
-/* 0BBA98 800BAE98 24C66758 */ addiu $a2, %lo(D_803B6758) # addiu $a2, $a2, 0x6758
+/* 0BBA98 800BAE98 24C66758 */ addiu $a2, %lo(sSampleDmas) # addiu $a2, $a2, 0x6758
.L800BAE9C:
-/* 0BBA9C 800BAE9C 3C06803B */ lui $a2, %hi(D_803B6758) # $a2, 0x803b
-/* 0BBAA0 800BAEA0 24C66758 */ addiu $a2, %lo(D_803B6758) # addiu $a2, $a2, 0x6758
+/* 0BBA9C 800BAE9C 3C06803B */ lui $a2, %hi(sSampleDmas) # $a2, 0x803b
+/* 0BBAA0 800BAEA0 24C66758 */ addiu $a2, %lo(sSampleDmas) # addiu $a2, $a2, 0x6758
/* 0BBAA4 800BAEA4 10A0002B */ beqz $a1, .L800BAF54
/* 0BBAA8 800BAEA8 00CD4021 */ addu $t0, $a2, $t5
.L800BAEAC:
@@ -125,14 +125,14 @@ glabel func_800BAD0C
/* 0BBAD0 800BAED0 5420001E */ bnel $at, $zero, .L800BAF4C
/* 0BBAD4 800BAED4 0065082B */ sltu $at, $v1, $a1
/* 0BBAD8 800BAED8 910E000E */ lbu $t6, 0xe($t0)
-/* 0BBADC 800BAEDC 3C05803B */ lui $a1, %hi(D_803B7068) # $a1, 0x803b
-/* 0BBAE0 800BAEE0 24A57068 */ addiu $a1, %lo(D_803B7068) # addiu $a1, $a1, 0x7068
+/* 0BBADC 800BAEDC 3C05803B */ lui $a1, %hi(sSampleDmaReuseQueueTail1) # $a1, 0x803b
+/* 0BBAE0 800BAEE0 24A57068 */ addiu $a1, %lo(sSampleDmaReuseQueueTail1) # addiu $a1, $a1, 0x7068
/* 0BBAE4 800BAEE4 55C00013 */ bnel $t6, $zero, .L800BAF34
/* 0BBAE8 800BAEE8 8D0E0000 */ lw $t6, ($t0)
/* 0BBAEC 800BAEEC 90A30000 */ lbu $v1, ($a1)
/* 0BBAF0 800BAEF0 9104000D */ lbu $a0, 0xd($t0)
-/* 0BBAF4 800BAEF4 3C07803B */ lui $a3, %hi(D_803B6E68) # $a3, 0x803b
-/* 0BBAF8 800BAEF8 24E76E68 */ addiu $a3, %lo(D_803B6E68) # addiu $a3, $a3, 0x6e68
+/* 0BBAF4 800BAEF4 3C07803B */ lui $a3, %hi(sSampleDmaReuseQueue1) # $a3, 0x803b
+/* 0BBAF8 800BAEF8 24E76E68 */ addiu $a3, %lo(sSampleDmaReuseQueue1) # addiu $a3, $a3, 0x6e68
/* 0BBAFC 800BAEFC 10640009 */ beq $v1, $a0, .L800BAF24
/* 0BBB00 800BAF00 00E31021 */ addu $v0, $a3, $v1
/* 0BBB04 800BAF04 90590000 */ lbu $t9, ($v0)
@@ -161,11 +161,11 @@ glabel func_800BAD0C
.L800BAF54:
/* 0BBB54 800BAF54 1560000C */ bnez $t3, .L800BAF88
/* 0BBB58 800BAF58 8FAA0030 */ lw $t2, 0x30($sp)
-/* 0BBB5C 800BAF5C 3C05803B */ lui $a1, %hi(D_803B7068) # $a1, 0x803b
-/* 0BBB60 800BAF60 24A57068 */ addiu $a1, %lo(D_803B7068) # addiu $a1, $a1, 0x7068
+/* 0BBB5C 800BAF5C 3C05803B */ lui $a1, %hi(sSampleDmaReuseQueueTail1) # $a1, 0x803b
+/* 0BBB60 800BAF60 24A57068 */ addiu $a1, %lo(sSampleDmaReuseQueueTail1) # addiu $a1, $a1, 0x7068
/* 0BBB64 800BAF64 90A30000 */ lbu $v1, ($a1)
-/* 0BBB68 800BAF68 3C07803B */ lui $a3, %hi(D_803B6E68) # $a3, 0x803b
-/* 0BBB6C 800BAF6C 24E76E68 */ addiu $a3, %lo(D_803B6E68) # addiu $a3, $a3, 0x6e68
+/* 0BBB68 800BAF68 3C07803B */ lui $a3, %hi(sSampleDmaReuseQueue1) # $a3, 0x803b
+/* 0BBB6C 800BAF6C 24E76E68 */ addiu $a3, %lo(sSampleDmaReuseQueue1) # addiu $a3, $a3, 0x6e68
/* 0BBB70 800BAF70 00E36821 */ addu $t5, $a3, $v1
/* 0BBB74 800BAF74 91AA0000 */ lbu $t2, ($t5)
/* 0BBB78 800BAF78 24780001 */ addiu $t8, $v1, 1
@@ -175,22 +175,22 @@ glabel func_800BAD0C
.L800BAF88:
/* 0BBB88 800BAF88 9502000A */ lhu $v0, 0xa($t0)
/* 0BBB8C 800BAF8C 2401FFF0 */ li $at, -16
-/* 0BBB90 800BAF90 3C09803B */ lui $t1, %hi(D_803B70BC) # $t1, 0x803b
+/* 0BBB90 800BAF90 3C09803B */ lui $t1, %hi(gCurrAudioFrameDmaCount) # $t1, 0x803b
/* 0BBB94 800BAF94 240F0002 */ li $t7, 2
/* 0BBB98 800BAF98 02218024 */ and $s0, $s1, $at
-/* 0BBB9C 800BAF9C 252970BC */ addiu $t1, %lo(D_803B70BC) # addiu $t1, $t1, 0x70bc
+/* 0BBB9C 800BAF9C 252970BC */ addiu $t1, %lo(gCurrAudioFrameDmaCount) # addiu $t1, $t1, 0x70bc
/* 0BBBA0 800BAFA0 A10F000E */ sb $t7, 0xe($t0)
/* 0BBBA4 800BAFA4 AD100004 */ sw $s0, 4($t0)
/* 0BBBA8 800BAFA8 A5020008 */ sh $v0, 8($t0)
/* 0BBBAC 800BAFAC 8D230000 */ lw $v1, ($t1)
/* 0BBBB0 800BAFB0 8D180000 */ lw $t8, ($t0)
-/* 0BBBB4 800BAFB4 3C0D803B */ lui $t5, %hi(D_803B6120) # $t5, 0x803b
+/* 0BBBB4 800BAFB4 3C0D803B */ lui $t5, %hi(gCurrAudioFrameDmaIoMesgBufs) # $t5, 0x803b
/* 0BBBB8 800BAFB8 0003C880 */ sll $t9, $v1, 2
-/* 0BBBBC 800BAFBC 3C0E803B */ lui $t6, %hi(D_803B6008) # $t6, 0x803b
+/* 0BBBBC 800BAFBC 3C0E803B */ lui $t6, %hi(gCurrAudioFrameDmaQueue) # $t6, 0x803b
/* 0BBBC0 800BAFC0 0323C823 */ subu $t9, $t9, $v1
/* 0BBBC4 800BAFC4 0019C8C0 */ sll $t9, $t9, 3
-/* 0BBBC8 800BAFC8 25CE6008 */ addiu $t6, %lo(D_803B6008) # addiu $t6, $t6, 0x6008
-/* 0BBBCC 800BAFCC 25AD6120 */ addiu $t5, %lo(D_803B6120) # addiu $t5, $t5, 0x6120
+/* 0BBBC8 800BAFC8 25CE6008 */ addiu $t6, %lo(gCurrAudioFrameDmaQueue) # addiu $t6, $t6, 0x6008
+/* 0BBBCC 800BAFCC 25AD6120 */ addiu $t5, %lo(gCurrAudioFrameDmaIoMesgBufs) # addiu $t5, $t5, 0x6120
/* 0BBBD0 800BAFD0 246F0001 */ addiu $t7, $v1, 1
/* 0BBBD4 800BAFD4 AD2F0000 */ sw $t7, ($t1)
/* 0BBBD8 800BAFD8 032D2021 */ addu $a0, $t9, $t5
diff --git a/asm/non_matchings/audio/load/func_800BB030.s b/asm/non_matchings/audio/load/func_800BB030.s
deleted file mode 100644
index 7f2b955a9..000000000
--- a/asm/non_matchings/audio/load/func_800BB030.s
+++ /dev/null
@@ -1,196 +0,0 @@
-glabel func_800BB030
-/* 0BBC30 800BB030 27BDFFC8 */ addiu $sp, $sp, -0x38
-/* 0BBC34 800BB034 AFB50028 */ sw $s5, 0x28($sp)
-/* 0BBC38 800BB038 3C15803B */ lui $s5, %hi(D_803B70B0) # $s5, 0x803b
-/* 0BBC3C 800BB03C 26B570B0 */ addiu $s5, %lo(D_803B70B0) # addiu $s5, $s5, 0x70b0
-/* 0BBC40 800BB040 AFA40038 */ sw $a0, 0x38($sp)
-/* 0BBC44 800BB044 8EA40000 */ lw $a0, ($s5)
-/* 0BBC48 800BB048 AFB2001C */ sw $s2, 0x1c($sp)
-/* 0BBC4C 800BB04C 24120003 */ li $s2, 3
-/* 0BBC50 800BB050 00920019 */ multu $a0, $s2
-/* 0BBC54 800BB054 AFB30020 */ sw $s3, 0x20($sp)
-/* 0BBC58 800BB058 3C13803B */ lui $s3, %hi(D_803B7088) # $s3, 0x803b
-/* 0BBC5C 800BB05C 26737088 */ addiu $s3, %lo(D_803B7088) # addiu $s3, $s3, 0x7088
-/* 0BBC60 800BB060 86780000 */ lh $t8, ($s3)
-/* 0BBC64 800BB064 AFB40024 */ sw $s4, 0x24($sp)
-/* 0BBC68 800BB068 3C14803B */ lui $s4, %hi(D_803B70A8) # $s4, 0x803b
-/* 0BBC6C 800BB06C AFB70030 */ sw $s7, 0x30($sp)
-/* 0BBC70 800BB070 AFB6002C */ sw $s6, 0x2c($sp)
-/* 0BBC74 800BB074 AFB10018 */ sw $s1, 0x18($sp)
-/* 0BBC78 800BB078 00007812 */ mflo $t7
-/* 0BBC7C 800BB07C 269470A8 */ addiu $s4, %lo(D_803B70A8) # addiu $s4, $s4, 0x70a8
-/* 0BBC80 800BB080 AFB00014 */ sw $s0, 0x14($sp)
-/* 0BBC84 800BB084 01F80019 */ multu $t7, $t8
-/* 0BBC88 800BB088 240E05A0 */ li $t6, 1440
-/* 0BBC8C 800BB08C 3C11803B */ lui $s1, %hi(D_803B6E58) # $s1, 0x803b
-/* 0BBC90 800BB090 3C16803B */ lui $s6, %hi(D_803AFBE8) # $s6, 0x803b
-/* 0BBC94 800BB094 3C17803B */ lui $s7, %hi(D_803B6758) # $s7, 0x803b
-/* 0BBC98 800BB098 AFBF0034 */ sw $ra, 0x34($sp)
-/* 0BBC9C 800BB09C AE8E0000 */ sw $t6, ($s4)
-/* 0BBCA0 800BB0A0 26F76758 */ addiu $s7, %lo(D_803B6758) # addiu $s7, $s7, 0x6758
-/* 0BBCA4 800BB0A4 26D6FBE8 */ addiu $s6, %lo(D_803AFBE8) # addiu $s6, $s6, -0x418
-/* 0BBCA8 800BB0A8 26316E58 */ addiu $s1, %lo(D_803B6E58) # addiu $s1, $s1, 0x6e58
-/* 0BBCAC 800BB0AC 0000C812 */ mflo $t9
-/* 0BBCB0 800BB0B0 01C02825 */ move $a1, $t6
-/* 0BBCB4 800BB0B4 1B200020 */ blez $t9, .L800BB138
-/* 0BBCB8 800BB0B8 00008025 */ move $s0, $zero
-.L800BB0BC:
-/* 0BBCBC 800BB0BC 0C02E3FF */ jal func_800B8FFC
-/* 0BBCC0 800BB0C0 02C02025 */ move $a0, $s6
-/* 0BBCC4 800BB0C4 8E260000 */ lw $a2, ($s1)
-/* 0BBCC8 800BB0C8 00064100 */ sll $t0, $a2, 4
-/* 0BBCCC 800BB0CC 02E81821 */ addu $v1, $s7, $t0
-/* 0BBCD0 800BB0D0 14400004 */ bnez $v0, .L800BB0E4
-/* 0BBCD4 800BB0D4 AC620000 */ sw $v0, ($v1)
-/* 0BBCD8 800BB0D8 00008025 */ move $s0, $zero
-/* 0BBCDC 800BB0DC 10000016 */ b .L800BB138
-/* 0BBCE0 800BB0E0 8EA40000 */ lw $a0, ($s5)
-.L800BB0E4:
-/* 0BBCE4 800BB0E4 8EA40000 */ lw $a0, ($s5)
-/* 0BBCE8 800BB0E8 866B0000 */ lh $t3, ($s3)
-/* 0BBCEC 800BB0EC 8E850000 */ lw $a1, ($s4)
-/* 0BBCF0 800BB0F0 00920019 */ multu $a0, $s2
-/* 0BBCF4 800BB0F4 26100001 */ addiu $s0, $s0, 1
-/* 0BBCF8 800BB0F8 24C90001 */ addiu $t1, $a2, 1
-/* 0BBCFC 800BB0FC AC600004 */ sw $zero, 4($v1)
-/* 0BBD00 800BB100 A4600008 */ sh $zero, 8($v1)
-/* 0BBD04 800BB104 A060000C */ sb $zero, 0xc($v1)
-/* 0BBD08 800BB108 A060000E */ sb $zero, 0xe($v1)
-/* 0BBD0C 800BB10C AE290000 */ sw $t1, ($s1)
-/* 0BBD10 800BB110 A465000A */ sh $a1, 0xa($v1)
-/* 0BBD14 800BB114 00005012 */ mflo $t2
-/* 0BBD18 800BB118 00000000 */ nop
-/* 0BBD1C 800BB11C 00000000 */ nop
-/* 0BBD20 800BB120 014B0019 */ multu $t2, $t3
-/* 0BBD24 800BB124 00006012 */ mflo $t4
-/* 0BBD28 800BB128 020C082A */ slt $at, $s0, $t4
-/* 0BBD2C 800BB12C 1420FFE3 */ bnez $at, .L800BB0BC
-/* 0BBD30 800BB130 00000000 */ nop
-/* 0BBD34 800BB134 00008025 */ move $s0, $zero
-.L800BB138:
-/* 0BBD38 800BB138 3C11803B */ lui $s1, %hi(D_803B6E58) # $s1, 0x803b
-/* 0BBD3C 800BB13C 26316E58 */ addiu $s1, %lo(D_803B6E58) # addiu $s1, $s1, 0x6e58
-/* 0BBD40 800BB140 8E260000 */ lw $a2, ($s1)
-/* 0BBD44 800BB144 3C16803B */ lui $s6, %hi(D_803AFBE8) # $s6, 0x803b
-/* 0BBD48 800BB148 3C17803B */ lui $s7, %hi(D_803B6758) # $s7, 0x803b
-/* 0BBD4C 800BB14C 26F76758 */ addiu $s7, %lo(D_803B6758) # addiu $s7, $s7, 0x6758
-/* 0BBD50 800BB150 10C0000C */ beqz $a2, .L800BB184
-/* 0BBD54 800BB154 26D6FBE8 */ addiu $s6, %lo(D_803AFBE8) # addiu $s6, $s6, -0x418
-/* 0BBD58 800BB158 3C02803B */ lui $v0, %hi(D_803B6E68) # $v0, 0x803b
-/* 0BBD5C 800BB15C 3C03803B */ lui $v1, %hi(D_803B6758) # $v1, 0x803b
-/* 0BBD60 800BB160 24636758 */ addiu $v1, %lo(D_803B6758) # addiu $v1, $v1, 0x6758
-/* 0BBD64 800BB164 24426E68 */ addiu $v0, %lo(D_803B6E68) # addiu $v0, $v0, 0x6e68
-.L800BB168:
-/* 0BBD68 800BB168 A0500000 */ sb $s0, ($v0)
-/* 0BBD6C 800BB16C A070000D */ sb $s0, 0xd($v1)
-/* 0BBD70 800BB170 26100001 */ addiu $s0, $s0, 1
-/* 0BBD74 800BB174 0206082B */ sltu $at, $s0, $a2
-/* 0BBD78 800BB178 24420001 */ addiu $v0, $v0, 1
-/* 0BBD7C 800BB17C 1420FFFA */ bnez $at, .L800BB168
-/* 0BBD80 800BB180 24630010 */ addiu $v1, $v1, 0x10
-.L800BB184:
-/* 0BBD84 800BB184 28C10100 */ slti $at, $a2, 0x100
-/* 0BBD88 800BB188 00C03825 */ move $a3, $a2
-/* 0BBD8C 800BB18C 1020000A */ beqz $at, .L800BB1B8
-/* 0BBD90 800BB190 00C08025 */ move $s0, $a2
-/* 0BBD94 800BB194 3C0D803B */ lui $t5, %hi(D_803B6E68) # $t5, 0x803b
-/* 0BBD98 800BB198 25AD6E68 */ addiu $t5, %lo(D_803B6E68) # addiu $t5, $t5, 0x6e68
-/* 0BBD9C 800BB19C 3C03803B */ lui $v1, %hi(D_803B6F68) # $v1, 0x803b
-/* 0BBDA0 800BB1A0 24636F68 */ addiu $v1, %lo(D_803B6F68) # addiu $v1, $v1, 0x6f68
-/* 0BBDA4 800BB1A4 020D1021 */ addu $v0, $s0, $t5
-.L800BB1A8:
-/* 0BBDA8 800BB1A8 24420001 */ addiu $v0, $v0, 1
-/* 0BBDAC 800BB1AC 0043082B */ sltu $at, $v0, $v1
-/* 0BBDB0 800BB1B0 1420FFFD */ bnez $at, .L800BB1A8
-/* 0BBDB4 800BB1B4 A040FFFF */ sb $zero, -1($v0)
-.L800BB1B8:
-/* 0BBDB8 800BB1B8 3C01803B */ lui $at, %hi(D_803B7068) # $at, 0x803b
-/* 0BBDBC 800BB1BC A0207068 */ sb $zero, %lo(D_803B7068)($at)
-/* 0BBDC0 800BB1C0 3C12803B */ lui $s2, %hi(D_803B6E5C) # $s2, 0x803b
-/* 0BBDC4 800BB1C4 3C01803B */ lui $at, %hi(D_803B706A) # $at, 0x803b
-/* 0BBDC8 800BB1C8 26526E5C */ addiu $s2, %lo(D_803B6E5C) # addiu $s2, $s2, 0x6e5c
-/* 0BBDCC 800BB1CC A026706A */ sb $a2, %lo(D_803B706A)($at)
-/* 0BBDD0 800BB1D0 240E0180 */ li $t6, 384
-/* 0BBDD4 800BB1D4 AE460000 */ sw $a2, ($s2)
-/* 0BBDD8 800BB1D8 AE8E0000 */ sw $t6, ($s4)
-/* 0BBDDC 800BB1DC 1880001A */ blez $a0, .L800BB248
-/* 0BBDE0 800BB1E0 00008025 */ move $s0, $zero
-/* 0BBDE4 800BB1E4 01C02825 */ move $a1, $t6
-.L800BB1E8:
-/* 0BBDE8 800BB1E8 0C02E3FF */ jal func_800B8FFC
-/* 0BBDEC 800BB1EC 02C02025 */ move $a0, $s6
-/* 0BBDF0 800BB1F0 8E260000 */ lw $a2, ($s1)
-/* 0BBDF4 800BB1F4 26100001 */ addiu $s0, $s0, 1
-/* 0BBDF8 800BB1F8 00067900 */ sll $t7, $a2, 4
-/* 0BBDFC 800BB1FC 02EF1821 */ addu $v1, $s7, $t7
-/* 0BBE00 800BB200 14400003 */ bnez $v0, .L800BB210
-/* 0BBE04 800BB204 AC620000 */ sw $v0, ($v1)
-/* 0BBE08 800BB208 1000000F */ b .L800BB248
-/* 0BBE0C 800BB20C 00C03825 */ move $a3, $a2
-.L800BB210:
-/* 0BBE10 800BB210 8EB90000 */ lw $t9, ($s5)
-/* 0BBE14 800BB214 8E850000 */ lw $a1, ($s4)
-/* 0BBE18 800BB218 24D80001 */ addiu $t8, $a2, 1
-/* 0BBE1C 800BB21C 0219082A */ slt $at, $s0, $t9
-/* 0BBE20 800BB220 AC600004 */ sw $zero, 4($v1)
-/* 0BBE24 800BB224 A4600008 */ sh $zero, 8($v1)
-/* 0BBE28 800BB228 A060000C */ sb $zero, 0xc($v1)
-/* 0BBE2C 800BB22C A060000E */ sb $zero, 0xe($v1)
-/* 0BBE30 800BB230 AE380000 */ sw $t8, ($s1)
-/* 0BBE34 800BB234 1420FFEC */ bnez $at, .L800BB1E8
-/* 0BBE38 800BB238 A465000A */ sh $a1, 0xa($v1)
-/* 0BBE3C 800BB23C 3C06803B */ lui $a2, %hi(D_803B6E58) # $a2, 0x803b
-/* 0BBE40 800BB240 8CC66E58 */ lw $a2, %lo(D_803B6E58)($a2)
-/* 0BBE44 800BB244 00C03825 */ move $a3, $a2
-.L800BB248:
-/* 0BBE48 800BB248 8E450000 */ lw $a1, ($s2)
-/* 0BBE4C 800BB24C 3C09803B */ lui $t1, %hi(D_803B6758) # $t1, 0x803b
-/* 0BBE50 800BB250 25296758 */ addiu $t1, %lo(D_803B6758) # addiu $t1, $t1, 0x6758
-/* 0BBE54 800BB254 00A6082B */ sltu $at, $a1, $a2
-/* 0BBE58 800BB258 1020000F */ beqz $at, .L800BB298
-/* 0BBE5C 800BB25C 00A08025 */ move $s0, $a1
-/* 0BBE60 800BB260 3C0A803B */ lui $t2, %hi(D_803B6F68) # $t2, 0x803b
-/* 0BBE64 800BB264 254A6F68 */ addiu $t2, %lo(D_803B6F68) # addiu $t2, $t2, 0x6f68
-/* 0BBE68 800BB268 00104100 */ sll $t0, $s0, 4
-/* 0BBE6C 800BB26C 02051023 */ subu $v0, $s0, $a1
-/* 0BBE70 800BB270 004A2021 */ addu $a0, $v0, $t2
-/* 0BBE74 800BB274 01091821 */ addu $v1, $t0, $t1
-.L800BB278:
-/* 0BBE78 800BB278 A0900000 */ sb $s0, ($a0)
-/* 0BBE7C 800BB27C 26100001 */ addiu $s0, $s0, 1
-/* 0BBE80 800BB280 0206082B */ sltu $at, $s0, $a2
-/* 0BBE84 800BB284 A062000D */ sb $v0, 0xd($v1)
-/* 0BBE88 800BB288 24420001 */ addiu $v0, $v0, 1
-/* 0BBE8C 800BB28C 24630010 */ addiu $v1, $v1, 0x10
-/* 0BBE90 800BB290 1420FFF9 */ bnez $at, .L800BB278
-/* 0BBE94 800BB294 24840001 */ addiu $a0, $a0, 1
-.L800BB298:
-/* 0BBE98 800BB298 28E10100 */ slti $at, $a3, 0x100
-/* 0BBE9C 800BB29C 1020000A */ beqz $at, .L800BB2C8
-/* 0BBEA0 800BB2A0 00C56023 */ subu $t4, $a2, $a1
-/* 0BBEA4 800BB2A4 3C0B803B */ lui $t3, %hi(D_803B6F68) # $t3, 0x803b
-/* 0BBEA8 800BB2A8 256B6F68 */ addiu $t3, %lo(D_803B6F68) # addiu $t3, $t3, 0x6f68
-/* 0BBEAC 800BB2AC 3C03803B */ lui $v1, %hi(D_803B7068) # $v1, 0x803b
-/* 0BBEB0 800BB2B0 24637068 */ addiu $v1, %lo(D_803B7068) # addiu $v1, $v1, 0x7068
-/* 0BBEB4 800BB2B4 00EB1021 */ addu $v0, $a3, $t3
-.L800BB2B8:
-/* 0BBEB8 800BB2B8 24420001 */ addiu $v0, $v0, 1
-/* 0BBEBC 800BB2BC 0043082B */ sltu $at, $v0, $v1
-/* 0BBEC0 800BB2C0 1420FFFD */ bnez $at, .L800BB2B8
-/* 0BBEC4 800BB2C4 A045FFFF */ sb $a1, -1($v0)
-.L800BB2C8:
-/* 0BBEC8 800BB2C8 8FBF0034 */ lw $ra, 0x34($sp)
-/* 0BBECC 800BB2CC 3C01803B */ lui $at, %hi(D_803B7069) # $at, 0x803b
-/* 0BBED0 800BB2D0 A0207069 */ sb $zero, %lo(D_803B7069)($at)
-/* 0BBED4 800BB2D4 3C01803B */ lui $at, %hi(D_803B706B) # $at, 0x803b
-/* 0BBED8 800BB2D8 8FB00014 */ lw $s0, 0x14($sp)
-/* 0BBEDC 800BB2DC 8FB10018 */ lw $s1, 0x18($sp)
-/* 0BBEE0 800BB2E0 8FB2001C */ lw $s2, 0x1c($sp)
-/* 0BBEE4 800BB2E4 8FB30020 */ lw $s3, 0x20($sp)
-/* 0BBEE8 800BB2E8 8FB40024 */ lw $s4, 0x24($sp)
-/* 0BBEEC 800BB2EC 8FB50028 */ lw $s5, 0x28($sp)
-/* 0BBEF0 800BB2F0 8FB6002C */ lw $s6, 0x2c($sp)
-/* 0BBEF4 800BB2F4 8FB70030 */ lw $s7, 0x30($sp)
-/* 0BBEF8 800BB2F8 A02C706B */ sb $t4, %lo(D_803B706B)($at)
-/* 0BBEFC 800BB2FC 03E00008 */ jr $ra
-/* 0BBF00 800BB300 27BD0038 */ addiu $sp, $sp, 0x38
diff --git a/asm/non_matchings/audio/load/func_800BB304.s b/asm/non_matchings/audio/load/func_800BB304.s
deleted file mode 100644
index cce32f9d7..000000000
--- a/asm/non_matchings/audio/load/func_800BB304.s
+++ /dev/null
@@ -1,37 +0,0 @@
-glabel func_800BB304
-/* 0BBF04 800BB304 27BDFFE0 */ addiu $sp, $sp, -0x20
-/* 0BBF08 800BB308 AFBF0014 */ sw $ra, 0x14($sp)
-/* 0BBF0C 800BB30C 14800003 */ bnez $a0, .L800BB31C
-/* 0BBF10 800BB310 00803825 */ move $a3, $a0
-/* 0BBF14 800BB314 10000018 */ b .L800BB378
-/* 0BBF18 800BB318 2402FFFF */ li $v0, -1
-.L800BB31C:
-/* 0BBF1C 800BB31C 90EE0001 */ lbu $t6, 1($a3)
-/* 0BBF20 800BB320 24010001 */ li $at, 1
-/* 0BBF24 800BB324 3C04803B */ lui $a0, %hi(D_803AFBE8) # $a0, 0x803b
-/* 0BBF28 800BB328 15C10013 */ bne $t6, $at, .L800BB378
-/* 0BBF2C 800BB32C 2484FBE8 */ addiu $a0, %lo(D_803AFBE8) # addiu $a0, $a0, -0x418
-/* 0BBF30 800BB330 8CE50010 */ lw $a1, 0x10($a3)
-/* 0BBF34 800BB334 0C02E3FF */ jal func_800B8FFC
-/* 0BBF38 800BB338 AFA70020 */ sw $a3, 0x20($sp)
-/* 0BBF3C 800BB33C 8FA70020 */ lw $a3, 0x20($sp)
-/* 0BBF40 800BB340 14400003 */ bnez $v0, .L800BB350
-/* 0BBF44 800BB344 00402825 */ move $a1, $v0
-/* 0BBF48 800BB348 1000000B */ b .L800BB378
-/* 0BBF4C 800BB34C 2402FFFF */ li $v0, -1
-.L800BB350:
-/* 0BBF50 800BB350 8CE40004 */ lw $a0, 4($a3)
-/* 0BBF54 800BB354 8CE60010 */ lw $a2, 0x10($a3)
-/* 0BBF58 800BB358 AFA70020 */ sw $a3, 0x20($sp)
-/* 0BBF5C 800BB35C 0C02EAA0 */ jal func_800BAA80
-/* 0BBF60 800BB360 AFA5001C */ sw $a1, 0x1c($sp)
-/* 0BBF64 800BB364 8FA70020 */ lw $a3, 0x20($sp)
-/* 0BBF68 800BB368 8FA5001C */ lw $a1, 0x1c($sp)
-/* 0BBF6C 800BB36C 240F0081 */ li $t7, 129
-/* 0BBF70 800BB370 A0EF0001 */ sb $t7, 1($a3)
-/* 0BBF74 800BB374 ACE50004 */ sw $a1, 4($a3)
-.L800BB378:
-/* 0BBF78 800BB378 8FBF0014 */ lw $ra, 0x14($sp)
-/* 0BBF7C 800BB37C 27BD0020 */ addiu $sp, $sp, 0x20
-/* 0BBF80 800BB380 03E00008 */ jr $ra
-/* 0BBF84 800BB384 00000000 */ nop
diff --git a/asm/non_matchings/audio/load/func_800BB484.s b/asm/non_matchings/audio/load/func_800BB484.s
index 6731dfa36..02aeed28c 100644
--- a/asm/non_matchings/audio/load/func_800BB484.s
+++ b/asm/non_matchings/audio/load/func_800BB484.s
@@ -28,13 +28,13 @@ glabel func_800BB484
/* 0BC0E8 800BB4E8 54810022 */ bnel $a0, $at, .L800BB574
/* 0BC0EC 800BB4EC 8FBF001C */ lw $ra, 0x1c($sp)
/* 0BC0F0 800BB4F0 8C690004 */ lw $t1, 4($v1)
-/* 0BC0F4 800BB4F4 3C04803B */ lui $a0, %hi(D_803AFBE8) # $a0, 0x803b
+/* 0BC0F4 800BB4F4 3C04803B */ lui $a0, %hi(gNotesAndBuffersPool) # $a0, 0x803b
/* 0BC0F8 800BB4F8 8C650010 */ lw $a1, 0x10($v1)
/* 0BC0FC 800BB4FC 01263821 */ addu $a3, $t1, $a2
/* 0BC100 800BB500 AFA70028 */ sw $a3, 0x28($sp)
/* 0BC104 800BB504 AFA3002C */ sw $v1, 0x2c($sp)
-/* 0BC108 800BB508 0C02E3FF */ jal func_800B8FFC
-/* 0BC10C 800BB50C 2484FBE8 */ addiu $a0, %lo(D_803AFBE8) # addiu $a0, $a0, -0x418
+/* 0BC108 800BB508 0C02E3FF */ jal soundAlloc
+/* 0BC10C 800BB50C 2484FBE8 */ addiu $a0, %lo(gNotesAndBuffersPool) # addiu $a0, $a0, -0x418
/* 0BC110 800BB510 8FA3002C */ lw $v1, 0x2c($sp)
/* 0BC114 800BB514 8FA70028 */ lw $a3, 0x28($sp)
/* 0BC118 800BB518 14400005 */ bnez $v0, .L800BB530
@@ -47,7 +47,7 @@ glabel func_800BB484
/* 0BC130 800BB530 8C660010 */ lw $a2, 0x10($v1)
/* 0BC134 800BB534 AFA50024 */ sw $a1, 0x24($sp)
/* 0BC138 800BB538 AFA3002C */ sw $v1, 0x2c($sp)
-/* 0BC13C 800BB53C 0C02EAA0 */ jal func_800BAA80
+/* 0BC13C 800BB53C 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BC140 800BB540 00E02025 */ move $a0, $a3
/* 0BC144 800BB544 8FA3002C */ lw $v1, 0x2c($sp)
/* 0BC148 800BB548 8FA50024 */ lw $a1, 0x24($sp)
diff --git a/asm/non_matchings/audio/load/func_800BB780.s b/asm/non_matchings/audio/load/func_800BB780.s
index 76c646e22..d69198b96 100644
--- a/asm/non_matchings/audio/load/func_800BB780.s
+++ b/asm/non_matchings/audio/load/func_800BB780.s
@@ -29,7 +29,7 @@ glabel func_800BB780
.L800BB7EC:
/* 0BC3EC 800BB7EC 8FA40028 */ lw $a0, 0x28($sp)
/* 0BC3F0 800BB7F0 AFA5002C */ sw $a1, 0x2c($sp)
-/* 0BC3F4 800BB7F4 0C02EAA0 */ jal func_800BAA80
+/* 0BC3F4 800BB7F4 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BC3F8 800BB7F8 24840010 */ addiu $a0, $a0, 0x10
/* 0BC3FC 800BB7FC 3C0A803B */ lui $t2, %hi(D_803B7080) # $t2, 0x803b
/* 0BC400 800BB800 8D4A7080 */ lw $t2, %lo(D_803B7080)($t2)
diff --git a/asm/non_matchings/audio/load/func_800BB99C.s b/asm/non_matchings/audio/load/func_800BB99C.s
index 10402f6fc..9a05a32d0 100644
--- a/asm/non_matchings/audio/load/func_800BB99C.s
+++ b/asm/non_matchings/audio/load/func_800BB99C.s
@@ -28,7 +28,7 @@ glabel func_800BB99C
/* 0BC604 800BBA04 00001025 */ move $v0, $zero
.L800BBA08:
/* 0BC608 800BBA08 8FA40024 */ lw $a0, 0x24($sp)
-/* 0BC60C 800BBA0C 0C02EAA0 */ jal func_800BAA80
+/* 0BC60C 800BBA0C 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BC610 800BBA10 AFA50028 */ sw $a1, 0x28($sp)
/* 0BC614 800BBA14 8FA90030 */ lw $t1, 0x30($sp)
/* 0BC618 800BBA18 3C0A803B */ lui $t2, %hi(D_803B0400) # $t2, 0x803b
diff --git a/asm/non_matchings/audio/load/func_800BBA50.s b/asm/non_matchings/audio/load/func_800BBA50.s
index 6fb89e365..7e2425f53 100644
--- a/asm/non_matchings/audio/load/func_800BBA50.s
+++ b/asm/non_matchings/audio/load/func_800BBA50.s
@@ -34,7 +34,7 @@ glabel func_800BBA50
/* 0BC6CC 800BBACC 8FA4003C */ lw $a0, 0x3c($sp)
/* 0BC6D0 800BBAD0 8FA4003C */ lw $a0, 0x3c($sp)
/* 0BC6D4 800BBAD4 02402825 */ move $a1, $s2
-/* 0BC6D8 800BBAD8 0C02EAA0 */ jal func_800BAA80
+/* 0BC6D8 800BBAD8 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BC6DC 800BBADC 02003025 */ move $a2, $s0
/* 0BC6E0 800BBAE0 8FA90048 */ lw $t1, 0x48($sp)
/* 0BC6E4 800BBAE4 3C0A803B */ lui $t2, %hi(D_803B0400) # $t2, 0x803b
@@ -49,7 +49,7 @@ glabel func_800BBA50
/* 0BC708 800BBB08 A04C0000 */ sb $t4, ($v0)
.L800BBB0C:
/* 0BC70C 800BBB0C 02402825 */ move $a1, $s2
-/* 0BC710 800BBB10 0C02EAA0 */ jal func_800BAA80
+/* 0BC710 800BBB10 0C02EAA0 */ jal audio_dma_copy_immediate
/* 0BC714 800BBB14 24060040 */ li $a2, 64
/* 0BC718 800BBB18 262700D4 */ addiu $a3, $s1, 0xd4
/* 0BC71C 800BBB1C 00E02025 */ move $a0, $a3
diff --git a/asm/non_matchings/audio/load/func_800BBEF0.s b/asm/non_matchings/audio/load/func_800BBEF0.s
deleted file mode 100644
index b0cc8c891..000000000
--- a/asm/non_matchings/audio/load/func_800BBEF0.s
+++ /dev/null
@@ -1,24 +0,0 @@
-glabel func_800BBEF0
-/* 0BCAF0 800BBEF0 27BDFFE8 */ addiu $sp, $sp, -0x18
-/* 0BCAF4 800BBEF4 14C00006 */ bnez $a2, .L800BBF10
-/* 0BCAF8 800BBEF8 AFBF0014 */ sw $ra, 0x14($sp)
-/* 0BCAFC 800BBEFC 3C0E1971 */ lui $t6, (0x19710515 >> 16) # lui $t6, 0x1971
-/* 0BCB00 800BBF00 3C0F800F */ lui $t7, %hi(D_800EA5DC) # $t7, 0x800f
-/* 0BCB04 800BBF04 25EFA5DC */ addiu $t7, %lo(D_800EA5DC) # addiu $t7, $t7, -0x5a24
-/* 0BCB08 800BBF08 35CE0515 */ ori $t6, (0x19710515 & 0xFFFF) # ori $t6, $t6, 0x515
-/* 0BCB0C 800BBF0C ADEE0000 */ sw $t6, ($t7)
-.L800BBF10:
-/* 0BCB10 800BBF10 0C02EFD1 */ jal func_800BBF44
-/* 0BCB14 800BBF14 AFA60020 */ sw $a2, 0x20($sp)
-/* 0BCB18 800BBF18 8FA60020 */ lw $a2, 0x20($sp)
-/* 0BCB1C 800BBF1C 3C187655 */ lui $t8, (0x76557364 >> 16) # lui $t8, 0x7655
-/* 0BCB20 800BBF20 37187364 */ ori $t8, (0x76557364 & 0xFFFF) # ori $t8, $t8, 0x7364
-/* 0BCB24 800BBF24 14C00003 */ bnez $a2, .L800BBF34
-/* 0BCB28 800BBF28 3C19800F */ lui $t9, %hi(D_800EA5DC) # $t9, 0x800f
-/* 0BCB2C 800BBF2C 2739A5DC */ addiu $t9, %lo(D_800EA5DC) # addiu $t9, $t9, -0x5a24
-/* 0BCB30 800BBF30 AF380000 */ sw $t8, ($t9)
-.L800BBF34:
-/* 0BCB34 800BBF34 8FBF0014 */ lw $ra, 0x14($sp)
-/* 0BCB38 800BBF38 27BD0018 */ addiu $sp, $sp, 0x18
-/* 0BCB3C 800BBF3C 03E00008 */ jr $ra
-/* 0BCB40 800BBF40 00000000 */ nop
diff --git a/asm/non_matchings/audio/playback/func_800BCBC4.s b/asm/non_matchings/audio/playback/func_800BCBC4.s
index 89e034f2c..9cf3fa31b 100644
--- a/asm/non_matchings/audio/playback/func_800BCBC4.s
+++ b/asm/non_matchings/audio/playback/func_800BCBC4.s
@@ -1,7 +1,7 @@
glabel func_800BCBC4
/* 0BD7C4 800BCBC4 27BDFF90 */ addiu $sp, $sp, -0x70
-/* 0BD7C8 800BCBC8 3C03803B */ lui $v1, %hi(D_803B70B0) # $v1, 0x803b
-/* 0BD7CC 800BCBCC 8C6370B0 */ lw $v1, %lo(D_803B70B0)($v1)
+/* 0BD7C8 800BCBC8 3C03803B */ lui $v1, %hi(gMaxSimultaneousNotes) # $v1, 0x803b
+/* 0BD7CC 800BCBCC 8C6370B0 */ lw $v1, %lo(gMaxSimultaneousNotes)($v1)
/* 0BD7D0 800BCBD0 AFBF0044 */ sw $ra, 0x44($sp)
/* 0BD7D4 800BCBD4 AFB70040 */ sw $s7, 0x40($sp)
/* 0BD7D8 800BCBD8 AFB6003C */ sw $s6, 0x3c($sp)
@@ -53,8 +53,8 @@ glabel func_800BCBC4
/* 0BD884 800BCC84 0C02FAE9 */ jal func_800BEBA4
/* 0BD888 800BCC88 00000000 */ nop
/* 0BD88C 800BCC8C A2360000 */ sb $s6, ($s1)
-/* 0BD890 800BCC90 3C03803B */ lui $v1, %hi(D_803B70B0) # $v1, 0x803b
-/* 0BD894 800BCC94 8C6370B0 */ lw $v1, %lo(D_803B70B0)($v1)
+/* 0BD890 800BCC90 3C03803B */ lui $v1, %hi(gMaxSimultaneousNotes) # $v1, 0x803b
+/* 0BD894 800BCC94 8C6370B0 */ lw $v1, %lo(gMaxSimultaneousNotes)($v1)
/* 0BD898 800BCC98 00031080 */ sll $v0, $v1, 2
/* 0BD89C 800BCC9C 00431023 */ subu $v0, $v0, $v1
/* 0BD8A0 800BCCA0 10000097 */ b .L800BCF00
@@ -218,8 +218,8 @@ glabel func_800BCBC4
/* 0BDAE4 800BCEE4 018E7825 */ or $t7, $t4, $t6
/* 0BDAE8 800BCEE8 A26F0001 */ sb $t7, 1($s3)
.L800BCEEC:
-/* 0BDAEC 800BCEEC 3C03803B */ lui $v1, %hi(D_803B70B0) # $v1, 0x803b
-/* 0BDAF0 800BCEF0 8C6370B0 */ lw $v1, %lo(D_803B70B0)($v1)
+/* 0BDAEC 800BCEEC 3C03803B */ lui $v1, %hi(gMaxSimultaneousNotes) # $v1, 0x803b
+/* 0BDAF0 800BCEF0 8C6370B0 */ lw $v1, %lo(gMaxSimultaneousNotes)($v1)
/* 0BDAF4 800BCEF4 00031080 */ sll $v0, $v1, 2
/* 0BDAF8 800BCEF8 00431023 */ subu $v0, $v0, $v1
/* 0BDAFC 800BCEFC 00021180 */ sll $v0, $v0, 6
diff --git a/asm/non_matchings/audio/playback/func_800BD368.s b/asm/non_matchings/audio/playback/func_800BD368.s
index 1b34eef97..26b4b0baf 100644
--- a/asm/non_matchings/audio/playback/func_800BD368.s
+++ b/asm/non_matchings/audio/playback/func_800BD368.s
@@ -10,8 +10,8 @@ glabel func_800BD368
/* 0BDF88 800BD388 AFB00018 */ sw $s0, 0x18($sp)
/* 0BDF8C 800BD38C 0C02F4C6 */ jal func_800BD318
/* 0BDF90 800BD390 02602025 */ move $a0, $s3
-/* 0BDF94 800BD394 3C14803B */ lui $s4, %hi(D_803B70B0) # $s4, 0x803b
-/* 0BDF98 800BD398 269470B0 */ addiu $s4, %lo(D_803B70B0) # addiu $s4, $s4, 0x70b0
+/* 0BDF94 800BD394 3C14803B */ lui $s4, %hi(gMaxSimultaneousNotes) # $s4, 0x803b
+/* 0BDF98 800BD398 269470B0 */ addiu $s4, %lo(gMaxSimultaneousNotes) # addiu $s4, $s4, 0x70b0
/* 0BDF9C 800BD39C 8E8E0000 */ lw $t6, ($s4)
/* 0BDFA0 800BD3A0 00008825 */ move $s1, $zero
/* 0BDFA4 800BD3A4 00008025 */ move $s0, $zero
diff --git a/asm/non_matchings/audio/playback/func_800BDD34.s b/asm/non_matchings/audio/playback/func_800BDD34.s
index 166be5387..0a8ddf1b6 100644
--- a/asm/non_matchings/audio/playback/func_800BDD34.s
+++ b/asm/non_matchings/audio/playback/func_800BDD34.s
@@ -1,8 +1,8 @@
glabel func_800BDD34
/* 0BE934 800BDD34 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 0BE938 800BDD38 AFB4002C */ sw $s4, 0x2c($sp)
-/* 0BE93C 800BDD3C 3C14803B */ lui $s4, %hi(D_803B70B0) # $s4, 0x803b
-/* 0BE940 800BDD40 269470B0 */ addiu $s4, %lo(D_803B70B0) # addiu $s4, $s4, 0x70b0
+/* 0BE93C 800BDD3C 3C14803B */ lui $s4, %hi(gMaxSimultaneousNotes) # $s4, 0x803b
+/* 0BE940 800BDD40 269470B0 */ addiu $s4, %lo(gMaxSimultaneousNotes) # addiu $s4, $s4, 0x70b0
/* 0BE944 800BDD44 8E8E0000 */ lw $t6, ($s4)
/* 0BE948 800BDD48 AFB10020 */ sw $s1, 0x20($sp)
/* 0BE94C 800BDD4C AFBF003C */ sw $ra, 0x3c($sp)
@@ -15,13 +15,13 @@ glabel func_800BDD34
/* 0BE968 800BDD68 F7B40010 */ sdc1 $f20, 0x10($sp)
/* 0BE96C 800BDD6C 19C0002A */ blez $t6, .L800BDE18
/* 0BE970 800BDD70 00008825 */ move $s1, $zero
-/* 0BE974 800BDD74 3C17803B */ lui $s7, %hi(D_803AFBE8) # $s7, 0x803b
+/* 0BE974 800BDD74 3C17803B */ lui $s7, %hi(gNotesAndBuffersPool) # $s7, 0x803b
/* 0BE978 800BDD78 3C16800F */ lui $s6, %hi(gZeroNoteSub) # $s6, 0x800f
/* 0BE97C 800BDD7C 3C15803B */ lui $s5, %hi(D_803B1508) # $s5, 0x803b
/* 0BE980 800BDD80 4480A000 */ mtc1 $zero, $f20
/* 0BE984 800BDD84 26B51508 */ addiu $s5, %lo(D_803B1508) # addiu $s5, $s5, 0x1508
/* 0BE988 800BDD88 26D66250 */ addiu $s6, %lo(gZeroNoteSub) # addiu $s6, $s6, 0x6250
-/* 0BE98C 800BDD8C 26F7FBE8 */ addiu $s7, %lo(D_803AFBE8) # addiu $s7, $s7, -0x418
+/* 0BE98C 800BDD8C 26F7FBE8 */ addiu $s7, %lo(gNotesAndBuffersPool) # addiu $s7, $s7, -0x418
/* 0BE990 800BDD90 00009025 */ move $s2, $zero
/* 0BE994 800BDD94 2413FFFF */ li $s3, -1
/* 0BE998 800BDD98 8EAF0000 */ lw $t7, ($s5)
@@ -48,7 +48,7 @@ glabel func_800BDD34
/* 0BE9E8 800BDDE8 A20000A0 */ sb $zero, 0xa0($s0)
/* 0BE9EC 800BDDEC E6140080 */ swc1 $f20, 0x80($s0)
/* 0BE9F0 800BDDF0 E6140084 */ swc1 $f20, 0x84($s0)
-/* 0BE9F4 800BDDF4 0C02E3FF */ jal func_800B8FFC
+/* 0BE9F4 800BDDF4 0C02E3FF */ jal soundAlloc
/* 0BE9F8 800BDDF8 AE1900BC */ sw $t9, 0xbc($s0)
/* 0BE9FC 800BDDFC AE02001C */ sw $v0, 0x1c($s0)
/* 0BEA00 800BDE00 8E880000 */ lw $t0, ($s4)
diff --git a/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s b/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s
index d088d3c36..dcbab6ba0 100644
--- a/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s
+++ b/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s
@@ -2,12 +2,12 @@ glabel create_next_audio_frame_task
/* 0CBF30 800CB330 3C03803B */ lui $v1, %hi(D_803B70B8) # $v1, 0x803b
/* 0CBF34 800CB334 246370B8 */ addiu $v1, %lo(D_803B70B8) # addiu $v1, $v1, 0x70b8
/* 0CBF38 800CB338 8C620000 */ lw $v0, ($v1)
-/* 0CBF3C 800CB33C 3C18803B */ lui $t8, %hi(D_803B7088) # $t8, 0x803b
+/* 0CBF3C 800CB33C 3C18803B */ lui $t8, %hi(gAudioBufferParameters) # $t8, 0x803b
/* 0CBF40 800CB340 27BDFF88 */ addiu $sp, $sp, -0x78
/* 0CBF44 800CB344 244E0001 */ addiu $t6, $v0, 1
/* 0CBF48 800CB348 AC6E0000 */ sw $t6, ($v1)
/* 0CBF4C 800CB34C 8C6F0000 */ lw $t7, ($v1)
-/* 0CBF50 800CB350 87187088 */ lh $t8, %lo(D_803B7088)($t8)
+/* 0CBF50 800CB350 87187088 */ lh $t8, %lo(gAudioBufferParameters)($t8)
/* 0CBF54 800CB354 AFBE0030 */ sw $fp, 0x30($sp)
/* 0CBF58 800CB358 03A0F025 */ move $fp, $sp
/* 0CBF5C 800CB35C 01F8001A */ div $zero, $t7, $t8
@@ -93,10 +93,10 @@ glabel create_next_audio_frame_task
/* 0CC080 800CB480 0C03443C */ jal osAiSetNextBuffer
/* 0CC084 800CB484 00032880 */ sll $a1, $v1, 2
.L800CB488:
-/* 0CC088 800CB488 3C02803B */ lui $v0, %hi(D_803B70BC) # $v0, 0x803b
-/* 0CC08C 800CB48C 8C5170BC */ lw $s1, %lo(D_803B70BC)($v0)
-/* 0CC090 800CB490 3C12803B */ lui $s2, %hi(D_803B6008) # $s2, 0x803b
-/* 0CC094 800CB494 26526008 */ addiu $s2, %lo(D_803B6008) # addiu $s2, $s2, 0x6008
+/* 0CC088 800CB488 3C02803B */ lui $v0, %hi(gCurrAudioFrameDmaCount) # $v0, 0x803b
+/* 0CC08C 800CB48C 8C5170BC */ lw $s1, %lo(gCurrAudioFrameDmaCount)($v0)
+/* 0CC090 800CB490 3C12803B */ lui $s2, %hi(gCurrAudioFrameDmaQueue) # $s2, 0x803b
+/* 0CC094 800CB494 26526008 */ addiu $s2, %lo(gCurrAudioFrameDmaQueue) # addiu $s2, $s2, 0x6008
/* 0CC098 800CB498 1A20000D */ blez $s1, .L800CB4D0
/* 0CC09C 800CB49C 00008025 */ move $s0, $zero
/* 0CC0A0 800CB4A0 02402025 */ move $a0, $s2
@@ -105,18 +105,18 @@ glabel create_next_audio_frame_task
/* 0CC0A8 800CB4A8 0C0335D4 */ jal osRecvMesg
/* 0CC0AC 800CB4AC 00003025 */ move $a2, $zero
/* 0CC0B0 800CB4B0 14400002 */ bnez $v0, .L800CB4BC
-/* 0CC0B4 800CB4B4 3C09803B */ lui $t1, %hi(D_803B70BC) # $t1, 0x803b
+/* 0CC0B4 800CB4B4 3C09803B */ lui $t1, %hi(gCurrAudioFrameDmaCount) # $t1, 0x803b
/* 0CC0B8 800CB4B8 2631FFFF */ addiu $s1, $s1, -1
.L800CB4BC:
-/* 0CC0BC 800CB4BC 8D2970BC */ lw $t1, %lo(D_803B70BC)($t1)
+/* 0CC0BC 800CB4BC 8D2970BC */ lw $t1, %lo(gCurrAudioFrameDmaCount)($t1)
/* 0CC0C0 800CB4C0 26100001 */ addiu $s0, $s0, 1
/* 0CC0C4 800CB4C4 0209082A */ slt $at, $s0, $t1
/* 0CC0C8 800CB4C8 5420FFF6 */ bnel $at, $zero, .L800CB4A4
/* 0CC0CC 800CB4CC 02402025 */ move $a0, $s2
.L800CB4D0:
-/* 0CC0D0 800CB4D0 3C12803B */ lui $s2, %hi(D_803B6008) # $s2, 0x803b
+/* 0CC0D0 800CB4D0 3C12803B */ lui $s2, %hi(gCurrAudioFrameDmaQueue) # $s2, 0x803b
/* 0CC0D4 800CB4D4 1220000A */ beqz $s1, .L800CB500
-/* 0CC0D8 800CB4D8 26526008 */ addiu $s2, %lo(D_803B6008) # addiu $s2, $s2, 0x6008
+/* 0CC0D8 800CB4D8 26526008 */ addiu $s2, %lo(gCurrAudioFrameDmaQueue) # addiu $s2, $s2, 0x6008
/* 0CC0DC 800CB4DC 1A200008 */ blez $s1, .L800CB500
/* 0CC0E0 800CB4E0 00008025 */ move $s0, $zero
/* 0CC0E4 800CB4E4 02402025 */ move $a0, $s2
@@ -142,9 +142,9 @@ glabel create_next_audio_frame_task
/* 0CC128 800CB528 5611FFFB */ bnel $s0, $s1, .L800CB518
/* 0CC12C 800CB52C 02402025 */ move $a0, $s2
.L800CB530:
-/* 0CC130 800CB530 3C01803B */ lui $at, %hi(D_803B70BC) # $at, 0x803b
+/* 0CC130 800CB530 3C01803B */ lui $at, %hi(gCurrAudioFrameDmaCount) # $at, 0x803b
/* 0CC134 800CB534 0C02EB01 */ jal func_800BAC04
-/* 0CC138 800CB538 AC2070BC */ sw $zero, %lo(D_803B70BC)($at)
+/* 0CC138 800CB538 AC2070BC */ sw $zero, %lo(gCurrAudioFrameDmaCount)($at)
/* 0CC13C 800CB53C 3C04800F */ lui $a0, %hi(D_800EA3B0) # $a0, 0x800f
/* 0CC140 800CB540 8C84A3B0 */ lw $a0, %lo(D_800EA3B0)($a0)
/* 0CC144 800CB544 27C50058 */ addiu $a1, $fp, 0x58
@@ -205,8 +205,8 @@ glabel create_next_audio_frame_task
/* 0CC214 800CB614 012A3821 */ addu $a3, $t1, $t2
/* 0CC218 800CB618 AC2870D0 */ sw $t0, %lo(D_803B70D0)($at)
/* 0CC21C 800CB61C 8CEB0000 */ lw $t3, ($a3)
-/* 0CC220 800CB620 3C05803B */ lui $a1, %hi(D_803B7088) # $a1, 0x803b
-/* 0CC224 800CB624 24A57088 */ addiu $a1, %lo(D_803B7088) # addiu $a1, $a1, 0x7088
+/* 0CC220 800CB620 3C05803B */ lui $a1, %hi(gAudioBufferParameters) # $a1, 0x803b
+/* 0CC224 800CB624 24A57088 */ addiu $a1, %lo(gAudioBufferParameters) # addiu $a1, $a1, 0x7088
/* 0CC228 800CB628 AFCB0060 */ sw $t3, 0x60($fp)
/* 0CC22C 800CB62C 84AE0006 */ lh $t6, 6($a1)
/* 0CC230 800CB630 8FCF0074 */ lw $t7, 0x74($fp)
diff --git a/asm/non_matchings/audio/synthesis/func_800B7034.s b/asm/non_matchings/audio/synthesis/func_800B7034.s
index ff6881cfc..a316860f9 100644
--- a/asm/non_matchings/audio/synthesis/func_800B7034.s
+++ b/asm/non_matchings/audio/synthesis/func_800B7034.s
@@ -1,6 +1,6 @@
glabel func_800B7034
-/* 0B7C34 800B7034 3C08803B */ lui $t0, %hi(D_803B70B0) # $t0, 0x803b
-/* 0B7C38 800B7038 250870B0 */ addiu $t0, %lo(D_803B70B0) # addiu $t0, $t0, 0x70b0
+/* 0B7C34 800B7034 3C08803B */ lui $t0, %hi(gMaxSimultaneousNotes) # $t0, 0x803b
+/* 0B7C38 800B7038 250870B0 */ addiu $t0, %lo(gMaxSimultaneousNotes) # addiu $t0, $t0, 0x70b0
/* 0B7C3C 800B703C 8D030000 */ lw $v1, ($t0)
/* 0B7C40 800B7040 00803825 */ move $a3, $a0
/* 0B7C44 800B7044 00001025 */ move $v0, $zero
diff --git a/asm/non_matchings/audio/synthesis/func_800B70EC.s b/asm/non_matchings/audio/synthesis/func_800B70EC.s
index d22252adf..11aa11eac 100644
--- a/asm/non_matchings/audio/synthesis/func_800B70EC.s
+++ b/asm/non_matchings/audio/synthesis/func_800B70EC.s
@@ -1,8 +1,8 @@
glabel func_800B70EC
/* 0B7CEC 800B70EC 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 0B7CF0 800B70F0 AFB5002C */ sw $s5, 0x2c($sp)
-/* 0B7CF4 800B70F4 3C15803B */ lui $s5, %hi(D_803B7088) # $s5, 0x803b
-/* 0B7CF8 800B70F8 26B57088 */ addiu $s5, %lo(D_803B7088) # addiu $s5, $s5, 0x7088
+/* 0B7CF4 800B70F4 3C15803B */ lui $s5, %hi(gAudioBufferParameters) # $s5, 0x803b
+/* 0B7CF8 800B70F8 26B57088 */ addiu $s5, %lo(gAudioBufferParameters) # addiu $s5, $s5, 0x7088
/* 0B7CFC 800B70FC AFB40028 */ sw $s4, 0x28($sp)
/* 0B7D00 800B7100 86B4000C */ lh $s4, 0xc($s5)
/* 0B7D04 800B7104 AFB60030 */ sw $s6, 0x30($sp)
diff --git a/asm/non_matchings/audio/synthesis/func_800B775C.s b/asm/non_matchings/audio/synthesis/func_800B775C.s
index 822cad046..89c6cbaaf 100644
--- a/asm/non_matchings/audio/synthesis/func_800B775C.s
+++ b/asm/non_matchings/audio/synthesis/func_800B775C.s
@@ -19,8 +19,8 @@ glabel func_800B775C
/* 0B83A0 800B77A0 AFA500C4 */ sw $a1, 0xc4($sp)
/* 0B83A4 800B77A4 1520001D */ bnez $t1, .L800B781C
/* 0B83A8 800B77A8 00009025 */ move $s2, $zero
-/* 0B83AC 800B77AC 3C04803B */ lui $a0, %hi(D_803B70B0) # $a0, 0x803b
-/* 0B83B0 800B77B0 8C8470B0 */ lw $a0, %lo(D_803B70B0)($a0)
+/* 0B83AC 800B77AC 3C04803B */ lui $a0, %hi(gMaxSimultaneousNotes) # $a0, 0x803b
+/* 0B83B0 800B77B0 8C8470B0 */ lw $a0, %lo(gMaxSimultaneousNotes)($a0)
/* 0B83B4 800B77B4 00008825 */ move $s1, $zero
/* 0B83B8 800B77B8 18800016 */ blez $a0, .L800B7814
/* 0B83BC 800B77BC 00000000 */ nop
@@ -53,8 +53,8 @@ glabel func_800B775C
.L800B781C:
/* 0B841C 800B781C 19200026 */ blez $t1, .L800B78B8
/* 0B8420 800B7820 00009825 */ move $s3, $zero
-/* 0B8424 800B7824 3C04803B */ lui $a0, %hi(D_803B70B0) # $a0, 0x803b
-/* 0B8428 800B7828 8C8470B0 */ lw $a0, %lo(D_803B70B0)($a0)
+/* 0B8424 800B7824 3C04803B */ lui $a0, %hi(gMaxSimultaneousNotes) # $a0, 0x803b
+/* 0B8428 800B7828 8C8470B0 */ lw $a0, %lo(gMaxSimultaneousNotes)($a0)
/* 0B842C 800B782C 27A50084 */ addiu $a1, $sp, 0x84
.L800B7830:
/* 0B8430 800B7830 1880001A */ blez $a0, .L800B789C
@@ -95,8 +95,8 @@ glabel func_800B775C
/* 0B84B0 800B78B0 00000000 */ nop
/* 0B84B4 800B78B4 00009825 */ move $s3, $zero
.L800B78B8:
-/* 0B84B8 800B78B8 3C04803B */ lui $a0, %hi(D_803B70B0) # $a0, 0x803b
-/* 0B84BC 800B78BC 8C8470B0 */ lw $a0, %lo(D_803B70B0)($a0)
+/* 0B84B8 800B78B8 3C04803B */ lui $a0, %hi(gMaxSimultaneousNotes) # $a0, 0x803b
+/* 0B84BC 800B78BC 8C8470B0 */ lw $a0, %lo(gMaxSimultaneousNotes)($a0)
/* 0B84C0 800B78C0 27A50084 */ addiu $a1, $sp, 0x84
/* 0B84C4 800B78C4 00008825 */ move $s1, $zero
/* 0B84C8 800B78C8 5880001D */ blezl $a0, .L800B7940
@@ -176,8 +176,8 @@ glabel func_800B775C
/* 0B85D8 800B79D8 27B80084 */ addiu $t8, $sp, 0x84
/* 0B85DC 800B79DC 02388021 */ addu $s0, $s1, $t8
.L800B79E0:
-/* 0B85E0 800B79E0 3C19803B */ lui $t9, %hi(D_803B70B0) # $t9, 0x803b
-/* 0B85E4 800B79E4 8F3970B0 */ lw $t9, %lo(D_803B70B0)($t9)
+/* 0B85E0 800B79E0 3C19803B */ lui $t9, %hi(gMaxSimultaneousNotes) # $t9, 0x803b
+/* 0B85E4 800B79E4 8F3970B0 */ lw $t9, %lo(gMaxSimultaneousNotes)($t9)
/* 0B85E8 800B79E8 92030000 */ lbu $v1, ($s0)
/* 0B85EC 800B79EC 8EC80000 */ lw $t0, ($s6)
/* 0B85F0 800B79F0 02B90019 */ multu $s5, $t9
@@ -245,8 +245,8 @@ glabel func_800B775C
/* 0B86D8 800B7AD8 022E8021 */ addu $s0, $s1, $t6
/* 0B86DC 800B7ADC 24130001 */ li $s3, 1
.L800B7AE0:
-/* 0B86E0 800B7AE0 3C18803B */ lui $t8, %hi(D_803B70B0) # $t8, 0x803b
-/* 0B86E4 800B7AE4 8F1870B0 */ lw $t8, %lo(D_803B70B0)($t8)
+/* 0B86E0 800B7AE0 3C18803B */ lui $t8, %hi(gMaxSimultaneousNotes) # $t8, 0x803b
+/* 0B86E4 800B7AE4 8F1870B0 */ lw $t8, %lo(gMaxSimultaneousNotes)($t8)
/* 0B86E8 800B7AE8 92030000 */ lbu $v1, ($s0)
/* 0B86EC 800B7AEC 8EC80000 */ lw $t0, ($s6)
/* 0B86F0 800B7AF0 02B80019 */ multu $s5, $t8
diff --git a/asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s b/asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s
index 28f84120c..71b54cc17 100644
--- a/asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s
+++ b/asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s
@@ -1,15 +1,15 @@
glabel synthesis_load_note_subs_eu
-/* 0B7BB4 800B6FB4 3C06803B */ lui $a2, %hi(D_803B7088) # $a2, 0x803b
-/* 0B7BB8 800B6FB8 24C67088 */ addiu $a2, %lo(D_803B7088) # addiu $a2, $a2, 0x7088
+/* 0B7BB4 800B6FB4 3C06803B */ lui $a2, %hi(gAudioBufferParameters) # $a2, 0x803b
+/* 0B7BB8 800B6FB8 24C67088 */ addiu $a2, %lo(gAudioBufferParameters) # addiu $a2, $a2, 0x7088
/* 0B7BBC 800B6FBC 84CE000C */ lh $t6, 0xc($a2)
/* 0B7BC0 800B6FC0 24820001 */ addiu $v0, $a0, 1
/* 0B7BC4 800B6FC4 00051900 */ sll $v1, $a1, 4
/* 0B7BC8 800B6FC8 004E082A */ slt $at, $v0, $t6
/* 0B7BCC 800B6FCC 10200017 */ beqz $at, .L800B702C
-/* 0B7BD0 800B6FD0 3C07803B */ lui $a3, %hi(D_803B70B0) # $a3, 0x803b
+/* 0B7BD0 800B6FD0 3C07803B */ lui $a3, %hi(gMaxSimultaneousNotes) # $a3, 0x803b
/* 0B7BD4 800B6FD4 3C05803B */ lui $a1, %hi(gNoteSubsEu) # $a1, 0x803b
/* 0B7BD8 800B6FD8 24A5FBC4 */ addiu $a1, %lo(gNoteSubsEu) # addiu $a1, $a1, -0x43c
-/* 0B7BDC 800B6FDC 24E770B0 */ addiu $a3, %lo(D_803B70B0) # addiu $a3, $a3, 0x70b0
+/* 0B7BDC 800B6FDC 24E770B0 */ addiu $a3, %lo(gMaxSimultaneousNotes) # addiu $a3, $a3, 0x70b0
/* 0B7BE0 800B6FE0 8CF80000 */ lw $t8, ($a3)
.L800B6FE4:
/* 0B7BE4 800B6FE4 8CAF0000 */ lw $t7, ($a1)
diff --git a/data/data_0DD0A0_1_1.s b/data/data_0DD0A0_1_1.s
index 0ac7fd0e3..f2ff8e65a 100644
--- a/data/data_0DD0A0_1_1.s
+++ b/data/data_0DD0A0_1_1.s
@@ -1427,202 +1427,102 @@ glabel gKartWarioGroup17
.word gKartWario281, gKartWario282, gKartWario283, gKartWario284
.word gKartWario285, gKartWario286, gKartWario287, gKartWario288
-glabel gKartMarioTable0
-.word gKartMarioGroup8, gKartMarioGroup7, gKartMarioGroup6, gKartMarioGroup5
-.word gKartMarioGroup4, gKartMarioGroup3, gKartMarioGroup2, gKartMarioGroup1
-.word gKartMarioGroup0
-
-glabel gKartLuigiTable0
-.word gKartLuigiGroup8, gKartLuigiGroup7, gKartLuigiGroup6, gKartLuigiGroup5
-.word gKartLuigiGroup4, gKartLuigiGroup3, gKartLuigiGroup2, gKartLuigiGroup1
-.word gKartLuigiGroup0
-
-glabel gKartYoshiTable0
-.word gKartYoshiGroup8, gKartYoshiGroup7, gKartYoshiGroup6, gKartYoshiGroup5
-.word gKartYoshiGroup4, gKartYoshiGroup3, gKartYoshiGroup2, gKartYoshiGroup1
-.word gKartYoshiGroup0
-
-glabel gKartToadTable0
-.word gKartToadGroup8, gKartToadGroup7, gKartToadGroup6, gKartToadGroup5
-.word gKartToadGroup4, gKartToadGroup3, gKartToadGroup2, gKartToadGroup1
-.word gKartToadGroup0
-
-glabel gKartDKTable0
-.word gKartDKGroup8, gKartDKGroup7, gKartDKGroup6, gKartDKGroup5
-.word gKartDKGroup4, gKartDKGroup3, gKartDKGroup2, gKartDKGroup1
-.word gKartDKGroup0
-
-glabel gKartWarioTable0
-.word gKartWarioGroup8, gKartWarioGroup7, gKartWarioGroup6, gKartWarioGroup5
-.word gKartWarioGroup4, gKartWarioGroup3, gKartWarioGroup2, gKartWarioGroup1
-.word gKartWarioGroup0
-
-glabel gKartPeachTable0
-.word gKartPeachGroup8, gKartPeachGroup7, gKartPeachGroup6, gKartPeachGroup5
-.word gKartPeachGroup4, gKartPeachGroup3, gKartPeachGroup2, gKartPeachGroup1
-.word gKartPeachGroup0
-
-glabel gKartBowserTable0
-.word gKartBowserGroup8, gKartBowserGroup7, gKartBowserGroup6, gKartBowserGroup5
-.word gKartBowserGroup4, gKartBowserGroup3, gKartBowserGroup2, gKartBowserGroup1
-.word gKartBowserGroup0
-
-glabel gKartMarioTable1
-.word gKartMarioGroup17, gKartMarioGroup16, gKartMarioGroup15, gKartMarioGroup14
-.word gKartMarioGroup13, gKartMarioGroup12, gKartMarioGroup11, gKartMarioGroup10
-.word gKartMarioGroup9
-
-glabel gKartLuigiTable1
-.word gKartLuigiGroup17, gKartLuigiGroup16, gKartLuigiGroup15, gKartLuigiGroup14
-.word gKartLuigiGroup13, gKartLuigiGroup12, gKartLuigiGroup11, gKartLuigiGroup10
-.word gKartLuigiGroup9
-
-glabel gKartYoshiTable1
-.word gKartYoshiGroup17, gKartYoshiGroup16, gKartYoshiGroup15, gKartYoshiGroup14
-.word gKartYoshiGroup13, gKartYoshiGroup12, gKartYoshiGroup11, gKartYoshiGroup10
-.word gKartYoshiGroup9
-
-glabel gKartToadTable1
-.word gKartToadGroup17, gKartToadGroup16, gKartToadGroup15, gKartToadGroup14
-.word gKartToadGroup13, gKartToadGroup12, gKartToadGroup11, gKartToadGroup10
-.word gKartToadGroup9
-
-glabel gKartDKTable1
-.word gKartDKGroup17, gKartDKGroup16, gKartDKGroup15, gKartDKGroup14
-.word gKartDKGroup13, gKartDKGroup12, gKartDKGroup11, gKartDKGroup10
-.word gKartDKGroup9
-
-glabel gKartWarioTable1
-.word gKartWarioGroup17, gKartWarioGroup16, gKartWarioGroup15, gKartWarioGroup14
-.word gKartWarioGroup13, gKartWarioGroup12, gKartWarioGroup11, gKartWarioGroup10
-.word gKartWarioGroup9
-
-glabel gKartPeachTable1
-.word gKartPeachGroup17, gKartPeachGroup16, gKartPeachGroup15, gKartPeachGroup14
-.word gKartPeachGroup13, gKartPeachGroup12, gKartPeachGroup11, gKartPeachGroup10
-.word gKartPeachGroup9
-
-glabel gKartBowserTable1
-.word gKartBowserGroup17, gKartBowserGroup16, gKartBowserGroup15, gKartBowserGroup14
-.word gKartBowserGroup13, gKartBowserGroup12, gKartBowserGroup11, gKartBowserGroup10
-.word gKartBowserGroup9
-
-glabel gKartTextureTable0
-.word gKartMarioTable0
-.word gKartLuigiTable0
-.word gKartYoshiTable0
-.word gKartToadTable0
-.word gKartDKTable0
-.word gKartWarioTable0
-.word gKartPeachTable0
-.word gKartBowserTable0
-
-glabel gKartTextureTable1
-.word gKartMarioTable1
-.word gKartLuigiTable1
-.word gKartYoshiTable1
-.word gKartToadTable1
-.word gKartDKTable1
-.word gKartWarioTable1
-.word gKartPeachTable1
-.word gKartBowserTable1
-
-glabel gKartMarioGroup18
-.word gKartMario289, gKartMario290, gKartMario291, gKartMario292
-.word gKartMario293, gKartMario294, gKartMario295, gKartMario296
-.word gKartMario297, gKartMario298, gKartMario299, gKartMario300
-.word gKartMario301, gKartMario302, gKartMario303, gKartMario304
-.word gKartMario305, gKartMario306, gKartMario307, gKartMario308
-.word gKartMario309, gKartMario310, gKartMario311, gKartMario312
-.word gKartMario313, gKartMario314, gKartMario315, gKartMario316
-.word gKartMario317, gKartMario318, gKartMario319, gKartMario320
-
-glabel gKartLuigiGroup18
-.word gKartLuigi289, gKartLuigi290, gKartLuigi291, gKartLuigi292
-.word gKartLuigi293, gKartLuigi294, gKartLuigi295, gKartLuigi296
-.word gKartLuigi297, gKartLuigi298, gKartLuigi299, gKartLuigi300
-.word gKartLuigi301, gKartLuigi302, gKartLuigi303, gKartLuigi304
-.word gKartLuigi305, gKartLuigi306, gKartLuigi307, gKartLuigi308
-.word gKartLuigi309, gKartLuigi310, gKartLuigi311, gKartLuigi312
-.word gKartLuigi313, gKartLuigi314, gKartLuigi315, gKartLuigi316
-.word gKartLuigi317, gKartLuigi318, gKartLuigi319, gKartLuigi320
-
-glabel gKartBowserGroup18
-.word gKartBowser289, gKartBowser290, gKartBowser291, gKartBowser292
-.word gKartBowser293, gKartBowser294, gKartBowser295, gKartBowser296
-.word gKartBowser297, gKartBowser298, gKartBowser299, gKartBowser300
-.word gKartBowser301, gKartBowser302, gKartBowser303, gKartBowser304
-.word gKartBowser305, gKartBowser306, gKartBowser307, gKartBowser308
-.word gKartBowser309, gKartBowser310, gKartBowser311, gKartBowser312
-.word gKartBowser313, gKartBowser314, gKartBowser315, gKartBowser316
-.word gKartBowser317, gKartBowser318, gKartBowser319, gKartBowser320
-
-glabel gKartToadGroup18
-.word gKartToad289, gKartToad290, gKartToad291, gKartToad292
-.word gKartToad293, gKartToad294, gKartToad295, gKartToad296
-.word gKartToad297, gKartToad298, gKartToad299, gKartToad300
-.word gKartToad301, gKartToad302, gKartToad303, gKartToad304
-.word gKartToad305, gKartToad306, gKartToad307, gKartToad308
-.word gKartToad309, gKartToad310, gKartToad311, gKartToad312
-.word gKartToad313, gKartToad314, gKartToad315, gKartToad316
-.word gKartToad317, gKartToad318, gKartToad319, gKartToad320
-
-glabel gKartYoshiGroup18
-.word gKartYoshi289, gKartYoshi290, gKartYoshi291, gKartYoshi292
-.word gKartYoshi293, gKartYoshi294, gKartYoshi295, gKartYoshi296
-.word gKartYoshi297, gKartYoshi298, gKartYoshi299, gKartYoshi300
-.word gKartYoshi301, gKartYoshi302, gKartYoshi303, gKartYoshi304
-.word gKartYoshi305, gKartYoshi306, gKartYoshi307, gKartYoshi308
-.word gKartYoshi309, gKartYoshi310, gKartYoshi311, gKartYoshi312
-.word gKartYoshi313, gKartYoshi314, gKartYoshi315, gKartYoshi316
-.word gKartYoshi317, gKartYoshi318, gKartYoshi319, gKartYoshi320
-
-glabel gKartDKGroup18
-.word gKartDK289, gKartDK290, gKartDK291, gKartDK292
-.word gKartDK293, gKartDK294, gKartDK295, gKartDK296
-.word gKartDK297, gKartDK298, gKartDK299, gKartDK300
-.word gKartDK301, gKartDK302, gKartDK303, gKartDK304
-.word gKartDK305, gKartDK306, gKartDK307, gKartDK308
-.word gKartDK309, gKartDK310, gKartDK311, gKartDK312
-.word gKartDK313, gKartDK314, gKartDK315, gKartDK316
-.word gKartDK317, gKartDK318, gKartDK319, gKartDK320
-
-glabel gKartPeachGroup18
-.word gKartPeach289, gKartPeach290, gKartPeach291, gKartPeach292
-.word gKartPeach293, gKartPeach294, gKartPeach295, gKartPeach296
-.word gKartPeach297, gKartPeach298, gKartPeach299, gKartPeach300
-.word gKartPeach301, gKartPeach302, gKartPeach303, gKartPeach304
-.word gKartPeach305, gKartPeach306, gKartPeach307, gKartPeach308
-.word gKartPeach309, gKartPeach310, gKartPeach311, gKartPeach312
-.word gKartPeach313, gKartPeach314, gKartPeach315, gKartPeach316
-.word gKartPeach317, gKartPeach318, gKartPeach319, gKartPeach320
-
-glabel gKartWarioGroup18
-.word gKartWario289, gKartWario290, gKartWario291, gKartWario292
-.word gKartWario293, gKartWario294, gKartWario295, gKartWario296
-.word gKartWario297, gKartWario298, gKartWario299, gKartWario300
-.word gKartWario301, gKartWario302, gKartWario303, gKartWario304
-.word gKartWario305, gKartWario306, gKartWario307, gKartWario308
-.word gKartWario309, gKartWario310, gKartWario311, gKartWario312
-.word gKartWario313, gKartWario314, gKartWario315, gKartWario316
-.word gKartWario317, gKartWario318, gKartWario319, gKartWario320
-
-glabel gKartTextureGroup18s
-.word gKartMarioGroup18
-.word gKartLuigiGroup18
-.word gKartYoshiGroup18
-.word gKartToadGroup18
-.word gKartDKGroup18
-.word gKartWarioGroup18
-.word gKartPeachGroup18
-.word gKartBowserGroup18
-
-glabel gKartPalettes
-.word gKartMarioPalette
-.word gKartLuigiPalette
-.word gKartYoshiPalette
-.word gKartToadPalette
-.word gKartDKPalette
-.word gKartWarioPalette
-.word gKartPeachPalette
-.word gKartBowserPalette
+#glabel gKartMarioTable0
+#.word gKartMarioGroup8, gKartMarioGroup7, gKartMarioGroup6, gKartMarioGroup5
+#.word gKartMarioGroup4, gKartMarioGroup3, gKartMarioGroup2, gKartMarioGroup1
+#.word gKartMarioGroup0
+
+#glabel gKartLuigiTable0
+#.word gKartLuigiGroup8, gKartLuigiGroup7, gKartLuigiGroup6, gKartLuigiGroup5
+#.word gKartLuigiGroup4, gKartLuigiGroup3, gKartLuigiGroup2, gKartLuigiGroup1
+#.word gKartLuigiGroup0
+
+#glabel gKartYoshiTable0
+#.word gKartYoshiGroup8, gKartYoshiGroup7, gKartYoshiGroup6, gKartYoshiGroup5
+#.word gKartYoshiGroup4, gKartYoshiGroup3, gKartYoshiGroup2, gKartYoshiGroup1
+#.word gKartYoshiGroup0
+
+#glabel gKartToadTable0
+#.word gKartToadGroup8, gKartToadGroup7, gKartToadGroup6, gKartToadGroup5
+#.word gKartToadGroup4, gKartToadGroup3, gKartToadGroup2, gKartToadGroup1
+#.word gKartToadGroup0
+
+#glabel gKartDKTable0
+#.word gKartDKGroup8, gKartDKGroup7, gKartDKGroup6, gKartDKGroup5
+#.word gKartDKGroup4, gKartDKGroup3, gKartDKGroup2, gKartDKGroup1
+#.word gKartDKGroup0
+
+#glabel gKartWarioTable0
+#.word gKartWarioGroup8, gKartWarioGroup7, gKartWarioGroup6, gKartWarioGroup5
+#.word gKartWarioGroup4, gKartWarioGroup3, gKartWarioGroup2, gKartWarioGroup1
+#.word gKartWarioGroup0
+
+#glabel gKartPeachTable0
+#.word gKartPeachGroup8, gKartPeachGroup7, gKartPeachGroup6, gKartPeachGroup5
+#.word gKartPeachGroup4, gKartPeachGroup3, gKartPeachGroup2, gKartPeachGroup1
+#.word gKartPeachGroup0
+
+#glabel gKartBowserTable0
+#.word gKartBowserGroup8, gKartBowserGroup7, gKartBowserGroup6, gKartBowserGroup5
+#.word gKartBowserGroup4, gKartBowserGroup3, gKartBowserGroup2, gKartBowserGroup1
+#.word gKartBowserGroup0
+
+#glabel gKartMarioTable1
+#.word gKartMarioGroup17, gKartMarioGroup16, gKartMarioGroup15, gKartMarioGroup14
+#.word gKartMarioGroup13, gKartMarioGroup12, gKartMarioGroup11, gKartMarioGroup10
+#.word gKartMarioGroup9
+
+#glabel gKartLuigiTable1
+#.word gKartLuigiGroup17, gKartLuigiGroup16, gKartLuigiGroup15, gKartLuigiGroup14
+#.word gKartLuigiGroup13, gKartLuigiGroup12, gKartLuigiGroup11, gKartLuigiGroup10
+#.word gKartLuigiGroup9
+
+#glabel gKartYoshiTable1
+#.word gKartYoshiGroup17, gKartYoshiGroup16, gKartYoshiGroup15, gKartYoshiGroup14
+#.word gKartYoshiGroup13, gKartYoshiGroup12, gKartYoshiGroup11, gKartYoshiGroup10
+#.word gKartYoshiGroup9
+
+#glabel gKartToadTable1
+#.word gKartToadGroup17, gKartToadGroup16, gKartToadGroup15, gKartToadGroup14
+#.word gKartToadGroup13, gKartToadGroup12, gKartToadGroup11, gKartToadGroup10
+#.word gKartToadGroup9
+
+#glabel gKartDKTable1
+#.word gKartDKGroup17, gKartDKGroup16, gKartDKGroup15, gKartDKGroup14
+#.word gKartDKGroup13, gKartDKGroup12, gKartDKGroup11, gKartDKGroup10
+#.word gKartDKGroup9
+
+#glabel gKartWarioTable1
+#.word gKartWarioGroup17, gKartWarioGroup16, gKartWarioGroup15, gKartWarioGroup14
+#.word gKartWarioGroup13, gKartWarioGroup12, gKartWarioGroup11, gKartWarioGroup10
+#.word gKartWarioGroup9
+
+#glabel gKartPeachTable1
+#.word gKartPeachGroup17, gKartPeachGroup16, gKartPeachGroup15, gKartPeachGroup14
+#.word gKartPeachGroup13, gKartPeachGroup12, gKartPeachGroup11, gKartPeachGroup10
+#.word gKartPeachGroup9
+
+#glabel gKartBowserTable1
+#.word gKartBowserGroup17, gKartBowserGroup16, gKartBowserGroup15, gKartBowserGroup14
+#.word gKartBowserGroup13, gKartBowserGroup12, gKartBowserGroup11, gKartBowserGroup10
+#.word gKartBowserGroup9
+
+#glabel gKartTextureTable0
+#.word gKartMarioTable0
+#.word gKartLuigiTable0
+#.word gKartYoshiTable0
+#.word gKartToadTable0
+#.word gKartDKTable0
+#.word gKartWarioTable0
+#.word gKartPeachTable0
+#.word gKartBowserTable0
+
+#glabel gKartTextureTable1
+#.word gKartMarioTable1
+#.word gKartLuigiTable1
+#.word gKartYoshiTable1
+#.word gKartToadTable1
+#.word gKartDKTable1
+#.word gKartWarioTable1
+#.word gKartPeachTable1
+#.word gKartBowserTable1
diff --git a/data/data_0DD0A0_1_2.s b/data/data_0DD0A0_1_2.s
new file mode 100644
index 000000000..687b484b7
--- /dev/null
+++ b/data/data_0DD0A0_1_2.s
@@ -0,0 +1,106 @@
+# Mario Kart 64 (U) disassembly and split file
+# generated by n64split v0.4a - N64 ROM splitter
+
+.include "macros.inc"
+
+.section .data
+
+glabel gKartMarioGroup18
+.word gKartMario289, gKartMario290, gKartMario291, gKartMario292
+.word gKartMario293, gKartMario294, gKartMario295, gKartMario296
+.word gKartMario297, gKartMario298, gKartMario299, gKartMario300
+.word gKartMario301, gKartMario302, gKartMario303, gKartMario304
+.word gKartMario305, gKartMario306, gKartMario307, gKartMario308
+.word gKartMario309, gKartMario310, gKartMario311, gKartMario312
+.word gKartMario313, gKartMario314, gKartMario315, gKartMario316
+.word gKartMario317, gKartMario318, gKartMario319, gKartMario320
+
+glabel gKartLuigiGroup18
+.word gKartLuigi289, gKartLuigi290, gKartLuigi291, gKartLuigi292
+.word gKartLuigi293, gKartLuigi294, gKartLuigi295, gKartLuigi296
+.word gKartLuigi297, gKartLuigi298, gKartLuigi299, gKartLuigi300
+.word gKartLuigi301, gKartLuigi302, gKartLuigi303, gKartLuigi304
+.word gKartLuigi305, gKartLuigi306, gKartLuigi307, gKartLuigi308
+.word gKartLuigi309, gKartLuigi310, gKartLuigi311, gKartLuigi312
+.word gKartLuigi313, gKartLuigi314, gKartLuigi315, gKartLuigi316
+.word gKartLuigi317, gKartLuigi318, gKartLuigi319, gKartLuigi320
+
+glabel gKartBowserGroup18
+.word gKartBowser289, gKartBowser290, gKartBowser291, gKartBowser292
+.word gKartBowser293, gKartBowser294, gKartBowser295, gKartBowser296
+.word gKartBowser297, gKartBowser298, gKartBowser299, gKartBowser300
+.word gKartBowser301, gKartBowser302, gKartBowser303, gKartBowser304
+.word gKartBowser305, gKartBowser306, gKartBowser307, gKartBowser308
+.word gKartBowser309, gKartBowser310, gKartBowser311, gKartBowser312
+.word gKartBowser313, gKartBowser314, gKartBowser315, gKartBowser316
+.word gKartBowser317, gKartBowser318, gKartBowser319, gKartBowser320
+
+glabel gKartToadGroup18
+.word gKartToad289, gKartToad290, gKartToad291, gKartToad292
+.word gKartToad293, gKartToad294, gKartToad295, gKartToad296
+.word gKartToad297, gKartToad298, gKartToad299, gKartToad300
+.word gKartToad301, gKartToad302, gKartToad303, gKartToad304
+.word gKartToad305, gKartToad306, gKartToad307, gKartToad308
+.word gKartToad309, gKartToad310, gKartToad311, gKartToad312
+.word gKartToad313, gKartToad314, gKartToad315, gKartToad316
+.word gKartToad317, gKartToad318, gKartToad319, gKartToad320
+
+glabel gKartYoshiGroup18
+.word gKartYoshi289, gKartYoshi290, gKartYoshi291, gKartYoshi292
+.word gKartYoshi293, gKartYoshi294, gKartYoshi295, gKartYoshi296
+.word gKartYoshi297, gKartYoshi298, gKartYoshi299, gKartYoshi300
+.word gKartYoshi301, gKartYoshi302, gKartYoshi303, gKartYoshi304
+.word gKartYoshi305, gKartYoshi306, gKartYoshi307, gKartYoshi308
+.word gKartYoshi309, gKartYoshi310, gKartYoshi311, gKartYoshi312
+.word gKartYoshi313, gKartYoshi314, gKartYoshi315, gKartYoshi316
+.word gKartYoshi317, gKartYoshi318, gKartYoshi319, gKartYoshi320
+
+glabel gKartDKGroup18
+.word gKartDK289, gKartDK290, gKartDK291, gKartDK292
+.word gKartDK293, gKartDK294, gKartDK295, gKartDK296
+.word gKartDK297, gKartDK298, gKartDK299, gKartDK300
+.word gKartDK301, gKartDK302, gKartDK303, gKartDK304
+.word gKartDK305, gKartDK306, gKartDK307, gKartDK308
+.word gKartDK309, gKartDK310, gKartDK311, gKartDK312
+.word gKartDK313, gKartDK314, gKartDK315, gKartDK316
+.word gKartDK317, gKartDK318, gKartDK319, gKartDK320
+
+glabel gKartPeachGroup18
+.word gKartPeach289, gKartPeach290, gKartPeach291, gKartPeach292
+.word gKartPeach293, gKartPeach294, gKartPeach295, gKartPeach296
+.word gKartPeach297, gKartPeach298, gKartPeach299, gKartPeach300
+.word gKartPeach301, gKartPeach302, gKartPeach303, gKartPeach304
+.word gKartPeach305, gKartPeach306, gKartPeach307, gKartPeach308
+.word gKartPeach309, gKartPeach310, gKartPeach311, gKartPeach312
+.word gKartPeach313, gKartPeach314, gKartPeach315, gKartPeach316
+.word gKartPeach317, gKartPeach318, gKartPeach319, gKartPeach320
+
+glabel gKartWarioGroup18
+.word gKartWario289, gKartWario290, gKartWario291, gKartWario292
+.word gKartWario293, gKartWario294, gKartWario295, gKartWario296
+.word gKartWario297, gKartWario298, gKartWario299, gKartWario300
+.word gKartWario301, gKartWario302, gKartWario303, gKartWario304
+.word gKartWario305, gKartWario306, gKartWario307, gKartWario308
+.word gKartWario309, gKartWario310, gKartWario311, gKartWario312
+.word gKartWario313, gKartWario314, gKartWario315, gKartWario316
+.word gKartWario317, gKartWario318, gKartWario319, gKartWario320
+
+glabel gKartTextureGroup18s
+.word gKartMarioGroup18
+.word gKartLuigiGroup18
+.word gKartYoshiGroup18
+.word gKartToadGroup18
+.word gKartDKGroup18
+.word gKartWarioGroup18
+.word gKartPeachGroup18
+.word gKartBowserGroup18
+
+glabel gKartPalettes
+.word gKartMarioPalette
+.word gKartLuigiPalette
+.word gKartYoshiPalette
+.word gKartToadPalette
+.word gKartDKPalette
+.word gKartWarioPalette
+.word gKartPeachPalette
+.word gKartBowserPalette
diff --git a/data/data_0DD0A0_2.s b/data/data_0DD0A0_2.s
index db2bcbe99..c7b0f474a 100644
--- a/data/data_0DD0A0_2.s
+++ b/data/data_0DD0A0_2.s
@@ -2683,770 +2683,10 @@ glabel D_800E9300
.balign 0x10
-glabel D_800E9310
-.asciiz "Romcopy %x -> %x ,size %x\n"
-.balign 4
-
-glabel D_800E932C
-.asciiz "Romcopyend\n"
-.balign 4
-
-glabel D_800E9338
-.asciiz "CAUTION:WAVE CACHE FULL %d"
-.balign 4
-
-glabel D_800E9354
-.asciiz "LOAD Rom :%x -> Ram :%x Len:%x\n"
-.balign 4
-
-glabel D_800E9378
-.asciiz "BASE %x %x\n"
-.balign 4
-
-glabel D_800E9384
-.asciiz "LOAD %x %x %x\n"
-.balign 4
-
-glabel D_800E9394
-.asciiz "INSTTOP %x\n"
-.balign 4
-
-glabel D_800E93A4
-.asciiz "INSTMAP[0] %x\n"
-.balign 4
-
-glabel D_800E93B4
-.asciiz "already flags %d\n"
-.balign 4
-
-glabel D_800E93C8
-.asciiz "already flags %d\n"
-.balign 4
-
-glabel D_800E93DC
-.asciiz "ERR:SLOW BANK DMA BUSY\n"
-.balign 4
-
-glabel D_800E93F4
-.asciiz "ERR:SLOW DMA BUSY\n"
-.balign 4
-
-glabel D_800E9408
-.asciiz "Check %d bank %d\n"
-.balign 4
-
-glabel D_800E941C
-.asciiz "Cache Check\n"
-.balign 4
-
-glabel D_800E942C
-.asciiz "NO BANK ERROR\n"
-.balign 4
-
-glabel D_800E943C
-.asciiz "BANK %d LOADING START\n"
-.balign 4
-
-glabel D_800E9454
-.asciiz "BANK %d LOAD MISS (NO MEMORY)!\n"
-.balign 4
-
-glabel D_800E9474
-.asciiz "BANK %d ALREADY CACHED\n"
-.balign 4
-
-glabel D_800E948C
-.asciiz "BANK LOAD MISS! FOR %d\n"
-.balign 4
-
-glabel D_800E94A4
-.asciiz "Seq %d Loading Start\n"
-.balign 4
-
-glabel D_800E94BC
-.asciiz "Heap Overflow Error\n"
-.balign 4
-
-glabel D_800E94D4
-.asciiz "SEQ %d ALREADY CACHED\n"
-.balign 4
-
-glabel D_800E94EC
-.asciiz "Ok,one bank slow load Start \n"
-.balign 4
-
-glabel D_800E950C
-.asciiz "Sorry,too many %d bank is none.fast load Start \n"
-.balign 4
+#glabel D_800E9310
+#.asciiz "Romcopy %x -> %x ,size %x\n"
+#.balign 4
-glabel D_800E9540
-.asciiz "Seq %d:Default Load Id is %d\n"
-.balign 4
-
-glabel D_800E9560
-.asciiz "Seq Loading Start\n"
-.balign 4
-
-glabel D_800E9574
-.asciiz "Error:Before Sequence-SlowDma remain.\n"
-.balign 4
-
-glabel D_800E959C
-.asciiz " Cancel Seq Start.\n"
-.balign 4
-
-glabel D_800E95B8
-.asciiz "SEQ %d ALREADY CACHED\n"
-.balign 4
-
-glabel D_800E95D0
-.asciiz "Clear Workarea %x -%x size %x \n"
-.balign 4
-
-glabel D_800E95F0
-.asciiz "AudioHeap is %x\n"
-.balign 4
-
-glabel D_800E9604
-.asciiz "Heap reset.Synth Change %x \n"
-.balign 4
-
-glabel D_800E9624
-.asciiz "Heap %x %x %x\n"
-.balign 4
-
-glabel D_800E9634
-.asciiz "Main Heap Initialize.\n"
-.balign 4
-
-glabel D_800E964C
-.asciiz "---------- Init Completed. ------------\n"
-.balign 4
-
-glabel D_800E9678
-.asciiz " Syndrv :[%6d]\n"
-.balign 4
-
-glabel D_800E968C
-.asciiz " Seqdrv :[%6d]\n"
-.balign 4
-
-glabel D_800E96A0
-.asciiz " audiodata :[%6d]\n"
-.balign 4
-
-glabel D_800E96B4
-.asciiz "---------------------------------------\n"
-.balign 4
-
-glabel D_800E96E0
-.asciiz "Audio: setvol: volume minus %f\n"
-.balign 4
-
-glabel D_800E9700
-.asciiz "Audio: setvol: volume overflow %f\n"
-.balign 4
-
-glabel D_800E9724
-.asciiz "Audio: setpitch: pitch minus %f\n"
-.balign 4
-
-glabel D_800E9748
-.asciiz "Audio: voiceman: No bank error %d\n"
-.balign 4
-
-glabel D_800E976C
-.asciiz "Audio: voiceman: progNo. overflow %d,%d\n"
-.balign 4
-
-glabel D_800E9798
-.asciiz "Audio: voiceman: progNo. undefined %d,%d\n"
-.balign 4
-
-glabel D_800E97C4
-.asciiz "Audio: voiceman: No bank error %d\n"
-.balign 4
-
-glabel D_800E97E8
-.asciiz "Audio: voiceman: Percussion Overflow %d,%d\n"
-.balign 4
-
-glabel D_800E9814
-.asciiz "Audio: voiceman: Percussion table pointer (bank %d) is irregular.\n"
-.balign 4
-
-glabel D_800E9858
-.asciiz "Audio: voiceman: Percpointer NULL %d,%d\n"
-.balign 4
-
-glabel D_800E9884
-.asciiz "--4 %x\n"
-.balign 4
-
-glabel D_800E988C
-.asciiz "Stoped Voice\n"
-.balign 4
-
-glabel D_800E989C
-.asciiz "CAUTION:SUB IS SEPARATED FROM GROUP"
-.balign 4
-
-glabel D_800E98C0
-.asciiz "Error:Wait Track disappear\n"
-.balign 4
-
-glabel D_800E98DC
-.asciiz "Slow Release Batting\n"
-.balign 4
-
-glabel D_800E98F4
-.byte 0x40, 0x20, 0x10, 0x08
-
-glabel D_800E98F8
-.asciiz "Audio:Wavemem: Bad voiceno (%d)\n"
-.balign 4
-
-glabel D_800E991C
-.asciiz "Audio: C-Alloc : Dealloc voice is NULL\n"
-.balign 4
-
-glabel D_800E9944
-.asciiz "Alloc Error:Dim voice-Alloc %d"
-.balign 4
-
-glabel D_800E9964
-.asciiz "Error:Same List Add\n"
-.balign 4
-
-glabel D_800E997C
-.asciiz "Already Cut\n"
-.balign 4
-
-glabel D_800E998C
-.asciiz "Audio: C-Alloc : lowerPrio is NULL\n"
-.balign 4
-
-glabel D_800E99B0
-.asciiz "Sub Limited Warning: Drop Voice"
-.balign 4
-
-glabel D_800E99D0
-.asciiz "Warning: Drop Voice"
-.balign 4
-
-glabel D_800E99E4
-.asciiz "Warning: Drop Voice"
-.balign 4
-
-glabel D_800E99F8
-.asciiz "Warning: Drop Voice"
-.balign 4
-
-.balign 0x10
-
-glabel D_800E9A10
-.asciiz "Env-Clear 0\n"
-.balign 4
-
-glabel D_800E9A20
-.asciiz "Audio:Envp: overflow %f\n"
-.balign 4
-
-.balign 0x10
-
-glabel D_800E9A40
-.asciiz "Audio:Track:Warning: No Free Notetrack\n"
-.balign 4
-
-glabel D_800E9A68
-.asciiz "SUBTRACK DIM\n"
-.balign 4
-
-glabel D_800E9A78
-.asciiz "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n"
-.balign 4
-
-glabel D_800E9AB8
-.asciiz "SEQID %d,BANKID %d\n"
-.balign 4
-
-glabel D_800E9ACC
-.asciiz "ERR:SUBTRACK %d NOT ALLOCATED\n"
-.balign 4
-
-glabel D_800E9AEC
-.asciiz "Error:Same List Add\n"
-.balign 4
-
-glabel D_800E9B04
-.asciiz "Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9B20
-.asciiz "Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9B3C
-.asciiz "WARNING: NPRG: cannot change %d\n"
-.balign 4
-
-glabel D_800E9B60
-.asciiz "Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n"
-.balign 4
-
-glabel D_800E9B8C
-.asciiz "Audio: Note:Velocity Error %d\n"
-.balign 4
-
-glabel D_800E9BAC
-.asciiz "Error: Subtrack no prg.\n"
-.balign 4
-
-glabel D_800E9BC8
-.asciiz "ERR %x\n"
-.balign 4
-
-glabel D_800E9BD0
-.asciiz "Error: Your assignchannel is stolen.\n"
-.balign 4
-
-glabel D_800E9BF8
-.asciiz "Audio:Track :Call Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9C24
-.asciiz "Audio:Track :Loops Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9C50
-.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
-.balign 4
-
-glabel D_800E9C70
-.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
-.balign 4
-
-glabel D_800E9C90
-.asciiz "Audio:Track: CTBLCALL Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9CC0
-.asciiz "[%2x] \n"
-.balign 4
-
-glabel D_800E9CC8
-.asciiz "Err :Sub %x ,address %x:Undefined SubTrack Function %x"
-.balign 4
-
-glabel D_800E9D00
-.asciiz "Disappear Sequence or Bank %d\n"
-.balign 4
-
-glabel D_800E9D20
-.asciiz "Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9D3C
-.asciiz "Macro Level Over Error!\n"
-.balign 4
-
-glabel D_800E9D58
-.asciiz "Group:Undefine upper C0h command (%x)\n"
-.balign 4
-
-glabel D_800E9D80
-.asciiz "Group:Undefined Command\n"
-.balign 4
-
-.balign 0x10
-
-glabel D_800E9DA0
-.byte 0x00
-
-.balign 4
-
-# TODO: unused?
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9DB4
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9DC4
-.float 1.0, 1.0, 1.0, 1.0
-
-glabel D_800E9DD4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9DE4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9DF4
-.float 0.0, 0.0, 0.0, 0.0
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9E14
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E24
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E34
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E54
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E64
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E74
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E84
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9E94
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9EA4
-.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800E9EB4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9EC4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9ED4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9EE4
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9EF4
-.float 1.0, 1.0, 1.0, 1.0
-
-glabel D_800E9F04
-.float 1.0, 1.0, 1.0, 1.0
-
-glabel D_800E9F14
-.float 1.0, 1.0, 1.0, 1.0
-
-glabel D_800E9F24
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
-glabel D_800E9F2C
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
-glabel D_800E9F34
-.float 0.0, 0.0, 0.0, 0.0
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9F54
-.float 0.0, 0.0, 0.0, 0.0
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800E9F74
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800E9F78
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800E9F7C
-.float 0.0, 0.0, 0.0, 1.0
-
-glabel D_800E9F8C
-.float 1.0
-
-glabel D_800E9F90
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800E9F94
-.float 3800.0, 3.4
-.float 0.4, -1.0, 0.4, 1100.0
-.float 630.0, 3600.0, 1.0, 0.0
-.float 0.0, 0.0, 1.0, 1.0
-.float 0.0, 3800.0, 3.4, 0.4
-.float -1.0, 0.4, 1100.0, 630.0
-.float 3600.0, 1.0, 0.0, 0.0
-.float 0.0, 1.0, 1.0, 0.0
-.float 3800.0, 3.4, 0.4, -1.0
-.float 0.4, 1100.0, 630.0, 3600.0
-.float 1.0, 0.0, 0.0, 0.0
-.float 1.0, 1.0, 0.0, 3800.0
-.float 3.4, 0.4, -1.0, 0.4
-.float 1100.0, 630.0, 3600.0, 1.0
-
-.macro Entry800EA06C f0, f1, f2, b0
-.float \f0, \f1, \f2
-.byte \b0, 0x00, 0x00, 0x00
-.endm
-
-glabel D_800EA06C
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-Entry800EA06C 0.0, 1.0, 1.0, 0x0
-
-glabel D_800EA0EC
-.byte 0x00
-glabel D_800EA0ED
-.byte 0x00
-glabel D_800EA0EE
-.byte 0x00
-glabel D_800EA0EF
-.byte 0x00
-
-glabel D_800EA0F0
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800EA0F4
-.byte 0x00, 0x00, 0x00, 0x00
-
-.word 0x00000000, 0x00000000, 0x3f800000
-
-glabel D_800EA104
-.word 0x00000000
-
-glabel D_800EA108
-.word 0x00000000
-
-glabel D_800EA10C
-.word 0x00000000
-
-glabel D_800EA110
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800EA120
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800EA130
-.float 0.0, 0.0, 0.0, 0.0
-.float 0.0, 0.0, 0.0, 0.0
-
-glabel D_800EA150
-.float 1.4
-
-glabel D_800EA154
-.byte 0x02, 0x02, 0x58, 0x5a, 0x03, 0x30, 0x58, 0x30
-
-glabel D_800EA15C
-.word 0x00000000
-
-glabel D_800EA160
-.word 0x00000000
-
-glabel D_800EA164
-.word 0x00000000
-
-glabel D_800EA168
-.word 0x00000000
-
-glabel D_800EA16C
-.word 0x00000000
-
-glabel D_800EA170
-.word 0x00000000
-
-glabel D_800EA174
-.word 0x00000000
-
-glabel D_800EA178
-.word 0x3f800000
-
-glabel D_800EA17C
-.word 0x3f59999a
-
-glabel D_800EA180
-.word 0x00000000
-
-glabel D_800EA184
-.word 0x00000000
-
-glabel D_800EA188
-.byte 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x06, 0x02, 0x02, 0x02, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00
-.byte 0x01, 0x01, 0x08, 0x02, 0x02, 0x00, 0x01, 0x01
-
-glabel D_800EA1A0
-.byte 0x04, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x01
-.byte 0x01, 0x02, 0x02, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01
-
-glabel D_800EA1B8
-.word 0x00000000
-
-glabel D_800EA1BC
-.word 0x00000000
-
-glabel D_800EA1C0
-.word 0x00000000
-
-glabel D_800EA1C4
-.word 0x00000000
-
-glabel D_800EA1C8
-.word 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800EA1D4
-.word 0x3f800000, 0x00000000
-
-glabel D_800EA1DC
-.word 0x00000000, 0x00000000
-
-glabel D_800EA1E4
-.word 0x00000000
-
-glabel D_800EA1E8
-.word 0x00000000
-
-glabel D_800EA1EC
-.word 0x00000000
-
-glabel D_800EA1F0
-.byte 0x00, 0x01, 0x02, 0x03
-
-glabel D_800EA1F4
-.byte 0x00, 0x00, 0x00, 0x00
-
-.asciiz "Error : Queue is not empty ( %x ) \n"
-.balign 4
-
-.asciiz "specchg error\n"
-.balign 4
-
-.asciiz "***** CAM MAX %d *****\n"
-.balign 4
-
-glabel D_800EA244
-.byte 0x00, 0x00, 0x00, 0x00
-
-.asciiz "entryout !!! %d\n"
-.balign 4
-
-.asciiz "AFTER GOAL VOICE FLAME %d\n"
-.balign 4
-
-.asciiz "*** Pause On ***\n"
-.balign 4
-
-.asciiz "*** Pause Off ***\n"
-.balign 4
-
-.asciiz "CALLED!! Na_ChangeSoundMode player %d\n"
-.balign 4
-
-.asciiz "CALLED!! Na_ChangeSoundMode spec %d\n"
-.balign 4
-
-.asciiz "Interfaced Spec Change player %d\n"
-.balign 4
-
-.asciiz "Interfaced Spec Change spec %d\n"
-.balign 4
-
-.word 0xff000000, 0xff000000, 0x00000000
-
-.asciiz "FX MIX %d\n"
-.balign 4
-
-.asciiz "************** Seq Fadeout ***************\n"
-.balign 4
-
-.asciiz "SEQ FADE OUT TIME %d\n"
-.balign 4
-
-.word 0x00000000, 0x00000000, 0x00000000
-
-glabel D_800EA3A0
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800EA3A4
-.byte 0x00, 0x00, 0x00, 0x00
-
-glabel D_800EA3A8
-.word D_801937C0
-
-glabel D_800EA3AC
-.word D_801937D8
-
-glabel D_800EA3B0
-.word D_801937F0
-
-glabel D_800EA3B4
-.word D_80193808
-
-.asciiz "DAC:Lost 1 Frame.\n"
-.balign 4
-
-.asciiz "DMA: Request queue over.( %d )\n"
-.balign 4
-
-.asciiz "DMA [ %d lines] TIMEOUT\n"
-.balign 4
-
-.asciiz "Warning: WaveDmaQ contains %d msgs.\n"
-.balign 4
-
-.asciiz "Audio:now-max tasklen is %d / %d\n"
-.balign 4
-
-.asciiz "Audio:Warning:ABI Tasklist length over (%d)\n"
-.balign 4
-
-glabel D_800EA484
-.word 0x00000080
-
-.asciiz "AudioSend: %d -> %d (%d)\n"
-.balign 4
-
-glabel D_800EA4A4
-.word 0x00000000
-
-.asciiz "Undefined Port Command %d\n"
-.balign 4
-
-.word 0x00000000, 0x00000000, 0x00000000
-
-.balign 4
-glabel D_800EA4D0
-.word 0x01284fff
-
-glabel D_800EA4D4
-.word 0x01145fff
-
-glabel D_800EA4D8
-.word 0x000068b0, 0x01180100, D_800EA4D0, 0x7fff0000
-.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
-.word 0x00002800, 0x00000000, 0x000068b0, 0x01140100
-.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
-.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
-.word 0x000068b0, 0x011c0100, D_800EA4D0, 0x7fff0000
-.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
-.word 0x00002800, 0x00000000, 0x000068b0, 0x011c0100
-.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
-.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
-.word 0x000068b0, 0x01100100, D_800EA4D0, 0x7fff0000
-.word 0x00002a00, 0x00004600, 0x00000000, 0x00004800
-.word 0x00002000, 0x00000000, 0x000068b0, 0x01100100
-.word D_800EA4D4, 0x7fff0000, 0x00002a00, 0x00004600
-.word 0x00000000, 0x00004800, 0x00002000, 0x00000000
-.word 0x1c000000
-
-glabel D_800EA5CC
-.hword 0x0030, 0x0000
-
-glabel D_800EA5D0
-.word 0x00048c00
-
-glabel D_800EA5D4
-.word 0x00002600
-
-glabel D_800EA5D8
-.word 0x00000000
-
-glabel D_800EA5DC
-.word 0x00000000
+#glabel D_800E932C
+#.asciiz "Romcopyend\n"
+#.balign 4
diff --git a/data/data_0DD0A0_2_1_0.s b/data/data_0DD0A0_2_1_0.s
new file mode 100644
index 000000000..d2dc6611b
--- /dev/null
+++ b/data/data_0DD0A0_2_1_0.s
@@ -0,0 +1,699 @@
+.include "macros.inc"
+
+.section .rodata
+
+#glabel D_800E94A4
+#.asciiz "Seq %d Loading Start\n"
+#.balign 4
+
+#glabel D_800E94BC
+#.asciiz "Heap Overflow Error\n"
+#.balign 4
+
+#glabel D_800E94D4
+#.asciiz "SEQ %d ALREADY CACHED\n"
+#.balign 4
+
+#glabel D_800E94EC
+#.asciiz "Ok,one bank slow load Start \n"
+#.balign 4
+
+#glabel D_800E950C
+#.asciiz "Sorry,too many %d bank is none.fast load Start \n"
+#.balign 4
+
+
+
+
+
+glabel D_800E9540
+.asciiz "Seq %d:Default Load Id is %d\n"
+.balign 4
+
+glabel D_800E9560
+.asciiz "Seq Loading Start\n"
+.balign 4
+
+glabel D_800E9574
+.asciiz "Error:Before Sequence-SlowDma remain.\n"
+.balign 4
+
+glabel D_800E959C
+.asciiz " Cancel Seq Start.\n"
+.balign 4
+
+glabel D_800E95B8
+.asciiz "SEQ %d ALREADY CACHED\n"
+.balign 4
+
+glabel D_800E95D0
+.asciiz "Clear Workarea %x -%x size %x \n"
+.balign 4
+
+glabel D_800E95F0
+.asciiz "AudioHeap is %x\n"
+.balign 4
+
+glabel D_800E9604
+.asciiz "Heap reset.Synth Change %x \n"
+.balign 4
+
+glabel D_800E9624
+.asciiz "Heap %x %x %x\n"
+.balign 4
+
+glabel D_800E9634
+.asciiz "Main Heap Initialize.\n"
+.balign 4
+
+glabel D_800E964C
+.asciiz "---------- Init Completed. ------------\n"
+.balign 4
+
+glabel D_800E9678
+.asciiz " Syndrv :[%6d]\n"
+.balign 4
+
+glabel D_800E968C
+.asciiz " Seqdrv :[%6d]\n"
+.balign 4
+
+glabel D_800E96A0
+.asciiz " audiodata :[%6d]\n"
+.balign 4
+
+glabel D_800E96B4
+.asciiz "---------------------------------------\n"
+.balign 4
+
+glabel D_800E96E0
+.asciiz "Audio: setvol: volume minus %f\n"
+.balign 4
+
+glabel D_800E9700
+.asciiz "Audio: setvol: volume overflow %f\n"
+.balign 4
+
+glabel D_800E9724
+.asciiz "Audio: setpitch: pitch minus %f\n"
+.balign 4
+
+glabel D_800E9748
+.asciiz "Audio: voiceman: No bank error %d\n"
+.balign 4
+
+glabel D_800E976C
+.asciiz "Audio: voiceman: progNo. overflow %d,%d\n"
+.balign 4
+
+glabel D_800E9798
+.asciiz "Audio: voiceman: progNo. undefined %d,%d\n"
+.balign 4
+
+glabel D_800E97C4
+.asciiz "Audio: voiceman: No bank error %d\n"
+.balign 4
+
+glabel D_800E97E8
+.asciiz "Audio: voiceman: Percussion Overflow %d,%d\n"
+.balign 4
+
+glabel D_800E9814
+.asciiz "Audio: voiceman: Percussion table pointer (bank %d) is irregular.\n"
+.balign 4
+
+glabel D_800E9858
+.asciiz "Audio: voiceman: Percpointer NULL %d,%d\n"
+.balign 4
+
+glabel D_800E9884
+.asciiz "--4 %x\n"
+.balign 4
+
+glabel D_800E988C
+.asciiz "Stoped Voice\n"
+.balign 4
+
+glabel D_800E989C
+.asciiz "CAUTION:SUB IS SEPARATED FROM GROUP"
+.balign 4
+
+glabel D_800E98C0
+.asciiz "Error:Wait Track disappear\n"
+.balign 4
+
+glabel D_800E98DC
+.asciiz "Slow Release Batting\n"
+.balign 4
+
+glabel D_800E98F4
+.byte 0x40, 0x20, 0x10, 0x08
+
+glabel D_800E98F8
+.asciiz "Audio:Wavemem: Bad voiceno (%d)\n"
+.balign 4
+
+glabel D_800E991C
+.asciiz "Audio: C-Alloc : Dealloc voice is NULL\n"
+.balign 4
+
+glabel D_800E9944
+.asciiz "Alloc Error:Dim voice-Alloc %d"
+.balign 4
+
+glabel D_800E9964
+.asciiz "Error:Same List Add\n"
+.balign 4
+
+glabel D_800E997C
+.asciiz "Already Cut\n"
+.balign 4
+
+glabel D_800E998C
+.asciiz "Audio: C-Alloc : lowerPrio is NULL\n"
+.balign 4
+
+glabel D_800E99B0
+.asciiz "Sub Limited Warning: Drop Voice"
+.balign 4
+
+glabel D_800E99D0
+.asciiz "Warning: Drop Voice"
+.balign 4
+
+glabel D_800E99E4
+.asciiz "Warning: Drop Voice"
+.balign 4
+
+glabel D_800E99F8
+.asciiz "Warning: Drop Voice"
+.balign 4
+
+.balign 0x10
+
+glabel D_800E9A10
+.asciiz "Env-Clear 0\n"
+.balign 4
+
+glabel D_800E9A20
+.asciiz "Audio:Envp: overflow %f\n"
+.balign 4
+
+.balign 0x10
+
+glabel D_800E9A40
+.asciiz "Audio:Track:Warning: No Free Notetrack\n"
+.balign 4
+
+glabel D_800E9A68
+.asciiz "SUBTRACK DIM\n"
+.balign 4
+
+glabel D_800E9A78
+.asciiz "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n"
+.balign 4
+
+glabel D_800E9AB8
+.asciiz "SEQID %d,BANKID %d\n"
+.balign 4
+
+glabel D_800E9ACC
+.asciiz "ERR:SUBTRACK %d NOT ALLOCATED\n"
+.balign 4
+
+glabel D_800E9AEC
+.asciiz "Error:Same List Add\n"
+.balign 4
+
+glabel D_800E9B04
+.asciiz "Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9B20
+.asciiz "Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9B3C
+.asciiz "WARNING: NPRG: cannot change %d\n"
+.balign 4
+
+glabel D_800E9B60
+.asciiz "Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n"
+.balign 4
+
+glabel D_800E9B8C
+.asciiz "Audio: Note:Velocity Error %d\n"
+.balign 4
+
+glabel D_800E9BAC
+.asciiz "Error: Subtrack no prg.\n"
+.balign 4
+
+glabel D_800E9BC8
+.asciiz "ERR %x\n"
+.balign 4
+
+glabel D_800E9BD0
+.asciiz "Error: Your assignchannel is stolen.\n"
+.balign 4
+
+glabel D_800E9BF8
+.asciiz "Audio:Track :Call Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9C24
+.asciiz "Audio:Track :Loops Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9C50
+.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
+.balign 4
+
+glabel D_800E9C70
+.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
+.balign 4
+
+glabel D_800E9C90
+.asciiz "Audio:Track: CTBLCALL Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9CC0
+.asciiz "[%2x] \n"
+.balign 4
+
+glabel D_800E9CC8
+.asciiz "Err :Sub %x ,address %x:Undefined SubTrack Function %x"
+.balign 4
+
+glabel D_800E9D00
+.asciiz "Disappear Sequence or Bank %d\n"
+.balign 4
+
+glabel D_800E9D20
+.asciiz "Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9D3C
+.asciiz "Macro Level Over Error!\n"
+.balign 4
+
+glabel D_800E9D58
+.asciiz "Group:Undefine upper C0h command (%x)\n"
+.balign 4
+
+glabel D_800E9D80
+.asciiz "Group:Undefined Command\n"
+.balign 4
+
+.balign 0x10
+
+glabel D_800E9DA0
+.byte 0x00
+
+.balign 4
+
+# TODO: unused?
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9DB4
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9DC4
+.float 1.0, 1.0, 1.0, 1.0
+
+glabel D_800E9DD4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9DE4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9DF4
+.float 0.0, 0.0, 0.0, 0.0
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9E14
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E24
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E34
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E54
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E64
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E74
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E84
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9E94
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9EA4
+.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800E9EB4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9EC4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9ED4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9EE4
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9EF4
+.float 1.0, 1.0, 1.0, 1.0
+
+glabel D_800E9F04
+.float 1.0, 1.0, 1.0, 1.0
+
+glabel D_800E9F14
+.float 1.0, 1.0, 1.0, 1.0
+
+glabel D_800E9F24
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+glabel D_800E9F2C
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+glabel D_800E9F34
+.float 0.0, 0.0, 0.0, 0.0
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9F54
+.float 0.0, 0.0, 0.0, 0.0
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800E9F74
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800E9F78
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800E9F7C
+.float 0.0, 0.0, 0.0, 1.0
+
+glabel D_800E9F8C
+.float 1.0
+
+glabel D_800E9F90
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800E9F94
+.float 3800.0, 3.4
+.float 0.4, -1.0, 0.4, 1100.0
+.float 630.0, 3600.0, 1.0, 0.0
+.float 0.0, 0.0, 1.0, 1.0
+.float 0.0, 3800.0, 3.4, 0.4
+.float -1.0, 0.4, 1100.0, 630.0
+.float 3600.0, 1.0, 0.0, 0.0
+.float 0.0, 1.0, 1.0, 0.0
+.float 3800.0, 3.4, 0.4, -1.0
+.float 0.4, 1100.0, 630.0, 3600.0
+.float 1.0, 0.0, 0.0, 0.0
+.float 1.0, 1.0, 0.0, 3800.0
+.float 3.4, 0.4, -1.0, 0.4
+.float 1100.0, 630.0, 3600.0, 1.0
+
+.macro Entry800EA06C f0, f1, f2, b0
+.float \f0, \f1, \f2
+.byte \b0, 0x00, 0x00, 0x00
+.endm
+
+glabel D_800EA06C
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+Entry800EA06C 0.0, 1.0, 1.0, 0x0
+
+glabel D_800EA0EC
+.byte 0x00
+glabel D_800EA0ED
+.byte 0x00
+glabel D_800EA0EE
+.byte 0x00
+glabel D_800EA0EF
+.byte 0x00
+
+glabel D_800EA0F0
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800EA0F4
+.byte 0x00, 0x00, 0x00, 0x00
+
+.word 0x00000000, 0x00000000, 0x3f800000
+
+glabel D_800EA104
+.word 0x00000000
+
+glabel D_800EA108
+.word 0x00000000
+
+glabel D_800EA10C
+.word 0x00000000
+
+glabel D_800EA110
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800EA120
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800EA130
+.float 0.0, 0.0, 0.0, 0.0
+.float 0.0, 0.0, 0.0, 0.0
+
+glabel D_800EA150
+.float 1.4
+
+glabel D_800EA154
+.byte 0x02, 0x02, 0x58, 0x5a, 0x03, 0x30, 0x58, 0x30
+
+glabel D_800EA15C
+.word 0x00000000
+
+glabel D_800EA160
+.word 0x00000000
+
+glabel D_800EA164
+.word 0x00000000
+
+glabel D_800EA168
+.word 0x00000000
+
+glabel D_800EA16C
+.word 0x00000000
+
+glabel D_800EA170
+.word 0x00000000
+
+glabel D_800EA174
+.word 0x00000000
+
+glabel D_800EA178
+.word 0x3f800000
+
+glabel D_800EA17C
+.word 0x3f59999a
+
+glabel D_800EA180
+.word 0x00000000
+
+glabel D_800EA184
+.word 0x00000000
+
+glabel D_800EA188
+.byte 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x06, 0x02, 0x02, 0x02, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00
+.byte 0x01, 0x01, 0x08, 0x02, 0x02, 0x00, 0x01, 0x01
+
+glabel D_800EA1A0
+.byte 0x04, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x01
+.byte 0x01, 0x02, 0x02, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01
+
+glabel D_800EA1B8
+.word 0x00000000
+
+glabel D_800EA1BC
+.word 0x00000000
+
+glabel D_800EA1C0
+.word 0x00000000
+
+glabel D_800EA1C4
+.word 0x00000000
+
+glabel D_800EA1C8
+.word 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800EA1D4
+.word 0x3f800000, 0x00000000
+
+glabel D_800EA1DC
+.word 0x00000000, 0x00000000
+
+glabel D_800EA1E4
+.word 0x00000000
+
+glabel D_800EA1E8
+.word 0x00000000
+
+glabel D_800EA1EC
+.word 0x00000000
+
+glabel D_800EA1F0
+.byte 0x00, 0x01, 0x02, 0x03
+
+glabel D_800EA1F4
+.byte 0x00, 0x00, 0x00, 0x00
+
+.asciiz "Error : Queue is not empty ( %x ) \n"
+.balign 4
+
+.asciiz "specchg error\n"
+.balign 4
+
+.asciiz "***** CAM MAX %d *****\n"
+.balign 4
+
+glabel D_800EA244
+.byte 0x00, 0x00, 0x00, 0x00
+
+.asciiz "entryout !!! %d\n"
+.balign 4
+
+.asciiz "AFTER GOAL VOICE FLAME %d\n"
+.balign 4
+
+.asciiz "*** Pause On ***\n"
+.balign 4
+
+.asciiz "*** Pause Off ***\n"
+.balign 4
+
+.asciiz "CALLED!! Na_ChangeSoundMode player %d\n"
+.balign 4
+
+.asciiz "CALLED!! Na_ChangeSoundMode spec %d\n"
+.balign 4
+
+.asciiz "Interfaced Spec Change player %d\n"
+.balign 4
+
+.asciiz "Interfaced Spec Change spec %d\n"
+.balign 4
+
+.word 0xff000000, 0xff000000, 0x00000000
+
+.asciiz "FX MIX %d\n"
+.balign 4
+
+.asciiz "************** Seq Fadeout ***************\n"
+.balign 4
+
+.asciiz "SEQ FADE OUT TIME %d\n"
+.balign 4
+
+.word 0x00000000, 0x00000000, 0x00000000
+
+glabel D_800EA3A0
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800EA3A4
+.byte 0x00, 0x00, 0x00, 0x00
+
+glabel D_800EA3A8
+.word D_801937C0
+
+glabel D_800EA3AC
+.word D_801937D8
+
+glabel D_800EA3B0
+.word D_801937F0
+
+glabel D_800EA3B4
+.word D_80193808
+
+.asciiz "DAC:Lost 1 Frame.\n"
+.balign 4
+
+.asciiz "DMA: Request queue over.( %d )\n"
+.balign 4
+
+.asciiz "DMA [ %d lines] TIMEOUT\n"
+.balign 4
+
+.asciiz "Warning: WaveDmaQ contains %d msgs.\n"
+.balign 4
+
+.asciiz "Audio:now-max tasklen is %d / %d\n"
+.balign 4
+
+.asciiz "Audio:Warning:ABI Tasklist length over (%d)\n"
+.balign 4
+
+glabel D_800EA484
+.word 0x00000080
+
+.asciiz "AudioSend: %d -> %d (%d)\n"
+.balign 4
+
+glabel D_800EA4A4
+.word 0x00000000
+
+.asciiz "Undefined Port Command %d\n"
+.balign 4
+
+.word 0x00000000, 0x00000000, 0x00000000
+
+.balign 4
+glabel D_800EA4D0
+.word 0x01284fff
+
+glabel D_800EA4D4
+.word 0x01145fff
+
+glabel D_800EA4D8
+.word 0x000068b0, 0x01180100, D_800EA4D0, 0x7fff0000
+.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
+.word 0x00002800, 0x00000000, 0x000068b0, 0x01140100
+.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
+.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
+.word 0x000068b0, 0x011c0100, D_800EA4D0, 0x7fff0000
+.word 0x00002a00, 0x00004600, 0x00000000, 0x00005800
+.word 0x00002800, 0x00000000, 0x000068b0, 0x011c0100
+.word D_800EA4D0, 0x7fff0000, 0x00002a00, 0x00004600
+.word 0x00000000, 0x00005800, 0x00002800, 0x00000000
+.word 0x000068b0, 0x01100100, D_800EA4D0, 0x7fff0000
+.word 0x00002a00, 0x00004600, 0x00000000, 0x00004800
+.word 0x00002000, 0x00000000, 0x000068b0, 0x01100100
+.word D_800EA4D4, 0x7fff0000, 0x00002a00, 0x00004600
+.word 0x00000000, 0x00004800, 0x00002000, 0x00000000
+.word 0x1c000000
+
+glabel D_800EA5CC
+.hword 0x0030, 0x0000
+
+glabel D_800EA5D0
+.word 0x00048c00
+
+glabel D_800EA5D4
+.word 0x00002600
+
+glabel D_800EA5D8
+.word 0x00000000
+
+glabel D_800EA5DC
+.word 0x00000000
diff --git a/include/PR/ultratypes.h b/include/PR/ultratypes.h
index 1f0d3e012..f4cf12249 100644
--- a/include/PR/ultratypes.h
+++ b/include/PR/ultratypes.h
@@ -37,6 +37,7 @@ typedef s32 intptr_t;
typedef s32 ptrdiff_t;
#else
#include <stddef.h>
+typedef ptrdiff_t ssize_t;
#endif
#endif
diff --git a/include/common_structs.h b/include/common_structs.h
index f86aff166..0006f1a71 100644
--- a/include/common_structs.h
+++ b/include/common_structs.h
@@ -387,7 +387,7 @@ typedef struct {
/* 0x023A */ s16 unk_23A;
/* 0x023C */ f32 unk_23C;
/* 0x0240 */ s32 unk_240;
- /* 0x0244 */ u16 unk_244[4];
+ /* 0x0244 */ u16 unk_244[4]; // [0] Active texture group
/* 0x0244 */ u16 unk_24C[4];
/* 0x0254 */ u16 characterId;
/* 0x0256 */ s16 unk_256;
diff --git a/mk64.ld b/mk64.ld
index c3d28a3d5..3cabe0c88 100644
--- a/mk64.ld
+++ b/mk64.ld
@@ -224,8 +224,12 @@ SECTIONS
BUILD_DIR/data/data_0DD0A0_1.o(.data);
BUILD_DIR/src/code_8001C4D0.o(.data);
BUILD_DIR/data/data_0DD0A0_1_1.o(.data);
+ BUILD_DIR/src/code_80027040.o(.data);
+ BUILD_DIR/data/data_0DD0A0_1_2.o(.data);
BUILD_DIR/src/kart_attributes.inc.o(.data);
BUILD_DIR/data/data_0DD0A0_2.o(.rodata);
+ BUILD_DIR/src/audio/load.o(.rodata*);
+ BUILD_DIR/data/data_0DD0A0_2_1_0.o(.rodata);
BUILD_DIR/src/os/osInitialize.o(.data*);
BUILD_DIR/src/os/osCreateViManager.o(.data);
BUILD_DIR/src/os/osViTable.o(.data);
diff --git a/src/audio/data.h b/src/audio/data.h
index cca619756..9dddc3e81 100644
--- a/src/audio/data.h
+++ b/src/audio/data.h
@@ -3,6 +3,13 @@
#include "internal.h"
+#define AUDIO_LOCK_UNINITIALIZED 0
+#define AUDIO_LOCK_NOT_LOADING 0x76557364
+#define AUDIO_LOCK_LOADING 0x19710515
+
extern struct AdsrEnvelope gDefaultEnvelope[3];
+// number of DMAs performed during this frame
+extern s32 gCurrAudioFrameDmaCount;
+
#endif
diff --git a/src/audio/effects.c b/src/audio/effects.c
index c436bdb09..cfaa049e6 100644
--- a/src/audio/effects.c
+++ b/src/audio/effects.c
@@ -314,7 +314,7 @@ GLOBAL_ASM("asm/non_matchings/audio/effects/func_800BE5BC.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
-extern ? D_803B7088;
+extern ? gAudioBufferParameters;
f32 func_800BE5E0(void *arg0) {
f32 temp_f0;
@@ -352,7 +352,7 @@ loop_6:
arg0->unk1 = 0;
} else {
if (temp_a2 >= 4) {
- arg0->unk4 = ((temp_a2 * D_803B7088.unkC) / D_803B7088.unk0) / 4;
+ arg0->unk4 = ((temp_a2 * gAudioBufferParameters.unkC) / gAudioBufferParameters.unk0) / 4;
}
phi_a2 = arg0->unk4;
if (arg0->unk4 == 0) {
diff --git a/src/audio/heap.c b/src/audio/heap.c
index 2f5e9d08f..6e05f6b69 100644
--- a/src/audio/heap.c
+++ b/src/audio/heap.c
@@ -1,5 +1,8 @@
#include <ultra64.h>
#include <macros.h>
+#include "heap.h"
+
+extern struct SoundAllocPool gNotesAndBuffersPool;
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -61,7 +64,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B8DE0.s")
? func_800BF004(? *, void *); // extern
extern s32 D_803B1508;
extern ? D_803B5FC8;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
void func_800B8EA8(s32 arg0) {
s32 temp_s2;
@@ -73,7 +76,7 @@ void func_800B8EA8(s32 arg0) {
s32 phi_s2;
s32 phi_v0;
- temp_v0 = D_803B70B0;
+ temp_v0 = gMaxSimultaneousNotes;
phi_s2 = 0;
phi_v0 = temp_v0;
if (temp_v0 > 0) {
@@ -90,7 +93,7 @@ void func_800B8EA8(s32 arg0) {
func_800BCB48(temp_s0);
func_800BD6F4(temp_s0);
func_800BF004(&D_803B5FC8, temp_s0);
- phi_v0 = D_803B70B0;
+ phi_v0 = gMaxSimultaneousNotes;
}
temp_s2 = phi_s2 + 1;
phi_s1 += 0xC0;
@@ -127,7 +130,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B8F8C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-u32 func_800B8FFC(void *arg0, s32 arg1) {
+u32 soundAlloc(void *arg0, s32 arg1) {
s32 temp_t6;
s8 *temp_a1;
u32 temp_a2;
@@ -153,7 +156,7 @@ u32 func_800B8FFC(void *arg0, s32 arg1) {
return 0;
}
#else
-GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B8FFC.s")
+GLOBAL_ASM("asm/non_matchings/audio/heap/soundAlloc.s")
#endif
#ifdef MIPS_TO_C
@@ -222,16 +225,16 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B90F0.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32); // extern
+s32 soundAlloc(? *, s32); // extern
? func_800B907C(? *, s32, s32); // extern
extern ? D_803AFBC8;
-extern ? D_803AFBE8;
+extern ? gNotesAndBuffersPool;
extern ? D_803AFC18;
void func_800B914C(void *arg0) {
D_803AFBC8.unk4 = D_803AFBC8.unk0;
- func_800B907C(&D_803AFBE8, func_800B8FFC(&D_803AFBC8, arg0->unk0), arg0->unk0);
- func_800B907C(&D_803AFC18, func_800B8FFC(&D_803AFBC8, arg0->unkC), arg0->unkC);
+ func_800B907C(&gNotesAndBuffersPool, soundAlloc(&D_803AFBC8, arg0->unk0), arg0->unk0);
+ func_800B907C(&D_803AFC18, soundAlloc(&D_803AFBC8, arg0->unkC), arg0->unkC);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B914C.s")
@@ -239,7 +242,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B914C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32); // extern
+s32 soundAlloc(? *, s32); // extern
? func_800B907C(? *, s32, s32); // extern
extern ? D_803AFC18;
extern ? D_803AFC28;
@@ -247,8 +250,8 @@ extern ? D_803AFC38;
void func_800B91C8(void *arg0) {
D_803AFC18.unk4 = D_803AFC18.unk0;
- func_800B907C(&D_803AFC28, func_800B8FFC(&D_803AFC18, arg0->unk0), arg0->unk0);
- func_800B907C(&D_803AFC38, func_800B8FFC(&D_803AFC18, arg0->unk4), arg0->unk4);
+ func_800B907C(&D_803AFC28, soundAlloc(&D_803AFC18, arg0->unk0), arg0->unk0);
+ func_800B907C(&D_803AFC38, soundAlloc(&D_803AFC18, arg0->unk4), arg0->unk4);
}
#else
GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B91C8.s")
@@ -256,7 +259,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B91C8.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32); // extern
+s32 soundAlloc(? *, s32); // extern
? func_800B907C(? *, s32, s32); // extern
? func_800B909C(? *); // extern
extern ? D_803AFC28;
@@ -269,9 +272,9 @@ extern ? D_803AFFEC;
void func_800B9244(void *arg0) {
D_803AFC28.unk4 = D_803AFC28.unk0;
- func_800B907C(&D_803AFC4C, func_800B8FFC(&D_803AFC28, arg0->unk0), arg0->unk0);
- func_800B907C(&D_803AFE1C, func_800B8FFC(&D_803AFC28, arg0->unk4), arg0->unk4);
- func_800B907C(&D_803AFFEC, func_800B8FFC(&D_803AFC28, arg0->unk8), arg0->unk8);
+ func_800B907C(&D_803AFC4C, soundAlloc(&D_803AFC28, arg0->unk0), arg0->unk0);
+ func_800B907C(&D_803AFE1C, soundAlloc(&D_803AFC28, arg0->unk4), arg0->unk4);
+ func_800B907C(&D_803AFFEC, soundAlloc(&D_803AFC28, arg0->unk8), arg0->unk8);
func_800B909C(&D_803AFC48);
func_800B909C(&D_803AFE18);
func_800B909C(&D_803AFFE8);
@@ -282,7 +285,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B9244.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32); // extern
+s32 soundAlloc(? *, s32); // extern
? func_800B907C(? *, s32, s32); // extern
? func_800B90B0(? *); // extern
extern ? D_803AFC38;
@@ -295,9 +298,9 @@ extern ? D_803B0180;
void func_800B9300(void *arg0) {
D_803AFC38.unk4 = D_803AFC38.unk0;
- func_800B907C(&D_803AFDE0, func_800B8FFC(&D_803AFC38, arg0->unk0), arg0->unk0);
- func_800B907C(&D_803AFFB0, func_800B8FFC(&D_803AFC38, arg0->unk4), arg0->unk4);
- func_800B907C(&D_803B0180, func_800B8FFC(&D_803AFC38, arg0->unk8), arg0->unk8);
+ func_800B907C(&D_803AFDE0, soundAlloc(&D_803AFC38, arg0->unk0), arg0->unk0);
+ func_800B907C(&D_803AFFB0, soundAlloc(&D_803AFC38, arg0->unk4), arg0->unk4);
+ func_800B907C(&D_803B0180, soundAlloc(&D_803AFC38, arg0->unk8), arg0->unk8);
func_800B90B0(&D_803AFDDC);
func_800B90B0(&D_803AFFAC);
func_800B90B0(&D_803B017C);
@@ -310,7 +313,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B9300.s")
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B8EA8(s16, s32, s16, s32 *); // extern
? func_800B8F8C(s16, s32); // extern
-s32 func_800B8FFC(s32, s32); // extern
+s32 soundAlloc(s32, s32); // extern
extern ? D_803AFC48;
extern ? D_803AFE18;
extern ? D_803AFFE8;
@@ -320,7 +323,7 @@ extern ? D_803B0400;
extern void *D_803B1508;
extern ? D_803B1510;
extern ? D_803B1A30;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
u32 func_800B93BC(s32 *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
? *sp34;
@@ -426,7 +429,7 @@ loop_1:
phi_t2_2 = phi_t2;
if (sp33 == 1) {
if (phi_t1 == 4) {
- temp_a1 = D_803B70B0;
+ temp_a1 = gMaxSimultaneousNotes;
phi_v1 = 0;
phi_v1_2 = 0;
if (temp_a1 > 0) {
@@ -452,7 +455,7 @@ loop_18:
}
}
if (phi_t2 == 4) {
- temp_a1_2 = D_803B70B0;
+ temp_a1_2 = gMaxSimultaneousNotes;
phi_v1_3 = 0;
phi_v1_4 = 0;
if (temp_a1_2 > 0) {
@@ -546,7 +549,7 @@ loop_54:
}
if (sp20 == 1) {
if (phi_t1_2 == 2) {
- temp_a1_3 = D_803B70B0;
+ temp_a1_3 = gMaxSimultaneousNotes;
phi_v1_5 = 0;
phi_v1_6 = 0;
if (temp_a1_3 > 0) {
@@ -576,7 +579,7 @@ block_68:
phi_a2 = phi_a2_2;
phi_a2 = phi_a2_2;
if (phi_t2_2 == 2) {
- temp_a1_4 = D_803B70B0;
+ temp_a1_4 = gMaxSimultaneousNotes;
phi_v1_7 = 0;
phi_v1_8 = 0;
if (temp_a1_4 > 0) {
@@ -717,7 +720,7 @@ block_99:
}
arg4 = arg4;
arg3 = phi_a3;
- temp_v0_9 = func_800B8FFC(arg0 + 4, arg1 * arg2);
+ temp_v0_9 = soundAlloc(arg0 + 4, arg1 * arg2);
(arg0 + (*arg0 * 0xC))->unk14 = temp_v0_9;
if (temp_v0_9 == 0) {
if ((arg3 != 0) && (arg3 != 1)) {
@@ -855,7 +858,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800B9FB8.s")
? func_800BEF2C(? *); /* extern */
extern ? D_803B1510;
extern ? D_803B1A30;
-extern ? D_803B7088;
+extern ? gAudioBufferParameters;
s32 func_800BA00C(void) {
? *temp_s0;
@@ -894,7 +897,7 @@ s32 func_800BA00C(void) {
D_803B0504 = temp_v0 - 1;
func_800B9FB8();
} else {
- temp_a2 = D_803B70B0;
+ temp_a2 = gMaxSimultaneousNotes;
phi_v1 = 0;
phi_a0 = 0;
phi_a2 = temp_a2;
@@ -904,10 +907,10 @@ s32 func_800BA00C(void) {
temp_v0_2 = D_803B1508 + phi_v1;
phi_a0 = temp_a0;
if (((temp_v0_2->unkB0 >> 0x1F) != 0) && (temp_v0_2->unk59 != 0)) {
- temp_v0_2->unk68 = D_803B7088.unk18;
+ temp_v0_2->unk68 = gAudioBufferParameters.unk18;
temp_v0_3 = D_803B1508 + phi_v1;
temp_v0_3->unk58 = temp_v0_3->unk58 | 0x10;
- phi_a2 = D_803B70B0;
+ phi_a2 = gMaxSimultaneousNotes;
}
phi_v1 += 0xC0;
} while (temp_a0 < phi_a2);
@@ -967,7 +970,7 @@ GLOBAL_ASM("asm/non_matchings/audio/heap/func_800BA00C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B8DE0(); // extern
-s32 func_800B8FFC(? *, s32); // extern
+s32 soundAlloc(? *, s32); // extern
? func_800B914C(? *, s16, s16, u16); // extern
? func_800B91C8(? *); // extern
? func_800B9244(? *); // extern
@@ -985,17 +988,17 @@ extern u16 D_803AFBC0;
extern u8 D_803AFBC3;
extern s32 D_803AFBC4;
extern s32 D_803AFBD0;
-extern ? D_803AFBE8;
+extern ? gNotesAndBuffersPool;
extern ? D_803B0348;
extern ? D_803B0358;
extern ? D_803B0360;
extern ? D_803B0370;
extern u8 D_803B0501;
extern s32 D_803B1508;
-extern s32 D_803B6E58;
-extern ? D_803B7088;
+extern s32 gSampleDmaNumListItems;
+extern ? gAudioBufferParameters;
extern s32 D_803B70AC;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
extern s16 D_803B70B4;
extern ? D_803B70C8;
extern ? D_803B70D0;
@@ -1034,36 +1037,36 @@ void func_800BA250(void) {
s32 phi_s1;
temp_s6 = (D_803B0501 * 0x28) + &D_800EA4D8;
- D_803B6E58 = 0;
+ gSampleDmaNumListItems = 0;
temp_t9 = temp_s6->unk0;
- D_803B7088.unk2 = temp_t9;
- D_803B7088.unk4 = osAiSetFrequency(temp_t9 & 0xFFFF);
- temp_a3 = D_803B7088.unk2;
- D_803B7088.unk6 = ((temp_a3 / D_803B717C) + 0xF) & 0xFFF0;
- temp_v1 = D_803B7088.unk6;
+ gAudioBufferParameters.unk2 = temp_t9;
+ gAudioBufferParameters.unk4 = osAiSetFrequency(temp_t9 & 0xFFFF);
+ temp_a3 = gAudioBufferParameters.unk2;
+ gAudioBufferParameters.unk6 = ((temp_a3 / D_803B717C) + 0xF) & 0xFFF0;
+ temp_v1 = gAudioBufferParameters.unk6;
temp_t0 = temp_v1 + 0x10;
- D_803B7088.unkA = temp_v1 - 0x10;
- D_803B7088.unk8 = temp_t0;
- D_803B7088.unkC = (temp_t0 / 0xC0) + 1;
- temp_a2 = D_803B7088.unkC;
- D_803B7088.unkE = (temp_v1 / temp_a2) & 0xFFF8;
- temp_t1 = D_803B7088.unkE;
+ gAudioBufferParameters.unkA = temp_v1 - 0x10;
+ gAudioBufferParameters.unk8 = temp_t0;
+ gAudioBufferParameters.unkC = (temp_t0 / 0xC0) + 1;
+ temp_a2 = gAudioBufferParameters.unkC;
+ gAudioBufferParameters.unkE = (temp_v1 / temp_a2) & 0xFFF8;
+ temp_t1 = gAudioBufferParameters.unkE;
temp_f0 = temp_a2;
- D_803B7088.unk10 = temp_t1 + 8;
- D_803B7088.unk12 = temp_t1 - 8;
- D_803B7088.unk14 = 32000.0f / temp_a3;
- D_803B7088.unk1C = D_800F2E98 / temp_f0;
- D_803B7088.unk18 = 1.0f / temp_f0;
- D_803B70B0 = temp_s6->unk5;
+ gAudioBufferParameters.unk10 = temp_t1 + 8;
+ gAudioBufferParameters.unk12 = temp_t1 - 8;
+ gAudioBufferParameters.unk14 = 32000.0f / temp_a3;
+ gAudioBufferParameters.unk1C = D_800F2E98 / temp_f0;
+ gAudioBufferParameters.unk18 = 1.0f / temp_f0;
+ gMaxSimultaneousNotes = temp_s6->unk5;
D_803AFBC0 = temp_s6->unkC;
D_803B70B4 = ((temp_f0 * D_800F2E9C) / D_800EA5CC) / D_803B7178;
- D_803B7088.unk0 = temp_s6->unk4;
- temp_a1 = D_803B7088.unk0;
- D_803B7088.unk6 = temp_v1 * temp_a1;
- D_803B7088.unk8 = D_803B7088.unk8 * temp_a1;
- D_803B7088.unkA = D_803B7088.unkA * temp_a1;
- D_803B7088.unkC = temp_a2 * temp_a1;
- D_803B70AC = (D_803B70B0 * 0x14 * D_803B7088.unkC) + (temp_s6->unk6 << 5) + 0x1E0;
+ gAudioBufferParameters.unk0 = temp_s6->unk4;
+ temp_a1 = gAudioBufferParameters.unk0;
+ gAudioBufferParameters.unk6 = temp_v1 * temp_a1;
+ gAudioBufferParameters.unk8 = gAudioBufferParameters.unk8 * temp_a1;
+ gAudioBufferParameters.unkA = gAudioBufferParameters.unkA * temp_a1;
+ gAudioBufferParameters.unkC = temp_a2 * temp_a1;
+ D_803B70AC = (gMaxSimultaneousNotes * 0x14 * gAudioBufferParameters.unkC) + (temp_s6->unk6 << 5) + 0x1E0;
temp_s0 = temp_s6->unk10 + temp_s6->unk14 + temp_s6->unk18;
temp_s1 = temp_s6->unk1C + temp_s6->unk20 + temp_s6->unk24;
temp_t2 = temp_s0 + temp_s1;
@@ -1082,14 +1085,14 @@ void func_800BA250(void) {
D_803B0370.unk8 = temp_s6->unk24;
func_800B9300(&D_803B0370);
func_800B8DE0();
- D_803B1508 = func_800B8FFC(&D_803AFBE8, D_803B70B0 * 0xC0);
+ D_803B1508 = soundAlloc(&gNotesAndBuffersPool, gMaxSimultaneousNotes * 0xC0);
func_800BDD34();
func_800BD368();
- D_803AFBC4 = func_800B8FFC(&D_803AFBE8, D_803B7088.unkC * D_803B70B0 * 0x10);
+ D_803AFBC4 = soundAlloc(&gNotesAndBuffersPool, gAudioBufferParameters.unkC * gMaxSimultaneousNotes * 0x10);
phi_s0 = &D_803B70C8;
do {
temp_s0_2 = phi_s0 + 4;
- temp_s0_2->unk-4 = func_800B8FFC(&D_803AFBE8, D_803B70AC * 8);
+ temp_s0_2->unk-4 = soundAlloc(&gNotesAndBuffersPool, D_803B70AC * 8);
phi_s0 = temp_s0_2;
} while (temp_s0_2 != &D_803B70D0);
phi_s2 = &D_803AF790;
@@ -1109,9 +1112,9 @@ void func_800BA250(void) {
phi_s2_2->unk4 = temp_v0->unk0;
phi_s2_2->unk1 = 8;
phi_s2_2->unk8 = temp_v0->unk2;
- phi_s2_2->unk18 = func_800B8FFC(&D_803AFBE8, (temp_t7 & 0xFFFF) * 2);
+ phi_s2_2->unk18 = soundAlloc(&gNotesAndBuffersPool, (temp_t7 & 0xFFFF) * 2);
temp_v1_2 = phi_s2_2->unk4;
- phi_s2_2->unk1C = func_800B8FFC(&D_803AFBE8, phi_s2_2->unk6 * 2);
+ phi_s2_2->unk1C = soundAlloc(&gNotesAndBuffersPool, phi_s2_2->unk6 * 2);
phi_s2_2->unkC = 0;
phi_s2_2->unk10 = 0;
phi_s2_2->unk3 = 0;
@@ -1120,26 +1123,26 @@ void func_800BA250(void) {
if (temp_v1_2 != 1) {
phi_s2_2->unk0 = 1;
phi_s2_2->unkA = 0x8000 / temp_v1_2;
- phi_s2_2->unk20 = func_800B8FFC(&D_803AFBE8, 0x20);
- phi_s2_2->unk24 = func_800B8FFC(&D_803AFBE8, 0x20);
- phi_s2_2->unk28 = func_800B8FFC(&D_803AFBE8, 0x20);
- phi_s2_2->unk2C = func_800B8FFC(&D_803AFBE8, 0x20);
+ phi_s2_2->unk20 = soundAlloc(&gNotesAndBuffersPool, 0x20);
+ phi_s2_2->unk24 = soundAlloc(&gNotesAndBuffersPool, 0x20);
+ phi_s2_2->unk28 = soundAlloc(&gNotesAndBuffersPool, 0x20);
+ phi_s2_2->unk2C = soundAlloc(&gNotesAndBuffersPool, 0x20);
phi_s1 = 0;
- if (D_803B7088.unkC > 0) {
+ if (gAudioBufferParameters.unkC > 0) {
phi_s0_2 = phi_s2_2;
do {
- temp_v0_2 = func_800B8FFC(&D_803AFBE8, 0x300);
+ temp_v0_2 = soundAlloc(&gNotesAndBuffersPool, 0x300);
temp_t6 = temp_v0_2 + 0x180;
phi_s0_2->unk34 = temp_v0_2;
phi_s0_2->unk38 = temp_t6;
- temp_v0_3 = func_800B8FFC(&D_803AFBE8, 0x300);
+ temp_v0_3 = soundAlloc(&gNotesAndBuffersPool, 0x300);
temp_t8 = temp_v0_3 + 0x180;
phi_s0_2->unk98 = temp_v0_3;
phi_s0_2->unk9C = temp_t8;
temp_s1_2 = phi_s1 + 1;
phi_s0_2 += 0x14;
phi_s1 = temp_s1_2;
- } while (temp_s1_2 < D_803B7088.unkC);
+ } while (temp_s1_2 < gAudioBufferParameters.unkC);
}
}
temp_s5 = phi_s5 + 1;
@@ -1147,7 +1150,7 @@ void func_800BA250(void) {
phi_s2_2 += 0x108;
} while (temp_s5 < D_803AFBC3);
}
- func_800BB030(D_803B70B0);
+ func_800BB030(gMaxSimultaneousNotes);
osWritebackDCacheAll();
}
#else
diff --git a/src/audio/heap.h b/src/audio/heap.h
new file mode 100644
index 000000000..7ca2f2b3d
--- /dev/null
+++ b/src/audio/heap.h
@@ -0,0 +1,27 @@
+#ifndef AUDIO_HEAP_H
+#define AUDIO_HEAP_H
+
+#include <PR/ultratypes.h>
+
+#include "internal.h"
+
+#define SOUND_LOAD_STATUS_NOT_LOADED 0
+#define SOUND_LOAD_STATUS_IN_PROGRESS 1
+#define SOUND_LOAD_STATUS_COMPLETE 2
+#define SOUND_LOAD_STATUS_DISCARDABLE 3
+#define SOUND_LOAD_STATUS_4 4
+#define SOUND_LOAD_STATUS_5 5
+
+#define IS_BANK_LOAD_COMPLETE(bankId) (gBankLoadStatus[bankId] >= SOUND_LOAD_STATUS_COMPLETE)
+#define IS_SEQ_LOAD_COMPLETE(seqId) (gSeqLoadStatus[seqId] >= SOUND_LOAD_STATUS_COMPLETE)
+
+struct SoundAllocPool {
+ u8 *start;
+ u8 *cur;
+ u32 size;
+ s32 numAllocatedEntries;
+}; // size = 0x10
+
+extern struct SoundAllocPool gNotesAndBuffersPool;
+
+#endif // AUDIO_HEAP_H \ No newline at end of file
diff --git a/src/audio/internal.h b/src/audio/internal.h
index afcabb180..f9bbc5593 100644
--- a/src/audio/internal.h
+++ b/src/audio/internal.h
@@ -3,11 +3,57 @@
#include <PR/ultratypes.h>
+
+// No-op printf macro which leaves string literals in rodata in IDO. IDO
+// doesn't support variadic macros, so instead we let the parameter list
+// expand to a no-op comma expression. Another possibility is that it might
+// have expanded to something with "if (0)". See also goddard/gd_main.h.
+// On US/JP, -sopt optimizes away these except for external.c.
+#ifdef __sgi
+#define stubbed_printf
+#else
+#define stubbed_printf(...)
+#endif
+
+#define stubbed_printf_0(msg) stubbed_printf(msg)
+#define stubbed_printf_1(msg, a) stubbed_printf(msg, a)
+#define stubbed_printf_2(msg, a, b) stubbed_printf(msg, a, b)
+#define stubbed_printf_3(msg, a, b, c) stubbed_printf(msg, a, b, c)
+
+
struct AdsrEnvelope {
s16 delay;
s16 arg;
}; // size = 0x4
+struct AdpcmLoop {
+ u32 start;
+ u32 end;
+ u32 count;
+ u32 pad;
+ s16 state[16]; // only exists if count != 0. 8-byte aligned
+};
+
+struct AdpcmBook {
+ s32 order;
+ s32 npredictors;
+ s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
+};
+
+struct AudioBankSample {
+ u8 unused;
+ u8 loaded;
+ u8 *sampleAddr;
+ struct AdpcmLoop *loop;
+ struct AdpcmBook *book;
+ u32 sampleSize; // never read. either 0 or 1 mod 9, depending on padding
+};
+
+struct AudioBankSound {
+ struct AudioBankSample *sample;
+ f32 tuning; // frequency scale factor
+}; // size = 0x8
+
struct NoteSub
{
/*0x00*/ volatile u8 enabled : 1;
@@ -35,4 +81,33 @@ struct NoteSub
} sound;
};
+struct AudioSessionSettings {
+ /*0x00*/ u32 frequency;
+ /*0x04*/ u8 maxSimultaneousNotes;
+ /*0x05*/ u8 reverbDownsampleRate; // always 1
+ /*0x06*/ u16 reverbWindowSize;
+ /*0x08*/ u16 reverbGain;
+ /*0x0A*/ u16 volume;
+ /*0x0C*/ u32 persistentSeqMem;
+ /*0x10*/ u32 persistentBankMem;
+ /*0x14*/ u32 temporarySeqMem;
+ /*0x18*/ u32 temporaryBankMem;
+}; // size = 0x1C
+
+struct AudioBufferParametersEU {
+ /*0x00*/ s16 presetUnk4; // audio frames per vsync?
+ /*0x02*/ u16 frequency;
+ /*0x04*/ u16 aiFrequency; // ?16
+ /*0x06*/ s16 samplesPerFrameTarget;
+ /*0x08*/ s16 maxAiBufferLength;
+ /*0x0A*/ s16 minAiBufferLength;
+ /*0x0C*/ s16 updatesPerFrame;
+ /*0x0E*/ s16 samplesPerUpdate;
+ /*0x10*/ s16 samplesPerUpdateMax;
+ /*0x12*/ s16 samplesPerUpdateMin;
+ /*0x14*/ f32 resampleRate; // contains 32000.0f / frequency
+ /*0x18*/ f32 updatesPerFrameInv; // 1.0f / updatesPerFrame
+ /*0x1C*/ f32 unkUpdatesPerFrameScaled; // 3.0f / (1280.0f * updatesPerFrame)
+};
+
#endif
diff --git a/src/audio/load.c b/src/audio/load.c
index 8dbd8cee0..c0f39c0a4 100644
--- a/src/audio/load.c
+++ b/src/audio/load.c
@@ -1,145 +1,248 @@
#include <ultra64.h>
#include <macros.h>
+#include "load.h"
+#include "data.h"
+#include "heap.h"
+#include "internal.h"
+
+#define ALIGN16(val) (((val) + 0xF) & ~0xF)
+struct SharedDma {
+ /*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
+ /*0x4*/ uintptr_t source; // device address
+ /*0x8*/ u16 sizeUnused; // set to bufSize, never read
+ /*0xA*/ u16 bufSize; // size of buffer
+ /*0xC*/ u8 unused2; // set to 0, never read
+ /*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
+ /*0xE*/ u8 ttl; // duration after which the DMA can be discarded
+}; // size = 0x10
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? osPiStartDma(? *, ?, ?, s32, void *, u32, OSMesgQueue *); // extern
extern OSMesgQueue D_803B6720;
-extern ? D_803B6740;
-
-void func_800BAA80(s32 arg0, void *arg1, u32 arg2) {
- osInvalDCache(arg1, arg2);
- osPiStartDma(&D_803B6740, 1, 0, arg0, arg1, arg2, &D_803B6720);
- osRecvMesg(&D_803B6720, NULL, 1);
+extern OSIoMesg D_803B6740;
+
+extern OSMesgQueue gCurrAudioFrameDmaQueue; // gCurrAudioFrameDmaQueue
+extern OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; // gCurrAudioFrameDmaMesgBufs
+extern OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; // gCurrAudioFrameDmaIoMesgBufs
+
+extern struct SharedDma sSampleDmas[0x60]; // sSampleDmas
+extern u32 gSampleDmaNumListItems; // gSampleDmaNumListItems
+extern u32 sSampleDmaListSize1; // sSampleDmaListSize1
+extern s32 D_803B6E60; // sUnused80226B40
+
+extern u8 sSampleDmaReuseQueue1[256]; // sSampleDmaReuseQueue1
+extern u8 sSampleDmaReuseQueue2[256]; // sSampleDmaReuseQueue2
+extern u8 sSampleDmaReuseQueueTail1; // sSampleDmaReuseQueueTail1
+extern u8 sSampleDmaReuseQueueTail2; // sSampleDmaReuseQueueTail2
+extern u8 sSampleDmaReuseQueueHead1; // sSampleDmaReuseQueueHead1
+extern u8 sSampleDmaReuseQueueHead2; // sSampleDmaReuseQueueHead2
+
+
+
+extern void *soundAlloc(struct SoundAllocPool *pool, u32 size);
+
+/**
+ * Performs an immediate DMA copy
+ */
+// audio_dma_copy_immediate
+void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
+ stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
+ osInvalDCache(vAddr, nbytes);
+ osPiStartDma(&D_803B6740, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes, &D_803B6720);
+ osRecvMesg(&D_803B6720, NULL, OS_MESG_BLOCK);
+ stubbed_printf_0("Romcopyend\n");
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAA80.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? osPiStartDma(s32, ?, ?, s32, void *, u32, s32); // extern
-
-void func_800BAAF8(s32 arg0, void *arg1, u32 arg2, s32 arg3, s32 arg4) {
- osInvalDCache(arg1, arg2);
- osPiStartDma(arg4, 0, 0, arg0, arg1, arg2, arg3);
+const char audioString34[] = "CAUTION:WAVE CACHE FULL %d";
+const char audioString35[] = "LOAD Rom :%x -> Ram :%x Len:%x\n";
+const char audioString36[] = "BASE %x %x\n";
+const char audioString37[] = "LOAD %x %x %x\n";
+const char audioString38[] = "INSTTOP %x\n";
+const char audioString39[] = "INSTMAP[0] %x\n";
+const char audioString40[] = "already flags %d\n";
+const char audioString41[] = "already flags %d\n";
+const char audioString42[] = "ERR:SLOW BANK DMA BUSY\n";
+const char audioString43[] = "ERR:SLOW DMA BUSY\n";
+const char audioString44[] = "Check %d bank %d\n";
+const char audioString45[] = "Cache Check\n";
+const char audioString46[] = "NO BANK ERROR\n";
+const char audioString47[] = "BANK %d LOADING START\n";
+const char audioString48[] = "BANK %d LOAD MISS (NO MEMORY)!\n";
+const char audioString49[] = "BANK %d ALREADY CACHED\n";
+const char audioString50[] = "BANK LOAD MISS! FOR %d\n";
+
+
+const char audioString51[] = "Seq %d Loading Start\n";
+
+const char audioString52[] = "Heap Overflow Error\n";
+
+const char asdf[] = "SEQ %d ALREADY CACHED\n";
+const char fdsa[] = "Ok,one bank slow load Start \n";
+const char af[] = "Sorry,too many %d bank is none.fast load Start \n";
+
+
+
+/**
+ * Performs an asynchronus (normal priority) DMA copy
+ */
+//audio_dma_copy_async
+void func_800BAAF8(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
+ osInvalDCache(vAddr, nbytes);
+ osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAAF8.s")
-#endif
+//#else
+//GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAAF8.s")
+//#endif
-#ifdef MIPS_TO_C
+//#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? osPiStartDma(s32, ?, ?, s32, void *, u32, s32); // extern
-
-void func_800BAB58(s32 *arg0, void **arg1, s32 *arg2, s32 arg3, s32 arg4) {
- s32 temp_v0;
- u32 phi_s0;
+//? osPiStartDma(s32, ?, ?, s32, void *, u32, s32); // extern
+
+
+/**
+ * Performs a partial asynchronous (normal priority) DMA copy. This is limited
+ * to 0x1000 bytes transfer at once.
+ */
+// audio_dma_partial_copy_async
+void func_800BAB58(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) {
+ ssize_t transfer = (*remaining >= 0x1000 ? 0x1000 : *remaining);
+ *remaining -= transfer;
+ osInvalDCache(*vAddr, transfer);
+ osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, *devAddr, *vAddr, transfer, queue);
+ *devAddr += transfer;
+ *vAddr += transfer;
+}
+//#else
+//GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAB58.s")
+//#endif
+
+// decrease_sample_dma_ttls
+
+void func_800BAC04() {
+ u32 i;
+
+ for (i = 0; i < sSampleDmaListSize1; i++) {
+ struct SharedDma *temp = &sSampleDmas[i];
+ if (temp->ttl != 0) {
+ temp->ttl--;
+ if (temp->ttl == 0) {
+ temp->reuseIndex = sSampleDmaReuseQueueHead1;
+ sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8) i;
+ }
+ }
+ }
- temp_v0 = *arg2;
- phi_s0 = temp_v0;
- if (temp_v0 >= 0x1000) {
- phi_s0 = 0x1000;
+ for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
+ struct SharedDma *temp = &sSampleDmas[i];
+ if (temp->ttl != 0) {
+ temp->ttl--;
+ if (temp->ttl == 0) {
+ temp->reuseIndex = sSampleDmaReuseQueueHead2;
+ sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8) i;
+ }
+ }
}
- *arg2 = temp_v0 - phi_s0;
- osInvalDCache(*arg1, phi_s0);
- osPiStartDma(arg4, 0, 0, *arg0, *arg1, phi_s0, arg3);
- *arg0 = *arg0 + phi_s0;
- *arg1 = *arg1 + phi_s0;
+
+ D_803B6E60 = 0;
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAB58.s")
-#endif
#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-extern ? D_803B6758;
-extern u32 D_803B6E58;
-extern u32 D_803B6E5C;
-extern s32 D_803B6E60;
-extern ? D_803B6E68;
-extern ? D_803B6F68;
-extern u8 D_803B706A;
-extern u8 D_803B706B;
-
-void func_800BAC04(void) {
- u32 temp_v0;
- u32 temp_v0_2;
- u8 temp_t4;
- u8 temp_t6;
- u8 temp_t6_2;
- u8 temp_t8;
- u8 temp_v1;
- u8 temp_v1_2;
- u8 temp_v1_3;
- u8 temp_v1_4;
- ? *phi_a0;
- s8 phi_v0;
- void *phi_a0_2;
- s8 phi_v0_2;
-
- phi_a0 = &D_803B6758;
- phi_v0 = 0;
- if (D_803B6E5C != 0) {
- do {
- temp_v1 = phi_a0->unkE;
- temp_t6 = temp_v1 - 1;
- if (temp_v1 != 0) {
- phi_a0->unkE = temp_t6;
- if ((temp_t6 & 0xFF) == 0) {
- temp_v1_2 = D_803B706A;
- temp_t8 = D_803B706A;
- *(&D_803B6E68 + temp_v1_2) = phi_v0;
- D_803B706A = temp_v1_2 + 1;
- phi_a0->unkD = temp_t8;
+// dma_sample_data 3000 score diff
+void *func_800BAD0C(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
+ s32 hasDma = FALSE;
+ struct SharedDma *dma;
+ uintptr_t dmaDevAddr;
+ u32 transfer;
+ u32 i;
+ u32 dmaIndex;
+ ssize_t bufferPos;
+ UNUSED u32 pad;
+
+ if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1) {
+ for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
+ dma = &sSampleDmas[i];
+ bufferPos = devAddr - dma->source;
+ if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
+ // We already have a DMA request for this memory range.
+ if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
+ // Move the DMA out of the reuse queue, by swapping it with the
+ // tail, and then incrementing the tail.
+ if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
+ sSampleDmaReuseQueue2[dma->reuseIndex] =
+ sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
+ sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex =
+ dma->reuseIndex;
+ }
+ sSampleDmaReuseQueueTail2++;
}
+ dma->ttl = 60;
+ *dmaIndexRef = (u8) i;
+ return &dma->buffer[(devAddr - dma->source)];
}
- temp_v0 = phi_v0 + 1;
- phi_a0 += 0x10;
- phi_v0 = temp_v0;
- } while (temp_v0 < D_803B6E5C);
- }
- phi_v0_2 = D_803B6E5C;
- if (D_803B6E5C < D_803B6E58) {
- phi_a0_2 = (D_803B6E5C * 0x10) + &D_803B6758;
- do {
- temp_v1_3 = phi_a0_2->unkE;
- temp_t4 = temp_v1_3 - 1;
- if (temp_v1_3 != 0) {
- phi_a0_2->unkE = temp_t4;
- if ((temp_t4 & 0xFF) == 0) {
- temp_v1_4 = D_803B706B;
- temp_t6_2 = D_803B706B;
- *(&D_803B6F68 + temp_v1_4) = phi_v0_2;
- D_803B706B = temp_v1_4 + 1;
- phi_a0_2->unkD = temp_t6_2;
+ }
+
+ if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0) {
+ // Allocate a DMA from reuse queue 2. This queue can be empty, since
+ // TTL 60 is pretty large.
+ dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
+ sSampleDmaReuseQueueTail2++;
+ dma = sSampleDmas + dmaIndex;
+ hasDma = TRUE;
+ }
+ } else {
+ dma = sSampleDmas;
+ dma += *dmaIndexRef;
+ bufferPos = devAddr - dma->source;
+ if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
+ // We already have DMA for this memory range.
+ if (dma->ttl == 0) {
+ // Move the DMA out of the reuse queue, by swapping it with the
+ // tail, and then incrementing the tail.
+ if (dma->reuseIndex != sSampleDmaReuseQueueTail1) {
+ if (1) {
+ }
+ sSampleDmaReuseQueue1[dma->reuseIndex] =
+ sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1];
+ sSampleDmas[sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1]].reuseIndex =
+ dma->reuseIndex;
}
+ sSampleDmaReuseQueueTail1++;
}
- temp_v0_2 = phi_v0_2 + 1;
- phi_a0_2 += 0x10;
- phi_v0_2 = temp_v0_2;
- } while (temp_v0_2 < D_803B6E58);
+ dma->ttl = 2;
+ return dma->buffer + (devAddr - dma->source);
+ }
}
- D_803B6E60 = 0;
+
+ if (!hasDma) {
+ // Allocate a DMA from reuse queue 1. This queue will hopefully never
+ // be empty, since TTL 2 is so small.
+ dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++];
+ dma = sSampleDmas + dmaIndex;
+ hasDma = TRUE;
+ }
+
+ transfer = dma->bufSize;
+ dmaDevAddr = devAddr & ~0xF;
+ dma->ttl = 2;
+ dma->source = dmaDevAddr;
+ dma->sizeUnused = transfer;
+ osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
+ OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
+ *dmaIndexRef = dmaIndex;
+ return (devAddr - dmaDevAddr) + dma->buffer;
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAC04.s")
-#endif
-#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? osPiStartDma(void *, ?, ?, s32, s32, s32, ? *); // extern
-extern ? D_803B6008;
-extern ? D_803B6120;
-extern ? D_803B6758;
-extern u32 D_803B6E58;
-extern u32 D_803B6E5C;
-extern ? D_803B6E68;
-extern ? D_803B6F68;
-extern u8 D_803B7068;
-extern u8 D_803B7069;
-extern u8 D_803B706B;
-extern s32 D_803B70BC;
+extern ? gCurrAudioFrameDmaQueue;
+extern ? gCurrAudioFrameDmaIoMesgBufs;
+extern ? sSampleDmas;
+extern u32 gSampleDmaNumListItems;
+extern u32 sSampleDmaListSize1;
+extern ? sSampleDmaReuseQueue1;
+extern ? sSampleDmaReuseQueue2;
+extern u8 sSampleDmaReuseQueueTail1;
+extern u8 sSampleDmaReuseQueueTail2;
+extern u8 sSampleDmaReuseQueueHead2;
+extern s32 gCurrAudioFrameDmaCount;
s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) {
void *sp40;
@@ -178,25 +281,25 @@ s32 func_800BAD0C(s32 arg0, s32 arg1, s32 arg2, u8 *arg3) {
phi_t3 = 0;
phi_t3 = 0;
- if ((arg2 != 0) || (temp_a1 = D_803B6E5C, temp_v0 = *arg3, phi_v1 = 0, ((temp_v0 < temp_a1) == 0))) {
- temp_a1_2 = D_803B6E58;
- temp_v1_3 = D_803B6E5C;
+ if ((arg2 != 0) || (temp_a1 = sSampleDmaListSize1, temp_v0 = *arg3, phi_v1 = 0, ((temp_v0 < temp_a1) == 0))) {
+ temp_a1_2 = gSampleDmaNumListItems;
+ temp_v1_3 = sSampleDmaListSize1;
phi_v1_2 = temp_v1_3;
if (temp_v1_3 < temp_a1_2) {
- phi_a0 = (temp_v1_3 * 0x10) + &D_803B6758;
+ phi_a0 = (temp_v1_3 * 0x10) + &sSampleDmas;
loop_4:
temp_v0_4 = arg0 - phi_a0->unk4;
if ((temp_v0_4 >= 0) && ((phi_a0->unkA - arg1) >= temp_v0_4)) {
if (phi_a0->unkE == 0) {
- temp_a1_3 = D_803B7069;
- if (D_803B706B != temp_a1_3) {
+ temp_a1_3 = sSampleDmaReuseQueueTail2;
+ if (sSampleDmaReuseQueueHead2 != temp_a1_3) {
temp_a3 = phi_a0->unkD;
- temp_v0_5 = &D_803B6F68 + temp_a1_3;
+ temp_v0_5 = &sSampleDmaReuseQueue2 + temp_a1_3;
if (temp_a1_3 != temp_a3) {
- *(&D_803B6F68 + temp_a3) = *temp_v0_5;
- (&D_803B6758 + (*temp_v0_5 * 0x10))->unkD = phi_a0->unkD;
+ *(&sSampleDmaReuseQueue2 + temp_a3) = *temp_v0_5;
+ (&sSampleDmas + (*temp_v0_5 * 0x10))->unkD = phi_a0->unkD;
}
- D_803B7069 = temp_a1_3 + 1;
+ sSampleDmaReuseQueueTail2 = temp_a1_3 + 1;
}
}
phi_a0->unkE = 0x3C;
@@ -213,18 +316,18 @@ loop_4:
goto loop_4;
}
block_14:
- temp_a1_4 = D_803B7069;
+ temp_a1_4 = sSampleDmaReuseQueueTail2;
phi_t0_2 = sp40;
- if ((D_803B706B != temp_a1_4) && (arg2 != 0)) {
- temp_t2 = *(&D_803B6F68 + temp_a1_4);
- D_803B7069 = temp_a1_4 + 1;
+ if ((sSampleDmaReuseQueueHead2 != temp_a1_4) && (arg2 != 0)) {
+ temp_t2 = *(&sSampleDmaReuseQueue2 + temp_a1_4);
+ sSampleDmaReuseQueueTail2 = temp_a1_4 + 1;
sp30 = temp_t2;
phi_t3 = 1;
- phi_t0_2 = &D_803B6758 + (temp_t2 * 0x10);
+ phi_t0_2 = &sSampleDmas + (temp_t2 * 0x10);
}
goto block_27;
}
- temp_t0 = &D_803B6758 + (temp_v0 * 0x10);
+ temp_t0 = &sSampleDmas + (temp_v0 * 0x10);
phi_t0 = temp_t0;
phi_t0_2 = temp_t0;
if (temp_a1 != 0) {
@@ -234,19 +337,19 @@ loop_19:
phi_v1 = temp_v1;
if ((temp_v0_2 >= 0) && ((phi_t0->unkA - arg1) >= temp_v0_2)) {
if (phi_t0->unkE == 0) {
- temp_v1_2 = D_803B7068;
+ temp_v1_2 = sSampleDmaReuseQueueTail1;
temp_a0 = phi_t0->unkD;
- temp_v0_3 = &D_803B6E68 + temp_v1_2;
+ temp_v0_3 = &sSampleDmaReuseQueue1 + temp_v1_2;
if (temp_v1_2 != temp_a0) {
- *(&D_803B6E68 + temp_a0) = *temp_v0_3;
- (&D_803B6758 + (*temp_v0_3 * 0x10))->unkD = phi_t0->unkD;
+ *(&sSampleDmaReuseQueue1 + temp_a0) = *temp_v0_3;
+ (&sSampleDmas + (*temp_v0_3 * 0x10))->unkD = phi_t0->unkD;
}
- D_803B7068 = temp_v1_2 + 1;
+ sSampleDmaReuseQueueTail1 = temp_v1_2 + 1;
}
phi_t0->unkE = 2;
return (phi_t0->unk0 + arg0) - phi_t0->unk4;
}
- temp_t0_2 = &D_803B6758 + (phi_v1 * 0x10);
+ temp_t0_2 = &sSampleDmas + (phi_v1 * 0x10);
phi_t0 = temp_t0_2;
phi_t0_2 = temp_t0_2;
if (temp_v1 >= temp_a1) {
@@ -257,10 +360,10 @@ loop_19:
block_27:
phi_t2 = sp30;
if (phi_t3 == 0) {
- temp_v1_5 = D_803B7068;
- temp_t2_2 = *(&D_803B6E68 + temp_v1_5);
- D_803B7068 = temp_v1_5 + 1;
- phi_t0_2 = &D_803B6758 + (temp_t2_2 * 0x10);
+ temp_v1_5 = sSampleDmaReuseQueueTail1;
+ temp_t2_2 = *(&sSampleDmaReuseQueue1 + temp_v1_5);
+ sSampleDmaReuseQueueTail1 = temp_v1_5 + 1;
+ phi_t0_2 = &sSampleDmas + (temp_t2_2 * 0x10);
phi_t2 = temp_t2_2;
}
temp_v0_6 = phi_t0_2->unkA;
@@ -268,12 +371,12 @@ block_27:
phi_t0_2->unkE = 2;
phi_t0_2->unk4 = temp_s0;
phi_t0_2->unk8 = temp_v0_6;
- temp_v1_6 = D_803B70BC;
+ temp_v1_6 = gCurrAudioFrameDmaCount;
temp_t9 = temp_v1_6 * 0x18;
- D_803B70BC = temp_v1_6 + 1;
+ gCurrAudioFrameDmaCount = temp_v1_6 + 1;
sp30 = phi_t2;
- sp40 = phi_t0_2;
- osPiStartDma(temp_t9 + &D_803B6120, 0, 0, temp_s0, phi_t0_2->unk0, temp_v0_6, &D_803B6008);
+ sp40 = phi_t0_2;./
+ osPiStartDma(temp_t9 + &gCurrAudioFrameDmaIoMesgBufs, 0, 0, temp_s0, phi_t0_2->unk0, temp_v0_6, &gCurrAudioFrameDmaQueue);
*arg3 = phi_t2;
return (arg0 - temp_s0) + phi_t0_2->unk0;
}
@@ -281,223 +384,95 @@ block_27:
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BAD0C.s")
#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32, u32); // extern
-extern ? D_803BFBE8;
-extern ? D_803B6758;
-extern u32 D_803B6E58;
-extern u32 D_803B6E5C;
-extern s8 D_803B6E68;
-extern ? D_803B6F68;
-extern s8 D_803B7068;
-extern s8 D_803B7069;
-extern s8 D_803B706A;
-extern s8 D_803B706B;
-extern s16 D_803B7088;
-extern s32 D_803B70A8;
-extern s32 D_803B70B0;
-
-void func_800BB030(s32 arg0, u32 arg2) {
- s32 temp_a1;
- s32 temp_a1_2;
- s32 temp_s0;
- s32 temp_s0_3;
- s32 temp_v0;
- s32 temp_v0_3;
- s8 temp_v0_4;
- u32 temp_a1_3;
- u32 temp_a2;
- u32 temp_a2_2;
- u32 temp_a2_3;
- u32 temp_s0_2;
- u32 temp_s0_4;
- u32 temp_v0_2;
- u32 temp_v0_5;
- void *temp_v1;
- void *temp_v1_2;
- s32 phi_a1;
- u32 phi_a2;
- s32 phi_s0;
- s8 phi_s0_2;
- s8 *phi_v0;
- ? *phi_v1;
- void *phi_v0_2;
- s32 phi_a1_2;
- s32 phi_s0_3;
- u32 phi_a2_2;
- s8 phi_s0_4;
- s8 *phi_a0;
- s8 phi_v0_3;
- void *phi_v1_2;
- s32 phi_a3;
- void *phi_v0_4;
- u32 phi_a2_3;
+extern u32 D_803B70A8; // sDmaBufSize
+extern s32 gMaxSimultaneousNotes; // gMaxSimultaneousNotes
+extern struct AudioBufferParametersEU gAudioBufferParameters; // gAudioBufferParameters
+//extern struct SoundAllocPool gNotesAndBuffersPool; // remove when possible. This is in heap.h
+// init_sample_dma_buffers
+void func_800BB030(UNUSED s32 arg0) {
+ s32 i;
+#define j i
D_803B70A8 = 0x5A0;
- phi_a1 = 0x5A0;
- phi_a2 = arg2;
- phi_s0 = 0;
- phi_s0_3 = 0;
- if ((D_803B70B0 * 3 * D_803B7088) > 0) {
-loop_1:
- temp_v0 = func_800B8FFC(&D_803BFBE8, phi_a1, phi_a2);
- temp_a2 = D_803B6E58;
- temp_v1 = &D_803B6758 + (temp_a2 * 0x10);
- temp_v1->unk0 = temp_v0;
- phi_a2 = temp_a2;
- if (temp_v0 == 0) {
- } else {
- temp_a1 = D_803B70A8;
- temp_s0 = phi_s0 + 1;
- temp_v1->unk4 = 0;
- temp_v1->unk8 = 0;
- temp_v1->unkC = 0;
- temp_v1->unkE = 0;
- D_803B6E58 = temp_a2 + 1;
- temp_v1->unkA = temp_a1;
- phi_a1 = temp_a1;
- phi_s0 = temp_s0;
- if (temp_s0 >= (D_803B70B0 * 3 * D_803B7088)) {
-
- } else {
- goto loop_1;
- }
+ for (i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++)
+ {
+ sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_803B70A8);
+ if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
+ break;
}
+ sSampleDmas[gSampleDmaNumListItems].bufSize = D_803B70A8;
+ sSampleDmas[gSampleDmaNumListItems].source = 0;
+ sSampleDmas[gSampleDmaNumListItems].sizeUnused = 0;
+ sSampleDmas[gSampleDmaNumListItems].unused2 = 0;
+ sSampleDmas[gSampleDmaNumListItems].ttl = 0;
+ gSampleDmaNumListItems++;
}
- temp_a2_2 = D_803B6E58;
- phi_s0_2 = 0;
- phi_a2_2 = temp_a2_2;
- if (temp_a2_2 != 0) {
- phi_v0 = &D_803B6E68;
- phi_v1 = &D_803B6758;
- do {
- *phi_v0 = phi_s0_2;
- phi_v1->unkD = phi_s0_2;
- temp_s0_2 = phi_s0_2 + 1;
- phi_s0_2 = temp_s0_2;
- phi_v0 += 1;
- phi_v1 += 0x10;
- } while (temp_s0_2 < temp_a2_2);
+
+ for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
+ sSampleDmaReuseQueue1[i] = (u8) i;
+ sSampleDmas[i].reuseIndex = (u8) i;
}
- phi_a3 = temp_a2_2;
- if (temp_a2_2 < 0x100) {
- phi_v0_2 = temp_a2_2 + &D_803B6E68;
- do {
- temp_v0_2 = phi_v0_2 + 1;
- temp_v0_2->unk-1 = 0;
- phi_v0_2 = temp_v0_2;
- } while (temp_v0_2 < &D_803B6F68);
+
+ for (j = gSampleDmaNumListItems; j < 0x100; j++) {
+ sSampleDmaReuseQueue1[j] = 0;
}
- D_803B7068 = 0;
- D_803B706A = temp_a2_2;
- D_803B6E5C = temp_a2_2;
+
+ sSampleDmaReuseQueueTail1 = 0;
+ sSampleDmaReuseQueueHead1 = (u8) gSampleDmaNumListItems;
+ sSampleDmaListSize1 = gSampleDmaNumListItems;
+
D_803B70A8 = 0x180;
- if (D_803B70B0 > 0) {
- phi_a1_2 = 0x180;
-loop_13:
- temp_v0_3 = func_800B8FFC(&D_803BFBE8, phi_a1_2, D_803B6E58);
- temp_a2_3 = D_803B6E58;
- temp_s0_3 = phi_s0_3 + 1;
- temp_v1_2 = &D_803B6758 + (temp_a2_3 * 0x10);
- temp_v1_2->unk0 = temp_v0_3;
- phi_s0_3 = temp_s0_3;
- phi_a2_3 = temp_a2_3;
- if (temp_v0_3 == 0) {
-
- } else {
- temp_a1_2 = D_803B70A8;
- temp_v1_2->unk4 = 0;
- temp_v1_2->unk8 = 0;
- temp_v1_2->unkC = 0;
- temp_v1_2->unkE = 0;
- D_803B6E58 = temp_a2_3 + 1;
- temp_v1_2->unkA = temp_a1_2;
- phi_a1_2 = temp_a1_2;
- if (temp_s0_3 >= D_803B70B0) {
- phi_a2_3 = D_803B6E58;
- } else {
- goto loop_13;
- }
+ for (i = 0; i < gMaxSimultaneousNotes; i++) {
+ sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_803B70A8);
+ if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
+ break;
}
- phi_a2_2 = phi_a2_3;
- phi_a3 = phi_a2_3;
+ sSampleDmas[gSampleDmaNumListItems].bufSize = D_803B70A8;
+ sSampleDmas[gSampleDmaNumListItems].source = 0;
+ sSampleDmas[gSampleDmaNumListItems].sizeUnused = 0;
+ sSampleDmas[gSampleDmaNumListItems].unused2 = 0;
+ sSampleDmas[gSampleDmaNumListItems].ttl = 0;
+ gSampleDmaNumListItems++;
}
- temp_a1_3 = D_803B6E5C;
- phi_s0_4 = temp_a1_3;
- if (temp_a1_3 < phi_a2_2) {
- temp_v0_4 = temp_a1_3 * 0;
- phi_a0 = temp_v0_4 + &D_803B6F68;
- phi_v0_3 = temp_v0_4;
- phi_v1_2 = (temp_a1_3 * 0x10) + &D_803B6758;
- do {
- *phi_a0 = phi_s0_4;
- temp_s0_4 = phi_s0_4 + 1;
- phi_v1_2->unkD = phi_v0_3;
- phi_s0_4 = temp_s0_4;
- phi_a0 += 1;
- phi_v0_3 += 1;
- phi_v1_2 += 0x10;
- } while (temp_s0_4 < phi_a2_2);
+
+ for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
+ sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8) i;
+ sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
}
- if (phi_a3 < 0x100) {
- phi_v0_4 = phi_a3 + &D_803B6F68;
- do {
- temp_v0_5 = phi_v0_4 + 1;
- temp_v0_5->unk-1 = temp_a1_3;
- phi_v0_4 = temp_v0_5;
- } while (temp_v0_5 < &D_803B7068);
+
+ // This probably meant to touch the range size1..size2 as well... but it
+ // doesn't matter, since these values are never read anyway.
+ for (j = gSampleDmaNumListItems; j < 0x100; j++) {
+ sSampleDmaReuseQueue2[j] = sSampleDmaListSize1;
}
- D_803B7069 = 0;
- D_803B706B = phi_a2_2 - temp_a1_3;
-}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB030.s")
-#endif
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32, void *); // extern
-? func_800BAA80(s32, s32, s32, void *); // extern
-extern ? D_803BFBE8;
+ sSampleDmaReuseQueueTail2 = 0;
+ sSampleDmaReuseQueueHead2 = gSampleDmaNumListItems - sSampleDmaListSize1;
+#undef j
+}
-void func_800BB304(void *arg0) {
- s32 sp1C;
- s32 temp_a0;
- s32 temp_a1;
- s32 temp_a1_2;
- s32 temp_a2;
- s32 temp_v0;
- void *temp_a3;
- void *temp_a3_2;
+// Similar to patch_sound, but not really
+s32 func_800BB304(struct AudioBankSample *sample) {
+ //struct AudioBankSample *sample = sound->sample;
+ UNUSED u8 *mem;
- temp_a3 = arg0;
- if (arg0 == 0) {
- return;
+ if (sample == (void *)NULL) {
+ return -1;
}
- if (temp_a3->unk1 == 1) {
- temp_a1 = temp_a3->unk10;
- arg0 = temp_a3;
- temp_v0 = func_800B8FFC(&D_803BFBE8, temp_a1, temp_a3);
- temp_a3_2 = arg0;
- temp_a1_2 = temp_v0;
- if (temp_v0 == 0) {
- return;
+
+ if (sample->loaded == 1) {
+ //temp_a1 = sound->sampleAddr // unk10;
+ mem = soundAlloc(&gNotesAndBuffersPool, sample->sampleSize);
+ //temp_a1_2 = temp_v0;
+ if (mem == (void *)NULL) {
+ return -1;
}
- temp_a0 = temp_a3_2->unk4;
- temp_a2 = temp_a3_2->unk10;
- arg0 = temp_a3_2;
- sp1C = temp_a1_2;
- func_800BAA80(temp_a0, temp_a1_2, temp_a2, temp_a3_2);
- arg0->unk1 = 0x81;
- arg0->unk4 = temp_a1_2;
- // Duplicate return node #6. Try simplifying control flow for better match
+ audio_dma_copy_immediate((uintptr_t)sample->sampleAddr, mem, sample->sampleSize);
+ sample->loaded = 0x81;
+ sample->sampleAddr = mem; // sound->unk4
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB304.s")
-#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -574,9 +549,9 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB43C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, s32, s32); // extern
-? func_800BAA80(s32, s32, s32, s32); // extern
-extern ? D_803BFBE8;
+s32 soundAlloc(? *, s32, s32); // extern
+? audio_dma_copy_immediate(s32, s32, s32, s32); // extern
+extern ? gNotesAndBuffersPool;
void func_800BB484(void **arg0, s32 arg1, s32 arg2) {
void *sp2C;
@@ -604,14 +579,14 @@ void func_800BB484(void **arg0, s32 arg1, s32 arg2) {
temp_a3_2 = temp_a3->unk4 + arg2;
sp28 = temp_a3_2;
sp2C = temp_a3;
- temp_v0_2 = func_800B8FFC(&D_803BFBE8, temp_a3->unk10, temp_a3_2);
+ temp_v0_2 = soundAlloc(&gNotesAndBuffersPool, temp_a3->unk10, temp_a3_2);
if (temp_v0_2 == 0) {
temp_a3->unk4 = temp_a3_2;
temp_a3->unk1 = 1;
} else {
sp24 = temp_v0_2;
sp2C = temp_a3;
- func_800BAA80(temp_a3_2, temp_v0_2, temp_a3->unk10, temp_a3_2);
+ audio_dma_copy_immediate(temp_a3_2, temp_v0_2, temp_a3->unk10, temp_a3_2);
temp_a3->unk1 = 0x81;
temp_a3->unk4 = temp_v0_2;
}
@@ -723,10 +698,12 @@ void func_800BB624(void **arg0, ? arg1, s32 arg2, s32 arg3) {
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB624.s")
#endif
+
+
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-? func_800BAA80(s32, s32, s32); // extern
+? audio_dma_copy_immediate(s32, s32, s32); // extern
? func_800BB584(s32); // extern
extern ? D_803AFE18;
extern ? D_803B03C0;
@@ -751,7 +728,7 @@ s32 func_800BB780(s32 arg0, ? arg1) {
return 0;
}
sp2C = temp_v0_2;
- func_800BAA80(sp28 + 0x10, temp_v0_2, temp_a2);
+ audio_dma_copy_immediate(sp28 + 0x10, temp_v0_2, temp_a2);
(D_803B7080 + (arg0 * 0xC))->unk4 = sp2C + 4;
func_800BB584(arg0);
temp_v0_3 = arg0 + &D_803B03C0;
@@ -819,7 +796,7 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB864.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-? func_800BAA80(s32, s32, s32); // extern
+? audio_dma_copy_immediate(s32, s32, s32); // extern
extern ? D_803AFC48;
extern ? D_803B0400;
extern s32 D_803B706C;
@@ -842,7 +819,7 @@ s32 func_800BB99C(s32 arg0, ? arg1) {
return 0;
}
sp28 = temp_v0;
- func_800BAA80(sp24, temp_v0, sp2C);
+ audio_dma_copy_immediate(sp24, temp_v0, sp2C);
temp_v0_3 = arg0 + &D_803B0400;
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
@@ -856,7 +833,7 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BB99C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B93BC(? *, ?, s32, ?, s32); // extern
-? func_800BAA80(s32, s32, s32); // extern
+? audio_dma_copy_immediate(s32, s32, s32); // extern
? func_800BAAF8(s32, s32, s32, OSMesgQueue *, void *); // extern
extern ? D_803AFC48;
extern ? D_803B0400;
@@ -882,13 +859,13 @@ s32 func_800BBA50(s32 arg0, ? arg1, u8 *arg2) {
return 0;
}
if (temp_s0 < 0x41) {
- func_800BAA80(sp3C, temp_v0, temp_s0);
+ audio_dma_copy_immediate(sp3C, temp_v0, temp_s0);
temp_v0_3 = arg0 + &D_803B0400;
if (*temp_v0_3 != 5) {
*temp_v0_3 = 2;
}
} else {
- func_800BAA80(sp3C, temp_v0, 0x40);
+ audio_dma_copy_immediate(sp3C, temp_v0, 0x40);
temp_a3 = arg2 + 0xD4;
sp34 = temp_a3;
osCreateMesgQueue(temp_a3, arg2 + 0xEC, 1);
@@ -1064,24 +1041,20 @@ block_11:
#else
GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBDDC.s")
#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-? func_800BBF44(); // extern
-extern s32 D_800EA5DC;
-
-void func_800BBEF0(s32 arg2) {
- if (arg2 == 0) {
- D_800EA5DC = 0x19710515;
+extern volatile s32 D_800EA5DC;
+//load_sequence_internal
+void func_800BBF44(u32 player, u32 seqId, s32 loadAsync);
+//load_sequence
+void func_800BBEF0(u32 player, u32 seqId, s32 loadAsync) {
+ if (!loadAsync) {
+ D_800EA5DC = AUDIO_LOCK_LOADING; // gAudioLoadLock
}
- func_800BBF44();
- if (arg2 == 0) {
- D_800EA5DC = 0x76557364;
+ func_800BBF44(player, seqId, loadAsync);
+ if (!loadAsync) {
+ D_800EA5DC = AUDIO_LOCK_NOT_LOADING;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBEF0.s")
-#endif
+//GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBEF0.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
diff --git a/src/audio/load.h b/src/audio/load.h
new file mode 100644
index 000000000..0ef0bea99
--- /dev/null
+++ b/src/audio/load.h
@@ -0,0 +1,12 @@
+#ifndef AUDIO_LOAD_H
+#define AUDIO_LOAD_H
+
+#include <PR/ultratypes.h>
+#include "internal.h"
+
+#define AUDIO_FRAME_DMA_QUEUE_SIZE 0x40
+
+#define PRELOAD_BANKS 2
+#define PRELOAD_SEQUENCE 1
+
+#endif // AUDIO_LOAD_H
diff --git a/src/audio/playback.c b/src/audio/playback.c
index d33b31e7b..b3c127225 100644
--- a/src/audio/playback.c
+++ b/src/audio/playback.c
@@ -292,7 +292,7 @@ f32 func_800BE5E0(void *); // extern
? func_800BEBA4(void *, u32); // extern
? func_800BF004(s32, void *); // extern
extern s32 D_803B1508;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
void func_800BCBC4(void) {
u8 sp4B;
@@ -327,7 +327,7 @@ void func_800BCBC4(void) {
s32 phi_v0_2;
s32 phi_v1;
- temp_v1 = D_803B70B0;
+ temp_v1 = gMaxSimultaneousNotes;
phi_v1 = temp_v1;
if (temp_v1 > 0) {
phi_s5 = 0;
@@ -347,7 +347,7 @@ void func_800BCBC4(void) {
if (temp_v0 == 0) {
func_800BEBA4(temp_a0, temp_a1);
temp_s1_2->unk0 = 1;
- temp_v1_2 = D_803B70B0;
+ temp_v1_2 = gMaxSimultaneousNotes;
phi_v0_2 = temp_v1_2 * 3;
phi_v1 = temp_v1_2;
} else {
@@ -436,7 +436,7 @@ block_27:
phi_s3->unk1 = ((phi_s2 * 4) & 0x1C) | (phi_s3->unk1 & 0xFFE3);
}
}
- temp_v1_3 = D_803B70B0;
+ temp_v1_3 = gMaxSimultaneousNotes;
phi_v0_2 = temp_v1_3 * 3;
phi_v1 = temp_v1_3;
}
@@ -670,7 +670,7 @@ GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BD318.s")
? func_800BF004(? *, s32); // extern
extern s32 D_803B1508;
extern ? D_803B5FC8;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
void func_800BD368(void) {
s32 temp_s1;
@@ -681,7 +681,7 @@ void func_800BD368(void) {
func_800BD318(&D_803B5FC8);
phi_s0 = 0;
phi_s1 = 0;
- if (D_803B70B0 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
do {
temp_v0 = D_803B1508;
(temp_v0 + phi_s0)->unk8 = phi_s0 + temp_v0;
@@ -690,7 +690,7 @@ void func_800BD368(void) {
temp_s1 = phi_s1 + 1;
phi_s0 += 0xC0;
phi_s1 = temp_s1;
- } while (temp_s1 < D_803B70B0);
+ } while (temp_s1 < gMaxSimultaneousNotes);
}
}
#else
@@ -1186,10 +1186,10 @@ GLOBAL_ASM("asm/non_matchings/audio/playback/func_800BDA44.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_800B8FFC(? *, ?); // extern
-extern ? D_803AFBE8;
+s32 soundAlloc(? *, ?); // extern
+extern ? gNotesAndBuffersPool;
extern s32 D_803B1508;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
extern ? gZeroNoteSub;
void func_800BDD34(void) {
@@ -1199,7 +1199,7 @@ void func_800BDD34(void) {
s32 phi_s1;
phi_s1 = 0;
- if (D_803B70B0 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
phi_s2 = 0;
do {
temp_s0 = phi_s2 + D_803B1508;
@@ -1219,11 +1219,11 @@ void func_800BDD34(void) {
temp_s0->unk80 = 0.0f;
temp_s0->unk84 = 0.0f;
temp_s0->unkBC = gZeroNoteSub.unkC;
- temp_s0->unk1C = func_800B8FFC(&D_803AFBE8, 0xA0);
+ temp_s0->unk1C = soundAlloc(&gNotesAndBuffersPool, 0xA0);
temp_s1 = phi_s1 + 1;
phi_s2 += 0xC0;
phi_s1 = temp_s1;
- } while (temp_s1 < D_803B70B0);
+ } while (temp_s1 < gMaxSimultaneousNotes);
}
}
#else
diff --git a/src/audio/port_eu.c b/src/audio/port_eu.c
index d261572fb..a4990188d 100644
--- a/src/audio/port_eu.c
+++ b/src/audio/port_eu.c
@@ -14,10 +14,10 @@ extern OSMesgQueue *D_800EA3B4;
extern s32 D_800EA484;
extern u8 D_803B0500;
extern u8 D_803B0501;
-extern OSMesgQueue D_803B6008;
-extern ? D_803B7088;
+extern OSMesgQueue gCurrAudioFrameDmaQueue;
+extern ? gAudioBufferParameters;
extern s32 D_803B70B8;
-extern s32 D_803B70BC;
+extern s32 gCurrAudioFrameDmaCount;
extern s32 D_803B70C0;
extern s32 D_803B70C4;
extern ? D_803B70C8;
@@ -64,7 +64,7 @@ void *create_next_audio_frame_task(void) {
s32 phi_s1_3;
D_803B70B8 = D_803B70B8 + 1;
- if ((D_803B70B8 % D_803B7088.unk0) != 0) {
+ if ((D_803B70B8 % gAudioBufferParameters.unk0) != 0) {
return NULL;
}
osSendMesg(D_800EA3A8, D_803B70B8, 0);
@@ -79,7 +79,7 @@ void *create_next_audio_frame_task(void) {
if (temp_v1 != 0) {
osAiSetNextBuffer(*(&D_803B7180 + (temp_hi * 4)), temp_v1 * 4);
}
- temp_s1 = D_803B70BC;
+ temp_s1 = gCurrAudioFrameDmaCount;
phi_s0 = 0;
phi_s1 = temp_s1;
phi_s0_2 = 0;
@@ -88,31 +88,31 @@ void *create_next_audio_frame_task(void) {
if (temp_s1 > 0) {
do {
phi_s1_2 = phi_s1_3;
- if (osRecvMesg(&D_803B6008, NULL, 0) == 0) {
+ if (osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0) == 0) {
phi_s1_2 = phi_s1_3 - 1;
}
temp_s0 = phi_s0 + 1;
phi_s0 = temp_s0;
phi_s1 = phi_s1_2;
phi_s1_3 = phi_s1_2;
- } while (temp_s0 < D_803B70BC);
+ } while (temp_s0 < gCurrAudioFrameDmaCount);
}
if ((phi_s1 != 0) && (phi_s1 > 0)) {
do {
- osRecvMesg(&D_803B6008, NULL, 1);
+ osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 1);
temp_s0_2 = phi_s0_2 + 1;
phi_s0_2 = temp_s0_2;
} while (temp_s0_2 != phi_s1);
}
- temp_s1_2 = D_803B6008.validCount;
+ temp_s1_2 = gCurrAudioFrameDmaQueue.validCount;
if ((temp_s1_2 != 0) && (temp_s1_2 > 0)) {
do {
- osRecvMesg(&D_803B6008, NULL, 0);
+ osRecvMesg(&gCurrAudioFrameDmaQueue, NULL, 0);
temp_s0_3 = phi_s0_3 + 1;
phi_s0_3 = temp_s0_3;
} while (temp_s0_3 != temp_s1_2);
}
- D_803B70BC = 0;
+ gCurrAudioFrameDmaCount = 0;
func_800BAC04();
if (osRecvMesg(D_800EA3B0, &sp58, 0) != -1) {
D_803B0501 = sp58;
@@ -131,12 +131,12 @@ void *create_next_audio_frame_task(void) {
D_803B70D0 = *(&D_803B70C8 + (temp_v0 * 4));
sp60 = *temp_a3;
temp_s1_3 = (temp_s0_4 * 2) + &D_803B718C;
- *temp_s1_3 = (((D_803B7088.unk6 - sp74) + 0x40) & 0xFFF0) + 0x10;
- temp_a0 = D_803B7088.unkA;
+ *temp_s1_3 = (((gAudioBufferParameters.unk6 - sp74) + 0x40) & 0xFFF0) + 0x10;
+ temp_a0 = gAudioBufferParameters.unkA;
if (*temp_s1_3 < temp_a0) {
*temp_s1_3 = temp_a0;
}
- temp_v0_2 = D_803B7088.unk8;
+ temp_v0_2 = gAudioBufferParameters.unk8;
if (temp_v0_2 < *temp_s1_3) {
*temp_s1_3 = temp_v0_2;
}
diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c
index 0cfca8028..11602ee5d 100644
--- a/src/audio/synthesis.c
+++ b/src/audio/synthesis.c
@@ -62,8 +62,8 @@ s8 gUseReverb;
s8 gNumSynthesisReverbs;
struct NoteSubEu *gNoteSubsEu;
-extern struct Note *D_803B7088;
-extern s32 D_803B70B0;
+extern struct Note *gAudioBufferParameters;
+extern s32 gMaxSimultaneousNotes;
f32 gLeftVolRampings;
//f32 gRightVolRampings[3][1024];
@@ -164,9 +164,9 @@ void synthesis_load_note_subs_eu(s32 updateIndex) {
struct NoteSubEu *dest;
s32 i;
- for (i = 0; i < D_803B70B0; i++) {
- src = &D_803B7088[i].noteSubEu;
- dest = &gNoteSubsEu[D_803B70B0 * updateIndex + i];
+ for (i = 0; i < gMaxSimultaneousNotes; i++) {
+ src = &gAudioBufferParameters[i].noteSubEu;
+ dest = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (src->enabled) {
*dest = *src;
src->needsInit = FALSE;
@@ -183,11 +183,11 @@ void func_800B6FB4(s32 arg0, s32 arg1) {
s32 phi_v0;
temp_v0 = arg0 + 1;
- if (i = 0; temp_v0 < (s32) D_803B7088.unkC; i++) {
+ if (i = 0; temp_v0 < (s32) gAudioBufferParameters.unkC; i++) {
phi_v0 = temp_v0;
- for(i = 0; temp_v0_2 < (s32) D_803B7088.unkC; i++) {
- dest = &gNoteSubsEu[D_803B70B0 * phi_v0 + (arg1 * 0x10)];
+ for(i = 0; temp_v0_2 < (s32) gAudioBufferParameters.unkC; i++) {
+ dest = &gNoteSubsEu[gMaxSimultaneousNotes * phi_v0 + (arg1 * 0x10)];
if ((*dest * 2) >= 0) {
temp_v0_2 = phi_v0 + 1;
*dest = (s8) ((u8) *dest & 0xFF7F);
@@ -205,8 +205,8 @@ GLOBAL_ASM("asm/non_matchings/audio/synthesis/func_800B6F1C.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
Tried to use struct NoteSubEu before it is defined.
-extern ? D_803B7088;
-extern s32 D_803B70B0;
+extern ? gAudioBufferParameters;
+extern s32 gMaxSimultaneousNotes;
extern ? gNoteSubsEu;
void synthesis_load_note_subs_eu(s32 arg0, s32 arg1) {
@@ -217,16 +217,16 @@ void synthesis_load_note_subs_eu(s32 arg0, s32 arg1) {
temp_v0 = arg0 + 1;
phi_v0 = temp_v0;
- if (temp_v0 < D_803B7088.unkC) {
+ if (temp_v0 < gAudioBufferParameters.unkC) {
// Error: Tried to use struct NoteSubEu before it is defined.
// At instruction: lui $a1, %hi(gNoteSubsEu)
loop_2:
- temp_a0 = *arg1 + (D_803B70B0 * phi_v0 * 0x10) + (arg1 * 0x10);
+ temp_a0 = *arg1 + (gMaxSimultaneousNotes * phi_v0 * 0x10) + (arg1 * 0x10);
if ((*temp_a0 * 2) >= 0) {
temp_v0_2 = phi_v0 + 1;
*temp_a0 = *temp_a0 & 0xFF7F;
phi_v0 = temp_v0_2;
- if (temp_v0_2 < D_803B7088.unkC) {
+ if (temp_v0_2 < gAudioBufferParameters.unkC) {
goto loop_2;
}
}
@@ -239,7 +239,7 @@ GLOBAL_ASM("asm/non_matchings/audio/synthesis/synthesis_load_note_subs_eu.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
Tried to use struct NoteSubEu before it is defined.
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
extern ? gNoteSubsEu;
void func_800B7034(s32 arg0) {
@@ -252,13 +252,13 @@ void func_800B7034(s32 arg0) {
phi_a1 = 0;
phi_v0 = 0;
- if (D_803B70B0 > 0) {
+ if (gMaxSimultaneousNotes > 0) {
// Error: Tried to use struct NoteSubEu before it is defined.
// At instruction: lui $t2, %hi(gNoteSubsEu)
do {
temp_a0 = phi_a1 + *MIPS2C_ERROR(Read from unset register $t1);
temp_a0_2 = temp_a0 + 0xB0;
- temp_a2 = (((D_803B70B0 * arg0) + phi_v0) * 0x10) + *MIPS2C_ERROR(Read from unset register $t2);
+ temp_a2 = (((gMaxSimultaneousNotes * arg0) + phi_v0) * 0x10) + *MIPS2C_ERROR(Read from unset register $t2);
if ((temp_a0->unkB0 >> 0x1F) != 0) {
temp_a2->unk0 = temp_a0_2->unk0;
temp_a2->unk4 = temp_a0_2->unk4;
@@ -271,7 +271,7 @@ void func_800B7034(s32 arg0) {
temp_v0 = phi_v0 + 1;
phi_a1 += 0xC0;
phi_v0 = temp_v0;
- } while (temp_v0 < D_803B70B0);
+ } while (temp_v0 < gMaxSimultaneousNotes);
}
}
#else
@@ -284,7 +284,7 @@ GLOBAL_ASM("asm/non_matchings/audio/synthesis/func_800B7034.s")
void *func_800B775C(s32, s32, void *, s32); // extern
? func_800C1138(s32); // extern
? prepare_reverb_ring_buffer(s32, s32, s32); // extern
-extern ? D_803B7088;
+extern ? gAudioBufferParameters;
void *func_800B70EC(void *arg0, s32 *arg1, s32 arg2, s32 arg3) {
s16 temp_s2;
@@ -317,20 +317,20 @@ void *func_800B70EC(void *arg0, s32 *arg1, s32 arg2, s32 arg3) {
void *phi_fp_2;
s16 phi_s2_3;
- temp_s4 = D_803B7088.unkC;
+ temp_s4 = gAudioBufferParameters.unkC;
phi_s4 = temp_s4;
phi_s6 = arg3;
if (temp_s4 > 0) {
do {
temp_s0 = phi_s4 - 1;
func_800C1138(temp_s0);
- func_800B7034(D_803B7088.unkC - phi_s4);
+ func_800B7034(gAudioBufferParameters.unkC - phi_s4);
phi_s4 = temp_s0;
} while (temp_s0 > 0);
}
arg0->unk0 = 0x7000000;
arg0->unk4 = 0;
- temp_s4_2 = D_803B7088.unkC;
+ temp_s4_2 = gAudioBufferParameters.unkC;
temp_fp = arg0 + 8;
phi_s4_2 = temp_s4_2;
phi_s7 = arg2;
@@ -338,7 +338,7 @@ void *func_800B70EC(void *arg0, s32 *arg1, s32 arg2, s32 arg3) {
phi_fp_2 = temp_fp;
if (temp_s4_2 > 0) {
do {
- temp_s2 = D_803B7088.unkC;
+ temp_s2 = gAudioBufferParameters.unkC;
phi_s2 = temp_s2;
phi_s1 = 0;
phi_s2_2 = temp_s2;
@@ -346,15 +346,15 @@ void *func_800B70EC(void *arg0, s32 *arg1, s32 arg2, s32 arg3) {
phi_s3 = phi_s6;
} else {
temp_lo = phi_s6 / phi_s4_2;
- temp_v1 = D_803B7088.unk10;
+ temp_v1 = gAudioBufferParameters.unk10;
if (temp_lo >= temp_v1) {
phi_s3 = temp_v1;
} else {
- temp_v1_2 = D_803B7088.unk12;
+ temp_v1_2 = gAudioBufferParameters.unk12;
if (temp_v1_2 >= temp_lo) {
phi_s3 = temp_v1_2;
} else {
- phi_s3 = D_803B7088.unkE;
+ phi_s3 = gAudioBufferParameters.unkE;
}
}
}
@@ -367,7 +367,7 @@ void *func_800B70EC(void *arg0, s32 *arg1, s32 arg2, s32 arg3) {
if (phi_s0->useReverb != 0) {
prepare_reverb_ring_buffer(phi_s3, phi_s2 - phi_s4_2, phi_s1);
phi_v0 = gNumSynthesisReverbs;
- phi_s2_3 = D_803B7088.unkC;
+ phi_s2_3 = gAudioBufferParameters.unkC;
}
temp_s1 = phi_s1 + 1;
phi_s0 += 0x108;
@@ -553,7 +553,7 @@ void *func_800B7630(void *, s16, s16); // extern
void *func_800B7C30(u8, s32, s32, s32, s32, void *, s32); // extern
extern ? D_803B03C0;
extern s32 D_803B1508;
-extern s32 D_803B70B0;
+extern s32 gMaxSimultaneousNotes;
extern s32 D_803B7198;
extern ? gNoteSubsEu;
extern u8 gUseReverb;
@@ -627,7 +627,7 @@ void *func_800B775C(s32 arg0, s32 arg1, void *arg2, s16 arg3) {
phi_s2_8 = 0;
phi_s2_4 = 0;
if (temp_t1 == 0) {
- temp_a0 = D_803B70B0;
+ temp_a0 = gMaxSimultaneousNotes;
phi_s1 = 0;
if (temp_a0 > 0) {
// Error: Tried to use struct NoteSubEu before it is defined.
@@ -649,7 +649,7 @@ void *func_800B775C(s32 arg0, s32 arg1, void *arg2, s16 arg3) {
} else {
phi_s3 = 0;
if (temp_t1 > 0) {
- temp_a0_2 = D_803B70B0;
+ temp_a0_2 = gMaxSimultaneousNotes;
do {
phi_s1_2 = 0;
phi_s2_2 = phi_s2_6;
@@ -676,7 +676,7 @@ void *func_800B775C(s32 arg0, s32 arg1, void *arg2, s16 arg3) {
phi_s2_8 = phi_s2_10;
} while (temp_s3 < temp_t1);
}
- temp_a0_3 = D_803B70B0;
+ temp_a0_3 = gMaxSimultaneousNotes;
phi_s1_3 = 0;
phi_s2_3 = phi_s2_8;
phi_s2_4 = phi_s2_8;
@@ -727,7 +727,7 @@ void *func_800B775C(s32 arg0, s32 arg1, void *arg2, s16 arg3) {
loop_31:
temp_v1 = *phi_s0;
temp_t0 = *saved_reg_s6;
- temp_lo = arg3 * D_803B70B0;
+ temp_lo = arg3 * gMaxSimultaneousNotes;
phi_s4_3 = phi_s4_2;
phi_s1_8 = phi_s1_5;
if (phi_s3_2 == ((temp_t0 + (temp_v1 * 0x10) + (temp_lo * 0x10))->unk1 >> 5)) {
@@ -765,7 +765,7 @@ loop_31:
do {
temp_v1_2 = *phi_s0_2;
temp_t0_2 = *saved_reg_s6;
- temp_lo_2 = arg3 * D_803B70B0;
+ temp_lo_2 = arg3 * gMaxSimultaneousNotes;
temp_a1 = (temp_t0_2 + (temp_v1_2 * 0x10) + (temp_lo_2 * 0x10))->unk2;
phi_s4_9 = phi_s4_4;
if (((*(&D_803B03C0 + temp_a1) < 2) ^ 1) == 1) {
diff --git a/src/code_80027040.c b/src/code_80027040.c
index f0c08253b..13ef45a76 100644
--- a/src/code_80027040.c
+++ b/src/code_80027040.c
@@ -7,58 +7,322 @@ extern OSMesgQueue gDmaMesgQueue;
extern OSMesg gMainReceivedMesg;
extern u8 _kart_texturesSegmentRomStart[];
-extern u32 gKartPalettes[];
+extern uintptr_t *gKartPalettes[];
// arrays?
-extern u32 *D_802F1F80;
-extern u32 *D_802DFB80;
+extern u16 D_802F1F80[2][4][2048];
+extern u8 D_802DFB80[2][2][18688];
-extern s16 D_800DDEB0[];
+extern u16 D_800DDEB0[];
+/*
+u16 D_800DDEB0[] = { // sizes
+ 0x06c0, 0x06e0, 0x06e0, 0x0680, 0x07c0, 0x0700, 0x0680, 0x0910
+};
+*/
extern s32 gActiveScreenMode;
-// Structured like a 3D pointer array
-extern u32 ***gKartTextureTable0, ***gKartTextureTable1, **gKartTextureGroup18s;
+extern uintptr_t **gKartTextureGroup18s;
+
+extern uintptr_t *gKartMarioGroup8[];
+extern uintptr_t *gKartMarioGroup7[];
+extern uintptr_t *gKartMarioGroup6[];
+extern uintptr_t *gKartMarioGroup5[];
+extern uintptr_t *gKartMarioGroup4[];
+extern uintptr_t *gKartMarioGroup3[];
+extern uintptr_t *gKartMarioGroup2[];
+extern uintptr_t *gKartMarioGroup1[];
+extern uintptr_t *gKartMarioGroup0[];
+
+extern uintptr_t *gKartLuigiGroup8[];
+extern uintptr_t *gKartLuigiGroup7[];
+extern uintptr_t *gKartLuigiGroup6[];
+extern uintptr_t *gKartLuigiGroup5[];
+extern uintptr_t *gKartLuigiGroup4[];
+extern uintptr_t *gKartLuigiGroup3[];
+extern uintptr_t *gKartLuigiGroup2[];
+extern uintptr_t *gKartLuigiGroup1[];
+extern uintptr_t *gKartLuigiGroup0[];
+
+extern uintptr_t *gKartYoshiGroup8[];
+extern uintptr_t *gKartYoshiGroup7[];
+extern uintptr_t *gKartYoshiGroup6[];
+extern uintptr_t *gKartYoshiGroup5[];
+extern uintptr_t *gKartYoshiGroup4[];
+extern uintptr_t *gKartYoshiGroup3[];
+extern uintptr_t *gKartYoshiGroup2[];
+extern uintptr_t *gKartYoshiGroup1[];
+extern uintptr_t *gKartYoshiGroup0[];
+
+extern uintptr_t *gKartToadGroup8[];
+extern uintptr_t *gKartToadGroup7[];
+extern uintptr_t *gKartToadGroup6[];
+extern uintptr_t *gKartToadGroup5[];
+extern uintptr_t *gKartToadGroup4[];
+extern uintptr_t *gKartToadGroup3[];
+extern uintptr_t *gKartToadGroup2[];
+extern uintptr_t *gKartToadGroup1[];
+extern uintptr_t *gKartToadGroup0[];
+
+extern uintptr_t *gKartDKGroup8[];
+extern uintptr_t *gKartDKGroup7[];
+extern uintptr_t *gKartDKGroup6[];
+extern uintptr_t *gKartDKGroup5[];
+extern uintptr_t *gKartDKGroup4[];
+extern uintptr_t *gKartDKGroup3[];
+extern uintptr_t *gKartDKGroup2[];
+extern uintptr_t *gKartDKGroup1[];
+extern uintptr_t *gKartDKGroup0[];
+
+extern uintptr_t *gKartWarioGroup8[];
+extern uintptr_t *gKartWarioGroup7[];
+extern uintptr_t *gKartWarioGroup6[];
+extern uintptr_t *gKartWarioGroup5[];
+extern uintptr_t *gKartWarioGroup4[];
+extern uintptr_t *gKartWarioGroup3[];
+extern uintptr_t *gKartWarioGroup2[];
+extern uintptr_t *gKartWarioGroup1[];
+extern uintptr_t *gKartWarioGroup0[];
+
+extern uintptr_t *gKartPeachGroup8[];
+extern uintptr_t *gKartPeachGroup7[];
+extern uintptr_t *gKartPeachGroup6[];
+extern uintptr_t *gKartPeachGroup5[];
+extern uintptr_t *gKartPeachGroup4[];
+extern uintptr_t *gKartPeachGroup3[];
+extern uintptr_t *gKartPeachGroup2[];
+extern uintptr_t *gKartPeachGroup1[];
+extern uintptr_t *gKartPeachGroup0[];
+
+extern uintptr_t *gKartBowserGroup8[];
+extern uintptr_t *gKartBowserGroup7[];
+extern uintptr_t *gKartBowserGroup6[];
+extern uintptr_t *gKartBowserGroup5[];
+extern uintptr_t *gKartBowserGroup4[];
+extern uintptr_t *gKartBowserGroup3[];
+extern uintptr_t *gKartBowserGroup2[];
+extern uintptr_t *gKartBowserGroup1[];
+extern uintptr_t *gKartBowserGroup0[];
+
+extern uintptr_t *gKartMarioGroup17[];
+extern uintptr_t *gKartMarioGroup16[];
+extern uintptr_t *gKartMarioGroup15[];
+extern uintptr_t *gKartMarioGroup14[];
+extern uintptr_t *gKartMarioGroup13[];
+extern uintptr_t *gKartMarioGroup12[];
+extern uintptr_t *gKartMarioGroup11[];
+extern uintptr_t *gKartMarioGroup10[];
+extern uintptr_t *gKartMarioGroup9[];
+
+extern uintptr_t *gKartLuigiGroup17[];
+extern uintptr_t *gKartLuigiGroup16[];
+extern uintptr_t *gKartLuigiGroup15[];
+extern uintptr_t *gKartLuigiGroup14[];
+extern uintptr_t *gKartLuigiGroup13[];
+extern uintptr_t *gKartLuigiGroup12[];
+extern uintptr_t *gKartLuigiGroup11[];
+extern uintptr_t *gKartLuigiGroup10[];
+extern uintptr_t *gKartLuigiGroup9[];
+
+extern uintptr_t *gKartYoshiGroup17[];
+extern uintptr_t *gKartYoshiGroup16[];
+extern uintptr_t *gKartYoshiGroup15[];
+extern uintptr_t *gKartYoshiGroup14[];
+extern uintptr_t *gKartYoshiGroup13[];
+extern uintptr_t *gKartYoshiGroup12[];
+extern uintptr_t *gKartYoshiGroup11[];
+extern uintptr_t *gKartYoshiGroup10[];
+extern uintptr_t *gKartYoshiGroup9[];
+
+extern uintptr_t *gKartToadGroup17[];
+extern uintptr_t *gKartToadGroup16[];
+extern uintptr_t *gKartToadGroup15[];
+extern uintptr_t *gKartToadGroup14[];
+extern uintptr_t *gKartToadGroup13[];
+extern uintptr_t *gKartToadGroup12[];
+extern uintptr_t *gKartToadGroup11[];
+extern uintptr_t *gKartToadGroup10[];
+extern uintptr_t *gKartToadGroup9[];
+
+extern uintptr_t *gKartDKGroup17[];
+extern uintptr_t *gKartDKGroup16[];
+extern uintptr_t *gKartDKGroup15[];
+extern uintptr_t *gKartDKGroup14[];
+extern uintptr_t *gKartDKGroup13[];
+extern uintptr_t *gKartDKGroup12[];
+extern uintptr_t *gKartDKGroup11[];
+extern uintptr_t *gKartDKGroup10[];
+extern uintptr_t *gKartDKGroup9[];
+
+extern uintptr_t *gKartWarioGroup17[];
+extern uintptr_t *gKartWarioGroup16[];
+extern uintptr_t *gKartWarioGroup15[];
+extern uintptr_t *gKartWarioGroup14[];
+extern uintptr_t *gKartWarioGroup13[];
+extern uintptr_t *gKartWarioGroup12[];
+extern uintptr_t *gKartWarioGroup11[];
+extern uintptr_t *gKartWarioGroup10[];
+extern uintptr_t *gKartWarioGroup9[];
+
+extern uintptr_t *gKartPeachGroup17[];
+extern uintptr_t *gKartPeachGroup16[];
+extern uintptr_t *gKartPeachGroup15[];
+extern uintptr_t *gKartPeachGroup14[];
+extern uintptr_t *gKartPeachGroup13[];
+extern uintptr_t *gKartPeachGroup12[];
+extern uintptr_t *gKartPeachGroup11[];
+extern uintptr_t *gKartPeachGroup10[];
+extern uintptr_t *gKartPeachGroup9[];
+
+extern uintptr_t *gKartBowserGroup17[];
+extern uintptr_t *gKartBowserGroup16[];
+extern uintptr_t *gKartBowserGroup15[];
+extern uintptr_t *gKartBowserGroup14[];
+extern uintptr_t *gKartBowserGroup13[];
+extern uintptr_t *gKartBowserGroup12[];
+extern uintptr_t *gKartBowserGroup11[];
+extern uintptr_t *gKartBowserGroup10[];
+extern uintptr_t *gKartBowserGroup9[];
+
+
+
+uintptr_t **gKartMarioTable0[] = {
+ gKartMarioGroup8, gKartMarioGroup7, gKartMarioGroup6,
+ gKartMarioGroup5, gKartMarioGroup4, gKartMarioGroup3,
+ gKartMarioGroup2, gKartMarioGroup1, gKartMarioGroup0,
+};
+uintptr_t **gKartLuigiTable0[] = {
+ gKartLuigiGroup8, gKartLuigiGroup7, gKartLuigiGroup6,
+ gKartLuigiGroup5, gKartLuigiGroup4, gKartLuigiGroup3,
+ gKartLuigiGroup2, gKartLuigiGroup1, gKartLuigiGroup0,
+};
+uintptr_t **gKartYoshiTable0[] = {
+ gKartYoshiGroup8, gKartYoshiGroup7, gKartYoshiGroup6,
+ gKartYoshiGroup5, gKartYoshiGroup4, gKartYoshiGroup3,
+ gKartYoshiGroup2, gKartYoshiGroup1, gKartYoshiGroup0,
+};
+uintptr_t **gKartToadTable0[] = {
+ gKartToadGroup8, gKartToadGroup7, gKartToadGroup6,
+ gKartToadGroup5, gKartToadGroup4, gKartToadGroup3,
+ gKartToadGroup2, gKartToadGroup1, gKartToadGroup0,
+};
+uintptr_t **gKartDKTable0[] = {
+ gKartDKGroup8, gKartDKGroup7, gKartDKGroup6,
+ gKartDKGroup5, gKartDKGroup4, gKartDKGroup3,
+ gKartDKGroup2, gKartDKGroup1, gKartDKGroup0,
+};
+uintptr_t **gKartWarioTable0[] = {
+ gKartWarioGroup8, gKartWarioGroup7, gKartWarioGroup6,
+ gKartWarioGroup5, gKartWarioGroup4, gKartWarioGroup3,
+ gKartWarioGroup2, gKartWarioGroup1, gKartWarioGroup0,
+};
+uintptr_t **gKartPeachTable0[] = {
+ gKartPeachGroup8, gKartPeachGroup7, gKartPeachGroup6,
+ gKartPeachGroup5, gKartPeachGroup4, gKartPeachGroup3,
+ gKartPeachGroup2, gKartPeachGroup1, gKartPeachGroup0,
+};
+uintptr_t **gKartBowserTable0[] = {
+ gKartBowserGroup8, gKartBowserGroup7, gKartBowserGroup6,
+ gKartBowserGroup5, gKartBowserGroup4, gKartBowserGroup3,
+ gKartBowserGroup2, gKartBowserGroup1, gKartBowserGroup0,
+};
+
+uintptr_t **gKartMarioTable1[] = {
+ gKartMarioGroup17, gKartMarioGroup16, gKartMarioGroup15,
+ gKartMarioGroup14, gKartMarioGroup13, gKartMarioGroup12,
+ gKartMarioGroup11, gKartMarioGroup10, gKartMarioGroup9,
+};
+
+uintptr_t **gKartLuigiTable1[] = {
+ gKartLuigiGroup17, gKartLuigiGroup16, gKartLuigiGroup15, gKartLuigiGroup14,
+ gKartLuigiGroup13, gKartLuigiGroup12, gKartLuigiGroup11, gKartLuigiGroup10,
+ gKartLuigiGroup9,
+};
+uintptr_t **gKartYoshiTable1[] = {
+ gKartYoshiGroup17, gKartYoshiGroup16, gKartYoshiGroup15, gKartYoshiGroup14,
+ gKartYoshiGroup13, gKartYoshiGroup12, gKartYoshiGroup11, gKartYoshiGroup10,
+ gKartYoshiGroup9,
+};
+uintptr_t **gKartToadTable1[] = {
+ gKartToadGroup17, gKartToadGroup16, gKartToadGroup15, gKartToadGroup14,
+ gKartToadGroup13, gKartToadGroup12, gKartToadGroup11, gKartToadGroup10,
+ gKartToadGroup9,
+};
+uintptr_t **gKartDKTable1[] = {
+ gKartDKGroup17, gKartDKGroup16, gKartDKGroup15, gKartDKGroup14,
+ gKartDKGroup13, gKartDKGroup12, gKartDKGroup11, gKartDKGroup10,
+ gKartDKGroup9,
+};
+uintptr_t **gKartWarioTable1[] = {
+ gKartWarioGroup17, gKartWarioGroup16, gKartWarioGroup15, gKartWarioGroup14,
+ gKartWarioGroup13, gKartWarioGroup12, gKartWarioGroup11, gKartWarioGroup10,
+ gKartWarioGroup9,
+};
+uintptr_t **gKartPeachTable1[] = {
+ gKartPeachGroup17, gKartPeachGroup16, gKartPeachGroup15, gKartPeachGroup14,
+ gKartPeachGroup13, gKartPeachGroup12, gKartPeachGroup11, gKartPeachGroup10,
+ gKartPeachGroup9,
+};
+uintptr_t **gKartBowserTable1[] = {
+ gKartBowserGroup17, gKartBowserGroup16, gKartBowserGroup15, gKartBowserGroup14,
+ gKartBowserGroup13, gKartBowserGroup12, gKartBowserGroup11, gKartBowserGroup10,
+ gKartBowserGroup9,
+};
+
+uintptr_t ***gKartTextureTable0[] = {
+ gKartMarioTable0,
+ gKartLuigiTable0,
+ gKartYoshiTable0,
+ gKartToadTable0,
+ gKartDKTable0,
+ gKartWarioTable0,
+ gKartPeachTable0,
+ gKartBowserTable0,
+};
+
+uintptr_t ***gKartTextureTable1[] = {
+ gKartMarioTable1,
+ gKartLuigiTable1,
+ gKartYoshiTable1,
+ gKartToadTable1,
+ gKartDKTable1,
+ gKartWarioTable1,
+ gKartPeachTable1,
+ gKartBowserTable1,
+};
// some larger diffs that need resolving
#ifdef MIPS_TO_C
-void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s32 arg4) {
- s32 temp_v0 = player->unk_0BC;
- void *temp_s0;
- // void *temp_v1;
-
- if ((temp_v0 & 0x80) == 0x80 ||
- (temp_v0 & 0x40) == 0x40 ||
- (temp_v0 & 0x80000) == 0x80000 ||
- (temp_v0 & 0x800000) == 0x800000 ||
- (temp_v0 & 0x20000) == 0x20000 ||
- (player->unk_044 & 0x800) != 0
- ) {
+void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
+
+ //s32 tmp = player->unk_0BC;
+ void *buf; // = &D_802DFB80[arg4][arg3][arg1 * 0x920];
+ u16 id;
+ if (((((((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40)) || ((player->unk_0BC & 0x80000) == 0x80000)) || ((player->unk_0BC & 0x800000) == 0x800000)) || ((player->unk_0BC & 0x20000) == 0x20000)) || ((player->unk_044 & 0x800) != 0))
+ {
// temp_v1 = player + (arg2 * 2);
- if (player->unk_244[arg2] == 0) {
- temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0, D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue);
+ if (player->unk_244[arg2] != 0) {
+ //buf = &D_802DFB80[arg2][arg1 * 0x920];
+ buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(buf, D_800DDEB0[player->characterId]);
+ id = player->characterId;
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[id][player->unk_24C[arg2]][player->unk_244[arg2]])], buf, D_800DDEB0[player->unk_0BC], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
} else {
- temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0, D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue);
+ buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(&D_802DFB80[arg4][arg3], D_800DDEB0[player->characterId]);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], buf, D_800DDEB0[player->unk_0BC], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
}
- }
- else if ((temp_v0 & 0x400) == 0x400 ||
- (temp_v0 & 0x1000000) == 0x1000000 ||
- (temp_v0 & 0x2000000) == 0x2000000 ||
- (temp_v0 & 0x10000) == 0x10000
- ) {
- temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0, 0x780);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8] & 0xFFFFFF], temp_s0, 0x900, &gDmaMesgQueue);
+ } else if (((((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x1000000) == 0x1000000)) || ((player->unk_0BC & 0x2000000) == 0x2000000)) || ((player->unk_0BC & 0x10000) == 0x10000))
+ {
+ buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(buf, 0x780);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], buf, 0x900, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
} else {
- temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0, D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue);
+ buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(buf, D_800DDEB0[player->characterId]);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], buf, D_800DDEB0[player->unk_0BC], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
}
}
@@ -68,111 +332,70 @@ GLOBAL_ASM("asm/non_matchings/code_80027040/func_80027040.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3ec45aadfc2cb619035fb802d88c52eacfab0326
-void func_80027560(Player *arg0, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
- void *sp30;
- s32 temp_v0;
- s8 temp_a3;
- u16 temp_v0;
- u16 temp_v0;
- u16 temp_v0;
+void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
+ //s32 temp_v0;
void *temp_s0;
- void *temp_s0_2;
- void *temp_s0_3;
- void *temp_s0_4;
- void *temp_v1;
- void *temp_v1_2;
-
- temp_v0 = arg0->unkBC;
- temp_a3 = arg3;
- if ((temp_v0 & 0x80) == 0x80) {
-block_6:
- temp_v1_2 = arg0 + (arg2 * 2);
- if (temp_v1_2->unk244 == 0) {
- temp_s0_4 = (arg4 * 0x9200) + (temp_a3 * 0x4900) + (arg1 * 0x920) + 0x802DFB80;
- sp30 = temp_v1_2;
- osInvalDCache(temp_s0_4, *(&D_800DDEB0 + (arg0->unk254 * 2)));
- temp_v0 = arg0->unk254;
- osPiStartDma(&gDmaIoMesg, 0, 0, (*(*(*(&gKartTextureTable0 + (temp_v0 * 4)) + (temp_v1_2->unk24C * 4)) + (temp_v1_2->unk244 * 4)) & 0xFFFFFF) + &_kart_texturesSegmentRomStart, temp_s0_4, *(&D_800DDEB0 + (temp_v0 * 2)), &gDmaMesgQueue);
- return;
+
+ //temp_v0 = player->unk_0BC;
+ if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x80000) == 0x80000) || ((player->unk_0BC & 0x800000) == 0x800000) || ((player->unk_0BC & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0))
+ {
+ //temp_v1_2 = player + (arg2 * 2);
+ if (player->unk_244[arg2] != 0) {
+ temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(D_802DFB80[arg4][arg3], D_800DDEB0[player->characterId]);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], temp_s0, D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ } else {
+ temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(temp_s0, D_800DDEB0[player->characterId]);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], temp_s0, D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
- temp_s0_3 = (arg4 * 0x9200) + (temp_a3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- sp30 = temp_v1_2;
- osInvalDCache(temp_s0_3, *(&D_800DDEB0 + (arg0->unk254 * 2)));
- temp_v0 = arg0->unk254;
- osPiStartDma(&gDmaIoMesg, 0, 0, (*(*(*(&gKartTextureTable1 + (temp_v0 * 4)) + (temp_v1_2->unk24C * 4)) + (temp_v1_2->unk244 * 4)) & 0xFFFFFF) + &_kart_texturesSegmentRomStart, temp_s0_3, *(&D_800DDEB0 + (temp_v0 * 2)), &gDmaMesgQueue);
- return;
- }
- if ((temp_v0 & 0x40) == 0x40) {
- goto block_6;
- }
- if ((temp_v0 & 0x80000) == 0x80000) {
- goto block_6;
- }
- if ((temp_v0 & 0x800000) == 0x800000) {
- goto block_6;
- }
- if ((temp_v0 & 0x20000) == 0x20000) {
- goto block_6;
- }
- if ((arg0->unk44 & 0x800) != 0) {
- goto block_6;
- }
- if ((temp_v0 & 0x400) == 0x400) {
-block_13:
- temp_s0_2 = (arg4 * 0x9200) + (temp_a3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0_2, 0x780);
- osPiStartDma(&gDmaIoMesg, 0, 0, (*(*(&gKartTextureGroup18s + (arg0->unk254 * 4)) + ((arg0->unkA8 >> 8) * 4)) & 0xFFFFFF) + &_kart_texturesSegmentRomStart, temp_s0_2, 0x900, &gDmaMesgQueue);
- return;
- }
- if ((temp_v0 & 0x1000000) == 0x1000000) {
- goto block_13;
- }
- if ((temp_v0 & 0x2000000) == 0x2000000) {
- goto block_13;
- }
- if ((temp_v0 & 0x10000) == 0x10000) {
- goto block_13;
+ } else if (((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x01000000) == 0x01000000) || ((player->unk_0BC & 0x02000000) == 0x02000000) || ((player->unk_0BC & 0x10000) == 0x10000))
+ {
+ temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(temp_s0, 0x780);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], temp_s0, 0x900, &gDmaMesgQueue);
+ } else {
+ temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
+ osInvalDCache(temp_s0, D_800DDEB0[player->characterId]);
+ //temp_v1 = player + (arg2 * 2);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], temp_s0, D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
- temp_s0 = (arg4 * 0x9200) + (temp_a3 * 0x4900) + (arg1 * 0x920) + D_802DFB80;
- osInvalDCache(temp_s0, *(&D_800DDEB0 + (arg0->unk254 * 2)));
- temp_v0 = arg0->unk254;
- temp_v1 = arg0 + (arg2 * 2);
- osPiStartDma(&gDmaIoMesg, 0, 0, (*(*(*(&gKartTextureTable0 + (temp_v0 * 4)) + (temp_v1->unk24C * 4)) + (temp_v1->unk244 * 4)) & 0xFFFFFF) + &_kart_texturesSegmentRomStart, temp_s0, *(&D_800DDEB0 + (temp_v0 * 2)), &gDmaMesgQueue);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80027040/func_80027560.s")
#endif
-// regalloc
-#ifdef NON_MATCHING
void func_80027A20(Player *player, s8 arg1, s8 arg2, s8 arg3) {
- void *temp_s0 = (arg3 << 0xE) + (arg2 << 0xC) + (arg1 << 9) + (s32)&D_802F1F80;
+ // @bug: Undefined Behaviour UB
+ // untested fix
+ #ifdef AVOID_UB
+ void *temp_s0 = &D_802F1F80[arg3][arg2][0];
+ #else
+ void *temp_s0 = &D_802F1F80[arg3][arg2][arg1 << 8];
+ #endif
switch(gActiveScreenMode) {
- case 0: case 1: case 2:
+ case 0: case 1:
+ case 2:
osInvalDCache(temp_s0, 0x200);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->characterId] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, 0x200, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
break;
case 3:
osInvalDCache(temp_s0, 0x200);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->characterId] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, 0x200, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
break;
- default: break;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/code_80027040/func_80027A20.s")
-#endif
-void func_80027BDC(s32 arg0, s32 arg1, void *vAddr, u16 size) {
+void func_80027BDC(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[arg1 & 0x00FFFFFF], vAddr, size, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
}
-void func_80027C74(s32 arg0, s32 arg1, void *vAddr, u16 size) {
+void func_80027C74(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[arg1 & 0x00FFFFFF], vAddr, size, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
}
diff --git a/src/framebuffers.c b/src/framebuffers.c
index 9684baeaa..709ad76bb 100644
--- a/src/framebuffers.c
+++ b/src/framebuffers.c
@@ -10,8 +10,8 @@ u8 D_802BFB80[77824];
u8 D_802D2B80[32768]; // Luigi raceway course path ghost
u8 D_802DAB80[20480];
-u16 D_802DFB80[37376];
-u16 D_802F1F80[16382];
+u8 D_802DFB80[2][2][18688];
+u16 D_802F1F80[2][4][2048];
u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
diff --git a/src/internal.h b/src/internal.h
deleted file mode 100644
index 460b07771..000000000
--- a/src/internal.h
+++ /dev/null
@@ -1,565 +0,0 @@
-#ifndef AUDIO_INTERNAL_H
-#define AUDIO_INTERNAL_H
-
-#include <ultra64.h>
-
-#include "types.h"
-
-
-// sm64 build defines
-#define IS_BIG_ENDIAN 1
-// sm64 build defines
-
-
-#define SEQUENCE_PLAYERS 4
-#define SEQUENCE_CHANNELS 48
-#define SEQUENCE_LAYERS 64
-
-#define LAYERS_MAX 4
-#define CHANNELS_MAX 16
-
-#define NO_LAYER ((struct SequenceChannelLayer *)(-1))
-
-#define MUTE_BEHAVIOR_STOP_SCRIPT 0x80 // stop processing sequence/channel scripts
-#define MUTE_BEHAVIOR_STOP_NOTES 0x40 // prevent further notes from playing
-#define MUTE_BEHAVIOR_SOFTEN 0x20 // lower volume, by default to half
-
-#define SEQUENCE_PLAYER_STATE_0 0
-#define SEQUENCE_PLAYER_STATE_FADE_OUT 1
-#define SEQUENCE_PLAYER_STATE_2 2
-#define SEQUENCE_PLAYER_STATE_3 3
-#define SEQUENCE_PLAYER_STATE_4 4
-
-#define NOTE_PRIORITY_DISABLED 0
-#define NOTE_PRIORITY_STOPPING 1
-#define NOTE_PRIORITY_MIN 2
-#define NOTE_PRIORITY_DEFAULT 3
-
-#define TATUMS_PER_BEAT 48
-
-// abi.h contains more details about the ADPCM and S8 codecs, "skip" skips codec processing
-#define CODEC_ADPCM 0
-#define CODEC_S8 1
-#define CODEC_SKIP 2
-
-#define TEMPO_SCALE TATUMS_PER_BEAT
-
-// TODO: US_FLOAT should probably be renamed to JP_DOUBLE since eu seems to use floats too
-#define US_FLOAT(x) x ## f
-
-// Convert u8 or u16 to f32.
-#define FLOAT_CAST(x) (f32) (s32) (x)
-
-// No-op printf macro which leaves string literals in rodata in IDO. IDO
-// doesn't support variadic macros, so instead we let the parameter list
-// expand to a no-op comma expression. Another possibility is that it might
-// have expanded to something with "if (0)". See also goddard/gd_main.h.
-// On US/JP, -sopt optimizes away these except for external.c.
-#ifdef __sgi
-#define stubbed_printf
-#else
-#define stubbed_printf(...)
-#endif
-
-#define eu_stubbed_printf_0(msg) stubbed_printf(msg)
-#define eu_stubbed_printf_1(msg, a) stubbed_printf(msg, a)
-#define eu_stubbed_printf_2(msg, a, b) stubbed_printf(msg, a, b)
-#define eu_stubbed_printf_3(msg, a, b, c) stubbed_printf(msg, a, b, c)
-
-struct NotePool;
-
-struct AudioListItem {
- // A node in a circularly linked list. Each node is either a head or an item:
- // - Items can be either detached (prev = NULL), or attached to a list.
- // 'value' points to something of interest.
- // - List heads are always attached; if a list is empty, its head points
- // to itself. 'count' contains the size of the list.
- // If the list holds notes, 'pool' points back to the pool where it lives.
- // Otherwise, that member is NULL.
- struct AudioListItem *prev;
- struct AudioListItem *next;
- union {
- void *value; // either Note* or SequenceChannelLayer*
- s32 count;
- } u;
- struct NotePool *pool;
-}; // size = 0x10
-
-struct NotePool {
- struct AudioListItem disabled;
- struct AudioListItem decaying;
- struct AudioListItem releasing;
- struct AudioListItem active;
-};
-
-struct VibratoState {
- /*0x00, 0x00*/ struct SequenceChannel *seqChannel;
- /*0x04, 0x04*/ u32 time;
- /* , 0x08*/ s16 *curve;
- /* , 0x0C*/ f32 extent;
- /* , 0x10*/ f32 rate;
- /* , 0x14*/ u8 active;
- /*0x12, 0x16*/ u16 rateChangeTimer;
- /*0x14, 0x18*/ u16 extentChangeTimer;
- /*0x16, 0x1A*/ u16 delay;
-}; // size = 0x18, 0x1C on EU
-
-// Pitch sliding by up to one octave in the positive direction. Negative
-// direction is "supported" by setting extent to be negative. The code
-// extrapolates exponentially in the wrong direction in that case, but that
-// doesn't prevent seqplayer from doing it, AFAICT.
-struct Portamento {
- u8 mode; // bit 0x80 denotes something; the rest are an index 0-5
- f32 cur;
- f32 speed;
- f32 extent;
-}; // size = 0x10
-
-struct AdsrEnvelope {
- s16 delay;
- s16 arg;
-}; // size = 0x4
-
-struct AdpcmLoop {
- u32 start;
- u32 end;
- u32 count;
- u32 pad;
- s16 state[16]; // only exists if count != 0. 8-byte aligned
-};
-
-struct AdpcmBook {
- s32 order;
- s32 npredictors;
- s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
-};
-
-struct AudioBankSample {
- u8 unused;
- u8 loaded;
- u8 *sampleAddr;
- struct AdpcmLoop *loop;
- struct AdpcmBook *book;
-};
-
-struct AudioBankSound {
- struct AudioBankSample *sample;
- f32 tuning; // frequency scale factor
-}; // size = 0x8
-
-struct Instrument {
- /*0x00*/ u8 loaded;
- /*0x01*/ u8 normalRangeLo;
- /*0x02*/ u8 normalRangeHi;
- /*0x03*/ u8 releaseRate;
- /*0x04*/ struct AdsrEnvelope *envelope;
- /*0x08*/ struct AudioBankSound lowNotesSound;
- /*0x10*/ struct AudioBankSound normalNotesSound;
- /*0x18*/ struct AudioBankSound highNotesSound;
-}; // size = 0x20
-
-struct Drum {
- u8 releaseRate;
- u8 pan;
- u8 loaded;
- struct AudioBankSound sound;
- struct AdsrEnvelope *envelope;
-};
-
-struct AudioBank {
- struct Drum **drums;
- struct Instrument *instruments[1];
-}; // dynamic size
-
-struct CtlEntry {
- u8 unused;
- u8 numInstruments;
- u8 numDrums;
- struct Instrument **instruments;
- struct Drum **drums;
-}; // size = 0xC
-
-struct M64ScriptState {
- u8 *pc;
- u8 *stack[4];
- u8 remLoopIters[4];
- u8 depth;
-}; // size = 0x1C
-
-// Also known as a Group, according to debug strings.
-struct SequencePlayer {
- /*0x000, 0x000, 0x000*/ u8 enabled : 1;
- /*0x000, 0x000*/ u8 finished : 1; // never read
- /*0x000, 0x000*/ u8 muted : 1;
- /*0x000, 0x000*/ u8 seqDmaInProgress : 1;
- /*0x000, 0x000*/ u8 bankDmaInProgress : 1;
- /* 0x000*/ u8 recalculateVolume : 1;
- /*0x002, 0x001, 0x001*/ u8 state;
- /*0x003, 0x002*/ u8 noteAllocPolicy;
- /*0x004, 0x003*/ u8 muteBehavior;
- /*0x005, 0x004*/ u8 seqId;
- /*0x006, 0x005*/ u8 defaultBank[1]; // must be an array to get a comparison
- // to match; other u8's might also be part of that array
- /*0x007, 0x006*/ u8 loadingBankId;
- /* , 0x007, 0x007*/ s8 seqVariationEu[1];
- /*0x00A, 0x008*/ u16 tempo; // beats per minute in JP, tatums per minute in US/EU
- /*0x00C, 0x00A*/ u16 tempoAcc;
- /*0x010, 0x00C, 0x00E*/ s16 transposition;
- /*0x012, 0x00E, 0x010*/ u16 delay;
- /*0x00E, 0x010, 0x012*/ u16 fadeRemainingFrames;
- /* , 0x012, 0x014*/ u16 fadeTimerUnkEu;
- /*0x014, 0x014*/ u8 *seqData; // buffer of some sort
- /*0x018, 0x018, 0x1C*/ f32 fadeVolume; // set to 1.0f
- /*0x01C, 0x01C*/ f32 fadeVelocity; // set to 0.0f
- /*0x020, 0x020, 0x024*/ f32 volume; // set to 0.0f
- /*0x024, 0x024*/ f32 muteVolumeScale; // set to 0.5f
- /* , 0x028, 0x02C*/ f32 fadeVolumeScale;
- /* , 0x02C*/ f32 appliedFadeVolume;
- /*0x02C, 0x030, 0x034*/ struct SequenceChannel *channels[CHANNELS_MAX];
- /*0x06C, 0x070*/ struct M64ScriptState scriptState;
- /*0x088, 0x08C*/ u8 *shortNoteVelocityTable;
- /*0x08C, 0x090*/ u8 *shortNoteDurationTable;
- /*0x090, 0x094*/ struct NotePool notePool;
- /*0x0D0, 0x0D4*/ OSMesgQueue seqDmaMesgQueue;
- /*0x0E8, 0x0EC*/ OSMesg seqDmaMesg;
- /*0x0EC, 0x0F0*/ OSIoMesg seqDmaIoMesg;
- /*0x100, 0x108*/ OSMesgQueue bankDmaMesgQueue;
- /*0x118, 0x120*/ OSMesg bankDmaMesg;
- /*0x11C, 0x124*/ OSIoMesg bankDmaIoMesg;
- /*0x130, 0x13C*/ u8 *bankDmaCurrMemAddr;
- /*0x138, 0x140*/ uintptr_t bankDmaCurrDevAddr;
- /*0x13C, 0x144*/ ssize_t bankDmaRemaining;
-}; // size = 0x140, 0x148 on EU, 0x14C on SH
-
-struct AdsrSettings {
- u8 releaseRate;
- u8 sustain;
- struct AdsrEnvelope *envelope;
-}; // size = 0x8
-
-struct AdsrState {
- /*0x00, 0x00*/ u8 action;
- /*0x01, 0x01*/ u8 state;
- /*0x08, 0x02*/ s16 envIndex;
- /*0x0A, 0x04*/ s16 delay;
- /* , 0x08*/ f32 sustain;
- /* , 0x0C*/ f32 velocity;
- /* , 0x10*/ f32 fadeOutVel;
- /* , 0x14*/ f32 current;
- /* , 0x18*/ f32 target;
- s32 pad1C;
- /*0x1C, 0x20*/ struct AdsrEnvelope *envelope;
-}; // size = 0x20, 0x24 in EU
-
-struct ReverbBitsData {
- /* 0x00 */ u8 bit0 : 1;
- /* 0x00 */ u8 bit1 : 1;
- /* 0x00 */ u8 bit2 : 1;
- /* 0x00 */ u8 usesHeadsetPanEffects : 1;
- /* 0x00 */ u8 stereoHeadsetEffects : 2;
- /* 0x00 */ u8 strongRight : 1;
- /* 0x00 */ u8 strongLeft : 1;
-};
-
-union ReverbBits {
- /* 0x00 */ struct ReverbBitsData s;
- /* 0x00 */ u8 asByte;
-};
-struct ReverbInfo {
- u8 reverbVol;
- u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
- u8 pan;
- union ReverbBits reverbBits;
- f32 freqScale;
- f32 velocity;
- s32 unused;
- s16 *filter;
-};
-
-struct NoteAttributes {
- u8 reverbVol;
- u8 pan;
- f32 freqScale;
- f32 velocity;
-}; // size = 0x10
-
-// Also known as a SubTrack, according to debug strings.
-// Confusingly, a SubTrack is a container of Tracks.
-struct SequenceChannel {
- /* U/J, EU, SH */
- /*0x00, 0x00*/ u8 enabled : 1;
- /*0x00, 0x00*/ u8 finished : 1;
- /*0x00, 0x00*/ u8 stopScript : 1;
- /*0x00, 0x00*/ u8 stopSomething2 : 1; // sets SequenceChannelLayer.stopSomething
- /*0x00, 0x00*/ u8 hasInstrument : 1;
- /*0x00, 0x00*/ u8 stereoHeadsetEffects : 1;
- /*0x00, ????*/ u8 largeNotes : 1; // notes specify duration and velocity
- /*0x00, ????*/ u8 unused : 1; // never read, set to 0
- /* , 0x01*/ union {
- struct {
- u8 freqScale : 1;
- u8 volume : 1;
- u8 pan : 1;
- } as_bitfields;
- u8 as_u8;
- } changes;
- /*0x01, 0x02*/ u8 noteAllocPolicy;
- /*0x02, 0x03, 0x03*/ u8 muteBehavior;
- /*0x03, 0x04, 0x04*/ u8 reverbVol; // until EU: Q1.7, after EU: UQ0.8
- /*0x04, ????*/ u8 notePriority; // 0-3
- /*0x05, 0x06*/ u8 bankId;
- /* , 0x07*/ u8 reverbIndex;
- /* , 0x08, 0x09*/ u8 bookOffset;
- /* , 0x09*/ u8 newPan;
- /* , 0x0A*/ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
- /*0x08, 0x0C, 0x0E*/ u16 vibratoRateStart; // initially 0x800
- /*0x0A, 0x0E, 0x10*/ u16 vibratoExtentStart;
- /*0x0C, 0x10, 0x12*/ u16 vibratoRateTarget; // initially 0x800
- /*0x0E, 0x12, 0x14*/ u16 vibratoExtentTarget;
- /*0x10, 0x14, 0x16*/ u16 vibratoRateChangeDelay;
- /*0x12, 0x16, 0x18*/ u16 vibratoExtentChangeDelay;
- /*0x14, 0x18, 0x1A*/ u16 vibratoDelay;
- /*0x16, 0x1A, 0x1C*/ u16 delay;
- /*0x18, 0x1C, 0x1E*/ s16 instOrWave; // either 0 (none), instrument index + 1, or
- // 0x80..0x83 for sawtooth/triangle/sine/square waves.
- /*0x1A, 0x1E, 0x20*/ s16 transposition;
- /*0x1C, 0x20, 0x24*/ f32 volumeScale;
- /*0x20, 0x24, 0x28*/ f32 volume;
- /* , 0x28*/ s32 pan;
- /* , 0x2C*/ f32 appliedVolume;
- /*0x2C, 0x30*/ f32 freqScale;
- /*0x30, 0x34*/ u8 (*dynTable)[][2];
- /*0x34, ????*/ struct Note *noteUnused; // never read
- /*0x38, ????*/ struct SequenceChannelLayer *layerUnused; // never read
- /*0x3C, 0x40*/ struct Instrument *instrument;
- /*0x40, 0x44*/ struct SequencePlayer *seqPlayer;
- /*0x44, 0x48*/ struct SequenceChannelLayer *layers[LAYERS_MAX];
- /*0x54, 0x58 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib. For player 2,
- // [0] contains enabled, [4] contains sound ID, [5] contains reverb adjustment
- /*0x5C, 0x60*/ struct M64ScriptState scriptState;
- /*0x78, 0x7C*/ struct AdsrSettings adsr;
- /*0x80, 0x84*/ struct NotePool notePool;
-}; // size = 0xC0, 0xC4 in EU, 0xD0 in SH
-
-// Also known as a Track, according to debug strings.
-struct SequenceChannelLayer {
- /* U/J, EU, SH */
- /*0x00, 0x00*/ u8 enabled : 1;
- /*0x00, 0x00*/ u8 finished : 1;
- /*0x00, 0x00*/ u8 stopSomething : 1; // ?
- /*0x00, 0x00*/ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound
- /* , 0x00*/ u8 unusedEu0b8 : 1;
- /* , 0x00*/ u8 notePropertiesNeedInit : 1;
- /* , 0x00*/ u8 ignoreDrumPan : 1;
- /* , 0x01, 0x02*/ u8 instOrWave;
- /*0x01, 0x02, 0x03*/ u8 status; // 0x03 in SH
- /*0x02, 0x03*/ u8 noteDuration; // set to 0x80
- /*0x03, 0x04*/ u8 portamentoTargetNote;
- /* , 0x05*/ u8 pan; // 0..128
- /* , 0x06, 0x07*/ u8 notePan;
- /*0x04, 0x08*/ struct Portamento portamento;
- /*0x14, 0x18*/ struct AdsrSettings adsr;
- /*0x1C, 0x20*/ u16 portamentoTime;
- /*0x1E, 0x22*/ s16 transposition; // #semitones added to play commands
- // (m64 instruction encoding only allows referring to the limited range
- // 0..0x3f; this makes 0x40..0x7f accessible as well)
- /*0x20, 0x24, 0x24*/ f32 freqScale;
- /*0x24, 0x28, 0x2C*/ f32 velocitySquare;
- /*0x2C, 0x2C, 0x30*/ f32 noteVelocity;
- /*0x34, 0x30, 0x34*/ f32 noteFreqScale;
- /*0x38, 0x34*/ s16 shortNoteDefaultPlayPercentage;
- /*0x3A, 0x36*/ s16 playPercentage; // it's not really a percentage...
- /*0x3C, 0x38*/ s16 delay;
- /*0x3E, 0x3A*/ s16 duration;
- /*0x40, 0x3C*/ s16 delayUnused; // set to 'delay', never read
- /*0x44, 0x40, 0x44*/ struct Note *note;
- /*0x48, 0x44*/ struct Instrument *instrument;
- /*0x4C, 0x48*/ struct AudioBankSound *sound;
- /*0x50, 0x4C, 0x50*/ struct SequenceChannel *seqChannel;
- /*0x54, 0x50*/ struct M64ScriptState scriptState;
- /*0x70, 0x6C*/ struct AudioListItem listItem;
- u8 pad2[4];
-}; // size = 0x80
-
-struct NoteSynthesisState {
- /*0x00*/ u8 restart;
- /*0x01*/ u8 sampleDmaIndex;
- /*0x02*/ u8 prevHeadsetPanRight;
- /*0x03*/ u8 prevHeadsetPanLeft;
- /*0x04, 0x06*/ u16 samplePosFrac;
- /*0x08*/ s32 samplePosInt;
- /*0x0C*/ struct NoteSynthesisBuffers *synthesisBuffers;
- /*0x10*/ s16 curVolLeft; // UQ0.16 (EU Q1.15)
- /*0x12*/ s16 curVolRight; // UQ0.16 (EU Q1.15)
-};
-
-struct NotePlaybackState {
- /* U/J, EU, SH */
- /*0x04, 0x00, 0x00*/ u8 priority;
- /* 0x01, 0x01*/ u8 waveId;
- /* 0x02, 0x02*/ u8 sampleCountIndex;
- /*0x08, 0x04, 0x06*/ s16 adsrVolScale;
- /*0x18, 0x08, 0x08*/ f32 portamentoFreqScale;
- /*0x1C, 0x0C, 0x0C*/ f32 vibratoFreqScale;
- /*0x28, 0x10, */ struct SequenceChannelLayer *prevParentLayer;
- /*0x2C, 0x14, 0x14*/ struct SequenceChannelLayer *parentLayer;
- /*0x30, 0x18, 0x18*/ struct SequenceChannelLayer *wantedParentLayer;
- /* , 0x1C, 0x1C*/ struct NoteAttributes attributes;
- /*0x54, 0x28, 0x2C*/ struct AdsrState adsr;
- /*0x74, 0x4C, */ struct Portamento portamento;
- /*0x84, 0x5C, */ struct VibratoState vibratoState;
-};
-struct NoteSubEu {
- /*0x00*/ volatile u8 enabled : 1;
- /*0x00*/ u8 needsInit : 1;
- /*0x00*/ u8 finished : 1;
- /*0x00*/ u8 envMixerNeedsInit : 1;
- /*0x00*/ u8 stereoStrongRight : 1;
- /*0x00*/ u8 stereoStrongLeft : 1;
- /*0x00*/ u8 stereoHeadsetEffects : 1;
- /*0x00*/ u8 usesHeadsetPanEffects : 1;
- /*0x01*/ u8 reverbIndex : 3;
- /*0x01*/ u8 bookOffset : 3;
- /*0x01*/ u8 isSyntheticWave : 1;
- /*0x01*/ u8 hasTwoAdpcmParts : 1;
- /*0x02*/ u8 bankId;
- /*0x03*/ u8 headsetPanRight;
- /*0x04*/ u8 headsetPanLeft;
- /*0x05*/ u8 reverbVol; // UQ0.7 (EU Q1.7)
- /*0x06*/ u16 targetVolLeft; // UQ0.12 (EU UQ0.10)
- /*0x08*/ u16 targetVolRight; // UQ0.12 (EU UQ0.10)
- /*0x0A*/ u16 resamplingRateFixedPoint; // stored as signed but loaded as u16
- /*0x0C*/ union {
- s16 *samples;
- struct AudioBankSound *audioBankSound;
- } sound;
-};
-struct Note {
- /* U/J, EU, SH */
- /*0xA4, 0x00, 0x00*/ struct AudioListItem listItem;
- /* 0x10, 0x10*/ struct NoteSynthesisState synthesisState;
- // The next members are actually part of a struct (NotePlaybackState), but
- // that results in messy US/EU ifdefs. Instead we cast to a struct pointer
- // when needed... This breaks alignment on non-N64 platforms, which we hack
- // around by skipping the padding in that case.
- // TODO: use macros or something instead.
-#ifdef TARGET_N64
- u8 pad0[12];
-#endif
-
- /*0x04, 0x30, 0x30*/ u8 priority;
- /* 0x31, 0x31*/ u8 waveId;
- /* 0x32, 0x32*/ u8 sampleCountIndex;
- /*0x08, 0x34, 0x36*/ s16 adsrVolScale;
- /*0x18, 0x38, */ f32 portamentoFreqScale;
- /*0x1C, 0x3C, */ f32 vibratoFreqScale;
- /*0x28, 0x40, */ struct SequenceChannelLayer *prevParentLayer;
- /*0x2C, 0x44, 0x44*/ struct SequenceChannelLayer *parentLayer;
- /*0x30, 0x48, 0x48*/ struct SequenceChannelLayer *wantedParentLayer;
- /* , 0x4C, 0x4C*/ struct NoteAttributes attributes;
- /*0x54, 0x58, 0x5C*/ struct AdsrState adsr;
- /*0x74, 0x7C*/ struct Portamento portamento;
- /*0x84, 0x8C*/ struct VibratoState vibratoState;
- u8 pad3[8];
- /* , 0xB0, 0xB4*/ struct NoteSubEu noteSubEu;
-}; // size = 0xC0, known to be 0xC8 on SH
-
-struct NoteSynthesisBuffers {
- s16 adpcmdecState[0x10];
- s16 finalResampleState[0x10];
- s16 mixEnvelopeState[0x28];
- s16 panResampleState[0x10];
- s16 panSamplesBuffer[0x20];
- s16 dummyResampleState[0x10];
-};
-
-struct ReverbSettingsEU {
- u8 downsampleRate;
- u8 windowSize; // To be multiplied by 64
- u16 gain;
-};
-
-struct AudioSessionSettingsEU {
- /* 0x00 */ u32 frequency;
- /* 0x04 */ u8 unk1; // always 1
- /* 0x05 */ u8 maxSimultaneousNotes;
- /* 0x06 */ u8 numReverbs; // always 1
- /* 0x07 */ u8 unk2; // always 0
- /* 0x08 */ struct ReverbSettingsEU *reverbSettings;
- /* 0x0C */ u16 volume;
- /* 0x0E */ u16 unk3; // always 0
- /* 0x10 */ u32 persistentSeqMem;
- /* 0x14 */ u32 persistentBankMem;
- /* 0x18, 0x1C */ u32 temporarySeqMem;
- /* 0x1C, 0x20 */ u32 temporaryBankMem;
-}; // 0x30 on shindou
-
-struct AudioSessionSettings {
- /*0x00*/ u32 frequency;
- /*0x04*/ u8 maxSimultaneousNotes;
- /*0x05*/ u8 reverbDownsampleRate; // always 1
- /*0x06*/ u16 reverbWindowSize;
- /*0x08*/ u16 reverbGain;
- /*0x0A*/ u16 volume;
- /*0x0C*/ u32 persistentSeqMem;
- /*0x10*/ u32 persistentBankMem;
- /*0x14*/ u32 temporarySeqMem;
- /*0x18*/ u32 temporaryBankMem;
-}; // size = 0x1C
-
-struct AudioBufferParametersEU {
- /*0x00*/ s16 presetUnk4; // audio frames per vsync?
- /*0x02*/ u16 frequency;
- /*0x04*/ u16 aiFrequency; // ?16
- /*0x06*/ s16 samplesPerFrameTarget;
- /*0x08*/ s16 maxAiBufferLength;
- /*0x0A*/ s16 minAiBufferLength;
- /*0x0C*/ s16 updatesPerFrame;
- /*0x0E*/ s16 samplesPerUpdate;
- /*0x10*/ s16 samplesPerUpdateMax;
- /*0x12*/ s16 samplesPerUpdateMin;
- /*0x14*/ f32 resampleRate; // contains 32000.0f / frequency
- /*0x18*/ f32 updatesPerFrameInv; // 1.0f / updatesPerFrame
- /*0x1C*/ f32 unkUpdatesPerFrameScaled; // 3.0f / (1280.0f * updatesPerFrame)
-};
-
-struct EuAudioCmd {
- union {
-#if IS_BIG_ENDIAN
- struct {
- u8 op;
- u8 arg1;
- u8 arg2;
- u8 arg3;
- } s;
-#else
- struct {
- u8 arg3;
- u8 arg2;
- u8 arg1;
- u8 op;
- } s;
-#endif
- s32 first;
- } u;
- union {
- s32 as_s32;
- u32 as_u32;
- f32 as_f32;
-#if IS_BIG_ENDIAN
- u8 as_u8;
- s8 as_s8;
-#else
- struct {
- u8 pad0[3];
- u8 as_u8;
- };
- struct {
- u8 pad1[3];
- s8 as_s8;
- };
-#endif
- } u2;
-};
-
-#endif // AUDIO_INTERNAL_H