Merge pull request #4123 from GregorR/netplay-the-hardest-things-in-computer-science-are-cache-invalidation-and-naming-things

delay_frames naming consistency
This commit is contained in:
Twinaphex 2016-12-01 20:04:04 +01:00 committed by GitHub
commit 87bb9e42d4
9 changed files with 23 additions and 23 deletions

View File

@ -922,7 +922,7 @@ static int populate_settings_int(settings_t *settings, struct config_int_setting
SETTING_INT("state_slot", (unsigned*)&settings->state_slot, false, 0 /* TODO */, false);
#ifdef HAVE_NETWORKING
SETTING_INT("netplay_ip_port", &settings->netplay.port, false, 0 /* TODO */, false);
SETTING_INT("netplay_delay_frames", &settings->netplay.sync_frames, true, 16, false);
SETTING_INT("netplay_delay_frames", &settings->netplay.delay_frames, true, 16, false);
SETTING_INT("netplay_check_frames", &settings->netplay.check_frames, true, 30, false);
#endif
#ifdef HAVE_LANGEXTRA
@ -1839,7 +1839,7 @@ static bool config_load_file(const char *path, bool set_defaults,
#ifdef HAVE_NETWORKING
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_DELAY_FRAMES, NULL))
CONFIG_GET_INT_BASE(conf, settings, netplay.sync_frames, "netplay_delay_frames");
CONFIG_GET_INT_BASE(conf, settings, netplay.delay_frames, "netplay_delay_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL))
CONFIG_GET_INT_BASE(conf, settings, netplay.check_frames, "netplay_check_frames");
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL))

View File

