SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit aa421258b846273b4e21a9858daa06a51c5a55d7 parent 13a1e9d332e5fce328e9850da8f94215897e7e87 Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 16 Jan 2021 14:51:06 +0200 Update the model enum so comparisons work correctly for SGB PAL and no-SFC SGBs Diffstat:
| M | Core/gb.h | 9 | +++++++-- |
| M | Core/save_state.c | 10 | ++++++++++ |
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git 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 @@ -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;
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.