Last active
August 29, 2015 14:08
-
-
Save Alcaro/3c1231d88f43f07ba8e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/libretro-v2.h | |
+++ b/libretro-v2.h | |
@@ -1890,18 +1890,32 @@ void retro_reset(struct retro_core_data *core_handle); | |
*/ | |
void retro_run(struct retro_core_data *core_handle); | |
+enum retro_serialize_type { | |
+ RETRO_SERIALIZE_TYPE_SRAM = 0, /* This refers to save data. */ | |
+ RETRO_SERIALIZE_TYPE_SAVESTATE, /* This refers to all internal core state. */ | |
+ | |
+ RETRO_SERIALIZE_TYPE_DUMMY = INT_MAX | |
+}; | |
/* Returns the amount of data the implementation requires to serialize | |
- * internal state (save states). | |
+ * the given data type. | |
* Between calls to retro_load_game() and retro_unload_game(), the | |
- * returned size is never allowed to be larger than a previous returned | |
+ * returned size for a certain type is never allowed to be larger than a previous returned | |
* value, to ensure that the frontend can allocate a save state buffer once. | |
*/ | |
-size_t retro_serialize_size(struct retro_core_data *core_handle); | |
+size_t retro_serialize_size(enum retro_serialize_type type, bool *can_detect_changes, struct retro_core_data *core_handle); | |
/* Serializes internal state. If failed, or size is lower than | |
- * retro_serialize_size(), it should return false, true otherwise. */ | |
-bool retro_serialize(void *data, size_t size, struct retro_core_data *core_handle); | |
-bool retro_unserialize(const void *data, size_t size, struct retro_core_data *core_handle); | |
+ * retro_serialize_size(), it should return false, true otherwise. | |
+ * If the core can detect when its SRAM is changed, the front will call this with data==NULL, and the core will return success if the data is unchanged. | |
+ * A core is allowed, but not required, to accept serialization data with different size than what retro_serialize_size returns, both bigger and smaller, if the size changes between versions of the core and the core wants to be able to load old data. */ | |
+bool retro_serialize(enum retro_serialize_type type, void *data, size_t size, struct retro_core_data *core_handle); | |
+bool retro_unserialize(enum retro_serialize_type type, const void *data, size_t size, struct retro_core_data *core_handle); | |
/* Loads a game. The returned value is a valid | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment