(Netplay/Lobby) Add setting for filtering out rooms with non-installed cores (#14124)
This commit is contained in:
parent
e7b9ff1ff6
commit
78bc42de68
|
@ -1202,8 +1202,9 @@ static const bool audio_enable_menu_bgm = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Netplay lobby filters */
|
/* Netplay lobby filters */
|
||||||
#define DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE true
|
#define DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE true
|
||||||
#define DEFAULT_NETPLAY_SHOW_PASSWORDED true
|
#define DEFAULT_NETPLAY_SHOW_ONLY_INSTALLED_CORES false
|
||||||
|
#define DEFAULT_NETPLAY_SHOW_PASSWORDED true
|
||||||
|
|
||||||
/* Publicly announce netplay */
|
/* Publicly announce netplay */
|
||||||
#define DEFAULT_NETPLAY_PUBLIC_ANNOUNCE true
|
#define DEFAULT_NETPLAY_PUBLIC_ANNOUNCE true
|
||||||
|
|
|
@ -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);
|
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
|
#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_only_connectable", &settings->bools.netplay_show_only_connectable, true, DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE, false);
|
||||||
|
SETTING_BOOL("netplay_show_only_installed_cores", &settings->bools.netplay_show_only_installed_cores, true, DEFAULT_NETPLAY_SHOW_ONLY_INSTALLED_CORES, false);
|
||||||
SETTING_BOOL("netplay_show_passworded", &settings->bools.netplay_show_passworded, true, DEFAULT_NETPLAY_SHOW_PASSWORDED, 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_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_start_as_spectator", &settings->bools.netplay_start_as_spectator, false, netplay_start_as_spectator, false);
|
||||||
|
|
|
@ -759,6 +759,7 @@ typedef struct settings
|
||||||
|
|
||||||
/* Netplay */
|
/* Netplay */
|
||||||
bool netplay_show_only_connectable;
|
bool netplay_show_only_connectable;
|
||||||
|
bool netplay_show_only_installed_cores;
|
||||||
bool netplay_show_passworded;
|
bool netplay_show_passworded;
|
||||||
bool netplay_public_announce;
|
bool netplay_public_announce;
|
||||||
bool netplay_start_as_spectator;
|
bool netplay_start_as_spectator;
|
||||||
|
|
|
@ -3066,6 +3066,10 @@ MSG_HASH(
|
||||||
MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE,
|
MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_CONNECTABLE,
|
||||||
"netplay_show_only_connectable"
|
"netplay_show_only_connectable"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_INSTALLED_CORES,
|
||||||
|
"netplay_show_only_installed_cores"
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED,
|
MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED,
|
||||||
"netplay_show_passworded"
|
"netplay_show_passworded"
|
||||||
|
|
|
@ -6606,6 +6606,10 @@ MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_CONNECTABLE,
|
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_CONNECTABLE,
|
||||||
"Only Connectable Rooms"
|
"Only Connectable Rooms"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_INSTALLED_CORES,
|
||||||
|
"Only Installed Cores"
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_PASSWORDED,
|
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_PASSWORDED,
|
||||||
"Passworded Rooms"
|
"Passworded Rooms"
|
||||||
|
|
|
@ -7953,8 +7953,9 @@ unsigned menu_displaylist_build_list(
|
||||||
case DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST:
|
case DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST:
|
||||||
{
|
{
|
||||||
menu_displaylist_build_info_selective_t build_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_ONLY_CONNECTABLE, PARSE_ONLY_BOOL, true},
|
||||||
{MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED, PARSE_ONLY_BOOL, true},
|
{MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_INSTALLED_CORES, PARSE_ONLY_BOOL, true},
|
||||||
|
{MENU_ENUM_LABEL_NETPLAY_SHOW_PASSWORDED, PARSE_ONLY_BOOL, true},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(build_list); i++)
|
for (i = 0; i < ARRAY_SIZE(build_list); i++)
|
||||||
|
@ -10412,17 +10413,21 @@ static unsigned menu_displaylist_build_shader_parameter(
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char passworded[64];
|
char passworded[64];
|
||||||
char country[8];
|
char country[8];
|
||||||
const char *room_type;
|
const char *room_type;
|
||||||
struct netplay_room *room;
|
struct netplay_room *room;
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
core_info_list_t *coreinfos = NULL;
|
||||||
net_driver_state_t *net_st = networking_state_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool show_only_connectable = settings->bools.netplay_show_only_connectable;
|
net_driver_state_t *net_st = networking_state_get_ptr();
|
||||||
bool show_passworded = settings->bools.netplay_show_passworded;
|
bool show_only_connectable =
|
||||||
|
settings->bools.netplay_show_only_connectable;
|
||||||
|
bool show_only_installed_cores =
|
||||||
|
settings->bools.netplay_show_only_installed_cores;
|
||||||
|
bool show_passworded = settings->bools.netplay_show_passworded;
|
||||||
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
|
||||||
|
|
||||||
|
@ -10482,6 +10487,8 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||||
count++;
|
count++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
core_info_get_list(&coreinfos);
|
||||||
|
|
||||||
for (i = 0; i < net_st->room_count; i++)
|
for (i = 0; i < net_st->room_count; i++)
|
||||||
{
|
{
|
||||||
room = &net_st->room_list[i];
|
room = &net_st->room_list[i];
|
||||||
|
@ -10510,6 +10517,20 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||||
else
|
else
|
||||||
room_type = msg_hash_to_str(MSG_INTERNET);
|
room_type = msg_hash_to_str(MSG_INTERNET);
|
||||||
|
|
||||||
|
/* Get rid of any room running a core that we don't have installed,
|
||||||
|
if the user opt-in. */
|
||||||
|
if (show_only_installed_cores)
|
||||||
|
{
|
||||||
|
for (j = 0; j < coreinfos->count; j++)
|
||||||
|
{
|
||||||
|
if (string_is_equal_case_insensitive(coreinfos->list[j].core_name,
|
||||||
|
room->corename))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (j >= coreinfos->count)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get rid of any room that is passworded,
|
/* Get rid of any room that is passworded,
|
||||||
if the user opt-in. */
|
if the user opt-in. */
|
||||||
if (room->has_password || room->has_spectate_password)
|
if (room->has_password || room->has_spectate_password)
|
||||||
|
|
|
@ -19713,6 +19713,21 @@ static bool setting_append_list(
|
||||||
general_read_handler,
|
general_read_handler,
|
||||||
SD_FLAG_NONE);
|
SD_FLAG_NONE);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
&settings->bools.netplay_show_only_installed_cores,
|
||||||
|
MENU_ENUM_LABEL_NETPLAY_SHOW_ONLY_INSTALLED_CORES,
|
||||||
|
MENU_ENUM_LABEL_VALUE_NETPLAY_SHOW_ONLY_INSTALLED_CORES,
|
||||||
|
DEFAULT_NETPLAY_SHOW_ONLY_INSTALLED_CORES,
|
||||||
|
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(
|
CONFIG_BOOL(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
&settings->bools.netplay_show_passworded,
|
&settings->bools.netplay_show_passworded,
|
||||||
|
|
|
@ -1716,6 +1716,7 @@ enum msg_hash_enums
|
||||||
MENU_LABEL(SCAN_DIRECTORY),
|
MENU_LABEL(SCAN_DIRECTORY),
|
||||||
MENU_LABEL(SCAN_FILE),
|
MENU_LABEL(SCAN_FILE),
|
||||||
MENU_LABEL(NETPLAY_SHOW_ONLY_CONNECTABLE),
|
MENU_LABEL(NETPLAY_SHOW_ONLY_CONNECTABLE),
|
||||||
|
MENU_LABEL(NETPLAY_SHOW_ONLY_INSTALLED_CORES),
|
||||||
MENU_LABEL(NETPLAY_SHOW_PASSWORDED),
|
MENU_LABEL(NETPLAY_SHOW_PASSWORDED),
|
||||||
MENU_LABEL(NETPLAY_REFRESH_ROOMS),
|
MENU_LABEL(NETPLAY_REFRESH_ROOMS),
|
||||||
MENU_LABEL(NETPLAY_REFRESH_LAN),
|
MENU_LABEL(NETPLAY_REFRESH_LAN),
|
||||||
|
|
Loading…
Reference in New Issue