GB: Fix DI

This commit is contained in:
Jeffrey Pfau 2016-01-27 21:41:44 -08:00
parent dbdd61cdcd
commit 213ba29964
2 changed files with 7 additions and 8 deletions

View File

@ -54,7 +54,7 @@ static void GBInit(struct LR35902Core* cpu, struct LR35902Component* component)
gb->pristineRomSize = 0; gb->pristineRomSize = 0;
gb->yankedRomSize = 0; gb->yankedRomSize = 0;
gb->eiPending = false; gb->diPending = false;
} }
bool GBLoadROM(struct GB* gb, struct VFile* vf, struct VFile* sav, const char* fname) { bool GBLoadROM(struct GB* gb, struct VFile* vf, struct VFile* sav, const char* fname) {
@ -201,10 +201,9 @@ void GBProcessEvents(struct LR35902Core* cpu) {
int32_t nextEvent = INT_MAX; int32_t nextEvent = INT_MAX;
int32_t testEvent; int32_t testEvent;
if (gb->eiPending) { if (gb->diPending) {
gb->memory.ime = true; gb->memory.ime = false;
GBUpdateIRQs(gb); gb->diPending = false;
gb->eiPending = false;
} }
testEvent = GBVideoProcessEvents(&gb->video, cycles); testEvent = GBVideoProcessEvents(&gb->video, cycles);
@ -233,14 +232,14 @@ void GBProcessEvents(struct LR35902Core* cpu) {
void GBSetInterrupts(struct LR35902Core* cpu, bool enable) { void GBSetInterrupts(struct LR35902Core* cpu, bool enable) {
struct GB* gb = (struct GB*) cpu->master; struct GB* gb = (struct GB*) cpu->master;
if (!enable) { if (enable) {
gb->memory.ime = enable; gb->memory.ime = enable;
GBUpdateIRQs(gb); GBUpdateIRQs(gb);
} else { } else {
if (cpu->nextEvent > 4) { if (cpu->nextEvent > 4) {
cpu->nextEvent = 4; cpu->nextEvent = 4;
} }
gb->eiPending = true; gb->diPending = true;
} }
} }

View File

@ -58,7 +58,7 @@ struct GB {
const char* activeFile; const char* activeFile;
bool eiPending; bool diPending;
}; };
struct GBCartridge { struct GBCartridge {