GBA: Add function for loading default overrides
Jeffrey Pfau jeffrey@endrift.com
Sun, 26 Jul 2015 18:22:17 -0700
3 files changed,
11 insertions(+),
7 deletions(-)
M
src/gba/supervisor/overrides.c
→
src/gba/supervisor/overrides.c
@@ -294,3 +294,12 @@ gba->idleOptimization = IDLE_LOOP_REMOVE;
} } } + +void GBAOverrideApplyDefaults(struct GBA* gba) { + struct GBACartridgeOverride override; + const struct GBACartridge* cart = (const struct GBACartridge*) gba->memory.rom; + memcpy(override.id, &cart->id, sizeof(override.id)); + if (GBAOverrideFind(0, &override)) { + GBAOverrideApply(gba, &override); + } +}
M
src/gba/supervisor/overrides.h
→
src/gba/supervisor/overrides.h
@@ -25,5 +25,6 @@ void GBAOverrideSave(struct Configuration*, const struct GBACartridgeOverride* override);
struct GBA; void GBAOverrideApply(struct GBA*, const struct GBACartridgeOverride*); +void GBAOverrideApplyDefaults(struct GBA*); #endif
M
src/platform/libretro/libretro.c
→
src/platform/libretro/libretro.c
@@ -198,13 +198,7 @@ savedata = malloc(SIZE_CART_FLASH1M);
save = VFileFromMemory(savedata, SIZE_CART_FLASH1M); GBALoadROM(&gba, rom, save, game->path); - - struct GBACartridgeOverride override; - const struct GBACartridge* cart = (const struct GBACartridge*) gba.memory.rom; - memcpy(override.id, &cart->id, sizeof(override.id)); - if (GBAOverrideFind(0, &override)) { - GBAOverrideApply(&gba, &override); - } + GBAOverrideApplyDefaults(&gba); ARMReset(&cpu); return true;