From 6556af1100558ba29545feb229f78a492f0048de Mon Sep 17 00:00:00 2001 From: Gregor Richards Date: Mon, 12 Dec 2016 19:34:50 -0500 Subject: [PATCH] force_send_savestate is global again We cannot send a savestate to only one player, as sending a savestate is a synchronization event invalidating all prior input. --- network/netplay/netplay.c | 3 +-- network/netplay/netplay_common.c | 3 +-- network/netplay/netplay_net.c | 6 ++---- network/netplay/netplay_private.h | 12 ++---------- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/network/netplay/netplay.c b/network/netplay/netplay.c index 18b6c1e644..2240d71298 100644 --- a/network/netplay/netplay.c +++ b/network/netplay/netplay.c @@ -1119,8 +1119,7 @@ static bool netplay_get_cmd(netplay_t *netplay, case NETPLAY_CMD_REQUEST_SAVESTATE: /* Delay until next frame so we don't send the savestate after the * input */ - connection->force_send_savestate = true; - netplay->force_send_savestate_one = true; + netplay->force_send_savestate = true; break; case NETPLAY_CMD_LOAD_SAVESTATE: diff --git a/network/netplay/netplay_common.c b/network/netplay/netplay_common.c index 9f8fefbc1e..ca5c8d7f8b 100644 --- a/network/netplay/netplay_common.c +++ b/network/netplay/netplay_common.c @@ -267,8 +267,7 @@ static void netplay_handshake_ready(netplay_t *netplay, struct netplay_connectio /* Send them the savestate */ if (!(netplay->quirks & (NETPLAY_QUIRK_NO_SAVESTATES|NETPLAY_QUIRK_NO_TRANSMISSION))) { - connection->force_send_savestate = true; - netplay->force_send_savestate_one = true; + netplay->force_send_savestate = true; } } else diff --git a/network/netplay/netplay_net.c b/network/netplay/netplay_net.c index 72830f4ff2..2af25f64c8 100644 --- a/network/netplay/netplay_net.c +++ b/network/netplay/netplay_net.c @@ -88,14 +88,12 @@ bool netplay_sync_pre_frame(netplay_t *netplay) } else if (!(netplay->quirks & NETPLAY_QUIRK_NO_SAVESTATES) && core_serialize(&serial_info)) { - if ((netplay->force_send_savestate_all || netplay->force_send_savestate_one) && !netplay->stall) + if (netplay->force_send_savestate && !netplay->stall) { /* Send this along to the other side */ serial_info.data_const = netplay->buffer[netplay->self_ptr].state; netplay_load_savestate(netplay, &serial_info, false); - netplay->force_send_savestate_all = - netplay->force_send_savestate_one = false; - /* FIXME: Shouldn't send to everyone! */ + netplay->force_send_savestate = false; } } else diff --git a/network/netplay/netplay_private.h b/network/netplay/netplay_private.h index 3bcb53056d..afbc170214 100644 --- a/network/netplay/netplay_private.h +++ b/network/netplay/netplay_private.h @@ -249,9 +249,6 @@ struct netplay_connection /* Player # of connected player */ int player; - - /* Force send a savestate, to this connection only */ - bool force_send_savestate; }; struct netplay @@ -349,13 +346,8 @@ struct netplay /* Quirks in the savestate implementation */ uint64_t quirks; - /* Force our state to be sent to all connections. Used when we explicitly - * load a state. */ - bool force_send_savestate_all; - - /* Set if there is at least one client which must be sent the state, usually - * because they've requested it or just connected. */ - bool force_send_savestate_one; + /* Force our state to be sent to all connections */ + bool force_send_savestate; /* Have we requested a savestate as a sync point? */ bool savestate_request_outstanding;