Merge pull request #19807 from hrydgard/infra-master

Rebased WIP: Infrastructure: sceNetInet and sceNetResolver support
This commit is contained in:
Henrik Rydgård 2025-01-04 21:20:19 +01:00 committed by GitHub
commit 5a328a8381
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 2362 additions and 264 deletions

View file

@ -2251,6 +2251,12 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/HLE/sceNetAdhoc.h
Core/HLE/sceNetAdhocMatching.cpp
Core/HLE/sceNetAdhocMatching.h
Core/HLE/sceNetInet.cpp
Core/HLE/sceNetInet.h
Core/HLE/sceNetApctl.cpp
Core/HLE/sceNetApctl.h
Core/HLE/sceNetResolver.cpp
Core/HLE/sceNetResolver.h
Core/HLE/proAdhoc.h
Core/HLE/proAdhoc.cpp
Core/HLE/proAdhocServer.h
@ -2378,6 +2384,12 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/MIPS/MIPSAsm.h
Core/MIPS/MIPSTracer.cpp
Core/MIPS/MIPSTracer.h
Core/Net/InetCommon.cpp
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
@ -2467,6 +2479,11 @@ include_directories(ext/libchdr/include)
target_link_libraries(${CoreLibName} Common native chdr kirk cityhash sfmt19937 xbrz xxhash rcheevos minimp3 at3_standalone lua ${GlslangLibs}
${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
# Winsock
if(WIN32)
target_link_libraries(${CoreLibName} ws2_32 winhttp)
endif()
if(NOT HTTPS_NOT_AVAILABLE)
target_link_libraries(${CoreLibName} naett)
if(WIN32)

View file

@ -1244,6 +1244,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
mPostShaderSetting[key] = std::stof(value);
}
const Section *hostOverrideSetting = iniFile.GetOrCreateSection("HostAliases");
// TODO: relocate me before PR
mHostToAlias = hostOverrideSetting->ToMap();
// Load post process shader names
vPostShaderNames.clear();
for (const auto& it : postShaderChain->ToMap()) {
@ -1376,6 +1380,13 @@ bool Config::Save(const char *saveReason) {
}
}
// TODO: relocate me before PR
Section *hostOverrideSetting = iniFile.GetOrCreateSection("HostAliases");
hostOverrideSetting->Clear();
for (auto& it : mHostToAlias) {
hostOverrideSetting->Set(it.first.c_str(), it.second.c_str());
}
Section *control = iniFile.GetOrCreateSection("Control");
control->Delete("DPadRadius");

View file

@ -458,6 +458,7 @@ public:
// Networking
std::string proAdhocServer;
bool bEnableWlan;
std::map<std::string, std::string> mHostToAlias; // TODO: mPostShaderSetting
bool bEnableAdhocServer;
bool bEnableUPnP;
bool bUPnPUseOriginalPort;
@ -482,6 +483,7 @@ public:
int iFirmwareVersion;
bool bBypassOSKWithKeyboard;
// Virtual reality
bool bEnableVR;
bool bEnable6DoF;

View file

@ -572,6 +572,9 @@
<ClCompile Include="HLE\KUBridge.cpp" />
<ClCompile Include="HLE\Plugins.cpp" />
<ClCompile Include="HLE\sceKernelHeap.cpp" />
<ClCompile Include="HLE\sceNetApctl.cpp" />
<ClCompile Include="HLE\sceNetInet.cpp" />
<ClCompile Include="HLE\sceNetResolver.cpp" />
<ClCompile Include="HLE\sceNp2.cpp" />
<ClCompile Include="HLE\sceUsbAcc.cpp" />
<ClCompile Include="HLE\sceUsbCam.cpp" />
@ -625,6 +628,9 @@
<ClCompile Include="MIPS\x86\X64IRCompSystem.cpp" />
<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" />
<ClCompile Include="Config.cpp" />
@ -1185,6 +1191,9 @@
<ClInclude Include="HLE\KUBridge.h" />
<ClInclude Include="HLE\Plugins.h" />
<ClInclude Include="HLE\sceKernelHeap.h" />
<ClInclude Include="HLE\sceNetApctl.h" />
<ClInclude Include="HLE\sceNetInet.h" />
<ClInclude Include="HLE\sceNetResolver.h" />
<ClInclude Include="HLE\sceNp2.h" />
<ClInclude Include="HLE\sceUsbAcc.h" />
<ClInclude Include="HLE\sceUsbCam.h" />
@ -1211,6 +1220,9 @@
<ClInclude Include="MIPS\RiscV\RiscVJit.h" />
<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" />
<ClInclude Include="Config.h" />

View file

@ -94,6 +94,9 @@
<Filter Include="MIPS\RiscV">
<UniqueIdentifier>{067e3128-3aaf-4ed1-b19e-bab11606abe7}</UniqueIdentifier>
</Filter>
<Filter Include="Net">
<UniqueIdentifier>{f1b3f688-26eb-4121-9914-e9e19ab04bcd}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ELF\ElfReader.cpp">
@ -1321,6 +1324,24 @@
<ClCompile Include="Dialog\PSPOskConstants.cpp">
<Filter>Dialog</Filter>
</ClCompile>
<ClCompile Include="HLE\sceNetApctl.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceNetInet.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceNetResolver.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="Net\InetCommon.cpp">
<Filter>Net</Filter>
</ClCompile>
<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">
@ -2121,6 +2142,24 @@
<ClInclude Include="Dialog\PSPOskConstants.h">
<Filter>Dialog</Filter>
</ClInclude>
<ClInclude Include="HLE\sceNetApctl.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceNetInet.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceNetResolver.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="Net\InetCommon.h">
<Filter>Net</Filter>
</ClInclude>
<ClInclude Include="Net\NetResolver.h">
<Filter>Net</Filter>
</ClInclude>
<ClInclude Include="Net\InetSocket.h">
<Filter>Net</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE.TXT" />

View file

@ -438,11 +438,21 @@ template<int func(int, int, int, u32, int)> void WrapI_IIIUI() {
RETURN(retval);
}
template<int func(int, int, int, u32, u32)> void WrapI_IIIUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
}
template<int func(int, u32, u32, int, int)> void WrapI_IUUII() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
}
template<int func(int, u32, u32, int, int, int)> void WrapI_IUUIII() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
RETURN(retval);
}
template<int func(int, const char *, int, u32, u32)> void WrapI_ICIUU() {
int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
@ -699,6 +709,11 @@ template<int func(int, u32, u32, u32, u32, u32)> void WrapI_IUUUUU() {
RETURN(retval);
}
template<int func(int, u32, u32, int, u32, u32)> void WrapI_IUUIUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
RETURN(retval);
}
template<int func(int, u32, int, int)> void WrapI_IUII() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
RETURN(retval);
@ -755,6 +770,11 @@ template<int func(int, u32, u32, u32)> void WrapI_IUUU() {
RETURN(retval);
}
template<int func(int, u32, u32, int)> void WrapI_IUUI() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
RETURN(retval);
}
template<int func(int, u32, u32)> void WrapI_IUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
@ -800,6 +820,11 @@ template <int func(int, const char *, int)> void WrapI_ICI() {
RETURN(retval);
}
template <int func(int, const char *, u32)> void WrapI_ICU() {
int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
RETURN(retval);
}
template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){
u32 retval = func(PARAM(0), Memory::GetPointerWrite(PARAM(1)), Memory::GetPointerWrite(PARAM(2)), Memory::GetPointerWrite(PARAM(3)), Memory::GetPointerWrite(PARAM(4)), PARAM(5), PARAM(6) );
RETURN(retval);

View file

@ -81,6 +81,8 @@
#include "sceSfmt19937.h"
#include "sceG729.h"
#include "KUBridge.h"
#include "sceNetInet.h"
#include "sceNetResolver.h"
#define N(s) s
@ -313,6 +315,8 @@ void RegisterAllModules() {
Register_mp4msv();
Register_InterruptManagerForKernel();
Register_sceSircs();
Register_sceNetInet();
Register_sceNetResolver();
// add new modules here.
}

View file

@ -53,6 +53,7 @@
#include "Core/HLE/sceKernelMutex.h"
#include "Core/HLE/sceUtility.h"
// TODO: move this to some common set
#ifdef _WIN32
#undef errno
#undef ESHUTDOWN

View file

@ -20,13 +20,20 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#elif _WIN32
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
#endif
// TODO: fixme move Core/Net to Common/Net
#include "Common/Net/Resolve.h"
#include "Core/Net/InetCommon.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/Serialize/SerializeMap.h"
#include "Core/Config.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/sceKernelMemory.h"
@ -44,6 +51,12 @@
#include "Core/HLE/sceNetAdhoc.h"
#include "Core/HLE/sceNetAdhocMatching.h"
#include "Core/HLE/sceNet.h"
#include <iostream>
#include <shared_mutex>
#include "sceNetInet.h"
#include "sceNetResolver.h"
#include "Core/HLE/sceNp.h"
#include "Core/CoreTiming.h"
#include "Core/Instance.h"
@ -54,7 +67,6 @@
#endif
bool netInited;
bool netInetInited;
u32 netDropRate = 0;
u32 netDropDuration = 0;
@ -131,6 +143,25 @@ void InitLocalhostIP() {
isLocalServer = (!strcasecmp(serverStr.c_str(), "localhost") || serverStr.find("127.") == 0);
}
static bool __PlatformNetInit() {
#ifdef _WIN32
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
// TODO: log
return false;
}
#endif
return true;
}
static bool __PlatformNetShutdown() {
#ifdef _WIN32
return WSACleanup() == 0;
#else
return true;
#endif
}
static void __ApctlState(u64 userdata, int cyclesLate) {
SceUID threadID = userdata >> 32;
int uid = (int)(userdata & 0xFFFFFFFF);
@ -176,7 +207,7 @@ void __NetApctlInit() {
static void __ResetInitNetLib() {
netInited = false;
netInetInited = false;
// netInetInited = false;
memset(&netMallocStat, 0, sizeof(netMallocStat));
memset(&parameter, 0, sizeof(parameter));
@ -211,7 +242,8 @@ void __NetInit() {
SceNetEtherAddr mac;
getLocalMac(&mac);
INFO_LOG(Log::sceNet, "LocalHost IP will be %s [%s]", ip2str(g_localhostIP.in.sin_addr).c_str(), mac2str(&mac).c_str());
__PlatformNetInit();
// TODO: May be we should initialize & cleanup somewhere else than here for PortManager to be used as general purpose for whatever port forwarding PPSSPP needed
__UPnPInit();
@ -233,12 +265,16 @@ void __NetShutdown() {
// Network Cleanup
Net_Term();
SceNetResolver::Shutdown();
SceNetInet::Shutdown();
__NetApctlShutdown();
__ResetInitNetLib();
// Since PortManager supposed to be general purpose for whatever port forwarding PPSSPP needed, may be we shouldn't clear & restore ports in here? it will be cleared and restored by PortManager's destructor when exiting PPSSPP anyway
__UPnPShutdown();
__PlatformNetShutdown();
free(dummyPeekBuf64k);
}
@ -268,11 +304,11 @@ void __NetDoState(PointerWrap &p) {
return;
auto cur_netInited = netInited;
auto cur_netInetInited = netInetInited;
// auto cur_netInetInited = netInetInited;
auto cur_netApctlInited = netApctlInited;
Do(p, netInited);
Do(p, netInetInited);
// Do(p, netInetInited);
Do(p, netApctlInited);
Do(p, apctlHandlers);
Do(p, netMallocStat);
@ -317,11 +353,13 @@ 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;
// netInetInited = cur_netInetInited;
netInited = cur_netInited;
// Discard leftover events
apctlEvents.clear();
// Discard created resolvers
SceNetResolver::Shutdown();
}
}
@ -795,21 +833,6 @@ static int sceNetGetMallocStat(u32 statPtr) {
return 0;
}
static int sceNetInetInit() {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetInit()");
if (netInetInited) return ERROR_NET_INET_ALREADY_INITIALIZED;
netInetInited = true;
return 0;
}
int sceNetInetTerm() {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetTerm()");
netInetInited = false;
return 0;
}
void NetApctl_InitInfo() {
memset(&netApctlInfo, 0, sizeof(netApctlInfo));
// Set dummy/fake values, these probably not suppose to have valid info before connected to an AP, right?
@ -823,7 +846,8 @@ void NetApctl_InitInfo() {
if (netApctlInfo.channel == PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC) netApctlInfo.channel = defaultWlanChannel;
// Get Local IP Address
sockaddr_in sockAddr;
getLocalIp(&sockAddr); // This will be valid IP, we probably not suppose to have a valid IP before connected to any AP, right?
socklen_t socklen = sizeof(sockaddr_in);
getDefaultOutboundSockaddr(sockAddr, socklen); // This will be valid IP, we probably not suppose to have a valid IP before connected to any AP, right?
char ipstr[INET_ADDRSTRLEN] = "127.0.0.1"; // Patapon 3 seems to try to get current IP using ApctlGetInfo() right after ApctlInit(), what kind of IP should we use as default before ApctlConnect()? it shouldn't be a valid IP, right?
inet_ntop(AF_INET, &sockAddr.sin_addr, ipstr, sizeof(ipstr));
truncate_cpy(netApctlInfo.ip, sizeof(netApctlInfo.ip), ipstr);
@ -985,6 +1009,7 @@ static int sceNetApctlGetInfo(int code, u32 pInfoAddr) {
if (!Memory::IsValidRange(pInfoAddr, 4))
return hleLogError(Log::sceNet, -1, "apctl invalid arg");
Memory::WriteUnchecked_U32(netApctlInfo.useProxy, pInfoAddr);
// Memory::WriteUnchecked_U32(1, pInfoAddr);
NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo");
break;
case PSP_NET_APCTL_INFO_PROXY_URL:
@ -1084,107 +1109,6 @@ static int sceNetApctlDelHandler(u32 handlerID) {
return NetApctl_DelHandler(handlerID);
}
static int sceNetInetInetAton(const char *hostname, u32 addrPtr) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetInetAton(%s, %08x)", hostname, addrPtr);
return -1;
}
int sceNetInetPoll(void *fds, u32 nfds, int timeout) { // timeout in miliseconds
DEBUG_LOG(Log::sceNet, "UNTESTED sceNetInetPoll(%p, %d, %i) at %08x", fds, nfds, timeout, currentMIPS->pc);
int retval = -1;
SceNetInetPollfd *fdarray = (SceNetInetPollfd *)fds; // SceNetInetPollfd/pollfd, sceNetInetPoll() have similarity to BSD poll() but pollfd have different size on 64bit
//#ifdef _WIN32
//WSAPoll only available for Vista or newer, so we'll use an alternative way for XP since Windows doesn't have poll function like *NIX
if (nfds > FD_SETSIZE) return -1;
fd_set readfds, writefds, exceptfds;
FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds);
for (int i = 0; i < (s32)nfds; i++) {
if (fdarray[i].events & (INET_POLLRDNORM)) FD_SET(fdarray[i].fd, &readfds); // (POLLRDNORM | POLLIN)
if (fdarray[i].events & (INET_POLLWRNORM)) FD_SET(fdarray[i].fd, &writefds); // (POLLWRNORM | POLLOUT)
//if (fdarray[i].events & (ADHOC_EV_ALERT)) // (POLLRDBAND | POLLPRI) // POLLERR
FD_SET(fdarray[i].fd, &exceptfds);
fdarray[i].revents = 0;
}
timeval tmout;
tmout.tv_sec = timeout / 1000; // seconds
tmout.tv_usec = (timeout % 1000) * 1000; // microseconds
retval = select(nfds, &readfds, &writefds, &exceptfds, &tmout);
if (retval < 0) return -1;
retval = 0;
for (int i = 0; i < (s32)nfds; i++) {
if (FD_ISSET(fdarray[i].fd, &readfds)) fdarray[i].revents |= INET_POLLRDNORM; //POLLIN
if (FD_ISSET(fdarray[i].fd, &writefds)) fdarray[i].revents |= INET_POLLWRNORM; //POLLOUT
fdarray[i].revents &= fdarray[i].events;
if (FD_ISSET(fdarray[i].fd, &exceptfds)) fdarray[i].revents |= ADHOC_EV_ALERT; // POLLPRI; // POLLERR; // can be raised on revents regardless of events bitmask?
if (fdarray[i].revents) retval++;
}
//#else
/*
// Doesn't work properly yet
pollfd *fdtmp = (pollfd *)malloc(sizeof(pollfd) * nfds);
// Note: sizeof(pollfd) = 16bytes in 64bit and 8bytes in 32bit, while sizeof(SceNetInetPollfd) is always 8bytes
for (int i = 0; i < (s32)nfds; i++) {
fdtmp[i].fd = fdarray[i].fd;
fdtmp[i].events = 0;
if (fdarray[i].events & INET_POLLRDNORM) fdtmp[i].events |= (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI);
if (fdarray[i].events & INET_POLLWRNORM) fdtmp[i].events |= (POLLOUT | POLLWRNORM | POLLWRBAND);
fdtmp[i].revents = 0;
fdarray[i].revents = 0;
}
retval = poll(fdtmp, (nfds_t)nfds, timeout); //retval = WSAPoll(fdarray, nfds, timeout);
for (int i = 0; i < (s32)nfds; i++) {
if (fdtmp[i].revents & (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)) fdarray[i].revents |= INET_POLLRDNORM;
if (fdtmp[i].revents & (POLLOUT | POLLWRNORM | POLLWRBAND)) fdarray[i].revents |= INET_POLLWRNORM;
fdarray[i].revents &= fdarray[i].events;
if (fdtmp[i].revents & POLLERR) fdarray[i].revents |= POLLERR; //INET_POLLERR // can be raised on revents regardless of events bitmask?
}
free(fdtmp);
*/
//#endif
return retval;
}
static int sceNetInetRecv(int socket, u32 bufPtr, u32 bufLen, u32 flags) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetRecv(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags);
return -1;
}
static int sceNetInetSend(int socket, u32 bufPtr, u32 bufLen, u32 flags) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSend(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags);
return -1;
}
static int sceNetInetGetErrno() {
ERROR_LOG(Log::sceNet, "UNTESTED sceNetInetGetErrno()");
int error = errno;
switch (error) {
case ETIMEDOUT:
return INET_ETIMEDOUT;
case EISCONN:
return INET_EISCONN;
case EINPROGRESS:
return INET_EINPROGRESS;
//case EAGAIN:
// return INET_EAGAIN;
}
return error; //-1;
}
static int sceNetInetSocket(int domain, int type, int protocol) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSocket(%i, %i, %i)", domain, type, protocol);
return -1;
}
static int sceNetInetSetsockopt(int socket, int level, int optname, u32 optvalPtr, int optlen) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSetsockopt(%i, %i, %i, %08x, %i)", socket, level, optname, optvalPtr, optlen);
return -1;
}
static int sceNetInetConnect(int socket, u32 sockAddrInternetPtr, int addressLength) {
ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetConnect(%i, %08x, %i)", socket, sockAddrInternetPtr, addressLength);
return -1;
}
int sceNetApctlConnect(int connIndex) {
WARN_LOG(Log::sceNet, "UNTESTED %s(%i)", __FUNCTION__, connIndex);
// Is this connIndex is the index to the scanning's result data or sceNetApctlGetBSSDescIDListUser result?
@ -1374,12 +1298,6 @@ static int sceNetApctlGetBSSDescEntry2(int entryId, int infoId, u32 resultAddr)
return NetApctl_GetBSSDescEntryUser(entryId, infoId, resultAddr);
}
static int sceNetResolverInit()
{
ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__);
return 0;
}
static int sceNetApctlAddInternalHandler(u32 handlerPtr, u32 handlerArg) {
ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg);
// This seems to be a 2nd kind of handler
@ -1433,46 +1351,38 @@ static int sceNetApctl_lib2_C20A144C(int connIndex, u32 ps3MacAddressPtr) {
return sceNetApctlConnect(connIndex);
}
static int sceNetUpnpInit(int unknown1,int unknown2)
{
static int sceNetUpnpInit(int unknown1,int unknown2) {
ERROR_LOG_REPORT_ONCE(sceNetUpnpInit, Log::sceNet, "UNIMPLsceNetUpnpInit %d,%d",unknown1,unknown2);
return 0;
}
static int sceNetUpnpStart()
{
static int sceNetUpnpStart() {
ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpStart");
return 0;
}
static int sceNetUpnpStop()
{
static int sceNetUpnpStop() {
ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpStop");
return 0;
}
static int sceNetUpnpTerm()
{
static int sceNetUpnpTerm() {
ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpTerm");
return 0;
}
static int sceNetUpnpGetNatInfo()
{
static int sceNetUpnpGetNatInfo() {
ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpGetNatInfo");
return 0;
}
static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr)
{
static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr) {
Memory::Write_U32(netDropRate, dropRateAddr);
Memory::Write_U32(netDropDuration, dropDurationAddr);
return hleLogSuccessInfoI(Log::sceNet, 0);
}
static int sceNetSetDropRate(u32 dropRate, u32 dropDuration)
{
static int sceNetSetDropRate(u32 dropRate, u32 dropDuration) {
netDropRate = dropRate;
netDropDuration = dropDuration;
return hleLogSuccessInfoI(Log::sceNet, 0);
@ -1489,54 +1399,6 @@ const HLEFunction sceNet[] = {
{0XAD6844C6, &WrapI_I<sceNetThreadAbort>, "sceNetThreadAbort", 'i', "i" },
};
const HLEFunction sceNetResolver[] = {
{0X224C5F44, nullptr, "sceNetResolverStartNtoA", '?', "" },
{0X244172AF, nullptr, "sceNetResolverCreate", '?', "" },
{0X94523E09, nullptr, "sceNetResolverDelete", '?', "" },
{0XF3370E61, &WrapI_V<sceNetResolverInit>, "sceNetResolverInit", 'i', "" },
{0X808F6063, nullptr, "sceNetResolverStop", '?', "" },
{0X6138194A, nullptr, "sceNetResolverTerm", '?', "" },
{0X629E2FB7, nullptr, "sceNetResolverStartAtoN", '?', "" },
{0X14C17EF9, nullptr, "sceNetResolverStartNtoAAsync", '?', "" },
{0XAAC09184, nullptr, "sceNetResolverStartAtoNAsync", '?', "" },
{0X12748EB9, nullptr, "sceNetResolverWaitAsync", '?', "" },
{0X4EE99358, nullptr, "sceNetResolverPollAsync", '?', "" },
};
const HLEFunction sceNetInet[] = {
{0X17943399, &WrapI_V<sceNetInetInit>, "sceNetInetInit", 'i', "" },
{0X4CFE4E56, nullptr, "sceNetInetShutdown", '?', "" },
{0XA9ED66B9, &WrapI_V<sceNetInetTerm>, "sceNetInetTerm", 'i', "" },
{0X8B7B220F, &WrapI_III<sceNetInetSocket>, "sceNetInetSocket", 'i', "iii" },
{0X2FE71FE7, &WrapI_IIIUI<sceNetInetSetsockopt>, "sceNetInetSetsockopt", 'i', "iiixi"},
{0X4A114C7C, nullptr, "sceNetInetGetsockopt", '?', "" },
{0X410B34AA, &WrapI_IUI<sceNetInetConnect>, "sceNetInetConnect", 'i', "ixi" },
{0X805502DD, nullptr, "sceNetInetCloseWithRST", '?', "" },
{0XD10A1A7A, nullptr, "sceNetInetListen", '?', "" },
{0XDB094E1B, nullptr, "sceNetInetAccept", '?', "" },
{0XFAABB1DD, &WrapI_VUI<sceNetInetPoll>, "sceNetInetPoll", 'i', "pxi" },
{0X5BE8D595, nullptr, "sceNetInetSelect", '?', "" },
{0X8D7284EA, nullptr, "sceNetInetClose", '?', "" },
{0XCDA85C99, &WrapI_IUUU<sceNetInetRecv>, "sceNetInetRecv", 'i', "ixxx" },
{0XC91142E4, nullptr, "sceNetInetRecvfrom", '?', "" },
{0XEECE61D2, nullptr, "sceNetInetRecvmsg", '?', "" },
{0X7AA671BC, &WrapI_IUUU<sceNetInetSend>, "sceNetInetSend", 'i', "ixxx" },
{0X05038FC7, nullptr, "sceNetInetSendto", '?', "" },
{0X774E36F4, nullptr, "sceNetInetSendmsg", '?', "" },
{0XFBABE411, &WrapI_V<sceNetInetGetErrno>, "sceNetInetGetErrno", 'i', "" },
{0X1A33F9AE, nullptr, "sceNetInetBind", '?', "" },
{0XB75D5B0A, nullptr, "sceNetInetInetAddr", '?', "" },
{0X1BDF5D13, &WrapI_CU<sceNetInetInetAton>, "sceNetInetInetAton", 'i', "sx" },
{0XD0792666, nullptr, "sceNetInetInetNtop", '?', "" },
{0XE30B8C19, nullptr, "sceNetInetInetPton", '?', "" },
{0X8CA3A97E, nullptr, "sceNetInetGetPspError", '?', "" },
{0XE247B6D6, nullptr, "sceNetInetGetpeername", '?', "" },
{0X162E6FD5, nullptr, "sceNetInetGetsockname", '?', "" },
{0X80A21ABD, nullptr, "sceNetInetSocketAbort", '?', "" },
{0X39B0C7D3, nullptr, "sceNetInetGetUdpcbstat", '?', "" },
{0XB3888AD4, nullptr, "sceNetInetGetTcpcbstat", '?', "" },
};
const HLEFunction sceNetApctl[] = {
{0XCFB957C6, &WrapI_I<sceNetApctlConnect>, "sceNetApctlConnect", 'i', "i" },
{0X24FE91A1, &WrapI_V<sceNetApctlDisconnect>, "sceNetApctlDisconnect", 'i', "" },
@ -1588,8 +1450,6 @@ const HLEFunction sceNetIfhandle[] = {
void Register_sceNet() {
RegisterModule("sceNet", ARRAY_SIZE(sceNet), sceNet);
RegisterModule("sceNetResolver", ARRAY_SIZE(sceNetResolver), sceNetResolver);
RegisterModule("sceNetInet", ARRAY_SIZE(sceNetInet), sceNetInet);
RegisterModule("sceNetApctl", ARRAY_SIZE(sceNetApctl), sceNetApctl);
}

View file

@ -17,7 +17,6 @@
#pragma once
#include <StringUtils.h>
#include "Core/HLE/proAdhoc.h"
// Using constants instead of numbers for readability reason, since PSP_THREAD_ATTR_KERNEL/USER is located in sceKernelThread.cpp instead of sceKernelThread.h
@ -32,14 +31,8 @@
#define PSP_SO_REUSEPORT 0x0200
#define PSP_SO_NBIO 0x1009
// Infrastructure Errno Numbers
#define INET_EAGAIN 0x0B
#define INET_ETIMEDOUT 0x74
#define INET_EINPROGRESS 0x77
#define INET_EISCONN 0x7F
// On-Demand Nonblocking Flag
#define INET_MSG_DONTWAIT 0x80
// #define INET_MSG_DONTWAIT 0x80
// Event Flags
#define INET_POLLRDNORM 0x0040
@ -64,19 +57,6 @@ enum {
ERROR_NET_CORE_80211_NO_BSS = 0x80410106,
ERROR_NET_CORE_80211_NO_AVAIL_BSS = 0x80410107,
// pspnet_inet
ERROR_NET_INET_ALREADY_INITIALIZED = 0x80410201,
ERROR_NET_INET_SOCKET_BUSY = 0x80410202,
ERROR_NET_INET_CONFIG_INVALID_ARG = 0x80410203,
ERROR_NET_INET_GET_IFADDR = 0x80410204,
ERROR_NET_INET_SET_IFADDR = 0x80410205,
ERROR_NET_INET_DEL_IFADDR = 0x80410206,
ERROR_NET_INET_NO_DEFAULT_ROUTE = 0x80410207,
ERROR_NET_INET_GET_ROUTE = 0x80410208,
ERROR_NET_INET_SET_ROUTE = 0x80410209,
ERROR_NET_INET_FLUSH_ROUTE = 0x8041020a,
ERROR_NET_INET_INVALID_ARG = 0x8041020b,
// pspnet_poeclient
ERROR_NET_POECLIENT_INIT = 0x80410301,
ERROR_NET_POECLIENT_NO_PADO = 0x80410302,
@ -90,31 +70,6 @@ enum {
ERROR_NET_POECLIENT_TERMINATE = 0x8041030a,
ERROR_NET_POECLIENT_NOT_STARTED = 0x8041030b,
// pspnet_resolver
ERROR_NET_RESOLVER_NOT_TERMINATED = 0x80410401,
ERROR_NET_RESOLVER_NO_DNS_SERVER = 0x80410402,
ERROR_NET_RESOLVER_INVALID_PTR = 0x80410403,
ERROR_NET_RESOLVER_INVALID_BUFLEN = 0x80410404,
ERROR_NET_RESOLVER_INVALID_ID = 0x80410405,
ERROR_NET_RESOLVER_ID_MAX = 0x80410406,
ERROR_NET_RESOLVER_NO_MEM = 0x80410407,
ERROR_NET_RESOLVER_BAD_ID = 0x80410408, // ERROR_NET_RESOLVER_ID_NOT_FOUND
ERROR_NET_RESOLVER_CTX_BUSY = 0x80410409,
ERROR_NET_RESOLVER_ALREADY_STOPPED = 0x8041040a,
ERROR_NET_RESOLVER_NOT_SUPPORTED = 0x8041040b,
ERROR_NET_RESOLVER_BUF_NO_SPACE = 0x8041040c,
ERROR_NET_RESOLVER_INVALID_PACKET = 0x8041040d,
ERROR_NET_RESOLVER_STOPPED = 0x8041040e,
ERROR_NET_RESOLVER_SOCKET = 0x8041040f,
ERROR_NET_RESOLVER_TIMEOUT = 0x80410410,
ERROR_NET_RESOLVER_NO_RECORD = 0x80410411,
ERROR_NET_RESOLVER_RES_PACKET_FORMAT = 0x80410412,
ERROR_NET_RESOLVER_RES_SERVER_FAILURE = 0x80410413,
ERROR_NET_RESOLVER_INVALID_HOST = 0x80410414, // ERROR_NET_RESOLVER_NO_HOST
ERROR_NET_RESOLVER_RES_NOT_IMPLEMENTED = 0x80410415,
ERROR_NET_RESOLVER_RES_SERVER_REFUSED = 0x80410416,
ERROR_NET_RESOLVER_INTERNAL = 0x80410417,
// pspnet_dhcp
ERROR_NET_DHCP_INVALID_PACKET = 0x80410501,
ERROR_NET_DHCP_NO_SERVER = 0x80410502,
@ -221,28 +176,6 @@ enum {
#ifdef _MSC_VER
#pragma pack(push,1)
#endif
// Sockaddr
typedef struct SceNetInetSockaddr {
uint8_t sa_len;
uint8_t sa_family;
uint8_t sa_data[14];
} PACK SceNetInetSockaddr;
// Sockaddr_in
typedef struct SceNetInetSockaddrIn {
uint8_t sin_len;
uint8_t sin_family;
u16_le sin_port; //uint16_t
u32_le sin_addr; //uint32_t
uint8_t sin_zero[8];
} PACK SceNetInetSockaddrIn;
// 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;
} PACK SceNetInetPollfd;
typedef struct ProductStruct { // Similar to SceNetAdhocctlAdhocId ?
s32_le unknown; // Unknown, set to 0 // Product Type ?
@ -310,7 +243,7 @@ private:
};
extern bool netInited;
extern bool netInetInited;
// extern bool netInetInited;
extern bool netApctlInited;
extern u32 netApctlState;
extern SceNetApctlInfoInternal netApctlInfo;

3
Core/HLE/sceNetApctl.cpp Normal file
View file

@ -0,0 +1,3 @@
// TODO: move apctl here
#include "sceNetApctl.h"

3
Core/HLE/sceNetApctl.h Normal file
View file

@ -0,0 +1,3 @@
#pragma once
// TODO: move sceNetApctl here

1396
Core/HLE/sceNetInet.cpp Normal file

File diff suppressed because it is too large Load diff

193
Core/HLE/sceNetInet.h Normal file
View file

@ -0,0 +1,193 @@
#pragma once
#include "Core/HLE/HLE.h"
#include "Core/Net/InetSocket.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include <winsock.h>
#endif
#include <memory>
#include <shared_mutex>
#include <unordered_map>
// Sockaddr
typedef struct SceNetInetSockaddr {
uint8_t sa_len;
uint8_t sa_family;
uint8_t sa_data[14];
} PACK SceNetInetSockaddr;
// Sockaddr_in
typedef struct SceNetInetSockaddrIn {
uint8_t sin_len;
uint8_t sin_family;
u16_le sin_port; //uint16_t
u32_le sin_addr; //uint32_t
uint8_t sin_zero[8];
} PACK SceNetInetSockaddrIn;
// 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;
} PACK SceNetInetPollfd;
enum {
// pspnet_inet
ERROR_NET_INET_ALREADY_INITIALIZED = 0x80410201,
ERROR_NET_INET_SOCKET_BUSY = 0x80410202,
ERROR_NET_INET_CONFIG_INVALID_ARG = 0x80410203,
ERROR_NET_INET_GET_IFADDR = 0x80410204,
ERROR_NET_INET_SET_IFADDR = 0x80410205,
ERROR_NET_INET_DEL_IFADDR = 0x80410206,
ERROR_NET_INET_NO_DEFAULT_ROUTE = 0x80410207,
ERROR_NET_INET_GET_ROUTE = 0x80410208,
ERROR_NET_INET_SET_ROUTE = 0x80410209,
ERROR_NET_INET_FLUSH_ROUTE = 0x8041020a,
ERROR_NET_INET_INVALID_ARG = 0x8041020b,
};
enum PspInetAddressFamily {
PSP_NET_INET_AF_UNSPEC = 0,
PSP_NET_INET_AF_LOCAL = 1,
PSP_NET_INET_AF_INET = 2,
};
enum PspInetSocketLevel {
PSP_NET_INET_SOL_SOCKET = 0xFFFF,
};
enum PspInetSocketType {
PSP_NET_INET_SOCK_STREAM = 1,
PSP_NET_INET_SOCK_DGRAM = 2,
PSP_NET_INET_SOCK_RAW = 3,
PSP_NET_INET_SOCK_RDM = 4,
PSP_NET_INET_SOCK_SEQPACKET = 5,
PSP_NET_INET_SOCK_DCCP = 6,
PSP_NET_INET_SOCK_PACKET = 10,
PSP_NET_INET_SOCK_TYPE_MASK = 0xF,
};
enum PspInetSocketTypeFlag {
PSP_NET_INET_SOCK_CLOEXEC = 0x10000000,
PSP_NET_INET_SOCK_NONBLOCK = 0x20000000,
PSP_NET_INET_SOCK_NOSIGPIPE = 0x40000000,
PSP_NET_INET_SOCK_FLAGS_MASK = 0xF0000000,
};
// TODO: revisit protocols, not all are necessary
enum PspInetProtocol {
PSP_NET_INET_IPPROTO_IP = 0, // dummy for IP
PSP_NET_INET_IPPROTO_UNSPEC = 0, // 0 will defaulted to the only existing protocol for that particular domain/family and type
PSP_NET_INET_IPPROTO_ICMP = 1, // control message protocol
PSP_NET_INET_IPPROTO_IGMP = 2, // group mgmt protocol
PSP_NET_INET_IPPROTO_TCP = 6, // tcp
PSP_NET_INET_IPPROTO_EGP = 8, // exterior gateway protocol
PSP_NET_INET_IPPROTO_PUP = 12, // pup
PSP_NET_INET_IPPROTO_UDP = 17, // user datagram protocol
PSP_NET_INET_IPPROTO_IDP = 22, // xns idp
PSP_NET_INET_IPPROTO_RAW = 255, // raw IP packet
};
// TODO: INET_
enum PspInetSocketOptionName {
// TODO: also specify minimum socket size
INET_SO_ACCEPTCONN = 0x0002, // socket has had listen()
INET_SO_REUSEADDR = 0x0004, // allow local address reuse
INET_SO_KEEPALIVE = 0x0008, // keep connections alive
INET_SO_DONTROUTE = 0x0010, // just use interface addresses
INET_SO_BROADCAST = 0x0020, // permit sending of broadcast msgs
INET_SO_USELOOPBACK = 0x0040, // bypass hardware when possible
INET_SO_LINGER = 0x0080, // linger on close if data present
INET_SO_OOBINLINE = 0x0100, // leave received OOB data in line
INET_SO_REUSEPORT = 0x0200, // allow local address & port reuse
INET_SO_TIMESTAMP = 0x0400, // timestamp received dgram traffic
INET_SO_ONESBCAST = 0x0800, // allow broadcast to 255.255.255.255
INET_SO_SNDBUF = 0x1001, // send buffer size
INET_SO_RCVBUF = 0x1002, // receive buffer size
INET_SO_SNDLOWAT = 0x1003, // send low-water mark
INET_SO_RCVLOWAT = 0x1004, // receive low-water mark
INET_SO_SNDTIMEO = 0x1005, // send timeout
INET_SO_RCVTIMEO = 0x1006, // receive timeout
INET_SO_ERROR = 0x1007, // get error status and clear
INET_SO_TYPE = 0x1008, // get socket type
INET_SO_OVERFLOWED = 0x1009, // datagrams: return packets dropped
INET_SO_NONBLOCK = 0x1009, // non-blocking I/O
};
enum PspInetLimit {
PSP_NET_INET_SOMAXCONN = 128,
};
enum PspInetMessageFlag {
INET_MSG_OOB = 1,
INET_MSG_PEEK = 1 << 1,
INET_MSG_DONTROUTE = 1 << 2,
INET_MSG_EOR = 1 << 3,
INET_MSG_TRUNC = 1 << 4,
INET_MSG_CTRUNC = 1 << 5,
INET_MSG_WAITALL = 1 << 6,
INET_MSG_DONTWAIT = 1 << 7,
INET_MSG_BCAST = 1 << 8,
INET_MSG_MCAST = 1 << 9
};
enum InetErrorCode {
INET_EINPROGRESS = 119,
};
class SceNetInet {
public:
static bool Init();
static bool Shutdown();
static std::shared_ptr<SceNetInet> Get() {
return gInstance;
}
// TODO: document that errno should be set to EAFNOSUPPORT when this returns false
static bool TranslateInetAddressFamilyToNative(int &destAddressFamily, int srcAddressFamily);
static inline bool TranslateInetSocketLevelToNative(int &destSocketLevel, int srcSocketLevel);
// TODO: document that errno should be set to ESOMETHING when this returns false
static bool TranslateInetSocketTypeToNative(int &destSocketType, bool &destNonBlocking, int srcSocketType);
// TODO: document that errno should be set to EPROTONOSUPPORT when this returns false
static bool TranslateInetProtocolToNative(int &destProtocol, int srcProtocol);
// TODO: document that errno should be set to EPROTONOSUPPORT when this returns false
static bool TranslateInetOptnameToNativeOptname(int &destOptname, int inetOptname);
static int TranslateInetFlagsToNativeFlags(int messageFlags, bool nonBlocking);
static int TranslateNativeErrorToInetError(int nativeError);
// TODO: document
int GetLastError();
void SetLastError(int error);
int SetLastErrorToMatchPlatform();
std::shared_ptr<InetSocket> CreateAndAssociateInetSocket(int nativeSocketId, int protocol, bool nonBlocking);
std::shared_ptr<InetSocket> GetInetSocket(int inetSocketId);
bool GetNativeSocketIdForInetSocketId(int &nativeSocketId, int inetSocketId);
bool EraseNativeSocket(int inetSocketId);
bool TranslateInetFdSetToNativeFdSet(int& maxFd, fd_set &destFdSet, u32 fdsPtr) const;
private:
void CloseAllRemainingSockets() const;
static std::shared_ptr<SceNetInet> gInstance;
static std::shared_mutex gLock;
static std::unordered_map<PspInetAddressFamily, int> gInetAddressFamilyToNativeAddressFamily;
// TODO: document that this does not include flags
static std::unordered_map<PspInetSocketType, int> gInetSocketTypeToNativeSocketType;
static std::unordered_map<PspInetProtocol, int> gInetProtocolToNativeProtocol;
// TODO: Handle commented out options
static std::unordered_map<PspInetSocketOptionName, int> gInetSocketOptnameToNativeOptname;
static std::unordered_map<PspInetMessageFlag, int> gInetMessageFlagToNativeMessageFlag;
static std::unordered_map<int, InetErrorCode> gNativeErrorCodeToInetErrorCode;
int mLastError = 0;
std::unordered_map<int, std::shared_ptr<InetSocket>> mInetSocketIdToNativeSocket;
int mCurrentInetSocketId = 0;
std::shared_mutex mLock;
};
void Register_sceNetInet();

312
Core/HLE/sceNetResolver.cpp Normal file
View file

@ -0,0 +1,312 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#if __linux__ || __APPLE__ || defined(__OpenBSD__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#endif
// TODO: fixme move Core/Net to Common/Net
#include "Common/Net/Resolve.h"
#include "Core/Net/InetCommon.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/Serialize/SerializeMap.h"
#include "Core/Config.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/sceKernelMemory.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Config.h"
#include "Core/MemMapHelpers.h"
#include "Core/Util/PortManager.h"
#include "sceKernel.h"
#include "sceKernelThread.h"
#include "sceKernelMutex.h"
#include "sceUtility.h"
#include "Core/HLE/proAdhoc.h"
#include "Core/HLE/sceNetResolver.h"
#include <iostream>
#include <shared_mutex>
#include "sceNet.h"
#include "Core/HLE/sceNp.h"
#include "Core/Reporting.h"
#include "Core/Instance.h"
#include "Core/Net/InetSocket.h"
#if PPSSPP_PLATFORM(SWITCH) && !defined(INADDR_NONE)
// Missing toolchain define
#define INADDR_NONE 0xFFFFFFFF
#endif
static int sceNetResolverInit() {
ERROR_LOG(Log::sceNet, "UNTESTED %s()", __FUNCTION__);
g_Config.mHostToAlias["socomftb2.psp.online.scea.com"] = "67.222.156.250";
g_Config.mHostToAlias["socompsp-prod.muis.pdonline.scea.com"] = "67.222.156.250";
SceNetResolver::Init();
return 0;
}
static int sceNetResolverTerm() {
ERROR_LOG(Log::sceNet, "UNTESTED %s()", __FUNCTION__);
SceNetResolver::Shutdown();
return 0;
}
// Note: timeouts are in seconds
int NetResolver_StartNtoA(u32 resolverId, u32 hostnamePtr, u32 inAddrPtr, int timeout, int retry) {
auto sceNetResolver = SceNetResolver::Get();
if (!sceNetResolver) {
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_STOPPED, "Net Resolver Subsystem Shutdown: Resolver %i",
resolverId);
}
const auto resolver = sceNetResolver->GetNetResolver(resolverId);
if (resolver == nullptr) {
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_BAD_ID, "Bad Resolver Id: %i", resolverId);
}
addrinfo* resolved = nullptr;
std::string err, hostname = std::string(safe_string(Memory::GetCharPointer(hostnamePtr)));
SockAddrIN4 addr{};
addr.in.sin_addr.s_addr = INADDR_NONE;
// Flag resolver as in-progress - not relevant for sync functions but potentially relevant for async
resolver->SetIsRunning(true);
// Resolve any aliases
if (g_Config.mHostToAlias.find(hostname) != g_Config.mHostToAlias.end()) {
const std::string& alias = g_Config.mHostToAlias[hostname];
INFO_LOG(Log::sceNet, "%s - Resolved alias %s from hostname %s", __FUNCTION__, alias.c_str(), hostname.c_str());
hostname = alias;
}
// Attempt to execute a DNS resolution
if (!net::DNSResolve(hostname, "", &resolved, err)) {
// TODO: Return an error based on the outputted "err" (unfortunately it's already converted to string)
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_INVALID_HOST, "DNS Error Resolving %s (%s)\n", hostname.c_str(),
err.c_str());
}
// If successful, write to memory
if (resolved != nullptr) {
for (auto ptr = resolved; ptr != nullptr; ptr = ptr->ai_next) {
switch (ptr->ai_family) {
case AF_INET:
addr.in = *(sockaddr_in *) ptr->ai_addr;
break;
}
}
net::DNSResolveFree(resolved);
Memory::Write_U32(addr.in.sin_addr.s_addr, inAddrPtr);
INFO_LOG(Log::sceNet, "%s - Hostname: %s => IPv4: %s", __FUNCTION__, hostname.c_str(),
ip2str(addr.in.sin_addr, false).c_str());
}
// Flag resolver as complete
resolver->SetIsRunning(false);
return 0;
}
static int sceNetResolverStartNtoA(int resolverId, u32 hostnamePtr, u32 inAddrPtr, int timeout, int retry) {
for (int attempt = 0; attempt < retry; ++attempt) {
if (const int status = NetResolver_StartNtoA(resolverId, hostnamePtr, inAddrPtr, timeout, retry); status >= 0) {
return status;
}
}
return -1;
}
static int sceNetResolverStartNtoAAsync(int resolverId, u32 hostnamePtr, u32 inAddrPtr, int timeout, int retry) {
ERROR_LOG_REPORT_ONCE(sceNetResolverStartNtoAAsync, Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %d, %d) at %08x",
__FUNCTION__, resolverId, hostnamePtr, inAddrPtr, timeout, retry, currentMIPS->pc);
return NetResolver_StartNtoA(resolverId, hostnamePtr, inAddrPtr, timeout, retry);
}
static int sceNetResolverPollAsync(int resolverId, u32 unknown) {
ERROR_LOG_REPORT_ONCE(sceNetResolverPollAsync, Log::sceNet, "UNIMPL %s(%d, %08x) at %08x", __FUNCTION__, resolverId,
unknown, currentMIPS->pc);
// TODO: Implement after confirming that this returns the state of resolver.isRunning
return 0;
}
static int sceNetResolverWaitAsync(int resolverId, u32 unknown) {
ERROR_LOG_REPORT_ONCE(sceNetResolverWaitAsync, Log::sceNet, "UNIMPL %s(%d, %08x) at %08x", __FUNCTION__, resolverId,
unknown, currentMIPS->pc);
// TODO: Implement after confirming that this blocks current thread until resolver.isRunning flips to false
return 0;
}
static int sceNetResolverStartAtoN(int resolverId, u32 inAddr, u32 hostnamePtr, int hostnameLength, int timeout,
int retry) {
ERROR_LOG_REPORT_ONCE(sceNetResolverStartAtoN, Log::sceNet, "UNIMPL %s(%d, %08x[%s], %08x, %i, %i, %i) at %08x",
__FUNCTION__, resolverId, inAddr, ip2str(*(in_addr*)&inAddr, false).c_str(), hostnamePtr,
hostnameLength, timeout, retry, currentMIPS->pc);
// TODO: Implement via getnameinfo
return 0;
}
static int sceNetResolverStartAtoNAsync(int resolverId, u32 inAddr, u32 hostnamePtr, int hostnameLength, int timeout,
int retry) {
ERROR_LOG_REPORT_ONCE(sceNetResolverStartAtoNAsync, Log::sceNet, "UNIMPL %s(%d, %08x[%s], %08x, %i, %i, %i) at %08x",
__FUNCTION__, resolverId, inAddr, ip2str(*(in_addr*)&inAddr, false).c_str(), hostnamePtr,
hostnameLength, timeout, retry, currentMIPS->pc);
return 0;
}
static int sceNetResolverCreate(u32 resolverIdPtr, u32 bufferPtr, int bufferLen) {
WARN_LOG(Log::sceNet, "UNTESTED %s(%08x[%d], %08x, %d) at %08x", __FUNCTION__, resolverIdPtr,
Memory::Read_U32(resolverIdPtr), bufferPtr, bufferLen, currentMIPS->pc);
if (!Memory::IsValidRange(resolverIdPtr, 4))
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_INVALID_PTR, "Invalid Ptr: %08x", resolverIdPtr);
if (Memory::IsValidRange(bufferPtr, 4) && bufferLen < 1)
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_INVALID_BUFLEN, "Invalid Buffer Length: %i", bufferLen);
auto sceNetResolver = SceNetResolver::Get();
if (!sceNetResolver)
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_STOPPED, "Resolver Subsystem Stopped");
const auto resolver = sceNetResolver->CreateNetResolver(bufferPtr, bufferLen);
Memory::Write_U32(resolver->GetId(), resolverIdPtr);
return 0;
}
static int sceNetResolverStop(u32 resolverId) {
auto sceNetResolver = SceNetResolver::Get();
if (!sceNetResolver) {
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_STOPPED, "Resolver Subsystem Stopped (Resolver Id: %i)",
resolverId);
}
const auto resolver = sceNetResolver->GetNetResolver(resolverId);
WARN_LOG(Log::sceNet, "UNTESTED %s(%d) at %08x", __FUNCTION__, resolverId, currentMIPS->pc);
if (resolver == nullptr)
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_BAD_ID, "Bad Resolver Id: %i", resolverId);
if (!resolver->GetIsRunning())
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_ALREADY_STOPPED, "Resolver Already Stopped (Id: %i)", resolverId);
resolver->SetIsRunning(false);
return 0;
}
static int sceNetResolverDelete(u32 resolverId) {
WARN_LOG(Log::sceNet, "UNTESTED %s(%d) at %08x", __FUNCTION__, resolverId, currentMIPS->pc);
auto sceNetResolver = SceNetResolver::Get();
if (!sceNetResolver)
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_STOPPED, "Resolver Subsystem Stopped (Resolver Id: %i)",
resolverId);
if (!sceNetResolver->DeleteNetResolver(resolverId))
return hleLogError(Log::sceNet, ERROR_NET_RESOLVER_BAD_ID, "Bad Resolver Id: %i", resolverId);
return 0;
}
const HLEFunction sceNetResolver[] = {
{0X224C5F44, &WrapI_IUUII<sceNetResolverStartNtoA>, "sceNetResolverStartNtoA", 'i', "ixxii"},
{0X244172AF, &WrapI_UUI<sceNetResolverCreate>, "sceNetResolverCreate", 'i', "xxi"},
{0X94523E09, &WrapI_U<sceNetResolverDelete>, "sceNetResolverDelete", 'i', "i"},
{0XF3370E61, &WrapI_V<sceNetResolverInit>, "sceNetResolverInit", 'i', ""},
{0X808F6063, &WrapI_U<sceNetResolverStop>, "sceNetResolverStop", 'i', "i"},
{0X6138194A, &WrapI_V<sceNetResolverTerm>, "sceNetResolverTerm", 'i', ""},
{0X629E2FB7, &WrapI_IUUIII<sceNetResolverStartAtoN>, "sceNetResolverStartAtoN", 'i', "ixxiii"},
{0X14C17EF9, &WrapI_IUUII<sceNetResolverStartNtoAAsync>, "sceNetResolverStartNtoAAsync", 'i', "ixxii"},
{0XAAC09184, &WrapI_IUUIII<sceNetResolverStartAtoNAsync>, "sceNetResolverStartAtoNAsync", 'i', "ixxiii"},
{0X12748EB9, &WrapI_IU<sceNetResolverWaitAsync>, "sceNetResolverWaitAsync", 'i', "ix"},
{0X4EE99358, &WrapI_IU<sceNetResolverPollAsync>, "sceNetResolverPollAsync", 'i', "ix"},
};
std::shared_ptr<SceNetResolver> SceNetResolver::gInstance;
std::shared_mutex SceNetResolver::gLock;
void SceNetResolver::Init() {
auto lock = std::unique_lock(gLock);
gInstance = std::make_shared<SceNetResolver>();
}
void SceNetResolver::Shutdown() {
auto lock = std::unique_lock(gLock);
gInstance = nullptr;
}
std::shared_ptr<SceNetResolver> SceNetResolver::Get() {
auto lock = std::shared_lock(gLock);
return gInstance;
}
std::shared_ptr<NetResolver> SceNetResolver::GetNetResolver(u32 resolverId) {
std::shared_lock lock(mNetResolversLock);
const auto it = mNetResolvers.find(resolverId);
return it != mNetResolvers.end() ? it->second : nullptr;
}
std::shared_ptr<NetResolver> SceNetResolver::CreateNetResolver(u32 bufferPtr, u32 bufferLen) {
// TODO: Consider using SceUidManager instead of this 1-indexed id
// TODO: Implement ERROR_NET_RESOLVER_ID_MAX (possibly 32?)
std::unique_lock lock(mNetResolversLock);
int currentNetResolverId = mCurrentNetResolverId++;
return mNetResolvers[currentNetResolverId] = std::make_shared<NetResolver>(
currentNetResolverId, // id
bufferPtr, // bufferPtr
bufferLen // bufferLen
);
}
bool SceNetResolver::TerminateNetResolver(u32 resolverId) {
const auto netResolver = GetNetResolver(resolverId);
if (netResolver == nullptr) {
return false;
}
netResolver->SetIsRunning(false);
return true;
}
bool SceNetResolver::DeleteNetResolver(u32 resolverId) {
std::unique_lock lock(mNetResolversLock);
const auto it = mNetResolvers.find(resolverId);
if (it == mNetResolvers.end()) {
return false;
}
mNetResolvers.erase(it);
return true;
}
void SceNetResolver::ClearNetResolvers() {
std::unique_lock lock(mNetResolversLock);
for (auto &[first, second]: mNetResolvers) {
second->SetIsRunning(false);
}
mNetResolvers.clear();
}
void Register_sceNetResolver() {
RegisterModule("sceNetResolver", ARRAY_SIZE(sceNetResolver), sceNetResolver);
}

