GB, GBA Core: Ensure the core is halted even if a state is not loaded
Vicki Pfau vi@endrift.com
Mon, 24 Apr 2017 13:14:31 -0700
2 files changed,
10 insertions(+),
0 deletions(-)
M
src/gb/core.c
→
src/gb/core.c
@@ -792,6 +792,11 @@
LR35902Reset(core->cpu); mVideoLogContextRewind(gbcore->logContext, core); GBVideoProxyRendererShim(&gb->video, &gbcore->proxyRenderer); + + // Make sure CPU loop never spins + GBHalt(gb->cpu); + gb->memory.ie = 0; + gb->memory.ime = false; } static bool _GBVLPLoadROM(struct mCore* core, struct VFile* vf) {
M
src/gba/core.c
→
src/gba/core.c
@@ -811,6 +811,11 @@
ARMReset(core->cpu); mVideoLogContextRewind(gbacore->logContext, core); GBAVideoProxyRendererShim(&gba->video, &gbacore->proxyRenderer); + + // Make sure CPU loop never spins + GBAHalt(gba); + gba->cpu->memory.store16(gba->cpu, BASE_IO | REG_IME, 0, NULL); + gba->cpu->memory.store16(gba->cpu, BASE_IO | REG_IE, 0, NULL); } static bool _GBAVLPLoadROM(struct mCore* core, struct VFile* vf) {