From 0f16569e7d89352158ec9ca6ea2dae745802636c Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 23 May 2016 20:13:51 -0700 Subject: [PATCH] GB: Fix eiPending issue --- src/gb/gb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gb/gb.c b/src/gb/gb.c index c14051a52..f739d78b7 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -65,7 +65,7 @@ static void GBInit(void* cpu, struct mCPUComponent* component) { gb->stream = NULL; - gb->eiPending = false; + gb->eiPending = INT_MAX; gb->doubleSpeed = 0; } @@ -301,12 +301,12 @@ void GBProcessEvents(struct LR35902Core* cpu) { int32_t nextEvent = INT_MAX; int32_t testEvent; - if (gb->eiPending) { + if (gb->eiPending != INT_MAX) { gb->eiPending -= cycles; if (gb->eiPending <= 0) { gb->memory.ime = true; GBUpdateIRQs(gb); - gb->eiPending = 0; + gb->eiPending = INT_MAX; } } @@ -349,7 +349,7 @@ void GBSetInterrupts(struct LR35902Core* cpu, bool enable) { struct GB* gb = (struct GB*) cpu->master; if (!enable) { gb->memory.ime = enable; - gb->eiPending = 0; + gb->eiPending = INT_MAX; GBUpdateIRQs(gb); } else { if (cpu->nextEvent > cpu->cycles + 4) {