74
Core/HLE/sceNetResolver.h Normal file
View file

@ -0,0 +1,74 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include <memory>
#include <shared_mutex>
#include "Core/Net/NetResolver.h"
class SceNetResolver;
enum {
// pspnet_resolver
ERROR_NET_RESOLVER_NOT_TERMINATED = 0x80410401,
ERROR_NET_RESOLVER_NO_DNS_SERVER = 0x80410402,
ERROR_NET_RESOLVER_INVALID_PTR = 0x80410403,
ERROR_NET_RESOLVER_INVALID_BUFLEN = 0x80410404,
ERROR_NET_RESOLVER_INVALID_ID = 0x80410405,
ERROR_NET_RESOLVER_ID_MAX = 0x80410406,
ERROR_NET_RESOLVER_NO_MEM = 0x80410407,
ERROR_NET_RESOLVER_BAD_ID = 0x80410408, // ERROR_NET_RESOLVER_ID_NOT_FOUND
ERROR_NET_RESOLVER_CTX_BUSY = 0x80410409,
ERROR_NET_RESOLVER_ALREADY_STOPPED = 0x8041040a,
ERROR_NET_RESOLVER_NOT_SUPPORTED = 0x8041040b,
ERROR_NET_RESOLVER_BUF_NO_SPACE = 0x8041040c,
ERROR_NET_RESOLVER_INVALID_PACKET = 0x8041040d,
ERROR_NET_RESOLVER_STOPPED = 0x8041040e,
ERROR_NET_RESOLVER_SOCKET = 0x8041040f,
ERROR_NET_RESOLVER_TIMEOUT = 0x80410410,
ERROR_NET_RESOLVER_NO_RECORD = 0x80410411,
ERROR_NET_RESOLVER_RES_PACKET_FORMAT = 0x80410412,
ERROR_NET_RESOLVER_RES_SERVER_FAILURE = 0x80410413,
ERROR_NET_RESOLVER_INVALID_HOST = 0x80410414, // ERROR_NET_RESOLVER_NO_HOST
ERROR_NET_RESOLVER_RES_NOT_IMPLEMENTED = 0x80410415,
ERROR_NET_RESOLVER_RES_SERVER_REFUSED = 0x80410416,
ERROR_NET_RESOLVER_INTERNAL = 0x80410417,
};
class SceNetResolver {
public:
static void Init();
static void Shutdown();
static std::shared_ptr<SceNetResolver> Get();
std::shared_ptr<NetResolver> GetNetResolver(u32 resolverId);
std::shared_ptr<NetResolver> CreateNetResolver(u32 bufferPtr, u32 bufferLen);
bool TerminateNetResolver(u32 resolverId);
bool DeleteNetResolver(u32 resolverId);
void ClearNetResolvers();
private:
static std::shared_ptr<SceNetResolver> gInstance;
static std::shared_mutex gLock;
int mCurrentNetResolverId = 1;
std::unordered_map<u32, std::shared_ptr<NetResolver>> mNetResolvers;
std::shared_mutex mNetResolversLock;
};
void Register_sceNetResolver();

