mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Allow mitm server selection on OK callback (#13906)
* Allow mitm server selection on OK callback
This commit is contained in:
parent
102abb0223
commit
55aceb5356
@ -774,6 +774,10 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD,
|
||||
"deferred_dropdown_box_list_input_description_kbd"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER,
|
||||
"deferred_dropdown_box_list_netplay_mitm_server"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST,
|
||||
"deferred_configurations_list"
|
||||
|
@ -1864,6 +1864,14 @@ int msg_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
"to use for netplay. A server that is \n"
|
||||
"located closer to you may have less latency. \n");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER_LOCATION:
|
||||
snprintf(s, len,
|
||||
"Man-in-the-middle server location \n"
|
||||
" \n"
|
||||
"Picks which man-in-the-middle server \n"
|
||||
"will be used for netplay. A server that is \n"
|
||||
"located closer to you may have less latency. \n");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES:
|
||||
snprintf(s, len,
|
||||
"Maximum amount of swapchain images. This \n"
|
||||
|
@ -663,6 +663,9 @@ GENERIC_DEFERRED_PUSH_GENERAL(deferred_push_dropdown_box_list_input_device_type,
|
||||
GENERIC_DEFERRED_PUSH_GENERAL(deferred_push_dropdown_box_list_input_device_index, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_INPUT_DEVICE_INDEX)
|
||||
GENERIC_DEFERRED_PUSH_GENERAL(deferred_push_dropdown_box_list_input_description, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION)
|
||||
GENERIC_DEFERRED_PUSH_GENERAL(deferred_push_dropdown_box_list_input_description_kbd, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION_KBD)
|
||||
#ifdef HAVE_NETWORKING
|
||||
GENERIC_DEFERRED_PUSH_GENERAL(deferred_push_dropdown_box_list_netplay_mitm_server, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_NETPLAY_MITM_SERVER)
|
||||
#endif
|
||||
|
||||
static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
menu_file_list_cbs_t *cbs,
|
||||
@ -698,6 +701,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DEVICE_INDEX, deferred_push_dropdown_box_list_input_device_index},
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION, deferred_push_dropdown_box_list_input_description},
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD, deferred_push_dropdown_box_list_input_description_kbd},
|
||||
#ifdef HAVE_NETWORKING
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER, deferred_push_dropdown_box_list_netplay_mitm_server},
|
||||
#endif
|
||||
{MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST, deferred_push_browse_url_list},
|
||||
{MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_START, deferred_push_browse_url_start},
|
||||
{MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST, deferred_push_core_settings_list},
|
||||
|
@ -302,6 +302,10 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION;
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD:
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD;
|
||||
#ifdef HAVE_NETWORKING
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER:
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER;
|
||||
#endif
|
||||
case ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST;
|
||||
case ACTION_OK_DL_ACCOUNTS_LIST:
|
||||
@ -808,6 +812,17 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
#ifdef HAVE_NETWORKING
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = path;
|
||||
info_label = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER);
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
#endif
|
||||
case ACTION_OK_DL_USER_BINDS_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
@ -6788,6 +6803,28 @@ static int action_ok_push_dropdown_item_input_description_kbd(
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static int action_ok_push_dropdown_item_netplay_mitm_server(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
const char *menu_path = NULL;
|
||||
enum msg_hash_enums enum_idx;
|
||||
rarch_setting_t *setting;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
|
||||
enum_idx = (enum msg_hash_enums)atoi(menu_path);
|
||||
setting = menu_setting_find_enum(enum_idx);
|
||||
|
||||
if (!setting)
|
||||
return menu_cbs_exit();
|
||||
|
||||
strlcpy(setting->value.target.string,
|
||||
label, setting->size);
|
||||
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int action_ok_push_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -8558,6 +8595,11 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION_KBD:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_input_description_kbd);
|
||||
break;
|
||||
#ifdef HAVE_NETWORKING
|
||||
case MENU_SETTING_DROPDOWN_ITEM_NETPLAY_MITM_SERVER:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_netplay_mitm_server);
|
||||
break;
|
||||
#endif
|
||||
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_default);
|
||||
break;
|
||||
|
@ -1764,6 +1764,9 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs,
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DEVICE_INDEX, action_get_title_dropdown_item},
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION, action_get_title_dropdown_input_description},
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD, action_get_title_dropdown_input_description_kbd},
|
||||
#ifdef HAVE_NETWORKING
|
||||
{MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER, action_get_title_dropdown_item},
|
||||
#endif
|
||||
{MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS, action_get_quick_menu_views_settings_list},
|
||||
{MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, action_get_title_deferred_playlist_list},
|
||||
{MENU_ENUM_LABEL_DEFERRED_PLAYLIST_MANAGER_SETTINGS, action_get_title_deferred_playlist_list},
|
||||
|
@ -54,6 +54,9 @@ enum
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_INPUT_DEVICE_INDEX,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD,
|
||||
#ifdef HAVE_NETWORKING
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER,
|
||||
#endif
|
||||
ACTION_OK_DL_OPEN_ARCHIVE,
|
||||
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE,
|
||||
ACTION_OK_DL_MUSIC,
|
||||
|
@ -5287,6 +5287,55 @@ end:
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static int menu_displaylist_parse_netplay_mitm_server_list(
|
||||
menu_displaylist_info_t *info, settings_t *settings)
|
||||
{
|
||||
size_t count = 0;
|
||||
size_t i;
|
||||
size_t list_len = ARRAY_SIZE(netplay_mitm_server_list);
|
||||
|
||||
if (!settings)
|
||||
goto end;
|
||||
|
||||
for (i = 0; i < list_len; i++)
|
||||
{
|
||||
/* Add menu entry */
|
||||
if (menu_entries_append_enum(info->list,
|
||||
netplay_mitm_server_list[i].description,
|
||||
netplay_mitm_server_list[i].name,
|
||||
MENU_ENUM_LABEL_NETPLAY_MITM_SERVER_LOCATION,
|
||||
MENU_SETTING_DROPDOWN_ITEM_NETPLAY_MITM_SERVER,
|
||||
0, i))
|
||||
{
|
||||
if (string_is_equal(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i].name))
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[count].actiondata;
|
||||
if (cbs)
|
||||
cbs->checked = true;
|
||||
menu_navigation_set_selection(count);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
/* Fallback */
|
||||
if (count == 0)
|
||||
if (menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY),
|
||||
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
|
||||
FILE_TYPE_NONE, 0, 0))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int menu_displaylist_parse_input_description_kbd_list(
|
||||
menu_displaylist_info_t *info, settings_t *settings)
|
||||
{
|
||||
@ -12540,6 +12589,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
#ifdef HAVE_NETWORKING
|
||||
case DISPLAYLIST_DROPDOWN_LIST_NETPLAY_MITM_SERVER:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
count = menu_displaylist_parse_netplay_mitm_server_list(info, settings);
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
#endif
|
||||
case DISPLAYLIST_SAVING_SETTINGS_LIST:
|
||||
case DISPLAYLIST_DRIVER_SETTINGS_LIST:
|
||||
case DISPLAYLIST_LOGGING_SETTINGS_LIST:
|
||||
|
@ -72,6 +72,9 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_DROPDOWN_LIST_INPUT_DEVICE_INDEX,
|
||||
DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION,
|
||||
DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION_KBD,
|
||||
#ifdef HAVE_NETWORKING
|
||||
DISPLAYLIST_DROPDOWN_LIST_NETPLAY_MITM_SERVER,
|
||||
#endif
|
||||
DISPLAYLIST_CDROM_DETAIL_INFO,
|
||||
DISPLAYLIST_INFO,
|
||||
DISPLAYLIST_HELP,
|
||||
|
@ -110,6 +110,9 @@ enum menu_settings_type
|
||||
MENU_SETTING_DROPDOWN_ITEM_INPUT_DEVICE_INDEX,
|
||||
MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION,
|
||||
MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION_KBD,
|
||||
#ifdef HAVE_NETWORKING
|
||||
MENU_SETTING_DROPDOWN_ITEM_NETPLAY_MITM_SERVER,
|
||||
#endif
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM,
|
||||
|
@ -5858,6 +5858,22 @@ static int setting_string_action_left_driver(
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static int setting_string_action_ok_netplay_mitm_server(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
char enum_idx[16];
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
snprintf(enum_idx, sizeof(enum_idx), "%d", setting->enum_idx);
|
||||
|
||||
generic_action_ok_displaylist_push(
|
||||
enum_idx, /* we will pass the enumeration index of the string as a path */
|
||||
NULL, NULL, 0, idx, 0,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setting_string_action_left_netplay_mitm_server(
|
||||
rarch_setting_t *setting, size_t idx, bool wraparound)
|
||||
{
|
||||
@ -19585,6 +19601,7 @@ static bool setting_append_list(
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].action_start = setting_generic_action_start_default;
|
||||
(*list)[list_info->index - 1].action_ok = setting_string_action_ok_netplay_mitm_server;
|
||||
(*list)[list_info->index - 1].action_left = setting_string_action_left_netplay_mitm_server;
|
||||
(*list)[list_info->index - 1].action_right = setting_string_action_right_netplay_mitm_server;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
|
@ -1546,6 +1546,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DEVICE_INDEX,
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION,
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_INPUT_DESCRIPTION_KBD,
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_NETPLAY_MITM_SERVER,
|
||||
MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST,
|
||||
@ -3040,6 +3041,7 @@ enum msg_hash_enums
|
||||
|
||||
MENU_LABEL(NETPLAY_USE_MITM_SERVER),
|
||||
MENU_LABEL(NETPLAY_MITM_SERVER),
|
||||
MENU_ENUM_LABEL_NETPLAY_MITM_SERVER_LOCATION,
|
||||
MENU_LABEL(NETPLAY_CUSTOM_MITM_SERVER),
|
||||
MENU_LABEL(VIDEO_WINDOW_SHOW_DECORATIONS),
|
||||
MENU_LABEL(VIDEO_WINDOW_SAVE_POSITION),
|
||||
|
Loading…
x
Reference in New Issue
Block a user