GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks

This commit is contained in:
Vicki Pfau 2021-03-30 21:25:08 -07:00
parent 0cde0fcc19
commit 85b4bb1400
2 changed files with 16 additions and 0 deletions

View File

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

View File

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