From 3f1ba1ed15303a91430a769d138f7b6014993afc Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 14 Jul 2024 08:02:52 +0900 Subject: [PATCH] GBA: Disable zombie mode for GB audio channels Caused sound issues in some games (i.e M&L Superstar saga) --- Core/GBA/APU/GbaEnvelope.h | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/Core/GBA/APU/GbaEnvelope.h b/Core/GBA/APU/GbaEnvelope.h index e1cdfd097..0b21021c6 100644 --- a/Core/GBA/APU/GbaEnvelope.h +++ b/Core/GBA/APU/GbaEnvelope.h @@ -41,41 +41,9 @@ class GbaEnvelope if((value & 0xF8) == 0) { state.Enabled = false; } else { - //This implementation of the Zombie mode behavior differs from the description - //found here: https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware - //Instead, it's based on the behavior of the channel_1_nrx2_glitch test and - //and SameBoy's implementation of the glitch - bool preventIncrement = false; - if(raiseVolume != state.EnvRaiseVolume) { - if(raiseVolume) { - if(!state.EnvStopped && state.EnvPeriod == 0) { - state.Volume ^= 0x0F; - } else { - state.Volume = 14 - state.Volume; - } - preventIncrement = true; - } else { - //"If the mode was changed (add to subtract or subtract to add), volume is set to 16 - volume." - state.Volume = 16 - state.Volume; - } - - //"Only the low 4 bits of volume are kept" - state.Volume &= 0xF; - } - - if(!state.EnvStopped && !preventIncrement) { - if(state.EnvPeriod == 0 && (period || raiseVolume)) { - if(raiseVolume) { - //"If the old envelope period was zero and the envelope is still doing automatic updates, volume is incremented by 1" - state.Volume++; - } else { - state.Volume--; - } - - //"Only the low 4 bits of volume are kept" - state.Volume &= 0xF; - } - } + //No zombie mode for GBA? (or maybe it behaves differently.) + //Using the GB implementation of zombie mode causes sound issues in some games + //e.g popping can be heard in M&L Superstar Saga's menu at the start of the game } state.EnvPeriod = period;