Add RetroArch version and use different icons for different room types

This commit is contained in:
radius 2017-07-09 18:19:56 -05:00
parent b8bbf77196
commit e09075dc25
6 changed files with 41 additions and 25 deletions

View File

@ -932,7 +932,7 @@ static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info
core_info_get_current_core((core_info_t**)&info); core_info_get_current_core((core_info_t**)&info);
if (info) if (info)
{ {
RARCH_LOG("Use the current core (%s) to load this content...\n", RARCH_LOG("[lobby] use the current core (%s) to load this content...\n",
info->path); info->path);
supported = 1; supported = 1;
} }
@ -3415,7 +3415,7 @@ static int action_ok_netplay_connect_room(const char *path,
netplay_room_list[idx - 3].port); netplay_room_list[idx - 3].port);
} }
RARCH_LOG("Connecting to: %s with game: %s/%08x\n", RARCH_LOG("[lobby] connecting to: %s with game: %s/%08x\n",
tmp_hostname, tmp_hostname,
netplay_room_list[idx - 3].gamename, netplay_room_list[idx - 3].gamename,
netplay_room_list[idx - 3].gamecrc); netplay_room_list[idx - 3].gamecrc);
@ -3649,13 +3649,13 @@ void netplay_refresh_rooms_menu(file_list_t *list)
if (netplay_room_count != 0) if (netplay_room_count != 0)
{ {
RARCH_LOG ("Found %d rooms...\n", netplay_room_count); RARCH_LOG ("[lobby] found %d rooms...\n", netplay_room_count);
for (i = 0; i < netplay_room_count; i++) for (i = 0; i < netplay_room_count; i++)
{ {
/* Uncomment this to debug mismatched room parameters*/ /* Uncomment this to debug mismatched room parameters*/
#if 0 #if 0
RARCH_LOG("Room Data: %d\n" RARCH_LOG("[lobby] room Data: %d\n"
"Nickname: %s\n" "Nickname: %s\n"
"Address: %s\n" "Address: %s\n"
"Port: %d\n" "Port: %d\n"
@ -3674,24 +3674,21 @@ void netplay_refresh_rooms_menu(file_list_t *list)
netplay_room_list[i].timestamp); netplay_room_list[i].timestamp);
#endif #endif
j+=8; j+=8;
if (netplay_room_list[i].lan) snprintf(s, sizeof(s),
{ msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME),
snprintf(s, sizeof(s), netplay_room_list[i].nickname);
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);
}
/*
netplay_room_list[i - 3].lan ? "LAN game" :
(netplay_room_list[i - 3].host_method == NETPLAY_HOST_METHOD_MITM ?
"MITM game" : "Lobby game"), netplay_room_list[i - 3].address);*/
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); room_type, 0, 0);
} }
netplay_rooms_free(); netplay_rooms_free();
@ -3729,7 +3726,7 @@ static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const cha
if (string_is_empty(data->data)) if (string_is_empty(data->data))
{ {
netplay_room_count = 0; netplay_room_count = 0;
RARCH_LOG("Room list empty\n"); RARCH_LOG("[lobby] room list empty\n");
} }
else else
{ {
@ -3804,7 +3801,7 @@ static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const cha
netplay_room_list[i].lan = true; netplay_room_list[i].lan = true;
snprintf(s, sizeof(s), snprintf(s, sizeof(s),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME),
netplay_room_list[i].nickname); netplay_room_list[i].nickname);
} }
netplay_room_count += lan_room_count; netplay_room_count += lan_room_count;

View File

