mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 02:08:16 +00:00
A bit more care about frame=0 input, which is always 0
This commit is contained in:
parent
f92d34e183
commit
307ba5951e
@ -224,14 +224,17 @@ bool netplay_send_info(netplay_t *netplay)
|
||||
}
|
||||
|
||||
/* Reset our frame count so it's consistent with the server */
|
||||
netplay->self_frame_count = netplay->read_frame_count = netplay->other_frame_count = 0;
|
||||
netplay->self_frame_count = netplay->other_frame_count = 0;
|
||||
netplay->read_frame_count = 1;
|
||||
for (i = 0; i < netplay->buffer_size; i++)
|
||||
{
|
||||
netplay->buffer[i].used = false;
|
||||
if (i == netplay->self_ptr)
|
||||
{
|
||||
netplay_delta_frame_ready(netplay, &netplay->buffer[i], 0);
|
||||
netplay->read_ptr = netplay->other_ptr = i;
|
||||
netplay->buffer[i].have_remote = true;
|
||||
netplay->other_ptr = i;
|
||||
netplay->read_ptr = NEXT_PTR(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -324,14 +327,17 @@ bool netplay_get_info(netplay_t *netplay)
|
||||
}
|
||||
|
||||
/* Reset our frame count so it's consistent with the client */
|
||||
netplay->self_frame_count = netplay->read_frame_count = netplay->other_frame_count = 0;
|
||||
netplay->self_frame_count = netplay->other_frame_count = 0;
|
||||
netplay->read_frame_count = 1;
|
||||
for (i = 0; i < netplay->buffer_size; i++)
|
||||
{
|
||||
netplay->buffer[i].used = false;
|
||||
if (i == netplay->self_ptr)
|
||||
{
|
||||
netplay_delta_frame_ready(netplay, &netplay->buffer[i], 0);
|
||||
netplay->read_ptr = netplay->other_ptr = i;
|
||||
netplay->buffer[i].have_remote = true;
|
||||
netplay->other_ptr = i;
|
||||
netplay->read_ptr = NEXT_PTR(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
|
||||
serial_info.size = netplay->state_size;
|
||||
|
||||
memset(serial_info.data, 0, serial_info.size);
|
||||
if (netplay->quirks & NETPLAY_QUIRK_INITIALIZATION)
|
||||
if ((netplay->quirks & NETPLAY_QUIRK_INITIALIZATION) || netplay->self_frame_count == 0)
|
||||
{
|
||||
/* Don't serialize until it's safe */
|
||||
}
|
||||
@ -105,6 +105,7 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
|
||||
|
||||
/* If we can't transmit savestates, we must stall until the client is ready */
|
||||
if (!netplay->has_connection &&
|
||||
netplay->self_frame_count > 0 &&
|
||||
(netplay->quirks & (NETPLAY_QUIRK_NO_SAVESTATES|NETPLAY_QUIRK_NO_TRANSMISSION)))
|
||||
netplay->stall = RARCH_NETPLAY_STALL_NO_CONNECTION;
|
||||
}
|
||||
@ -155,7 +156,16 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
|
||||
|
||||
/* Send them the savestate */
|
||||
if (!(netplay->quirks & (NETPLAY_QUIRK_NO_SAVESTATES|NETPLAY_QUIRK_NO_TRANSMISSION)))
|
||||
{
|
||||
netplay_load_savestate(netplay, NULL, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Because the first frame isn't serialized, we're actually at
|
||||
* frame 1 */
|
||||
netplay->self_ptr = NEXT_PTR(netplay->self_ptr);
|
||||
netplay->self_frame_count = 1;
|
||||
}
|
||||
|
||||
/* And expect the current frame from the other side */
|
||||
netplay->read_frame_count = netplay->other_frame_count = netplay->self_frame_count;
|
||||
|
Loading…
Reference in New Issue
Block a user