Skip to content

Commit

Permalink
VIF: Fix VU Sync option infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Sep 16, 2023
1 parent 3157f1a commit 8b77755
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pcsx2/Vif0_Dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ __fi void vif0SetupTransfer()
__fi void vif0VUFinish()
{
// 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();
}

if (VU0.VI[REG_VPU_STAT].UL & 0x5)
{
Expand Down
9 changes: 8 additions & 1 deletion pcsx2/Vif1_Dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,15 @@ __fi void vif1SetupTransfer()
__fi void vif1VUFinish()
{
// 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();
}

if (VU0.VI[REG_VPU_STAT].UL & 0x500)
{
Expand Down

0 comments on commit 8b77755

Please sign in to comment.