summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-04-20 00:14:20 -0400
committerGitHub <noreply@github.com>2021-04-20 00:14:20 -0400
commita005118d7f83a12b73361c3655812e437201146b (patch)
tree7d88f472613ac6d458855d697b8176d2f0329b48
parent35cf80b7eac2f80d2bb97f0e52152c6c35939fd2 (diff)
parent60cbcaaa9b3d5ae5182ec26f7c7854c0c469bb94 (diff)
Merge pull request #419 from Kurausukun/M4A_IS_DEAD
FIX CGBMODVOL FAKEMATCHING (WE DID IT REDDIT)
-rw-r--r--src/m4a.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/m4a.c b/src/m4a.c
index 8772b6f2f..639aa2ac6 100644
--- a/src/m4a.c
+++ b/src/m4a.c
@@ -871,18 +871,13 @@ void CgbModVol(struct CgbChannel *chan)
if ((soundInfo->mode & 1) || !CgbPan(chan))
{
chan->pan = 0xFF;
- chan->eg = (u32)(chan->rightVolume + chan->leftVolume) >> 4;
+ chan->eg = (u32)(chan->leftVolume + chan->rightVolume);
+ chan->eg /= 16;
}
else
{
- // Force chan->rightVolume and chan->leftVolume to be read from memory again,
- // even though there is no reason to do so.
- // The command line option "-fno-gcse" achieves the same result as this.
- #ifndef NONMATCHING
- asm("" : : : "memory");
- #endif
-
- chan->eg = (u32)(chan->rightVolume + chan->leftVolume) >> 4;
+ chan->eg = (u32)(chan->leftVolume + chan->rightVolume);
+ chan->eg /= 16;
if (chan->eg > 15)
chan->eg = 15;
}