View file

@ -248,7 +248,16 @@ u8* GetPointerWrite(const u32 address);
const u8* GetPointer(const u32 address);
u8 *GetPointerWriteRange(const u32 address, const u32 size);
template<typename T>
T* GetTypedPointerWriteRange(const u32 address, const u32 size) {
return reinterpret_cast<T*>(GetPointerWriteRange(address, size));
}
const u8 *GetPointerRange(const u32 address, const u32 size);
template<typename T>
const T* GetTypedPointerRange(const u32 address, const u32 size) {
return reinterpret_cast<const T*>(GetPointerRange(address, size));
}
bool IsRAMAddress(const u32 address);
inline bool IsVRAMAddress(const u32 address) {

54
Core/Net/InetCommon.cpp Normal file
View file

@ -0,0 +1,54 @@
// TODO: license
#if __linux__ || __APPLE__ || defined(__OpenBSD__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#endif
// TODO: fixme move Core/Net to Common/Net
#include "Common/Net/Resolve.h"
#include "Core/Net/InetCommon.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Serialize/Serializer.h"
#include "Core/Config.h"
#include "Core/HLE/HLE.h"
#include "Core/MemMapHelpers.h"
#include "Core/HLE/proAdhoc.h"
#include <iostream>
#include <shared_mutex>
#include "Core/HLE/sceNp.h"
#if PPSSPP_PLATFORM(WINDOWS)
#define close closesocket
#endif
bool getDefaultOutboundSockaddr(sockaddr_in& destSockaddrIn, socklen_t& destSocklen) {
auto fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
ERROR_LOG(Log::sceNet, "getSockAddrFromDefaultSocket: Failed to open socket (%s)", strerror(errno));
return false;
}
sockaddr_in connectingTo;
memset(&connectingTo, 0, sizeof(connectingTo));
connectingTo.sin_family = AF_INET;
connectingTo.sin_port = htons(53);
connectingTo.sin_addr.s_addr = 0x08080808;
if (connect(fd, (sockaddr*) &connectingTo, sizeof(connectingTo)) < 0) {
ERROR_LOG(Log::sceNet, "getSockAddrFromDefaultSocket: Failed to connect to Google (%s)", strerror(errno));
close(fd);
return false;
}
if (getsockname(fd, (sockaddr*) &destSockaddrIn, &destSocklen) < 0) {
ERROR_LOG(Log::sceNet, "getSockAddrFromDefaultSocket: Failed to execute getsockname (%s)", strerror(errno));
close(fd);
return false;
}
close(fd);
return true;
}

