all repos — mgba @ 0f16569e7d89352158ec9ca6ea2dae745802636c

mGBA Game Boy Advance Emulator

GB: Fix eiPending issue
Jeffrey Pfau jeffrey@endrift.com
Mon, 23 May 2016 20:13:51 -0700
commit

0f16569e7d89352158ec9ca6ea2dae745802636c

parent

616625a510a9f9ff265deda9c9a71841853c547f

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -65,7 +65,7 @@ gb->yankedRomSize = 0;

gb->stream = NULL; - gb->eiPending = false; + gb->eiPending = INT_MAX; gb->doubleSpeed = 0; }

@@ -301,12 +301,12 @@ int32_t cycles = cpu->nextEvent;

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) {