all repos — mgba @ 91491e704e21343f8d7a908d1a8119cafecd6de2

mGBA Game Boy Advance Emulator

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
commit

91491e704e21343f8d7a908d1a8119cafecd6de2

parent

5cda42077c114080b6b91dd7ece27fb12b08d7c8

2 files changed, 10 insertions(+), 0 deletions(-)

jump to
M src/gb/core.csrc/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.csrc/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) {