(Netplay/Lobby) Add a toggleable filter for passworded rooms (#13920)

In addition, move lobby filters into its own submenu for better organization.
This commit is contained in:
Cthulhu-throwaway 2022-05-07 23:24:58 -03:00 committed by GitHub
parent 2a15a4cba3
commit 80a9c16b3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 101 additions and 15 deletions

View file

@ -1184,8 +1184,9 @@ static const bool audio_enable_menu_bgm = false;
#define DEFAULT_AUTOSAVE_INTERVAL 0
#endif
/* Show only connectable rooms */
/* Netplay lobby filters */
#define DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE true
#define DEFAULT_NETPLAY_SHOW_PASSWORDED true
/* Publicly announce netplay */
#define DEFAULT_NETPLAY_PUBLIC_ANNOUNCE true

View file

@ -1608,6 +1608,7 @@ static struct config_bool_setting *populate_settings_bool(
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_show_passworded", &settings->bools.netplay_show_passworded, true, DEFAULT_NETPLAY_SHOW_PASSWORDED, 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);

View file

@ -777,6 +777,7 @@ typedef struct settings
/* Netplay */
bool netplay_show_only_connectable;
bool netplay_show_passworded;
bool netplay_public_announce;
bool netplay_start_as_spectator;
bool netplay_fade_chat;

View file

@ -1046,6 +1046,10 @@ MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST,
"deferred_network_settings_list"
)
MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST,
"deferred_netplay_lobby_filters_list"
)
MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST,
"deferred_onscreen_display_settings_list"
@ -2154,6 +2158,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NETWORK_SETTINGS,
"network_settings"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS,
"netplay_lobby_filters"
)
MSG_HASH(
MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY,
"no_achievements_to_display"
@ -3042,6 +3050,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE,
"netplay_show_only_connectable"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED,
"netplay_show_passworded"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS,
"refresh_rooms"

View file

@ -6489,10 +6489,18 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT,
"Disconnect an active netplay connection."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_LOBBY_FILTERS,
"Lobby Filters"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_CONNECTABLE,
"Only Connectable Rooms"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_PASSWORDED,
"Passworded Rooms"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS,
"Refresh Netplay Host List"

View file

@ -206,6 +206,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_wifi_networks_list, DISPLAYLIST_
GENERIC_DEFERRED_PUSH(deferred_push_network_settings_list, DISPLAYLIST_NETWORK_SETTINGS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_subsystem_settings_list, DISPLAYLIST_SUBSYSTEM_SETTINGS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_network_hosting_settings_list, DISPLAYLIST_NETWORK_HOSTING_SETTINGS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_netplay_lobby_filters_list, DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_lakka_services_list, DISPLAYLIST_LAKKA_SERVICES_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_user_settings_list, DISPLAYLIST_USER_SETTINGS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_directory_settings_list, DISPLAYLIST_DIRECTORY_SETTINGS_LIST)
@ -739,6 +740,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST, deferred_push_network_settings_list},
{MENU_ENUM_LABEL_DEFERRED_SUBSYSTEM_SETTINGS_LIST, deferred_push_subsystem_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST, deferred_push_network_hosting_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST, deferred_push_netplay_lobby_filters_list},
{MENU_ENUM_LABEL_DEFERRED_BLUETOOTH_SETTINGS_LIST, deferred_push_bluetooth_settings_list},
{MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST, deferred_push_wifi_settings_list},
{MENU_ENUM_LABEL_DEFERRED_WIFI_NETWORKS_LIST, deferred_push_wifi_networks_list},

View file

