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:
parent
4f16a19f5e
commit
07e869ccae
|
@ -310,7 +310,7 @@ static bool netplay_get_cmd(netplay_t *netplay)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The data's good! */
|
/* 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));
|
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_ptr = NEXT_PTR(netplay->read_ptr);
|
||||||
netplay->read_frame_count++;
|
netplay->read_frame_count++;
|
||||||
|
@ -498,7 +498,7 @@ static void simulate_input(netplay_t *netplay)
|
||||||
netplay->buffer[prev].real_input_state,
|
netplay->buffer[prev].real_input_state,
|
||||||
sizeof(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;
|
netplay->buffer[ptr].used_real = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ static bool netplay_poll(netplay_t *netplay)
|
||||||
if (netplay->self_frame_count == 0)
|
if (netplay->self_frame_count == 0)
|
||||||
{
|
{
|
||||||
netplay->buffer[0].used_real = true;
|
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,
|
memset(netplay->buffer[0].real_input_state,
|
||||||
0, sizeof(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->port == (netplay_flip_port(netplay, port) ? 1 : 0))
|
||||||
{
|
{
|
||||||
if (netplay->buffer[ptr].is_simulated)
|
if (netplay->buffer[ptr].have_remote)
|
||||||
curr_input_state = netplay->buffer[ptr].simulated_input_state;
|
|
||||||
else
|
|
||||||
curr_input_state = netplay->buffer[ptr].real_input_state;
|
curr_input_state = netplay->buffer[ptr].real_input_state;
|
||||||
|
else
|
||||||
|
curr_input_state = netplay->buffer[ptr].simulated_input_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (device)
|
switch (device)
|
||||||
|
|
|
@ -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 */
|
/* 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)
|
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->buffer[netplay->replay_ptr].used_real = true;
|
||||||
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
|
netplay->replay_ptr = NEXT_PTR(netplay->replay_ptr);
|
||||||
netplay->replay_frame_count++;
|
netplay->replay_frame_count++;
|
||||||
|
@ -205,8 +204,6 @@ static bool netplay_net_init_buffers(netplay_t *netplay)
|
||||||
|
|
||||||
if (!netplay->buffer[i].state)
|
if (!netplay->buffer[i].state)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
netplay->buffer[i].is_simulated = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,10 +52,10 @@ struct delta_frame
|
||||||
/* Have we read local input? */
|
/* Have we read local input? */
|
||||||
bool have_local;
|
bool have_local;
|
||||||
|
|
||||||
/* Badly named: This is !have_real(_remote) */
|
/* Have we read the real remote input? */
|
||||||
bool is_simulated;
|
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;
|
bool used_real;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue