fix undo load state (#12062)

This commit is contained in:
Jamiras 2021-02-21 13:50:27 -08:00 committed by GitHub
parent c43b0f53bf
commit 1e39de800c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -422,7 +422,6 @@ void autosave_unlock(void)
bool content_undo_load_state(void) bool content_undo_load_state(void)
{ {
unsigned i; unsigned i;
retro_ctx_serialize_info_t serial_info;
size_t temp_data_size; size_t temp_data_size;
bool ret = false; bool ret = false;
unsigned num_blocks = 0; unsigned num_blocks = 0;
@ -494,14 +493,11 @@ bool content_undo_load_state(void)
temp_data_size = undo_load_buf.size; temp_data_size = undo_load_buf.size;
memcpy(temp_data, undo_load_buf.data, undo_load_buf.size); memcpy(temp_data, undo_load_buf.data, undo_load_buf.size);
serial_info.data_const = temp_data;
serial_info.size = temp_data_size;
/* Swap the current state with the backup state. This way, we can undo /* Swap the current state with the backup state. This way, we can undo
what we're undoing */ what we're undoing */
content_save_state("RAM", false, false); content_save_state("RAM", false, false);
ret = core_unserialize(&serial_info); ret = content_deserialize_state(temp_data, temp_data_size);
/* Clean up the temporary copy */ /* Clean up the temporary copy */
free(temp_data); free(temp_data);