mirror of https://github.com/mgba-emu/mgba.git
GB, GBA: Unload cheats when unloading ROM
This commit is contained in:
parent
836051ee32
commit
891a607507
|
@ -194,6 +194,14 @@ static bool _GBCoreLoadPatch(struct mCore* core, struct VFile* vf) {
|
|||
}
|
||||
|
||||
static void _GBCoreUnloadROM(struct mCore* core) {
|
||||
struct GBCore* gbcore = (struct GBCore*) core;
|
||||
struct LR35902Core* cpu = core->cpu;
|
||||
if (gbcore->cheatDevice) {
|
||||
LR35902HotplugDetach(cpu, CPU_COMPONENT_CHEAT_DEVICE);
|
||||
cpu->components[CPU_COMPONENT_CHEAT_DEVICE] = NULL;
|
||||
mCheatDeviceDestroy(gbcore->cheatDevice);
|
||||
gbcore->cheatDevice = NULL;
|
||||
}
|
||||
return GBUnloadROM(core->board);
|
||||
}
|
||||
|
||||
|
@ -455,7 +463,9 @@ static void _GBCoreAttachDebugger(struct mCore* core, struct mDebugger* debugger
|
|||
|
||||
static void _GBCoreDetachDebugger(struct mCore* core) {
|
||||
struct LR35902Core* cpu = core->cpu;
|
||||
LR35902HotplugDetach(cpu, CPU_COMPONENT_DEBUGGER);
|
||||
if (core->debugger) {
|
||||
LR35902HotplugDetach(cpu, CPU_COMPONENT_DEBUGGER);
|
||||
}
|
||||
cpu->components[CPU_COMPONENT_DEBUGGER] = NULL;
|
||||
core->debugger = NULL;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,14 @@ static bool _GBACoreLoadPatch(struct mCore* core, struct VFile* vf) {
|
|||
}
|
||||
|
||||
static void _GBACoreUnloadROM(struct mCore* core) {
|
||||
struct GBACore* gbacore = (struct GBACore*) core;
|
||||
struct ARMCore* cpu = core->cpu;
|
||||
if (gbacore->cheatDevice) {
|
||||
ARMHotplugDetach(cpu, CPU_COMPONENT_CHEAT_DEVICE);
|
||||
cpu->components[CPU_COMPONENT_CHEAT_DEVICE] = NULL;
|
||||
mCheatDeviceDestroy(gbacore->cheatDevice);
|
||||
gbacore->cheatDevice = NULL;
|
||||
}
|
||||
return GBAUnloadROM(core->board);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue