From a08f4fb53137f4c51ebe72bc0515536caefaa26e Mon Sep 17 00:00:00 2001 From: OV2 Date: Mon, 4 Jun 2012 21:31:27 +0200 Subject: [PATCH] Reroll IRQ edge case fix --- cpuexec.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cpuexec.h b/cpuexec.h index 1ffd5737..8d201d01 100644 --- a/cpuexec.h +++ b/cpuexec.h @@ -278,10 +278,9 @@ static inline void S9xCheckInterrupts (void) if (CPU.IRQLine && thisIRQ) CPU.IRQTransition = TRUE; - int32 htimepos = PPU.HTimerEnabled ? PPU.HTimerPosition : 10; - - if (thisIRQ) + if (PPU.HTimerEnabled) { + int32 htimepos = PPU.HTimerPosition; if (CPU.Cycles >= Timings.H_Max && htimepos < CPU.PrevCycles) htimepos += Timings.H_Max; @@ -292,7 +291,7 @@ static inline void S9xCheckInterrupts (void) if (PPU.VTimerEnabled) { int32 vcounter = CPU.V_Counter; - if (htimepos >= Timings.H_Max) + if (CPU.Cycles >= Timings.H_Max && (!PPU.HTimerEnabled || PPU.HTimerPosition < CPU.PrevCycles)) vcounter++; if (vcounter != PPU.VTimerPosition)