diff --git a/configuration.c b/configuration.c index 9284821974..28659b4a0c 100644 --- a/configuration.c +++ b/configuration.c @@ -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)) diff --git a/configuration.h b/configuration.h index 861143a3dd..9c0781601b 100644 --- a/configuration.h +++ b/configuration.h @@ -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; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index bdfca9c6c6..66425b8250 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -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, diff --git a/network/netplay/netplay.c b/network/netplay/netplay.c index 3ea2095969..9479b9cd21 100644 --- a/network/netplay/netplay.c +++ b/network/netplay/netplay.c @@ -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); diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index b1470bb96b..41bc60f743 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -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); diff --git a/network/netplay/netplay_net.c b/network/netplay/netplay_net.c index cc6e409fc6..51a3535e97 100644 --- a/network/netplay/netplay_net.c +++ b/network/netplay/netplay_net.c @@ -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 */ diff --git a/network/netplay/netplay_private.h b/network/netplay/netplay_private.h index 9318a70681..3ac24227c4 100644 --- a/network/netplay/netplay_private.h +++ b/network/netplay/netplay_private.h @@ -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; diff --git a/network/netplay/netplay_spectate.c b/network/netplay/netplay_spectate.c index 5fbd3aa61b..7f20f7e976 100644 --- a/network/netplay/netplay_spectate.c +++ b/network/netplay/netplay_spectate.c @@ -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; diff --git a/retroarch.c b/retroarch.c index bb375b4c0b..af54841baa 100644 --- a/retroarch.c +++ b/retroarch.c @@ -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;