@ -412,6 +412,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
return MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST;
case ACTION_OK_DL_NETWORK_HOSTING_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST;
case ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST;
case ACTION_OK_DL_SUBSYSTEM_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_SUBSYSTEM_SETTINGS_LIST;
case ACTION_OK_DL_NETWORK_SETTINGS_LIST:
@ -1559,6 +1561,7 @@ int generic_action_ok_displaylist_push(const char *path,
case ACTION_OK_DL_UPDATER_SETTINGS_LIST:
case ACTION_OK_DL_NETWORK_SETTINGS_LIST:
case ACTION_OK_DL_NETWORK_HOSTING_SETTINGS_LIST:
case ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST:
case ACTION_OK_DL_SUBSYSTEM_SETTINGS_LIST:
case ACTION_OK_DL_BLUETOOTH_SETTINGS_LIST:
case ACTION_OK_DL_WIFI_SETTINGS_LIST:
@ -5759,6 +5762,7 @@ DEFAULT_ACTION_OK_FUNC(action_ok_configurations_list, ACTION_OK_DL_CONFIGURATION
DEFAULT_ACTION_OK_FUNC(action_ok_saving_list, ACTION_OK_DL_SAVING_SETTINGS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_network_list, ACTION_OK_DL_NETWORK_SETTINGS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_network_hosting_list, ACTION_OK_DL_NETWORK_HOSTING_SETTINGS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_netplay_lobby_filters_list, ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_subsystem_list, ACTION_OK_DL_SUBSYSTEM_SETTINGS_LIST)
DEFAULT_ACTION_OK_FUNC(action_ok_database_manager_list, ACTION_OK_DL_DATABASE_MANAGER_LIST)
#ifdef HAVE_BLUETOOTH
@ -8335,6 +8339,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, action_ok_netplay_connect_room},
#endif
{MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS, action_ok_network_hosting_list},
{MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS, action_ok_netplay_lobby_filters_list},
{MENU_ENUM_LABEL_SUBSYSTEM_SETTINGS, action_ok_subsystem_list},
{MENU_ENUM_LABEL_NETWORK_SETTINGS, action_ok_network_list},
{MENU_ENUM_LABEL_LAKKA_SERVICES, action_ok_lakka_services},

View file

@ -648,6 +648,7 @@ DEFAULT_TITLE_MACRO(action_get_bluetooth_settings_list, MENU_ENUM_LABEL_
DEFAULT_TITLE_MACRO(action_get_wifi_networks_list, MENU_ENUM_LABEL_VALUE_WIFI_NETWORKS)
DEFAULT_TITLE_MACRO(action_get_wifi_settings_list, MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS)
DEFAULT_TITLE_MACRO(action_get_network_hosting_settings_list, MENU_ENUM_LABEL_VALUE_NETWORK_HOSTING_SETTINGS)
DEFAULT_TITLE_MACRO(action_get_netplay_lobby_filters_list, MENU_ENUM_LABEL_VALUE_NETPLAY_LOBBY_FILTERS)
DEFAULT_TITLE_MACRO(action_get_subsystem_settings_list, MENU_ENUM_LABEL_VALUE_SUBSYSTEM_SETTINGS)
DEFAULT_TITLE_MACRO(action_get_network_settings_list, MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS)
DEFAULT_TITLE_MACRO(action_get_netplay_lan_scan_settings_list, MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS)
@ -992,6 +993,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST, action_get_wifi_settings_list},
{MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST, action_get_updater_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST, action_get_network_hosting_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST, action_get_netplay_lobby_filters_list},
{MENU_ENUM_LABEL_DEFERRED_SUBSYSTEM_SETTINGS_LIST, action_get_subsystem_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST, action_get_network_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST, action_get_netplay_lan_scan_settings_list},

View file

@ -10703,6 +10703,7 @@ static void materialui_list_insert(
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SHADER_APPLY_CHANGES)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_LAN)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT)) ||

View file

@ -1962,6 +1962,7 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_WIFI_SETTINGS:
case MENU_ENUM_LABEL_NETWORK_INFO_ENTRY:
case MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS:
case MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_NETWORK];
case MENU_ENUM_LABEL_BLUETOOTH_SETTINGS:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_BLUETOOTH];

View file

@ -2860,6 +2860,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_WIFI_SETTINGS:
case MENU_ENUM_LABEL_NETWORK_INFO_ENTRY:
case MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS:
case MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS:
return xmb->textures.list[XMB_TEXTURE_NETWORK];
#endif
case MENU_ENUM_LABEL_BLUETOOTH_SETTINGS:

View file

@ -202,6 +202,7 @@ enum
ACTION_OK_DL_NETWORK_SETTINGS_LIST,
ACTION_OK_DL_SUBSYSTEM_SETTINGS_LIST,
ACTION_OK_DL_NETWORK_HOSTING_SETTINGS_LIST,
ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST,
ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST,
ACTION_OK_DL_LAKKA_SERVICES_LIST,
ACTION_OK_DL_USER_SETTINGS_LIST,

View file

