From 5923013d659f5b45eeef7660607c853673559c96 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Fri, 13 May 2016 20:21:19 +0200 Subject: [PATCH] Simple workaround for timing issue with coreState after syscall. Also fixes off by one in ForceCheck. --- Core/CoreTiming.cpp | 4 ++-- Core/MIPS/IR/IRInterpreter.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 8e816fcc4..feece5e5b 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -567,10 +567,10 @@ void MoveEvents() void ForceCheck() { - int cyclesExecuted = slicelength - currentMIPS->downcount; + int cyclesExecuted = slicelength - currentMIPS->downcount + 1; globalTimer += cyclesExecuted; // This will cause us to check for new events immediately. - currentMIPS->downcount = 0; + currentMIPS->downcount = -1; // But let's not eat a bunch more time in Advance() because of this. slicelength = 0; } diff --git a/Core/MIPS/IR/IRInterpreter.cpp b/Core/MIPS/IR/IRInterpreter.cpp index 07ce9e1d7..c0bcdb91c 100644 --- a/Core/MIPS/IR/IRInterpreter.cpp +++ b/Core/MIPS/IR/IRInterpreter.cpp @@ -10,6 +10,8 @@ #include "Core/HLE/ReplaceTables.h" #include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/MIPSVFPUUtils.h" +#include "Core/System.h" +#include "Core/CoreTiming.h" #include "math/math_util.h" #include "Common/CommonTypes.h" @@ -583,6 +585,8 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst, const u32 *constPool, int c { MIPSOpcode op(constPool[inst->src1]); CallSyscall(op); + if (coreState != CORE_RUNNING) + CoreTiming::ForceCheck(); return mips->pc; }