mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 10:49:02 +00:00
Fix spectator mode to work with the late-serialization workaround
This commit is contained in:
parent
03215a831f
commit
5b62fbb355
@ -721,7 +721,7 @@ static bool netplay_poll(void)
|
||||
|
||||
/* WORKAROUND: The only reason poll_input is ignored in the first frame is
|
||||
* that some cores can't report state size until after the first frame. */
|
||||
if (netplay_data->self_frame_count > 0 || netplay_data->stall)
|
||||
if (netplay_data->self_frame_count > 0 || netplay_data->stall || netplay_data->spectate.enabled)
|
||||
{
|
||||
/* Read Netplay input, block if we're configured to stall for input every
|
||||
* frame */
|
||||
|
@ -36,6 +36,29 @@
|
||||
**/
|
||||
static bool netplay_spectate_pre_frame(netplay_t *netplay)
|
||||
{
|
||||
/* WORKAROUND: We initialize the buffer states here as part of a workaround
|
||||
* for cores that can't even core_serialize_size early. */
|
||||
if (netplay->self_frame_count == 0 && netplay->state_size == 0)
|
||||
{
|
||||
int i;
|
||||
retro_ctx_size_info_t info;
|
||||
|
||||
core_serialize_size(&info);
|
||||
|
||||
netplay->state_size = info.size;
|
||||
|
||||
for (i = 0; i < netplay->buffer_size; i++)
|
||||
{
|
||||
netplay->buffer[i].state = calloc(netplay->state_size, 1);
|
||||
|
||||
if (!netplay->buffer[i].state)
|
||||
{
|
||||
netplay->savestates_work = false;
|
||||
netplay->stall_frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (netplay_is_server(netplay))
|
||||
{
|
||||
fd_set fds;
|
||||
|
Loading…
Reference in New Issue
Block a user