SPU: Only ignore loop address for not-pending-on voices

Fixes softlocks during dialog in The Misadventures of Tron Bonne.
This commit is contained in:
Connor McLaughlin 2020-11-25 22:44:56 +10:00
parent ade61d6139
commit 917fa5dd0e

View file

@ -586,8 +586,8 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value)
DebugAssert(voice_index < 24); DebugAssert(voice_index < 24);
Voice& voice = m_voices[voice_index]; Voice& voice = m_voices[voice_index];
const bool voice_was_on = voice.IsOn(); const u32 pending_key_on = m_key_on_register;
if (voice_was_on || m_key_on_register & (1u << voice_index)) if (voice.IsOn() || pending_key_on & (1u << voice_index))
m_tick_event->InvokeEarly(); m_tick_event->InvokeEarly();
switch (reg_index) switch (reg_index)
@ -649,9 +649,11 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value)
case 0x0E: // repeat address case 0x0E: // repeat address
{ {
Log_DebugPrintf("SPU voice %u ADPCM repeat address <- 0x%04X", voice_index, value); const bool ignore_loop_address = (pending_key_on & (1u << voice_index)) == 0 && !voice.IsOn();
Log_DebugPrintf("SPU voice %u ADPCM repeat address <- 0x%04X, ignoring block address = %s", voice_index, value,
ignore_loop_address ? "yes" : "no");
voice.regs.adpcm_repeat_address = value; voice.regs.adpcm_repeat_address = value;
voice.ignore_loop_address = voice_was_on; voice.ignore_loop_address |= ignore_loop_address;
} }
break; break;