Match DecreaseMusicVolume

This commit is contained in:
y.demaisonregne 2023-05-23 23:39:26 +02:00
parent 83be0ec42c
commit 7f003fac78
4 changed files with 18 additions and 4 deletions

View File

@ -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**

View File

@ -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;

View File

@ -7,6 +7,7 @@ MEMORY {
gNumMusicPlayers = 9;
gUnk_Audio0x64 = 0x64;
gUnk_Audio0x194F700 = 0x194F700;
gUnk_Audio0x50 = 0x50;
SECTIONS {
ewram (NOLOAD) : ALIGN(4) {

View File

@ -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);
}