Rename things back after renaming for refactoring.

This commit is contained in:
Gregor Richards 2017-09-10 09:15:06 -04:00
parent b897ba4e30
commit e4029b72c1
6 changed files with 56 additions and 60 deletions

View File

@ -59,9 +59,9 @@ bool netplay_delta_frame_ready(netplay_t *netplay, struct delta_frame *delta,
delta->crc = 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++)
{
clear_input(delta->resolved_input1[i]);
clear_input(delta->real_input1[i]);
clear_input(delta->simulated_input1[i]);
clear_input(delta->resolved_input[i]);
clear_input(delta->real_input[i]);
clear_input(delta->simlated_input[i]);
}
delta->have_local = false;
for (i = 0; i < MAX_CLIENTS; i++)
@ -117,9 +117,9 @@ void netplay_delta_frame_free(struct delta_frame *delta)
for (i = 0; i < MAX_INPUT_DEVICES; i++)
{
free_input_state(&delta->resolved_input1[i]);
free_input_state(&delta->real_input1[i]);
free_input_state(&delta->simulated_input1[i]);
free_input_state(&delta->resolved_input[i]);
free_input_state(&delta->real_input[i]);
free_input_state(&delta->simlated_input[i]);
}
}

View File

@ -135,7 +135,7 @@ static bool get_self_input_state(netplay_t *netplay)
if (!(devices & (1<<devi)))
continue;
istate = netplay_input_state_for(&ptr->real_input1[devi],
istate = netplay_input_state_for(&ptr->real_input[devi],
netplay->self_client_num, 3 /* FIXME */, true, false);
if (!istate)
continue; /* FIXME: More severe? */
@ -227,7 +227,7 @@ static bool netplay_poll(void)
* frame */
netplay_update_unread_ptr(netplay_data);
if (netplay_data->stateless_mode &&
(netplay_data->connected_players1>1) &&
(netplay_data->connected_players>1) &&
netplay_data->unread_frame_count <= netplay_data->run_frame_count)
res = netplay_poll_net_input(netplay_data, true);
else
@ -239,7 +239,7 @@ static bool netplay_poll(void)
netplay_resolve_input(netplay_data, netplay_data->run_ptr, false);
/* Handle any slaves */
if (netplay_data->is_server && netplay_data->connected_slaves1)
if (netplay_data->is_server && netplay_data->connected_slaves)
netplay_handle_slaves(netplay_data);
netplay_update_unread_ptr(netplay_data);
@ -360,7 +360,7 @@ static bool netplay_poll(void)
{
/* Have we not read enough latency frames? */
if (netplay_data->self_mode == NETPLAY_CONNECTION_PLAYING &&
netplay_data->connected_players1 &&
netplay_data->connected_players &&
netplay_data->run_frame_count + netplay_data->input_latency_frames > netplay_data->self_frame_count)
{
netplay_data->stall = NETPLAY_STALL_INPUT_LATENCY;
@ -380,7 +380,7 @@ static bool netplay_poll(void)
for (client = 1; client < MAX_CLIENTS; client++)
{
struct netplay_connection *connection;
if (!(netplay_data->connected_players1 & (1<<client)))
if (!(netplay_data->connected_players & (1<<client)))
continue;
if (netplay_data->read_frame_count1[client] > netplay_data->unread_frame_count)
continue;
@ -501,7 +501,7 @@ static int16_t netplay_input_state(netplay_t *netplay,
/* FIXME: Mixing */
delta = &netplay->buffer[ptr];
istate = delta->resolved_input1[port];
istate = delta->resolved_input[port];
if (istate && istate->used)
delta->used_real[port] = true;
if (!istate)
@ -891,7 +891,7 @@ bool netplay_pre_frame(netplay_t *netplay)
}
if (sync_stalled ||
((!netplay->is_server || (netplay->connected_players1>1)) &&
((!netplay->is_server || (netplay->connected_players>1)) &&
(netplay->stall || netplay->remote_paused)))
{
/* We may have received data even if we're stalled, so run post-frame
@ -953,7 +953,7 @@ static void netplay_force_future(netplay_t *netplay)
uint32_t client;
for (client = 0; client < MAX_CLIENTS; client++)
{
if (!(netplay->connected_players1 & (1<<client))) continue;
if (!(netplay->connected_players & (1<<client))) continue;
if (netplay->read_frame_count1[client] < netplay->run_frame_count)
{
netplay->read_ptr1[client] = netplay->run_ptr;
@ -1148,8 +1148,8 @@ 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_players1 |= ~(1L);
netplay->connected_slaves1 |= ~(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);
@ -1172,7 +1172,7 @@ static void netplay_toggle_play_spectate(netplay_t *netplay)
payload[1] = htonl(NETPLAY_CMD_MODE_BIT_PLAYING | device);
payload[2] = htonl(1<<device);
netplay->self_mode = NETPLAY_CONNECTION_PLAYING;
netplay->connected_players1 |= 1;
netplay->connected_players |= 1;
netplay->client_devices[0] = netplay->self_devices = (1<<device);
netplay->device_clients[device] = 1;
netplay->read_ptr1[0] = netplay->self_ptr;
@ -1325,7 +1325,7 @@ bool init_netplay(void *direct_host, const char *server, unsigned port)
netplay_data->self_devices = 1;
netplay_data->client_devices[0] = 1;
netplay_data->device_clients[0] = 1;
netplay_data->connected_players1 = 1;
netplay_data->connected_players = 1;
}
return true;
}

View File

@ -1002,8 +1002,8 @@ bool netplay_handshake_pre_sync(netplay_t *netplay,
}
/* Get the client-controller mapping */
netplay->connected_players1 =
netplay->connected_slaves1 =
netplay->connected_players =
netplay->connected_slaves =
netplay->self_devices = 0;
for (i = 0; i < MAX_CLIENTS; i++)
netplay->client_devices[i] = 0;
@ -1015,7 +1015,7 @@ bool netplay_handshake_pre_sync(netplay_t *netplay,
fprintf(stderr, "Device %d: %d\n", (int) i, (int) device);
netplay->device_clients[i] = device;
netplay->connected_players1 |= device;
netplay->connected_players |= device;
for (j = 0; j < MAX_CLIENTS; j++)
{
if (device & (1<<j))

View File

@ -45,7 +45,7 @@ static void print_state(netplay_t *netplay)
APPEND((M, " H:%u", netplay->server_frame_count));
for (client = 0; client < MAX_USERS; client++)
{
if ((netplay->connected_players1 & (1<<client)))
if ((netplay->connected_players & (1<<client)))
APPEND((M, " %u:%u", client, netplay->read_frame_count1[client]));
}
msg[sizeof(msg)-1] = '\0';
@ -124,7 +124,7 @@ void netplay_hangup(netplay_t *netplay, struct netplay_connection *connection)
if (!netplay->is_server)
{
netplay->self_mode = NETPLAY_CONNECTION_NONE;
netplay->connected_players1 &= (1L<<netplay->self_client_num);
netplay->connected_players &= (1L<<netplay->self_client_num);
for (i = 0; i < MAX_CLIENTS; i++)
{
if (i == netplay->self_client_num)
@ -150,8 +150,8 @@ void netplay_hangup(netplay_t *netplay, struct netplay_connection *connection)
connection->delay_frame = netplay->read_frame_count1[client_num];
/* Mark them as not playing anymore */
netplay->connected_players1 &= ~(1L<<client_num);
netplay->connected_slaves1 &= ~(1L<<client_num);
netplay->connected_players &= ~(1L<<client_num);
netplay->connected_slaves &= ~(1L<<client_num);
netplay->client_devices[client_num] = 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++)
netplay->device_clients[i] &= ~(1L<<client_num);
@ -225,7 +225,7 @@ static bool send_input_frame(netplay_t *netplay, struct delta_frame *dframe,
netplay_input_state_t istate;
if (!(devices & (1<<device)))
continue;
istate = dframe->real_input1[device];
istate = dframe->real_input[device];
while (istate && istate->client_num != client_num)
istate = istate->next;
if (!istate)
@ -298,7 +298,7 @@ bool netplay_send_cur_input(netplay_t *netplay,
{
if (from_client == to_client)
continue;
if ((netplay->connected_players1 & (1<<from_client)))
if ((netplay->connected_players & (1<<from_client)))
{
if (dframe->have_real[from_client])
{
@ -594,7 +594,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
return netplay_cmd_nak(netplay, connection);
}
if (client_num >= MAX_CLIENTS || !(netplay->connected_players1 & (1<<client_num)))
if (client_num >= MAX_CLIENTS || !(netplay->connected_players & (1<<client_num)))
{
RARCH_ERR("Invalid NETPLAY_CMD_INPUT player number.\n");
return netplay_cmd_nak(netplay, connection);
@ -633,7 +633,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
continue;
dsize = netplay_expected_input_size(1 << device);
istate = netplay_input_state_for(&dframe->real_input1[device],
istate = netplay_input_state_for(&dframe->real_input[device],
client_num, dsize, true, false);
if (!istate)
{
@ -780,8 +780,8 @@ static bool netplay_get_cmd(netplay_t *netplay,
/* Mark them as not playing anymore */
connection->mode = NETPLAY_CONNECTION_SPECTATING;
netplay->connected_players1 &= ~(1<<client_num);
netplay->connected_slaves1 &= ~(1<<client_num);
netplay->connected_players &= ~(1<<client_num);
netplay->connected_slaves &= ~(1<<client_num);
netplay->client_devices[client_num] = 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++)
netplay->device_clients[client_num] &= ~(1<<client_num);
@ -884,9 +884,9 @@ static bool netplay_get_cmd(netplay_t *netplay,
connection->mode = slave ? NETPLAY_CONNECTION_SLAVE :
NETPLAY_CONNECTION_PLAYING;
netplay->connected_players1 |= 1<<client_num;
netplay->connected_players |= 1<<client_num;
if (slave)
netplay->connected_slaves1 |= 1<<client_num;
netplay->connected_slaves |= 1<<client_num;
netplay->client_devices[client_num] |= 1<<device;
netplay->device_clients[device] |= 1<<client_num;
@ -990,7 +990,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
else
netplay->self_mode = NETPLAY_CONNECTION_PLAYING;
netplay->connected_players1 |= (1<<client_num);
netplay->connected_players |= (1<<client_num);
netplay->client_devices[client_num] = devices;
for (device = 0; device < MAX_INPUT_DEVICES; device++)
if (devices & (1<<device))
@ -1008,7 +1008,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
{
if (!(devices & (1<<device))) continue;
netplay_input_state_t istate = netplay_input_state_for(
&dframe->real_input1[device], client_num,
&dframe->real_input[device], client_num,
3 /* FIXME */, true, false);
memset(istate->data, 0, istate->size*sizeof(uint32_t));
}
@ -1074,7 +1074,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
}
/* Unmark ourself, in case we were in slave mode */
netplay->connected_players1 &= ~(1<<client_num);
netplay->connected_players &= ~(1<<client_num);
netplay->client_devices[client_num] = 0;
for (device = 0; device < MAX_INPUT_DEVICES; device++)
netplay->device_clients[device] &= ~(1<<client_num);
@ -1103,7 +1103,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
return netplay_cmd_nak(netplay, connection);
}
netplay->connected_players1 |= (1<<client_num);
netplay->connected_players |= (1<<client_num);
netplay->client_devices[client_num] = devices;
for (device = 0; device < MAX_INPUT_DEVICES; device++)
if (devices & (1<<device))
@ -1126,7 +1126,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
}
else
{
netplay->connected_players1 &= ~(1<<client_num);
netplay->connected_players &= ~(1<<client_num);
netplay->client_devices[client_num] = 0;
for (device = 0; device < MAX_INPUT_DEVICES; device++)
netplay->device_clients[device] &= ~(1<<client_num);
@ -1426,7 +1426,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
/* Don't expect earlier data from other clients */
for (client = 0; client < MAX_CLIENTS; client++)
{
if (!(netplay->connected_players1 & (1<<client))) continue;
if (!(netplay->connected_players & (1<<client))) continue;
if (frame > netplay->read_frame_count1[client])
{
netplay->read_ptr1[client] = netplay->read_ptr1[client_num];
@ -1660,12 +1660,12 @@ void netplay_handle_slaves(netplay_t *netplay)
netplay_input_state_t istate_out, istate_in;
if (!(devices & (1<<device)))
continue;
istate_in = oframe->real_input1[device];
istate_in = oframe->real_input[device];
while (istate_in && istate_in->client_num != client_num)
istate_in = istate_in->next;
if (!istate_in)
continue;
istate_out = netplay_input_state_for(&frame->real_input1[device],
istate_out = netplay_input_state_for(&frame->real_input[device],
client_num, istate_in->size, true, false);
memcpy(istate_out->data, istate_in->data,
istate_in->size * sizeof(uint32_t));

View File

@ -278,14 +278,14 @@ struct delta_frame
/* The resolved input, i.e., what's actually going to the core. One input
* per device. */
netplay_input_state_t resolved_input1[MAX_INPUT_DEVICES];
netplay_input_state_t resolved_input[MAX_INPUT_DEVICES];
/* The real input */
netplay_input_state_t real_input1[MAX_INPUT_DEVICES];
netplay_input_state_t real_input[MAX_INPUT_DEVICES];
/* The simulated input. is_real here means the simulation is done, i.e.,
* it's a real simulation, not real input. */
netplay_input_state_t simulated_input1[MAX_INPUT_DEVICES];
netplay_input_state_t simlated_input[MAX_INPUT_DEVICES];
/* Have we read local input? */
bool have_local;
@ -387,11 +387,11 @@ struct netplay
struct netplay_connection one_connection; /* Client only */
/* Bitmap of clients with input devices */
uint32_t connected_players1;
uint32_t connected_players;
/* Bitmap of clients playing in slave mode (should be a subset of
* connected_players) */
uint32_t connected_slaves1;
uint32_t connected_slaves;
/* For each client, the bitmap of devices they're connected to */
uint32_t client_devices[MAX_CLIENTS];
@ -490,10 +490,6 @@ struct netplay
/* Have we requested a savestate as a sync point? */
bool savestate_request_outstanding;
/* A buffer for outgoing input packets. */
size_t input_packet_buffer_size;
uint32_t *input_packet_buffer1;
/* Our local socket info */
struct addrinfo *addr;

View File

@ -39,7 +39,7 @@
*/
void netplay_update_unread_ptr(netplay_t *netplay)
{
if (netplay->is_server && netplay->connected_players1<=1)
if (netplay->is_server && netplay->connected_players<=1)
{
/* Nothing at all to read! */
netplay->unread_ptr = netplay->self_ptr;
@ -54,8 +54,8 @@ void netplay_update_unread_ptr(netplay_t *netplay)
for (client = 0; client < MAX_CLIENTS; client++)
{
if (!(netplay->connected_players1 & (1<<client))) continue;
if ((netplay->connected_slaves1 & (1<<client))) continue;
if (!(netplay->connected_players & (1<<client))) continue;
if ((netplay->connected_slaves & (1<<client))) continue;
if (netplay->read_frame_count1[client] < new_unread_frame_count)
{
new_unread_ptr = netplay->read_ptr1[client];
@ -106,7 +106,7 @@ bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim)
for (client = 0; client < MAX_CLIENTS; client++)
{
if (!(netplay->connected_players1 & (1<<client))) continue;
if (!(netplay->connected_players & (1<<client))) continue;
devices = netplay->client_devices[client];
@ -116,18 +116,18 @@ bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim)
continue;
simulated = false;
simstate = netplay_input_state_for(&simframe->real_input1[device], client, 3 /* FIXME */, false, true);
simstate = netplay_input_state_for(&simframe->real_input[device], client, 3 /* FIXME */, false, true);
if (!simstate)
{
/* Don't already have this input, so must simulate */
simulated = true;
simstate = netplay_input_state_for(&simframe->simulated_input1[device], client, 3 /* FIXME */, false, false);
simstate = netplay_input_state_for(&simframe->simlated_input[device], client, 3 /* FIXME */, false, false);
if (!simstate)
continue;
prev = PREV_PTR(netplay->read_ptr1[client]);
pframe = &netplay->buffer[prev];
pstate = netplay_input_state_for(&pframe->real_input1[device], client, 3 /* FIXME */, false, true);
pstate = netplay_input_state_for(&pframe->real_input[device], client, 3 /* FIXME */, false, true);
if (!pstate)
continue;
@ -164,7 +164,7 @@ bool netplay_resolve_input(netplay_t *netplay, size_t sim_ptr, bool resim)
}
/* Now we copy the state, whether real or simulated, out into the resolved state (FIXME: Merging) */
resstate = netplay_input_state_for(&simframe->resolved_input1[device], 0, 3 /* FIXME */, false, false);
resstate = netplay_input_state_for(&simframe->resolved_input[device], 0, 3 /* FIXME */, false, false);
if (!resstate)
continue;
resstate->used = !simulated; /* We reuse "used" to mean "real" */
@ -427,7 +427,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
}
/* Only relevant if we're connected and not in a desynching operation */
if ((netplay->is_server && (netplay->connected_players1<=1)) ||
if ((netplay->is_server && (netplay->connected_players<=1)) ||
(netplay->self_mode < NETPLAY_CONNECTION_CONNECTED) ||
(netplay->desync))
{
@ -575,7 +575,7 @@ void netplay_sync_post_frame(netplay_t *netplay, bool stalled)
/* Look for players that are ahead of us */
for (client = 0; client < MAX_CLIENTS; client++)
{
if (!(netplay->connected_players1 & (1<<client))) continue;
if (!(netplay->connected_players & (1<<client))) continue;
if (netplay->read_frame_count1[client] > hi_frame_count)
hi_frame_count = netplay->read_frame_count1[client];
}