From e09075dc2551f5b7a09efad8c37bc8f6e9bfd10b Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 9 Jul 2017 18:19:56 -0500 Subject: [PATCH] Add RetroArch version and use different icons for different room types --- menu/cbs/menu_cbs_ok.c | 35 +++++++++++++--------------- menu/cbs/menu_cbs_sublabel.c | 12 +++++----- menu/drivers/xmb.c | 10 ++++++++ menu/menu_driver.h | 2 ++ network/netplay/netplay_discovery.h | 1 + network/netplay/netplay_room_parse.c | 6 +++++ 6 files changed, 41 insertions(+), 25 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 9805887fee..25e88187ff 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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); 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); supported = 1; } @@ -3415,7 +3415,7 @@ static int action_ok_netplay_connect_room(const char *path, 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, netplay_room_list[idx - 3].gamename, netplay_room_list[idx - 3].gamecrc); @@ -3649,13 +3649,13 @@ void netplay_refresh_rooms_menu(file_list_t *list) 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++) { /* Uncomment this to debug mismatched room parameters*/ #if 0 - RARCH_LOG("Room Data: %d\n" + RARCH_LOG("[lobby] room Data: %d\n" "Nickname: %s\n" "Address: %s\n" "Port: %d\n" @@ -3674,24 +3674,21 @@ void netplay_refresh_rooms_menu(file_list_t *list) netplay_room_list[i].timestamp); #endif j+=8; - 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); - } + 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, s, msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, - MENU_ROOM, 0, 0); + room_type, 0, 0); } 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)) { netplay_room_count = 0; - RARCH_LOG("Room list empty\n"); + RARCH_LOG("[lobby] room list empty\n"); } 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; 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_count += lan_room_count; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 750cf41cd9..8fd9977be8 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -23,6 +23,9 @@ #endif #include "../../verbosity.h" +#include +#include + #ifndef BIND_ACTION_SUBLABEL #define BIND_ACTION_SUBLABEL(cbs, name) \ cbs->action_sublabel = name; \ @@ -359,13 +362,10 @@ static int action_bind_sublabel_netplay_room( if (i < 1) 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].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); - + netplay_room_list[i - 3].gamename, netplay_room_list[i - 3].gamecrc); #if 0 strlcpy(s, netplay_room_list[i - 3].corename, len); #endif diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 22c7a88f4e..5e4e50ab45 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -97,6 +97,8 @@ enum #ifdef HAVE_NETWORKING XMB_TEXTURE_NETPLAY, XMB_TEXTURE_ROOM, + XMB_TEXTURE_ROOM_LAN, + XMB_TEXTURE_ROOM_MITM, #endif #ifdef HAVE_IMAGEVIEWER XMB_TEXTURE_IMAGES, @@ -2148,6 +2150,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, #ifdef HAVE_NETWORKING case MENU_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 } @@ -3528,6 +3534,10 @@ static const char *xmb_texture_path(unsigned id) return "netplay.png"; case XMB_TEXTURE_ROOM: return "room.png"; + case XMB_TEXTURE_ROOM_LAN: + return "room_lan.png"; + case XMB_TEXTURE_ROOM_MITM: + return "room_mitm.png"; #endif case XMB_TEXTURE_KEY: return "key.png"; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 08a1ebdff6..1e8af0af8b 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -167,6 +167,8 @@ enum menu_settings_type MENU_SETTING_HORIZONTAL_MENU, MENU_WIFI, MENU_ROOM, + MENU_ROOM_LAN, + MENU_ROOM_MITM, MENU_NETPLAY_LAN_SCAN, MENU_INFO_MESSAGE, MENU_SETTINGS_SHADER_PARAMETER_0, diff --git a/network/netplay/netplay_discovery.h b/network/netplay/netplay_discovery.h index 5148a8af9a..97be8c88e1 100644 --- a/network/netplay/netplay_discovery.h +++ b/network/netplay/netplay_discovery.h @@ -76,6 +76,7 @@ struct netplay_room bool has_spectate_password; bool lan; bool fixed; + char retroarchversion [PATH_MAX_LENGTH]; struct netplay_room *next; }; diff --git a/network/netplay/netplay_room_parse.c b/network/netplay/netplay_room_parse.c index ecefc904ff..096147c5bc 100644 --- a/network/netplay/netplay_room_parse.c +++ b/network/netplay/netplay_room_parse.c @@ -279,6 +279,12 @@ static JSON_Parser_HandlerResult JSON_CALL ObjectMemberHandler(JSON_Parser parse pCtx->cur_field = strdup(pValue); 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); + } } }