From 95a2da81e4b43fd7edcf1eeceb15cac5a171238a Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 18 Jan 2017 22:46:48 -0500 Subject: [PATCH] start adding ui elements to insert room list into --- intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.h | 10 +++++--- menu/cbs/menu_cbs_left.c | 3 +++ menu/cbs/menu_cbs_right.c | 3 +++ menu/cbs/menu_cbs_title.c | 2 ++ menu/drivers/xmb.c | 33 +++++++++++++++++++++++-- menu/menu_displaylist.c | 39 ++++++++++++++++++++++++++---- menu/menu_displaylist.h | 1 + menu/menu_driver.h | 1 + msg_hash.h | 1 + network/netplay/netplay_frontend.c | 1 - 11 files changed, 85 insertions(+), 11 deletions(-) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index b223e9fa33..e307a25cd5 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -14,6 +14,8 @@ MSG_HASH(MENU_ENUM_LABEL_CONFIGURATIONS_LIST, "configurations_list") MSG_HASH(MENU_ENUM_LABEL_ADD_TAB, "add_tab") +MSG_HASH(MENU_ENUM_LABEL_NETPLAY_TAB, + "netplay_tab") MSG_HASH(MENU_ENUM_LABEL_ARCHIVE_MODE, "archive_mode") MSG_HASH(MENU_ENUM_LABEL_ASSETS_DIRECTORY, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 4301bdd150..ffcfb615bf 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -199,6 +199,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_TAB, "Import content" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, + "Netplay Rooms" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ARCHIVE_MODE, "Archive File Association Action" @@ -967,13 +971,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CLIENT_SWAP_INPUT, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, "Netplay Delay Frames") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, - "Disconnect") + "Disconnect from netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, "Netplay Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, - "Connect to Netplay host") + "Connect to netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, - "Start hosting") + "Start netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Address") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 3a139c101b..dc8b6e1e3f 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -487,6 +487,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -586,6 +587,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -625,6 +627,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 92f2d02912..c313ff1271 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -474,6 +474,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -594,6 +595,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB)) || @@ -632,6 +634,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || + string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_IMAGES_TAB)) || diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 89710e9c5c..0c1cc995df 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -257,6 +257,8 @@ static int action_get_title_group_settings(const char *path, const char *label, strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB), len); else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB))) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TAB), len); + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB))) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_TAB), len); else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU), len); else diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2a436e6fbd..88d0327bc1 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -96,6 +96,9 @@ enum XMB_TEXTURE_MUSICS, XMB_TEXTURE_MOVIES, #endif +#ifdef HAVE_NETWORKING + XMB_TEXTURE_NETPLAY, +#endif #ifdef HAVE_IMAGEVIEWER XMB_TEXTURE_IMAGES, #endif @@ -151,10 +154,15 @@ enum #ifdef HAVE_IMAGEVIEWER XMB_SYSTEM_TAB_IMAGES, #endif - XMB_SYSTEM_TAB_ADD + XMB_SYSTEM_TAB_ADD, +#ifdef HAVE_NETWORKING + XMB_SYSTEM_TAB_NETPLAY +#endif }; -#ifdef HAVE_LIBRETRODB +#ifdef HAVE_NETWORKING +#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_NETPLAY +#elif defined(HAVE_LIBRETRODB) #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_ADD #elif defined(HAVE_IMAGEVIEWER) #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_IMAGES @@ -164,6 +172,7 @@ enum #define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_HISTORY #endif + typedef struct xmb_handle { file_list_t *menu_stack_old; @@ -300,6 +309,7 @@ typedef struct xmb_handle xmb_node_t settings_tab_node; xmb_node_t history_tab_node; xmb_node_t add_tab_node; + xmb_node_t netplay_tab_node; font_data_t *font; font_data_t *font2; @@ -1466,6 +1476,8 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i) return &xmb->history_tab_node; case XMB_SYSTEM_TAB_ADD: return &xmb->add_tab_node; + case XMB_SYSTEM_TAB_NETPLAY: + return &xmb->netplay_tab_node; default: if (i > xmb->system_tab_end) return xmb_get_userdata_from_horizontal_list( @@ -3249,6 +3261,9 @@ static void *xmb_init(void **userdata) if (settings->menu.xmb.show_add) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_ADD; #endif +#ifdef HAVE_NETWORKING + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_NETPLAY; +#endif menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); @@ -3464,6 +3479,8 @@ static const char *xmb_texture_path(unsigned id) return "off.png"; case XMB_TEXTURE_ADD: return "add.png"; + case XMB_TEXTURE_NETPLAY: + return "wifi.png"; case XMB_TEXTURE_KEY: return "key.png"; case XMB_TEXTURE_KEY_HOVER: @@ -3514,6 +3531,12 @@ static void xmb_context_reset_textures( xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD]; xmb->add_tab_node.alpha = xmb->categories.active.alpha; xmb->add_tab_node.zoom = xmb->categories.active.zoom; + +#ifdef HAVE_NETWORKING + xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; + xmb->netplay_tab_node.alpha = xmb->categories.active.alpha; + xmb->netplay_tab_node.zoom = xmb->categories.active.zoom; +#endif } static void xmb_context_reset_background(const char *iconpath) @@ -3826,6 +3849,12 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action menu_stack->list[stack_size - 1].type = MENU_ADD_TAB; break; + case XMB_SYSTEM_TAB_NETPLAY: + menu_stack->list[stack_size - 1].label = + strdup(msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB)); + menu_stack->list[stack_size - 1].type = + MENU_NETPLAY_TAB; + break; default: menu_stack->list[stack_size - 1].label = strdup(msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 84f802422e..8f6ee38771 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -244,11 +244,6 @@ static int menu_displaylist_parse_netplay( MENU_ENUM_LABEL_NETPLAY_DISCONNECT, MENU_SETTING_ACTION, 0, 0); - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_SETTINGS), - MENU_ENUM_LABEL_NETWORK_SETTINGS, MENU_SETTING_GROUP, 0, 0); - menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS), @@ -2697,6 +2692,11 @@ static int menu_displaylist_parse_load_content_settings( MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS, MENU_SETTING_ACTION, 0, 0); +#ifdef HAVE_NETWORKING + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_NETPLAY, + PARSE_ACTION, false); +#endif menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS), @@ -2930,6 +2930,7 @@ static int menu_displaylist_parse_add_content_list( static int menu_displaylist_parse_scan_directory_list( menu_displaylist_info_t *info) { + #ifdef HAVE_LIBRETRODB menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), @@ -2947,6 +2948,21 @@ static int menu_displaylist_parse_scan_directory_list( return 0; } +static int menu_displaylist_parse_netplay_room_list( + menu_displaylist_info_t *info) +{ + +#ifdef HAVE_NETWORKING + menu_entries_append_enum(info->list, + "Refresh Room List", + msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY), + MENU_ENUM_LABEL_SCAN_DIRECTORY, + MENU_SETTING_ACTION, 0, 0); +#endif + + return 0; +} + static int menu_displaylist_parse_options( menu_displaylist_info_t *info) { @@ -3781,6 +3797,12 @@ static bool menu_displaylist_push_internal( return false; return true; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_TAB))) + { + if (!menu_displaylist_ctl(DISPLAYLIST_NETPLAY_ROOM_LIST, info)) + return false; + return true; + } else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))) { if (!menu_displaylist_ctl(DISPLAYLIST_HORIZONTAL, info)) @@ -3909,6 +3931,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_ADD_CONTENT_LIST: case DISPLAYLIST_CONFIGURATIONS_LIST: case DISPLAYLIST_SCAN_DIRECTORY_LIST: + case DISPLAYLIST_NETPLAY_ROOM_LIST: case DISPLAYLIST_LOAD_CONTENT_LIST: case DISPLAYLIST_USER_BINDS_LIST: case DISPLAYLIST_ACCOUNTS_LIST: @@ -5312,6 +5335,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_SCAN_DIRECTORY_LIST: ret = menu_displaylist_parse_scan_directory_list(info); + info->need_push = true; + info->need_refresh = true; + break; + case DISPLAYLIST_NETPLAY_ROOM_LIST: + ret = menu_displaylist_parse_netplay_room_list(info); + info->need_push = true; info->need_refresh = true; break; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 5e63c5f768..c7156ec55d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -151,6 +151,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_ADD_CONTENT_LIST, DISPLAYLIST_CONFIGURATIONS_LIST, DISPLAYLIST_SCAN_DIRECTORY_LIST, + DISPLAYLIST_NETPLAY_ROOM_LIST, DISPLAYLIST_ARCHIVE_ACTION, DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE, DISPLAYLIST_CORE_CONTENT, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index e097fd6a06..3429cac4f6 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -158,6 +158,7 @@ enum menu_settings_type MENU_MUSIC_TAB, MENU_VIDEO_TAB, MENU_IMAGES_TAB, + MENU_NETPLAY_TAB, MENU_ADD_TAB, MENU_PLAYLISTS_TAB, MENU_SETTING_NO_ITEM, diff --git a/msg_hash.h b/msg_hash.h index 863c19246d..f3cd259221 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1146,6 +1146,7 @@ enum msg_hash_enums MENU_LABEL(SETTINGS_TAB), MENU_LABEL(HISTORY_TAB), MENU_LABEL(ADD_TAB), + MENU_LABEL(NETPLAY_TAB), MENU_LABEL(PLAYLISTS_TAB), MENU_LABEL(MAIN_MENU), MENU_LABEL(INPUT_SETTINGS), diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index d8a9bc6b41..1181c0eaab 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -551,7 +551,6 @@ bool netplay_pre_frame(netplay_t *netplay) { bool sync_stalled; reannounce ++; - RARCH_LOG("%d\n", reannounce); if (reannounce % 3600 == 0) netplay_announce(); retro_assert(netplay);