From 9c7d3688acf8f611dbc0d0b09c0a230b27e65c75 Mon Sep 17 00:00:00 2001 From: zelda2774 <69368340+zelda2774@users.noreply.github.com> Date: Tue, 7 Sep 2021 20:14:09 +0200 Subject: [PATCH] audio_load OK (#948) * Match func_800DDB64 * Match func_800DC910 * remove stack comments * Move nop padding to ucode_disas * Partially label audio_synthesis To some extent copied from sm64. * cleanup * Reverb and ReverbBits have nothing to do with reverbs * review * naming * Revert "reduce diff" This reverts commit cd4ac24d8809f3f8e5b0f91788bffd72b47d15af. * Match func_800E283C * Audio_DmaSampleData * Warning fixes * func_800E4198 * func_800E4918 * Fix compiler warnings in z_camera/db_camera * cleanup * terminology * tiny bit of doc * undo permuter_settings change * Revert "Fix compiler warnings in z_camera/db_camera" This reverts commit dfdfac47f2bb972056eb70b4f1ffb4df907166a0. * review Co-authored-by: zelda2774 --- .../code/audio_load/Audio_DmaSampleData.s | 232 ------- .../code/audio_load/func_800E283C.s | 172 ----- .../code/audio_load/func_800E4198.s | 277 -------- .../code/audio_load/func_800E4918.s | 319 --------- include/functions.h | 8 +- include/variables.h | 3 - include/z64audio.h | 234 +++---- src/code/audio_load.c | 644 +++++++++++++----- src/code/code_800E4FE0.c | 14 +- 9 files changed, 600 insertions(+), 1303 deletions(-) delete mode 100644 asm/non_matchings/code/audio_load/Audio_DmaSampleData.s delete mode 100644 asm/non_matchings/code/audio_load/func_800E283C.s delete mode 100644 asm/non_matchings/code/audio_load/func_800E4198.s delete mode 100644 asm/non_matchings/code/audio_load/func_800E4918.s diff --git a/asm/non_matchings/code/audio_load/Audio_DmaSampleData.s b/asm/non_matchings/code/audio_load/Audio_DmaSampleData.s deleted file mode 100644 index dfea00d6e8..0000000000 --- a/asm/non_matchings/code/audio_load/Audio_DmaSampleData.s +++ /dev/null @@ -1,232 +0,0 @@ -.rdata -glabel D_80149420 - .asciz "SUPERDMA" - .balign 4 - -.text -glabel Audio_DmaSampleData -/* B5847C 800E12DC 27BDFFB0 */ addiu $sp, $sp, -0x50 -/* B58480 800E12E0 AFB10030 */ sw $s1, 0x30($sp) -/* B58484 800E12E4 AFB0002C */ sw $s0, 0x2c($sp) -/* B58488 800E12E8 00A08025 */ move $s0, $a1 -/* B5848C 800E12EC 00808825 */ move $s1, $a0 -/* B58490 800E12F0 AFBF0034 */ sw $ra, 0x34($sp) -/* B58494 800E12F4 AFA60058 */ sw $a2, 0x58($sp) -/* B58498 800E12F8 AFA7005C */ sw $a3, 0x5c($sp) -/* B5849C 800E12FC 14C00008 */ bnez $a2, .L800E1320 -/* B584A0 800E1300 00005825 */ move $t3, $zero -/* B584A4 800E1304 3C098017 */ lui $t1, %hi(gAudioContext) # $t1, 0x8017 -/* B584A8 800E1308 2529F180 */ addiu $t1, %lo(gAudioContext) # addiu $t1, $t1, -0xe80 -/* B584AC 800E130C 8D262624 */ lw $a2, 0x2624($t1) -/* B584B0 800E1310 90E20000 */ lbu $v0, ($a3) -/* B584B4 800E1314 0046082B */ sltu $at, $v0, $a2 -/* B584B8 800E1318 54200057 */ bnezl $at, .L800E1478 -/* B584BC 800E131C 8D25261C */ lw $a1, 0x261c($t1) -.L800E1320: -/* B584C0 800E1320 3C098017 */ lui $t1, %hi(gAudioContext) # $t1, 0x8017 -/* B584C4 800E1324 2529F180 */ addiu $t1, %lo(gAudioContext) # addiu $t1, $t1, -0xe80 -/* B584C8 800E1328 8D262624 */ lw $a2, 0x2624($t1) -/* B584CC 800E132C 8D252620 */ lw $a1, 0x2620($t1) -/* B584D0 800E1330 00C02025 */ move $a0, $a2 -/* B584D4 800E1334 00C5082B */ sltu $at, $a2, $a1 -/* B584D8 800E1338 50200036 */ beql $at, $zero, .L800E1414 -/* B584DC 800E133C 8FB90058 */ lw $t9, 0x58($sp) -/* B584E0 800E1340 8D39261C */ lw $t9, 0x261c($t1) -/* B584E4 800E1344 0004C100 */ sll $t8, $a0, 4 -/* B584E8 800E1348 03191821 */ addu $v1, $t8, $t9 -.L800E134C: -/* B584EC 800E134C 8C6C0004 */ lw $t4, 4($v1) -/* B584F0 800E1350 00604025 */ move $t0, $v1 -/* B584F4 800E1354 022C1023 */ subu $v0, $s1, $t4 -/* B584F8 800E1358 04420029 */ bltzl $v0, .L800E1400 -/* B584FC 800E135C 24840001 */ addiu $a0, $a0, 1 -/* B58500 800E1360 950D000A */ lhu $t5, 0xa($t0) -/* B58504 800E1364 01B07023 */ subu $t6, $t5, $s0 -/* B58508 800E1368 01C2082B */ sltu $at, $t6, $v0 -/* B5850C 800E136C 54200024 */ bnezl $at, .L800E1400 -/* B58510 800E1370 24840001 */ addiu $a0, $a0, 1 -/* B58514 800E1374 910F000E */ lbu $t7, 0xe($t0) -/* B58518 800E1378 55E00018 */ bnezl $t7, .L800E13DC -/* B5851C 800E137C 240C0020 */ li $t4, 32 -/* B58520 800E1380 9122282D */ lbu $v0, 0x282d($t1) -/* B58524 800E1384 9138282F */ lbu $t8, 0x282f($t1) -/* B58528 800E1388 53020014 */ beql $t8, $v0, .L800E13DC -/* B5852C 800E138C 240C0020 */ li $t4, 32 -/* B58530 800E1390 9103000D */ lbu $v1, 0xd($t0) -/* B58534 800E1394 0122C821 */ addu $t9, $t1, $v0 -/* B58538 800E1398 5043000E */ beql $v0, $v1, .L800E13D4 -/* B5853C 800E139C 24590001 */ addiu $t9, $v0, 1 -/* B58540 800E13A0 932C272C */ lbu $t4, 0x272c($t9) -/* B58544 800E13A4 01236821 */ addu $t5, $t1, $v1 -/* B58548 800E13A8 A1AC272C */ sb $t4, 0x272c($t5) -/* B5854C 800E13AC 9138282D */ lbu $t8, 0x282d($t1) -/* B58550 800E13B0 8D2F261C */ lw $t7, 0x261c($t1) -/* B58554 800E13B4 910E000D */ lbu $t6, 0xd($t0) -/* B58558 800E13B8 0138C821 */ addu $t9, $t1, $t8 -/* B5855C 800E13BC 932C272C */ lbu $t4, 0x272c($t9) -/* B58560 800E13C0 000C6900 */ sll $t5, $t4, 4 -/* B58564 800E13C4 01EDC021 */ addu $t8, $t7, $t5 -/* B58568 800E13C8 A30E000D */ sb $t6, 0xd($t8) -/* B5856C 800E13CC 9122282D */ lbu $v0, 0x282d($t1) -/* B58570 800E13D0 24590001 */ addiu $t9, $v0, 1 -.L800E13D4: -/* B58574 800E13D4 A139282D */ sb $t9, 0x282d($t1) -/* B58578 800E13D8 240C0020 */ li $t4, 32 -.L800E13DC: -/* B5857C 800E13DC A10C000E */ sb $t4, 0xe($t0) -/* B58580 800E13E0 8FAF005C */ lw $t7, 0x5c($sp) -/* B58584 800E13E4 A1E40000 */ sb $a0, ($t7) -/* B58588 800E13E8 8D0D0000 */ lw $t5, ($t0) -/* B5858C 800E13EC 8D180004 */ lw $t8, 4($t0) -/* B58590 800E13F0 01B17021 */ addu $t6, $t5, $s1 -/* B58594 800E13F4 10000083 */ b .L800E1604 -/* B58598 800E13F8 01D81023 */ subu $v0, $t6, $t8 -/* B5859C 800E13FC 24840001 */ addiu $a0, $a0, 1 -.L800E1400: -/* B585A0 800E1400 0085082B */ sltu $at, $a0, $a1 -/* B585A4 800E1404 1420FFD1 */ bnez $at, .L800E134C -/* B585A8 800E1408 24630010 */ addiu $v1, $v1, 0x10 -/* B585AC 800E140C AFA80048 */ sw $t0, 0x48($sp) -/* B585B0 800E1410 8FB90058 */ lw $t9, 0x58($sp) -.L800E1414: -/* B585B4 800E1414 8FA80048 */ lw $t0, 0x48($sp) -/* B585B8 800E1418 8FAC005C */ lw $t4, 0x5c($sp) -/* B585BC 800E141C 57200005 */ bnezl $t9, .L800E1434 -/* B585C0 800E1420 9122282D */ lbu $v0, 0x282d($t1) -/* B585C4 800E1424 91820000 */ lbu $v0, ($t4) -/* B585C8 800E1428 10000013 */ b .L800E1478 -/* B585CC 800E142C 8D25261C */ lw $a1, 0x261c($t1) -/* B585D0 800E1430 9122282D */ lbu $v0, 0x282d($t1) -.L800E1434: -/* B585D4 800E1434 912F282F */ lbu $t7, 0x282f($t1) -/* B585D8 800E1438 8FAD0058 */ lw $t5, 0x58($sp) -/* B585DC 800E143C 11E2000B */ beq $t7, $v0, .L800E146C -/* B585E0 800E1440 00000000 */ nop -/* B585E4 800E1444 11A00009 */ beqz $t5, .L800E146C -/* B585E8 800E1448 01227021 */ addu $t6, $t1, $v0 -/* B585EC 800E144C 91CA272C */ lbu $t2, 0x272c($t6) -/* B585F0 800E1450 8D2C261C */ lw $t4, 0x261c($t1) -/* B585F4 800E1454 24580001 */ addiu $t8, $v0, 1 -/* B585F8 800E1458 000AC900 */ sll $t9, $t2, 4 -/* B585FC 800E145C A138282D */ sb $t8, 0x282d($t1) -/* B58600 800E1460 240B0001 */ li $t3, 1 -/* B58604 800E1464 AFAA0038 */ sw $t2, 0x38($sp) -/* B58608 800E1468 032C4021 */ addu $t0, $t9, $t4 -.L800E146C: -/* B5860C 800E146C 10000030 */ b .L800E1530 -/* B58610 800E1470 00000000 */ nop -/* B58614 800E1474 8D25261C */ lw $a1, 0x261c($t1) -.L800E1478: -/* B58618 800E1478 00027900 */ sll $t7, $v0, 4 -/* B5861C 800E147C 01E54021 */ addu $t0, $t7, $a1 -/* B58620 800E1480 00002025 */ move $a0, $zero -.L800E1484: -/* B58624 800E1484 8D030004 */ lw $v1, 4($t0) -/* B58628 800E1488 02231023 */ subu $v0, $s1, $v1 -/* B5862C 800E148C 04420024 */ bltzl $v0, .L800E1520 -/* B58630 800E1490 00046900 */ sll $t5, $a0, 4 -/* B58634 800E1494 950D000A */ lhu $t5, 0xa($t0) -/* B58638 800E1498 01B07023 */ subu $t6, $t5, $s0 -/* B5863C 800E149C 01C2082B */ sltu $at, $t6, $v0 -/* B58640 800E14A0 5420001F */ bnezl $at, .L800E1520 -/* B58644 800E14A4 00046900 */ sll $t5, $a0, 4 -/* B58648 800E14A8 9118000E */ lbu $t8, 0xe($t0) -/* B5864C 800E14AC 57000016 */ bnezl $t8, .L800E1508 -/* B58650 800E14B0 8D0E0000 */ lw $t6, ($t0) -/* B58654 800E14B4 9122282C */ lbu $v0, 0x282c($t1) -/* B58658 800E14B8 9103000D */ lbu $v1, 0xd($t0) -/* B5865C 800E14BC 0122C821 */ addu $t9, $t1, $v0 -/* B58660 800E14C0 5043000E */ beql $v0, $v1, .L800E14FC -/* B58664 800E14C4 24590001 */ addiu $t9, $v0, 1 -/* B58668 800E14C8 932C262C */ lbu $t4, 0x262c($t9) -/* B5866C 800E14CC 01237821 */ addu $t7, $t1, $v1 -/* B58670 800E14D0 A1EC262C */ sb $t4, 0x262c($t7) -/* B58674 800E14D4 9138282C */ lbu $t8, 0x282c($t1) -/* B58678 800E14D8 8D2E261C */ lw $t6, 0x261c($t1) -/* B5867C 800E14DC 910D000D */ lbu $t5, 0xd($t0) -/* B58680 800E14E0 0138C821 */ addu $t9, $t1, $t8 -/* B58684 800E14E4 932C262C */ lbu $t4, 0x262c($t9) -/* B58688 800E14E8 000C7900 */ sll $t7, $t4, 4 -/* B5868C 800E14EC 01CFC021 */ addu $t8, $t6, $t7 -/* B58690 800E14F0 A30D000D */ sb $t5, 0xd($t8) -/* B58694 800E14F4 9122282C */ lbu $v0, 0x282c($t1) -/* B58698 800E14F8 24590001 */ addiu $t9, $v0, 1 -.L800E14FC: -/* B5869C 800E14FC A139282C */ sb $t9, 0x282c($t1) -/* B586A0 800E1500 8D030004 */ lw $v1, 4($t0) -/* B586A4 800E1504 8D0E0000 */ lw $t6, ($t0) -.L800E1508: -/* B586A8 800E1508 240C0002 */ li $t4, 2 -/* B586AC 800E150C A10C000E */ sb $t4, 0xe($t0) -/* B586B0 800E1510 01D17821 */ addu $t7, $t6, $s1 -/* B586B4 800E1514 1000003B */ b .L800E1604 -/* B586B8 800E1518 01E31023 */ subu $v0, $t7, $v1 -/* B586BC 800E151C 00046900 */ sll $t5, $a0, 4 -.L800E1520: -/* B586C0 800E1520 24840001 */ addiu $a0, $a0, 1 -/* B586C4 800E1524 00C4082B */ sltu $at, $a2, $a0 -/* B586C8 800E1528 1020FFD6 */ beqz $at, .L800E1484 -/* B586CC 800E152C 01A54021 */ addu $t0, $t5, $a1 -.L800E1530: -/* B586D0 800E1530 1560000D */ bnez $t3, .L800E1568 -/* B586D4 800E1534 8FAA0038 */ lw $t2, 0x38($sp) -/* B586D8 800E1538 9122282C */ lbu $v0, 0x282c($t1) -/* B586DC 800E153C 9138282E */ lbu $t8, 0x282e($t1) -/* B586E0 800E1540 0122C821 */ addu $t9, $t1, $v0 -/* B586E4 800E1544 17020003 */ bne $t8, $v0, .L800E1554 -/* B586E8 800E1548 244C0001 */ addiu $t4, $v0, 1 -/* B586EC 800E154C 1000002D */ b .L800E1604 -/* B586F0 800E1550 00001025 */ move $v0, $zero -.L800E1554: -/* B586F4 800E1554 932A262C */ lbu $t2, 0x262c($t9) -/* B586F8 800E1558 8D2F261C */ lw $t7, 0x261c($t1) -/* B586FC 800E155C A12C282C */ sb $t4, 0x282c($t1) -/* B58700 800E1560 000A7100 */ sll $t6, $t2, 4 -/* B58704 800E1564 01CF4021 */ addu $t0, $t6, $t7 -.L800E1568: -/* B58708 800E1568 9502000A */ lhu $v0, 0xa($t0) -/* B5870C 800E156C 240D0003 */ li $t5, 3 -/* B58710 800E1570 2401FFF0 */ li $at, -16 -/* B58714 800E1574 A10D000E */ sb $t5, 0xe($t0) -/* B58718 800E1578 02218024 */ and $s0, $s1, $at -/* B5871C 800E157C AD100004 */ sw $s0, 4($t0) -/* B58720 800E1580 A5020008 */ sh $v0, 8($t0) -/* B58724 800E1584 8D2328A0 */ lw $v1, 0x28a0($t1) -/* B58728 800E1588 8D190000 */ lw $t9, ($t0) -/* B5872C 800E158C 8FAE0060 */ lw $t6, 0x60($sp) -/* B58730 800E1590 0003C080 */ sll $t8, $v1, 2 -/* B58734 800E1594 0303C023 */ subu $t8, $t8, $v1 -/* B58738 800E1598 0018C0C0 */ sll $t8, $t8, 3 -/* B5873C 800E159C 3C0C8017 */ lui $t4, %hi(gAudioContext+0x1ed0) # $t4, 0x8017 -/* B58740 800E15A0 3C0F8015 */ lui $t7, %hi(D_80149420) # $t7, 0x8015 -/* B58744 800E15A4 25EF9420 */ addiu $t7, %lo(D_80149420) # addiu $t7, $t7, -0x6be0 -/* B58748 800E15A8 258C1050 */ addiu $t4, %lo(gAudioContext+0x1ed0) # addiu $t4, $t4, 0x1050 -/* B5874C 800E15AC 01382021 */ addu $a0, $t1, $t8 -/* B58750 800E15B0 246D0001 */ addiu $t5, $v1, 1 -/* B58754 800E15B4 AD2D28A0 */ sw $t5, 0x28a0($t1) -/* B58758 800E15B8 24841FE8 */ addiu $a0, $a0, 0x1fe8 -/* B5875C 800E15BC AFAC0018 */ sw $t4, 0x18($sp) -/* B58760 800E15C0 AFAF0020 */ sw $t7, 0x20($sp) -/* B58764 800E15C4 AFAA0038 */ sw $t2, 0x38($sp) -/* B58768 800E15C8 AFA80048 */ sw $t0, 0x48($sp) -/* B5876C 800E15CC 02003825 */ move $a3, $s0 -/* B58770 800E15D0 00002825 */ move $a1, $zero -/* B58774 800E15D4 00003025 */ move $a2, $zero -/* B58778 800E15D8 AFA20014 */ sw $v0, 0x14($sp) -/* B5877C 800E15DC AFB90010 */ sw $t9, 0x10($sp) -/* B58780 800E15E0 0C038AF8 */ jal Audio_DMA -/* B58784 800E15E4 AFAE001C */ sw $t6, 0x1c($sp) -/* B58788 800E15E8 8FAA0038 */ lw $t2, 0x38($sp) -/* B5878C 800E15EC 8FB8005C */ lw $t8, 0x5c($sp) -/* B58790 800E15F0 8FA80048 */ lw $t0, 0x48($sp) -/* B58794 800E15F4 0230C823 */ subu $t9, $s1, $s0 -/* B58798 800E15F8 A30A0000 */ sb $t2, ($t8) -/* B5879C 800E15FC 8D0C0000 */ lw $t4, ($t0) -/* B587A0 800E1600 032C1021 */ addu $v0, $t9, $t4 -.L800E1604: -/* B587A4 800E1604 8FBF0034 */ lw $ra, 0x34($sp) -/* B587A8 800E1608 8FB0002C */ lw $s0, 0x2c($sp) -/* B587AC 800E160C 8FB10030 */ lw $s1, 0x30($sp) -/* B587B0 800E1610 03E00008 */ jr $ra -/* B587B4 800E1614 27BD0050 */ addiu $sp, $sp, 0x50 - diff --git a/asm/non_matchings/code/audio_load/func_800E283C.s b/asm/non_matchings/code/audio_load/func_800E283C.s deleted file mode 100644 index ee31bfd111..0000000000 --- a/asm/non_matchings/code/audio_load/func_800E283C.s +++ /dev/null @@ -1,172 +0,0 @@ -glabel func_800E283C -/* B599DC 800E283C 27BDFF90 */ addiu $sp, $sp, -0x70 -/* B599E0 800E2840 00047080 */ sll $t6, $a0, 2 -/* B599E4 800E2844 3C0F8017 */ lui $t7, %hi(gAudioContext+0x2844) # $t7, 0x8017 -/* B599E8 800E2848 8DEF19C4 */ lw $t7, %lo(gAudioContext+0x2844)($t7) -/* B599EC 800E284C 01C47021 */ addu $t6, $t6, $a0 -/* B599F0 800E2850 000E7080 */ sll $t6, $t6, 2 -/* B599F4 800E2854 AFBF0034 */ sw $ra, 0x34($sp) -/* B599F8 800E2858 AFB60030 */ sw $s6, 0x30($sp) -/* B599FC 800E285C AFB5002C */ sw $s5, 0x2c($sp) -/* B59A00 800E2860 AFB40028 */ sw $s4, 0x28($sp) -/* B59A04 800E2864 AFB30024 */ sw $s3, 0x24($sp) -/* B59A08 800E2868 AFB20020 */ sw $s2, 0x20($sp) -/* B59A0C 800E286C AFB1001C */ sw $s1, 0x1c($sp) -/* B59A10 800E2870 AFB00018 */ sw $s0, 0x18($sp) -/* B59A14 800E2874 AFAE0044 */ sw $t6, 0x44($sp) -/* B59A18 800E2878 01EE1021 */ addu $v0, $t7, $t6 -/* B59A1C 800E287C 90590000 */ lbu $t9, ($v0) -/* B59A20 800E2880 90470001 */ lbu $a3, 1($v0) -/* B59A24 800E2884 00A09825 */ move $s3, $a1 -/* B59A28 800E2888 AFB90050 */ sw $t9, 0x50($sp) -/* B59A2C 800E288C 8CA30000 */ lw $v1, ($a1) -/* B59A30 800E2890 00C0A025 */ move $s4, $a2 -/* B59A34 800E2894 94550004 */ lhu $s5, 4($v0) -/* B59A38 800E2898 50600021 */ beql $v1, $zero, .L800E2920 -/* B59A3C 800E289C 8E630004 */ lw $v1, 4($s3) -/* B59A40 800E28A0 10E0001E */ beqz $a3, .L800E291C -/* B59A44 800E28A4 00654021 */ addu $t0, $v1, $a1 -/* B59A48 800E28A8 18E0001C */ blez $a3, .L800E291C -/* B59A4C 800E28AC ACA80000 */ sw $t0, ($a1) -/* B59A50 800E28B0 00009025 */ move $s2, $zero -/* B59A54 800E28B4 00071880 */ sll $v1, $a3, 2 -/* B59A58 800E28B8 24160001 */ li $s6, 1 -/* B59A5C 800E28BC 8E690000 */ lw $t1, ($s3) -.L800E28C0: -/* B59A60 800E28C0 01321021 */ addu $v0, $t1, $s2 -/* B59A64 800E28C4 8C500000 */ lw $s0, ($v0) -/* B59A68 800E28C8 12000011 */ beqz $s0, .L800E2910 -/* B59A6C 800E28CC 02138021 */ addu $s0, $s0, $s3 -/* B59A70 800E28D0 AC500000 */ sw $s0, ($v0) -/* B59A74 800E28D4 920A0002 */ lbu $t2, 2($s0) -/* B59A78 800E28D8 02008825 */ move $s1, $s0 -/* B59A7C 800E28DC 26040004 */ addiu $a0, $s0, 4 -/* B59A80 800E28E0 1540000B */ bnez $t2, .L800E2910 -/* B59A84 800E28E4 02602825 */ move $a1, $s3 -/* B59A88 800E28E8 02803025 */ move $a2, $s4 -/* B59A8C 800E28EC AFA3003C */ sw $v1, 0x3c($sp) -/* B59A90 800E28F0 0C039016 */ jal Audio_SampleReloc -/* B59A94 800E28F4 AFA70054 */ sw $a3, 0x54($sp) -/* B59A98 800E28F8 8E30000C */ lw $s0, 0xc($s1) -/* B59A9C 800E28FC 8FA3003C */ lw $v1, 0x3c($sp) -/* B59AA0 800E2900 8FA70054 */ lw $a3, 0x54($sp) -/* B59AA4 800E2904 02135821 */ addu $t3, $s0, $s3 -/* B59AA8 800E2908 AE2B000C */ sw $t3, 0xc($s1) -/* B59AAC 800E290C A2360002 */ sb $s6, 2($s1) -.L800E2910: -/* B59AB0 800E2910 26520004 */ addiu $s2, $s2, 4 -/* B59AB4 800E2914 5643FFEA */ bnel $s2, $v1, .L800E28C0 -/* B59AB8 800E2918 8E690000 */ lw $t1, ($s3) -.L800E291C: -/* B59ABC 800E291C 8E630004 */ lw $v1, 4($s3) -.L800E2920: -/* B59AC0 800E2920 24160001 */ li $s6, 1 -/* B59AC4 800E2924 50600016 */ beql $v1, $zero, .L800E2980 -/* B59AC8 800E2928 8FAF0050 */ lw $t7, 0x50($sp) -/* B59ACC 800E292C 12A00013 */ beqz $s5, .L800E297C -/* B59AD0 800E2930 00736021 */ addu $t4, $v1, $s3 -/* B59AD4 800E2934 1AA00011 */ blez $s5, .L800E297C -/* B59AD8 800E2938 AE6C0004 */ sw $t4, 4($s3) -/* B59ADC 800E293C 00008825 */ move $s1, $zero -/* B59AE0 800E2940 001590C0 */ sll $s2, $s5, 3 -/* B59AE4 800E2944 8E6D0004 */ lw $t5, 4($s3) -.L800E2948: -/* B59AE8 800E2948 01B18021 */ addu $s0, $t5, $s1 -/* B59AEC 800E294C 52000009 */ beql $s0, $zero, .L800E2974 -/* B59AF0 800E2950 26310008 */ addiu $s1, $s1, 8 -/* B59AF4 800E2954 8E0E0000 */ lw $t6, ($s0) -/* B59AF8 800E2958 02002025 */ move $a0, $s0 -/* B59AFC 800E295C 02602825 */ move $a1, $s3 -/* B59B00 800E2960 51C00004 */ beql $t6, $zero, .L800E2974 -/* B59B04 800E2964 26310008 */ addiu $s1, $s1, 8 -/* B59B08 800E2968 0C039016 */ jal Audio_SampleReloc -/* B59B0C 800E296C 02803025 */ move $a2, $s4 -/* B59B10 800E2970 26310008 */ addiu $s1, $s1, 8 -.L800E2974: -/* B59B14 800E2974 5632FFF4 */ bnel $s1, $s2, .L800E2948 -/* B59B18 800E2978 8E6D0004 */ lw $t5, 4($s3) -.L800E297C: -/* B59B1C 800E297C 8FAF0050 */ lw $t7, 0x50($sp) -.L800E2980: -/* B59B20 800E2980 2418007E */ li $t8, 126 -/* B59B24 800E2984 26720008 */ addiu $s2, $s3, 8 -/* B59B28 800E2988 29E1007F */ slti $at, $t7, 0x7f -/* B59B2C 800E298C 54200003 */ bnezl $at, .L800E299C -/* B59B30 800E2990 8FA30050 */ lw $v1, 0x50($sp) -/* B59B34 800E2994 AFB80050 */ sw $t8, 0x50($sp) -/* B59B38 800E2998 8FA30050 */ lw $v1, 0x50($sp) -.L800E299C: -/* B59B3C 800E299C 24630001 */ addiu $v1, $v1, 1 -/* B59B40 800E29A0 28610002 */ slti $at, $v1, 2 -/* B59B44 800E29A4 14200024 */ bnez $at, .L800E2A38 -/* B59B48 800E29A8 0003C880 */ sll $t9, $v1, 2 -/* B59B4C 800E29AC 0333A821 */ addu $s5, $t9, $s3 -/* B59B50 800E29B0 8E420000 */ lw $v0, ($s2) -.L800E29B4: -/* B59B54 800E29B4 1040001C */ beqz $v0, .L800E2A28 -/* B59B58 800E29B8 00534021 */ addu $t0, $v0, $s3 -/* B59B5C 800E29BC AE480000 */ sw $t0, ($s2) -/* B59B60 800E29C0 91090000 */ lbu $t1, ($t0) -/* B59B64 800E29C4 01008825 */ move $s1, $t0 -/* B59B68 800E29C8 55200018 */ bnezl $t1, .L800E2A2C -/* B59B6C 800E29CC 26520004 */ addiu $s2, $s2, 4 -/* B59B70 800E29D0 910A0001 */ lbu $t2, 1($t0) -/* B59B74 800E29D4 25040008 */ addiu $a0, $t0, 8 -/* B59B78 800E29D8 02602825 */ move $a1, $s3 -/* B59B7C 800E29DC 51400004 */ beql $t2, $zero, .L800E29F0 -/* B59B80 800E29E0 26240010 */ addiu $a0, $s1, 0x10 -/* B59B84 800E29E4 0C039016 */ jal Audio_SampleReloc -/* B59B88 800E29E8 02803025 */ move $a2, $s4 -/* B59B8C 800E29EC 26240010 */ addiu $a0, $s1, 0x10 -.L800E29F0: -/* B59B90 800E29F0 02602825 */ move $a1, $s3 -/* B59B94 800E29F4 0C039016 */ jal Audio_SampleReloc -/* B59B98 800E29F8 02803025 */ move $a2, $s4 -/* B59B9C 800E29FC 922B0002 */ lbu $t3, 2($s1) -/* B59BA0 800E2A00 2401007F */ li $at, 127 -/* B59BA4 800E2A04 26240018 */ addiu $a0, $s1, 0x18 -/* B59BA8 800E2A08 11610003 */ beq $t3, $at, .L800E2A18 -/* B59BAC 800E2A0C 02602825 */ move $a1, $s3 -/* B59BB0 800E2A10 0C039016 */ jal Audio_SampleReloc -/* B59BB4 800E2A14 02803025 */ move $a2, $s4 -.L800E2A18: -/* B59BB8 800E2A18 8E300004 */ lw $s0, 4($s1) -/* B59BBC 800E2A1C A2360000 */ sb $s6, ($s1) -/* B59BC0 800E2A20 02136021 */ addu $t4, $s0, $s3 -/* B59BC4 800E2A24 AE2C0004 */ sw $t4, 4($s1) -.L800E2A28: -/* B59BC8 800E2A28 26520004 */ addiu $s2, $s2, 4 -.L800E2A2C: -/* B59BCC 800E2A2C 02B2082B */ sltu $at, $s5, $s2 -/* B59BD0 800E2A30 5020FFE0 */ beql $at, $zero, .L800E29B4 -/* B59BD4 800E2A34 8E420000 */ lw $v0, ($s2) -.L800E2A38: -/* B59BD8 800E2A38 3C0E8017 */ lui $t6, %hi(gAudioContext+0x2844) # $t6, 0x8017 -/* B59BDC 800E2A3C 8DCE19C4 */ lw $t6, %lo(gAudioContext+0x2844)($t6) -/* B59BE0 800E2A40 8FAF0044 */ lw $t7, 0x44($sp) -/* B59BE4 800E2A44 8E6D0000 */ lw $t5, ($s3) -/* B59BE8 800E2A48 3C088017 */ lui $t0, %hi(gAudioContext+0x2844) # $t0, 0x8017 -/* B59BEC 800E2A4C 01CFC021 */ addu $t8, $t6, $t7 -/* B59BF0 800E2A50 AF0D000C */ sw $t5, 0xc($t8) -/* B59BF4 800E2A54 8FA90044 */ lw $t1, 0x44($sp) -/* B59BF8 800E2A58 8D0819C4 */ lw $t0, %lo(gAudioContext+0x2844)($t0) -/* B59BFC 800E2A5C 8E790004 */ lw $t9, 4($s3) -/* B59C00 800E2A60 3C0C8017 */ lui $t4, %hi(gAudioContext+0x2844) # $t4, 0x8017 -/* B59C04 800E2A64 01095021 */ addu $t2, $t0, $t1 -/* B59C08 800E2A68 AD590010 */ sw $t9, 0x10($t2) -/* B59C0C 800E2A6C 8FAE0044 */ lw $t6, 0x44($sp) -/* B59C10 800E2A70 8D8C19C4 */ lw $t4, %lo(gAudioContext+0x2844)($t4) -/* B59C14 800E2A74 266B0008 */ addiu $t3, $s3, 8 -/* B59C18 800E2A78 018E7821 */ addu $t7, $t4, $t6 -/* B59C1C 800E2A7C ADEB0008 */ sw $t3, 8($t7) -/* B59C20 800E2A80 8FBF0034 */ lw $ra, 0x34($sp) -/* B59C24 800E2A84 8FB60030 */ lw $s6, 0x30($sp) -/* B59C28 800E2A88 8FB5002C */ lw $s5, 0x2c($sp) -/* B59C2C 800E2A8C 8FB40028 */ lw $s4, 0x28($sp) -/* B59C30 800E2A90 8FB30024 */ lw $s3, 0x24($sp) -/* B59C34 800E2A94 8FB20020 */ lw $s2, 0x20($sp) -/* B59C38 800E2A98 8FB1001C */ lw $s1, 0x1c($sp) -/* B59C3C 800E2A9C 8FB00018 */ lw $s0, 0x18($sp) -/* B59C40 800E2AA0 03E00008 */ jr $ra -/* B59C44 800E2AA4 27BD0070 */ addiu $sp, $sp, 0x70 - diff --git a/asm/non_matchings/code/audio_load/func_800E4198.s b/asm/non_matchings/code/audio_load/func_800E4198.s deleted file mode 100644 index 94e1d234df..0000000000 --- a/asm/non_matchings/code/audio_load/func_800E4198.s +++ /dev/null @@ -1,277 +0,0 @@ -glabel func_800E4198 -/* B5B338 800E4198 27BDFF98 */ addiu $sp, $sp, -0x68 -/* B5B33C 800E419C AFB30030 */ sw $s3, 0x30($sp) -/* B5B340 800E41A0 3C138017 */ lui $s3, %hi(gAudioContext) # $s3, 0x8017 -/* B5B344 800E41A4 2673F180 */ addiu $s3, %lo(gAudioContext) # addiu $s3, $s3, -0xe80 -/* B5B348 800E41A8 8E6E176C */ lw $t6, 0x176c($s3) -/* B5B34C 800E41AC AFB50038 */ sw $s5, 0x38($sp) -/* B5B350 800E41B0 AFB2002C */ sw $s2, 0x2c($sp) -/* B5B354 800E41B4 00C09025 */ move $s2, $a2 -/* B5B358 800E41B8 00E0A825 */ move $s5, $a3 -/* B5B35C 800E41BC AFBF0044 */ sw $ra, 0x44($sp) -/* B5B360 800E41C0 AFB70040 */ sw $s7, 0x40($sp) -/* B5B364 800E41C4 AFB6003C */ sw $s6, 0x3c($sp) -/* B5B368 800E41C8 AFB40034 */ sw $s4, 0x34($sp) -/* B5B36C 800E41CC AFB10028 */ sw $s1, 0x28($sp) -/* B5B370 800E41D0 AFB00024 */ sw $s0, 0x24($sp) -/* B5B374 800E41D4 11C00003 */ beqz $t6, .L800E41E4 -/* B5B378 800E41D8 00001025 */ move $v0, $zero -/* B5B37C 800E41DC 10000003 */ b .L800E41EC -/* B5B380 800E41E0 24020001 */ li $v0, 1 -.L800E41E4: -/* B5B384 800E41E4 3C018017 */ lui $at, %hi(D_8016B780) # $at, 0x8017 -/* B5B388 800E41E8 AC20B780 */ sw $zero, %lo(D_8016B780)($at) -.L800E41EC: -/* B5B38C 800E41EC AE601768 */ sw $zero, 0x1768($s3) -/* B5B390 800E41F0 02403025 */ move $a2, $s2 -/* B5B394 800E41F4 0C038A0F */ jal func_800E283C -/* B5B398 800E41F8 AFA2004C */ sw $v0, 0x4c($sp) -/* B5B39C 800E41FC 8E641768 */ lw $a0, 0x1768($s3) -/* B5B3A0 800E4200 00002825 */ move $a1, $zero -/* B5B3A4 800E4204 0000A025 */ move $s4, $zero -/* B5B3A8 800E4208 18800011 */ blez $a0, .L800E4250 -/* B5B3AC 800E420C 3C0F8017 */ lui $t7, %hi(gAudioContext) -/* B5B3B0 800E4210 25E2F180 */ addiu $v0, $t7, %lo(gAudioContext) -/* B5B3B4 800E4214 0004C080 */ sll $t8, $a0, 2 -/* B5B3B8 800E4218 03023021 */ addu $a2, $t8, $v0 -/* B5B3BC 800E421C 2403FFF0 */ li $v1, -16 -.L800E4220: -/* B5B3C0 800E4220 8C590B68 */ lw $t9, 0xb68($v0) -/* B5B3C4 800E4224 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B3C8 800E4228 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B3CC 800E422C 8F2A0000 */ lw $t2, ($t9) -/* B5B3D0 800E4230 24420004 */ addiu $v0, $v0, 4 -/* B5B3D4 800E4234 01415824 */ and $t3, $t2, $at -/* B5B3D8 800E4238 256C000F */ addiu $t4, $t3, 0xf -/* B5B3DC 800E423C 0046082B */ sltu $at, $v0, $a2 -/* B5B3E0 800E4240 01836824 */ and $t5, $t4, $v1 -/* B5B3E4 800E4244 1420FFF6 */ bnez $at, .L800E4220 -/* B5B3E8 800E4248 00AD2821 */ addu $a1, $a1, $t5 -/* B5B3EC 800E424C 0000A025 */ move $s4, $zero -.L800E4250: -/* B5B3F0 800E4250 188000A7 */ blez $a0, .L800E44F0 -/* B5B3F4 800E4254 24170001 */ li $s7, 1 -/* B5B3F8 800E4258 24160003 */ li $s6, 3 -/* B5B3FC 800E425C 8E6E176C */ lw $t6, 0x176c($s3) -.L800E4260: -/* B5B400 800E4260 24010078 */ li $at, 120 -/* B5B404 800E4264 0014C080 */ sll $t8, $s4, 2 -/* B5B408 800E4268 11C100A1 */ beq $t6, $at, .L800E44F0 -/* B5B40C 800E426C 02787821 */ addu $t7, $s3, $t8 -/* B5B410 800E4270 8DF00B68 */ lw $s0, 0xb68($t7) -/* B5B414 800E4274 12A00005 */ beqz $s5, .L800E428C -/* B5B418 800E4278 00008825 */ move $s1, $zero -/* B5B41C 800E427C 52B7002D */ beql $s5, $s7, .L800E4334 -/* B5B420 800E4280 8E030000 */ lw $v1, ($s0) -/* B5B424 800E4284 10000052 */ b .L800E43D0 -/* B5B428 800E4288 00000000 */ nop -.L800E428C: -/* B5B42C 800E428C 8E030000 */ lw $v1, ($s0) -/* B5B430 800E4290 8E590010 */ lw $t9, 0x10($s2) -/* B5B434 800E4294 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B438 800E4298 00031100 */ sll $v0, $v1, 4 -/* B5B43C 800E429C 00021782 */ srl $v0, $v0, 0x1e -/* B5B440 800E42A0 1722000A */ bne $t9, $v0, .L800E42CC -/* B5B444 800E42A4 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B448 800E42A8 8E450000 */ lw $a1, ($s2) -/* B5B44C 800E42AC 8E060004 */ lw $a2, 4($s0) -/* B5B450 800E42B0 00023E00 */ sll $a3, $v0, 0x18 -/* B5B454 800E42B4 00073E03 */ sra $a3, $a3, 0x18 -/* B5B458 800E42B8 AFB70010 */ sw $s7, 0x10($sp) -/* B5B45C 800E42BC 0C038171 */ jal func_800E05C4 -/* B5B460 800E42C0 00612024 */ and $a0, $v1, $at -/* B5B464 800E42C4 10000042 */ b .L800E43D0 -/* B5B468 800E42C8 00408825 */ move $s1, $v0 -.L800E42CC: -/* B5B46C 800E42CC 8E4A0014 */ lw $t2, 0x14($s2) -/* B5B470 800E42D0 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B474 800E42D4 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B478 800E42D8 15420009 */ bne $t2, $v0, .L800E4300 -/* B5B47C 800E42DC 00612024 */ and $a0, $v1, $at -/* B5B480 800E42E0 8E450004 */ lw $a1, 4($s2) -/* B5B484 800E42E4 8E060004 */ lw $a2, 4($s0) -/* B5B488 800E42E8 00023E00 */ sll $a3, $v0, 0x18 -/* B5B48C 800E42EC 00073E03 */ sra $a3, $a3, 0x18 -/* B5B490 800E42F0 0C038171 */ jal func_800E05C4 -/* B5B494 800E42F4 AFB70010 */ sw $s7, 0x10($sp) -/* B5B498 800E42F8 10000035 */ b .L800E43D0 -/* B5B49C 800E42FC 00408825 */ move $s1, $v0 -.L800E4300: -/* B5B4A0 800E4300 16C20033 */ bne $s6, $v0, .L800E43D0 -/* B5B4A4 800E4304 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B4A8 800E4308 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B4AC 800E430C 8E060004 */ lw $a2, 4($s0) -/* B5B4B0 800E4310 00023E00 */ sll $a3, $v0, 0x18 -/* B5B4B4 800E4314 00073E03 */ sra $a3, $a3, 0x18 -/* B5B4B8 800E4318 AFB70010 */ sw $s7, 0x10($sp) -/* B5B4BC 800E431C 00612024 */ and $a0, $v1, $at -/* B5B4C0 800E4320 0C038171 */ jal func_800E05C4 -/* B5B4C4 800E4324 240500FE */ li $a1, 254 -/* B5B4C8 800E4328 10000029 */ b .L800E43D0 -/* B5B4CC 800E432C 00408825 */ move $s1, $v0 -/* B5B4D0 800E4330 8E030000 */ lw $v1, ($s0) -.L800E4334: -/* B5B4D4 800E4334 8E4B0010 */ lw $t3, 0x10($s2) -/* B5B4D8 800E4338 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B4DC 800E433C 00031100 */ sll $v0, $v1, 4 -/* B5B4E0 800E4340 00021782 */ srl $v0, $v0, 0x1e -/* B5B4E4 800E4344 1562000A */ bne $t3, $v0, .L800E4370 -/* B5B4E8 800E4348 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B4EC 800E434C 8E450000 */ lw $a1, ($s2) -/* B5B4F0 800E4350 8E060004 */ lw $a2, 4($s0) -/* B5B4F4 800E4354 00023E00 */ sll $a3, $v0, 0x18 -/* B5B4F8 800E4358 00073E03 */ sra $a3, $a3, 0x18 -/* B5B4FC 800E435C AFA00010 */ sw $zero, 0x10($sp) -/* B5B500 800E4360 0C038171 */ jal func_800E05C4 -/* B5B504 800E4364 00612024 */ and $a0, $v1, $at -/* B5B508 800E4368 10000019 */ b .L800E43D0 -/* B5B50C 800E436C 00408825 */ move $s1, $v0 -.L800E4370: -/* B5B510 800E4370 8E4C0014 */ lw $t4, 0x14($s2) -/* B5B514 800E4374 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B518 800E4378 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B51C 800E437C 15820009 */ bne $t4, $v0, .L800E43A4 -/* B5B520 800E4380 00612024 */ and $a0, $v1, $at -/* B5B524 800E4384 8E450004 */ lw $a1, 4($s2) -/* B5B528 800E4388 8E060004 */ lw $a2, 4($s0) -/* B5B52C 800E438C 00023E00 */ sll $a3, $v0, 0x18 -/* B5B530 800E4390 00073E03 */ sra $a3, $a3, 0x18 -/* B5B534 800E4394 0C038171 */ jal func_800E05C4 -/* B5B538 800E4398 AFA00010 */ sw $zero, 0x10($sp) -/* B5B53C 800E439C 1000000C */ b .L800E43D0 -/* B5B540 800E43A0 00408825 */ move $s1, $v0 -.L800E43A4: -/* B5B544 800E43A4 16C2000A */ bne $s6, $v0, .L800E43D0 -/* B5B548 800E43A8 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B54C 800E43AC 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B550 800E43B0 8E060004 */ lw $a2, 4($s0) -/* B5B554 800E43B4 00023E00 */ sll $a3, $v0, 0x18 -/* B5B558 800E43B8 00073E03 */ sra $a3, $a3, 0x18 -/* B5B55C 800E43BC AFA00010 */ sw $zero, 0x10($sp) -/* B5B560 800E43C0 00612024 */ and $a0, $v1, $at -/* B5B564 800E43C4 0C038171 */ jal func_800E05C4 -/* B5B568 800E43C8 240500FE */ li $a1, 254 -/* B5B56C 800E43CC 00408825 */ move $s1, $v0 -.L800E43D0: -/* B5B570 800E43D0 16200003 */ bnez $s1, .L800E43E0 -/* B5B574 800E43D4 00000000 */ nop -/* B5B578 800E43D8 10000041 */ b .L800E44E0 -/* B5B57C 800E43DC 8E641768 */ lw $a0, 0x1768($s3) -.L800E43E0: -/* B5B580 800E43E0 52A00006 */ beql $s5, $zero, .L800E43FC -/* B5B584 800E43E4 8E030000 */ lw $v1, ($s0) -/* B5B588 800E43E8 52B70023 */ beql $s5, $s7, .L800E4478 -/* B5B58C 800E43EC 8E6A176C */ lw $t2, 0x176c($s3) -/* B5B590 800E43F0 1000003B */ b .L800E44E0 -/* B5B594 800E43F4 8E641768 */ lw $a0, 0x1768($s3) -/* B5B598 800E43F8 8E030000 */ lw $v1, ($s0) -.L800E43FC: -/* B5B59C 800E43FC 24010001 */ li $at, 1 -/* B5B5A0 800E4400 02202825 */ move $a1, $s1 -/* B5B5A4 800E4404 00031100 */ sll $v0, $v1, 4 -/* B5B5A8 800E4408 00021782 */ srl $v0, $v0, 0x1e -/* B5B5AC 800E440C 1441000E */ bne $v0, $at, .L800E4448 -/* B5B5B0 800E4410 00403825 */ move $a3, $v0 -/* B5B5B4 800E4414 8E6D2838 */ lw $t5, 0x2838($s3) -/* B5B5B8 800E4418 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B5BC 800E441C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B5C0 800E4420 00613024 */ and $a2, $v1, $at -/* B5B5C4 800E4424 8E040004 */ lw $a0, 4($s0) -/* B5B5C8 800E4428 02202825 */ move $a1, $s1 -/* B5B5CC 800E442C 0C038AF3 */ jal func_800E2BCC -/* B5B5D0 800E4430 85A70002 */ lh $a3, 2($t5) -/* B5B5D4 800E4434 920E0000 */ lbu $t6, ($s0) -/* B5B5D8 800E4438 AE110004 */ sw $s1, 4($s0) -/* B5B5DC 800E443C 31D8FFF3 */ andi $t8, $t6, 0xfff3 -/* B5B5E0 800E4440 1000000A */ b .L800E446C -/* B5B5E4 800E4444 A2180000 */ sb $t8, ($s0) -.L800E4448: -/* B5B5E8 800E4448 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B5EC 800E444C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B5F0 800E4450 00613024 */ and $a2, $v1, $at -/* B5B5F4 800E4454 0C038AAA */ jal Audio_DMAFastCopy -/* B5B5F8 800E4458 8E040004 */ lw $a0, 4($s0) -/* B5B5FC 800E445C 920F0000 */ lbu $t7, ($s0) -/* B5B600 800E4460 AE110004 */ sw $s1, 4($s0) -/* B5B604 800E4464 31F9FFF3 */ andi $t9, $t7, 0xfff3 -/* B5B608 800E4468 A2190000 */ sb $t9, ($s0) -.L800E446C: -/* B5B60C 800E446C 1000001C */ b .L800E44E0 -/* B5B610 800E4470 8E641768 */ lw $a0, 0x1768($s3) -/* B5B614 800E4474 8E6A176C */ lw $t2, 0x176c($s3) -.L800E4478: -/* B5B618 800E4478 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B61C 800E447C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B620 800E4480 000A5880 */ sll $t3, $t2, 2 -/* B5B624 800E4484 016A5821 */ addu $t3, $t3, $t2 -/* B5B628 800E4488 000B5880 */ sll $t3, $t3, 2 -/* B5B62C 800E448C 026B1021 */ addu $v0, $s3, $t3 -/* B5B630 800E4490 AC500D6C */ sw $s0, 0xd6c($v0) -/* B5B634 800E4494 AC510D70 */ sw $s1, 0xd70($v0) -/* B5B638 800E4498 8E6C176C */ lw $t4, 0x176c($s3) -/* B5B63C 800E449C AC400D78 */ sw $zero, 0xd78($v0) -/* B5B640 800E44A0 24420D68 */ addiu $v0, $v0, 0xd68 -/* B5B644 800E44A4 000C6E00 */ sll $t5, $t4, 0x18 -/* B5B648 800E44A8 01A17025 */ or $t6, $t5, $at -/* B5B64C 800E44AC AC4E000C */ sw $t6, 0xc($v0) -/* B5B650 800E44B0 8E030000 */ lw $v1, ($s0) -/* B5B654 800E44B4 8E180004 */ lw $t8, 4($s0) -/* B5B658 800E44B8 00617824 */ and $t7, $v1, $at -/* B5B65C 800E44BC 00035100 */ sll $t2, $v1, 4 -/* B5B660 800E44C0 000A5F82 */ srl $t3, $t2, 0x1e -/* B5B664 800E44C4 030FC821 */ addu $t9, $t8, $t7 -/* B5B668 800E44C8 032B6021 */ addu $t4, $t9, $t3 -/* B5B66C 800E44CC AC4C0000 */ sw $t4, ($v0) -/* B5B670 800E44D0 8E6D176C */ lw $t5, 0x176c($s3) -/* B5B674 800E44D4 8E641768 */ lw $a0, 0x1768($s3) -/* B5B678 800E44D8 25AE0001 */ addiu $t6, $t5, 1 -/* B5B67C 800E44DC AE6E176C */ sw $t6, 0x176c($s3) -.L800E44E0: -/* B5B680 800E44E0 26940001 */ addiu $s4, $s4, 1 -/* B5B684 800E44E4 0284082A */ slt $at, $s4, $a0 -/* B5B688 800E44E8 5420FF5D */ bnezl $at, .L800E4260 -/* B5B68C 800E44EC 8E6E176C */ lw $t6, 0x176c($s3) -.L800E44F0: -/* B5B690 800E44F0 8E69176C */ lw $t1, 0x176c($s3) -/* B5B694 800E44F4 AE601768 */ sw $zero, 0x1768($s3) -/* B5B698 800E44F8 8FB8004C */ lw $t8, 0x4c($sp) -/* B5B69C 800E44FC 5120001A */ beql $t1, $zero, .L800E4568 -/* B5B6A0 800E4500 8FBF0044 */ lw $ra, 0x44($sp) -/* B5B6A4 800E4504 17000017 */ bnez $t8, .L800E4564 -/* B5B6A8 800E4508 00097880 */ sll $t7, $t1, 2 -/* B5B6AC 800E450C 01E97821 */ addu $t7, $t7, $t1 -/* B5B6B0 800E4510 000F7880 */ sll $t7, $t7, 2 -/* B5B6B4 800E4514 026F1021 */ addu $v0, $s3, $t7 -/* B5B6B8 800E4518 8C500D58 */ lw $s0, 0xd58($v0) -/* B5B6BC 800E451C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5B6C0 800E4520 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5B6C4 800E4524 8E030000 */ lw $v1, ($s0) -/* B5B6C8 800E4528 8C450D5C */ lw $a1, 0xd5c($v0) -/* B5B6CC 800E452C 3C0A8017 */ lui $t2, %hi(gAudioContext+0x1e78) # $t2, 0x8017 -/* B5B6D0 800E4530 00613024 */ and $a2, $v1, $at -/* B5B6D4 800E4534 00064302 */ srl $t0, $a2, 0xc -/* B5B6D8 800E4538 8E040004 */ lw $a0, 4($s0) -/* B5B6DC 800E453C 25080001 */ addiu $t0, $t0, 1 -/* B5B6E0 800E4540 254A0FF8 */ addiu $t2, %lo(gAudioContext+0x1e78) # addiu $t2, $t2, 0xff8 -/* B5B6E4 800E4544 AFAA0014 */ sw $t2, 0x14($sp) -/* B5B6E8 800E4548 AFA80010 */ sw $t0, 0x10($sp) -/* B5B6EC 800E454C 8C590D60 */ lw $t9, 0xd60($v0) -/* B5B6F0 800E4550 00033900 */ sll $a3, $v1, 4 -/* B5B6F4 800E4554 24420D54 */ addiu $v0, $v0, 0xd54 -/* B5B6F8 800E4558 00073F82 */ srl $a3, $a3, 0x1e -/* B5B6FC 800E455C 0C038EB2 */ jal Audio_InitAsyncReq -/* B5B700 800E4560 AFB90018 */ sw $t9, 0x18($sp) -.L800E4564: -/* B5B704 800E4564 8FBF0044 */ lw $ra, 0x44($sp) -.L800E4568: -/* B5B708 800E4568 8FB00024 */ lw $s0, 0x24($sp) -/* B5B70C 800E456C 8FB10028 */ lw $s1, 0x28($sp) -/* B5B710 800E4570 8FB2002C */ lw $s2, 0x2c($sp) -/* B5B714 800E4574 8FB30030 */ lw $s3, 0x30($sp) -/* B5B718 800E4578 8FB40034 */ lw $s4, 0x34($sp) -/* B5B71C 800E457C 8FB50038 */ lw $s5, 0x38($sp) -/* B5B720 800E4580 8FB6003C */ lw $s6, 0x3c($sp) -/* B5B724 800E4584 8FB70040 */ lw $s7, 0x40($sp) -/* B5B728 800E4588 03E00008 */ jr $ra -/* B5B72C 800E458C 27BD0068 */ addiu $sp, $sp, 0x68 - diff --git a/asm/non_matchings/code/audio_load/func_800E4918.s b/asm/non_matchings/code/audio_load/func_800E4918.s deleted file mode 100644 index 86fc6a7855..0000000000 --- a/asm/non_matchings/code/audio_load/func_800E4918.s +++ /dev/null @@ -1,319 +0,0 @@ -glabel func_800E4918 -/* B5BAB8 800E4918 27BDFF88 */ addiu $sp, $sp, -0x78 -/* B5BABC 800E491C AFB40034 */ sw $s4, 0x34($sp) -/* B5BAC0 800E4920 3C148017 */ lui $s4, %hi(gAudioContext) # $s4, 0x8017 -/* B5BAC4 800E4924 2694F180 */ addiu $s4, %lo(gAudioContext) # addiu $s4, $s4, -0xe80 -/* B5BAC8 800E4928 8E8E176C */ lw $t6, 0x176c($s4) -/* B5BACC 800E492C AFB50038 */ sw $s5, 0x38($sp) -/* B5BAD0 800E4930 AFB30030 */ sw $s3, 0x30($sp) -/* B5BAD4 800E4934 AFB10028 */ sw $s1, 0x28($sp) -/* B5BAD8 800E4938 00808825 */ move $s1, $a0 -/* B5BADC 800E493C 00C09825 */ move $s3, $a2 -/* B5BAE0 800E4940 00A0A825 */ move $s5, $a1 -/* B5BAE4 800E4944 AFBF003C */ sw $ra, 0x3c($sp) -/* B5BAE8 800E4948 AFB2002C */ sw $s2, 0x2c($sp) -/* B5BAEC 800E494C AFB00024 */ sw $s0, 0x24($sp) -/* B5BAF0 800E4950 11C00003 */ beqz $t6, .L800E4960 -/* B5BAF4 800E4954 AFA00044 */ sw $zero, 0x44($sp) -/* B5BAF8 800E4958 240F0001 */ li $t7, 1 -/* B5BAFC 800E495C AFAF0044 */ sw $t7, 0x44($sp) -.L800E4960: -/* B5BB00 800E4960 8E982844 */ lw $t8, 0x2844($s4) -/* B5BB04 800E4964 0011C880 */ sll $t9, $s1, 2 -/* B5BB08 800E4968 0331C821 */ addu $t9, $t9, $s1 -/* B5BB0C 800E496C 0019C880 */ sll $t9, $t9, 2 -/* B5BB10 800E4970 AE801768 */ sw $zero, 0x1768($s4) -/* B5BB14 800E4974 03191021 */ addu $v0, $t8, $t9 -/* B5BB18 800E4978 904A0001 */ lbu $t2, 1($v0) -/* B5BB1C 800E497C 00009025 */ move $s2, $zero -/* B5BB20 800E4980 AFAA0074 */ sw $t2, 0x74($sp) -/* B5BB24 800E4984 90430000 */ lbu $v1, ($v0) -/* B5BB28 800E4988 944B0004 */ lhu $t3, 4($v0) -/* B5BB2C 800E498C 18600019 */ blez $v1, .L800E49F4 -/* B5BB30 800E4990 AFAB006C */ sw $t3, 0x6c($sp) -/* B5BB34 800E4994 AFA30070 */ sw $v1, 0x70($sp) -/* B5BB38 800E4998 02202025 */ move $a0, $s1 -.L800E499C: -/* B5BB3C 800E499C 0C039D26 */ jal Audio_GetInstrumentInner -/* B5BB40 800E49A0 02402825 */ move $a1, $s2 -/* B5BB44 800E49A4 1040000E */ beqz $v0, .L800E49E0 -/* B5BB48 800E49A8 00408025 */ move $s0, $v0 -/* B5BB4C 800E49AC 904C0001 */ lbu $t4, 1($v0) -/* B5BB50 800E49B0 51800004 */ beql $t4, $zero, .L800E49C4 -/* B5BB54 800E49B4 920D0002 */ lbu $t5, 2($s0) -/* B5BB58 800E49B8 0C039230 */ jal func_800E48C0 -/* B5BB5C 800E49BC 24440008 */ addiu $a0, $v0, 8 -/* B5BB60 800E49C0 920D0002 */ lbu $t5, 2($s0) -.L800E49C4: -/* B5BB64 800E49C4 2401007F */ li $at, 127 -/* B5BB68 800E49C8 11A10003 */ beq $t5, $at, .L800E49D8 -/* B5BB6C 800E49CC 00000000 */ nop -/* B5BB70 800E49D0 0C039230 */ jal func_800E48C0 -/* B5BB74 800E49D4 26040018 */ addiu $a0, $s0, 0x18 -.L800E49D8: -/* B5BB78 800E49D8 0C039230 */ jal func_800E48C0 -/* B5BB7C 800E49DC 26040010 */ addiu $a0, $s0, 0x10 -.L800E49E0: -/* B5BB80 800E49E0 8FAE0070 */ lw $t6, 0x70($sp) -/* B5BB84 800E49E4 26520001 */ addiu $s2, $s2, 1 -/* B5BB88 800E49E8 564EFFEC */ bnel $s2, $t6, .L800E499C -/* B5BB8C 800E49EC 02202025 */ move $a0, $s1 -/* B5BB90 800E49F0 00009025 */ move $s2, $zero -.L800E49F4: -/* B5BB94 800E49F4 8FAF0074 */ lw $t7, 0x74($sp) -/* B5BB98 800E49F8 19E0000C */ blez $t7, .L800E4A2C -/* B5BB9C 800E49FC 02202025 */ move $a0, $s1 -.L800E4A00: -/* B5BBA0 800E4A00 0C039D5B */ jal Audio_GetDrum -/* B5BBA4 800E4A04 02402825 */ move $a1, $s2 -/* B5BBA8 800E4A08 50400004 */ beql $v0, $zero, .L800E4A1C -/* B5BBAC 800E4A0C 8FB80074 */ lw $t8, 0x74($sp) -/* B5BBB0 800E4A10 0C039230 */ jal func_800E48C0 -/* B5BBB4 800E4A14 24440004 */ addiu $a0, $v0, 4 -/* B5BBB8 800E4A18 8FB80074 */ lw $t8, 0x74($sp) -.L800E4A1C: -/* B5BBBC 800E4A1C 26520001 */ addiu $s2, $s2, 1 -/* B5BBC0 800E4A20 5658FFF7 */ bnel $s2, $t8, .L800E4A00 -/* B5BBC4 800E4A24 02202025 */ move $a0, $s1 -/* B5BBC8 800E4A28 00009025 */ move $s2, $zero -.L800E4A2C: -/* B5BBCC 800E4A2C 8FB9006C */ lw $t9, 0x6c($sp) -/* B5BBD0 800E4A30 1B20000B */ blez $t9, .L800E4A60 -/* B5BBD4 800E4A34 02202025 */ move $a0, $s1 -.L800E4A38: -/* B5BBD8 800E4A38 0C039D94 */ jal Audio_GetSfx -/* B5BBDC 800E4A3C 02402825 */ move $a1, $s2 -/* B5BBE0 800E4A40 10400003 */ beqz $v0, .L800E4A50 -/* B5BBE4 800E4A44 00402025 */ move $a0, $v0 -/* B5BBE8 800E4A48 0C039230 */ jal func_800E48C0 -/* B5BBEC 800E4A4C 00000000 */ nop -.L800E4A50: -/* B5BBF0 800E4A50 8FAA006C */ lw $t2, 0x6c($sp) -/* B5BBF4 800E4A54 26520001 */ addiu $s2, $s2, 1 -/* B5BBF8 800E4A58 564AFFF7 */ bnel $s2, $t2, .L800E4A38 -/* B5BBFC 800E4A5C 02202025 */ move $a0, $s1 -.L800E4A60: -/* B5BC00 800E4A60 8E851768 */ lw $a1, 0x1768($s4) -/* B5BC04 800E4A64 00001825 */ move $v1, $zero -/* B5BC08 800E4A68 00009025 */ move $s2, $zero -/* B5BC0C 800E4A6C 50A000C1 */ beql $a1, $zero, .L800E4D74 -/* B5BC10 800E4A70 8FBF003C */ lw $ra, 0x3c($sp) -/* B5BC14 800E4A74 18A00012 */ blez $a1, .L800E4AC0 -/* B5BC18 800E4A78 8E88176C */ lw $t0, 0x176c($s4) -/* B5BC1C 800E4A7C 3C0B8017 */ lui $t3, %hi(gAudioContext) -/* B5BC20 800E4A80 2562F180 */ addiu $v0, $t3, %lo(gAudioContext) -/* B5BC24 800E4A84 00056080 */ sll $t4, $a1, 2 -/* B5BC28 800E4A88 01823021 */ addu $a2, $t4, $v0 -/* B5BC2C 800E4A8C 2404FFF0 */ li $a0, -16 -.L800E4A90: -/* B5BC30 800E4A90 8C4D0B68 */ lw $t5, 0xb68($v0) -/* B5BC34 800E4A94 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BC38 800E4A98 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BC3C 800E4A9C 8DAE0000 */ lw $t6, ($t5) -/* B5BC40 800E4AA0 24420004 */ addiu $v0, $v0, 4 -/* B5BC44 800E4AA4 01C17824 */ and $t7, $t6, $at -/* B5BC48 800E4AA8 25F8000F */ addiu $t8, $t7, 0xf -/* B5BC4C 800E4AAC 0046082B */ sltu $at, $v0, $a2 -/* B5BC50 800E4AB0 0304C824 */ and $t9, $t8, $a0 -/* B5BC54 800E4AB4 1420FFF6 */ bnez $at, .L800E4A90 -/* B5BC58 800E4AB8 00791821 */ addu $v1, $v1, $t9 -/* B5BC5C 800E4ABC 00009025 */ move $s2, $zero -.L800E4AC0: -/* B5BC60 800E4AC0 18A00090 */ blez $a1, .L800E4D04 -/* B5BC64 800E4AC4 8FB10054 */ lw $s1, 0x54($sp) -/* B5BC68 800E4AC8 24010078 */ li $at, 120 -.L800E4ACC: -/* B5BC6C 800E4ACC 1101008D */ beq $t0, $at, .L800E4D04 -/* B5BC70 800E4AD0 00125080 */ sll $t2, $s2, 2 -/* B5BC74 800E4AD4 028A6021 */ addu $t4, $s4, $t2 -/* B5BC78 800E4AD8 8D900B68 */ lw $s0, 0xb68($t4) -/* B5BC7C 800E4ADC 8E030000 */ lw $v1, ($s0) -/* B5BC80 800E4AE0 00031100 */ sll $v0, $v1, 4 -/* B5BC84 800E4AE4 00021782 */ srl $v0, $v0, 0x1e -/* B5BC88 800E4AE8 50400082 */ beql $v0, $zero, .L800E4CF4 -/* B5BC8C 800E4AEC 26520001 */ addiu $s2, $s2, 1 -/* B5BC90 800E4AF0 12A00005 */ beqz $s5, .L800E4B08 -/* B5BC94 800E4AF4 24010001 */ li $at, 1 -/* B5BC98 800E4AF8 52A10020 */ beql $s5, $at, .L800E4B7C -/* B5BC9C 800E4AFC 8E780010 */ lw $t8, 0x10($s3) -/* B5BCA0 800E4B00 10000036 */ b .L800E4BDC -/* B5BCA4 800E4B04 00000000 */ nop -.L800E4B08: -/* B5BCA8 800E4B08 8E6B0010 */ lw $t3, 0x10($s3) -/* B5BCAC 800E4B0C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BCB0 800E4B10 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BCB4 800E4B14 1562000A */ bne $t3, $v0, .L800E4B40 -/* B5BCB8 800E4B18 00612024 */ and $a0, $v1, $at -/* B5BCBC 800E4B1C 8E650000 */ lw $a1, ($s3) -/* B5BCC0 800E4B20 8E060004 */ lw $a2, 4($s0) -/* B5BCC4 800E4B24 00023E00 */ sll $a3, $v0, 0x18 -/* B5BCC8 800E4B28 240D0001 */ li $t5, 1 -/* B5BCCC 800E4B2C AFAD0010 */ sw $t5, 0x10($sp) -/* B5BCD0 800E4B30 0C038171 */ jal func_800E05C4 -/* B5BCD4 800E4B34 00073E03 */ sra $a3, $a3, 0x18 -/* B5BCD8 800E4B38 10000028 */ b .L800E4BDC -/* B5BCDC 800E4B3C 00408825 */ move $s1, $v0 -.L800E4B40: -/* B5BCE0 800E4B40 8E6E0014 */ lw $t6, 0x14($s3) -/* B5BCE4 800E4B44 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BCE8 800E4B48 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BCEC 800E4B4C 15C20023 */ bne $t6, $v0, .L800E4BDC -/* B5BCF0 800E4B50 00612024 */ and $a0, $v1, $at -/* B5BCF4 800E4B54 8E650004 */ lw $a1, 4($s3) -/* B5BCF8 800E4B58 8E060004 */ lw $a2, 4($s0) -/* B5BCFC 800E4B5C 00023E00 */ sll $a3, $v0, 0x18 -/* B5BD00 800E4B60 240F0001 */ li $t7, 1 -/* B5BD04 800E4B64 AFAF0010 */ sw $t7, 0x10($sp) -/* B5BD08 800E4B68 0C038171 */ jal func_800E05C4 -/* B5BD0C 800E4B6C 00073E03 */ sra $a3, $a3, 0x18 -/* B5BD10 800E4B70 1000001A */ b .L800E4BDC -/* B5BD14 800E4B74 00408825 */ move $s1, $v0 -/* B5BD18 800E4B78 8E780010 */ lw $t8, 0x10($s3) -.L800E4B7C: -/* B5BD1C 800E4B7C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BD20 800E4B80 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BD24 800E4B84 17020009 */ bne $t8, $v0, .L800E4BAC -/* B5BD28 800E4B88 00612024 */ and $a0, $v1, $at -/* B5BD2C 800E4B8C 8E650000 */ lw $a1, ($s3) -/* B5BD30 800E4B90 8E060004 */ lw $a2, 4($s0) -/* B5BD34 800E4B94 00023E00 */ sll $a3, $v0, 0x18 -/* B5BD38 800E4B98 00073E03 */ sra $a3, $a3, 0x18 -/* B5BD3C 800E4B9C 0C038171 */ jal func_800E05C4 -/* B5BD40 800E4BA0 AFA00010 */ sw $zero, 0x10($sp) -/* B5BD44 800E4BA4 1000000D */ b .L800E4BDC -/* B5BD48 800E4BA8 00408825 */ move $s1, $v0 -.L800E4BAC: -/* B5BD4C 800E4BAC 8E790014 */ lw $t9, 0x14($s3) -/* B5BD50 800E4BB0 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BD54 800E4BB4 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BD58 800E4BB8 17220008 */ bne $t9, $v0, .L800E4BDC -/* B5BD5C 800E4BBC 00612024 */ and $a0, $v1, $at -/* B5BD60 800E4BC0 8E650004 */ lw $a1, 4($s3) -/* B5BD64 800E4BC4 8E060004 */ lw $a2, 4($s0) -/* B5BD68 800E4BC8 00023E00 */ sll $a3, $v0, 0x18 -/* B5BD6C 800E4BCC 00073E03 */ sra $a3, $a3, 0x18 -/* B5BD70 800E4BD0 0C038171 */ jal func_800E05C4 -/* B5BD74 800E4BD4 AFA00010 */ sw $zero, 0x10($sp) -/* B5BD78 800E4BD8 00408825 */ move $s1, $v0 -.L800E4BDC: -/* B5BD7C 800E4BDC 16200004 */ bnez $s1, .L800E4BF0 -/* B5BD80 800E4BE0 00000000 */ nop -/* B5BD84 800E4BE4 8E88176C */ lw $t0, 0x176c($s4) -/* B5BD88 800E4BE8 10000041 */ b .L800E4CF0 -/* B5BD8C 800E4BEC 8E851768 */ lw $a1, 0x1768($s4) -.L800E4BF0: -/* B5BD90 800E4BF0 12A00005 */ beqz $s5, .L800E4C08 -/* B5BD94 800E4BF4 24010001 */ li $at, 1 -/* B5BD98 800E4BF8 12A10023 */ beq $s5, $at, .L800E4C88 -/* B5BD9C 800E4BFC 8E88176C */ lw $t0, 0x176c($s4) -/* B5BDA0 800E4C00 1000003B */ b .L800E4CF0 -/* B5BDA4 800E4C04 8E851768 */ lw $a1, 0x1768($s4) -.L800E4C08: -/* B5BDA8 800E4C08 8E030000 */ lw $v1, ($s0) -/* B5BDAC 800E4C0C 24010001 */ li $at, 1 -/* B5BDB0 800E4C10 02202825 */ move $a1, $s1 -/* B5BDB4 800E4C14 00031100 */ sll $v0, $v1, 4 -/* B5BDB8 800E4C18 00021782 */ srl $v0, $v0, 0x1e -/* B5BDBC 800E4C1C 1441000E */ bne $v0, $at, .L800E4C58 -/* B5BDC0 800E4C20 00403825 */ move $a3, $v0 -/* B5BDC4 800E4C24 8E8A2838 */ lw $t2, 0x2838($s4) -/* B5BDC8 800E4C28 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BDCC 800E4C2C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BDD0 800E4C30 00613024 */ and $a2, $v1, $at -/* B5BDD4 800E4C34 8E040004 */ lw $a0, 4($s0) -/* B5BDD8 800E4C38 02202825 */ move $a1, $s1 -/* B5BDDC 800E4C3C 0C038AF3 */ jal func_800E2BCC -/* B5BDE0 800E4C40 85470002 */ lh $a3, 2($t2) -/* B5BDE4 800E4C44 920C0000 */ lbu $t4, ($s0) -/* B5BDE8 800E4C48 AE110004 */ sw $s1, 4($s0) -/* B5BDEC 800E4C4C 318BFFF3 */ andi $t3, $t4, 0xfff3 -/* B5BDF0 800E4C50 1000000A */ b .L800E4C7C -/* B5BDF4 800E4C54 A20B0000 */ sb $t3, ($s0) -.L800E4C58: -/* B5BDF8 800E4C58 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BDFC 800E4C5C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BE00 800E4C60 00613024 */ and $a2, $v1, $at -/* B5BE04 800E4C64 0C038AAA */ jal Audio_DMAFastCopy -/* B5BE08 800E4C68 8E040004 */ lw $a0, 4($s0) -/* B5BE0C 800E4C6C 920D0000 */ lbu $t5, ($s0) -/* B5BE10 800E4C70 AE110004 */ sw $s1, 4($s0) -/* B5BE14 800E4C74 31AEFFF3 */ andi $t6, $t5, 0xfff3 -/* B5BE18 800E4C78 A20E0000 */ sb $t6, ($s0) -.L800E4C7C: -/* B5BE1C 800E4C7C 8E88176C */ lw $t0, 0x176c($s4) -/* B5BE20 800E4C80 1000001B */ b .L800E4CF0 -/* B5BE24 800E4C84 8E851768 */ lw $a1, 0x1768($s4) -.L800E4C88: -/* B5BE28 800E4C88 00087880 */ sll $t7, $t0, 2 -/* B5BE2C 800E4C8C 01E87821 */ addu $t7, $t7, $t0 -/* B5BE30 800E4C90 000F7880 */ sll $t7, $t7, 2 -/* B5BE34 800E4C94 028F1021 */ addu $v0, $s4, $t7 -/* B5BE38 800E4C98 AC500D6C */ sw $s0, 0xd6c($v0) -/* B5BE3C 800E4C9C AC510D70 */ sw $s1, 0xd70($v0) -/* B5BE40 800E4CA0 8E98176C */ lw $t8, 0x176c($s4) -/* B5BE44 800E4CA4 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BE48 800E4CA8 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BE4C 800E4CAC 0018CE00 */ sll $t9, $t8, 0x18 -/* B5BE50 800E4CB0 03215025 */ or $t2, $t9, $at -/* B5BE54 800E4CB4 AC4A0D74 */ sw $t2, 0xd74($v0) -/* B5BE58 800E4CB8 AC400D78 */ sw $zero, 0xd78($v0) -/* B5BE5C 800E4CBC 8E030000 */ lw $v1, ($s0) -/* B5BE60 800E4CC0 8E0C0004 */ lw $t4, 4($s0) -/* B5BE64 800E4CC4 24420D68 */ addiu $v0, $v0, 0xd68 -/* B5BE68 800E4CC8 00615824 */ and $t3, $v1, $at -/* B5BE6C 800E4CCC 00037100 */ sll $t6, $v1, 4 -/* B5BE70 800E4CD0 000E7F82 */ srl $t7, $t6, 0x1e -/* B5BE74 800E4CD4 018B6821 */ addu $t5, $t4, $t3 -/* B5BE78 800E4CD8 01AFC021 */ addu $t8, $t5, $t7 -/* B5BE7C 800E4CDC AC580000 */ sw $t8, ($v0) -/* B5BE80 800E4CE0 8E99176C */ lw $t9, 0x176c($s4) -/* B5BE84 800E4CE4 8E851768 */ lw $a1, 0x1768($s4) -/* B5BE88 800E4CE8 27280001 */ addiu $t0, $t9, 1 -/* B5BE8C 800E4CEC AE88176C */ sw $t0, 0x176c($s4) -.L800E4CF0: -/* B5BE90 800E4CF0 26520001 */ addiu $s2, $s2, 1 -.L800E4CF4: -/* B5BE94 800E4CF4 0245082A */ slt $at, $s2, $a1 -/* B5BE98 800E4CF8 5420FF74 */ bnezl $at, .L800E4ACC -/* B5BE9C 800E4CFC 24010078 */ li $at, 120 -/* B5BEA0 800E4D00 AFB10054 */ sw $s1, 0x54($sp) -.L800E4D04: -/* B5BEA4 800E4D04 1100001A */ beqz $t0, .L800E4D70 -/* B5BEA8 800E4D08 AE801768 */ sw $zero, 0x1768($s4) -/* B5BEAC 800E4D0C 8FAC0044 */ lw $t4, 0x44($sp) -/* B5BEB0 800E4D10 00085880 */ sll $t3, $t0, 2 -/* B5BEB4 800E4D14 01685821 */ addu $t3, $t3, $t0 -/* B5BEB8 800E4D18 15800015 */ bnez $t4, .L800E4D70 -/* B5BEBC 800E4D1C 000B5880 */ sll $t3, $t3, 2 -/* B5BEC0 800E4D20 028B1021 */ addu $v0, $s4, $t3 -/* B5BEC4 800E4D24 8C500D58 */ lw $s0, 0xd58($v0) -/* B5BEC8 800E4D28 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* B5BECC 800E4D2C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* B5BED0 800E4D30 8E030000 */ lw $v1, ($s0) -/* B5BED4 800E4D34 8C450D5C */ lw $a1, 0xd5c($v0) -/* B5BED8 800E4D38 3C0E8017 */ lui $t6, %hi(gAudioContext+0x1e78) # $t6, 0x8017 -/* B5BEDC 800E4D3C 00613024 */ and $a2, $v1, $at -/* B5BEE0 800E4D40 00064B02 */ srl $t1, $a2, 0xc -/* B5BEE4 800E4D44 8E040004 */ lw $a0, 4($s0) -/* B5BEE8 800E4D48 25290001 */ addiu $t1, $t1, 1 -/* B5BEEC 800E4D4C 25CE0FF8 */ addiu $t6, %lo(gAudioContext+0x1e78) # addiu $t6, $t6, 0xff8 -/* B5BEF0 800E4D50 AFAE0014 */ sw $t6, 0x14($sp) -/* B5BEF4 800E4D54 AFA90010 */ sw $t1, 0x10($sp) -/* B5BEF8 800E4D58 8C4D0D60 */ lw $t5, 0xd60($v0) -/* B5BEFC 800E4D5C 00033900 */ sll $a3, $v1, 4 -/* B5BF00 800E4D60 24420D54 */ addiu $v0, $v0, 0xd54 -/* B5BF04 800E4D64 00073F82 */ srl $a3, $a3, 0x1e -/* B5BF08 800E4D68 0C038EB2 */ jal Audio_InitAsyncReq -/* B5BF0C 800E4D6C AFAD0018 */ sw $t5, 0x18($sp) -.L800E4D70: -/* B5BF10 800E4D70 8FBF003C */ lw $ra, 0x3c($sp) -.L800E4D74: -/* B5BF14 800E4D74 8FB00024 */ lw $s0, 0x24($sp) -/* B5BF18 800E4D78 8FB10028 */ lw $s1, 0x28($sp) -/* B5BF1C 800E4D7C 8FB2002C */ lw $s2, 0x2c($sp) -/* B5BF20 800E4D80 8FB30030 */ lw $s3, 0x30($sp) -/* B5BF24 800E4D84 8FB40034 */ lw $s4, 0x34($sp) -/* B5BF28 800E4D88 8FB50038 */ lw $s5, 0x38($sp) -/* B5BF2C 800E4D8C 03E00008 */ jr $ra -/* B5BF30 800E4D90 27BD0078 */ addiu $sp, $sp, 0x78 - diff --git a/include/functions.h b/include/functions.h index bafddb14e3..775f8eab0e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1936,7 +1936,7 @@ void func_800E0E90(s32 id); void func_800E0EB4(s32 arg0, s32 id); void func_800E1148(void); void func_800E11F0(void); -void* Audio_DmaSampleData(u32 arg0, s32 arg1, s32 arg2, u8* arg3, s32 arg4); +void* Audio_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, s32 medium); void func_800E1618(s32 arg0); s32 Audio_IsBankLoadComplete(s32 bankId); s32 Audio_IsSeqLoadComplete(s32 seqId); @@ -1955,11 +1955,11 @@ void Audio_ProcessLoads(s32 resetStatus); void func_800E301C(void* callback); void Audio_ContextInit(void* heap, u32 heapSize); void Audio_SyncLoadsInit(void); -s32 Audio_SyncLoadSample(s32 arg0, s32 arg1, u8* arg2); -s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, u8* arg2); +s32 Audio_SyncLoadSample(s32 arg0, s32 arg1, s8* arg2); +s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, s8* arg2); void Audio_AsyncLoadReqInit(void); void func_800E4D94(void); -void func_800E4EEC(s32 tableType, s32 arg1, u8* arg2); +void func_800E4EEC(s32 tableType, s32 arg1, s8* arg2); void func_800E4F58(void); void func_800E4FB0(void); AudioTask* func_800E4FE0(void); diff --git a/include/variables.h b/include/variables.h index 67a4c360ce..0596c93ac1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3069,9 +3069,6 @@ extern FaultThreadStruct gFaultStruct; //extern ? D_8016B6B5; //extern ? D_8016B6B8; extern OSMesgQueue D_8016B6E0; -//extern OSMesg D_8016B6F8; -extern u8* D_8016B738[]; -//extern u32 D_8016B780; //extern ? D_8016B7A8; //extern ? D_8016B7AC; //extern ? D_8016B7B0; diff --git a/include/z64audio.h b/include/z64audio.h index 6e54a4d557..7284e2f4e5 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -731,25 +731,25 @@ typedef struct { /* 0x1C */ u32 retMsg; /* 0x20 */ OSMesgQueue* retQueue; /* 0x24 */ OSMesgQueue msgQueue; - /* 0x3C */ OSMesg msg[1]; + /* 0x3C */ OSMesg msg; /* 0x40 */ OSIoMesg ioMesg; } AsyncLoadReq; // size = 0x58 typedef struct { - /* 0x0000 */ u8 unk_00; - /* 0x0001 */ u8 unk_01; - /* 0x0002 */ u16 unk_02; - /* 0x0004 */ s32 unk_04; - /* 0x0008 */ s32 devAddr; - /* 0x000C */ u8* ramAddr; - /* 0x0010 */ u8* unk_10; - /* 0x0014 */ s32 status; - /* 0x0018 */ s32 size; - /* 0x001C */ s8* isDone; - /* 0x0020 */ AudioBankSample sample; - /* 0x0030 */ OSMesgQueue msgqueue; - /* 0x0048 */ OSMesg msg[1]; - /* 0x004C */ OSIoMesg ioMesg; + /* 0x00 */ u8 unk_00; + /* 0x01 */ u8 unk_01; + /* 0x02 */ u16 unk_02; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 devAddr; + /* 0x0C */ u8* ramAddr; + /* 0x10 */ u8* unk_10; + /* 0x14 */ s32 status; + /* 0x18 */ s32 size; + /* 0x1C */ s8* isDone; + /* 0x20 */ AudioBankSample sample; + /* 0x30 */ OSMesgQueue msgqueue; + /* 0x48 */ OSMesg msg; + /* 0x4C */ OSIoMesg ioMesg; } AudioSyncLoad; // size = 0x64 typedef struct { @@ -758,79 +758,78 @@ typedef struct { } unk_283C; typedef struct { - /* 0x0000 */ s16 entryCnt; - /* 0x0002 */ s16 unk_02; - /* 0x0004 */ u32 romAddr; - /* 0x0008 */ char pad[0x8]; + /* 0x00 */ s16 entryCnt; + /* 0x02 */ s16 unk_02; + /* 0x04 */ u32 romAddr; + /* 0x08 */ char pad[0x8]; } AudioTableHeader; // size = 0x10 typedef struct { - /* 0x0000 */ u32 romAddr; - /* 0x0004 */ u32 size; - /* 0x0008 */ s8 unk_08; - /* 0x0009 */ s8 type; - /* 0x000A */ char pad[6]; + /* 0x00 */ u32 romAddr; + /* 0x04 */ u32 size; + /* 0x08 */ s8 unk_08; + /* 0x09 */ s8 type; + /* 0x0A */ char pad[6]; } SequenceTableEntry; // size = 0x10 typedef struct { - /* 0x0000 */ u32 romAddr; - /* 0x0004 */ u32 size; - /* 0x0008 */ u8 unk_08; - /* 0x0009 */ u8 unk_09; - /* 0x000A */ s16 unk_0A; - /* 0x000C */ s16 unk_0C; - /* 0x000E */ s16 unk_0E; + /* 0x00 */ u32 romAddr; + /* 0x04 */ u32 size; + /* 0x08 */ u8 unk_08; + /* 0x09 */ u8 unk_09; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ s16 unk_0C; + /* 0x0E */ s16 unk_0E; } AudioBankTableEntry; // size = 0x10 typedef struct { - /* 0x0000 */ u32 romAddr; - /* 0x0004 */ u32 size; - /* 0x0008 */ s8 unk_08; - /* 0x0009 */ s8 unk_09; - /* 0x000A */ char pad[6]; + /* 0x00 */ u32 romAddr; + /* 0x04 */ u32 size; + /* 0x08 */ s8 unk_08; + /* 0x09 */ s8 unk_09; + /* 0x0A */ char pad[6]; } AudioTableEntry; // size = 0x10 typedef struct { - /* 0x0000 */ AudioTableHeader header; - /* 0x0010 */ SequenceTableEntry entries[1]; + /* 0x00 */ AudioTableHeader header; + /* 0x10 */ SequenceTableEntry entries[1]; } SequenceTable; // size >= 0x20 typedef struct { - /* 0x0000 */ AudioTableHeader header; - /* 0x0010 */ AudioBankTableEntry entries[1]; + /* 0x00 */ AudioTableHeader header; + /* 0x10 */ AudioBankTableEntry entries[1]; } AudioBankTable; // size >= 0x20 typedef struct { - /* 0x0000 */ AudioTableHeader header; - /* 0x0010 */ AudioTableEntry entries[1]; + /* 0x00 */ AudioTableHeader header; + /* 0x10 */ AudioTableEntry entries[1]; } AudioTable; // size >= 0x20 typedef struct { - /* 0x0000 */ OSTask task; - /* 0x0040 */ OSMesgQueue* taskQueue; - /* 0x0044 */ void* unk_44; // probably a message that gets unused. - /* 0x0048 */ char unk_48[0x8]; + /* 0x00 */ OSTask task; + /* 0x40 */ OSMesgQueue* taskQueue; + /* 0x44 */ void* unk_44; // probably a message that gets unused. + /* 0x48 */ char unk_48[0x8]; } AudioTask; // size = 0x50 typedef struct { - /* 0x0000 */ u8* ramAddr; - /* 0x0004 */ u32 devAddr; - /* 0x0008 */ u16 unk_08; - /* 0x000A */ u16 size; - /* 0x000C */ u8 unk_0C; - /* 0x000D */ u8 unk_0D; - /* 0x000E */ u8 unk_0E; - /* 0x000F */ u8 unk_0F; + /* 0x00 */ u8* ramAddr; + /* 0x04 */ u32 devAddr; + /* 0x08 */ u16 sizeUnused; + /* 0x0A */ u16 size; + /* 0x0C */ u8 unused; + /* 0x0D */ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0 + /* 0x0E */ u8 ttl; // duration after which the DMA can be discarded } SampleDmaReq; // size = 0x10 typedef struct { - s32 unk_00; - s32 unk_04; - s32 unk_08; - s32 unk_0C; - s32 unk_10; - s32 unk_14; -} RelocInfo; + /* 0x00 */ s32 index1; + /* 0x04 */ s32 index2; + /* 0x08 */ s32 baseAddr1; + /* 0x0C */ s32 baseAddr2; + /* 0x10 */ u32 medium1; + /* 0x14 */ u32 medium2; +} RelocInfo; // size = 0x18 typedef enum { /* 0 */ SEQUENCE_TABLE, @@ -838,12 +837,6 @@ typedef enum { /* 2 */ AUDIO_TABLE } AudioTableType; -typedef struct { - Drum** drums; - AudioBankSound* sfx; - Instrument* instruments[1]; -} unk_ldr; - typedef struct { /* 0x0000 */ char unk_0000; /* 0x0001 */ s8 numSynthesisReverbs; @@ -854,7 +847,7 @@ typedef struct { /* 0x0014 */ NoteSubEu* noteSubsEu; /* 0x0018 */ SynthesisReverb synthesisReverbs[4]; /* 0x0B38 */ char unk_0B38[0x30]; - /* 0x0B68 */ AudioBankSample* unk_B68[128]; + /* 0x0B68 */ AudioBankSample* unk_0B68[128]; /* 0x0D68 */ AudioStruct0D68 unk_0D68[128]; /* 0x1768 */ s32 unk_1768; /* 0x176C */ s32 unk_176C; @@ -871,29 +864,28 @@ typedef struct { /* 0x1E38 */ OSMesg unk_1E38[0x10]; /* 0x1E78 */ OSMesgQueue unk_1E78; /* 0x1E90 */ OSMesg unk_1E90[0x10]; - /* 0x1ED0 */ OSMesgQueue unk_1ED0; - /* 0x1EE8 */ OSMesg unk_1EE8[0x40]; - /* 0x1FE8 */ OSIoMesg sampIoReq[1]; // unknown size - /* 0x2000 */ char unk_2000[0x5E8]; + /* 0x1ED0 */ OSMesgQueue currAudioFrameDmaQueue; + /* 0x1EE8 */ OSMesg currAudioFrameDmaMesgBufs[0x40]; + /* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMesgBufs[0x40]; /* 0x25E8 */ OSMesgQueue unk_25E8; /* 0x2600 */ OSMesg unk_2600; /* 0x2604 */ OSIoMesg unk_2604; /* 0x261C */ SampleDmaReq* sampleDmaReqs; /* 0x2620 */ u32 sampleDmaReqCnt; - /* 0x2624 */ u32 unk_2624; // sample start idx? + /* 0x2624 */ u32 sampleDmaListSize1; /* 0x2628 */ s32 unk_2628; - /* 0x262C */ u8 unk_262C[0x100]; - /* 0x272C */ u8 unk_272C[0x100]; - /* 0x282C */ u8 unk_282C; - /* 0x282D */ u8 unk_282D; - /* 0x282E */ u8 unk_282E; - /* 0x282F */ u8 unk_282F; + /* 0x262C */ u8 sampleDmaReuseQueue1[0x100]; // read pos <= write pos, wrapping mod 256 + /* 0x272C */ u8 sampleDmaReuseQueue2[0x100]; + /* 0x282C */ u8 sampleDmaReuseQueue1RdPos; + /* 0x282D */ u8 sampleDmaReuseQueue2RdPos; + /* 0x282E */ u8 sampleDmaReuseQueue1WrPos; + /* 0x282F */ u8 sampleDmaReuseQueue2WrPos; /* 0x2830 */ SequenceTable* sequenceTable; /* 0x2834 */ AudioBankTable* audioBankTable; /* 0x2838 */ AudioTable* audioTable; union { /* 0x283C */ u16* unk_283C; - /* 0x283C */ char* unk_283Cb; + /* 0x283C */ u8* unk_283Cb; }; /* 0x2840 */ u16 seqTabEntCnt; // channels used? /* 0x2844 */ CtlEntry* ctlEntries; @@ -908,7 +900,7 @@ typedef struct { /* 0x2898 */ s16 tempoInternalToExternal; /* 0x289A */ s8 soundMode; /* 0x289C */ s32 totalTaskCnt; - /* 0x28A0 */ s32 sampleIoReqIdx; + /* 0x28A0 */ s32 curAudioFrameDmaCount; /* 0x28A4 */ s32 rspTaskIdx; /* 0x28A8 */ s32 curAIBufIdx; /* 0x28AC */ Acmd* abiCmdBufs[2]; @@ -990,52 +982,52 @@ typedef struct { } NoteSubAttributes; // size = 0x18 typedef struct { - /* 0x0000 */ u32 heap; - /* 0x0004 */ u32 mainPool; - /* 0x0008 */ u32 initPool; + /* 0x00 */ u32 heap; + /* 0x04 */ u32 mainPool; + /* 0x08 */ u32 initPool; } AudioContextInitSizes; // size = 0xC typedef struct { - /* 0x0000 */ f32 unk_00; - /* 0x0004 */ f32 unk_04; - /* 0x0008 */ f32 unk_08; - /* 0x000C */ u16 unk_0C; - /* 0x0010 */ f32 unk_10; - /* 0x0014 */ f32 unk_14; - /* 0x0018 */ f32 unk_18; - /* 0x001C */ u16 unk_1C; + /* 0x00 */ f32 unk_00; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ u16 unk_0C; + /* 0x10 */ f32 unk_10; + /* 0x14 */ f32 unk_14; + /* 0x18 */ f32 unk_18; + /* 0x1C */ u16 unk_1C; } unk_50_s; // size = 0x20 typedef struct { - /* 0x0000 */ f32 volCur; - /* 0x0004 */ f32 volTarget; - /* 0x0008 */ f32 unk_08; - /* 0x000C */ u16 unk_0C; - /* 0x000E */ u8 volScales[0x4]; - /* 0x0012 */ u8 volFadeTimer; - /* 0x0013 */ u8 fadeVolUpdate; - /* 0x0014 */ u32 unk_14; - /* 0x0018 */ u16 unk_18; - /* 0x001C */ f32 unk_1C; - /* 0x0020 */ f32 unk_20; - /* 0x0024 */ f32 unk_24; - /* 0x0028 */ u16 unk_28; - /* 0x002A */ char unk_2A[0x2]; - /* 0x002C */ u32 unk_2C[8]; - /* 0x004C */ u8 unk_4C; - /* 0x004D */ u8 unk_4D; - /* 0x004E */ u8 unk_4E; - /* 0x004F */ char unk_4F; - /* 0x0050 */ unk_50_s unk_50[0x10]; - /* 0x0250 */ u16 unk_250; - /* 0x0252 */ u16 unk_252; - /* 0x0254 */ u16 unk_254; - /* 0x0256 */ u16 unk_256; - /* 0x0258 */ u16 unk_258; - /* 0x025A */ char unk_25A[0x2]; - /* 0x025C */ u32 unk_25C; - /* 0x0260 */ u8 unk_260; - /* 0x0261 */ char unk_261[0x3]; + /* 0x000 */ f32 volCur; + /* 0x004 */ f32 volTarget; + /* 0x008 */ f32 unk_08; + /* 0x00C */ u16 unk_0C; + /* 0x00E */ u8 volScales[0x4]; + /* 0x012 */ u8 volFadeTimer; + /* 0x013 */ u8 fadeVolUpdate; + /* 0x014 */ u32 unk_14; + /* 0x018 */ u16 unk_18; + /* 0x01C */ f32 unk_1C; + /* 0x020 */ f32 unk_20; + /* 0x024 */ f32 unk_24; + /* 0x028 */ u16 unk_28; + /* 0x02A */ char unk_2A[0x2]; + /* 0x02C */ u32 unk_2C[8]; + /* 0x04C */ u8 unk_4C; + /* 0x04D */ u8 unk_4D; + /* 0x04E */ u8 unk_4E; + /* 0x04F */ char unk_4F; + /* 0x050 */ unk_50_s unk_50[0x10]; + /* 0x250 */ u16 unk_250; + /* 0x252 */ u16 unk_252; + /* 0x254 */ u16 unk_254; + /* 0x256 */ u16 unk_256; + /* 0x258 */ u16 unk_258; + /* 0x25A */ char unk_25A[0x2]; + /* 0x25C */ u32 unk_25C; + /* 0x260 */ u8 unk_260; + /* 0x261 */ char unk_261[0x3]; } unk_D_8016E750; // size = 0x264 typedef enum { diff --git a/src/code/audio_load.c b/src/code/audio_load.c index 3fa8a07882..1146c3a1ca 100644 --- a/src/code/audio_load.c +++ b/src/code/audio_load.c @@ -3,25 +3,26 @@ typedef enum { LOAD_STATUS_WAITING, LOAD_STATUS_START, LOAD_STATUS_LOADING, LOAD_STATUS_DONE } SyncLoadStatus; -#define RELOC(v, base) (reloc = (void*)((u32)v + (u32)base)) +// opaque type for unpatched audio bank data (should maybe get rid of this?) +typedef void AudioBankData; /* forward declarations */ s32 func_800E217C(s32 playerIndex, s32, s32); -unk_ldr* func_800E2454(u32 bankId); +AudioBankData* func_800E2454(u32 bankId); AudioBankSample* Audio_GetBankSample(s32 bankId, s32 sfxId); void Audio_ProcessAsyncLoads(s32 arg0); void Audio_HandleAsyncMsg(AsyncLoadReq* arg0, s32 arg1); void Audio_UpdateAsyncReq(AsyncLoadReq* arg0, s32 arg1); -void func_800E4198(s32, unk_ldr*, RelocInfo*, s32); +void func_800E4198(s32, AudioBankData*, RelocInfo*, s32); void Audio_SampleReloc(AudioBankSound* sound, u32, RelocInfo*); void func_800E202C(s32 arg0); u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2); -u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate); +void* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate); u32 Audio_GetTableIndex(s32 tableType, u32 tableIdx); void* func_800E27A4(s32 tableType, s32 id); void* Audio_GetLoadTable(s32 tableType); void Audio_DMAFastCopy(u32 devAddr, u8* addr, u32 size, s32 handleType); -void func_800E2BCC(u32 devAddr, u8* addr, u32 size, s32 handleType); +void Audio_NoopCopy(u32 devAddr, u8* addr, u32 size, s32 handleType); s32 Audio_DMA(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void* ramAddr, u32 size, OSMesgQueue* reqQueue, s32 handleType, const char* dmaFuncType); void* Audio_AsyncLoadInner(s32 tableType, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue* retQueue); @@ -38,33 +39,36 @@ void Audio_ProcessSyncLoads(s32 resetStatus); void func_800E38F8(s32 arg0, s32 arg1, s32 arg2, s32 arg3); OSMesgQueue D_8016B6E0; -u8 D_8016B6F8[0x40]; -u8* D_8016B738[0x12]; -u32 D_8016B780[8]; +OSMesg D_8016B6F8[0x10]; +s8* D_8016B738[0x12]; +s32 D_8016B780; +s32 sAudioLoadPad[4]; void func_800E11F0(void) { - s32 i; + u32 i; - for (i = 0; i < gAudioContext.unk_2624; i++) { + for (i = 0; i < gAudioContext.sampleDmaListSize1; i++) { SampleDmaReq* req = &gAudioContext.sampleDmaReqs[i]; - if (req->unk_0E != 0) { - req->unk_0E--; - if ((req->unk_0E) == 0) { - req->unk_0D = gAudioContext.unk_282E; - gAudioContext.unk_262C[gAudioContext.unk_282E] = i; - gAudioContext.unk_282E++; + + if (req->ttl != 0) { + req->ttl--; + if (req->ttl == 0) { + req->reuseIndex = gAudioContext.sampleDmaReuseQueue1WrPos; + gAudioContext.sampleDmaReuseQueue1[gAudioContext.sampleDmaReuseQueue1WrPos] = i; + gAudioContext.sampleDmaReuseQueue1WrPos++; } } } - for (i = gAudioContext.unk_2624; i < gAudioContext.sampleDmaReqCnt; i++) { + for (i = gAudioContext.sampleDmaListSize1; i < gAudioContext.sampleDmaReqCnt; i++) { SampleDmaReq* req = &gAudioContext.sampleDmaReqs[i]; - if (req->unk_0E != 0) { - req->unk_0E--; - if (req->unk_0E == 0) { - req->unk_0D = gAudioContext.unk_282F; - gAudioContext.unk_272C[gAudioContext.unk_282F] = i; - gAudioContext.unk_282F++; + + if (req->ttl != 0) { + req->ttl--; + if (req->ttl == 0) { + req->reuseIndex = gAudioContext.sampleDmaReuseQueue2WrPos; + gAudioContext.sampleDmaReuseQueue2[gAudioContext.sampleDmaReuseQueue2WrPos] = i; + gAudioContext.sampleDmaReuseQueue2WrPos++; } } } @@ -72,7 +76,102 @@ void func_800E11F0(void) { gAudioContext.unk_2628 = 0; } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_load/Audio_DmaSampleData.s") +void* Audio_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, s32 medium) { + s32 sp60; + SampleDmaReq* dma; + s32 hasDma = false; + u32 dmaDevAddr; + u32 pad; + u32 dmaIndex; + u32 transfer; + s32 bufferPos; + u32 i; + + if (arg2 != 0 || *dmaIndexRef >= gAudioContext.sampleDmaListSize1) { + for (i = gAudioContext.sampleDmaListSize1; i < gAudioContext.sampleDmaReqCnt; i++) { + dma = &gAudioContext.sampleDmaReqs[i]; + bufferPos = devAddr - dma->devAddr; + if (0 <= bufferPos && (u32)bufferPos <= dma->size - size) { + // We already have a DMA request for this memory range. + if (dma->ttl == 0 && + gAudioContext.sampleDmaReuseQueue2RdPos != gAudioContext.sampleDmaReuseQueue2WrPos) { + // Move the DMA out of the reuse queue, by swapping it with the + // read pos, and then incrementing the read pos. + if (dma->reuseIndex != gAudioContext.sampleDmaReuseQueue2RdPos) { + gAudioContext.sampleDmaReuseQueue2[dma->reuseIndex] = + gAudioContext.sampleDmaReuseQueue2[gAudioContext.sampleDmaReuseQueue2RdPos]; + gAudioContext + .sampleDmaReqs[gAudioContext.sampleDmaReuseQueue2[gAudioContext.sampleDmaReuseQueue2RdPos]] + .reuseIndex = dma->reuseIndex; + } + gAudioContext.sampleDmaReuseQueue2RdPos++; + } + dma->ttl = 32; + *dmaIndexRef = (u8)i; + return &dma->ramAddr[devAddr - dma->devAddr]; + } + } + + if (arg2 == 0) { + goto search_short_lived; + } + + if (gAudioContext.sampleDmaReuseQueue2RdPos != gAudioContext.sampleDmaReuseQueue2WrPos && arg2 != 0) { + // Allocate a DMA from reuse queue 2, unless full. + dmaIndex = gAudioContext.sampleDmaReuseQueue2[gAudioContext.sampleDmaReuseQueue2RdPos]; + gAudioContext.sampleDmaReuseQueue2RdPos++; + dma = gAudioContext.sampleDmaReqs + dmaIndex; + hasDma = true; + } + } else { + search_short_lived: + dma = gAudioContext.sampleDmaReqs + *dmaIndexRef; + i = 0; + again: + bufferPos = devAddr - dma->devAddr; + if (0 <= bufferPos && (u32)bufferPos <= dma->size - 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 + // read pos, and then incrementing the read pos. + if (dma->reuseIndex != gAudioContext.sampleDmaReuseQueue1RdPos) { + gAudioContext.sampleDmaReuseQueue1[dma->reuseIndex] = + gAudioContext.sampleDmaReuseQueue1[gAudioContext.sampleDmaReuseQueue1RdPos]; + gAudioContext + .sampleDmaReqs[gAudioContext.sampleDmaReuseQueue1[gAudioContext.sampleDmaReuseQueue1RdPos]] + .reuseIndex = dma->reuseIndex; + } + gAudioContext.sampleDmaReuseQueue1RdPos++; + } + dma->ttl = 2; + return dma->ramAddr + (devAddr - dma->devAddr); + } + dma = gAudioContext.sampleDmaReqs + i++; + if (i <= gAudioContext.sampleDmaListSize1) { + goto again; + } + } + + if (!hasDma) { + if (gAudioContext.sampleDmaReuseQueue1RdPos == gAudioContext.sampleDmaReuseQueue1WrPos) { + return NULL; + } + // Allocate a DMA from reuse queue 1. + dmaIndex = gAudioContext.sampleDmaReuseQueue1[gAudioContext.sampleDmaReuseQueue1RdPos++]; + dma = gAudioContext.sampleDmaReqs + dmaIndex; + hasDma = true; + } + + transfer = dma->size; + dmaDevAddr = devAddr & ~0xF; + dma->ttl = 3; + dma->devAddr = dmaDevAddr; + dma->sizeUnused = transfer; + Audio_DMA(&gAudioContext.currAudioFrameDmaIoMesgBufs[gAudioContext.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, + OS_READ, dmaDevAddr, dma->ramAddr, transfer, &gAudioContext.currAudioFrameDmaQueue, medium, "SUPERDMA"); + *dmaIndexRef = dmaIndex; + return (devAddr - dmaDevAddr) + dma->ramAddr; +} void func_800E1618(s32 arg0) { SampleDmaReq* temp_s0; @@ -94,25 +193,25 @@ void func_800E1618(s32 arg0) { func_800DE238(temp_s0->ramAddr, gAudioContext.unk_288C); temp_s0->size = gAudioContext.unk_288C; temp_s0->devAddr = 0; - temp_s0->unk_08 = 0; - temp_s0->unk_0C = 0; - temp_s0->unk_0E = 0; + temp_s0->sizeUnused = 0; + temp_s0->unused = 0; + temp_s0->ttl = 0; gAudioContext.sampleDmaReqCnt++; } } - for (i = 0; i < gAudioContext.sampleDmaReqCnt; i++) { - gAudioContext.unk_262C[i] = i; - gAudioContext.sampleDmaReqs[i].unk_0D = i; + for (i = 0; (u32)i < gAudioContext.sampleDmaReqCnt; i++) { + gAudioContext.sampleDmaReuseQueue1[i] = i; + gAudioContext.sampleDmaReqs[i].reuseIndex = i; } for (i = gAudioContext.sampleDmaReqCnt; i < 0x100; i++) { - gAudioContext.unk_262C[i] = 0; + gAudioContext.sampleDmaReuseQueue1[i] = 0; } - gAudioContext.unk_282C = 0; - gAudioContext.unk_282E = gAudioContext.sampleDmaReqCnt; - gAudioContext.unk_2624 = gAudioContext.sampleDmaReqCnt; + gAudioContext.sampleDmaReuseQueue1RdPos = 0; + gAudioContext.sampleDmaReuseQueue1WrPos = gAudioContext.sampleDmaReqCnt; + gAudioContext.sampleDmaListSize1 = gAudioContext.sampleDmaReqCnt; gAudioContext.unk_288C = gAudioContext.unk_2878; for (j = 0; j < gAudioContext.maxSimultaneousNotes; j++) { @@ -124,24 +223,24 @@ void func_800E1618(s32 arg0) { func_800DE238(temp_s0->ramAddr, gAudioContext.unk_288C); temp_s0->size = gAudioContext.unk_288C; temp_s0->devAddr = 0U; - temp_s0->unk_08 = 0; - temp_s0->unk_0C = 0; - temp_s0->unk_0E = 0; + temp_s0->sizeUnused = 0; + temp_s0->unused = 0; + temp_s0->ttl = 0; gAudioContext.sampleDmaReqCnt++; } } - for (i = gAudioContext.unk_2624; i < gAudioContext.sampleDmaReqCnt; i++) { - gAudioContext.unk_272C[i - gAudioContext.unk_2624] = i; - gAudioContext.sampleDmaReqs[i].unk_0D = i - gAudioContext.unk_2624; + for (i = gAudioContext.sampleDmaListSize1; (u32)i < gAudioContext.sampleDmaReqCnt; i++) { + gAudioContext.sampleDmaReuseQueue2[i - gAudioContext.sampleDmaListSize1] = i; + gAudioContext.sampleDmaReqs[i].reuseIndex = i - gAudioContext.sampleDmaListSize1; } for (i = gAudioContext.sampleDmaReqCnt; i < 0x100; i++) { - gAudioContext.unk_272C[i] = gAudioContext.unk_2624; + gAudioContext.sampleDmaReuseQueue2[i] = gAudioContext.sampleDmaListSize1; } - gAudioContext.unk_282D = 0; - gAudioContext.unk_282F = gAudioContext.sampleDmaReqCnt - gAudioContext.unk_2624; + gAudioContext.sampleDmaReuseQueue2RdPos = 0; + gAudioContext.sampleDmaReuseQueue2WrPos = gAudioContext.sampleDmaReqCnt - gAudioContext.sampleDmaListSize1; } s32 Audio_IsBankLoadComplete(s32 bankId) { @@ -223,10 +322,10 @@ void Audio_InitAudioTable(AudioTable* table, u32 romAddr, u16 arg2) { } } -unk_ldr* func_800E1B68(s32 arg0, u32* arg1) { +AudioBankData* func_800E1B68(s32 arg0, u32* arg1) { char pad[0x8]; s32 phi_s0; - unk_ldr* sp28; + AudioBankData* sp28; s32 phi_s1; s32 phi_s2; s32 i; @@ -275,7 +374,7 @@ s32 func_800E1C78(AudioBankSample* sample, s32 arg1) { } if (sample->medium == 1) { - func_800E2BCC(sample->sampleAddr, sampleAddr, sample->size, gAudioContext.audioTable->header.unk_02); + Audio_NoopCopy(sample->sampleAddr, sampleAddr, sample->size, gAudioContext.audioTable->header.unk_02); } else { Audio_DMAFastCopy(sample->sampleAddr, sampleAddr, sample->size, sample->medium); } @@ -361,7 +460,7 @@ void func_800E1F7C(s32 arg0) { } void func_800E202C(s32 arg0) { - s32 i; + u32 i; SoundMultiPool* pool = &gAudioContext.bankLoadedPool; PersistentPool* persistent; @@ -482,8 +581,8 @@ u32 func_800E2338(u32 arg0, u32* arg1, s32 arg2) { } } -unk_ldr* func_800E2454(u32 bankId) { - u8* temp_ret; +AudioBankData* func_800E2454(u32 bankId) { + AudioBankData* temp_ret; s32 unk02; s32 unk03; s32 sp38; @@ -496,22 +595,22 @@ unk_ldr* func_800E2454(u32 bankId) { unk02 = gAudioContext.ctlEntries[idx].unk_02; unk03 = gAudioContext.ctlEntries[idx].unk_03; - relocInfo.unk_00 = unk02; - relocInfo.unk_04 = unk03; - if (relocInfo.unk_00 != 0xFF) { - relocInfo.unk_08 = func_800E2338(relocInfo.unk_00, &relocInfo.unk_10, 0); + relocInfo.index1 = unk02; + relocInfo.index2 = unk03; + if (relocInfo.index1 != 0xFF) { + relocInfo.baseAddr1 = func_800E2338(relocInfo.index1, &relocInfo.medium1, 0); } else { - relocInfo.unk_08 = 0; + relocInfo.baseAddr1 = 0; } if (unk03 != 0xFF) { - relocInfo.unk_0C = func_800E2338(unk03, &relocInfo.unk_14, 0); + relocInfo.baseAddr2 = func_800E2338(unk03, &relocInfo.medium2, 0); } else { - relocInfo.unk_0C = 0; + relocInfo.baseAddr2 = 0; } temp_ret = func_800E2558(BANK_TABLE, bankId, &sp38); - if (temp_ret == 0) { + if (temp_ret == NULL) { return NULL; } if (sp38 == 1) { @@ -521,7 +620,7 @@ unk_ldr* func_800E2454(u32 bankId) { return temp_ret; } -u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate) { +void* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate) { u32 size; AudioTable* table; s32 pad; @@ -529,7 +628,7 @@ u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate) { s32 status; u32 romAddr; s32 sp24; - u8* ret; + void* ret; u32 id; id = Audio_GetTableIndex(tableType, tableIdx); @@ -574,7 +673,7 @@ u8* func_800E2558(u32 tableType, u32 tableIdx, s32* didAllocate) { *didAllocate = true; if (sp40 == 1) { - func_800E2BCC(romAddr, ret, size, (s16)table->header.unk_02); + Audio_NoopCopy(romAddr, ret, size, (s16)table->header.unk_02); } else { Audio_DMAFastCopy(romAddr, ret, size, sp40); } @@ -647,95 +746,82 @@ void* Audio_GetLoadTable(s32 tableType) { #define BASE_OFFSET(x, off) (void*)((u32)(x) + (u32)(off)) -#ifdef NON_MATCHING -void func_800E283C(s32 arg0, unk_ldr* arg1, RelocInfo* arg2) { - s32 temp_v1_3; - void* reloc; +void func_800E283C(s32 bankId, AudioBankData* mem, RelocInfo* relocInfo) { + u32 reloc; + u32 reloc2; + Instrument* inst; Drum* drum; AudioBankSound* sfx; - Instrument* inst; - Instrument** end; - Instrument** instIt; - Drum** drums; - s32 temp_a3; - s32 sp50; - s32 temp_s5; s32 i; + s32 numDrums = gAudioContext.ctlEntries[bankId].numDrums; + s32 numInstruments = gAudioContext.ctlEntries[bankId].numInstruments; + s32 numSfx = gAudioContext.ctlEntries[bankId].numSfx; + void** ptrs = (void**)mem; - temp_a3 = gAudioContext.ctlEntries[arg0].numDrums; - sp50 = gAudioContext.ctlEntries[arg0].numInstruments; - temp_s5 = gAudioContext.ctlEntries[arg0].numSfx; - - drums = arg1->drums; - if ((drums != NULL) && (temp_a3 != 0)) { - if (1) { - arg1->drums = RELOC(drums, arg1); - } - for (i = 0; i < temp_a3; i++) { - reloc = arg1->drums[i]; - if (reloc != NULL) { - arg1->drums[i] = drum = RELOC(reloc, arg1); + reloc2 = ptrs[0]; + if (1) {} + if ((reloc2 != 0) && (numDrums != 0)) { + ptrs[0] = BASE_OFFSET(reloc2, mem); + for (i = 0; i < numDrums; i++) { + reloc = ((Drum**)ptrs[0])[i]; + if (reloc != 0) { + reloc = BASE_OFFSET(reloc, mem); + ((Drum**)ptrs[0])[i] = drum = reloc; if (!drum->loaded) { - Audio_SampleReloc(&drum->sound, arg1, arg2); + Audio_SampleReloc(&drum->sound, mem, relocInfo); reloc = drum->envelope; - drum->envelope = BASE_OFFSET(reloc, arg1); + drum->envelope = BASE_OFFSET(reloc, mem); drum->loaded = 1; } } } } - if ((arg1->sfx != NULL) && (temp_s5 != 0)) { - if (1) { - arg1->sfx = RELOC(arg1->sfx, arg1); - } - for (i = 0; i < temp_s5; i++) { - sfx = &arg1->sfx[i]; - if ((sfx != NULL) && (sfx->sample != NULL)) { - Audio_SampleReloc(sfx, arg1, arg2); - } - } - } - - if (sp50 >= 0x7F) { - sp50 = 0x7E; - } - - temp_v1_3 = sp50 + 1; - if (temp_v1_3 > 1) { - instIt = arg1->instruments; - end = instIt + temp_v1_3 - 2; - do { - if (*instIt != NULL) { - inst = *instIt; - *instIt = RELOC(inst, arg1); - if (0) {} - inst = *instIt; - if (!inst->loaded) { - if (inst->normalRangeLo != 0) { - Audio_SampleReloc(&inst->lowNotesSound, arg1, arg2); - } - Audio_SampleReloc(&inst->normalNotesSound, arg1, arg2); - if (inst->normalRangeHi != 0x7F) { - Audio_SampleReloc(&inst->highNotesSound, arg1, arg2); - } - - inst->loaded = 1; - inst->envelope = RELOC(inst->envelope, arg1); + reloc2 = ptrs[1]; + if (1) {} + if ((reloc2 != 0) && (numSfx != 0)) { + ptrs[1] = BASE_OFFSET(reloc2, mem); + for (i = 0; i < numSfx; i++) { + reloc = (AudioBankSound*)ptrs[1] + i; + if (reloc != 0) { + sfx = reloc; + if (sfx->sample != NULL) { + Audio_SampleReloc(sfx, mem, relocInfo); } } - instIt++; - } while (instIt <= end); + } } - gAudioContext.ctlEntries[arg0].drums = arg1->drums; - gAudioContext.ctlEntries[arg0].soundEffects = arg1->sfx; - gAudioContext.ctlEntries[arg0].instruments = arg1->instruments; + if (numInstruments > 0x7E) { + numInstruments = 0x7E; + } + + for (i = 2; i <= 2 + numInstruments - 1; i++) { + if (ptrs[i] != NULL) { + ptrs[i] = BASE_OFFSET(ptrs[i], mem); + inst = ptrs[i]; + if (!inst->loaded) { + if (inst->normalRangeLo != 0) { + Audio_SampleReloc(&inst->lowNotesSound, mem, relocInfo); + } + Audio_SampleReloc(&inst->normalNotesSound, mem, relocInfo); + if (inst->normalRangeHi != 0x7F) { + Audio_SampleReloc(&inst->highNotesSound, mem, relocInfo); + } + + reloc = inst->envelope; + inst->envelope = BASE_OFFSET(reloc, mem); + inst->loaded = 1; + } + } + } + + gAudioContext.ctlEntries[bankId].drums = ptrs[0]; + gAudioContext.ctlEntries[bankId].soundEffects = ptrs[1]; + gAudioContext.ctlEntries[bankId].instruments = (Instrument**)(ptrs + 2); } -#else -void func_800E283C(s32 arg0, unk_ldr* arg1, RelocInfo* arg2); -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_load/func_800E283C.s") -#endif + +#undef BASE_OFFSET void Audio_DMAFastCopy(u32 devAddr, u8* addr, u32 size, s32 handleType) { OSMesgQueue* msgQueue = &gAudioContext.unk_25E8; @@ -761,7 +847,7 @@ void Audio_DMAFastCopy(u32 devAddr, u8* addr, u32 size, s32 handleType) { } } -void func_800E2BCC(u32 devAddr, u8* addr, u32 size, s32 handleType) { +void Audio_NoopCopy(u32 devAddr, u8* addr, u32 size, s32 handleType) { } s32 (*sDmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction) = osEPiStartDma; @@ -949,7 +1035,7 @@ void Audio_ContextInit(void* heap, u32 heapSize) { { s32 i; - u8* ctxP = &gAudioContext; + u8* ctxP = (u8*)&gAudioContext; for (i = sizeof(gAudioContext); i >= 0; i--) { *ctxP++ = 0; } @@ -984,10 +1070,10 @@ void Audio_ContextInit(void* heap, u32 heapSize) { gAudioContext.rspTask[0].task.t.data_size = 0; gAudioContext.rspTask[1].task.t.data_size = 0; osCreateMesgQueue(&gAudioContext.unk_25E8, &gAudioContext.unk_2600, 1); - osCreateMesgQueue(&gAudioContext.unk_1ED0, gAudioContext.unk_1EE8, 0x40); + osCreateMesgQueue(&gAudioContext.currAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBufs, 0x40); osCreateMesgQueue(&gAudioContext.unk_1E20, gAudioContext.unk_1E38, 0x10); osCreateMesgQueue(&gAudioContext.unk_1E78, gAudioContext.unk_1E90, 0x10); - gAudioContext.sampleIoReqIdx = 0; + gAudioContext.curAudioFrameDmaCount = 0; gAudioContext.sampleDmaReqCnt = 0; gAudioContext.cartHandle = osCartRomInit(); @@ -1045,7 +1131,7 @@ void Audio_SyncLoadsInit(void) { gAudioContext.syncLoads[1].status = 0; } -s32 Audio_SyncLoadSample(s32 arg0, s32 arg1, u8* isDone) { +s32 Audio_SyncLoadSample(s32 arg0, s32 arg1, s8* isDone) { AudioBankSample* sample; AudioSyncLoad* syncLoad; @@ -1193,7 +1279,7 @@ void func_800E3874(AudioSyncLoad* arg0, s32 size) { void func_800E38F8(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { } -s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, u8* isDone) { +s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, s8* isDone) { AudioSyncLoad* syncLoad; SequenceTable* seqTable; u32 size; @@ -1291,7 +1377,7 @@ AsyncLoadReq* Audio_InitAsyncReq(u32 devAddr, void* ramAddr, u32 size, s32 arg3, loadReq->unk_01 = 3; loadReq->unk_02 = arg3; loadReq->retMsg = retMsg; - osCreateMesgQueue(&loadReq->msgQueue, loadReq->msg, ARRAY_COUNT(loadReq->msg)); + osCreateMesgQueue(&loadReq->msgQueue, &loadReq->msg, 1); return loadReq; } @@ -1306,8 +1392,8 @@ void Audio_ProcessAsyncLoads(s32 resetStatus) { if (gAudioContext.curAsyncReq == NULL) { if (resetStatus != 0) { do { - } while (osRecvMesg(&gAudioContext.asyncLoadQueue, &loadReq, OS_MESG_NOBLOCK) != -1); - } else if (osRecvMesg(&gAudioContext.asyncLoadQueue, &loadReq, OS_MESG_NOBLOCK) == -1) { + } while (osRecvMesg(&gAudioContext.asyncLoadQueue, (OSMesg*)&loadReq, OS_MESG_NOBLOCK) != -1); + } else if (osRecvMesg(&gAudioContext.asyncLoadQueue, (OSMesg*)&loadReq, OS_MESG_NOBLOCK) == -1) { gAudioContext.curAsyncReq = NULL; } else { gAudioContext.curAsyncReq = loadReq; @@ -1352,10 +1438,10 @@ void Audio_AsyncReqDone(AsyncLoadReq* loadReq) { b2 = ASYNC_B2(retMsg); t1 = gAudioContext.ctlEntries[b2].unk_02; t2 = gAudioContext.ctlEntries[b2].unk_03; - sp30.unk_00 = t1; - sp30.unk_04 = t2; - sp30.unk_08 = t1 != 0xFF ? func_800E2318(t1, &sp30.unk_10) : 0; - sp30.unk_0C = t2 != 0xFF ? func_800E2318(t2, &sp30.unk_14) : 0; + sp30.index1 = t1; + sp30.index2 = t2; + sp30.baseAddr1 = t1 != 0xFF ? func_800E2318(t1, &sp30.medium1) : 0; + sp30.baseAddr2 = t2 != 0xFF ? func_800E2318(t2, &sp30.medium2) : 0; Audio_SetBankLoadStatus(b2, ASYNC_B3(retMsg)); func_800E4198(b2, loadReq->unk_04, &sp30, 1); break; @@ -1421,6 +1507,8 @@ void func_800E3FB4(AsyncLoadReq* req, u32 size) { void func_800E4044(u32 devAddr, void* ramAddr, u32 size, s16 arg3) { } +#define RELOC(v, base) (reloc = (void*)((u32)(v) + (u32)(base))) + void Audio_SampleReloc(AudioBankSound* sound, u32 arg1, RelocInfo* arg2) { AudioBankSample* sample; void* reloc; @@ -1432,12 +1520,12 @@ void Audio_SampleReloc(AudioBankSound* sound, u32 arg1, RelocInfo* arg2) { sample->book = RELOC(sample->book, arg1); switch (sample->medium) { case 0: - sample->sampleAddr = RELOC(sample->sampleAddr, arg2->unk_08); - sample->medium = arg2->unk_10; + sample->sampleAddr = RELOC(sample->sampleAddr, arg2->baseAddr1); + sample->medium = arg2->medium1; break; case 1: - sample->sampleAddr = RELOC(sample->sampleAddr, arg2->unk_0C); - sample->medium = arg2->unk_14; + sample->sampleAddr = RELOC(sample->sampleAddr, arg2->baseAddr2); + sample->medium = arg2->medium2; break; case 2: case 3: @@ -1446,13 +1534,107 @@ void Audio_SampleReloc(AudioBankSound* sound, u32 arg1, RelocInfo* arg2) { sample->unk_bits25 = 1; if (sample->unk_bits26 && (sample->medium != 0)) { - gAudioContext.unk_B68[gAudioContext.unk_1768++] = sample; + gAudioContext.unk_0B68[gAudioContext.unk_1768++] = sample; } } } } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_load/func_800E4198.s") +#undef RELOC + +void func_800E4198(s32 bankId, AudioBankData* mem, RelocInfo* relocInfo, s32 arg3) { + AudioStruct0D68* item; + AudioStruct0D68* item2; + AudioBankSample* sample; + s32 count; + s32 nChunks; + u8* addr; + s32 sp4C; + s32 i; + + sp4C = false; + if (gAudioContext.unk_176C != 0) { + sp4C = true; + } else { + D_8016B780 = 0; + } + gAudioContext.unk_1768 = 0; + func_800E283C(bankId, mem, relocInfo); + + count = 0; + for (i = 0; i < gAudioContext.unk_1768; i++) { + count += ALIGN16(gAudioContext.unk_0B68[i]->size); + } + if (count && count) {} + + for (i = 0; i < gAudioContext.unk_1768; i++) { + if (gAudioContext.unk_176C == 120) { + break; + } + + sample = gAudioContext.unk_0B68[i]; + addr = NULL; + switch (arg3) { + case 0: + if (sample->medium == relocInfo->medium1) { + addr = func_800E05C4(sample->size, relocInfo->index1, sample->sampleAddr, sample->medium, 1); + } else if (sample->medium == relocInfo->medium2) { + addr = func_800E05C4(sample->size, relocInfo->index2, sample->sampleAddr, sample->medium, 1); + } else if (sample->medium == 3) { + addr = func_800E05C4(sample->size, 0xFE, sample->sampleAddr, sample->medium, 1); + } + break; + + case 1: + if (sample->medium == relocInfo->medium1) { + addr = func_800E05C4(sample->size, relocInfo->index1, sample->sampleAddr, sample->medium, 0); + } else if (sample->medium == relocInfo->medium2) { + addr = func_800E05C4(sample->size, relocInfo->index2, sample->sampleAddr, sample->medium, 0); + } else if (sample->medium == 3) { + addr = func_800E05C4(sample->size, 0xFE, sample->sampleAddr, sample->medium, 0); + } + break; + } + if (addr == NULL) { + continue; + } + + switch (arg3) { + case 0: + if (sample->medium == 1) { + Audio_NoopCopy((u32)sample->sampleAddr, addr, sample->size, + gAudioContext.audioTable->header.unk_02); + sample->sampleAddr = addr; + sample->medium = 0; + } else { + Audio_DMAFastCopy((u32)sample->sampleAddr, addr, sample->size, sample->medium); + sample->sampleAddr = addr; + sample->medium = 0; + } + if (sample->medium == 3) {} + break; + + case 1: + item = &gAudioContext.unk_0D68[gAudioContext.unk_176C]; + item->sample = sample; + item->ramAddr = addr; + item->encodedInfo = (gAudioContext.unk_176C << 24) | 0xFFFFFF; + item->isFree = false; + item->endAndMediumKey = (u32)sample->sampleAddr + sample->size + sample->medium; + gAudioContext.unk_176C++; + break; + } + } + + gAudioContext.unk_1768 = 0; + if (gAudioContext.unk_176C != 0 && !sp4C) { + item2 = &gAudioContext.unk_0D68[gAudioContext.unk_176C - 1]; + sample = item2->sample; + nChunks = (sample->size >> 12) + 1; + Audio_InitAsyncReq((u32)sample->sampleAddr, item2->ramAddr, sample->size, sample->medium, nChunks, + &gAudioContext.unk_1E78, item2->encodedInfo); + } +} s32 func_800E4590(s32 resetStatus) { AudioBankSample* sample; @@ -1564,13 +1746,139 @@ void func_800E48C0(AudioBankSound* sound) { AudioBankSample* sample = sound->sample; if ((sample->size != 0) && (sample->unk_bits26) && (sample->medium)) { - gAudioContext.unk_B68[gAudioContext.unk_1768++] = sample; + gAudioContext.unk_0B68[gAudioContext.unk_1768++] = sample; } } -// large -void func_800E4918(s32, s32, RelocInfo*); -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_load/func_800E4918.s") +void func_800E4918(s32 bankId, s32 arg1, RelocInfo* relocInfo) { + s32 numDrums; + s32 numInstruments; + s32 numSfx; + Drum* drum; + Instrument* instrument; + AudioBankSound* sound; + AudioStruct0D68* item; + AudioStruct0D68* item2; + u8* addr; + s32 count; + s32 i; + AudioBankSample* sample; + s32 sp44; + s32 nChunks; + + sp44 = false; + if (gAudioContext.unk_176C != 0) { + sp44 = true; + } + gAudioContext.unk_1768 = 0; + + numDrums = gAudioContext.ctlEntries[bankId].numDrums; + numInstruments = gAudioContext.ctlEntries[bankId].numInstruments; + numSfx = gAudioContext.ctlEntries[bankId].numSfx; + + for (i = 0; i < numInstruments; i++) { + instrument = Audio_GetInstrumentInner(bankId, i); + if (instrument != NULL) { + if (instrument->normalRangeLo != 0) { + func_800E48C0(&instrument->lowNotesSound); + } + if (instrument->normalRangeHi != 0x7F) { + func_800E48C0(&instrument->highNotesSound); + } + func_800E48C0(&instrument->normalNotesSound); + } + } + + for (i = 0; i < numDrums; i++) { + drum = Audio_GetDrum(bankId, i); + if (drum != NULL) { + func_800E48C0(&drum->sound); + } + } + + for (i = 0; i < numSfx; i++) { + sound = Audio_GetSfx(bankId, i); + if (sound != NULL) { + func_800E48C0(sound); + } + } + + if (gAudioContext.unk_1768 == 0) { + return; + } + + count = 0; + for (i = 0; i < gAudioContext.unk_1768; i++) { + count += ALIGN16(gAudioContext.unk_0B68[i]->size); + } + if (count) {} + + for (i = 0; i < gAudioContext.unk_1768; i++) { + if (gAudioContext.unk_176C == 120) { + break; + } + + sample = gAudioContext.unk_0B68[i]; + if (sample->medium == 0) { + continue; + } + + switch (arg1) { + case 0: + if (sample->medium == relocInfo->medium1) { + addr = func_800E05C4(sample->size, relocInfo->index1, sample->sampleAddr, sample->medium, 1); + } else if (sample->medium == relocInfo->medium2) { + addr = func_800E05C4(sample->size, relocInfo->index2, sample->sampleAddr, sample->medium, 1); + } + break; + + case 1: + if (sample->medium == relocInfo->medium1) { + addr = func_800E05C4(sample->size, relocInfo->index1, sample->sampleAddr, sample->medium, 0); + } else if (sample->medium == relocInfo->medium2) { + addr = func_800E05C4(sample->size, relocInfo->index2, sample->sampleAddr, sample->medium, 0); + } + break; + } + if (addr == NULL) { + continue; + } + + switch (arg1) { + case 0: + if (sample->medium == 1) { + Audio_NoopCopy((u32)sample->sampleAddr, addr, sample->size, + gAudioContext.audioTable->header.unk_02); + sample->sampleAddr = addr; + sample->medium = 0; + } else { + Audio_DMAFastCopy((u32)sample->sampleAddr, addr, sample->size, sample->medium); + sample->sampleAddr = addr; + sample->medium = 0; + } + break; + + case 1: + item = &gAudioContext.unk_0D68[gAudioContext.unk_176C]; + item->sample = sample; + item->ramAddr = addr; + item->encodedInfo = (gAudioContext.unk_176C << 24) | 0xFFFFFF; + item->isFree = false; + item->endAndMediumKey = (u32)sample->sampleAddr + sample->size + sample->medium; + gAudioContext.unk_176C++; + break; + } + } + + gAudioContext.unk_1768 = 0; + if (gAudioContext.unk_176C != 0 && !sp44) { + item2 = &gAudioContext.unk_0D68[gAudioContext.unk_176C - 1]; + sample = item2->sample; + nChunks = (sample->size >> 12) + 1; + Audio_InitAsyncReq((u32)sample->sampleAddr, item2->ramAddr, sample->size, sample->medium, nChunks, + &gAudioContext.unk_1E78, item2->encodedInfo); + } +} void func_800E4D94(void) { s32 pad; @@ -1584,17 +1892,17 @@ void func_800E4D94(void) { RelocInfo sp4C; if (gAudioContext.unk_2D60[i].poolIndex == 1) { temp_s2 = Audio_GetTableIndex(BANK_TABLE, gAudioContext.unk_2D60[i].id); - sp4C.unk_00 = gAudioContext.ctlEntries[temp_s2].unk_02; - sp4C.unk_04 = gAudioContext.ctlEntries[temp_s2].unk_03; + sp4C.index1 = gAudioContext.ctlEntries[temp_s2].unk_02; + sp4C.index2 = gAudioContext.ctlEntries[temp_s2].unk_03; - if (sp4C.unk_00 != 0xFF) { - sp4C.unk_00 = Audio_GetTableIndex(AUDIO_TABLE, sp4C.unk_00); - sp4C.unk_10 = audioTable->entries[sp4C.unk_00].unk_08; + if (sp4C.index1 != 0xFF) { + sp4C.index1 = Audio_GetTableIndex(AUDIO_TABLE, sp4C.index1); + sp4C.medium1 = audioTable->entries[sp4C.index1].unk_08; } - if (sp4C.unk_04 != 0xFF) { - sp4C.unk_04 = Audio_GetTableIndex(AUDIO_TABLE, sp4C.unk_04); - sp4C.unk_14 = audioTable->entries[sp4C.unk_04].unk_08; + if (sp4C.index2 != 0xFF) { + sp4C.index2 = Audio_GetTableIndex(AUDIO_TABLE, sp4C.index2); + sp4C.medium2 = audioTable->entries[sp4C.index2].unk_08; } func_800E4918(temp_s2, 0, &sp4C); } @@ -1610,7 +1918,7 @@ void func_800E4EDC(void) { void func_800E4EE4(void) { } -void func_800E4EEC(s32 tableType, s32 arg1, u8* arg2) { +void func_800E4EEC(s32 tableType, s32 arg1, s8* arg2) { static u32 D_801304DC = 0; D_8016B738[D_801304DC] = arg2; Audio_AsyncLoad(tableType, arg1, 0, D_801304DC, &D_8016B6E0); @@ -1623,10 +1931,10 @@ void func_800E4EEC(s32 tableType, s32 arg1, u8* arg2) { void func_800E4F58(void) { u32 pad; u32 sp20; - u8* temp_v0; + s8* temp_v0; - if (osRecvMesg(&D_8016B6E0, &sp20, OS_MESG_NOBLOCK) != -1) { - pad = sp20 >> 0x18; + if (osRecvMesg(&D_8016B6E0, (OSMesg*)&sp20, OS_MESG_NOBLOCK) != -1) { + pad = sp20 >> 24; temp_v0 = D_8016B738[pad]; if (temp_v0 != NULL) { *temp_v0 = 0; @@ -1635,5 +1943,5 @@ void func_800E4F58(void) { } void func_800E4FB0(void) { - osCreateMesgQueue(&D_8016B6E0, &D_8016B6F8, 0x10); + osCreateMesgQueue(&D_8016B6E0, D_8016B6F8, 0x10); } diff --git a/src/code/code_800E4FE0.c b/src/code/code_800E4FE0.c index 1c7b6da2ce..e187df9614 100644 --- a/src/code/code_800E4FE0.c +++ b/src/code/code_800E4FE0.c @@ -86,27 +86,27 @@ AudioTask* func_800E5000(void) { D_801755D0(); } - sp5C = gAudioContext.sampleIoReqIdx; - for (i = 0; i < gAudioContext.sampleIoReqIdx; i++) { - if (osRecvMesg(&gAudioContext.unk_1ED0, NULL, OS_MESG_NOBLOCK) == 0) { + sp5C = gAudioContext.curAudioFrameDmaCount; + for (i = 0; i < gAudioContext.curAudioFrameDmaCount; i++) { + if (osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) { sp5C--; } } if (sp5C != 0) { for (i = 0; i < sp5C; i++) { - osRecvMesg(&gAudioContext.unk_1ED0, NULL, OS_MESG_BLOCK); + osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK); } } - sp48 = gAudioContext.unk_1ED0.validCount; + sp48 = gAudioContext.currAudioFrameDmaQueue.validCount; if (sp48 != 0) { for (i = 0; i < sp48; i++) { - osRecvMesg(&gAudioContext.unk_1ED0, NULL, OS_MESG_NOBLOCK); + osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK); } } - gAudioContext.sampleIoReqIdx = 0; + gAudioContext.curAudioFrameDmaCount = 0; func_800E11F0(); Audio_ProcessLoads(gAudioContext.resetStatus); func_800E4F58();