From 7317c83a3c87a2a699e003262a1f0184f8d2dac1 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 24 Mar 2020 00:21:52 +1000 Subject: [PATCH] SPU: Implement internal volume sweep register reads Fixes muted audio in Michelin Rally Masters. --- src/core/spu.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/spu.cpp b/src/core/spu.cpp index 2082abe21..c16feb6f7 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -219,6 +219,14 @@ u16 SPU::ReadRegister(u32 offset) case 0x1F801DB2 - SPU_BASE: return m_cd_audio_volume_right; + case 0x1F801DB8 - SPU_BASE: + m_tick_event->InvokeEarly(); + return m_main_volume_left.current_level; + + case 0x1F801DBA - SPU_BASE: + m_tick_event->InvokeEarly(); + return m_main_volume_right.current_level; + default: { if (offset < (0x1F801D80 - SPU_BASE)) @@ -227,6 +235,16 @@ u16 SPU::ReadRegister(u32 offset) if (offset >= (0x1F801DC0 - SPU_BASE) && offset <= (0x1F801DFE - SPU_BASE)) return m_reverb_registers.rev[(offset - (0x1F801DC0 - SPU_BASE)) / 2]; + if (offset >= (0x1F801E00 - SPU_BASE) && offset <= (0x1F801E60 - SPU_BASE)) + { + const u32 voice_index = offset - (0x1F801E00 - SPU_BASE); + m_tick_event->InvokeEarly(); + if (offset & 0x02) + return m_voices[voice_index].left_volume.current_level; + else + return m_voices[voice_index].right_volume.current_level; + } + Log_ErrorPrintf("Unknown SPU register read: offset 0x%X (address 0x%08X)", offset, offset | SPU_BASE); return UINT16_C(0xFFFF); }