(Netplay) Host Kick Submenu

Path: Netplay -> Host -> Kick Client

- Allows the host to kick clients.
- Allows the host to view client information: connected clients (names), status (playing/spectating) and ping.
This commit is contained in:
Cthulhu-throwaway 2022-05-15 04:04:15 -03:00
parent a577d7d224
commit 81593fda42
14 changed files with 226 additions and 38 deletions

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_KICK_LIST,
"deferred_netplay_kick_list"
)
MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LOBBY_FILTERS_LIST,
"deferred_netplay_lobby_filters_list"
@ -2034,6 +2038,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
"menu_netplay_enable_host"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_KICK,
"menu_netplay_kick"
)
MSG_HASH(
MENU_ENUM_LABEL_NETPLAY_ALLOW_SLAVES,
"netplay_allow_slaves"
@ -2198,6 +2206,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NO_NETPLAY_HOSTS_FOUND,
"no_netplay_hosts_found"
)
MSG_HASH(
MENU_ENUM_LABEL_NO_NETPLAY_CLIENTS_FOUND,
"no_netplay_clients_found"
)
MSG_HASH(
MENU_ENUM_LABEL_NO_BT_DEVICES_FOUND,
"no_bt_devices_found"

View File

@ -6545,6 +6545,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST,
"Stop Netplay Host"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETPLAY_KICK,
"Kick Client"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NETPLAY_KICK,
"Kick a client from your currently hosted room."
)
/* Import Content */
@ -10775,6 +10783,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND,
"No netplay hosts found."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_NETPLAY_CLIENTS_FOUND,
"No netplay clients found."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS,
"No performance counters."
@ -11499,6 +11511,23 @@ MSG_HASH(
MSG_NETPLAY_CHANGED_NICK,
"Your nickname changed to \"%s\""
)
MSG_HASH(
MSG_NETPLAY_KICKED_CLIENT_S,
"Client kicked: \"%s\""
)
MSG_HASH(
MSG_NETPLAY_FAILED_TO_KICK_CLIENT_S,
"Failed to kick client: \"%s\""
)
MSG_HASH(
MSG_NETPLAY_STATUS_PLAYING,
"Playing"
)
MSG_HASH(
MSG_NETPLAY_STATUS_SPECTATING,
"Spectating"
)
MSG_HASH(
MSG_AUDIO_VOLUME,
"Audio volume"

View File

@ -204,8 +204,9 @@ GENERIC_DEFERRED_PUSH(deferred_push_bluetooth_settings_list, DISPLAYLIST_
GENERIC_DEFERRED_PUSH(deferred_push_wifi_settings_list, DISPLAYLIST_WIFI_SETTINGS_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_wifi_networks_list, DISPLAYLIST_WIFI_NETWORKS_LIST)
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_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_kick_list, DISPLAYLIST_NETPLAY_KICK_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)
@ -740,6 +741,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_KICK_LIST, deferred_push_netplay_kick_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},

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_KICK_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETPLAY_KICK_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:
@ -1561,6 +1563,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_KICK_LIST:
case ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST:
case ACTION_OK_DL_SUBSYSTEM_SETTINGS_LIST:
case ACTION_OK_DL_BLUETOOTH_SETTINGS_LIST:
@ -5762,6 +5765,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_kick_list, ACTION_OK_DL_NETPLAY_KICK_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)
@ -6158,6 +6162,28 @@ static int action_ok_push_netplay_refresh_lan(const char *path,
return 0;
}
#endif
static int action_ok_push_netplay_kick(const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
char msg[256];
netplay_client_info_t client;
client.id = (int)strtol(label, NULL, 10);
strlcpy(client.name, path, sizeof(client.name));
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_KICK_CLIENT, &client))
snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_KICKED_CLIENT_S), client.name);
else
snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_NETPLAY_FAILED_TO_KICK_CLIENT_S), client.name);
runloop_msg_queue_push(msg, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return action_cancel_pop_default(NULL, NULL, 0, 0);
}
#endif
DEFAULT_ACTION_OK_DL_PUSH(action_ok_content_collection_list, FILEBROWSER_SELECT_COLLECTION, ACTION_OK_DL_CONTENT_COLLECTION_LIST, NULL)
@ -8339,6 +8365,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_KICK, action_ok_netplay_kick_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},
@ -8833,6 +8860,11 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
#ifdef HAVE_WIFI
BIND_ACTION_OK(cbs, action_ok_wifi);
#endif
#endif
break;
case MENU_NETPLAY_KICK:
#ifdef HAVE_NETWORKING
BIND_ACTION_OK(cbs, action_ok_push_netplay_kick);
#endif
break;
case FILE_TYPE_CURSOR:

View File

