From 24a39078beeed6a18ffcb22171280ab231d9d802 Mon Sep 17 00:00:00 2001 From: Gregor Richards Date: Tue, 13 Dec 2016 22:03:10 -0500 Subject: [PATCH] Adding netplay password to menu. --- config.def.h | 2 ++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.c | 5 +++++ intl/msg_hash_us.h | 4 +++- menu/menu_displaylist.c | 8 ++++++-- menu/menu_setting.c | 18 ++++++++++++++++-- msg_hash.h | 1 + 7 files changed, 35 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index d44acd7f50..12c2773810 100644 --- a/config.def.h +++ b/config.def.h @@ -798,6 +798,8 @@ static const unsigned autosave_interval = 0; * user 1 rather than user 2. */ static const bool netplay_client_swap_input = true; +static const bool netplay_nat_traversal = false; + static const unsigned netplay_delay_frames = 16; static const unsigned netplay_check_frames = 30; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1e5e29a070..7a8b8557b2 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -589,6 +589,8 @@ MSG_HASH(MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, "netplay_nat_traversal") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_NICKNAME, "netplay_nickname") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_PASSWORD, + "netplay_password") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_SETTINGS, "menu_netplay_settings") MSG_HASH(MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE, diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index ace43f647f..1620d6f4a7 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1697,6 +1697,11 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "The address of the host to connect to."); break; + case MENU_ENUM_LABEL_NETPLAY_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host. Used only in host mode."); + break; case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: snprintf(s, len, "Enable stdin command interface."); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 5b84cfa9aa..dae1823cfd 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -920,12 +920,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, "Netplay Client Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, "Username") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "Server Password") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, "Netplay settings") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, "Netplay Spectator Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, - "Netplay TCP/UDP Port") + "Netplay TCP Port") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, "Netplay NAT Traversal") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 44f118ae6b..e19204bd26 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4689,6 +4689,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, false) != -1) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY_PASSWORD, + PARSE_ONLY_STRING, false) != -1) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES, PARSE_ONLY_UINT, false) != -1) @@ -4698,11 +4702,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) PARSE_ONLY_UINT, false) != -1) count++; if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT, + MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, PARSE_ONLY_BOOL, false) != -1) count++; if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, + MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT, PARSE_ONLY_BOOL, false) != -1) count++; if (menu_displaylist_parse_settings_enum(menu, info, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 789e76bdd3..f897490a3d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5577,6 +5577,20 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, 65535, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_STRING( + list, list_info, + settings->netplay.password, + sizeof(settings->netplay.password), + MENU_ENUM_LABEL_NETPLAY_PASSWORD, + MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_UINT( list, list_info, &settings->netplay.delay_frames, @@ -5588,7 +5602,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - menu_settings_list_current_add_range(list, list_info, 0, 10, 1, true, false); + menu_settings_list_current_add_range(list, list_info, 0, 60, 1, true, false); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_UINT( @@ -5602,7 +5616,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - menu_settings_list_current_add_range(list, list_info, 0, 10, 1, true, false); + menu_settings_list_current_add_range(list, list_info, 0, 600, 1, true, false); 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 3f975fc885..ca879df1ba 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1003,6 +1003,7 @@ enum msg_hash_enums MENU_LABEL(SORT_SAVEFILES_ENABLE), MENU_LABEL(SORT_SAVESTATES_ENABLE), MENU_LABEL(NETPLAY_IP_ADDRESS), + MENU_LABEL(NETPLAY_PASSWORD), MENU_LABEL(NETPLAY_MODE), MENU_LABEL(PERFCNT_ENABLE), MENU_LABEL(OVERLAY_SCALE),