Properly reset after loading BIOS

This commit is contained in:
Jeffrey Pfau 2014-10-19 05:41:35 -07:00
parent 29337a60b5
commit f1afeae74c
2 changed files with 4 additions and 3 deletions

View File

@ -114,7 +114,6 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
GBACreate(&gba); GBACreate(&gba);
ARMSetComponents(&cpu, &gba.d, numComponents, components); ARMSetComponents(&cpu, &gba.d, numComponents, components);
ARMInit(&cpu); ARMInit(&cpu);
ARMReset(&cpu);
threadContext->gba = &gba; threadContext->gba = &gba;
gba.sync = &threadContext->sync; gba.sync = &threadContext->sync;
gba.logLevel = threadContext->logLevel; gba.logLevel = threadContext->logLevel;
@ -145,6 +144,8 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
} }
} }
ARMReset(&cpu);
if (threadContext->debugger) { if (threadContext->debugger) {
threadContext->debugger->log = GBADebuggerLogShim; threadContext->debugger->log = GBADebuggerLogShim;
GBAAttachDebugger(&gba, threadContext->debugger); GBAAttachDebugger(&gba, threadContext->debugger);

View File

@ -427,8 +427,8 @@ void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
GBALog(gba, GBA_LOG_WARN, "BIOS checksum incorrect"); GBALog(gba, GBA_LOG_WARN, "BIOS checksum incorrect");
} }
gba->biosChecksum = checksum; gba->biosChecksum = checksum;
if ((gba->cpu->gprs[ARM_PC] >> BASE_OFFSET) == BASE_BIOS) { if (gba->memory.activeRegion == REGION_BIOS) {
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]); gba->cpu->memory.activeRegion = gba->memory.bios;
} }
// TODO: error check // TODO: error check
} }