mirror of https://github.com/mgba-emu/mgba.git
GBA: Add function for loading default overrides
This commit is contained in:
parent
1300b7570d
commit
5c6f8e3799
|
@ -294,3 +294,12 @@ void GBAOverrideApply(struct GBA* gba, const struct GBACartridgeOverride* overri
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,5 +25,6 @@ void GBAOverrideSave(struct Configuration*, const struct GBACartridgeOverride* o
|
|||
|
||||
struct GBA;
|
||||
void GBAOverrideApply(struct GBA*, const struct GBACartridgeOverride*);
|
||||
void GBAOverrideApplyDefaults(struct GBA*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -198,13 +198,7 @@ bool retro_load_game(const struct retro_game_info* game) {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue