From 6d4527441663c9254486ea694661189e71b6e4aa Mon Sep 17 00:00:00 2001 From: bladeoner Date: Sat, 19 Jan 2019 08:43:22 +0100 Subject: [PATCH] Backport Only allow instantaneous IRQ when toggling IRQ completely --- source/snes9x/ppu.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/snes9x/ppu.cpp b/source/snes9x/ppu.cpp index 6f8090f..c2925e4 100644 --- a/source/snes9x/ppu.cpp +++ b/source/snes9x/ppu.cpp @@ -1382,7 +1382,13 @@ void S9xSetCPU (uint8 Byte, uint16 Address) } if ((Byte & 0x30) != (Memory.FillRAM[0x4200] & 0x30)) - S9xUpdateIRQPositions(true); + { + // Only allow instantaneous IRQ if turning it completely on or off + if ((Byte & 0x30) == 0 || (Memory.FillRAM[0x4200] & 0x30) == 0) + S9xUpdateIRQPositions(true); + else + S9xUpdateIRQPositions(false); + } // NMI can trigger immediately during VBlank as long as NMI_read ($4210) wasn't cleard. if ((Byte & 0x80) && !(Memory.FillRAM[0x4200] & 0x80) &&