Add NXDK (Xbox) support
CMake / CMake ubuntu-latest Debug (push) Cancelled after 0s
CMake / CMake windows-latest Debug (push) Cancelled after 0s
CMake / CMake macos-latest Release (push) Cancelled after 0s
CMake / CMake ubuntu-latest Release (push) Cancelled after 0s
CMake / CMake windows-latest Release (push) Cancelled after 0s
CMake / CMake macos-latest Debug (push) Cancelled after 0s
CMake / CMake ubuntu-latest Debug (push) Cancelled after 0s
CMake / CMake windows-latest Debug (push) Cancelled after 0s
CMake / CMake macos-latest Release (push) Cancelled after 0s
CMake / CMake ubuntu-latest Release (push) Cancelled after 0s
CMake / CMake windows-latest Release (push) Cancelled after 0s
CMake / CMake macos-latest Debug (push) Cancelled after 0s
This commit is contained in:
committed by
Cameron Gutman
parent
c7353c0593
commit
0eb84dcca8
+1
-1
@@ -12,7 +12,7 @@ extern "C"
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(NXDK)
|
||||||
#include "enet/win32.h"
|
#include "enet/win32.h"
|
||||||
#else
|
#else
|
||||||
#include "enet/unix.h"
|
#include "enet/unix.h"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@file unix.c
|
@file unix.c
|
||||||
@brief ENet Unix system specific functions
|
@brief ENet Unix system specific functions
|
||||||
*/
|
*/
|
||||||
#ifndef _WIN32
|
#if !defined(_WIN32) || defined(NXDK)
|
||||||
|
|
||||||
// Required for IPV6_PKTINFO with Darwin headers
|
// Required for IPV6_PKTINFO with Darwin headers
|
||||||
#ifndef __APPLE_USE_RFC_3542
|
#ifndef __APPLE_USE_RFC_3542
|
||||||
@@ -104,6 +104,34 @@
|
|||||||
#ifndef NO_MSGAPI
|
#ifndef NO_MSGAPI
|
||||||
#define NO_MSGAPI 1
|
#define NO_MSGAPI 1
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(NXDK)
|
||||||
|
#ifndef HAS_POLL
|
||||||
|
#define HAS_POLL 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_FCNTL
|
||||||
|
#define HAS_FCNTL 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_IOCTL
|
||||||
|
#define HAS_IOCTL 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_INET_PTON
|
||||||
|
#define HAS_INET_PTON 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_INET_NTOP
|
||||||
|
#define HAS_INET_NTOP 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_SOCKLEN_T
|
||||||
|
#define HAS_SOCKLEN_T 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GETADDRINFO
|
||||||
|
#define HAS_GETADDRINFO 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GETNAMEINFO
|
||||||
|
#define HAS_GETNAMEINFO 1
|
||||||
|
#endif
|
||||||
|
#ifndef NO_MSGAPI
|
||||||
|
#define NO_MSGAPI 1
|
||||||
|
#endif
|
||||||
#elif defined(__3DS__)
|
#elif defined(__3DS__)
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
#undef AF_INET6
|
#undef AF_INET6
|
||||||
@@ -438,7 +466,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
|
|||||||
{
|
{
|
||||||
case ENET_SOCKOPT_NONBLOCK:
|
case ENET_SOCKOPT_NONBLOCK:
|
||||||
#ifdef HAS_FCNTL
|
#ifdef HAS_FCNTL
|
||||||
result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
|
result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL, 0) & ~O_NONBLOCK));
|
||||||
#else
|
#else
|
||||||
#ifdef HAS_IOCTL
|
#ifdef HAS_IOCTL
|
||||||
result = ioctl (socket, FIONBIO, & value);
|
result = ioctl (socket, FIONBIO, & value);
|
||||||
@@ -715,7 +743,9 @@ enet_socket_send (ENetSocket socket,
|
|||||||
case EADDRNOTAVAIL:
|
case EADDRNOTAVAIL:
|
||||||
case ENETDOWN:
|
case ENETDOWN:
|
||||||
case ENETUNREACH:
|
case ENETUNREACH:
|
||||||
|
#if !defined(EHOSTDOWN) || (EHOSTDOWN != EHOSTUNREACH)
|
||||||
case EHOSTDOWN:
|
case EHOSTDOWN:
|
||||||
|
#endif
|
||||||
case EHOSTUNREACH:
|
case EHOSTUNREACH:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
@file win32.c
|
@file win32.c
|
||||||
@brief ENet Win32 system specific functions
|
@brief ENet Win32 system specific functions
|
||||||
*/
|
*/
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(NXDK)
|
||||||
|
|
||||||
#define ENET_BUILDING_LIB 1
|
#define ENET_BUILDING_LIB 1
|
||||||
#include "enet/enet.h"
|
#include "enet/enet.h"
|
||||||
@@ -51,7 +51,7 @@ enet_initialize (void)
|
|||||||
{
|
{
|
||||||
WORD versionRequested = MAKEWORD (2, 0);
|
WORD versionRequested = MAKEWORD (2, 0);
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
|
|
||||||
if (WSAStartup (versionRequested, & wsaData))
|
if (WSAStartup (versionRequested, & wsaData))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ enet_initialize (void)
|
|||||||
HIBYTE (wsaData.wVersion) != 0)
|
HIBYTE (wsaData.wVersion) != 0)
|
||||||
{
|
{
|
||||||
WSACleanup ();
|
WSACleanup ();
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,9 +228,9 @@ enet_address_set_host (ENetAddress * address, const char * name)
|
|||||||
{
|
{
|
||||||
memcpy (& address -> address, result -> ai_addr, result -> ai_addrlen);
|
memcpy (& address -> address, result -> ai_addr, result -> ai_addrlen);
|
||||||
address -> addressLength = result -> ai_addrlen;
|
address -> addressLength = result -> ai_addrlen;
|
||||||
|
|
||||||
freeaddrinfo (resultList);
|
freeaddrinfo (resultList);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,10 +429,10 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address)
|
|||||||
if (address != NULL)
|
if (address != NULL)
|
||||||
address -> addressLength = sizeof (address -> address);
|
address -> addressLength = sizeof (address -> address);
|
||||||
|
|
||||||
result = accept (socket,
|
result = accept (socket,
|
||||||
address != NULL ? (struct sockaddr *) & address -> address : NULL,
|
address != NULL ? (struct sockaddr *) & address -> address : NULL,
|
||||||
address != NULL ? & address -> addressLength : NULL);
|
address != NULL ? & address -> addressLength : NULL);
|
||||||
|
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
return ENET_SOCKET_NULL;
|
return ENET_SOCKET_NULL;
|
||||||
|
|
||||||
@@ -697,10 +697,10 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
|
|||||||
fd_set readSet, writeSet;
|
fd_set readSet, writeSet;
|
||||||
struct timeval timeVal;
|
struct timeval timeVal;
|
||||||
int selectCount;
|
int selectCount;
|
||||||
|
|
||||||
timeVal.tv_sec = timeout / 1000;
|
timeVal.tv_sec = timeout / 1000;
|
||||||
timeVal.tv_usec = (timeout % 1000) * 1000;
|
timeVal.tv_usec = (timeout % 1000) * 1000;
|
||||||
|
|
||||||
FD_ZERO (& readSet);
|
FD_ZERO (& readSet);
|
||||||
FD_ZERO (& writeSet);
|
FD_ZERO (& writeSet);
|
||||||
|
|
||||||
@@ -722,12 +722,12 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
|
|||||||
|
|
||||||
if (FD_ISSET (socket, & writeSet))
|
if (FD_ISSET (socket, & writeSet))
|
||||||
* condition |= ENET_SOCKET_WAIT_SEND;
|
* condition |= ENET_SOCKET_WAIT_SEND;
|
||||||
|
|
||||||
if (FD_ISSET (socket, & readSet))
|
if (FD_ISSET (socket, & readSet))
|
||||||
* condition |= ENET_SOCKET_WAIT_RECEIVE;
|
* condition |= ENET_SOCKET_WAIT_RECEIVE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user