12
Core/Net/InetCommon.h Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include "Core/HLE/HLE.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#endif
bool getDefaultOutboundSockaddr(sockaddr_in& destSockaddrIn, socklen_t& destSocklen);

3
Core/Net/InetSocket.cpp Normal file
View file

@ -0,0 +1,3 @@
// TODO: remove me if the functions remain inlined
#include "InetSocket.h"

37
Core/Net/InetSocket.h Normal file
View file

@ -0,0 +1,37 @@
#pragma once
// TODO: document
class InetSocket {
public:
InetSocket(int sceSocketId, int nativeSocketId, int protocol, bool nonBlocking) :
mInetSocketId(sceSocketId),
mNativeSocketId(nativeSocketId),
mProtocol(protocol),
mNonBlocking(nonBlocking) {}
int GetInetSocketId() const {
return mInetSocketId;
}
int GetNativeSocketId() const {
return mNativeSocketId;
}
bool IsNonBlocking() const {
return mNonBlocking;
}
void SetNonBlocking(const bool nonBlocking) {
mNonBlocking = nonBlocking;
}
// TODO: document that this is the native protocol
int GetProtocol() const {
return mProtocol;
}
private:
int mInetSocketId;
int mNativeSocketId;
int mProtocol;
bool mNonBlocking = false;
};

