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.
This commit is contained in:
Gregor Richards 2016-12-12 19:34:50 -05:00
parent 3d34c0222f
commit 6556af1100
4 changed files with 6 additions and 18 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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;