mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
cut code duplication further
This commit is contained in:
parent
1de95c6413
commit
54ce598a00
@ -3348,6 +3348,42 @@ void netplay_refresh_rooms_menu(file_list_t *list)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
menu_entries_append_enum(list,
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT),
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
|
||||||
|
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_REFRESH_ROOMS),
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
|
||||||
|
MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS,
|
||||||
|
MENU_SETTING_ACTION, 0, 0);
|
||||||
|
|
||||||
if (netplay_room_count != 0)
|
if (netplay_room_count != 0)
|
||||||
{
|
{
|
||||||
RARCH_LOG ("Found %d rooms...\n", netplay_room_count);
|
RARCH_LOG ("Found %d rooms...\n", netplay_room_count);
|
||||||
@ -3463,42 +3499,6 @@ finish:
|
|||||||
calloc(netplay_room_count + lan_room_count,
|
calloc(netplay_room_count + lan_room_count,
|
||||||
sizeof(struct netplay_room));
|
sizeof(struct netplay_room));
|
||||||
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
|
|
||||||
|
|
||||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
|
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(file_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))
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(file_list,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT),
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
|
|
||||||
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
|
|
||||||
MENU_SETTING_ACTION, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(file_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(file_list,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS),
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
|
|
||||||
MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS,
|
|
||||||
MENU_SETTING_ACTION, 0, 0);
|
|
||||||
|
|
||||||
for (i = 0; i < netplay_room_count; i++)
|
for (i = 0; i < netplay_room_count; i++)
|
||||||
memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i]));
|
memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i]));
|
||||||
|
|
||||||
|
@ -3127,43 +3127,7 @@ static int menu_displaylist_parse_netplay_room_list(
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
|
||||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
|
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(info->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))
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(info->list,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT),
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
|
|
||||||
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
|
|
||||||
MENU_SETTING_ACTION, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
menu_entries_append_enum(info->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(info->list,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS),
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
|
|
||||||
MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS,
|
|
||||||
MENU_SETTING_ACTION, 0, 0);
|
|
||||||
|
|
||||||
netplay_refresh_rooms_menu(info->list);
|
netplay_refresh_rooms_menu(info->list);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user