diff --git a/README.md b/README.md index 9299c1e1..3eec1c1c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a work in progress decompilation of Metroid - Zero Mission. -2499/2721 functions decompiled (91.84%, 222 left) +2500/2721 functions decompiled (91.88%, 221 left) Progress can be seen here : https://docs.google.com/spreadsheets/d/1X8XarD5evY8ZI7r_GQqh1pYmdVMbBcINYfRBUlogmKY/edit#gid=0 **This decomp is not shiftable, don't use it as a base to work on anything** diff --git a/include/structs/audio.h b/include/structs/audio.h index d1289d44..37e85f06 100644 --- a/include/structs/audio.h +++ b/include/structs/audio.h @@ -257,9 +257,11 @@ extern struct MusicTrackInfo gMusicTrackInfo; extern struct MusicInfo gMusicInfo; +// Linker variables extern char gNumMusicPlayers[]; extern char gUnk_Audio0x64[]; extern char gUnk_Audio0x194F700[]; +extern char gUnk_Audio0x50[]; extern struct TrackData gTrackData0; extern struct TrackData gTrackData1; diff --git a/linker.ld b/linker.ld index 2bfa0326..402ccac1 100644 --- a/linker.ld +++ b/linker.ld @@ -7,6 +7,7 @@ MEMORY { gNumMusicPlayers = 9; gUnk_Audio0x64 = 0x64; gUnk_Audio0x194F700 = 0x194F700; +gUnk_Audio0x50 = 0x50; SECTIONS { ewram (NOLOAD) : ALIGN(4) { diff --git a/src/music_wrappers.c b/src/music_wrappers.c index af1ba6e4..0ee1698d 100644 --- a/src/music_wrappers.c +++ b/src/music_wrappers.c @@ -653,9 +653,20 @@ void PlayCurrentMusicTrack(void) init_track(pTrack, pHeader); gMusicInfo.occupied = FALSE; } + +/** + * @brief 3f20 | 4c | Decreases the music volume when paused + * + */ void DecreaseMusicVolume(void) { + SoundPlay(0x63); + unk_34ac(FALSE); + gMusicInfo.volumeDownFlag |= (1 << 7); + + unk_3058(sMusicTrackDataROM[0].pTrack, USHORT_MAX, (u16)gUnk_Audio0x50); + unk_3058(sMusicTrackDataROM[1].pTrack, USHORT_MAX, (u16)gUnk_Audio0x50); } /** @@ -664,10 +675,10 @@ void DecreaseMusicVolume(void) */ void ResetMusicVolume(void) { - unk_3058(sMusicTrackDataROM[0].pTrack, 0xFFFF, 0x100); - unk_3058(sMusicTrackDataROM[1].pTrack, 0xFFFF, 0x100); + unk_3058(sMusicTrackDataROM[0].pTrack, USHORT_MAX, 0x100); + unk_3058(sMusicTrackDataROM[1].pTrack, USHORT_MAX, 0x100); - gMusicInfo.volumeDownFlag &= 0x7F; + gMusicInfo.volumeDownFlag &= ~(1 << 7); unk_35d0(FALSE); }