Create Netplay Hosting submenu

This commit is contained in:
twinaphex 2019-12-30 03:01:52 +01:00
parent fdd4915718
commit 2169a25b0a
9 changed files with 92 additions and 17 deletions

View File

@ -399,6 +399,8 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_QUICK_MENU_VIEWS_SETTINGS_LIST,
"deferred_quick_menu_views_settings_list")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_SETTINGS_VIEWS_SETTINGS_LIST,
"deferred_settings_views_settings_list")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST,
"deferred_network_hosting_settings_list")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST,
"deferred_network_settings_list")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST,
@ -859,6 +861,8 @@ MSG_HASH(MENU_ENUM_LABEL_NETWORK_REMOTE_USER_LAST_ENABLE,
"network_remote_user_last_enable")
MSG_HASH(MENU_ENUM_LABEL_NETWORK_ON_DEMAND_THUMBNAILS,
"network_on_demand_thumbnails")
MSG_HASH(MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS,
"network_hosting_settings")
MSG_HASH(MENU_ENUM_LABEL_NETWORK_SETTINGS,
"network_settings")
MSG_HASH(MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY,

View File

@ -2167,6 +2167,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NETWORK_ON_DEMAND_THUMBNAILS,
"Automatically download missing thumbnail images while browsing playlists. Has a severe performance impact."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETWORK_HOSTING_SETTINGS,
"Host"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS,
"Network"

View File

@ -182,6 +182,7 @@ generic_deferred_push(deferred_push_retro_achievements_settings_list,DISPLAYLIST
generic_deferred_push(deferred_push_updater_settings_list, DISPLAYLIST_UPDATER_SETTINGS_LIST)
generic_deferred_push(deferred_push_wifi_settings_list, DISPLAYLIST_WIFI_SETTINGS_LIST)
generic_deferred_push(deferred_push_network_settings_list, DISPLAYLIST_NETWORK_SETTINGS_LIST)
generic_deferred_push(deferred_push_network_hosting_settings_list, DISPLAYLIST_NETWORK_HOSTING_SETTINGS_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)
@ -715,6 +716,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST, deferred_push_retro_achievements_settings_list},
{MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST, deferred_push_updater_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST, deferred_push_network_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST, deferred_push_network_hosting_settings_list},
{MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST, deferred_push_wifi_settings_list},
{MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST, deferred_push_lakka_services_list},
{MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST, deferred_push_user_settings_list},

View File

@ -278,6 +278,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
return MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST;
case ACTION_OK_DL_UPDATER_SETTINGS_LIST:
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_NETWORK_SETTINGS_LIST:
return MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST;
case ACTION_OK_DL_WIFI_SETTINGS_LIST:
@ -1109,6 +1111,7 @@ int generic_action_ok_displaylist_push(const char *path,
case ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST:
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_WIFI_SETTINGS_LIST:
case ACTION_OK_DL_NETPLAY:
case ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST:
@ -4789,6 +4792,7 @@ default_action_ok_func(action_ok_directory_push, ACTION_OK_DL_DIRECTORY_PUSH)
default_action_ok_func(action_ok_configurations_list, ACTION_OK_DL_CONFIGURATIONS_LIST)
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_database_manager_list, ACTION_OK_DL_DATABASE_MANAGER_LIST)
default_action_ok_func(action_ok_wifi_list, ACTION_OK_DL_WIFI_SETTINGS_LIST)
default_action_ok_func(action_ok_cursor_manager_list, ACTION_OK_DL_CURSOR_MANAGER_LIST)
@ -5037,16 +5041,13 @@ void netplay_refresh_rooms_menu(file_list_t *list)
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_HOSTING_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS),
MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS,
MENU_SETTING_ACTION, 0, 0);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
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))
{
@ -5056,14 +5057,6 @@ void netplay_refresh_rooms_menu(file_list_t *list)
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
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);
}
menu_entries_append_enum(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT),
@ -6954,6 +6947,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_WIFI_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_wifi_list);
break;
case MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_network_hosting_list);
break;
case MENU_ENUM_LABEL_NETWORK_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_network_list);
break;

View File

@ -376,6 +376,7 @@ default_title_macro(action_get_menu_sounds_list, MENU_ENUM_LABEL_
default_title_macro(action_get_menu_file_browser_settings_list, MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS)
default_title_macro(action_get_retro_achievements_settings_list,MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS)
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_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)
#ifdef HAVE_LAKKA
@ -664,6 +665,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST, action_get_retro_achievements_settings_list},
{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_NETWORK_SETTINGS_LIST, action_get_network_settings_list},
{MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST, action_get_netplay_lan_scan_settings_list},
#ifdef HAVE_LAKKA

View File

@ -173,6 +173,7 @@ enum
ACTION_OK_DL_UPDATER_SETTINGS_LIST,
ACTION_OK_DL_WIFI_SETTINGS_LIST,
ACTION_OK_DL_NETWORK_SETTINGS_LIST,
ACTION_OK_DL_NETWORK_HOSTING_SETTINGS_LIST,
ACTION_OK_DL_NETPLAY_LAN_SCAN_SETTINGS_LIST,
ACTION_OK_DL_LAKKA_SERVICES_LIST,
ACTION_OK_DL_USER_SETTINGS_LIST,

View File

@ -7007,6 +7007,69 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
switch (type)
{
case DISPLAYLIST_NETWORK_HOSTING_SETTINGS_LIST:
{
bool include_everything = true;
settings_t *settings = config_get_ptr();
file_list_t *list = info->list;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT, PARSE_ONLY_UINT, 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_PUBLIC_ANNOUNCE, PARSE_ONLY_BOOL, true },
};
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
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))
{
}
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);
}
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
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;
default:
break;
}
}
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++;
}
}
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
case DISPLAYLIST_OPTIONS_REMAPPINGS_PORT:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);

View File

@ -184,6 +184,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_UPDATER_SETTINGS_LIST,
DISPLAYLIST_WIFI_SETTINGS_LIST,
DISPLAYLIST_NETWORK_SETTINGS_LIST,
DISPLAYLIST_NETWORK_HOSTING_SETTINGS_LIST,
DISPLAYLIST_NETPLAY_LAN_SCAN_SETTINGS_LIST,
DISPLAYLIST_LAKKA_SERVICES_LIST,
DISPLAYLIST_USER_SETTINGS_LIST,

View File

@ -1186,6 +1186,7 @@ enum msg_hash_enums
MENU_LABEL(DIRECTORY_SETTINGS),
MENU_LABEL(PRIVACY_SETTINGS),
MENU_LABEL(MIDI_SETTINGS),
MENU_LABEL(NETWORK_HOSTING_SETTINGS),
MENU_LABEL(NETWORK_SETTINGS),
MENU_LABEL(NETPLAY_LAN_SCAN_SETTINGS),
@ -1347,6 +1348,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_WIFI_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETWORK_HOSTING_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST,
MENU_ENUM_LABEL_DEFERRED_LAKKA_SERVICES_LIST,