Add default 'no settings' entry if no settings could be added for

network settings
This commit is contained in:
twinaphex 2016-09-13 22:43:20 +02:00
parent 82dd2bc64c
commit 10c29cd317

View File

@ -4655,53 +4655,75 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
info->need_push = true; info->need_push = true;
break; break;
case DISPLAYLIST_NETWORK_SETTINGS_LIST: case DISPLAYLIST_NETWORK_SETTINGS_LIST:
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_ENABLE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS,
PARSE_ONLY_STRING, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_MODE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_CMD_ENABLE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_CMD_PORT,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_REMOTE_ENABLE,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_REMOTE_PORT,
PARSE_ONLY_UINT, false);
{ {
unsigned user; unsigned user;
unsigned count = 0;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_ENABLE,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_CLIENT_SWAP_INPUT,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS,
PARSE_ONLY_STRING, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_MODE,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES,
PARSE_ONLY_UINT, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT,
PARSE_ONLY_UINT, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_CMD_ENABLE,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_CMD_PORT,
PARSE_ONLY_UINT, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_REMOTE_ENABLE,
PARSE_ONLY_BOOL, false) != -1)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_NETWORK_REMOTE_PORT,
PARSE_ONLY_UINT, false) != -1)
count++;
for(user = 0; user < settings->input.max_users; user++) for(user = 0; user < settings->input.max_users; user++)
{ {
menu_displaylist_parse_settings_enum(menu, info, if (menu_displaylist_parse_settings_enum(menu, info,
(enum msg_hash_enums)(MENU_ENUM_LABEL_NETWORK_REMOTE_USER_1_ENABLE + user), (enum msg_hash_enums)(MENU_ENUM_LABEL_NETWORK_REMOTE_USER_1_ENABLE + user),
PARSE_ONLY_BOOL, false); PARSE_ONLY_BOOL, false) != -1)
count++;
} }
}
menu_displaylist_parse_settings_enum(menu, info, if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_STDIN_CMD_ENABLE, MENU_ENUM_LABEL_STDIN_CMD_ENABLE,
PARSE_ONLY_BOOL, false); PARSE_ONLY_BOOL, false) != -1)
count++;
if (count == 0)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND),
msg_hash_to_str(MENU_ENUM_LABEL_NO_SETTINGS_FOUND),
MENU_ENUM_LABEL_NO_SETTINGS_FOUND,
0, 0, 0);
}
info->need_refresh = true; info->need_refresh = true;
info->need_push = true; info->need_push = true;