Start using new callbacks

This commit is contained in:
twinaphex 2016-01-27 07:17:53 +01:00
parent dad9b4abf8
commit 24d438ccc1
2 changed files with 13 additions and 4 deletions

View File

@ -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++)

View File

@ -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: