is_simulated was confusing and poorly named. Using have_remote in its

place, which is simply true if we've received remote data. Could also
just use read_frame_crount instead, but this keeps the info frame-local.
This commit is contained in:
Gregor Richards 2016-09-12 09:18:27 -04:00
parent 4f16a19f5e
commit 07e869ccae
3 changed files with 9 additions and 12 deletions

View File

@ -310,7 +310,7 @@ static bool netplay_get_cmd(netplay_t *netplay)
}
/* The data's good! */
netplay->buffer[netplay->read_ptr].is_simulated = false;
netplay->buffer[netplay->read_ptr].have_remote = true;
memcpy(netplay->buffer[netplay->read_ptr].real_input_state, buffer + 1, sizeof(buffer) - sizeof(uint32_t));
netplay->read_ptr = NEXT_PTR(netplay->read_ptr);
netplay->read_frame_count++;
@ -498,7 +498,7 @@ static void simulate_input(netplay_t *netplay)
netplay->buffer[prev].real_input_state,
sizeof(netplay->buffer[prev].real_input_state));
netplay->buffer[ptr].is_simulated = true;
netplay->buffer[ptr].have_remote = false;
netplay->buffer[ptr].used_real = false;
}
@ -529,7 +529,7 @@ static bool netplay_poll(netplay_t *netplay)
if (netplay->self_frame_count == 0)
{
netplay->buffer[0].used_real = true;
netplay->buffer[0].is_simulated = false;
netplay->buffer[0].have_remote = true;
memset(netplay->buffer[0].real_input_state,
0, sizeof(netplay->buffer[0].real_input_state));
@ -667,10 +667,10 @@ static int16_t netplay_input_state(netplay_t *netplay,
if (netplay->port == (netplay_flip_port(netplay, port) ? 1 : 0))
{
if (netplay->buffer[ptr].is_simulated)
curr_input_state = netplay->buffer[ptr].simulated_input_state;
else
if (netplay->buffer[ptr].have_remote)
curr_input_state = netplay->buffer[ptr].real_input_state;
else
curr_input_state = netplay->buffer[ptr].simulated_input_state;
}
switch (device)

View File

@ -114,7 +114,6 @@ static void netplay_net_post_frame(netplay_t *netplay)
/* For the remainder of the frames up to the read count, we can use the real data */
while (netplay->replay_frame_count < netplay->read_frame_count)
{
netplay->buffer[netplay->replay_ptr].is_simulated = false;
netplay->buffer[netplay->replay_ptr].used_real = true;
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
netplay->replay_frame_count++;
@ -205,8 +204,6 @@ static bool netplay_net_init_buffers(netplay_t *netplay)
if (!netplay->buffer[i].state)
return false;
netplay->buffer[i].is_simulated = true;
}
return true;

View File

@ -52,10 +52,10 @@ struct delta_frame
/* Have we read local input? */
bool have_local;
/* Badly named: This is !have_real(_remote) */
bool is_simulated;
/* Have we read the real remote input? */
bool have_remote;
/* Is the current state as of self_frame_count using the real data? */
/* Is the current state as of self_frame_count using the real remote data? */
bool used_real;
};