VMManager: Exit the CPU rec immediately on stopping

This commit is contained in:
Stenzek 2023-01-28 13:33:29 +10:00 committed by refractionpcsx2
parent ed26368a3a
commit c596a51593
2 changed files with 17 additions and 0 deletions

View File

@ -209,6 +209,11 @@ void VMManager::SetState(VMState state)
else
Host::OnVMResumed();
}
else if (state == VMState::Stopping)
{
// If stopping, break execution as soon as possible.
Cpu->ExitExecution();
}
}
bool VMManager::HasValidVM()

View File

@ -686,7 +686,19 @@ static void recSafeExitExecution()
// Force an event test at the end of this block.
if (!eeEventTestIsActive)
{
// EE is running.
cpuRegs.nextEventCycle = 0;
}
else
{
// IOP might be running, so break out if so.
if (psxRegs.iopCycleEE > 0)
{
psxRegs.iopBreak += psxRegs.iopCycleEE; // record the number of cycles the IOP didn't run.
psxRegs.iopCycleEE = 0;
}
}
}
static void recResetEE()