diff --git a/libretro-common/include/net/net_compat.h b/libretro-common/include/net/net_compat.h index 60173882eb..dc8cdc1aad 100644 --- a/libretro-common/include/net/net_compat.h +++ b/libretro-common/include/net/net_compat.h @@ -158,6 +158,8 @@ static INLINE bool isagain(int bytes) return true; #elif defined(VITA) return (bytes<0 && (bytes == SCE_NET_ERROR_EAGAIN || bytes == SCE_NET_ERROR_EWOULDBLOCK)); +#elif defined(WIIU) + return (bytes == -1) && ((socketlasterr() == SO_SUCCESS) || (socketlasterr() == SO_EWOULDBLOCK)); #else return (bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)); #endif diff --git a/wiiu/include/netinet/tcp.h b/wiiu/include/netinet/tcp.h index bc2561e90c..5031b34407 100644 --- a/wiiu/include/netinet/tcp.h +++ b/wiiu/include/netinet/tcp.h @@ -5,7 +5,7 @@ extern "C" { #endif - +#define TCP_NODELAY 0x2004 #ifdef __cplusplus } diff --git a/wiiu/include/sys/socket.h b/wiiu/include/sys/socket.h index 80c5d6a795..4563a506e3 100644 --- a/wiiu/include/sys/socket.h +++ b/wiiu/include/sys/socket.h @@ -7,7 +7,7 @@ extern "C" { #endif -#define SOL_SOCKET 0xFFFF +#define SOL_SOCKET -1 #define INADDR_ANY 0 @@ -24,6 +24,11 @@ extern "C" { #define SO_NBIO 0x1014 +// return codes +#define SO_SUCCESS 0 +#define SO_EWOULDBLOCK 6 + + typedef uint32_t socklen_t; typedef uint16_t sa_family_t; @@ -63,6 +68,8 @@ int shutdown(int sockfd, int how); int socket(int domain, int type, int protocol); int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +int socketlasterr(void); + #ifdef __cplusplus } #endif diff --git a/wiiu/system/imports.h b/wiiu/system/imports.h index 77171778d7..0014e7e552 100644 --- a/wiiu/system/imports.h +++ b/wiiu/system/imports.h @@ -127,6 +127,7 @@ IMPORT(setsockopt); IMPORT(shutdown); IMPORT(socket); IMPORT(select); +IMPORT(socketlasterr); IMPORT_END();