mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Start using new callbacks
This commit is contained in:
parent
dad9b4abf8
commit
24d438ccc1
11
content.c
11
content.c
@ -160,6 +160,7 @@ static bool dump_to_file_desperate(const void *data,
|
|||||||
**/
|
**/
|
||||||
static bool content_save_state(const char *path)
|
static bool content_save_state(const char *path)
|
||||||
{
|
{
|
||||||
|
retro_ctx_serialize_info_t serial_info;
|
||||||
retro_ctx_size_info_t info;
|
retro_ctx_size_info_t info;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
@ -182,7 +183,10 @@ static bool content_save_state(const char *path)
|
|||||||
msg_hash_to_str(MSG_STATE_SIZE),
|
msg_hash_to_str(MSG_STATE_SIZE),
|
||||||
(int)info.size,
|
(int)info.size,
|
||||||
msg_hash_to_str(MSG_BYTES));
|
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)
|
if (ret)
|
||||||
ret = retro_write_file(path, data, info.size);
|
ret = retro_write_file(path, data, info.size);
|
||||||
@ -210,6 +214,7 @@ static bool content_load_state(const char *path)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
retro_ctx_serialize_info_t serial_info;
|
||||||
unsigned num_blocks = 0;
|
unsigned num_blocks = 0;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
struct sram_block *blocks = 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. */
|
/* Flush back. */
|
||||||
for (i = 0; i < num_blocks; i++)
|
for (i = 0; i < num_blocks; i++)
|
||||||
|
@ -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;
|
retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data;
|
||||||
if (!info)
|
if (!info)
|
||||||
return false;
|
return false;
|
||||||
core.retro_unserialize(info->data_const, info->size);
|
if (!core.retro_unserialize(info->data_const, info->size))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CORE_CTL_RETRO_SERIALIZE:
|
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;
|
retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data;
|
||||||
if (!info)
|
if (!info)
|
||||||
return false;
|
return false;
|
||||||
core.retro_serialize(info->data, info->size);
|
if (!core.retro_serialize(info->data, info->size))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CORE_CTL_RETRO_SERIALIZE_SIZE:
|
case CORE_CTL_RETRO_SERIALIZE_SIZE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user