@ -682,7 +682,6 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_nowinkey_enable, MENU_
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_sensors_enable, MENU_ENUM_SUBLABEL_INPUT_SENSORS_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_mouse_grab, MENU_ENUM_SUBLABEL_INPUT_AUTO_MOUSE_GRAB)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_android_input_disconnect_workaround, MENU_ENUM_SUBLABEL_ANDROID_INPUT_DISCONNECT_WORKAROUND)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_game_focus, MENU_ENUM_SUBLABEL_INPUT_AUTO_GAME_FOCUS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_ok_cancel, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_pause_libretro, MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO)
@ -786,6 +785,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_resampler_quality,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_enable_host, MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_enable_client, MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_disconnect, MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_kick, MENU_ENUM_SUBLABEL_NETPLAY_KICK)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_scan_file, MENU_ENUM_SUBLABEL_SCAN_FILE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_scan_directory, MENU_ENUM_SUBLABEL_SCAN_DIRECTORY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_swap_interval, MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL)
@ -1579,6 +1579,55 @@ static int action_bind_sublabel_netplay_room(
}
return 0;
}
static int action_bind_sublabel_netplay_kick_client(file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
char buf[256];
netplay_client_info_t *client = NULL;
const char *status = NULL;
size_t idx = list->list[i].entry_idx;
net_driver_state_t *net_st = networking_state_get_ptr();
if (idx >= net_st->client_info_count)
return menu_cbs_exit();
client = &net_st->client_info[idx];
switch (client->mode)
{
case NETPLAY_CONNECTION_SLAVE:
case NETPLAY_CONNECTION_PLAYING:
status = msg_hash_to_str(MSG_NETPLAY_STATUS_PLAYING);
break;
case NETPLAY_CONNECTION_SPECTATING:
status = msg_hash_to_str(MSG_NETPLAY_STATUS_SPECTATING);
break;
default:
break;
}
*s = '\0';
if (status)
{
snprintf(buf, sizeof(buf), "%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATUS), status);
strlcat(s, buf, len);
}
if (client->ping >= 0)
{
if (*s)
strlcat(s, "\n", len);
snprintf(buf, sizeof(buf), "Ping: %u", (unsigned)client->ping);
strlcat(s, buf, len);
}
return 0;
}
#endif
static int action_bind_sublabel_playlist_entry(
@ -3089,6 +3138,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SCAN_DIRECTORY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_scan_directory);
break;
case MENU_ENUM_LABEL_NETPLAY_KICK:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_kick);
break;
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_disconnect);
break;
@ -3978,6 +4030,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_room);
break;
case MENU_ENUM_LABEL_NETPLAY_KICK_CLIENT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_kick_client);
break;
#endif
#ifdef HAVE_CHEEVOS
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST:

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_kick_list, MENU_ENUM_LABEL_VALUE_NETPLAY_KICK)
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)
@ -993,6 +994,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_KICK_LIST, action_get_netplay_kick_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},

View File

@ -10364,7 +10364,8 @@ static void materialui_list_insert(
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_CORE_OPTIONS_AVAILABLE)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_SETTINGS_FOUND)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_PRESETS_FOUND))
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_PRESETS_FOUND)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NO_NETPLAY_CLIENTS_FOUND))
)
{
node->icon_texture_index = MUI_TEXTURE_INFO;
@ -10708,6 +10709,7 @@ static void materialui_list_insert(
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)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_KICK)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_LOAD)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE)) ||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR)) ||

View File

@ -1963,6 +1963,7 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case MENU_ENUM_LABEL_NETWORK_INFO_ENTRY:
case MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS:
case MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS:
case MENU_ENUM_LABEL_NETPLAY_KICK:
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

@ -2861,6 +2861,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_NETWORK_INFO_ENTRY:
case MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS:
case MENU_ENUM_LABEL_NETPLAY_LOBBY_FILTERS:
case MENU_ENUM_LABEL_NETPLAY_KICK:
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_KICK_LIST,
ACTION_OK_DL_NETPLAY_LOBBY_FILTERS_LIST,
ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST,
ACTION_OK_DL_LAKKA_SERVICES_LIST,

View File

