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_driver.h"
#include "../menu_cbs.h" #include "../menu_cbs.h"
#include "../verbosity.h"
#include "../widgets/menu_dialog.h" #include "../widgets/menu_dialog.h"
@ -26,6 +27,10 @@
cbs->action_info_ident = #name; cbs->action_info_ident = #name;
#endif #endif
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay_discovery.h"
#endif
static int action_info_default(unsigned type, const char *label) static int action_info_default(unsigned type, const char *label)
{ {
menu_displaylist_info_t info = {0}; menu_displaylist_info_t info = {0};
@ -60,8 +65,22 @@ static int action_info_cheevos(unsigned type, const char *label)
menu_dialog_set_current_id(new_id); menu_dialog_set_current_id(new_id);
return generic_action_ok_help(NULL, label, new_id, 0, 0, return generic_action_ok_help(NULL, label, new_id, 0, 0,
MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION, MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION,
MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION); MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION);
}
#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 #endif
@ -72,13 +91,22 @@ int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
return -1; return -1;
#ifdef HAVE_CHEEVOS #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); BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0; return 0;
} }
#endif #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); BIND_ACTION_INFO(cbs, action_info_default);
return -1; return -1;

View File

@ -3417,7 +3417,6 @@ void netplay_refresh_rooms_menu(file_list_t *list)
{ {
char s[4115]; char s[4115];
int i = 0; int i = 0;
int j = 0;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); 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].gamecrc,
netplay_room_list[i].timestamp); netplay_room_list[i].timestamp);
#endif #endif
j+=8;
snprintf(s, sizeof(s), "%s: %s%s", snprintf(s, sizeof(s), "%s: %s%s",
netplay_room_list[i].lan ? "Local" : netplay_room_list[i].lan ? "Local" :
(netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ? (netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ?
"Internet (relay)" : "Internet (direct)"), "Internet (relay)" : "Internet (direct)"),
netplay_room_list[i].nickname, country); 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, menu_entries_append_enum(list,
s, s,
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
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(); netplay_rooms_free();