From bf9017c89bc8a008a3afbd68d58851fb10f1f473 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 21 Sep 2016 14:11:24 -0700 Subject: [PATCH] LR35902: Fix events running with the wrong cycle active --- CHANGES | 1 + src/lr35902/lr35902.c | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 13cb0f984..a5f268e3c 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Bugfixes: - Qt: Fix saving overrides - FFmpeg: Fix encoding AAC - GB Video: Fix video frames getting missed when LCDC is off + - LR35902: Fix events running with the wrong cycle active Misc: - All: Only update version info if needed - FFmpeg: Encoding cleanup diff --git a/src/lr35902/lr35902.c b/src/lr35902/lr35902.c index a5782cb71..830e058d2 100644 --- a/src/lr35902/lr35902.c +++ b/src/lr35902/lr35902.c @@ -141,6 +141,7 @@ void LR35902Tick(struct LR35902Core* cpu) { if (cpu->cycles + 2 >= cpu->nextEvent) { int32_t diff = cpu->nextEvent - cpu->cycles; cpu->cycles = cpu->nextEvent; + cpu->executionState += diff; cpu->irqh.processEvents(cpu); cpu->cycles += 2 - diff; } else {