mirror of https://github.com/mgba-emu/mgba.git
GB: Fix HALT bug
This commit is contained in:
parent
1db01d652b
commit
35be6c121b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue