From a93b21e88640848a0dac4a1319ffb4e3506040b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 26 Oct 2015 20:31:22 -0700 Subject: [PATCH] GBA Audio: Implement missing flags on SOUNDCNT_X register --- CHANGES | 1 + src/gba/audio.c | 6 ++++++ src/gba/io.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index 0c1b86dcb..9a703e0ab 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Misc: - SDL: Allow GBASDLAudio to be used without a thread context - All: Improved PowerPC support - All: Fix some undefined behavior warnings + - GBA Audio: Implement missing flags on SOUNDCNT_X register 0.3.1: (2015-10-24) Bugfixes: diff --git a/src/gba/audio.c b/src/gba/audio.c index 305b4545b..c281e3552 100644 --- a/src/gba/audio.c +++ b/src/gba/audio.c @@ -283,6 +283,12 @@ int32_t GBAAudioProcessEvents(struct GBAAudio* audio, int32_t cycles) { } } } + + audio->p->memory.io[REG_SOUNDCNT_X >> 1] &= ~0x000F; + audio->p->memory.io[REG_SOUNDCNT_X >> 1] |= audio->playingCh1; + audio->p->memory.io[REG_SOUNDCNT_X >> 1] |= audio->playingCh2 << 1; + audio->p->memory.io[REG_SOUNDCNT_X >> 1] |= audio->playingCh3 << 2; + audio->p->memory.io[REG_SOUNDCNT_X >> 1] |= audio->playingCh4 << 2; } audio->nextSample -= audio->eventDiff; diff --git a/src/gba/io.c b/src/gba/io.c index 02652a238..f1f9a8d3c 100644 --- a/src/gba/io.c +++ b/src/gba/io.c @@ -351,6 +351,8 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) { break; case REG_SOUNDCNT_X: GBAAudioWriteSOUNDCNT_X(&gba->audio, value); + value &= 0xFFFF; + value |= gba->memory.io[REG_SOUNDCNT_X >> 1] & 0xF; break; case REG_SOUNDBIAS: GBAAudioWriteSOUNDBIAS(&gba->audio, value);