From 17519c21b4eeefbadaad3374bd98bdd43d44f1a6 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Thu, 27 May 2021 00:10:33 +0100 Subject: [PATCH] SPU2: Fix hi def audio streaming --- pcsx2/SPU2/ReadInput.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pcsx2/SPU2/ReadInput.cpp b/pcsx2/SPU2/ReadInput.cpp index 74559bf2c7..d5888893a6 100644 --- a/pcsx2/SPU2/ReadInput.cpp +++ b/pcsx2/SPU2/ReadInput.cpp @@ -51,6 +51,24 @@ StereoOut32 V_Core::ReadInput_HiFi() retval.Right >>= 4; } + // Simulate MADR increase, GTA VC tracks the MADR address for calculating a certain point in the buffer + if (InputDataTransferred) + { + u32 amount = std::min(InputDataTransferred, (u32)0x180); + + InputDataTransferred -= amount; + MADR += amount; + // Because some games watch the MADR to see when it reaches the end we need to end the DMA here + // Tom & Jerry War of the Whiskers is one such game, the music will skip + if (!InputDataTransferred && !InputDataLeft) + { + if (Index == 0) + spu2DMA4Irq(); + else + spu2DMA7Irq(); + } + } + if (ReadIndex == 0x100 || ReadIndex == 0x0 || ReadIndex == 0x80 || ReadIndex == 0x180) { if (ReadIndex == 0x100) @@ -75,8 +93,6 @@ StereoOut32 V_Core::ReadInput_HiFi() } InputDataLeft = 0; - DMAICounter = InputDataTransferred * 4; - LastClock = *cyclePtr; } } else if ((AutoDMACtrl & (Index + 1)))