From 2404d08f1f05619f7f0aaaf0119bcd50ed5a6ef0 Mon Sep 17 00:00:00 2001 From: kode54 Date: Tue, 22 Oct 2013 01:17:06 +0000 Subject: [PATCH] Mother 3 fix, refined to not break Metroid Fusion or hopefully anything else --- src/gba/Sound.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gba/Sound.cpp b/src/gba/Sound.cpp index 948bae34..442c2034 100644 --- a/src/gba/Sound.cpp +++ b/src/gba/Sound.cpp @@ -183,11 +183,15 @@ void Gba_Pcm_Fifo::timer_overflowed( int which_timer ) { if ( which_timer == timer && enabled ) { - if ( count <= 16 ) + /* Mother 3 fix, refined to not break Metroid Fusion */ + if ( count == 16 || count == 0 ) { // Need to fill FIFO + int saved_count = count; CPUCheckDMA( 3, which ? 4 : 2 ); - if ( count == 0 ) // Fixes Mother 3 + if ( saved_count == 0 && count == 16 ) + CPUCheckDMA( 3, which ? 4 : 2 ); + if ( count == 0 ) { // Not filled by DMA, so fill with 16 bytes of silence int reg = which ? FIFOB_L : FIFOA_L;