GBA: Implement more game removal pieces

This commit is contained in:
Jeffrey Pfau 2015-06-19 22:28:02 -07:00
parent 8538e99a08
commit 289e9b0cf1
2 changed files with 18 additions and 14 deletions

View File

@ -140,6 +140,11 @@ void GBAReset(struct ARMCore* cpu) {
if (!gba->rr || (!gba->rr->isPlaying(gba->rr) && !gba->rr->isRecording(gba->rr))) {
GBASavedataUnmask(&gba->memory.savedata);
}
if (gba->yankedRomSize) {
gba->memory.romSize = gba->yankedRomSize;
gba->yankedRomSize = 0;
}
GBAMemoryReset(gba);
GBAVideoReset(&gba->video);
GBAAudioReset(&gba->audio);
@ -389,6 +394,7 @@ void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char
void GBAYankROM(struct GBA* gba) {
gba->yankedRomSize = gba->memory.romSize;
gba->memory.romSize = 0;
GBARaiseIRQ(gba, IRQ_GAMEPAK);
}
void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
@ -497,10 +503,6 @@ void GBAWriteIE(struct GBA* gba, uint16_t value) {
GBALog(gba, GBA_LOG_STUB, "Keypad interrupts not implemented");
}
if (value & (1 << IRQ_GAMEPAK)) {
GBALog(gba, GBA_LOG_STUB, "Gamepak interrupts not implemented");
}
if (gba->memory.io[REG_IME >> 1] && value & gba->memory.io[REG_IF >> 1]) {
ARMRaiseIRQ(gba->cpu);
}
@ -670,7 +672,9 @@ void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) {
void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
struct GBA* gba = (struct GBA*) cpu->master;
GBALog(gba, GBA_LOG_WARN, "Illegal opcode: %08x", opcode);
if (!gba->yankedRomSize) {
GBALog(gba, GBA_LOG_WARN, "Illegal opcode: %08x", opcode);
}
if (gba->debugger) {
struct DebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu),

View File

@ -18,7 +18,7 @@
static uint32_t _popcount32(unsigned bits);
static void _pristineCow(struct GBA* gba);
static uint32_t _deadbeef[1] = { 0xF00FC7C8 };
static uint32_t _deadbeef[1] = { 0xE710B710 }; // Illegal instruction on both ARM and Thumb
static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t region);
static void GBAMemoryServiceDMA(struct GBA* gba, int number, struct GBADMA* info);
@ -270,20 +270,20 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
}
// Fall through
default:
memory->activeRegion = 0;
memory->activeRegion = -1;
cpu->memory.activeRegion = _deadbeef;
cpu->memory.activeMask = 0;
if (!gba->yankedRomSize) {
GBALog(gba, GBA_LOG_FATAL, "Jumped to invalid address");
}
break;
return;
}
cpu->memory.activeSeqCycles32 = memory->waitstatesPrefetchSeq32[memory->activeRegion];
cpu->memory.activeSeqCycles16 = memory->waitstatesPrefetchSeq16[memory->activeRegion];
cpu->memory.activeNonseqCycles32 = memory->waitstatesPrefetchNonseq32[memory->activeRegion];
cpu->memory.activeNonseqCycles16 = memory->waitstatesPrefetchNonseq16[memory->activeRegion];
cpu->memory.activeUncachedCycles32 = memory->waitstatesNonseq32[memory->activeRegion];
cpu->memory.activeUncachedCycles16 = memory->waitstatesNonseq16[memory->activeRegion];
cpu->memory.activeSeqCycles32 = memory->waitstatesPrefetchSeq32[newRegion];
cpu->memory.activeSeqCycles16 = memory->waitstatesPrefetchSeq16[newRegion];
cpu->memory.activeNonseqCycles32 = memory->waitstatesPrefetchNonseq32[newRegion];
cpu->memory.activeNonseqCycles16 = memory->waitstatesPrefetchNonseq16[newRegion];
cpu->memory.activeUncachedCycles32 = memory->waitstatesNonseq32[newRegion];
cpu->memory.activeUncachedCycles16 = memory->waitstatesNonseq16[newRegion];
}
#define LOAD_BAD \