From 5b395aafe0a45fda0ce5a4944d589799e5c186eb Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 9 Sep 2017 11:42:45 -0700 Subject: [PATCH] =?UTF-8?q?GBA:=20Detect=20hardware=20for=20Pok=C3=A9mon?= =?UTF-8?q?=20FireRed=20ROM=20hacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES | 1 + src/gba/core.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 89c590062..ab6afa272 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ Bugfixes: Misc: - Qt: Don't rebuild library view if style hasn't changed - SDL: Fix 2.0.5 build on macOS under some circumstances + - GBA: Detect hardware for Pokémon FireRed ROM hacks 0.6.0: (2017-07-16) Features: diff --git a/src/gba/core.c b/src/gba/core.c index 10425e645..6736af8eb 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -385,11 +385,16 @@ static void _GBACoreReset(struct mCore* core) { const struct GBACartridge* cart = (const struct GBACartridge*) gba->memory.rom; if (cart) { memcpy(override.id, &cart->id, sizeof(override.id)); - if (GBAOverrideFind(gbacore->overrides, &override)) { + + if (!strncmp("pokemon red version", &((const char*) gba->memory.rom)[0x108], 20) && gba->romCrc32 != 0xDD88761C) { + // Enable FLASH1M and RTC on Pokémon FireRed ROM hacks + override.savetype = SAVEDATA_FLASH1M; + override.hardware = HW_RTC; + GBAOverrideApply(gba, &override); + } else if (GBAOverrideFind(gbacore->overrides, &override)) { GBAOverrideApply(gba, &override); } } - #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 if (!gba->biosVf && core->opts.useBios) { struct VFile* bios = NULL;