From 37954fe510393e3a7e9557e2b68ad5ca0cd34326 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 26 May 2018 17:02:57 -0500 Subject: [PATCH] Fix some IRQ bits. --- cpuexec.cpp | 2 +- ppu.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpuexec.cpp b/cpuexec.cpp index 358d0f00..cdcc2a91 100644 --- a/cpuexec.cpp +++ b/cpuexec.cpp @@ -229,7 +229,7 @@ void S9xMainLoop (void) } } - if (CPU.Cycles >= Timings.NextIRQTimer || CPU.IRQExternal) + if ((CPU.Cycles >= Timings.NextIRQTimer || CPU.IRQExternal) && !CPU.IRQLine) { if (CPU.IRQPending) CPU.IRQPending--; diff --git a/ppu.cpp b/ppu.cpp index 4a2578dd..9cab99f1 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -312,7 +312,7 @@ void S9xUpdateIRQPositions (void) PPU.VTimerPosition = PPU.IRQVBeamPos; - if ((PPU.HTimerPosition >= Timings.H_Max) && (PPU.IRQHBeamPos < 340)) + if ((PPU.HTimerPosition >= Timings.H_Max) && (PPU.IRQHBeamPos < 340) && PPU.HTimerEnabled) { PPU.HTimerPosition -= Timings.H_Max; PPU.VTimerPosition++; @@ -336,7 +336,7 @@ void S9xUpdateIRQPositions (void) if (CPU.V_Counter == PPU.VTimerPosition) Timings.NextIRQTimer = 0; else - Timings.NextIRQTimer = CyclesUntilNext (0, PPU.VTimerPosition); + Timings.NextIRQTimer = CyclesUntilNext (ONE_DOT_CYCLE + Timings.IRQTriggerCycles, PPU.VTimerPosition); } else {