diff options
author | PikalaxALT <PikalaxALT@users.noreply.github.com> | 2021-08-11 19:55:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 19:55:44 -0400 |
commit | c7fc6ac893b1018d48379d807740352e0926defd (patch) | |
tree | eb824f4bd90778f5e968f1fe37f0e99f764cd0ab | |
parent | cc516274650bfc21437003c16bb793a43d190a41 (diff) | |
parent | 2e892c6961d646244b6cf0397181ba3051fffb80 (diff) |
Merge pull request #1492 from Kurausukun/cgbsound
Fix CgbSound Fakematches (Thanks to Revo)
-rw-r--r-- | src/m4a.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -906,7 +906,6 @@ void CgbSound(void) { s32 ch; struct CgbChannel *channels; - s32 envelopeStepTimeAndDir; s32 prevC15; struct SoundInfo *soundInfo = SOUND_INFO_PTR; vu8 *nrx0ptr; @@ -914,6 +913,7 @@ void CgbSound(void) vu8 *nrx2ptr; vu8 *nrx3ptr; vu8 *nrx4ptr; + s32 envelopeStepTimeAndDir; // Most comparision operations that cast to s8 perform 'and' by 0xFF. int mask = 0xff; @@ -1198,8 +1198,8 @@ void CgbSound(void) } else { - envelopeStepTimeAndDir &= 0xf; - *nrx2ptr = (channels->envelopeVolume << 4) + envelopeStepTimeAndDir; + u32 envMask = 0xF; + *nrx2ptr = (envelopeStepTimeAndDir & envMask) + (channels->envelopeVolume << 4); *nrx4ptr = channels->n4 | 0x80; if (ch == 1 && !(*nrx0ptr & 0x08)) *nrx4ptr = channels->n4 | 0x80; |