diff --git a/content.c b/content.c index 6672d60ec0..3bdc7bb194 100644 --- a/content.c +++ b/content.c @@ -160,6 +160,7 @@ static bool dump_to_file_desperate(const void *data, **/ static bool content_save_state(const char *path) { + retro_ctx_serialize_info_t serial_info; retro_ctx_size_info_t info; bool ret = false; void *data = NULL; @@ -182,7 +183,10 @@ static bool content_save_state(const char *path) msg_hash_to_str(MSG_STATE_SIZE), (int)info.size, msg_hash_to_str(MSG_BYTES)); - ret = core.retro_serialize(data, info.size); + + serial_info.data = data; + serial_info.size = info.size; + ret = core_ctl(CORE_CTL_RETRO_SERIALIZE, &serial_info); if (ret) ret = retro_write_file(path, data, info.size); @@ -210,6 +214,7 @@ static bool content_load_state(const char *path) { unsigned i; ssize_t size; + retro_ctx_serialize_info_t serial_info; unsigned num_blocks = 0; void *buf = NULL; struct sram_block *blocks = NULL; @@ -263,7 +268,9 @@ static bool content_load_state(const char *path) } } - ret = core.retro_unserialize(buf, size); + serial_info.data_const = buf; + serial_info.size = size; + ret = core_ctl(CORE_CTL_RETRO_UNSERIALIZE, &serial_info); /* Flush back. */ for (i = 0; i < num_blocks; i++) diff --git a/libretro_version_1.c b/libretro_version_1.c index ff1fc1a1f3..b1a2811f06 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -177,7 +177,8 @@ bool core_ctl(enum core_ctl_state state, void *data) retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data; if (!info) return false; - core.retro_unserialize(info->data_const, info->size); + if (!core.retro_unserialize(info->data_const, info->size)) + return false; } break; case CORE_CTL_RETRO_SERIALIZE: @@ -185,7 +186,8 @@ bool core_ctl(enum core_ctl_state state, void *data) retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data; if (!info) return false; - core.retro_serialize(info->data, info->size); + if (!core.retro_serialize(info->data, info->size)) + return false; } break; case CORE_CTL_RETRO_SERIALIZE_SIZE: