Merge pull request #3650 from GregorR/netplay-fixes

Netplay fixes
This commit is contained in:
Twinaphex 2016-09-24 04:27:39 +02:00 committed by GitHub
commit 591579e868
4 changed files with 9 additions and 9 deletions

View File

@ -1839,7 +1839,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_DELAY_FRAMES))
CONFIG_GET_INT_BASE(conf, global, netplay.sync_frames, "netplay_delay_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES))
CONFIG_GET_INT_BASE(conf, global, netplay.sync_frames, "netplay_check_frames");
CONFIG_GET_INT_BASE(conf, global, netplay.check_frames, "netplay_check_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT))
CONFIG_GET_INT_BASE(conf, global, netplay.port, "netplay_ip_port");
#endif

View File

@ -82,6 +82,7 @@ static void hangup(netplay_t *netplay)
netplay->remote_paused = false;
netplay->flip = false;
netplay->flip_frame = 0;
netplay->stall = 0;
}
}
@ -380,7 +381,7 @@ static bool netplay_get_cmd(netplay_t *netplay)
* arithmetic. */
do
{
if (netplay->buffer[tmp_ptr].frame == buffer[0])
if (netplay->buffer[tmp_ptr].used && netplay->buffer[tmp_ptr].frame == buffer[0])
{
found = true;
break;

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)