diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index a4779e7e7e..1b42d3b213 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1813,6 +1813,7 @@ int getLocalIp(sockaddr_in* SocketAddress) { } #else // Alternative way + // Socket doesn't "leak" to the game. int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock != SOCKET_ERROR) { const char* kGoogleDnsIp = "8.8.8.8"; // Needs to be an IP string so it can be resolved as fast as possible to IP, doesn't need to be reachable diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index f0f3e811cf..7fa2275b41 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -1379,6 +1379,7 @@ int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 flag) { // Valid MAC supplied. FIXME: MAC only valid after successful attempt to Create/Connect/Join a Group? (ie. adhocctlCurrentMode != ADHOCCTL_MODE_NONE) if ((adhocctlCurrentMode != ADHOCCTL_MODE_NONE) && isLocalMAC(saddr)) { // Create Internet UDP Socket + // Socket is remapped through adhocSockets int usocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); // Valid Socket produced if (usocket != INVALID_SOCKET) { @@ -3257,6 +3258,7 @@ int RecreatePtpSocket(int ptpId) { closesocket(sock->data.ptp.id); // Create a new socket + // Socket is remapped through adhocSockets int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // Valid Socket produced @@ -3375,7 +3377,8 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, // Valid Arguments if (bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0) { - // Create Infrastructure Socket + // Create Infrastructure Socket (?) + // Socket is remapped through adhocSockets int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // Valid Socket produced @@ -3977,7 +3980,8 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int // Valid Arguments if (bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0 && backlog > 0) { - // Create Infrastructure Socket + // Create Infrastructure Socket (?) + // Socket is remapped through adhocSockets int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // Valid Socket produced diff --git a/Core/HLE/sceNetInet.cpp b/Core/HLE/sceNetInet.cpp index 3252445321..489da3096c 100644 --- a/Core/HLE/sceNetInet.cpp +++ b/Core/HLE/sceNetInet.cpp @@ -321,6 +321,7 @@ int sceNetInetPoll(u32 fdsPtr, u32 nfds, int timeout) { // timeout in milisecond FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); for (int i = 0; i < (s32)nfds; i++) { if (fdarray[i].fd < 0) { + // In Unix, this is OK and means it the fd should be ignored, except fdarray[i].revents should be zeroed. inetLastErrno = EINVAL; return hleLogError(Log::sceNet, -1, "invalid socket id"); } diff --git a/Core/HLE/sceNetInet.h b/Core/HLE/sceNetInet.h index fb84e14350..25496e4a35 100644 --- a/Core/HLE/sceNetInet.h +++ b/Core/HLE/sceNetInet.h @@ -96,8 +96,8 @@ typedef struct SceNetInetLinger { // Polling Event Field typedef struct SceNetInetPollfd { //similar format to pollfd in 32bit (pollfd in 64bit have different size) s32_le fd; - s16_le events; - s16_le revents; + s16_le events; // requested events + s16_le revents; // returned events } PACK SceNetInetPollfd; // TCP & UDP Socket Union (Internal use only)