mirror of https://github.com/PCSX2/pcsx2.git
INTC: Give grace period after event for reading INTC
If a game is in a tight loop waiting for a bit of INTC, we could skip a bunch of cycles incorrectly.
This commit is contained in:
parent
44b672b6f5
commit
02ac3943f2
|
@ -30,7 +30,7 @@ static __fi void IntCHackCheck()
|
|||
// Sanity check: To protect from accidentally "rewinding" the cyclecount
|
||||
// on the few times nextBranchCycle can be behind our current cycle.
|
||||
s32 diff = g_nextEventCycle - cpuRegs.cycle;
|
||||
if( diff > 0 ) cpuRegs.cycle = g_nextEventCycle;
|
||||
if (diff > 0 && (cpuRegs.cycle - g_lastEventCycle) > 8) cpuRegs.cycle = g_nextEventCycle;
|
||||
}
|
||||
|
||||
template< uint page > RETURNS_R128 _hwRead128(u32 mem);
|
||||
|
|
|
@ -365,14 +365,14 @@ static bool cpuIntsEnabled(int Interrupt)
|
|||
|
||||
// if cpuRegs.cycle is greater than this cycle, should check cpuEventTest for updates
|
||||
u32 g_nextEventCycle = 0;
|
||||
|
||||
u32 g_lastEventCycle = 0;
|
||||
// Shared portion of the branch test, called from both the Interpreter
|
||||
// and the recompiler. (moved here to help alleviate redundant code)
|
||||
__fi void _cpuEventTest_Shared()
|
||||
{
|
||||
eeEventTestIsActive = true;
|
||||
g_nextEventCycle = cpuRegs.cycle + eeWaitCycles;
|
||||
|
||||
g_lastEventCycle = cpuRegs.cycle;
|
||||
// ---- INTC / DMAC (CPU-level Exceptions) -----------------
|
||||
// Done first because exceptions raised during event tests need to be postponed a few
|
||||
// cycles (fixes Grandia II [PAL], which does a spin loop on a vsync and expects to
|
||||
|
@ -387,7 +387,7 @@ __fi void _cpuEventTest_Shared()
|
|||
// escape/suspend hooks, and it's really a good idea to suspend/resume emulation before
|
||||
// doing any actual meaningful branchtest logic.
|
||||
|
||||
if( cpuTestCycle( nextsCounter, nextCounter ) )
|
||||
if ( cpuTestCycle( nextsCounter, nextCounter ) )
|
||||
{
|
||||
rcntUpdate();
|
||||
_cpuTestPERF();
|
||||
|
|
|
@ -260,6 +260,7 @@ alignas(16) extern fpuRegisters fpuRegs;
|
|||
alignas(16) extern tlbs tlb[48];
|
||||
|
||||
extern u32 g_nextEventCycle;
|
||||
extern u32 g_lastEventCycle;
|
||||
extern bool eeEventTestIsActive;
|
||||
extern u32 s_iLastCOP0Cycle;
|
||||
extern u32 s_iLastPERFCycle[2];
|
||||
|
|
Loading…
Reference in New Issue