3
Core/Net/NetResolver.cpp Normal file
View file

@ -0,0 +1,3 @@
#include "NetResolver.h"
// TODO: remove me if the functions remain inlined

32
Core/Net/NetResolver.h Normal file
View file

@ -0,0 +1,32 @@
#pragma once
#include "CommonTypes.h"
class NetResolver {
public:
NetResolver(const NetResolver& other) = default;
NetResolver() :
mId(0),
mIsRunning(false),
mBufferAddr(0),
mBufferLen(0) {}
NetResolver(const int id, const u32 bufferAddr, const int bufferLen) :
mId(id),
mIsRunning(false),
mBufferAddr(bufferAddr),
mBufferLen(bufferLen) {}
int GetId() const { return mId; }
bool GetIsRunning() const { return mIsRunning; }
void SetIsRunning(const bool isRunning) { this->mIsRunning = isRunning; }
private:
int mId;
bool mIsRunning;
u32 mBufferAddr;
u32 mBufferLen;
};

View file

@ -177,6 +177,9 @@
<ClInclude Include="..\..\Core\HDRemaster.h" />
<ClInclude Include="..\..\Core\HLE\AtracCtx.h" />
<ClInclude Include="..\..\Core\HLE\AtracCtx2.h" />
<ClInclude Include="..\..\Core\HLE\sceNetApctl.h" />
<ClInclude Include="..\..\Core\HLE\sceNetInet.h" />
<ClInclude Include="..\..\Core\HLE\sceNetResolver.h" />
<ClInclude Include="..\..\Core\HLE\sceNp2.h" />
<ClInclude Include="..\..\Core\Instance.h" />
<ClInclude Include="..\..\Core\HLE\FunctionWrappers.h" />
@ -314,6 +317,9 @@
<ClInclude Include="..\..\Core\MIPS\x86\RegCacheFPU.h" />
<ClInclude Include="..\..\Core\MIPS\x86\X64IRJit.h" />
<ClInclude Include="..\..\Core\MIPS\x86\X64IRRegCache.h" />
<ClInclude Include="..\..\Core\Net\InetCommon.h" />
<ClInclude Include="..\..\Core\Net\InetSocket.h" />
<ClInclude Include="..\..\Core\Net\NetResolver.h" />
<ClInclude Include="..\..\Core\Opcode.h" />
<ClInclude Include="..\..\Core\PSPLoaders.h" />
<ClInclude Include="..\..\Core\Reporting.h" />
@ -433,6 +439,9 @@
<ClCompile Include="..\..\Core\HDRemaster.cpp" />
<ClCompile Include="..\..\Core\HLE\AtracCtx.cpp" />
<ClCompile Include="..\..\Core\HLE\AtracCtx2.cpp" />
<ClCompile Include="..\..\Core\HLE\sceNetApctl.cpp" />
<ClCompile Include="..\..\Core\HLE\sceNetInet.cpp" />
<ClCompile Include="..\..\Core\HLE\sceNetResolver.cpp" />
<ClCompile Include="..\..\Core\HLE\sceNp2.cpp" />
<ClCompile Include="..\..\Core\Instance.cpp" />
<ClCompile Include="..\..\Core\HLE\HLE.cpp" />
@ -608,6 +617,9 @@
<ClCompile Include="..\..\Core\MIPS\x86\X64IRCompVec.cpp" />
<ClCompile Include="..\..\Core\MIPS\x86\X64IRJit.cpp" />
<ClCompile Include="..\..\Core\MIPS\x86\X64IRRegCache.cpp" />
<ClCompile Include="..\..\Core\Net\InetCommon.cpp" />
<ClCompile Include="..\..\Core\Net\InetSocket.cpp" />
<ClCompile Include="..\..\Core\Net\NetResolver.cpp" />
<ClCompile Include="..\..\Core\PSPLoaders.cpp" />
<ClCompile Include="..\..\Core\Reporting.cpp" />
<ClCompile Include="..\..\Core\Replay.cpp" />

