diff --git a/Makefile.common b/Makefile.common index c9de56340c..44da342e90 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2126,6 +2126,8 @@ ifeq ($(HAVE_NETWORKING), 1) ifneq ($(HAVE_SOCKET_LEGACY),1) OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o + else ifeq ($(platform), vita) + OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o endif ifeq ($(WANT_IFADDRS), 1) diff --git a/griffin/griffin.c b/griffin/griffin.c index 39c18ce3db..896f3b0896 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1335,7 +1335,7 @@ NETPLAY #include "../libretro-common/net/net_compat.c" #include "../libretro-common/net/net_socket.c" #include "../libretro-common/net/net_http.c" -#if !defined(HAVE_SOCKET_LEGACY) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) #include "../libretro-common/net/net_ifinfo.c" #endif #include "../tasks/task_http.c" diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index e6875ed82c..9910421129 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -33,7 +33,7 @@ #include -#elif !defined(GEKKO) +#elif !defined(VITA) && !defined(GEKKO) #if defined(WANT_IFADDRS) #include #elif !defined(HAVE_LIBNX) && !defined(_3DS) @@ -159,6 +159,30 @@ failure: net_ifinfo_free(list); return false; +#elif defined(VITA) + SceNetCtlInfo info; + + list->entries = (struct net_ifinfo_entry*)calloc(2, sizeof(*list->entries)); + if (!list->entries) + { + list->size = 0; + + return false; + } + + strcpy_literal(list->entries[0].name, "lo"); + strcpy_literal(list->entries[0].host, "127.0.0.1"); + list->size = 1; + + if (!sceNetCtlInetGetInfo(SCE_NETCTL_INFO_GET_IP_ADDRESS, &info)) + { + strcpy_literal(list->entries[1].name, "wlan"); + strlcpy(list->entries[1].host, info.ip_address, + sizeof(list->entries[1].host)); + list->size++; + } + + return true; #elif defined(HAVE_LIBNX) || defined(_3DS) || defined(GEKKO) uint32_t addr = 0; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 2e144d78d4..ef7d12d2c1 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -137,7 +137,7 @@ #define BYTES_TO_GB(bytes) (((bytes) / 1024) / 1024 / 1024) #ifdef HAVE_NETWORKING -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) #include #endif #endif @@ -3899,7 +3899,7 @@ static unsigned menu_displaylist_parse_information_list(file_list_t *info_list) #endif #ifdef HAVE_NETWORKING -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) if (menu_entries_append_enum(info_list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION), msg_hash_to_str(MENU_ENUM_LABEL_NETWORK_INFORMATION), @@ -7165,7 +7165,7 @@ unsigned menu_displaylist_build_list( break; case DISPLAYLIST_NETWORK_INFO: #ifdef HAVE_NETWORKING -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) { net_ifinfo_t interfaces = {0}; diff --git a/network/natt.c b/network/natt.c index 48d4bc0cef..63264d29a5 100644 --- a/network/natt.c +++ b/network/natt.c @@ -22,7 +22,7 @@ #include -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) #include #endif @@ -96,7 +96,7 @@ bool natt_init(struct natt_discovery *discovery) if (!bind_addr) goto failure; -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) { struct sockaddr_in *addr = (struct sockaddr_in *) bind_addr->ai_addr; diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 28420b8837..9ec860646b 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -40,7 +40,7 @@ #include #include -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) #include #endif @@ -219,7 +219,7 @@ bool init_netplay_discovery(void) if (ret) { -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) net_ifinfo_best("223.255.255.255", &((struct sockaddr_in*)addr->ai_addr)->sin_addr, false); #endif diff --git a/tasks/task_netplay_nat_traversal.c b/tasks/task_netplay_nat_traversal.c index bb0a401693..fdc2127c83 100644 --- a/tasks/task_netplay_nat_traversal.c +++ b/tasks/task_netplay_nat_traversal.c @@ -26,7 +26,7 @@ #ifdef HAVE_NETWORKING -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) #include #endif @@ -39,7 +39,7 @@ static bool find_local_address(struct natt_device *device, { bool ret = false; -#if !defined(HAVE_SOCKET_LEGACY) || defined(GEKKO) +#if !defined(HAVE_SOCKET_LEGACY) || defined(VITA) || defined(GEKKO) struct net_ifinfo interfaces = {0}; struct addrinfo **addrs = NULL; uint32_t *scores = NULL;