mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 03:40:24 +00:00
remove some more code duplication, lan rooms now show up correctly on left-right
This commit is contained in:
parent
4710bfcf43
commit
c783dbff28
@ -3447,37 +3447,20 @@ static int action_ok_push_scan_file(const char *path,
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
struct netplay_host_list *lan_hosts;
|
||||
int lan_room_count;
|
||||
void netplay_refresh_rooms_menu(file_list_t *list)
|
||||
{
|
||||
char s[PATH_MAX_LENGTH];
|
||||
int i, j , k;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
if (netplay_room_count != 0)
|
||||
{
|
||||
RARCH_LOG ("Found %d rooms...\n", netplay_room_count);
|
||||
|
||||
for (i = 0; i < netplay_room_count; i++)
|
||||
{
|
||||
|
||||
/*strlcpy(netplay_room_list[i].nickname,
|
||||
room_data->elems[j + 0].data,
|
||||
sizeof(netplay_room_list[i].nickname));
|
||||
strlcpy(netplay_room_list[i].address,
|
||||
room_data->elems[j + 1].data,
|
||||
sizeof(netplay_room_list[i].address));
|
||||
strlcpy(netplay_room_list[i].corename,
|
||||
room_data->elems[j + 3].data,
|
||||
sizeof(netplay_room_list[i].corename));
|
||||
strlcpy(netplay_room_list[i].coreversion,
|
||||
room_data->elems[j + 4].data,
|
||||
sizeof(netplay_room_list[i].coreversion));
|
||||
strlcpy(netplay_room_list[i].gamename,
|
||||
room_data->elems[j + 5].data,
|
||||
sizeof(netplay_room_list[i].gamename));
|
||||
|
||||
netplay_room_list[i].port = atoi(room_data->elems[j + 2].data);
|
||||
netplay_room_list[i].gamecrc = atoi(room_data->elems[j + 6].data);
|
||||
netplay_room_list[i].timestamp = atoi(room_data->elems[j + 7].data);*/
|
||||
|
||||
/* Uncomment this to debug mismatched room parameters*/
|
||||
#if 0
|
||||
RARCH_LOG("Room Data: %d\n"
|
||||
@ -3499,10 +3482,18 @@ void netplay_refresh_rooms_menu(file_list_t *list)
|
||||
netplay_room_list[i].timestamp);
|
||||
#endif
|
||||
j+=8;
|
||||
|
||||
snprintf(s, sizeof(s),
|
||||
if (netplay_room_list[i].lan)
|
||||
{
|
||||
snprintf(s, sizeof(s),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN),
|
||||
netplay_room_list[i].nickname);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(s, sizeof(s),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME),
|
||||
netplay_room_list[i].nickname);
|
||||
}
|
||||
|
||||
menu_entries_append_enum(list,
|
||||
s,
|
||||
@ -3559,13 +3550,9 @@ finish:
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int lan_room_count = 0;
|
||||
struct netplay_host_list *lan_hosts = NULL;
|
||||
file_list_t *file_list = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
#if 1
|
||||
netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &lan_hosts);
|
||||
#endif
|
||||
if (lan_hosts)
|
||||
lan_room_count = (int)lan_hosts->size;
|
||||
|
||||
@ -3618,8 +3605,6 @@ finish:
|
||||
for (i = 0; i < netplay_room_count; i++)
|
||||
memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i]));
|
||||
|
||||
netplay_refresh_rooms_menu(file_list);
|
||||
|
||||
if (lan_room_count != 0)
|
||||
{
|
||||
struct netplay_host *host = NULL;
|
||||
@ -3649,20 +3634,15 @@ finish:
|
||||
netplay_room_list[i].port = 55435;
|
||||
netplay_room_list[i].gamecrc = host->content_crc;
|
||||
netplay_room_list[i].timestamp = 0;
|
||||
netplay_room_list[i].lan = true;
|
||||
|
||||
snprintf(s, sizeof(s),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN),
|
||||
netplay_room_list[i].nickname);
|
||||
|
||||
menu_entries_append_enum(file_list,
|
||||
s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
|
||||
MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM,
|
||||
MENU_ROOM, 0, 0);
|
||||
k++;
|
||||
}
|
||||
netplay_room_count += lan_room_count;
|
||||
}
|
||||
netplay_refresh_rooms_menu(file_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ struct netplay_room
|
||||
int host_method;
|
||||
bool has_password;
|
||||
bool has_spectate_password;
|
||||
bool lan;
|
||||
bool fixed;
|
||||
struct netplay_room *next;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user