diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 436169f11a..de04a9637d 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -581,6 +581,10 @@ MSG_HASH(MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES, "netplay_check_frames") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT, "netplay_client_swap_input") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "netplay_input_latency_frames_min") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "netplay_input_latency_frames_range") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_DISCONNECT, "menu_netplay_disconnect") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_ENABLE, diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 3d18b4d165..1f4f1c8339 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1560,6 +1560,31 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) { "no checks. This value is only used on the \n" "netplay host. \n"); break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN: + snprintf(s, len, + "The number of frames of input latency for \n" + "netplay to use to hide network latency. \n" + " \n" + "When in netplay, this option delays local \n" + "input, so that the frame being run is \n" + "closer to the frames being received from \n" + "the network. This reduces jitter and makes \n" + "netplay less CPU-intensive, but at the \n" + "price of noticeable input lag. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE: + snprintf(s, len, + "The range of frames of input latency that \n" + "may be used by netplay to hide network \n" + "latency. \n" + "\n" + "If set, netplay will adjust the number of \n" + "frames of input latency dynamically to \n" + "balance CPU time, input latency and \n" + "network latency. This reduces jitter and \n" + "makes netplay less CPU-intensive, but at \n" + "the price of unpredictable input lag. \n"); + break; case MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL: snprintf(s, len, "When hosting, attempt to listen for\n" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ad54c40752..8f4b8da8df 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -964,6 +964,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY, "Netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, "Netplay Check Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "Input Latency Frames") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "Input Latency Frames Range") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CLIENT_SWAP_INPUT, "Netplay P2 Uses C1") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ca34e75fa1..b615473867 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4813,6 +4813,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES, PARSE_ONLY_INT, false) != -1) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + PARSE_ONLY_INT, false) != -1) + count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + PARSE_ONLY_INT, false) != -1) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, PARSE_ONLY_BOOL, false) != -1) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 287e005e4c..1db31837a5 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5672,7 +5672,35 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - menu_settings_list_current_add_range(list, list_info, -600, 600, 1, true, false); + menu_settings_list_current_add_range(list, list_info, -600, 600, 1, false, false); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); + + CONFIG_INT( + list, list_info, + (int *) &settings->netplay.input_latency_frames_min, + MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + 0, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 0, 15, 1, true, true); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); + + CONFIG_INT( + list, list_info, + (int *) &settings->netplay.input_latency_frames_range, + MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + 0, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 0, 15, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( diff --git a/msg_hash.h b/msg_hash.h index a599ada318..4a541166fa 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1023,6 +1023,8 @@ enum msg_hash_enums MENU_LABEL(NETPLAY_DELAY_FRAMES), MENU_LABEL(NETPLAY_STATELESS_MODE), MENU_LABEL(NETPLAY_CHECK_FRAMES), + MENU_LABEL(NETPLAY_INPUT_LATENCY_FRAMES_MIN), + MENU_LABEL(NETPLAY_INPUT_LATENCY_FRAMES_RANGE), MENU_LABEL(NETPLAY_SPECTATOR_MODE_ENABLE), MENU_LABEL(NETPLAY_TCP_UDP_PORT), MENU_LABEL(NETPLAY_NAT_TRAVERSAL),