From 380821729880f3551933803e3df821b933da291f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 25 Sep 2024 00:56:08 +1000 Subject: [PATCH] SPU: Handle ignore loop address with IRQs on This was actually the issue with World Cup 98, not anything to do with disc timing. Which makes more sense. Game has IRQs enabled, but because it wasn't keyed on, the condition never held true, therefore the new repeat address was immediately overwritten. --- src/core/spu.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/spu.cpp b/src/core/spu.cpp index eb5e17aae..b29ea2e32 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -1229,12 +1229,17 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) case 0x0E: // repeat address { // There is a short window of time here between the voice being keyed on and the first block finishing decoding - // where setting the repeat address will *NOT* ignore the block/loop start flag. Games sensitive to this are: + // where setting the repeat address will *NOT* ignore the block/loop start flag. + // + // We always set this flag if the voice is off, because IRQs will keep the voice reading regardless, and we don't + // want the address that we just set to get wiped out by the IRQ looping. + // + // Games sensitive to this are: // - The Misadventures of Tron Bonne - // - Re-Loaded - The Hardcore Sequel + // - Re-Loaded - The Hardcore Sequel (repeated sound effects) // - Valkyrie Profile - const bool ignore_loop_address = voice.IsOn() && !voice.is_first_block; + const bool ignore_loop_address = !voice.IsOn() || !voice.is_first_block; DEBUG_LOG("SPU voice {} ADPCM repeat address <- 0x{:04X}", voice_index, value); voice.regs.adpcm_repeat_address = value; voice.ignore_loop_address |= ignore_loop_address;