all repos — mgba @ 818bde5869d09f8ea502697bb86eb23568771c22

mGBA Game Boy Advance Emulator

GBA: Add function for loading default overrides
Jeffrey Pfau jeffrey@endrift.com
Sun, 26 Jul 2015 18:22:17 -0700
commit

818bde5869d09f8ea502697bb86eb23568771c22

parent

f5092737ff65837d00b7e71f89b3e2396260adce

3 files changed, 11 insertions(+), 7 deletions(-)

jump to
M src/gba/supervisor/overrides.csrc/gba/supervisor/overrides.c

@@ -300,3 +300,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.hsrc/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.csrc/platform/libretro/libretro.c

@@ -235,13 +235,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;