GB: Fix HALT bug

This commit is contained in:
Vicki Pfau 2020-06-06 17:57:26 -07:00
parent 1db01d652b
commit 35be6c121b
2 changed files with 3 additions and 3 deletions

View File

@ -1082,9 +1082,9 @@ static void _GBVLPReset(struct mCore* core) {
GBVideoProxyRendererShim(&gb->video, &gbcore->proxyRenderer);
// Make sure CPU loop never spins
GBHalt(gb->cpu);
gb->memory.ie = 0;
gb->memory.ime = false;
GBHalt(gb->cpu);
}
static bool _GBVLPLoadROM(struct mCore* core, struct VFile* vf) {
@ -1115,9 +1115,9 @@ static bool _GBVLPLoadState(struct mCore* core, const void* buffer) {
GBAudioReset(&gb->audio);
// Make sure CPU loop never spins
GBHalt(gb->cpu);
gb->memory.ie = 0;
gb->memory.ime = false;
GBHalt(gb->cpu);
return true;
}

View File

@ -749,7 +749,7 @@ void GBHalt(struct SM83Core* cpu) {
if (!(gb->memory.ie & gb->memory.io[REG_IF] & 0x1F)) {
cpu->cycles = cpu->nextEvent;
cpu->halted = true;
} else {
} else if (!gb->memory.ime) {
mLOG(GB, GAME_ERROR, "HALT bug");
cpu->executionState = SM83_CORE_HALT_BUG;
}