@ -399,7 +399,7 @@ typedef struct settings
{
char server[255];
unsigned port;
unsigned sync_frames;
unsigned delay_frames;
unsigned check_frames;
bool is_spectate;
bool swap_input;

View File

@ -1717,7 +1717,7 @@ void general_write_handler(void *data)
case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES:
#ifdef HAVE_NETWORKING
{
bool val = (settings->netplay.sync_frames > 0);
bool val = (settings->netplay.delay_frames > 0);
if (val)
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_NETPLAY_DELAY_FRAMES, NULL);
@ -5548,7 +5548,7 @@ static bool setting_append_list(
CONFIG_UINT(
list, list_info,
&settings->netplay.sync_frames,
&settings->netplay.delay_frames,
MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES,
MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES,
0,

View File

@ -277,9 +277,9 @@ static void hangup(netplay_t *netplay)
netplay->stall = 0;
}
static bool netplay_info_cb(netplay_t* netplay, unsigned frames)
static bool netplay_info_cb(netplay_t* netplay, unsigned delay_frames)
{
return netplay->net_cbs->info_cb(netplay, frames);
return netplay->net_cbs->info_cb(netplay, delay_frames);
}
/**
@ -832,7 +832,7 @@ static bool netplay_poll(void)
/* Read Netplay input, block if we're configured to stall for input every
* frame */
if (netplay_data->stall_frames == 0 &&
if (netplay_data->delay_frames == 0 &&
netplay_data->read_frame_count <= netplay_data->self_frame_count)
res = poll_input(netplay_data, true);
else
@ -856,7 +856,7 @@ static bool netplay_poll(void)
break;
default: /* not stalling */
if (netplay_data->read_frame_count + netplay_data->stall_frames
if (netplay_data->read_frame_count + netplay_data->delay_frames
<= netplay_data->self_frame_count)
{
netplay_data->stall = RARCH_NETPLAY_STALL_RUNNING_FAST;
@ -1244,7 +1244,7 @@ static bool netplay_init_buffers(netplay_t *netplay, unsigned frames)
* netplay_new:
* @server : IP address of server.
* @port : Port of server.
* @frames : Amount of lag frames.
* @delay_frames : Amount of delay frames.
* @check_frames : Frequency with which to check CRCs.
* @cb : Libretro callbacks.
* @spectate : If true, enable spectator mode.
@ -1257,7 +1257,7 @@ static bool netplay_init_buffers(netplay_t *netplay, unsigned frames)
*
* Returns: new netplay handle.
**/
netplay_t *netplay_new(const char *server, uint16_t port, unsigned frames,
netplay_t *netplay_new(const char *server, uint16_t port, unsigned delay_frames,
unsigned check_frames, const struct retro_callbacks *cb, bool spectate,
bool nat_traversal, const char *nick, uint64_t quirks)
{
@ -1272,13 +1272,13 @@ netplay_t *netplay_new(const char *server, uint16_t port, unsigned frames,
netplay->spectate.enabled = spectate;
netplay->is_server = server == NULL;
netplay->nat_traversal = netplay->is_server ? nat_traversal : false;
netplay->stall_frames = frames;
netplay->delay_frames = delay_frames;
netplay->check_frames = check_frames;
netplay->quirks = quirks;
strlcpy(netplay->nick, nick, sizeof(netplay->nick));
if (!netplay_init_buffers(netplay, frames))
if (!netplay_init_buffers(netplay, delay_frames))
{
free(netplay);
return NULL;
@ -1295,7 +1295,7 @@ netplay_t *netplay_new(const char *server, uint16_t port, unsigned frames,
return NULL;
}
if(!netplay_info_cb(netplay, frames))
if(!netplay_info_cb(netplay, delay_frames))
goto error;
return netplay;
@ -1699,7 +1699,7 @@ bool init_netplay(bool is_spectate, const char *server, unsigned port)
netplay_data = (netplay_t*)netplay_new(
netplay_is_client ? server : NULL,
port ? port : RARCH_DEFAULT_PORT,
settings->netplay.sync_frames, settings->netplay.check_frames, &cbs,
settings->netplay.delay_frames, settings->netplay.check_frames, &cbs,
is_spectate, settings->netplay.nat_traversal, settings->username,
quirks);

View File

@ -110,7 +110,7 @@ enum netplay_cmd_cfg
/* input.netplay_client_swap_input */
NETPLAY_CFG_SWAP_INPUT = 0x0002,
/* netplay.sync_frames */
/* netplay.delay_frames */
NETPLAY_CFG_DELAY_FRAMES = 0x0004,
/* For more than 2 players */
@ -133,7 +133,7 @@ size_t audio_sample_batch_net(const int16_t *data, size_t frames);
* netplay_new:
* @server : IP address of server.
* @port : Port of server.
* @frames : Amount of lag frames.
* @delay_frames : Amount of delay frames.
* @check_frames : Frequency with which to check CRCs.
* @cb : Libretro callbacks.
* @spectate : If true, enable spectator mode.
@ -147,7 +147,7 @@ size_t audio_sample_batch_net(const int16_t *data, size_t frames);
* Returns: new netplay handle.
**/
netplay_t *netplay_new(const char *server,
uint16_t port, unsigned frames, unsigned check_frames,
uint16_t port, unsigned delay_frames, unsigned check_frames,
const struct retro_callbacks *cb, bool spectate, bool nat_traversal,
const char *nick, uint64_t quirks);

View File

@ -101,7 +101,7 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
/* If the core can't serialize properly, we must stall for the
* remote input on EVERY frame, because we can't recover */
netplay->quirks |= NETPLAY_QUIRK_NO_SAVESTATES;
netplay->stall_frames = 0;
netplay->delay_frames = 0;
}
/* If we can't transmit savestates, we must stall until the client is ready */

View File

@ -212,7 +212,7 @@ struct netplay
bool remote_paused;
/* And stalling */
uint32_t stall_frames;
uint32_t delay_frames;
int stall;
retro_time_t stall_time;

View File

@ -243,7 +243,7 @@ static void netplay_spectate_post_frame(netplay_t *netplay)
}
/* If the server gets significantly ahead, skip to catch up */
if (netplay->self_frame_count + netplay->stall_frames <= netplay->read_frame_count)
if (netplay->self_frame_count + netplay->delay_frames <= netplay->read_frame_count)
{
/* "Replay" into the future */
netplay->is_replay = true;

View File

@ -339,7 +339,7 @@ static void retroarch_print_help(const char *arg0)
puts(" -H, --host Host netplay as user 1.");
puts(" -C, --connect=HOST Connect to netplay server as user 2.");
puts(" --port=PORT Port used to netplay. Default is 55435.");
puts(" -F, --frames=NUMBER Sync frames when using netplay.");
puts(" -F, --frames=NUMBER Delay frames when using netplay.");
puts(" --check-frames=NUMBER\n"
" Check frames when using netplay.");
puts(" --spectate Connect to netplay server as spectator.");
@ -708,7 +708,7 @@ static void retroarch_parse_input(int argc, char *argv[])
break;
case 'F':
settings->netplay.sync_frames = strtol(optarg, NULL, 0);
settings->netplay.delay_frames = strtol(optarg, NULL, 0);
retroarch_override_setting_set(
RARCH_OVERRIDE_SETTING_NETPLAY_DELAY_FRAMES, NULL);
break;