@ -5288,10 +5288,10 @@ end:
}
#ifdef HAVE_NETWORKING
static int menu_displaylist_parse_netplay_mitm_server_list(
static unsigned menu_displaylist_parse_netplay_mitm_server_list(
menu_displaylist_info_t *info, settings_t *settings)
{
size_t count = 0;
unsigned count = 0;
size_t i;
size_t list_len = ARRAY_SIZE(netplay_mitm_server_list);
@ -5315,10 +5315,8 @@ static int menu_displaylist_parse_netplay_mitm_server_list(
cbs->checked = true;
menu_navigation_set_selection(count);
}
count++;
}
}
end:
@ -10595,6 +10593,41 @@ static unsigned print_buf_lines(file_list_t *list, char *buf,
return count;
}
static unsigned menu_displaylist_netplay_kick(file_list_t *list)
{
unsigned count = 0;
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_REFRESH_CLIENT_INFO, NULL))
{
char client_id[4];
size_t i;
net_driver_state_t *net_st = networking_state_get_ptr();
for (i = 0; i < net_st->client_info_count; i++)
{
netplay_client_info_t *client = &net_st->client_info[i];
snprintf(client_id, sizeof(client_id), "%d", client->id);
if (menu_entries_append_enum(list, client->name, client_id,
MENU_ENUM_LABEL_NETPLAY_KICK_CLIENT,
MENU_NETPLAY_KICK,
0, i))
count++;
}
}
if (count == 0)
if (menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_NETPLAY_CLIENTS_FOUND),
msg_hash_to_str(MENU_ENUM_LABEL_NO_NETPLAY_CLIENTS_FOUND),
MENU_ENUM_LABEL_NO_NETPLAY_CLIENTS_FOUND,
0, 0, 0))
count++;
return count;
}
#endif
bool menu_displaylist_has_subsystems(void)
@ -10634,43 +10667,46 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#ifdef HAVE_NETWORKING
{
size_t i;
bool include_everything = false;
file_list_t *list = info->list;
file_list_t *list = info->list;
bool use_mitm_server = settings->bools.netplay_use_mitm_server;
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_PING, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_PUBLIC_ANNOUNCE, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, PARSE_ONLY_STRING, false},
{MENU_ENUM_LABEL_NETPLAY_CUSTOM_MITM_SERVER, PARSE_ONLY_STRING, false},
{MENU_ENUM_LABEL_NETPLAY_PASSWORD, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_CONNECTIONS, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_MAX_PING, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_NETPLAY_PUBLIC_ANNOUNCE, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_NETPLAY_MITM_SERVER, PARSE_ONLY_STRING, false},
{MENU_ENUM_LABEL_NETPLAY_CUSTOM_MITM_SERVER, PARSE_ONLY_STRING, false},
{MENU_ENUM_LABEL_NETPLAY_PASSWORD, PARSE_ONLY_STRING, true},
{MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD, PARSE_ONLY_STRING, true},
};
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
{
menu_entries_append_enum(list,
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
{
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
MENU_SETTING_ACTION, 0, 0);
}
else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
{
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_KICK),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_KICK),
MENU_ENUM_LABEL_NETPLAY_KICK,
MENU_SETTING_ACTION, 0, 0);
}
}
else
{
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST),
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
MENU_SETTING_ACTION, 0, 0);
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST),
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST),
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
MENU_SETTING_ACTION, 0, 0);
}
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -10678,11 +10714,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
switch (build_list[i].enum_idx)
{
case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER:
if (settings->bools.netplay_use_mitm_server)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_NETPLAY_CUSTOM_MITM_SERVER:
if (settings->bools.netplay_use_mitm_server)
if (use_mitm_server)
build_list[i].checked = true;
break;
default:
@ -10692,14 +10725,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
if (!build_list[i].checked && !include_everything)
if (!build_list[i].checked)
continue;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
build_list[i].enum_idx, build_list[i].parse_type,
false) == 0)
build_list[i].enum_idx, build_list[i].parse_type,
false) == 0)
count++;
}
}
#endif
info->need_push = true;
info->need_refresh = true;
break;
case DISPLAYLIST_NETPLAY_KICK_LIST:
#ifdef HAVE_NETWORKING
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_netplay_kick(info->list);
#endif
info->need_push = true;
info->need_refresh = true;

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_KICK_LIST,
DISPLAYLIST_NETPLAY_LOBBY_FILTERS_LIST,
DISPLAYLIST_NETPLAY_LAN_SCAN_SETTINGS_LIST,
DISPLAYLIST_LAKKA_SERVICES_LIST,

View File

@ -169,6 +169,7 @@ enum menu_settings_type
MENU_ROOM_LAN,
MENU_ROOM_RELAY,
MENU_NETPLAY_LAN_SCAN,
MENU_NETPLAY_KICK,
MENU_INFO_MESSAGE,
MENU_SETTINGS_SHADER_PARAMETER_0,
MENU_SETTINGS_SHADER_PARAMETER_LAST = MENU_SETTINGS_SHADER_PARAMETER_0 + (GFX_MAX_PARAMETERS - 1),

View File

@ -216,6 +216,10 @@ enum msg_hash_enums
MSG_NETPLAY_CANNOT_PLAY,
MSG_NETPLAY_PEER_PAUSED,
MSG_NETPLAY_CHANGED_NICK,
MSG_NETPLAY_KICKED_CLIENT_S,
MSG_NETPLAY_FAILED_TO_KICK_CLIENT_S,
MSG_NETPLAY_STATUS_PLAYING,
MSG_NETPLAY_STATUS_SPECTATING,
MSG_RESAMPLER_QUALITY_LOWEST,
MSG_RESAMPLER_QUALITY_LOWER,
MSG_RESAMPLER_QUALITY_NORMAL,
@ -1759,7 +1763,11 @@ enum msg_hash_enums
MENU_LABEL(NETPLAY_ENABLE_CLIENT),
MENU_LABEL(NETPLAY_DISCONNECT),
MENU_LABEL(NETPLAY_CONNECT_TO),
MENU_LABEL(NETPLAY_KICK),
MENU_ENUM_LABEL_DEFERRED_NETPLAY_KICK_LIST,
MENU_ENUM_LABEL_NETPLAY_KICK_CLIENT,
MENU_LABEL(NO_NETPLAY_HOSTS_FOUND),
MENU_LABEL(NO_NETPLAY_CLIENTS_FOUND),
MENU_ENUM_LABEL_RESET,
MENU_ENUM_LABEL_SLOWMOTION_HOLD,