diff --git a/config.def.h b/config.def.h index d6b31bdd0b..e05501d913 100644 --- a/config.def.h +++ b/config.def.h @@ -1159,6 +1159,9 @@ static const bool audio_enable_menu_bgm = false; #define DEFAULT_AUTOSAVE_INTERVAL 0 #endif +/* Show only connectable rooms */ +#define DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE true + /* Publicly announce netplay */ #define DEFAULT_NETPLAY_PUBLIC_ANNOUNCE true diff --git a/configuration.c b/configuration.c index 72259fd774..387f1c27f1 100644 --- a/configuration.c +++ b/configuration.c @@ -1603,6 +1603,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false); SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false); #ifdef HAVE_NETWORKING + SETTING_BOOL("netplay_show_only_connectable", &settings->bools.netplay_show_only_connectable, true, DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE, false); SETTING_BOOL("netplay_public_announce", &settings->bools.netplay_public_announce, true, DEFAULT_NETPLAY_PUBLIC_ANNOUNCE, false); SETTING_BOOL("netplay_start_as_spectator", &settings->bools.netplay_start_as_spectator, false, netplay_start_as_spectator, false); SETTING_BOOL("netplay_fade_chat", &settings->bools.netplay_fade_chat, true, netplay_fade_chat, false); diff --git a/configuration.h b/configuration.h index 7e74c29384..6e27ae17d2 100644 --- a/configuration.h +++ b/configuration.h @@ -761,6 +761,7 @@ typedef struct settings bool crt_switch_hires_menu; /* Netplay */ + bool netplay_show_only_connectable; bool netplay_public_announce; bool netplay_start_as_spectator; bool netplay_fade_chat; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index e1011606e5..bef50cba86 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -2848,6 +2848,10 @@ MSG_HASH( MENU_ENUM_LABEL_SCAN_FILE, "scan_file" ) +MSG_HASH( + MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE, + "netplay_show_only_connectable" + ) MSG_HASH( MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, "refresh_rooms" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 368504c345..37e2bbbf61 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -6168,6 +6168,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, "Disconnect an active netplay connection." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_CONNECTABLE, + "Only Connectable Rooms" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, "Refresh Netplay Host List" diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d036cadf16..241ec3d2e7 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -9688,6 +9688,7 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) { int i; unsigned count = 0; + settings_t *settings = config_get_ptr(); net_driver_state_t *net_st = networking_state_get_ptr(); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); @@ -9725,6 +9726,11 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) MENU_SETTING_ACTION, 0, 0)) count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE, + PARSE_ONLY_BOOL, false) == 0) + count++; + if (menu_entries_append_enum(list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS), msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS), @@ -9753,6 +9759,11 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) if (!room->is_retroarch) continue; + /* Get rid of any room that is not connectable, + if the user opt-in. */ + if (!room->connectable && settings->bools.netplay_show_only_connectable) + continue; + if (room->has_password || room->has_spectate_password) snprintf(passworded, sizeof(passworded), "[%s] ", msg_hash_to_str(MSG_ROOM_PASSWORDED)); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 15bf6a5a0d..dbb88a2f5b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -19143,6 +19143,21 @@ static bool setting_append_list( char dev_req_label[64]; char dev_req_value[64]; + CONFIG_BOOL( + list, list_info, + &settings->bools.netplay_show_only_connectable, + MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE, + MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_CONNECTABLE, + DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + CONFIG_BOOL( list, list_info, &settings->bools.netplay_public_announce, diff --git a/msg_hash.h b/msg_hash.h index 70830ec9cb..cb222c0425 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1645,6 +1645,7 @@ enum msg_hash_enums MENU_LABEL(SCAN_THIS_DIRECTORY), MENU_LABEL(SCAN_DIRECTORY), MENU_LABEL(SCAN_FILE), + MENU_LABEL(NETPLAY_SHOW_ONLY_CONNECTABLE), MENU_LABEL(NETPLAY_REFRESH_ROOMS), MENU_LABEL(NETPLAY_REFRESH_LAN), MENU_LABEL(NETPLAY_ROOM_NICKNAME),