Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2388,8 +2388,6 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Net/InetCommon.h
Core/Net/NetResolver.cpp
Core/Net/NetResolver.h
Core/Net/InetSocket.cpp
Core/Net/InetSocket.h
Core/MemFault.cpp
Core/MemFault.h
Core/MemMap.cpp
Expand Down
2 changes: 0 additions & 2 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@
<ClCompile Include="MIPS\x86\X64IRCompVec.cpp" />
<ClCompile Include="MIPS\x86\X64IRJit.cpp" />
<ClCompile Include="Net\InetCommon.cpp" />
<ClCompile Include="Net\InetSocket.cpp" />
<ClCompile Include="Net\NetResolver.cpp" />
<ClCompile Include="Replay.cpp" />
<ClCompile Include="Compatibility.cpp" />
Expand Down Expand Up @@ -1221,7 +1220,6 @@
<ClInclude Include="MIPS\RiscV\RiscVRegCache.h" />
<ClInclude Include="MIPS\x86\X64IRJit.h" />
<ClInclude Include="Net\InetCommon.h" />
<ClInclude Include="Net\InetSocket.h" />
<ClInclude Include="Net\NetResolver.h" />
<ClInclude Include="Replay.h" />
<ClInclude Include="Compatibility.h" />
Expand Down
6 changes: 0 additions & 6 deletions Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,6 @@
<ClCompile Include="Net\NetResolver.cpp">
<Filter>Net</Filter>
</ClCompile>
<ClCompile Include="Net\InetSocket.cpp">
<Filter>Net</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
Expand Down Expand Up @@ -2157,9 +2154,6 @@
<ClInclude Include="Net\NetResolver.h">
<Filter>Net</Filter>
</ClInclude>
<ClInclude Include="Net\InetSocket.h">
<Filter>Net</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE.TXT" />
Expand Down
48 changes: 48 additions & 0 deletions Core/HLE/proAdhoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@
#undef EALREADY
#undef ETIMEDOUT
#undef EOPNOTSUPP
#undef ENOTSOCK
#undef EPROTONOSUPPORT
#undef ESOCKTNOSUPPORT
#undef EPFNOSUPPORT
#undef EAFNOSUPPORT
#undef EINTR
#undef EACCES
#undef EFAULT
#undef EINVAL
#undef ENOSPC
#undef EHOSTDOWN
#undef EADDRINUSE
#undef EADDRNOTAVAIL
#undef ENETUNREACH
#undef EHOSTUNREACH
#undef ENETDOWN
#define errno WSAGetLastError()
#define ESHUTDOWN WSAESHUTDOWN
#define ECONNABORTED WSAECONNABORTED
Expand All @@ -83,6 +99,22 @@
#define EALREADY WSAEALREADY
#define ETIMEDOUT WSAETIMEDOUT
#define EOPNOTSUPP WSAEOPNOTSUPP
#define ENOTSOCK WSAENOTSOCK
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
#define EPFNOSUPPORT WSAEPFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define EINTR WSAEINTR
#define EACCES WSAEACCES
#define EFAULT WSAEFAULT
#define EINVAL WSAEINVAL
#define ENOSPC ERROR_INVALID_PARAMETER
#define EHOSTDOWN WSAEHOSTDOWN
#define EADDRINUSE WSAEADDRINUSE
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define ENETUNREACH WSAENETUNREACH
#define EHOSTUNREACH WSAEHOSTUNREACH
#define ENETDOWN WSAENETDOWN
inline bool connectInProgress(int errcode){ return (errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS || errcode == WSAEALREADY || errcode == WSAEINVAL); } // WSAEINVAL should be treated as WSAEALREADY during connect for backward-compatibility with Winsock 1.1
inline bool isDisconnected(int errcode) { return (errcode == WSAECONNRESET || errcode == WSAECONNABORTED || errcode == WSAESHUTDOWN); }
#else
Expand Down Expand Up @@ -1300,16 +1332,32 @@ int getActivePeerCount(const bool excludeTimedout = true);
int getLocalIp(sockaddr_in * SocketAddress);
uint32_t getLocalIp(int sock);

/*
* Check if an IP (big-endian/network order) is Private or Public IP
*/
bool isMulticastIP(uint32_t ip);

/*
* Check if an IP (big-endian/network order) is Private or Public IP
*/
bool isPrivateIP(uint32_t ip);

/*
* Check if an IP (big-endian/network order) is APIPA(169.254.x.x) IP
*/
bool isAPIPA(uint32_t ip);

/*
* Check if an IP (big-endian/network order) is Loopback IP
*/
bool isLoopbackIP(uint32_t ip);

/*
* Check if an IP (big-endian/network order) is a Broadcast IP
* Default subnet mask is 255.255.255.0
*/
bool isBroadcastIP(uint32_t ip, const uint32_t subnetmask = 0x00ffffff);

/*
* Get Number of bytes available in buffer to be Received
* @param sock fd
Expand Down
9 changes: 4 additions & 5 deletions Core/HLE/sceNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void __NetApctlInit() {

static void __ResetInitNetLib() {
netInited = false;
SceNetInet::Shutdown();
netInetInited = false; // shouldn't this actually do something?

memset(&netMallocStat, 0, sizeof(netMallocStat));
memset(&parameter, 0, sizeof(parameter));
Expand Down Expand Up @@ -275,7 +275,7 @@ void __NetShutdown() {
Net_Term();

SceNetResolver::Shutdown();
SceNetInet::Shutdown();
__NetInetShutdown();
__NetApctlShutdown();
__ResetInitNetLib();

Expand Down Expand Up @@ -313,11 +313,9 @@ void __NetDoState(PointerWrap &p) {
return;

auto cur_netInited = netInited;
auto cur_netInetInited = SceNetInet::Inited();
auto cur_netInetInited = netInetInited;
auto cur_netApctlInited = netApctlInited;

bool netInetInited = cur_netInetInited;

Do(p, netInited);
Do(p, netInetInited);
Do(p, netApctlInited);
Expand Down Expand Up @@ -370,6 +368,7 @@ void __NetDoState(PointerWrap &p) {
if (p.mode == p.MODE_READ) {
// Let's not change "Inited" value when Loading SaveState in the middle of multiplayer to prevent memory & port leaks
netApctlInited = cur_netApctlInited;
netInetInited = cur_netInetInited;
netInited = cur_netInited;

// Discard leftover events
Expand Down
5 changes: 0 additions & 5 deletions Core/HLE/sceNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
// On-Demand Nonblocking Flag
// #define INET_MSG_DONTWAIT 0x80

// Event Flags
#define INET_POLLRDNORM 0x0040
#define INET_POLLWRNORM 0x0004

// TODO: Determine how many handlers we can actually have
const size_t MAX_APCTL_HANDLERS = 32;

Expand Down Expand Up @@ -267,5 +263,4 @@ int NetApctl_GetState();

int sceNetApctlConnect(int connIndex);
int sceNetInetPoll(void *fds, u32 nfds, int timeout);
int sceNetInetTerm();
int sceNetApctlTerm();
Loading