Merge pull request #1409 from Kurausukun/M4A_IS_DEAD

FIX CGBMODVOL FAKEMATCHING (WE DID IT REDDIT)
This commit is contained in:
GriffinR 2021-04-20 00:14:02 -04:00 committed by GitHub
commit b65d4eb910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -887,18 +887,13 @@ void CgbModVol(struct CgbChannel *chan)
if ((soundInfo->mode & 1) || !CgbPan(chan)) if ((soundInfo->mode & 1) || !CgbPan(chan))
{ {
chan->pan = 0xFF; chan->pan = 0xFF;
chan->envelopeGoal = (u32)(chan->rightVolume + chan->leftVolume) >> 4; chan->envelopeGoal = (u32)(chan->leftVolume + chan->rightVolume);
chan->envelopeGoal /= 16;
} }
else else
{ {
// Force chan->rightVolume and chan->leftVolume to be read from memory again, chan->envelopeGoal = (u32)(chan->leftVolume + chan->rightVolume);
// even though there is no reason to do so. chan->envelopeGoal /= 16;
// The command line option "-fno-gcse" achieves the same result as this.
#ifndef NONMATCHING
asm("" : : : "memory");
#endif
chan->envelopeGoal = (u32)(chan->rightVolume + chan->leftVolume) >> 4;
if (chan->envelopeGoal > 15) if (chan->envelopeGoal > 15)
chan->envelopeGoal = 15; chan->envelopeGoal = 15;
} }