mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Enable GetBestRoute for MSVC 2005 (#13407)
This commit is contained in:
parent
43d0fa6248
commit
b67b93ebfe
@ -35,11 +35,9 @@
|
||||
|
||||
#include <net/net_natt.h>
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 1400
|
||||
#if !defined(HAVE_SOCKET_LEGACY) && defined(_WIN32) && defined(IP_MULTICAST_IF)
|
||||
#if !defined(HAVE_SOCKET_LEGACY) && defined(_WIN32)
|
||||
#include <iphlpapi.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static natt_state_t natt_st = {{0}, {{0}}, 0, -1};
|
||||
|
||||
@ -59,10 +57,8 @@ bool natt_init(void)
|
||||
"MX: 5\r\n"
|
||||
"\r\n";
|
||||
static struct sockaddr_in msearch_addr = {0};
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 1400
|
||||
#if defined(_WIN32) && defined(IP_MULTICAST_IF)
|
||||
#ifdef _WIN32
|
||||
MIB_IPFORWARDROW ip_forward;
|
||||
#endif
|
||||
#endif
|
||||
natt_state_t *st = &natt_st;
|
||||
struct addrinfo *bind_addr = NULL;
|
||||
@ -93,13 +89,12 @@ bool natt_init(void)
|
||||
if (!bind_addr)
|
||||
goto failure;
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 1400
|
||||
#if defined(_WIN32) && defined(IP_MULTICAST_IF)
|
||||
#ifdef _WIN32
|
||||
if (GetBestRoute(inet_addr("223.255.255.255"),
|
||||
0, &ip_forward) == NO_ERROR)
|
||||
{
|
||||
IF_INDEX index = ip_forward.dwForwardIfIndex;
|
||||
PMIB_IPADDRTABLE table = malloc(sizeof(MIB_IPADDRTABLE));
|
||||
DWORD index = ip_forward.dwForwardIfIndex;
|
||||
PMIB_IPADDRTABLE table = malloc(sizeof(*table));
|
||||
|
||||
if (table)
|
||||
{
|
||||
@ -127,8 +122,10 @@ bool natt_init(void)
|
||||
|
||||
if (ip_addr->dwIndex == index)
|
||||
{
|
||||
#ifdef IP_MULTICAST_IF
|
||||
setsockopt(st->fd, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
(const char *) &ip_addr->dwAddr, sizeof(ip_addr->dwAddr));
|
||||
#endif
|
||||
((struct sockaddr_in *) bind_addr->ai_addr)->sin_addr.s_addr =
|
||||
ip_addr->dwAddr;
|
||||
break;
|
||||
@ -140,7 +137,6 @@ bool natt_init(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef IP_MULTICAST_TTL
|
||||
{
|
||||
|
@ -41,11 +41,9 @@
|
||||
#include <string/stdstring.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 1400
|
||||
#if defined(_WIN32) && defined(IP_MULTICAST_IF)
|
||||
#ifdef _WIN32
|
||||
#include <iphlpapi.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
#include "../discord.h"
|
||||
@ -245,15 +243,14 @@ bool init_netplay_discovery(void)
|
||||
|
||||
if (ret)
|
||||
{
|
||||
#if !defined(_MSC_VER) || _MSC_VER > 1400
|
||||
#if defined(_WIN32) && defined(IP_MULTICAST_IF)
|
||||
#ifdef _WIN32
|
||||
MIB_IPFORWARDROW ip_forward;
|
||||
|
||||
if (GetBestRoute(inet_addr("223.255.255.255"),
|
||||
0, &ip_forward) == NO_ERROR)
|
||||
{
|
||||
IF_INDEX index = ip_forward.dwForwardIfIndex;
|
||||
PMIB_IPADDRTABLE table = malloc(sizeof(MIB_IPADDRTABLE));
|
||||
DWORD index = ip_forward.dwForwardIfIndex;
|
||||
PMIB_IPADDRTABLE table = malloc(sizeof(*table));
|
||||
|
||||
if (table)
|
||||
{
|
||||
@ -281,8 +278,10 @@ bool init_netplay_discovery(void)
|
||||
|
||||
if (ip_addr->dwIndex == index)
|
||||
{
|
||||
#ifdef IP_MULTICAST_IF
|
||||
setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
(const char *) &ip_addr->dwAddr, sizeof(ip_addr->dwAddr));
|
||||
#endif
|
||||
((struct sockaddr_in *) addr->ai_addr)->sin_addr.s_addr =
|
||||
ip_addr->dwAddr;
|
||||
break;
|
||||
@ -294,9 +293,8 @@ bool init_netplay_discovery(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SOL_SOCKET) && defined(SO_BROADCAST)
|
||||
#ifdef SO_BROADCAST
|
||||
/* Make it broadcastable */
|
||||
{
|
||||
int broadcast = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user