Bugfixes in how we reset state on a late Netplay connection

This commit is contained in:
Gregor Richards 2016-09-23 22:21:53 -04:00
parent 236839e22f
commit fa5b75b635
2 changed files with 6 additions and 7 deletions

View File

@ -280,9 +280,10 @@ bool netplay_get_info(netplay_t *netplay)
netplay->self_frame_count = netplay->read_frame_count = netplay->other_frame_count = 0;
for (i = 0; i < netplay->buffer_size; i++)
{
netplay->buffer[i].used = false;
if (i == netplay->self_ptr)
{
netplay->buffer[i].frame = 0;
netplay_delta_frame_ready(netplay, &netplay->buffer[i], 0);
}
else
{

View File

@ -124,17 +124,15 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
{
netplay->has_connection = true;
/* If we're not at frame 0, send them the savestate */
if (netplay->self_frame_count != 0 && netplay->savestates_work)
/* Send them the savestate */
if (netplay->savestates_work)
{
serial_info.size = netplay->state_size;
serial_info.data_const = netplay->buffer[netplay->self_ptr].state;
netplay_load_savestate(netplay, &serial_info, false);
netplay_load_savestate(netplay, NULL, true);
}
/* And expect the current frame from the other side */
netplay->read_frame_count = netplay->other_frame_count = netplay->self_frame_count;
netplay->read_ptr = netplay->other_ptr = netplay->read_ptr;
netplay->read_ptr = netplay->other_ptr = netplay->self_ptr;
/* Unstall if we were waiting for this */
if (netplay->stall == RARCH_NETPLAY_STALL_NO_CONNECTION)