@ -7922,6 +7922,25 @@ unsigned menu_displaylist_build_list(
#endif
}
break;
case DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST:
{
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED, PARSE_ONLY_BOOL, true},
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
if (!build_list[i].checked && !include_everything)
continue;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
build_list[i].enum_idx, build_list[i].parse_type,
false) == 0)
count++;
}
}
break;
case DISPLAYLIST_CHEAT_SEARCH_SETTINGS_LIST:
#ifdef HAVE_CHEATS
{
@ -10365,9 +10384,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)
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_LOBBY_FILTERS),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS),
MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS,
MENU_SETTING_ACTION, 0, 0))
count++;
if (menu_entries_append_enum(list,
@ -10400,12 +10421,30 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
/* 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->connectable)
{
if (settings->bools.netplay_show_only_connectable)
continue;
room_type = msg_hash_to_str(MSG_INTERNET_NOT_CONNECTABLE);
}
else if (room->lan)
room_type = msg_hash_to_str(MSG_LOCAL);
else if (room->host_method == NETPLAY_HOST_METHOD_MITM)
room_type = msg_hash_to_str(MSG_INTERNET_RELAY);
else
room_type = msg_hash_to_str(MSG_INTERNET);
/* Get rid of any room that is passworded,
if the user opt-in. */
if (room->has_password || room->has_spectate_password)
{
if (!settings->bools.netplay_show_passworded)
continue;
snprintf(passworded, sizeof(passworded), "[%s] ",
msg_hash_to_str(MSG_ROOM_PASSWORDED));
}
else
*passworded = '\0';
@ -10415,15 +10454,6 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
else
*country = '\0';
if (room->lan)
room_type = msg_hash_to_str(MSG_LOCAL);
else if (room->host_method == NETPLAY_HOST_METHOD_MITM)
room_type = msg_hash_to_str(MSG_INTERNET_RELAY);
else if (room->connectable)
room_type = msg_hash_to_str(MSG_INTERNET);
else
room_type = msg_hash_to_str(MSG_INTERNET_NOT_CONNECTABLE);
snprintf(buf, sizeof(buf), "%s%s: %s%s",
passworded, room_type,
room->nickname, country);
@ -12649,6 +12679,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
case DISPLAYLIST_CHEAT_DETAILS_SETTINGS_LIST:
case DISPLAYLIST_CHEAT_SEARCH_SETTINGS_LIST:
case DISPLAYLIST_NETWORK_SETTINGS_LIST:
case DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST:
case DISPLAYLIST_OPTIONS_CHEATS:
case DISPLAYLIST_NETWORK_INFO:
case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION:

View file

@ -217,6 +217,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_WIFI_SETTINGS_LIST,
DISPLAYLIST_NETWORK_SETTINGS_LIST,
DISPLAYLIST_NETWORK_HOSTING_SETTINGS_LIST,
DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST,
DISPLAYLIST_NETPLAY_LAN_SCAN_SETTINGS_LIST,
DISPLAYLIST_LAKKA_SERVICES_LIST,
DISPLAYLIST_USER_SETTINGS_LIST,

View file

@ -19555,6 +19555,21 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.netplay_show_passworded,
MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED,
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_PASSWORDED,
DEFAULT_NETPLAY_SHOW_PASSWORDED,
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,

View file

@ -1457,6 +1457,7 @@ enum msg_hash_enums
MENU_LABEL(SUBSYSTEM_SETTINGS),
MENU_LABEL(NETWORK_HOSTING_SETTINGS),
MENU_LABEL(NETWORK_SETTINGS),
MENU_LABEL(NETPLAY_LOBBY_FILTERS),
MENU_LABEL(NETPLAY_LAN_SCAN_SETTINGS),
MENU_LABEL(WIFI_ENABLED),
MENU_LABEL(WIFI_NETWORK_SCAN),
@ -1653,6 +1654,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_DEFERRED_SUBSYSTEM_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST,
MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST,
@ -1694,6 +1696,7 @@ enum msg_hash_enums
MENU_LABEL(SCAN_DIRECTORY),
MENU_LABEL(SCAN_FILE),
MENU_LABEL(NETPLAY_SHOW_ONLY_CONNECTABLE),
MENU_LABEL(NETPLAY_SHOW_PASSWORDED),
MENU_LABEL(NETPLAY_REFRESH_ROOMS),
MENU_LABEL(NETPLAY_REFRESH_LAN),
MENU_LABEL(NETPLAY_ROOM_NICKNAME),