documented most audio stuff

This commit is contained in:
Henny022p
2021-03-24 01:58:52 +01:00
parent 58b4df70b5
commit 5af4805e59
45 changed files with 223 additions and 507 deletions
+2 -2
View File
@@ -95,7 +95,7 @@ _080A365E:
strh r0, [r2, #0x14]
subs r0, #0x8a
strh r0, [r2, #0x20]
bl sub_080A3210
bl InitSoundPlayingInfo
bl sub_0805E5B4
movs r1, #0x80
lsls r1, r1, #1
@@ -505,7 +505,7 @@ _080A39C8:
strb r4, [r2, #3]
movs r0, #1
bl DispReset
bl sub_080A3210
bl InitSoundPlayingInfo
bl sub_080A4D34
movs r0, #0xa
bl LoadPaletteGroup
+4 -4
View File
@@ -1249,7 +1249,7 @@ _080A4604: .4byte gMenu
sub_080A4608: @ 0x080A4608
push {r4, lr}
movs r0, #0x80
bl sub_080A3248
bl SetBgmVolume
movs r0, #3
bl sub_080A4DA8
ldr r4, _080A46A0 @ =gPaletteBuffer
@@ -1334,7 +1334,7 @@ sub_080A46C0: @ 0x080A46C0
push {lr}
movs r0, #0x80
lsls r0, r0, #1
bl sub_080A3248
bl SetBgmVolume
movs r0, #0x6c
bl SoundReq
movs r0, #2
@@ -2222,7 +2222,7 @@ sub_080A4D88: @ 0x080A4D88
movs r1, #0
bl MenuFadeIn
movs r0, #0x80
bl sub_080A3248
bl SetBgmVolume
pop {pc}
.align 2, 0
_080A4DA4: .4byte gUnk_020344A0
@@ -2351,7 +2351,7 @@ sub_080A4EA0: @ 0x080A4EA0
bne _080A4EBC
movs r0, #0x80
lsls r0, r0, #1
bl sub_080A3248
bl SetBgmVolume
bl sub_080A71DC
b _080A4F14
.align 2, 0
+2 -2
View File
@@ -34,7 +34,7 @@ sub_080519B0: @ 0x080519B0
bne _08051A02
movs r0, #1
bl DispReset
bl sub_080A3210
bl InitSoundPlayingInfo
bl zMallocInit
bl sub_080A7124
bl sub_0807059C
@@ -726,7 +726,7 @@ _0805200C: .4byte gMenu
thumb_func_start sub_08052010
sub_08052010: @ 0x08052010
push {r4, lr}
bl sub_080A3210
bl InitSoundPlayingInfo
bl MessageInitialize
movs r0, #1
bl DispReset
+1 -1
View File
@@ -670,7 +670,7 @@
.4byte \w
.endm
.macro SoundReq0x80100000
.macro StopBgm
.2byte 0x047e
.endm
-280
View File
@@ -1,280 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start SoundReq
SoundReq: @ 0x080A3268
push {r4, r5, lr}
adds r3, r0, #0
ldr r0, _080A32AC @ =gMain
ldrb r2, [r0, #7]
cmp r2, #0
beq _080A3276
b _080A347C
_080A3276:
ldr r5, _080A32B0 @ =gUnk_02021EE0
ldr r4, _080A32B4 @ =0x0000FFFF
ands r4, r3
ldr r1, _080A32B8 @ =0xFFFF0000
ands r1, r3
ldr r0, _080A32BC @ =0x80090000
cmp r1, r0
bne _080A3288
b _080A33A0
_080A3288:
cmp r1, r0
bhi _080A3310
ldr r0, _080A32C0 @ =0x80040000
cmp r1, r0
bne _080A3294
b _080A33F4
_080A3294:
cmp r1, r0
bhi _080A32D8
ldr r0, _080A32C4 @ =0x80020000
cmp r1, r0
bne _080A32A0
b _080A3384
_080A32A0:
cmp r1, r0
bhi _080A32CC
ldr r0, _080A32C8 @ =0x80010000
cmp r1, r0
beq _080A337C
b _080A3458
.align 2, 0
_080A32AC: .4byte gMain
_080A32B0: .4byte gUnk_02021EE0
_080A32B4: .4byte 0x0000FFFF
_080A32B8: .4byte 0xFFFF0000
_080A32BC: .4byte 0x80090000
_080A32C0: .4byte 0x80040000
_080A32C4: .4byte 0x80020000
_080A32C8: .4byte 0x80010000
_080A32CC:
ldr r0, _080A32D4 @ =0x80030000
cmp r1, r0
beq _080A338C
b _080A3458
.align 2, 0
_080A32D4: .4byte 0x80030000
_080A32D8:
ldr r0, _080A32F0 @ =0x80060000
cmp r1, r0
bne _080A32E0
b _080A340A
_080A32E0:
cmp r1, r0
bhi _080A32F8
ldr r0, _080A32F4 @ =0x80050000
cmp r1, r0
bne _080A32EC
b _080A33FE
_080A32EC:
b _080A3458
.align 2, 0
_080A32F0: .4byte 0x80060000
_080A32F4: .4byte 0x80050000
_080A32F8:
ldr r0, _080A3308 @ =0x80070000
cmp r1, r0
bne _080A3300
b _080A340E
_080A3300:
ldr r0, _080A330C @ =0x80080000
cmp r1, r0
beq _080A3398
b _080A3458
.align 2, 0
_080A3308: .4byte 0x80070000
_080A330C: .4byte 0x80080000
_080A3310:
ldr r0, _080A3330 @ =0x800D0000
cmp r1, r0
bne _080A3318
b _080A343A
_080A3318:
cmp r1, r0
bhi _080A3348
ldr r0, _080A3334 @ =0x800B0000
cmp r1, r0
bne _080A3324
b _080A3420
_080A3324:
cmp r1, r0
bhi _080A333C
ldr r0, _080A3338 @ =0x800A0000
cmp r1, r0
beq _080A33B6
b _080A3458
.align 2, 0
_080A3330: .4byte 0x800D0000
_080A3334: .4byte 0x800B0000
_080A3338: .4byte 0x800A0000
_080A333C:
ldr r0, _080A3344 @ =0x800C0000
cmp r1, r0
beq _080A33CC
b _080A3458
.align 2, 0
_080A3344: .4byte 0x800C0000
_080A3348:
ldr r0, _080A335C @ =0x800F0000
cmp r1, r0
bne _080A3350
b _080A344E
_080A3350:
cmp r1, r0
bhi _080A3364
ldr r0, _080A3360 @ =0x800E0000
cmp r1, r0
beq _080A3446
b _080A3458
.align 2, 0
_080A335C: .4byte 0x800F0000
_080A3360: .4byte 0x800E0000
_080A3364:
ldr r0, _080A3374 @ =0x80100000
cmp r1, r0
beq _080A343E
ldr r0, _080A3378 @ =0x80110000
cmp r1, r0
beq _080A3454
b _080A3458
.align 2, 0
_080A3374: .4byte 0x80100000
_080A3378: .4byte 0x80110000
_080A337C:
strh r2, [r5, #0x14]
bl m4aMPlayAllStop
b _080A347C
_080A3384:
movs r0, #0
bl sub_080A3234
b _080A347C
_080A338C:
bl sub_080A35C8
movs r0, #0x80
lsls r0, r0, #1
strh r0, [r5, #0x12]
b _080A3418
_080A3398:
ldrh r0, [r5, #0x14]
bl sub_080A35B4
b _080A347C
_080A33A0:
cmp r4, #0
bne _080A33A6
ldrh r4, [r5, #0x14]
_080A33A6:
subs r0, r4, #1
cmp r0, #0x62
bhi _080A347C
strh r4, [r5, #0x14]
adds r0, r4, #0
bl m4aSongNumStart
b _080A33C4
_080A33B6:
subs r0, r4, #1
cmp r0, #0x62
bhi _080A347C
strh r4, [r5, #0x14]
adds r0, r4, #0
bl m4aSongNumStartOrContinue
_080A33C4:
adds r0, r4, #0
bl sub_080A35A0
b _080A347C
_080A33CC:
ldr r2, _080A33EC @ =gMPlayTable
ldr r1, _080A33F0 @ =gSongTable
ldrh r0, [r5, #0x14]
lsls r0, r0, #3
adds r0, r0, r1
ldrh r1, [r0, #4]
lsls r0, r1, #1
adds r0, r0, r1
lsls r0, r0, #2
adds r0, r0, r2
ldr r0, [r0]
adds r1, r4, #0
bl m4aMPlayTempoControl
b _080A347C
.align 2, 0
_080A33EC: .4byte gMPlayTable
_080A33F0: .4byte gSongTable
_080A33F4:
bl m4aMPlayAllStop
bl m4aSoundVSyncOff
b _080A347C
_080A33FE:
ldrh r0, [r5, #0x14]
cmp r0, #0
beq _080A347C
bl m4aSongNumStop
b _080A347C
_080A340A:
bl m4aSoundVSyncOn
_080A340E:
ldrh r0, [r5, #0x14]
cmp r0, #0
beq _080A347C
bl m4aSongNumStartOrContinue
_080A3418:
ldrh r0, [r5, #0x14]
bl sub_080A353C
b _080A347C
_080A3420:
subs r0, r4, #1
cmp r0, #0x62
bhi _080A347C
strh r4, [r5, #0x14]
adds r0, r4, #0
bl m4aSongNumStartOrContinue
bl sub_080A35C8
adds r0, r4, #0
bl sub_080A353C
b _080A347C
_080A343A:
strh r2, [r5, #0x10]
b _080A347C
_080A343E:
strh r2, [r5, #0x10]
movs r0, #1
strb r0, [r5, #2]
b _080A347C
_080A3446:
movs r0, #0x80
lsls r0, r0, #1
strh r0, [r5, #0x10]
b _080A347C
_080A344E:
bl sub_080A35C8
b _080A347C
_080A3454:
strh r2, [r5, #0x14]
b _080A347C
_080A3458:
cmp r4, #0
beq _080A347C
subs r0, r4, #1
cmp r0, #0x62
bhi _080A3470
strh r4, [r5, #0x14]
adds r0, r4, #0
bl m4aSongNumStart
bl sub_080A35C8
b _080A3476
_080A3470:
adds r0, r4, #0
bl m4aSongNumStart
_080A3476:
adds r0, r4, #0
bl sub_080A353C
_080A347C:
pop {r4, r5, pc}
.align 2, 0
+12 -12
View File
@@ -545,19 +545,19 @@
.equiv SFX_220, 0x220
.equiv SFX_221, 0x221
.equiv SONG_STOP_ALL, 0x80010000
.equiv SONG_VOL_ZERO, 0x80020000
.equiv SONG_VOL_RESET_ALL, 0x80030000
.equiv SONG_MUTE, 0x80020000
.equiv SONG_PLAY_VOL_RESET_ALL, 0x80030000
.equiv SONG_VSYNC_OFF, 0x80040000
.equiv SONG_STOP, 0x80050000
.equiv SONG_VSYNC_ON, 0x80060000
.equiv SONG_UNK_7, 0x80070000
.equiv SONG_CONTINUE, 0x80070000
.equiv SONG_VOL_FADE_OUT, 0x80080000
.equiv SONG_UNK_9, 0x80090000
.equiv SONG_UNK_A, 0x800a0000
.equiv SONG_VOL_RESET, 0x800b0000
.equiv SONG_UNK_C, 0x800c0000
.equiv SONG_VOL_CHAN1_SILENT, 0x800d0000
.equiv SONG_VOL_CHAN1_RESET, 0x800e0000
.equiv SONG_UNK_F, 0x800f0000
.equiv SONG_RESET_UNK, 0x80100000
.equiv SONG_UNK_11, 0x80110000
.equiv SONG_FADE_IN, 0x80090000
.equiv SONG_FADE_IN_CONTINUE, 0x800a0000
.equiv SONG_PLAY_VOL_RESET, 0x800b0000
.equiv SONG_PLAY_TEMPO_CONTROL, 0x800c0000
.equiv SONG_FADE_OUT_BGM, 0x800d0000
.equiv SONG_FADE_IN_BGM, 0x800e0000
.equiv SONG_INIT, 0x800f0000
.equiv SONG_STOP_BGM, 0x80100000
.equiv SONG_BGM_0, 0x80110000
+1 -1
View File
@@ -6,7 +6,7 @@ script_0800A0FE:
BeginBlock
_0807E864
Call sub_0807DF28
SoundReq0x80100000
StopBgm
Call sub_0807FBFC
SetEntityPositionRelative 0x00b0, 0x0058
Call sub_0807F844
+1 -1
View File
@@ -47,7 +47,7 @@ SCRIPT_START script_0800A1D8
WaitForSomething2 0x000000c0
TextboxNoOverlapFollowPos 0x165c, 0x000e
_0807EA94
SoundReq0x80100000
StopBgm
TextboxNoOverlapFollowPos 0x165d, 0x000e
_0807EA94
_0807E5F8 0x00000006
+1 -1
View File
@@ -45,7 +45,7 @@ SCRIPT_START script_0800AD54
Call sub_0807F2D4
Wait 0x001e
_0807E5F8 0x00000020
SoundReq0x80100000
StopBgm
Call CreateDust
Call sub_0806305C
Call sub_080630A4
+1 -1
View File
@@ -51,7 +51,7 @@ script_0800BA46:
_0807EA94
_0807E3E8
JumpIfNot script_0800BA6C
SoundReq0x80100000
StopBgm
Call sub_0806E964
PlayBGM
script_0800BA6C:
+1 -1
View File
@@ -40,7 +40,7 @@ script_0800DBCA:
_0807EA94
Call sub_0807F3F8
_0807E5F8 0x00000001
SoundReq0x80100000
StopBgm
Call sub_08094F98
CallWithArg sub_0805DDEC, 0x00000001
_0807F0C8 0xffff, 0x0000
+1 -1
View File
@@ -14,7 +14,7 @@ script_0800DCD0:
DoPostScriptAction 0x0010
SetEntityPositionRelative 0x0078, 0x0068
WaitForSomething2 0x00000001
SoundReq0x80100000
StopBgm
Call sub_08066E50
PlaySound SFX_1C9
Call sub_0807F2D4
+1 -1
View File
@@ -7,7 +7,7 @@ SCRIPT_START script_0800DF24
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
SoundReq0x80100000
StopBgm
_0807E8E4_2
Wait 0x005a
Call sub_0807F3F8
+1 -1
View File
@@ -3,7 +3,7 @@ SCRIPT_START script_0800DFB4
script_0800DFB6:
CheckRoomFlag 0x0001
JumpIfNot script_0800DFB6
SoundReq0x80100000
StopBgm
_0807E864
Call sub_0807DF28
PlaySound SFX_EVAPORATE
+1 -1
View File
@@ -3,7 +3,7 @@ SCRIPT_START script_0800DFE4
Call sub_0807DF28
_0807E864
EndBlock
SoundReq0x80100000
StopBgm
TextboxNoOverlapFollowPos 0x1632, 0x0002
_0807EA94
SetRoomFlag 0x0003
+2 -2
View File
@@ -3,8 +3,8 @@ SCRIPT_START script_0800E050
Call sub_0807DF28
_0807E864
EndBlock
SoundReq0x80100000
SoundReq0x80100000
StopBgm
StopBgm
Wait 0x0078
_0807EB28 0x1638
_0807EA94
+1 -1
View File
@@ -80,7 +80,7 @@ script_080101AC:
Call sub_0807DF28
TextboxNoOverlapFollowPos 0x3004, 0x0007
_0807EA94
SoundReq0x80100000
StopBgm
_0807E778 0x0004
DoFade5
WaitFor_2
+3 -3
View File
@@ -33,7 +33,7 @@ script_08010BCA:
WaitForSomething2 0x00000020
TextboxNoOverlapFollowPos 0x1038, 0x000c
_0807EA94
SoundReq0x80100000
StopBgm
_0807E778 0x0004
DoFade5
WaitFor_2
@@ -95,7 +95,7 @@ script_08010BCA:
Wait 0x003c
WaitForSomething2 0x00000200
_0807E5F8 0x00280000
SoundReq0x80100000
StopBgm
PlaySound SFX_9B
_0807E5F8 0x00000100
WaitForSomething2 0x00000200
@@ -118,7 +118,7 @@ script_08010BCA:
TextboxNoOverlapFollowPos 0x1044, 0x0000
_0807EA94
SetEntityPositionRelative 0x01f8, 0x0098
SoundReq0x80100000
StopBgm
Wait 0x003c
PlayBgm BGM_VAATI_REBORN
_0807E5F8 0x00028000
+1 -1
View File
@@ -26,7 +26,7 @@ SCRIPT_START script_08010F84
_0807F0C8 0x0000, 0x0000
_0807E5F8 0x00000010
WaitForSomething2 0x00000020
SoundReq0x80100000
StopBgm
Wait 0x003c
TextboxNoOverlapFollowPos 0x104a, 0x0000
_0807EA94
+1 -1
View File
@@ -60,7 +60,7 @@ script_08011BBC:
script_08011C04:
CheckRoomFlag 0x0064
JumpIfNot script_08011C04
SoundReq0x80100000
StopBgm
_0807E864
Wait 0x003c
CameraTargetEntity
+2 -2
View File
@@ -27,7 +27,7 @@ script_08012368:
JumpIfNot script_08012368
Call sub_0807DF28
_0807E864
SoundReq0x80100000
StopBgm
BeginBlock
_0807E778 0x0004
_0807E788 0x00007fff
@@ -49,7 +49,7 @@ script_08012368:
WaitForSomething2 0x00000001
TextboxNoOverlap 0x1402
_0807EA94
SoundReq0x80100000
StopBgm
SetEntity0x20 0x00010000
Wait 0x003c
BeginBlock
+7 -7
View File
@@ -30,7 +30,7 @@ script_08012474:
script_0801248A:
CheckPlayerInRegion 0x0208, 0x02c8, 0x4020
JumpIfNot script_0801248A
SoundReq0x80100000
StopBgm
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
@@ -61,7 +61,7 @@ script_0801248A:
WaitForSomething2 0x00000100
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
SoundReq0x80100000
StopBgm
_0807E778 0x0004
_0807E80C 0x00000000
WaitFor_2
@@ -82,7 +82,7 @@ script_08012566:
Call sub_0807F9A4
Call sub_0807DF28
Call sub_0806DC7C
SoundReq0x80100000
StopBgm
StartPlayerScript script_08012AC8
WaitForSomething2 0x00000001
SetEntityPositionRelative 0x0388, 0x0168
@@ -104,7 +104,7 @@ script_08012566:
WaitForSomething2 0x00000100
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
SoundReq0x80100000
StopBgm
PlayBgm BGM_FIGHT_THEME2
Call sub_0807DF50
_0807E878
@@ -115,7 +115,7 @@ script_08012566:
Call sub_0807FA40
Call sub_0807DF28
PlaySound SFX_SECRET
SoundReq0x80100000
StopBgm
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
StartPlayerScript script_08012AF0
@@ -133,7 +133,7 @@ script_08012566:
WaitForSomething2 0x00000008
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
SoundReq0x80100000
StopBgm
Wait 0x003c
PlayBGM
Call sub_0806DCA0
@@ -147,7 +147,7 @@ script_08012566:
WaitForSomething2 0x00000008
_0807E5F8 0x00000004
WaitForSomething2 0x00000008
SoundReq0x80100000
StopBgm
Wait 0x003c
PlayBGM
Call sub_08054570
+1 -1
View File
@@ -214,7 +214,7 @@ script_08012A3E:
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
SoundReq0x80100000
StopBgm
DoPostScriptAction 0x000b
_0807EB8C
Call sub_0806D944
+1 -1
View File
@@ -53,7 +53,7 @@ script_080131AC:
_0807E778 0x0004
DoFade5
WaitFor_2
SoundReq0x80100000
StopBgm
_0807E858 0x0000
Wait 0x003c
CameraTargetPlayer
+3 -3
View File
@@ -138,7 +138,7 @@ script_08014FCC:
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
SoundReq0x80100000
StopBgm
_0807F0B4 0x0001
CameraTargetEntity
StartPlayerScript script_080152B4
@@ -164,7 +164,7 @@ script_08014FCC:
WaitForSomething2 0x00000004
_0807EB28 0x1306
_0807EA94
SoundReq0x80100000
StopBgm
StartPlayerScript script_080152DC
CameraTargetEntity
_0807F0B4 0x0003
@@ -206,7 +206,7 @@ script_08015104:
_0807E864
Call sub_0807F9A4
Call sub_0807DF28
SoundReq0x80100000
StopBgm
StartPlayerScript script_08015338
WaitForSomething2 0x00000001
Wait 0x003c
+1 -1
View File
@@ -17,7 +17,7 @@ SCRIPT_START script_0801548E
_0807EA94
_0807E5F8 0x00000800
WaitForSomething2 0x00001000
SoundReq0x80100000
StopBgm
_0807E778 0x0004
DoFade5
WaitFor_2
+1 -1
View File
@@ -15,7 +15,7 @@ script_08015BF0:
_0807E778 0x0004
_0807E80C 0x00000000
WaitFor_2
SoundReq0x80100000
StopBgm
Call sub_08053BE8
BeginBlock
_0807E864
+2 -2
View File
@@ -42,7 +42,7 @@ SCRIPT_START script_08015CD4
WaitFor_2
_0807E5F8 0x00000010
LoadRoomEntityList gUnk_080FCE30
SoundReq0x80100000
StopBgm
Wait 0x0078
_0807E778 0x0004
DoFade4
@@ -61,7 +61,7 @@ SCRIPT_START script_08015CD4
_0807E778 0x0004
DoFade5
WaitFor_2
SoundReq0x80100000
StopBgm
SetRoomFlag 0x0000
DoPostScriptAction 0x0006
SCRIPT_END
+1 -1
View File
@@ -179,7 +179,7 @@ script_080162F6:
Call sub_0807F594
Call sub_0807DF28
_0807E864
SoundReq0x80100000
StopBgm
PlaySound SFX_TASK_COMPLETE
Wait 0x003c
PlayBgm BGM_LEARN_SCROLL
+1 -1
View File
@@ -63,7 +63,7 @@ SCRIPT_START script_08016482
PlaySound SFX_METAL_CLINK
PlayBgm BGM_MINISH_WOODS
SoundReq 0x00000074
SoundReq0x80100000
StopBgm
ModRupees 0xff38
ModHealth 0x0010
IncreaseMaxHealth
+30 -12
View File
@@ -556,25 +556,43 @@ typedef enum {
SFX_221,
// special functions
SONG_STOP_ALL = 0x80010000,
SONG_VOL_ZERO = 0x80020000,
SONG_VOL_RESET_ALL = 0x80030000,
SONG_MUTE = 0x80020000,
SONG_PLAY_VOL_RESET_ALL = 0x80030000,
SONG_VSYNC_OFF = 0x80040000,
SONG_STOP = 0x80050000,
SONG_VSYNC_ON = 0x80060000,
SONG_UNK_7 = 0x80070000,
SONG_CONTINUE = 0x80070000,
SONG_VOL_FADE_OUT = 0x80080000,
SONG_UNK_9 = 0x80090000,
SONG_UNK_A = 0x800A0000,
SONG_VOL_RESET = 0x800B0000,
SONG_UNK_C = 0x800C0000,
SONG_VOL_CHAN1_SILENT = 0x800D0000,
SONG_VOL_CHAN1_RESET = 0x800E0000,
SONG_UNK_F = 0x800F0000,
SONG_RESET_UNK = 0x80100000,
SONG_UNK_11 = 0x80110000,
SONG_FADE_IN = 0x80090000,
SONG_FADE_IN_CONTINUE = 0x800A0000,
SONG_PLAY_VOL_RESET = 0x800B0000,
SONG_PLAY_TEMPO_CONTROL = 0x800C0000,
SONG_FADE_OUT_BGM = 0x800D0000,
SONG_FADE_IN_BGM = 0x800E0000,
SONG_INIT = 0x800F0000,
SONG_STOP_BGM = 0x80100000,
SONG_BGM_0 = 0x80110000,
} Sound;
typedef struct SoundPlayingInfo {
u16 unk_00;
bool8 stopBgm;
// u8 unk_03;
u16 unk_04;
s16 volumeMasterUnk;
s16 volumeMaster;
s16 volumeMasterTarget;
s16 volumeBgmUnk;
s16 volumeBgm;
s16 volumeBgmTarget;
s16 volumeSfx;
u16 currentBgm;
} SoundPlayingInfo;
extern SoundPlayingInfo gSoundPlayingInfo;
void InitSound(void);
void SoundReq(Sound sound);
void SoundLoop(void);
#endif // AUDIO_H
+1 -1
View File
@@ -142,7 +142,7 @@ extern void sub_080AF2E4(void);
extern void sub_0804F578(void);
extern void sub_08059994(void);
extern s32 sub_0801CFA8(u32);
extern void sub_080A3210(void);
extern void InitSoundPlayingInfo(void);
extern void sub_080ADA14(u32, u32); // trampoline to sub_080B27F4
extern void sub_0801E1B8(u32, u32);
extern void sub_0801E1EC(s32, s32, s32);
-1
View File
@@ -88,7 +88,6 @@ extern void sub_08056260(void);
extern void VBlankIntrWait();
extern void MessageUpdate(void);
extern void sub_08050154(void);
extern void sub_080A3480(void);
extern u8 gUnk_03003DE4;
-17
View File
@@ -182,23 +182,6 @@ typedef struct {
extern EntityHandler gUnk_03003DC0;
typedef struct struct_02021EE0 {
u16 unk_00;
u8 unk_02;
u8 unk_03;
u16 unk_04;
s16 unk_06;
s16 unk_08;
s16 unk_0a;
s16 unk_0c;
s16 unk_0e;
s16 unk_10;
s16 unk_12;
u16 currentBgm;
} struct_02021EE0;
extern struct_02021EE0 gUnk_02021EE0;
extern u8 gUnk_02022740[];
extern u8 gUnk_02034490[];
+1 -1
View File
@@ -78,7 +78,7 @@ SECTIONS {
. = 0x00019EE0; gUnk_02019EE0 = .;
. = 0x00019F6C; gUnk_02019F6C = .;
. = 0x0001AEE0; gUnk_0201AEE0 = .;
. = 0x00021EE0; gUnk_02021EE0 = .;
. = 0x00021EE0; gSoundPlayingInfo = .;
. = 0x00021F00; gUnk_02021F00 = .;
. = 0x00021F20; gUnk_02021F20 = .;
. = 0x00021F30; gBG1Buffer = .;
+106 -111
View File
@@ -3,88 +3,86 @@
#include "gba/m4a.h"
#include "audio.h"
#include "utils.h"
#include "structures.h"
s32 sub_080A3518(s32, s32);
void sub_080A353C(u32);
void sub_080A35A0(u32);
void sub_080A35B4(u32);
void sub_080A35C8(void);
#define IS_BGM(song) (song) - 1 <= NUM_BGM - 1
#define IS_SFX(song) (song) - 1 > NUM_BGM - 1
void sub_080A3210(void);
void InitSoundPlayingInfo(void);
s32 fade(s32 target, s32 current);
void doPlaySound(u32 sound);
void PlayFadeIn(u32 sound);
void PlayFadeOut(u32 sound);
void InitVolume(void);
void InitSound(void){
sub_080A3210();
void InitSound(void) {
InitSoundPlayingInfo();
m4aSoundInit();
}
void sub_080A3210(void){
MemClear(&gUnk_02021EE0, 0x18);
sub_080A35C8();
gUnk_02021EE0.unk_12 = 0x100;
gUnk_02021EE0.unk_04 = 0x100;
void InitSoundPlayingInfo(void) {
MemClear(&gSoundPlayingInfo, sizeof(gSoundPlayingInfo));
InitVolume();
gSoundPlayingInfo.volumeSfx = 0x100;
gSoundPlayingInfo.unk_04 = 0x100;
m4aMPlayAllStop();
}
void sub_080A3234(u32 arg){
gUnk_02021EE0.unk_08 = arg;
gUnk_02021EE0.unk_0a = arg;
sub_080A353C(gUnk_02021EE0.currentBgm);
void SetMasterVolume(u32 volume) {
gSoundPlayingInfo.volumeMaster = volume;
gSoundPlayingInfo.volumeMasterTarget = volume;
doPlaySound(gSoundPlayingInfo.currentBgm);
}
void sub_080A3248(u32 arg){
gUnk_02021EE0.unk_10 = arg;
gUnk_02021EE0.unk_0e = arg;
sub_080A353C(gUnk_02021EE0.currentBgm);
void SetBgmVolume(u32 volume) {
gSoundPlayingInfo.volumeBgmTarget = volume;
gSoundPlayingInfo.volumeBgm = volume;
doPlaySound(gSoundPlayingInfo.currentBgm);
}
void sub_080A325C(u32 arg){
gUnk_02021EE0.unk_12 = arg;
void SetSfxVolume(u32 volume) {
gSoundPlayingInfo.volumeSfx = volume;
}
void SoundReq(Sound sound) {
u32 song;
struct_02021EE0* ptr;
SoundPlayingInfo* ptr;
if (gMain.field_0x7)
return;
ptr = &gUnk_02021EE0;
ptr = &gSoundPlayingInfo;
song = sound & 0xffff;
switch (sound & 0xffff0000) {
case SONG_STOP_ALL:
ptr->currentBgm = 0;
m4aMPlayAllStop();
return;
case SONG_VOL_ZERO:
sub_080A3234(0);
case SONG_MUTE:
SetMasterVolume(0);
return;
case SONG_VOL_RESET_ALL:
sub_080A35C8();
ptr->unk_12 = 0x100;
sub_080A353C(ptr->currentBgm);
case SONG_PLAY_VOL_RESET_ALL:
InitVolume();
ptr->volumeSfx = 0x100;
doPlaySound(ptr->currentBgm);
return;
case SONG_VOL_FADE_OUT:
sub_080A35B4(ptr->currentBgm);
PlayFadeOut(ptr->currentBgm);
return;
case SONG_UNK_9:
case SONG_FADE_IN:
if (song == 0)
song = ptr->currentBgm;
if (IS_SFX(song))
return;
ptr->currentBgm = song;
m4aSongNumStart(song);
sub_080A35A0(song);
PlayFadeIn(song);
return;
case SONG_UNK_A:
case SONG_FADE_IN_CONTINUE:
if (IS_SFX(song))
return;
ptr->currentBgm = song;
m4aSongNumStartOrContinue(song);
sub_080A35A0(song);
PlayFadeIn(song);
return;
case SONG_UNK_C:
case SONG_PLAY_TEMPO_CONTROL:
m4aMPlayTempoControl(gMPlayTable[gSongTable[ptr->currentBgm].ms].info, song);
return;
case SONG_VSYNC_OFF:
@@ -98,34 +96,34 @@ void SoundReq(Sound sound) {
return;
case SONG_VSYNC_ON:
m4aSoundVSyncOn();
case SONG_UNK_7:
case SONG_CONTINUE:
if (ptr->currentBgm == 0)
return;
m4aSongNumStartOrContinue(ptr->currentBgm);
sub_080A353C(ptr->currentBgm);
doPlaySound(ptr->currentBgm);
return;
case SONG_VOL_RESET:
case SONG_PLAY_VOL_RESET:
if (IS_SFX(song))
return;
ptr->currentBgm = song;
m4aSongNumStartOrContinue(song);
sub_080A35C8();
sub_080A353C(song);
InitVolume();
doPlaySound(song);
return;
case SONG_VOL_CHAN1_SILENT:
ptr->unk_10 = 0;
case SONG_FADE_OUT_BGM:
ptr->volumeBgmTarget = 0;
return;
case SONG_RESET_UNK:
ptr->unk_10 = 0;
ptr->unk_02 = 1;
case SONG_STOP_BGM:
ptr->volumeBgmTarget = 0;
ptr->stopBgm = TRUE;
return;
case SONG_VOL_CHAN1_RESET:
ptr->unk_10 = 0x100;
case SONG_FADE_IN_BGM:
ptr->volumeBgmTarget = 0x100;
return;
case SONG_UNK_F:
sub_080A35C8();
case SONG_INIT:
InitVolume();
return;
case SONG_UNK_11:
case SONG_BGM_0:
ptr->currentBgm = 0;
return;
default:
@@ -133,109 +131,106 @@ void SoundReq(Sound sound) {
if (IS_BGM(song)) {
ptr->currentBgm = song;
m4aSongNumStart(song);
sub_080A35C8();
InitVolume();
} else {
m4aSongNumStart(song);
}
sub_080A353C(song);
doPlaySound(song);
}
return;
}
}
void sub_080A3480(void) {
u32 iVar2;
struct_02021EE0* ptr = &gUnk_02021EE0;
void SoundLoop(void) {
s32 fadeValue;
SoundPlayingInfo* ptr = &gSoundPlayingInfo;
if (ptr->unk_0a != ptr->unk_08) {
iVar2 = sub_080A3518(ptr->unk_0a, ptr->unk_08);
if (iVar2 == 0) {
ptr->unk_08 = ptr->unk_0a;
if (ptr->volumeMasterTarget != ptr->volumeMaster) {
fadeValue = fade(ptr->volumeMasterTarget, ptr->volumeMaster);
if (fadeValue == 0) {
ptr->volumeMaster = ptr->volumeMasterTarget;
} else {
ptr->unk_08 = ptr->unk_08 + iVar2;
ptr->volumeMaster = ptr->volumeMaster + fadeValue;
}
if (ptr->unk_08 < 0) {
ptr->unk_0a = 0;
ptr->unk_08 = 0;
if (ptr->volumeMaster < 0) {
ptr->volumeMasterTarget = 0;
ptr->volumeMaster = 0;
}
sub_080A353C(ptr->currentBgm);
doPlaySound(ptr->currentBgm);
} else {
if (ptr->unk_10 != ptr->unk_0e) {
iVar2 = sub_080A3518(ptr->unk_10, ptr->unk_0e);
if (iVar2 == 0) {
if (ptr->unk_02 != 0 && ptr->unk_10 == 0) {
ptr->unk_02 = 0;
if (ptr->volumeBgmTarget != ptr->volumeBgm) {
fadeValue = fade(ptr->volumeBgmTarget, ptr->volumeBgm);
if (fadeValue == 0) {
if (ptr->stopBgm && ptr->volumeBgmTarget == 0) {
ptr->stopBgm = FALSE;
ptr->currentBgm = 0;
m4aSongNumStop(0);
} else {
ptr->unk_0e = ptr->unk_10;
ptr->volumeBgm = ptr->volumeBgmTarget;
}
} else {
ptr->unk_0e += iVar2;
ptr->volumeBgm += fadeValue;
}
if (ptr->unk_0e < 0) {
ptr->unk_10 = 0;
ptr->unk_0e = 0;
if (ptr->volumeBgm < 0) {
ptr->volumeBgmTarget = 0;
ptr->volumeBgm = 0;
}
sub_080A353C(ptr->currentBgm);
doPlaySound(ptr->currentBgm);
}
}
}
s32 sub_080A3518(s32 unk_1, s32 unk_2){
if (unk_1 - unk_2 >= 1) {
unk_2 += 4;
if (unk_1 > unk_2)
s32 fade(s32 target, s32 current) {
if (target - current >= 1) {
current += 4;
if (target > current)
return 4;
else
return 0;
return 0;
} else {
unk_2 -= 4;
if (unk_1 < unk_2)
current -= 4;
if (target < current)
return -4;
else
return 0;
return 0;
}
}
void sub_080A353C(u32 song){
void doPlaySound(u32 sound) {
u32 volume;
u32 iVar2;
MusicPlayerInfo* musicPlayerInfo;
if(song == 0)
if (sound == 0)
return;
if (IS_BGM(song)) {
volume = gUnk_02021EE0.unk_0e;
if (IS_BGM(sound)) {
volume = gSoundPlayingInfo.volumeBgm;
} else {
volume = gSoundPlayingInfo.volumeSfx;
}
else{
volume = gUnk_02021EE0.unk_12;
}
iVar2 = gUnk_02021EE0.unk_08;
iVar2 = gSoundPlayingInfo.volumeMaster;
volume = iVar2 * volume / 0x100;
musicPlayerInfo = gMPlayTable[gSongTable[song].ms].info;
musicPlayerInfo = gMPlayTable[gSongTable[sound].ms].info;
m4aMPlayImmInit(musicPlayerInfo);
m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume);
}
void sub_080A35A0(u32 song){
gUnk_02021EE0.unk_0a = 0x100;
sub_080A353C(song);
void PlayFadeIn(u32 sound) {
gSoundPlayingInfo.volumeMasterTarget = 0x100;
doPlaySound(sound);
}
void sub_080A35B4(u32 song){
gUnk_02021EE0.unk_0a = 0;
sub_080A353C(song);
void PlayFadeOut(u32 sound) {
gSoundPlayingInfo.volumeMasterTarget = 0;
doPlaySound(sound);
}
void sub_080A35C8(){
gUnk_02021EE0.unk_06 = 0x100;
gUnk_02021EE0.unk_08 = 0x100;
gUnk_02021EE0.unk_0a = 0x100;
gUnk_02021EE0.unk_0c = 0x100;
gUnk_02021EE0.unk_0e = 0x100;
gUnk_02021EE0.unk_10 = 0x100;
void InitVolume() {
gSoundPlayingInfo.volumeMasterUnk = 0x100;
gSoundPlayingInfo.volumeMaster = 0x100;
gSoundPlayingInfo.volumeMasterTarget = 0x100;
gSoundPlayingInfo.volumeBgmUnk = 0x100;
gSoundPlayingInfo.volumeBgm = 0x100;
gSoundPlayingInfo.volumeBgmTarget = 0x100;
}
extern const SongHeader sfxNone;
+1 -1
View File
@@ -33,7 +33,7 @@ void sub_0805FA04(void) {
sub_08053320();
sub_0801D79C(0, 0x1144);
gMain.funcIndex = 1;
sub_080A3210();
InitSoundPlayingInfo();
sub_08050008();
}
+1 -1
View File
@@ -190,7 +190,7 @@ static void HandleFileScreenEnter(void) {
u32 i;
DispReset(1);
sub_080A3210();
InitSoundPlayingInfo();
MemClear((void*)VRAM, 0x80); // clear palettes
MessageInitialize();
EraseAllEntities();
+1 -1
View File
@@ -158,7 +158,7 @@ static void HandleTitlescreen(void) {
gIntroState.swordBgScaleRatio = 0x10;
UpdateSwordBgAffineData();
}
sub_080A3210();
InitSoundPlayingInfo();
SoundReq(BGM_TITLE_SCREEN);
DoFade(6, 8);
break;
+1 -1
View File
@@ -73,7 +73,7 @@ void AgbMain(void) {
sScreenHandlers[gMain.screen]();
MessageUpdate();
sub_08050154();
sub_080A3480();
SoundLoop();
break;
}
PrepNextFrame();
+1 -1
View File
@@ -81,7 +81,7 @@ void sub_0805A370(Manager15* this) {
if (this->manager.unk_0d) {
LoadRoomEntityList((EntityData*)&gUnk_080E4C08);
this->manager.action = 3;
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
}
}
+2 -2
View File
@@ -19,7 +19,7 @@
void (*const ManagerB_ActionFuncs[])(Manager*);
void sub_080585F0(Manager* this) {
// make a distincion if this is a controller (unk_0a = 0) or a helper (unk_0a = 1)
// make a distincion if this is a controller (volumeMasterTarget = 0) or a helper (volumeMasterTarget = 1)
ManagerB_ActionFuncs[this->unk_0a](this);
}
@@ -141,7 +141,7 @@ void ManagerBHelper_Monitor(ManagerBHelper* this, Entity* ent, u32 index) {
this->manager.unk_0e++;
}
// case unk_0a is 1: The manager is a helper
// case volumeMasterTarget is 1: The manager is a helper
void ManagerBHelper_Main(Manager* this) {
u8 i, anyRemaining;
+10 -10
View File
@@ -2241,7 +2241,7 @@ void sub_0804CD48(void) {
if (CheckGlobalFlag(LV1_CLEAR)) {
LoadRoomEntityList(&gUnk_080DF94C);
} else {
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
}
}
@@ -2429,7 +2429,7 @@ void sub_0804CED8(void) {
sub_0807AABC(&gPlayerEntity);
LoadRoomEntityList(&gUnk_080E1814);
} else {
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
}
}
@@ -2523,7 +2523,7 @@ void sub_0804CFB0(void) {
if (!CheckFlags(0x31)) {
if (gScreenTransition.field_0x38 == 0) {
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
} else {
if (gScreenTransition.field_0x39 == 0) {
SoundReq(SONG_STOP);
@@ -2761,7 +2761,7 @@ void sub_0804D140(void) {
if (CheckGlobalFlag(LV4_CLEAR)) {
LoadRoomEntityList(&gUnk_080E49F4);
} else {
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
}
}
@@ -3090,7 +3090,7 @@ void sub_0804D384(void) {
sub_08078A90(3);
LoadRoomEntityList(&gUnk_080E72E4);
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
}
}
}
@@ -3498,7 +3498,7 @@ u32 sub_0804D6C4() {
}
void sub_0804D6C8(void) {
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
}
@@ -4506,7 +4506,7 @@ void sub_0804E3C4() {
index = 0xE;
}
sub_0804B3C4(&gUnk_080F0E1C[index]);
SoundReq(SONG_RESET_UNK);
SoundReq(SONG_STOP_BGM);
}
u32 sub_0804E45C() {
@@ -4714,7 +4714,7 @@ extern EntityData gUnk_080F2E2C;
void sub_0804E6E8(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(SONG_VOL_RESET | BGM_MINISH_CAP);
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
LoadRoomEntityList(&gUnk_080F2E2C);
@@ -4731,7 +4731,7 @@ extern EntityData gUnk_080F2EC4;
void sub_0804E72C(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(SONG_VOL_RESET | BGM_MINISH_CAP);
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
LoadRoomEntityList(&gUnk_080F2E94);
@@ -4783,7 +4783,7 @@ void sub_0804E7DC(void) {
}
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(SONG_VOL_RESET | BGM_MINISH_CAP);
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if ((gPlayerState.flags.all & 8) == 0) {
LoadRoomEntityList(&gUnk_080F31D8);
+6 -5
View File
@@ -1,5 +1,6 @@
#include "save.h"
#include "gba/eeprom.h"
#include "audio.h"
typedef struct SaveFileStatus {
u16 checksum1;
@@ -67,8 +68,8 @@ SaveResult HandleSave(u32 arg0) {
}
SaveResult HandleSaveInit(u32 arg0) {
gUnk_02021EE0.unk_0a -= 8;
if (gUnk_02021EE0.unk_08 <= 0) {
gSoundPlayingInfo.volumeMasterTarget -= 8;
if (gSoundPlayingInfo.volumeMaster <= 0) {
gMenu.field_0xa = 8;
gMenu.storyPanelIndex = SAVE_IN_PROGRESS;
}
@@ -105,9 +106,9 @@ SaveResult HandleSaveDone(u32 arg0) {
SaveResult result;
result = SAVE_BUSY;
gUnk_02021EE0.unk_0a += 8;
if (gUnk_02021EE0.unk_06 <= gUnk_02021EE0.unk_0a) {
gUnk_02021EE0.unk_0a = gUnk_02021EE0.unk_06;
gSoundPlayingInfo.volumeMasterTarget += 8;
if (gSoundPlayingInfo.volumeMasterUnk <= gSoundPlayingInfo.volumeMasterTarget) {
gSoundPlayingInfo.volumeMasterTarget = gSoundPlayingInfo.volumeMasterUnk;
sub_08050384();
gMenu.storyPanelIndex = SAVE_INIT;
if (gMenu.field_0xa == 1) {
+4 -4
View File
@@ -141,7 +141,7 @@ void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* c
void ScriptCommand_PlaySound(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_PlayBgm(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_SoundReq0x80100000(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_StopBgm(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_ModRupees(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_ModHealth(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_IncreaseMaxHealth(Entity* entity, ScriptExecutionContext* context);
@@ -287,7 +287,7 @@ const ScriptCommand gScriptCommands[] = { ScriptCommandNop,
ScriptCommand_PlaySound,
ScriptCommand_PlayBgm,
ScriptCommand_SoundReq,
ScriptCommand_SoundReq0x80100000,
ScriptCommand_StopBgm,
ScriptCommand_ModRupees,
ScriptCommand_ModHealth,
ScriptCommand_IncreaseMaxHealth,
@@ -1467,8 +1467,8 @@ void ScriptCommand_SoundReq(Entity* entity, ScriptExecutionContext* context) {
SoundReq(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer));
}
void ScriptCommand_SoundReq0x80100000(Entity* entity, ScriptExecutionContext* context) {
SoundReq(SONG_RESET_UNK);
void ScriptCommand_StopBgm(Entity* entity, ScriptExecutionContext* context) {
SoundReq(SONG_STOP_BGM);
}
void ScriptCommand_ModRupees(Entity* entity, ScriptExecutionContext* context) {