From c31c2d93d73bd6c6d328df3ac07ab5d160a21008 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 16 Oct 2020 16:55:29 -0400 Subject: [PATCH 1/3] [LEAK INFORMED] match FadeOutBody --- src/m4a.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/m4a.c b/src/m4a.c index b8f9e21c11..a417466cf5 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -643,40 +643,27 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo) s32 i; struct MusicPlayerTrack *track; u16 fadeOV; -#ifdef NONMATCHING - u16 mask; -#else - register u16 mask asm("r2"); -#endif // NONMATCHING if (mplayInfo->fadeOI == 0) return; - - mplayInfo->fadeOC--; - mask = 0xFFFF; - - if (mplayInfo->fadeOC != 0) + if (--mplayInfo->fadeOC != 0) return; mplayInfo->fadeOC = mplayInfo->fadeOI; if (mplayInfo->fadeOV & FADE_IN) { - mplayInfo->fadeOV += (4 << FADE_VOL_SHIFT); - - if ((u16)(mplayInfo->fadeOV & mask) >= (64 << FADE_VOL_SHIFT)) + if ((u16)(mplayInfo->fadeOV += (4 << FADE_VOL_SHIFT)) >= (64 << FADE_VOL_SHIFT)) { mplayInfo->fadeOV = (64 << FADE_VOL_SHIFT); mplayInfo->fadeOI = 0; } } + else { - mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT); - - if ((s16)(mplayInfo->fadeOV & mask) <= 0) + if ((s16)(mplayInfo->fadeOV-=(4 << FADE_VOL_SHIFT)) <= 0) { - for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++) { u32 val; From bf03f1154f4e25b8d03035074bd4f77fe421aa3b Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 16 Oct 2020 16:57:41 -0400 Subject: [PATCH 2/3] formatting --- src/m4a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m4a.c b/src/m4a.c index a417466cf5..fa81a09c38 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -662,7 +662,7 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo) else { - if ((s16)(mplayInfo->fadeOV-=(4 << FADE_VOL_SHIFT)) <= 0) + if ((s16)(mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT)) <= 0) { for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++) { From aedfe27f8d609e4a6cef15b977ae8322f190d094 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 16 Oct 2020 17:16:25 -0400 Subject: [PATCH 3/3] Remove newline --- src/m4a.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/m4a.c b/src/m4a.c index fa81a09c38..2280fc74c8 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -659,7 +659,6 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo) mplayInfo->fadeOI = 0; } } - else { if ((s16)(mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT)) <= 0)