diff --git a/dynamic.c b/dynamic.c index b2ad6bb394..03345d02ca 100644 --- a/dynamic.c +++ b/dynamic.c @@ -1609,17 +1609,20 @@ bool rarch_environment_cb(unsigned cmd, void *data) } case RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS: - core_set_serialization_quirks(*((uint64_t *) data)); + { + uint64_t *quirks = (uint64_t *) data; - /* Zero any unrecognized quirks */ - *((uint64_t *) data) &= ~((uint64_t) - ((RETRO_SERIALIZATION_QUIRK_ARCHITECTURE_DEPENDENT-1) | - RETRO_SERIALIZATION_QUIRK_ARCHITECTURE_DEPENDENT)); + core_set_serialization_quirks(*quirks); - /* And zero variable-sized serialization, which we don't support */ - *((uint64_t *) data) &= ~((uint64_t) RETRO_SERIALIZATION_QUIRK_VARIABLE_SIZE); + /* Zero any unrecognized quirks, and zero unsupported VARIABLE_SIZE */ + *quirks &= (RETRO_SERIALIZATION_QUIRK_INCOMPLETE + |RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE + |RETRO_SERIALIZATION_QUIRK_INITIALIZING + |RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION + |RETRO_SERIALIZATION_QUIRK_ARCHITECTURE_DEPENDENT); break; + } /* Default */ default: diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 7f8e340aa5..59914d2c59 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -976,29 +976,29 @@ struct retro_hw_render_context_negotiation_interface * so it will be used after SET_HW_RENDER, but before the context_reset callback. */ +/* Serialized state is incomplete in some way. Set if serialization is + * usable in typical end-user cases but should not be relied upon to + * implement frame-sensitive frontend features such as netplay or + * rerecording. */ #define RETRO_SERIALIZATION_QUIRK_INCOMPLETE (1 << 0) - /* Serialized state is incomplete in some way. Set if serialization is - * usable in typical end-user cases but should not be relied upon to - * implement frame-sensitive frontend features such as netplay or - * rerecording. */ +/* The core must spend some time initializing before serialization is + * safe. */ #define RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE (1 << 1) - /* The core must spend some time initializing before serialization is - * safe. */ +/* If MUST_INITIALIZE is set, this should also be set if initialization is + * in progress. */ #define RETRO_SERIALIZATION_QUIRK_INITIALIZING (1 << 2) - /* If MUST_INITIALIZE is set, this should also be set if initialization is - * in progress. */ +/* Serialization size may change within a session. */ #define RETRO_SERIALIZATION_QUIRK_VARIABLE_SIZE (1 << 3) - /* Serialization size may change within a session. */ +/* Serialized state can only be loaded during the same session. */ #define RETRO_SERIALIZATION_QUIRK_SINGLE_SESSION (1 << 4) - /* Serialized state can only be loaded during the same session. */ +/* Serialized state cannot be loaded on a different architecture from the + * one it was saved on. */ #define RETRO_SERIALIZATION_QUIRK_ARCHITECTURE_DEPENDENT (1 << 5) - /* Serialized state cannot be loaded on a different architecture from the - * one it was saved on. */ #define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44 /* uint64_t * -- * Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't - * recognize or support. + * recognize or support. Should be set during retro_init or retro_load_game. */