SPU2: Tighten AutoDMA IRQ timing.

Fixes games which monitor the MADR while transferring.
Tom & Jerry War of the Whiskers was one game that suffered (Jumpy music)
This commit is contained in:
refractionpcsx2 2021-01-30 04:55:28 +00:00
parent 4624d2d175
commit e0394921e9
2 changed files with 21 additions and 11 deletions

View File

@ -181,14 +181,6 @@ void V_Core::StartADMAWrite(u16* pMem, u32 sz)
#else
AutoDMAReadBuffer(0);
#endif
if (!InputDataLeft)
{
DMAICounter = size * 4;
LastClock = *cyclePtr;
AutoDMACtrl |= ~3;
}
}
AdmaInProgress = 1;
}

View File

@ -110,8 +110,28 @@ StereoOut32 V_Core::ReadInput()
if (InputDataTransferred)
{
u32 amount = std::min(InputDataTransferred, (u32)0x180);
MADR += amount;
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)
{
if (!SPU2_dummy_callback)
spu2DMA4Irq();
else
SPU2interruptDMA4();
}
else
{
if (!SPU2_dummy_callback)
spu2DMA7Irq();
else
SPU2interruptDMA7();
}
}
}
if (PlayMode == 2 && Index == 0) //Bitstream bypass refills twice as quickly (GTA VC)
@ -141,8 +161,6 @@ StereoOut32 V_Core::ReadInput()
}
InputDataLeft = 0;
DMAICounter = InputDataTransferred * 4;
LastClock = *cyclePtr;
}
}
else if ((AutoDMACtrl & (Index + 1)))