all repos — mgba @ 5c6f8e3799ae9dd99b02c7805f2d60f4bdaf38a5

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

5c6f8e3799ae9dd99b02c7805f2d60f4bdaf38a5

parent

1300b7570dafd8f204202d74f3d62c177b87436b

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

jump to
M src/gba/supervisor/overrides.csrc/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.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

@@ -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;