start adding descriptions for netplay rooms

This commit is contained in:
radius 2017-08-15 20:20:24 -05:00
parent cf7fd7b34b
commit 6f4697d60f
2 changed files with 33 additions and 8 deletions

View File

@ -17,6 +17,7 @@
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../verbosity.h"
#include "../widgets/menu_dialog.h"
@ -26,6 +27,10 @@
cbs->action_info_ident = #name;
#endif
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay_discovery.h"
#endif
static int action_info_default(unsigned type, const char *label)
{
menu_displaylist_info_t info = {0};
@ -65,6 +70,20 @@ static int action_info_cheevos(unsigned type, const char *label)
}
#endif
#ifdef HAVE_NETWORKING
static int action_info_room(unsigned type, const char *label)
{
unsigned new_id = type - MENU_SETTINGS_NETPLAY_ROOMS_START;
#if 1
RARCH_LOG ("Room id: %u IP: %s Port: %u\n", new_id,
netplay_room_list[new_id].address, netplay_room_list[new_id].port);
#endif
/* add description here
the relevant data is in netplay_room_list[new_id]*/
return 0;
}
#endif
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
@ -72,13 +91,22 @@ int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
return -1;
#ifdef HAVE_CHEEVOS
if ((type >= MENU_SETTINGS_CHEEVOS_START))
if ((type >= MENU_SETTINGS_CHEEVOS_START) &&
(type < MENU_SETTINGS_NETPLAY_ROOMS_START))
{
BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0;
}
#endif
#ifdef HAVE_NETWORKING
if ((type >= MENU_SETTINGS_NETPLAY_ROOMS_START))
{
BIND_ACTION_INFO(cbs, action_info_room);
return 0;
}
#endif
BIND_ACTION_INFO(cbs, action_info_default);
return -1;

View File

@ -3417,7 +3417,6 @@ void netplay_refresh_rooms_menu(file_list_t *list)
{
char s[4115];
int i = 0;
int j = 0;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list);
@ -3496,20 +3495,18 @@ void netplay_refresh_rooms_menu(file_list_t *list)
netplay_room_list[i].gamecrc,
netplay_room_list[i].timestamp);
#endif
j+=8;
snprintf(s, sizeof(s), "%s: %s%s",
netplay_room_list[i].lan ? "Local" :
(netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ?
"Internet (relay)" : "Internet (direct)"),
netplay_room_list[i].nickname, country);
/*int room_type = netplay_room_list[i].lan ? MENU_ROOM_LAN :
(netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ? MENU_ROOM_MITM : MENU_ROOM); */
menu_entries_append_enum(list,
s,
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM,
MENU_ROOM, 0, 0);
MENU_SETTINGS_NETPLAY_ROOMS_START + i, 0, 0);
}
netplay_rooms_free();