@ -23,6 +23,9 @@
#endif #endif
#include "../../verbosity.h" #include "../../verbosity.h"
#include <string.h>
#include <string/stdstring.h>
#ifndef BIND_ACTION_SUBLABEL #ifndef BIND_ACTION_SUBLABEL
#define BIND_ACTION_SUBLABEL(cbs, name) \ #define BIND_ACTION_SUBLABEL(cbs, name) \
cbs->action_sublabel = name; \ cbs->action_sublabel = name; \
@ -359,13 +362,10 @@ static int action_bind_sublabel_netplay_room(
if (i < 1) if (i < 1)
return 0; return 0;
snprintf(s,len, "%s (%s)\n%s (%08x)\nType: %s (%s)", snprintf(s,len, "RetroArch: %s\nCore: %s (%s)\nGame: %s (%08x)",
string_is_empty(netplay_room_list[i - 3].retroarchversion) ? "N/A" : netplay_room_list[i - 3].retroarchversion,
netplay_room_list[i - 3].corename, netplay_room_list[i - 3].coreversion, netplay_room_list[i - 3].corename, netplay_room_list[i - 3].coreversion,
netplay_room_list[i - 3].gamename, netplay_room_list[i - 3].gamecrc, netplay_room_list[i - 3].gamename, netplay_room_list[i - 3].gamecrc);
netplay_room_list[i - 3].lan ? "LAN game" :
(netplay_room_list[i - 3].host_method == NETPLAY_HOST_METHOD_MITM ?
"MITM game" : "Lobby game"), netplay_room_list[i - 3].address);
#if 0 #if 0
strlcpy(s, netplay_room_list[i - 3].corename, len); strlcpy(s, netplay_room_list[i - 3].corename, len);
#endif #endif

View File

@ -97,6 +97,8 @@ enum
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
XMB_TEXTURE_NETPLAY, XMB_TEXTURE_NETPLAY,
XMB_TEXTURE_ROOM, XMB_TEXTURE_ROOM,
XMB_TEXTURE_ROOM_LAN,
XMB_TEXTURE_ROOM_MITM,
#endif #endif
#ifdef HAVE_IMAGEVIEWER #ifdef HAVE_IMAGEVIEWER
XMB_TEXTURE_IMAGES, XMB_TEXTURE_IMAGES,
@ -2148,6 +2150,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
case MENU_ROOM: case MENU_ROOM:
return xmb->textures.list[XMB_TEXTURE_ROOM]; return xmb->textures.list[XMB_TEXTURE_ROOM];
case MENU_ROOM_LAN:
return xmb->textures.list[XMB_TEXTURE_ROOM_LAN];
case MENU_ROOM_MITM:
return xmb->textures.list[XMB_TEXTURE_ROOM_MITM];
#endif #endif
} }
@ -3528,6 +3534,10 @@ static const char *xmb_texture_path(unsigned id)
return "netplay.png"; return "netplay.png";
case XMB_TEXTURE_ROOM: case XMB_TEXTURE_ROOM:
return "room.png"; return "room.png";
case XMB_TEXTURE_ROOM_LAN:
return "room_lan.png";
case XMB_TEXTURE_ROOM_MITM:
return "room_mitm.png";
#endif #endif
case XMB_TEXTURE_KEY: case XMB_TEXTURE_KEY:
return "key.png"; return "key.png";

View File

@ -167,6 +167,8 @@ enum menu_settings_type
MENU_SETTING_HORIZONTAL_MENU, MENU_SETTING_HORIZONTAL_MENU,
MENU_WIFI, MENU_WIFI,
MENU_ROOM, MENU_ROOM,
MENU_ROOM_LAN,
MENU_ROOM_MITM,
MENU_NETPLAY_LAN_SCAN, MENU_NETPLAY_LAN_SCAN,
MENU_INFO_MESSAGE, MENU_INFO_MESSAGE,
MENU_SETTINGS_SHADER_PARAMETER_0, MENU_SETTINGS_SHADER_PARAMETER_0,

View File

@ -76,6 +76,7 @@ struct netplay_room
bool has_spectate_password; bool has_spectate_password;
bool lan; bool lan;
bool fixed; bool fixed;
char retroarchversion [PATH_MAX_LENGTH];
struct netplay_room *next; struct netplay_room *next;
}; };

View File

@ -279,6 +279,12 @@ static JSON_Parser_HandlerResult JSON_CALL ObjectMemberHandler(JSON_Parser parse
pCtx->cur_field = strdup(pValue); pCtx->cur_field = strdup(pValue);
pCtx->cur_member = &rooms->cur->host_method; pCtx->cur_member = &rooms->cur->host_method;
} }
else if (string_is_equal_fast(pValue, "retroarch_version", 17))
{
pCtx->cur_field = strdup(pValue);
pCtx->cur_member = &rooms->cur->retroarchversion;
pCtx->cur_member_size = sizeof(rooms->cur->retroarchversion);
}
} }
} }