all repos — mgba @ 207219b25e8a770e2cb58d72ceefee4f9b388245

mGBA Game Boy Advance Emulator

Libretro: Use predefined overrides
Jeffrey Pfau jeffrey@endrift.com
Mon, 09 Mar 2015 21:18:00 -0700
commit

207219b25e8a770e2cb58d72ceefee4f9b388245

parent

11f0e690f8bbc7a3d7dcf5257027f7038fed8ec0

1 files changed, 14 insertions(+), 0 deletions(-)

jump to
M src/platform/libretro/libretro.csrc/platform/libretro/libretro.c

@@ -1,8 +1,14 @@

+/* Copyright (c) 2013-2015 Jeffrey Pfau + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "libretro.h" #include "gba/gba.h" #include "gba/renderers/video-software.h" #include "gba/serialize.h" +#include "gba/supervisor/overrides.h" #include "gba/video.h" #include "util/vfs.h"

@@ -177,6 +183,14 @@ 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); + } + ARMReset(&cpu); return true; }