diff --git a/Core/gb.h b/Core/gb.h index c2e96db6..50987a04 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -31,8 +31,13 @@ #define GB_MODEL_DMG_FAMILY 0x000 #define GB_MODEL_MGB_FAMILY 0x100 #define GB_MODEL_CGB_FAMILY 0x200 -#define GB_MODEL_PAL_BIT 0x1000 -#define GB_MODEL_NO_SFC_BIT 0x2000 +#define GB_MODEL_PAL_BIT 0x40 +#define GB_MODEL_NO_SFC_BIT 0x80 + +#ifdef GB_INTERNAL +#define GB_MODEL_PAL_BIT_OLD 0x1000 +#define GB_MODEL_NO_SFC_BIT_OLD 0x2000 +#endif #ifdef GB_INTERNAL #if __clang__ diff --git a/Core/save_state.c b/Core/save_state.c index 827cf575..2b31ba3b 100644 --- a/Core/save_state.c +++ b/Core/save_state.c @@ -163,6 +163,16 @@ static bool verify_and_update_state_compatibility(GB_gameboy_t *gb, GB_gameboy_t } } + if (save->model & GB_MODEL_PAL_BIT_OLD) { + save->model &= ~GB_MODEL_PAL_BIT_OLD; + save->model |= GB_MODEL_PAL_BIT; + } + + if (save->model & GB_MODEL_NO_SFC_BIT_OLD) { + save->model &= ~GB_MODEL_NO_SFC_BIT_OLD; + save->model |= GB_MODEL_NO_SFC_BIT; + } + if (gb->version != save->version) { GB_log(gb, "The save state is for a different version of SameBoy.\n"); return false;