GBA: Add function for loading default overrides

This commit is contained in:
Jeffrey Pfau 2015-07-26 18:22:17 -07:00
parent 1300b7570d
commit 5c6f8e3799
3 changed files with 11 additions and 7 deletions

View File

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

View File

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

View File

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