From 02b814d3bb803e38056829a14be9e17b2dedbfd8 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 30 Mar 2021 21:25:08 -0700 Subject: [PATCH] GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks --- CHANGES | 1 + src/gba/overrides.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGES b/CHANGES index e43252115..b4884b405 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Other fixes: - GBA: Fix non-USA 1.0 FireRed misdetecting as a ROM hack (fixes mgba.io/i/2100) - GBA: Fix crash when ROM loading fails Misc: + - GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks - Qt: Add ROM filename and size to bug reporter 0.9.0: (2021-03-28) diff --git a/src/gba/overrides.c b/src/gba/overrides.c index bb88e57e6..a84ccd2de 100644 --- a/src/gba/overrides.c +++ b/src/gba/overrides.c @@ -376,6 +376,14 @@ void GBAOverrideApplyDefaults(struct GBA* gba, const struct Configuration* overr memcpy(override.id, &cart->id, sizeof(override.id)); static const uint32_t pokemonTable[] = { + // Emerald + 0x4881F3F8, // BPEJ + 0x8C4D3108, // BPES + 0x1F1C08FB, // BPEE + 0x34C9DF89, // BPED + 0xA3FDCCB1, // BPEF + 0xA0AEC80A, // BPEI + // FireRed 0x1A81EEDF, // BPRD 0x3B2056E9, // BPRJ @@ -385,10 +393,17 @@ void GBAOverrideApplyDefaults(struct GBA* gba, const struct Configuration* overr 0x9F08064E, // BPRS 0xBB640DF7, // BPRJ rev 1 0xDD88761C, // BPRE + + // Ruby + 0x61641576, // AXVE rev 1 + 0xAEAC73E6, // AXVE rev 2 + 0xF0815EE7, // AXVE }; bool isPokemon = false; isPokemon = isPokemon || !strncmp("pokemon red version", &((const char*) gba->memory.rom)[0x108], 20); + isPokemon = isPokemon || !strncmp("pokemon emerald version", &((const char*) gba->memory.rom)[0x108], 24); + isPokemon = isPokemon || !strncmp("AXVE", &((const char*) gba->memory.rom)[0xAC], 4); bool isKnownPokemon = false; if (isPokemon) { size_t i;