Communicate paused-ness during initial connection SYNC.

This commit is contained in:
Gregor Richards 2016-12-17 22:41:34 -05:00
parent 60b81e3a51
commit 84c33634a6
4 changed files with 12 additions and 3 deletions

View File

@ -208,7 +208,8 @@ Command: SYNC
Payload:
{
frame number: uint32
connected players: uint32
paused?: 1 bit
connected players: 31 bits
flip frame: uint32
controller devices: uint32[16]
client nick: char[32]

View File

@ -506,6 +506,8 @@ bool netplay_handshake_sync(netplay_t *netplay, struct netplay_connection *conne
connected_players = netplay->connected_players;
if (netplay->self_mode == NETPLAY_CONNECTION_PLAYING)
connected_players |= 1<<netplay->self_player;
if (netplay->local_paused || netplay->remote_paused)
connected_players |= NETPLAY_CMD_SYNC_BIT_PAUSED;
cmd[3] = htonl(connected_players);
if (netplay->flip)
cmd[4] = htonl(netplay->flip_frame);
@ -852,10 +854,15 @@ bool netplay_handshake_pre_sync(netplay_t *netplay,
return false;
new_frame_count = ntohl(new_frame_count);
/* Get the connected players */
/* Get the connected players and pause mode */
RECV(&connected_players, sizeof(connected_players))
return false;
connected_players = ntohl(connected_players);
if (connected_players & NETPLAY_CMD_SYNC_BIT_PAUSED)
{
netplay->remote_paused = true;
connected_players ^= NETPLAY_CMD_SYNC_BIT_PAUSED;
}
netplay->connected_players = connected_players;
/* And the flip state */

View File

@ -166,6 +166,7 @@ enum netplay_cmd
};
#define NETPLAY_CMD_INPUT_BIT_SERVER (1U<<31)
#define NETPLAY_CMD_SYNC_BIT_PAUSED (1U<<31)
#define NETPLAY_CMD_MODE_BIT_PLAYING (1U<<17)
#define NETPLAY_CMD_MODE_BIT_YOU (1U<<16)

View File

@ -191,7 +191,7 @@ 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 && !netplay->stall)
if (netplay->force_send_savestate && !netplay->stall && !netplay->remote_paused)
{
/* Send this along to the other side */
serial_info.data_const = netplay->buffer[netplay->self_ptr].state;