diff --git a/libretro-common/net/net_ifinfo_test.c b/libretro-common/net/net_ifinfo_test.c index aef3d96e42..cba7df3ab2 100644 --- a/libretro-common/net/net_ifinfo_test.c +++ b/libretro-common/net/net_ifinfo_test.c @@ -24,7 +24,7 @@ #include #include -#include +#include int main(int argc, const char *argv[]) { diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index d29074964a..6e5bb5155f 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -63,6 +63,11 @@ static int deferred_push_system_information(menu_displaylist_info_t *info) return deferred_push_dlist(info, DISPLAYLIST_SYSTEM_INFO); } +static int deferred_push_network_information(menu_displaylist_info_t *info) +{ + return deferred_push_dlist(info, DISPLAYLIST_NETWORK_INFO); +} + static int deferred_push_debug_information(menu_displaylist_info_t *info) { return deferred_push_dlist(info, DISPLAYLIST_DEBUG_INFO); @@ -694,6 +699,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_LABEL_SYSTEM_INFORMATION: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_system_information); break; + case MENU_LABEL_NETWORK_INFORMATION: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_network_information); + break; case MENU_LABEL_DEBUG_INFORMATION: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_debug_information); break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index cc5cf02392..8bc67d5d2d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2346,6 +2346,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS: case MENU_LABEL_CORE_INFORMATION: case MENU_LABEL_SYSTEM_INFORMATION: + case MENU_LABEL_NETWORK_INFORMATION: case MENU_LABEL_DEBUG_INFORMATION: case MENU_LABEL_ACHIEVEMENT_LIST: case MENU_LABEL_DISK_OPTIONS: diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 12c723dce3..d6e850af0e 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -620,6 +620,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) return "achievement_list"; case MENU_LABEL_SYSTEM_INFORMATION: return "system_information"; + case MENU_LABEL_NETWORK_INFORMATION: + return "network_information"; case MENU_LABEL_ONLINE_UPDATER: return "online_updater"; case MENU_LABEL_CORE_INFORMATION: @@ -1304,6 +1306,8 @@ const char *menu_hash_to_str_us(uint32_t hash) return "Automatically extract downloaded archive"; case MENU_LABEL_VALUE_SYSTEM_INFORMATION: return "System Information"; + case MENU_LABEL_VALUE_NETWORK_INFORMATION: + return "Network Information"; case MENU_LABEL_VALUE_DEBUG_INFORMATION: return "Debug Information"; case MENU_LABEL_VALUE_ACHIEVEMENT_LIST: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index fdd6a8d355..6af74f11ff 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -442,6 +442,37 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info) return 0; } +#ifdef HAVE_NETPLAY +#ifndef HAVE_SOCKET_LEGACY +#include + +static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info) +{ + unsigned k = 0; + net_ifinfo_t *list = + (net_ifinfo_t*)calloc(1, sizeof(*list)); + + if (!list) + return -1; + + if (!net_ifinfo_new(list)) + return -1; + + for (k = 0; k < list->size; k++) + { + char tmp[PATH_MAX_LENGTH]; + snprintf(tmp, sizeof(tmp), "Interface (%s) : %s\n", + list->entries[k].name, list->entries[k].host); + menu_entries_push(info->list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0, 0); + } + + net_ifinfo_free(list); + return 0; +} +#endif +#endif + static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) { int controller; @@ -2142,6 +2173,15 @@ static int menu_displaylist_parse_information_list( menu_hash_to_str(MENU_LABEL_CORE_INFORMATION), MENU_SETTING_ACTION, 0, 0); +#ifdef HAVE_NETPLAY +#ifndef HAVE_SOCKET_LEGACY + menu_entries_push(info->list, + menu_hash_to_str(MENU_LABEL_VALUE_NETWORK_INFORMATION), + menu_hash_to_str(MENU_LABEL_NETWORK_INFORMATION), + MENU_SETTING_ACTION, 0, 0); +#endif +#endif + menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFORMATION), menu_hash_to_str(MENU_LABEL_SYSTEM_INFORMATION), @@ -2954,6 +2994,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_PLAYLIST_COLLECTION: case DISPLAYLIST_HISTORY: case DISPLAYLIST_OPTIONS_DISK: + case DISPLAYLIST_NETWORK_INFO: case DISPLAYLIST_SYSTEM_INFO: case DISPLAYLIST_DEBUG_INFO: case DISPLAYLIST_ACHIEVEMENT_LIST: @@ -3553,6 +3594,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->need_push = true; break; + case DISPLAYLIST_NETWORK_INFO: +#ifdef HAVE_NETPLAY +#ifndef HAVE_SOCKET_LEGACY + menu_displaylist_parse_network_info(info); +#endif +#endif + info->need_push = true; + info->need_refresh = true; + break; case DISPLAYLIST_SYSTEM_INFO: menu_displaylist_parse_system_info(info); info->need_push = true; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index d1eecf00a4..ff46de8105 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -89,6 +89,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_OVERLAYS, DISPLAYLIST_SHADER_PARAMETERS, DISPLAYLIST_SHADER_PARAMETERS_PRESET, + DISPLAYLIST_NETWORK_INFO, DISPLAYLIST_SYSTEM_INFO, DISPLAYLIST_DEBUG_INFO, DISPLAYLIST_ACHIEVEMENT_LIST, diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 3d1c6128a9..7dfd56dc73 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -759,6 +759,8 @@ extern "C" { #define MENU_LABEL_CORE_COUNTERS 0x64cc83e0U #define MENU_LABEL_LOAD_CONTENT_HISTORY 0xfe1d79e5U #define MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY 0x5b362286U +#define MENU_LABEL_NETWORK_INFORMATION 0x73ae3cb4U +#define MENU_LABEL_VALUE_NETWORK_INFORMATION 0xa0e6d195U #define MENU_LABEL_SYSTEM_INFORMATION 0x206ebf0fU #define MENU_LABEL_DEBUG_INFORMATION 0xeb0d82b1U #define MENU_LABEL_ACHIEVEMENT_LIST 0x7b90fc49U