View file

@ -86,6 +86,9 @@
<Filter Include="Ext\libzip">
<UniqueIdentifier>{1ad7ee67-c496-4709-bf98-cad322fe5d97}</UniqueIdentifier>
</Filter>
<Filter Include="Net">
<UniqueIdentifier>{4341253d-564e-490a-9780-179786e7ab2a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
@ -1211,6 +1214,24 @@
<ClCompile Include="..\..\Core\Dialog\PSPOskConstants.cpp">
<Filter>Dialog</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\HLE\sceNetApctl.cpp">
<Filter>HLE</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\HLE\sceNetInet.cpp">
<Filter>HLE</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\HLE\sceNetResolver.cpp">
<Filter>HLE</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\Net\InetCommon.cpp">
<Filter>Net</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\Net\InetSocket.cpp">
<Filter>Net</Filter>
</ClCompile>
<ClCompile Include="..\..\Core\Net\NetResolver.cpp">
<Filter>Net</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
@ -1909,6 +1930,24 @@
<ClInclude Include="..\..\Core\Dialog\PSPOskConstants.h">
<Filter>Dialog</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\HLE\sceNetApctl.h">
<Filter>HLE</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\HLE\sceNetInet.h">
<Filter>HLE</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\HLE\sceNetResolver.h">
<Filter>HLE</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\Net\InetCommon.h">
<Filter>Net</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\Net\InetSocket.h">
<Filter>Net</Filter>
</ClInclude>
<ClInclude Include="..\..\Core\Net\NetResolver.h">
<Filter>Net</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\ext\gason\LICENSE">

View file

@ -510,6 +510,9 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Core/MIPS/IR/IRNativeCommon.cpp \
$(SRC)/Core/MIPS/IR/IRPassSimplify.cpp \
$(SRC)/Core/MIPS/IR/IRRegCache.cpp \
$(SRC)/Core/Net/InetCommon.cpp \
$(SRC)/Core/Net/InetSocket.cpp \
$(SRC)/Core/Net/NetResolver.cpp \
$(SRC)/GPU/Math3D.cpp \
$(SRC)/GPU/GPU.cpp \
$(SRC)/GPU/GPUCommon.cpp \
@ -709,6 +712,9 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Core/HLE/proAdhocServer.cpp \
$(SRC)/Core/HLE/sceNetAdhoc.cpp \
$(SRC)/Core/HLE/sceNetAdhocMatching.cpp \
$(SRC)/Core/HLE/sceNetApctl.cpp \
$(SRC)/Core/HLE/sceNetInet.cpp \
$(SRC)/Core/HLE/sceNetResolver.cpp \
$(SRC)/Core/HLE/sceOpenPSID.cpp \
$(SRC)/Core/HLE/sceP3da.cpp \
$(SRC)/Core/HLE/sceMt19937.cpp \

@ -1 +1 @@
Subproject commit 32917bdddf4982e62047862c6633e7671aaaf2cb
Subproject commit 3a91a58605c0fb05833a228dbb674357b0e65a09

View file

@ -739,6 +739,9 @@ SOURCES_CXX += \
$(COREDIR)/HLE/sceNet.cpp \
$(COREDIR)/HLE/sceNetAdhoc.cpp \
$(COREDIR)/HLE/sceNetAdhocMatching.cpp \
$(COREDIR)/HLE/sceNetApctl.cpp \
$(COREDIR)/HLE/sceNetInet.cpp \
$(COREDIR)/HLE/sceNetResolver.cpp \
$(COREDIR)/HLE/proAdhocServer.cpp \
$(COREDIR)/HLE/proAdhoc.cpp \
$(COREDIR)/HLE/sceOpenPSID.cpp \
@ -811,6 +814,9 @@ SOURCES_CXX += \
$(COREDIR)/MemFault.cpp \
$(COREDIR)/MemMap.cpp \
$(COREDIR)/MemMapFunctions.cpp \
$(COREDIR)/Net/InetCommon.cpp \
$(COREDIR)/Net/InetSocket.cpp \
$(COREDIR)/Net/NetResolver.cpp \
$(COREDIR)/PSPLoaders.cpp \
$(COREDIR)/Replay.cpp \
$(COREDIR)/Reporting.cpp \