mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 07:13:35 +00:00
Merge pull request #3607 from GregorR/netplay-savestates
Netplay savestate loading frontend changes
This commit is contained in:
commit
e21662b3e9
@ -1713,6 +1713,10 @@ static void command_event_load_state(const char *path, char *s, size_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETPLAY
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (settings->state_slot < 0)
|
if (settings->state_slot < 0)
|
||||||
snprintf(s, len, "%s #-1 (auto).",
|
snprintf(s, len, "%s #-1 (auto).",
|
||||||
msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT));
|
msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT));
|
||||||
@ -1740,6 +1744,10 @@ static void command_event_undo_load_state(char *s, size_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETPLAY
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_LOAD_SAVESTATE, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
strlcpy(s,
|
strlcpy(s,
|
||||||
msg_hash_to_str(MSG_UNDID_LOAD_STATE), len);
|
msg_hash_to_str(MSG_UNDID_LOAD_STATE), len);
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,7 @@ void netplay_frontend_paused(netplay_t *netplay, bool paused)
|
|||||||
/**
|
/**
|
||||||
* netplay_load_savestate
|
* netplay_load_savestate
|
||||||
* @netplay : pointer to netplay object
|
* @netplay : pointer to netplay object
|
||||||
* @serial_info : the savestate being loaded
|
* @serial_info : the savestate being loaded, NULL means "load it yourself"
|
||||||
* @save : whether to save the provided serial_info into the frame buffer
|
* @save : whether to save the provided serial_info into the frame buffer
|
||||||
*
|
*
|
||||||
* Inform Netplay of a savestate load and send it to the other side
|
* Inform Netplay of a savestate load and send it to the other side
|
||||||
@ -1178,12 +1178,24 @@ void netplay_frontend_paused(netplay_t *netplay, bool paused)
|
|||||||
void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save)
|
void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save)
|
||||||
{
|
{
|
||||||
uint32_t header[3];
|
uint32_t header[3];
|
||||||
|
retro_ctx_serialize_info_t tmp_serial_info;
|
||||||
|
|
||||||
if (!netplay->has_connection)
|
if (!netplay->has_connection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Record it in our own buffer */
|
/* Record it in our own buffer */
|
||||||
if (save && netplay_delta_frame_ready(netplay, &netplay->buffer[netplay->self_ptr], netplay->self_frame_count))
|
if ((save || !serial_info) && netplay_delta_frame_ready(netplay, &netplay->buffer[netplay->self_ptr], netplay->self_frame_count))
|
||||||
|
{
|
||||||
|
if (!serial_info)
|
||||||
|
{
|
||||||
|
tmp_serial_info.size = netplay->state_size;
|
||||||
|
tmp_serial_info.data = netplay->buffer[netplay->self_ptr].state;
|
||||||
|
if (!core_serialize(&tmp_serial_info))
|
||||||
|
return;
|
||||||
|
tmp_serial_info.data_const = tmp_serial_info.data;
|
||||||
|
serial_info = &tmp_serial_info;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (serial_info->size <= netplay->state_size)
|
if (serial_info->size <= netplay->state_size)
|
||||||
{
|
{
|
||||||
@ -1191,6 +1203,7 @@ void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *seri
|
|||||||
serial_info->data_const, serial_info->size);
|
serial_info->data_const, serial_info->size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We need to ignore any intervening data from the other side, and never rewind past this */
|
/* We need to ignore any intervening data from the other side, and never rewind past this */
|
||||||
if (netplay->read_frame_count < netplay->self_frame_count)
|
if (netplay->read_frame_count < netplay->self_frame_count)
|
||||||
|
@ -187,7 +187,7 @@ void netplay_frontend_paused(netplay_t *netplay, bool paused);
|
|||||||
/**
|
/**
|
||||||
* netplay_load_savestate
|
* netplay_load_savestate
|
||||||
* @netplay : pointer to netplay object
|
* @netplay : pointer to netplay object
|
||||||
* @serial_info : the savestate being loaded
|
* @serial_info : the savestate being loaded, NULL means "load it yourself"
|
||||||
* @save : whether to save the provided serial_info into the frame buffer
|
* @save : whether to save the provided serial_info into the frame buffer
|
||||||
*
|
*
|
||||||
* Inform Netplay of a savestate load and send it to the other side
|
* Inform Netplay of a savestate load and send it to the other side
|
||||||
|
Loading…
x
Reference in New Issue
Block a user