From afa5d2394c4caaaec2e2df820c0d03ba6924458e Mon Sep 17 00:00:00 2001 From: Mittenz Date: Tue, 18 Aug 2020 00:33:11 -0500 Subject: [PATCH] c: alSeqpGetChlFXMix, alCSPGetChlVol --- .../unknown_001050/func_80001D04.s | 8 +- .../unknown_001050/func_80002224.s | 4 +- .../unknown_001050/func_8000232C.s | 4 +- .../unknown_003260/_handleEvent.s | 16 ++-- .../unknown_032760/func_8003FD68.s | 2 +- .../unknown_080500/MenuAudioOptionsLoop.s | 4 +- data/dkr.data.s | 4 +- .../unknown_0C85A0/alCSPGetChlVol.s | 11 --- .../unknown_0C85C0/alSeqpGetChlFXMix.s | 11 --- lib/src/alCSPGetChlVol.c | 10 +++ lib/src/alSeqpGetChlFXMix.c | 9 ++ lib/src/unknown_0C84E0.c | 16 ++++ lib/src/unknown_0C85A0.c | 7 -- lib/src/unknown_0C85C0.c | 7 -- src/unknown_001050.c | 87 +++++++++---------- src/unknown_003260.c | 33 +++++-- src/unknown_080500.c | 6 +- undefined_syms.txt | 10 +-- 18 files changed, 130 insertions(+), 119 deletions(-) delete mode 100644 lib/asm/non_matchings/unknown_0C85A0/alCSPGetChlVol.s delete mode 100644 lib/asm/non_matchings/unknown_0C85C0/alSeqpGetChlFXMix.s create mode 100644 lib/src/alCSPGetChlVol.c create mode 100644 lib/src/alSeqpGetChlFXMix.c delete mode 100644 lib/src/unknown_0C85A0.c delete mode 100644 lib/src/unknown_0C85C0.c diff --git a/asm/non_matchings/unknown_001050/func_80001D04.s b/asm/non_matchings/unknown_001050/func_80001D04.s index 8ad2e7dd..0ac3fabe 100644 --- a/asm/non_matchings/unknown_001050/func_80001D04.s +++ b/asm/non_matchings/unknown_001050/func_80001D04.s @@ -43,12 +43,12 @@ glabel func_80001D04 /* 00299C 80001D9C 00032C00 */ sll $a1, $v1, 0x10 /* 0029A0 80001DA0 460A3403 */ div.s $f16, $f6, $f10 /* 0029A4 80001DA4 00057C03 */ sra $t7, $a1, 0x10 -/* 0029A8 80001DA8 3C098011 */ lui $t1, %hi(D_80115D14) # $t1, 0x8011 +/* 0029A8 80001DA8 3C098011 */ lui $t1, %hi(ALBankFile_80115D14) # $t1, 0x8011 /* 0029AC 80001DAC 01E02825 */ move $a1, $t7 -/* 0029B0 80001DB0 3C0E8011 */ lui $t6, %hi(D_80115D14) # $t6, 0x8011 +/* 0029B0 80001DB0 3C0E8011 */ lui $t6, %hi(ALBankFile_80115D14) # $t6, 0x8011 /* 0029B4 80001DB4 10E0001F */ beqz $a3, .L80001E34 /* 0029B8 80001DB8 E7B00024 */ swc1 $f16, 0x24($sp) -/* 0029BC 80001DBC 8D295D14 */ lw $t1, %lo(D_80115D14)($t1) +/* 0029BC 80001DBC 8D295D14 */ lw $t1, %lo(ALBankFile_80115D14)($t1) /* 0029C0 80001DC0 00032C00 */ sll $a1, $v1, 0x10 /* 0029C4 80001DC4 90460008 */ lbu $a2, 8($v0) /* 0029C8 80001DC8 8D240004 */ lw $a0, 4($t1) @@ -79,7 +79,7 @@ glabel func_80001D04 /* 002A2C 80001E2C 1000001B */ b .L80001E9C /* 002A30 80001E30 8FBF0014 */ lw $ra, 0x14($sp) .L80001E34: -/* 002A34 80001E34 8DCE5D14 */ lw $t6, %lo(D_80115D14)($t6) +/* 002A34 80001E34 8DCE5D14 */ lw $t6, %lo(ALBankFile_80115D14)($t6) /* 002A38 80001E38 90460008 */ lbu $a2, 8($v0) /* 002A3C 80001E3C 3C078011 */ lui $a3, %hi(D_80115F80) # $a3, 0x8011 /* 002A40 80001E40 8DC40004 */ lw $a0, 4($t6) diff --git a/asm/non_matchings/unknown_001050/func_80002224.s b/asm/non_matchings/unknown_001050/func_80002224.s index 9056dcc3..07cc430d 100644 --- a/asm/non_matchings/unknown_001050/func_80002224.s +++ b/asm/non_matchings/unknown_001050/func_80002224.s @@ -24,8 +24,8 @@ glabel func_80002224 /* 002E7C 8000227C 00402025 */ move $a0, $v0 /* 002E80 80002280 0C0188A4 */ jal alCSPNew /* 002E84 80002284 27A50024 */ addiu $a1, $sp, 0x24 -/* 002E88 80002288 3C088011 */ lui $t0, %hi(D_80115D10) # $t0, 0x8011 -/* 002E8C 8000228C 8D085D10 */ lw $t0, %lo(D_80115D10)($t0) +/* 002E88 80002288 3C088011 */ lui $t0, %hi(ALBankFile_80115D10) # $t0, 0x8011 +/* 002E8C 8000228C 8D085D10 */ lw $t0, %lo(ALBankFile_80115D10)($t0) /* 002E90 80002290 8FA40044 */ lw $a0, 0x44($sp) /* 002E94 80002294 8D050004 */ lw $a1, 4($t0) /* 002E98 80002298 0C031E98 */ jal alCSPSetBank diff --git a/asm/non_matchings/unknown_001050/func_8000232C.s b/asm/non_matchings/unknown_001050/func_8000232C.s index bde3359a..2d94b554 100644 --- a/asm/non_matchings/unknown_001050/func_8000232C.s +++ b/asm/non_matchings/unknown_001050/func_8000232C.s @@ -19,8 +19,8 @@ glabel func_8000232C /* 002F70 80002370 0C01DBBA */ jal func_80076EE8 /* 002F74 80002374 00002825 */ move $a1, $zero /* 002F78 80002378 92630000 */ lbu $v1, ($s3) -/* 002F7C 8000237C 3C0F8011 */ lui $t7, %hi(D_80115CF8) # $t7, 0x8011 -/* 002F80 80002380 8DEF5CF8 */ lw $t7, %lo(D_80115CF8)($t7) +/* 002F7C 8000237C 3C0F8011 */ lui $t7, %hi(ALSeqFile_80115CF8) # $t7, 0x8011 +/* 002F80 80002380 8DEF5CF8 */ lw $t7, %lo(ALSeqFile_80115CF8)($t7) /* 002F84 80002384 3C098011 */ lui $t1, %hi(D_80115D0C) # $t1, 0x8011 /* 002F88 80002388 8D295D0C */ lw $t1, %lo(D_80115D0C)($t1) /* 002F8C 8000238C 0003C0C0 */ sll $t8, $v1, 3 diff --git a/asm/non_matchings/unknown_003260/_handleEvent.s b/asm/non_matchings/unknown_003260/_handleEvent.s index 6a4c76b0..8e5452e6 100644 --- a/asm/non_matchings/unknown_003260/_handleEvent.s +++ b/asm/non_matchings/unknown_003260/_handleEvent.s @@ -243,7 +243,7 @@ glabel _handleEvent /* 0043EC 800037EC 0018C840 */ sll $t9, $t8, 1 /* 0043F0 800037F0 01D94021 */ addu $t0, $t6, $t9 /* 0043F4 800037F4 85090000 */ lh $t1, ($t0) -/* 0043F8 800037F8 3C19800E */ lui $t9, %hi(D_800DC6C0) # $t9, 0x800e +/* 0043F8 800037F8 3C19800E */ lui $t9, %hi(sfxVolumeSlider) # $t9, 0x800e /* 0043FC 800037FC 46105483 */ div.s $f18, $f10, $f16 /* 004400 80003800 00006012 */ mflo $t4 /* 004404 80003804 444DF800 */ cfc1 $t5, $31 @@ -277,7 +277,7 @@ glabel _handleEvent /* 004474 80003874 10000001 */ b .L8000387C /* 004478 80003878 00001025 */ move $v0, $zero .L8000387C: -/* 00447C 8000387C 8F39C6C0 */ lw $t9, %lo(D_800DC6C0)($t9) +/* 00447C 8000387C 8F39C6C0 */ lw $t9, %lo(sfxVolumeSlider)($t9) /* 004480 80003880 8EE40038 */ lw $a0, 0x38($s7) /* 004484 80003884 00590019 */ multu $v0, $t9 /* 004488 80003888 02602825 */ move $a1, $s3 @@ -585,7 +585,7 @@ glabel _handleEvent /* 0048CC 80003CCC 00000000 */ nop /* 0048D0 80003CD0 032C5821 */ addu $t3, $t9, $t4 /* 0048D4 80003CD4 856F0000 */ lh $t7, ($t3) -/* 0048D8 80003CD8 3C0B800E */ lui $t3, %hi(D_800DC6C0) # $t3, 0x800e +/* 0048D8 80003CD8 3C0B800E */ lui $t3, %hi(sfxVolumeSlider) # $t3, 0x800e /* 0048DC 80003CDC 00007012 */ mflo $t6 /* 0048E0 80003CE0 00000000 */ nop /* 0048E4 80003CE4 00000000 */ nop @@ -610,7 +610,7 @@ glabel _handleEvent /* 004930 80003D30 10000001 */ b .L80003D38 /* 004934 80003D34 00001025 */ move $v0, $zero .L80003D38: -/* 004938 80003D38 8D6BC6C0 */ lw $t3, %lo(D_800DC6C0)($t3) +/* 004938 80003D38 8D6BC6C0 */ lw $t3, %lo(sfxVolumeSlider)($t3) /* 00493C 80003D3C 8EE40038 */ lw $a0, 0x38($s7) /* 004940 80003D40 004B0019 */ multu $v0, $t3 /* 004944 80003D44 2625000C */ addiu $a1, $s1, 0xc @@ -649,7 +649,7 @@ glabel _handleEvent /* 0049C0 80003DC0 000C5840 */ sll $t3, $t4, 1 /* 0049C4 80003DC4 01EB6821 */ addu $t5, $t7, $t3 /* 0049C8 80003DC8 85A90000 */ lh $t1, ($t5) -/* 0049CC 80003DCC 3C0B800E */ lui $t3, %hi(D_800DC6C0) # $t3, 0x800e +/* 0049CC 80003DCC 3C0B800E */ lui $t3, %hi(sfxVolumeSlider) # $t3, 0x800e /* 0049D0 80003DD0 46083283 */ div.s $f10, $f6, $f8 /* 0049D4 80003DD4 00004012 */ mflo $t0 /* 0049D8 80003DD8 444AF800 */ cfc1 $t2, $31 @@ -683,7 +683,7 @@ glabel _handleEvent /* 004A48 80003E48 10000001 */ b .L80003E50 /* 004A4C 80003E4C 00001025 */ move $v0, $zero .L80003E50: -/* 004A50 80003E50 8D6BC6C0 */ lw $t3, %lo(D_800DC6C0)($t3) +/* 004A50 80003E50 8D6BC6C0 */ lw $t3, %lo(sfxVolumeSlider)($t3) /* 004A54 80003E54 8EE40038 */ lw $a0, 0x38($s7) /* 004A58 80003E58 004B0019 */ multu $v0, $t3 /* 004A5C 80003E5C 2625000C */ addiu $a1, $s1, 0xc @@ -748,8 +748,8 @@ glabel _handleEvent /* 004B3C 80003F3C 448D9000 */ mtc1 $t5, $f18 /* 004B40 80003F40 C62A002C */ lwc1 $f10, 0x2c($s1) /* 004B44 80003F44 46809120 */ cvt.s.w $f4, $f18 -/* 004B48 80003F48 3C0C800E */ lui $t4, %hi(D_800DC6C0) # $t4, 0x800e -/* 004B4C 80003F4C 8D8CC6C0 */ lw $t4, %lo(D_800DC6C0)($t4) +/* 004B48 80003F48 3C0C800E */ lui $t4, %hi(sfxVolumeSlider) # $t4, 0x800e +/* 004B4C 80003F4C 8D8CC6C0 */ lw $t4, %lo(sfxVolumeSlider)($t4) /* 004B50 80003F50 46062203 */ div.s $f8, $f4, $f6 /* 004B54 80003F54 004C0019 */ multu $v0, $t4 /* 004B58 80003F58 8EE40038 */ lw $a0, 0x38($s7) diff --git a/asm/non_matchings/unknown_032760/func_8003FD68.s b/asm/non_matchings/unknown_032760/func_8003FD68.s index 95c763a7..d01a539b 100644 --- a/asm/non_matchings/unknown_032760/func_8003FD68.s +++ b/asm/non_matchings/unknown_032760/func_8003FD68.s @@ -25,7 +25,7 @@ glabel func_8003FD68 /* 0409C4 8003FDC4 90AB0010 */ lbu $t3, 0x10($a1) /* 0409C8 8003FDC8 AC600008 */ sw $zero, 8($v1) /* 0409CC 8003FDCC A06B000D */ sb $t3, 0xd($v1) -/* 0409D0 8003FDD0 0C00086C */ jal func_800021B0 +/* 0409D0 8003FDD0 0C00086C */ jal ALBankFile_80115D14_GetSoundDecayTime /* 0409D4 8003FDD4 AFA30044 */ sw $v1, 0x44($sp) /* 0409D8 8003FDD8 8FA30044 */ lw $v1, 0x44($sp) /* 0409DC 8003FDDC 10400021 */ beqz $v0, .L8003FE64 diff --git a/asm/non_matchings/unknown_080500/MenuAudioOptionsLoop.s b/asm/non_matchings/unknown_080500/MenuAudioOptionsLoop.s index f5921d81..2025bb1b 100644 --- a/asm/non_matchings/unknown_080500/MenuAudioOptionsLoop.s +++ b/asm/non_matchings/unknown_080500/MenuAudioOptionsLoop.s @@ -218,7 +218,7 @@ glabel MenuAudioOptionsLoop /* 085B84 80084F84 24020100 */ li $v0, 256 /* 085B88 80084F88 AC620000 */ sw $v0, ($v1) .L80084F8C: -/* 085B8C 80084F8C 0C000C58 */ jal func_80003160 +/* 085B8C 80084F8C 0C000C58 */ jal sfxSetVolumeSlider /* 085B90 80084F90 00402025 */ move $a0, $v0 /* 085B94 80084F94 1000005A */ b .L80085100 /* 085B98 80084F98 00000000 */ nop @@ -294,7 +294,7 @@ glabel MenuAudioOptionsLoop /* 085C98 80085098 3C10800E */ lui $s0, %hi(D_800DFABC) # $s0, 0x800e /* 085C9C 8008509C 1900000C */ blez $t0, .L800850D0 /* 085CA0 800850A0 2610FABC */ addiu $s0, %lo(D_800DFABC) # addiu $s0, $s0, -0x544 -/* 085CA4 800850A4 0C000844 */ jal func_80002110 +/* 085CA4 800850A4 0C000844 */ jal ALSeqFile_80115CF8_GetSeqCount /* 085CA8 800850A8 AFA40028 */ sw $a0, 0x28($sp) /* 085CAC 800850AC 8E030000 */ lw $v1, ($s0) /* 085CB0 800850B0 2459FFFF */ addiu $t9, $v0, -1 diff --git a/data/dkr.data.s b/data/dkr.data.s index 0d66d672..600a36fc 100644 --- a/data/dkr.data.s +++ b/data/dkr.data.s @@ -15,7 +15,7 @@ glabel gSndFxPlayer glabel musicRelativeVolume .word 0x7F000000 -glabel D_800DC63C +glabel sfxRelativeVolume .word 0x7F000000 glabel D_800DC640 @@ -98,7 +98,7 @@ glabel D_800DC6B8 glabel D_800DC6BC .word 0x80119BD0 -glabel D_800DC6C0 +glabel sfxVolumeSlider .word 0x00000100 glabel D_800DC6C4 diff --git a/lib/asm/non_matchings/unknown_0C85A0/alCSPGetChlVol.s b/lib/asm/non_matchings/unknown_0C85A0/alCSPGetChlVol.s deleted file mode 100644 index fdfbd684..00000000 --- a/lib/asm/non_matchings/unknown_0C85A0/alCSPGetChlVol.s +++ /dev/null @@ -1,11 +0,0 @@ -glabel alCSPGetChlVol -/* 0C85A0 800C79A0 AFA50004 */ sw $a1, 4($sp) -/* 0C85A4 800C79A4 8C8F0060 */ lw $t7, 0x60($a0) -/* 0C85A8 800C79A8 30AE00FF */ andi $t6, $a1, 0xff -/* 0C85AC 800C79AC 000EC100 */ sll $t8, $t6, 4 -/* 0C85B0 800C79B0 01F8C821 */ addu $t9, $t7, $t8 -/* 0C85B4 800C79B4 03E00008 */ jr $ra -/* 0C85B8 800C79B8 93220009 */ lbu $v0, 9($t9) - -/* 0C85BC 800C79BC 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0C85C0/alSeqpGetChlFXMix.s b/lib/asm/non_matchings/unknown_0C85C0/alSeqpGetChlFXMix.s deleted file mode 100644 index c53c163d..00000000 --- a/lib/asm/non_matchings/unknown_0C85C0/alSeqpGetChlFXMix.s +++ /dev/null @@ -1,11 +0,0 @@ -glabel alSeqpGetChlFXMix -/* 0C85C0 800C79C0 AFA50004 */ sw $a1, 4($sp) -/* 0C85C4 800C79C4 8C8F0060 */ lw $t7, 0x60($a0) -/* 0C85C8 800C79C8 30AE00FF */ andi $t6, $a1, 0xff -/* 0C85CC 800C79CC 000EC100 */ sll $t8, $t6, 4 -/* 0C85D0 800C79D0 01F8C821 */ addu $t9, $t7, $t8 -/* 0C85D4 800C79D4 03E00008 */ jr $ra -/* 0C85D8 800C79D8 9322000A */ lbu $v0, 0xa($t9) - -/* 0C85DC 800C79DC 00000000 */ nop - diff --git a/lib/src/alCSPGetChlVol.c b/lib/src/alCSPGetChlVol.c new file mode 100644 index 00000000..33677763 --- /dev/null +++ b/lib/src/alCSPGetChlVol.c @@ -0,0 +1,10 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C79A0 */ + + +#include "audio_internal.h" + +u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan) +{ + return seqp->chanState[chan].vol; +} \ No newline at end of file diff --git a/lib/src/alSeqpGetChlFXMix.c b/lib/src/alSeqpGetChlFXMix.c new file mode 100644 index 00000000..10803bce --- /dev/null +++ b/lib/src/alSeqpGetChlFXMix.c @@ -0,0 +1,9 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C79C0 */ + +#include "audio_internal.h" + +u8 alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 chan) +{ + return seqp->chanState[chan].fxmix; +} \ No newline at end of file diff --git a/lib/src/unknown_0C84E0.c b/lib/src/unknown_0C84E0.c index 39c89eae..6c5b05e9 100644 --- a/lib/src/unknown_0C84E0.c +++ b/lib/src/unknown_0C84E0.c @@ -3,5 +3,21 @@ #include "types.h" #include "macros.h" +#include "audio_internal.h" +#if 1 GLOBAL_ASM("lib/asm/non_matchings/unknown_0C84E0/alCSPSetChlPan.s") +#else +void alCSPSetChlPan(ALCSPlayer *seqp, u8 chan, ALPan pan) +{ + ALEvent evt; + + evt.type = AL_SEQP_MIDI_EVT; + evt.msg.midi.ticks = 0; + evt.msg.midi.status = AL_MIDI_ControlChange | chan; + evt.msg.midi.byte1 = AL_MIDI_PAN_CTRL; + evt.msg.midi.byte2 = pan; + + alEvtqPostEvent(&seqp->evtq, &evt, 0); +} +#endif \ No newline at end of file diff --git a/lib/src/unknown_0C85A0.c b/lib/src/unknown_0C85A0.c deleted file mode 100644 index 6487e03b..00000000 --- a/lib/src/unknown_0C85A0.c +++ /dev/null @@ -1,7 +0,0 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800C79A0 */ - -#include "types.h" -#include "macros.h" - -GLOBAL_ASM("lib/asm/non_matchings/unknown_0C85A0/alCSPGetChlVol.s") diff --git a/lib/src/unknown_0C85C0.c b/lib/src/unknown_0C85C0.c deleted file mode 100644 index 325344aa..00000000 --- a/lib/src/unknown_0C85C0.c +++ /dev/null @@ -1,7 +0,0 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800C79C0 */ - -#include "types.h" -#include "macros.h" - -GLOBAL_ASM("lib/asm/non_matchings/unknown_0C85C0/alSeqpGetChlFXMix.s") diff --git a/src/unknown_001050.c b/src/unknown_001050.c index 971f5a01..31a9ea7a 100644 --- a/src/unknown_001050.c +++ b/src/unknown_001050.c @@ -14,18 +14,11 @@ typedef struct unk80115D48 { /* 0x04 */ s32 unk4; } unk80115D48; -/* Unknown size */ -typedef struct unk800DC630 { - u8 pad0[0x2C]; - s32 unk2C; - u16 unk30; -} unk800DC630; - extern ALCSPlayer* gMusicPlayer; extern ALCSPlayer* gSndFxPlayer; extern u8 musicRelativeVolume; -extern u8 D_800DC63C; +extern u8 sfxRelativeVolume; extern u8 D_800DC640; extern u8 D_800DC644; extern s32 D_800DC648; @@ -50,16 +43,16 @@ typedef struct unk80115CF8 { s16 unk2; } unk80115CF8; -extern ALSeqFile *D_80115CF8; +extern ALSeqFile *ALSeqFile_80115CF8; extern void *D_80115CFC; extern u8 D_80115D04; extern u8 D_80115D05; extern s32 musicTempo; -extern ALBankFile *D_80115D10; +extern ALBankFile *ALBankFile_80115D10; -extern ALBankFile *D_80115D14; +extern ALBankFile *ALBankFile_80115D14; /* Size: 0x0A bytes */ typedef struct unk80115D18 { @@ -127,11 +120,11 @@ void audio_init(u32 arg0){ alHeapInit(&gALHeap, &D_800EBF60, 0x00029D88); reg_s2 = func_80076C58(38); - D_80115D14 = (ALBankFile*) func_80070C9C(reg_s2[2] - reg_s2[1], 0x00FFFFFF); - func_80076E68(39, D_80115D14, reg_s2[1], reg_s2[2] - reg_s2[1]); - alBnkfNew(D_80115D14, func_80076EE8(39, reg_s2[2])); - D_80115D28 = reg_s2[7] - reg_s2[6]; + ALBankFile_80115D14 = (ALBankFile*) func_80070C9C(reg_s2[2] - reg_s2[1], 0x00FFFFFF); + func_80076E68(39, ALBankFile_80115D14, reg_s2[1], reg_s2[2] - reg_s2[1]); + alBnkfNew(ALBankFile_80115D14, func_80076EE8(39, reg_s2[2])); + D_80115D28 = reg_s2[7] - reg_s2[6]; D_80115D18 = (unk80115D18 *) func_80070C9C(D_80115D28, 0x00FFFFFF); func_80076E68(39, D_80115D18, reg_s2[6], D_80115D28); D_80115D20 = D_80115D28/10; @@ -141,22 +134,22 @@ void audio_init(u32 arg0){ func_80076E68(39, D_80115D1C, reg_s2[5], D_80115D2C); D_80115D24 = D_80115D2C/3; - D_80115D10 = (ALBankFile *)func_80070C9C(reg_s2[0], 0x00FFFFFF); - func_80076E68(39, D_80115D10, 0, reg_s2[0]); - alBnkfNew(D_80115D10, func_80076EE8(39, reg_s2[0])); - D_80115CF8 = (ALSeqFile *) alHeapDBAlloc(0,0,&gALHeap,1,4); - func_80076E68(39, D_80115CF8, reg_s2[4], 4); + ALBankFile_80115D10 = (ALBankFile *)func_80070C9C(reg_s2[0], 0x00FFFFFF); + func_80076E68(39, ALBankFile_80115D10, 0, reg_s2[0]); + alBnkfNew(ALBankFile_80115D10, func_80076EE8(39, reg_s2[0])); + ALSeqFile_80115CF8 = (ALSeqFile *) alHeapDBAlloc(0,0,&gALHeap,1,4); + func_80076E68(39, ALSeqFile_80115CF8, reg_s2[4], 4); - seqfSize = (D_80115CF8->seqCount)*8 + 4; - D_80115CF8 = func_80070C9C(seqfSize, 0x00FFFFFF); - func_80076E68(39, D_80115CF8, reg_s2[4], seqfSize); - alSeqFileNew(D_80115CF8, func_80076EE8(39, reg_s2[4])); - D_80115D0C = (u32 *)func_80070C9C( (D_80115CF8->seqCount)*4, 0x00FFFFFF); + seqfSize = (ALSeqFile_80115CF8->seqCount)*8 + 4; + ALSeqFile_80115CF8 = func_80070C9C(seqfSize, 0x00FFFFFF); + func_80076E68(39, ALSeqFile_80115CF8, reg_s2[4], seqfSize); + alSeqFileNew(ALSeqFile_80115CF8, func_80076EE8(39, reg_s2[4])); + D_80115D0C = (u32 *)func_80070C9C( (ALSeqFile_80115CF8->seqCount)*4, 0x00FFFFFF); - for(iCnt = 0; iCnt < D_80115CF8->seqCount; iCnt++){ - (u32*)((u32) D_80115CF8 + 8 + iCnt*8); - D_80115D0C[iCnt] = D_80115CF8->seqArray[iCnt].len; + for(iCnt = 0; iCnt < ALSeqFile_80115CF8->seqCount; iCnt++){ + (u32*)((u32) ALSeqFile_80115CF8 + 8 + iCnt*8); + D_80115D0C[iCnt] = ALSeqFile_80115CF8->seqArray[iCnt].len; if(D_80115D0C[iCnt] & 1){ D_80115D0C[iCnt]++; } @@ -247,7 +240,7 @@ void func_80000968(s32 arg0) { func_80004A60(2, 0x7FFF); func_80004A60(4, 0x7FFF); alCSPSetVol(gMusicPlayer, (s16) (musicRelativeVolume * musicVolumeSliderPercentage)); - alCSPSetVol(gSndFxPlayer, (s16) (sfxVolumeSliderPercentage() * D_800DC63C)); + alCSPSetVol(gSndFxPlayer, (s16) (sfxGetVolumeSlider() * sfxRelativeVolume)); break; } D_80115F79 = arg0; @@ -450,7 +443,7 @@ void musicSetChlVol(u8 chan, u8 vol) { s32 alCSPGetChlVol(ALCSPlayer*, u8 arg1); /* Unused?*/ -s32 func_80001228(u8 arg0) { +s32 musicGetChlVol(u8 arg0) { if (arg0 >= 0x10) { return 0; } else { @@ -696,8 +689,8 @@ s32 musicGetVolSliderPercentage(void) { } void sfxSetRelativeVolume(u8 arg0) { - D_800DC63C = arg0; - alCSPSetVol(gSndFxPlayer, (s16) (sfxVolumeSliderPercentage() * D_800DC63C)); + sfxRelativeVolume = arg0; + alCSPSetVol(gSndFxPlayer, (s16) (sfxGetVolumeSlider() * sfxRelativeVolume)); } void sfxSetPan(ALPan pan){ @@ -756,19 +749,19 @@ void func_80001EA8(u16 arg0, unknown_struct_80001EA8 arg1, u32* arg2){ } } -u16 func_800020E8(void); +u16 ALBankFile_80115D14_GetSoundCount(void); -void func_80001F14(u16 arg0, u32 *arg1){ - if(arg0 <= 0 || func_800020E8() < arg0){ +void func_80001F14(u16 sndIndx, u32 *arg1){ + if(sndIndx <= 0 || ALBankFile_80115D14_GetSoundCount() < sndIndx){ if(arg1){ *arg1 = 0; } } else{ if(arg1){ - func_80004638(D_80115D14->bankArray[0], (s16) arg0, arg1); + func_80004638(ALBankFile_80115D14->bankArray[0], (s16) sndIndx, arg1); }else{ - func_80004638(D_80115D14->bankArray[0], (s16) arg0, &D_80115F88); + func_80004638(ALBankFile_80115D14->bankArray[0], (s16) sndIndx, &D_80115F88); } } } @@ -781,12 +774,12 @@ void func_80001FB8(u16 arg0){ } #endif -u16 func_800020E8(void) { - return D_80115D14->bankArray[0]->instArray[0]->soundCount; +u16 ALBankFile_80115D14_GetSoundCount(void) { + return ALBankFile_80115D14->bankArray[0]->instArray[0]->soundCount; } -u8 func_80002110(void) { - return D_80115CF8->seqCount; +u8 ALSeqFile_80115CF8_GetSeqCount(void) { + return ALSeqFile_80115CF8->seqCount; } void func_80002128(unk80115D18 **arg0, s32 *arg1, s32 *arg2) { @@ -814,11 +807,11 @@ void func_8000216C(unk80115D1C **arg0, s32 *arg1, s32 *arg2) { } } -u8 func_800021B0(u16 arg0){ - if(arg0 <= 0 || D_80115D14->bankArray[0]->instArray[0]->soundCount < arg0){ +u8 ALBankFile_80115D14_GetSoundDecayTime(u16 sndIndx){ + if(sndIndx <= 0 || ALBankFile_80115D14->bankArray[0]->instArray[0]->soundCount < sndIndx){ return 0; } - return ((u32)(1+ D_80115D14->bankArray[0]->instArray[0]->soundArray[arg0-1]->envelope->decayTime) == 0); + return ((u32)(1+ ALBankFile_80115D14->bankArray[0]->instArray[0]->soundArray[sndIndx-1]->envelope->decayTime) == 0); } @@ -844,7 +837,7 @@ ALCSPlayer *func_80002224(s32 _max_voices, s32 _max_events){ cseqp = (ALCSPlayer *) alHeapDBAlloc(NULL, 0, &gALHeap, 1, 128); alCSPNew(cseqp, &config); - alCSPSetBank(cseqp, D_80115D10->bankArray[0]); + alCSPSetBank(cseqp, ALBankFile_80115D10->bankArray[0]); ((u8*) cseqp)[0x36]= 0x7F; //this member doesn't exist in ALCSPlayer return cseqp; } @@ -854,7 +847,7 @@ ALCSPlayer *func_80002224(s32 _max_voices, s32 _max_events){ void func_800022BC(u8 arg0, ALCSPlayer* arg1) { func_80002570(arg1); - if (arg0 < D_80115CF8->seqCount) { + if (arg0 < ALSeqFile_80115CF8->seqCount) { if (arg1 == gMusicPlayer) { D_800DC65C = arg0; return; @@ -870,7 +863,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_001050/func_8000232C.s") func_8000232C(ALCSPlayer* seqp, u8* ptr, u8* arg2, ALCSeq* seq){ if(alCSPGetState(seqp) == AL_STOPPED && *arg2){ func_80076E68(39, ptr, - ((u32*)(((*arg2) << 3) + D_80115CF8))[1]-func_80076EE8(39,0), + ((u32*)(((*arg2) << 3) + ALSeqFile_80115CF8))[1]-func_80076EE8(39,0), *((u32*)(((*arg2) << 3) + D_80115D0C))); alCSeqNew(seq, ptr); alCSPSetSeq(seqp, seq); diff --git a/src/unknown_003260.c b/src/unknown_003260.c index 60032d42..4e4bf66a 100644 --- a/src/unknown_003260.c +++ b/src/unknown_003260.c @@ -24,8 +24,16 @@ typedef struct unk80119240 void* unk10; } unk80119240; +/* Unknown Size */ +/*typedef struct unk800DC6B0 { + ALLink node; + ALLink_s * unk08; +} unk800DC6B0; +*/ +extern u32 D_800DC6A0; +//extern unk800DC6B0* D_800DC6B0; extern unk800DC6BC* D_800DC6BC; -extern s32 D_800DC6C0; +extern s32 sfxVolumeSlider; extern s32 D_80115F90; extern ALHeap* D_80115F94; extern OSThread audioThread; @@ -108,16 +116,16 @@ GLOBAL_ASM("asm/non_matchings/unknown_003260/D_80002E38.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/D_80003008.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/func_80003040.s") -void func_80003160(u32 arg0) { +void sfxSetVolumeSlider(u32 arg0) { if (arg0 > 256) { arg0 = 256; } - D_800DC6C0 = arg0; + sfxVolumeSlider = arg0; } -s32 sfxVolumeSliderPercentage(void) { - return D_800DC6C0; +s32 sfxGetVolumeSlider(void) { + return sfxVolumeSlider; } void func_8000318C(s32 arg0) { @@ -136,8 +144,12 @@ GLOBAL_ASM("asm/non_matchings/unknown_003260/func_8000418C.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/func_800041FC.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/func_800042CC.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/func_80004384.s") + + + GLOBAL_ASM("asm/non_matchings/unknown_003260/func_80004520.s") + void func_80004604(u8* arg0, u8 arg1){ if (arg0) arg0[0x36]=arg1; @@ -149,11 +161,18 @@ u8 func_8000461C(u8* arg0){ return 0; } -void func_80004638(ALBank* bnk, s16 arg1, s32 arg2) { - func_80004668(bnk, arg1, 0, arg2); +void func_80004638(ALBank* bnk, s16 sndIndx, s32 arg2) { + func_80004668(bnk, sndIndx, 0, arg2); } + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_003260/func_80004668.s") +#else +void func_80004668(ALBank* bnk, s16 sndIndx, u8, s32){ +} +#endif + GLOBAL_ASM("asm/non_matchings/unknown_003260/func_8000488C.s") GLOBAL_ASM("asm/non_matchings/unknown_003260/func_800048D8.s") diff --git a/src/unknown_080500.c b/src/unknown_080500.c index 74bf2297..39fbe52c 100644 --- a/src/unknown_080500.c +++ b/src/unknown_080500.c @@ -747,7 +747,7 @@ void MenuAudioOptionsInit(void) { func_800C01D8(&D_800DF77C); func_8007FFEC(2); D_800DFAC4 = musicGetVolSliderPercentage(); - D_800DFAC0 = sfxVolumeSliderPercentage(); + D_800DFAC0 = sfxGetVolumeSlider(); if (gActiveMagicCodes & 0x40) { // Check if "JUKEBOX" cheat is active D_800DFA3C.unk6C = D_801269E0; D_800DFA3C.unk32 = 0xD4; @@ -854,7 +854,7 @@ s32 MenuAudioOptionsLoop(s32 arg0) { } else if (D_800DFAC0 >= 0x101) { D_800DFAC0 = 0x100; } - func_80003160(D_800DFAC0); + sfxSetVolumeSlider(D_800DFAC0); } else if(D_80126C46 == 1) { D_800DFAC4 += (phi_a2 >> 2); if (D_800DFAC4 < 0) { @@ -881,7 +881,7 @@ s32 MenuAudioOptionsLoop(s32 arg0) { if (phi_t0 < 0 && D_800DFABC > 0) { D_800DFABC--; sp30 = 1; - } else if (phi_t0 > 0 && D_800DFABC < (func_80002110() - 1)) { + } else if (phi_t0 > 0 && D_800DFABC < (ALSeqFile_80115CF8_GetSeqCount() - 1)) { D_800DFABC++; sp30 = 1; } diff --git a/undefined_syms.txt b/undefined_syms.txt index 25d414a3..d96300f3 100755 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -74,7 +74,7 @@ D_800DA970 = 0x800DA970; gMusicPlayer = 0x800DC630; gSndFxPlayer = 0x800DC634; musicRelativeVolume = 0x800DC638; -D_800DC63C = 0x800DC63C; +sfxRelativeVolume = 0x800DC63C; D_800DC640 = 0x800DC640; D_800DC644 = 0x800DC644; D_800DC648 = 0x800DC648; @@ -99,7 +99,7 @@ D_800DC6B0 = 0x800DC6B0; D_800DC6B4 = 0x800DC6B4; D_800DC6B8 = 0x800DC6B8; D_800DC6BC = 0x800DC6BC; -D_800DC6C0 = 0x800DC6C0; +sfxVolumeSlider = 0x800DC6C0; D_800DC6C4 = 0x800DC6C4; D_800DC6D0 = 0x800DC6D0; D_800DC6D4 = 0x800DC6D4; @@ -1717,15 +1717,15 @@ D_800EA3A0 = 0x800EA3A0; D_800EABA0 = 0x800EABA0; D_800EBF60 = 0x800EBF60; gALHeap = 0x80115CE8; -D_80115CF8 = 0x80115CF8; +ALSeqFile_80115CF8 = 0x80115CF8; D_80115CFC = 0x80115CFC; D_80115D00 = 0x80115D00; D_80115D04 = 0x80115D04; D_80115D05 = 0x80115D05; musicTempo = 0x80115D08; D_80115D0C = 0x80115D0C; -D_80115D10 = 0x80115D10; -D_80115D14 = 0x80115D14; +ALBankFile_80115D10 = 0x80115D10; +ALBankFile_80115D14 = 0x80115D14; D_80115D18 = 0x80115D18; D_80115D1C = 0x80115D1C; D_80115D20 = 0x80115D20;