mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-09 20:41:19 +00:00
Fixed server mode changes.
This commit is contained in:
parent
6eaaaef995
commit
2104ac44d9
@ -1185,7 +1185,7 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
|
||||
if (netplay->is_server)
|
||||
{
|
||||
/* FIXME: Duplication */
|
||||
uint32_t payload[3];
|
||||
uint32_t payload[7];
|
||||
char msg[512];
|
||||
const char *dmsg = NULL;
|
||||
payload[0] = htonl(netplay->self_frame_count);
|
||||
@ -1197,11 +1197,11 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
|
||||
payload[1] = htonl(netplay->self_client_num);
|
||||
payload[2] = htonl(0);
|
||||
netplay->self_mode = NETPLAY_CONNECTION_SPECTATING;
|
||||
netplay->connected_players |= ~(1L);
|
||||
netplay->connected_slaves |= ~(1L);
|
||||
netplay->connected_players &= ~(1L);
|
||||
netplay->connected_slaves &= ~(1L);
|
||||
netplay->client_devices[0] = 0;
|
||||
for (i = 0; i < MAX_INPUT_DEVICES; i++)
|
||||
netplay->device_clients[i] |= ~(1L);
|
||||
netplay->device_clients[i] &= ~(1L);
|
||||
netplay->self_devices = 0;
|
||||
|
||||
dmsg = msg_hash_to_str(MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME);
|
||||
@ -1224,7 +1224,7 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
|
||||
if (!netplay->device_clients[device])
|
||||
break;
|
||||
}
|
||||
if (device >= MAX_INPUT_DEVICES && share_mode)
|
||||
if (device == MAX_INPUT_DEVICES && share_mode)
|
||||
{
|
||||
/* Share one */
|
||||
for (device = 0; device < MAX_INPUT_DEVICES; device++)
|
||||
@ -1239,12 +1239,12 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
|
||||
if (device >= MAX_INPUT_DEVICES)
|
||||
return; /* Failure! */
|
||||
|
||||
payload[1] = htonl(NETPLAY_CMD_MODE_BIT_PLAYING | device);
|
||||
payload[1] = htonl(NETPLAY_CMD_MODE_BIT_PLAYING);
|
||||
payload[2] = htonl(1<<device);
|
||||
netplay->self_mode = NETPLAY_CONNECTION_PLAYING;
|
||||
netplay->connected_players |= 1;
|
||||
netplay->client_devices[0] = netplay->self_devices = (1<<device);
|
||||
netplay->device_clients[device] = 1;
|
||||
netplay->device_clients[device] |= 1;
|
||||
netplay->device_share_modes[device] = share_mode;
|
||||
netplay->read_ptr[0] = netplay->self_ptr;
|
||||
netplay->read_frame_count[0] = netplay->self_frame_count;
|
||||
@ -1254,6 +1254,8 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
|
||||
snprintf(msg, sizeof(msg)-1, msg_hash_to_str(MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N), device+1);
|
||||
}
|
||||
|
||||
memcpy(payload + 3, netplay->device_share_modes, sizeof(netplay->device_share_modes));
|
||||
|
||||
RARCH_LOG("[netplay] %s\n", dmsg);
|
||||
runloop_msg_queue_push(dmsg, 1, 180, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user