VIF: Fix VU Sync option infinite loop

This commit is contained in:
refractionpcsx2 2023-09-16 16:56:53 +01:00
parent ae5cd7b3c3
commit 1f0a91c313
2 changed files with 16 additions and 2 deletions

View File

@ -137,8 +137,15 @@ __fi void vif0SetupTransfer()
__fi void vif0VUFinish() __fi void vif0VUFinish()
{ {
// Sync up VU0 so we don't errantly wait. // Sync up VU0 so we don't errantly wait.
while (static_cast<int>(cpuRegs.cycle - VU0.cycle) > 0 && (VU0.VI[REG_VPU_STAT].UL & 0x1)) while (VU0.VI[REG_VPU_STAT].UL & 0x1)
{
const int cycle_diff = static_cast<int>(cpuRegs.cycle - VU0.cycle);
if ((EmuConfig.Gamefixes.VUSyncHack && cycle_diff < VU0.nextBlockCycles) || cycle_diff <= 0)
break;
CpuVU0->ExecuteBlock(); CpuVU0->ExecuteBlock();
}
if (VU0.VI[REG_VPU_STAT].UL & 0x5) if (VU0.VI[REG_VPU_STAT].UL & 0x5)
{ {

View File

@ -232,8 +232,15 @@ __fi void vif1SetupTransfer()
__fi void vif1VUFinish() __fi void vif1VUFinish()
{ {
// Sync up VU1 so we don't errantly wait. // Sync up VU1 so we don't errantly wait.
while (!THREAD_VU1 && static_cast<int>(cpuRegs.cycle - VU1.cycle) > 0 && (VU0.VI[REG_VPU_STAT].UL & 0x100)) while (!THREAD_VU1 && (VU0.VI[REG_VPU_STAT].UL & 0x100))
{
const int cycle_diff = static_cast<int>(cpuRegs.cycle - VU1.cycle);
if ((EmuConfig.Gamefixes.VUSyncHack && cycle_diff < VU1.nextBlockCycles) || cycle_diff <= 0)
break;
CpuVU1->ExecuteBlock(); CpuVU1->ExecuteBlock();
}
if (VU0.VI[REG_VPU_STAT].UL & 0x500) if (VU0.VI[REG_VPU_STAT].UL & 0x500)
{ {