Skip to content

Commit

Permalink
sceNetInet and sceNetResolver support.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAWhiteBloodCell committed Dec 18, 2023
1 parent 06e92e9 commit 62ef20b
Show file tree
Hide file tree
Showing 21 changed files with 1,677 additions and 234 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ option(USE_SYSTEM_MINIUPNPC "Dynamically link against system miniUPnPc" ${USE_SY
option(USE_ASAN "Use address sanitizer" OFF)
option(USE_UBSAN "Use undefined behaviour sanitizer" OFF)

# TODO: stop hardcoding this before PR
# set(USING_QT_UI ON)

if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN)
if(USING_X11_VULKAN)
message("Using X11 for Vulkan")
Expand Down Expand Up @@ -2128,6 +2131,12 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/HLE/sceNet.h
Core/HLE/sceNetAdhoc.cpp
Core/HLE/sceNetAdhoc.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
Expand Down Expand Up @@ -2248,6 +2257,12 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/MIPS/MIPSVFPUFallbacks.h
Core/MIPS/MIPSAsm.cpp
Core/MIPS/MIPSAsm.h
Core/Net/InetCommon.cpp
Core/Net/InetCommon.h
Core/Net/NetResolver.cpp
Core/Net/NetResolver.h
Core/Net/SceSocket.cpp
Core/Net/SceSocket.h
Core/MemFault.cpp
Core/MemFault.h
Core/MemMap.cpp
Expand Down Expand Up @@ -2337,6 +2352,11 @@ include_directories(ext/libchdr/include)
target_link_libraries(${CoreLibName} Common native chdr kirk cityhash sfmt19937 xbrz xxhash rcheevos ${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)
Expand Down
11 changes: 11 additions & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
mPostShaderSetting[it.first] = std::stof(it.second);
}

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()) {
Expand Down Expand Up @@ -1323,6 +1327,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");

Expand Down
2 changes: 2 additions & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ struct Config {
// Networking
std::string proAdhocServer;
bool bEnableWlan;
std::map<std::string, std::string> mHostToAlias; // TODO: mPostShaderSetting
bool bEnableAdhocServer;
bool bEnableUPnP;
bool bUPnPUseOriginalPort;
Expand All @@ -453,6 +454,7 @@ struct Config {
int iFirmwareVersion;
bool bBypassOSKWithKeyboard;


// Virtual reality
bool bEnableVR;
bool bEnable6DoF;
Expand Down
20 changes: 20 additions & 0 deletions Core/HLE/FunctionWrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions Core/HLE/HLETables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
#include "sceSfmt19937.h"
#include "sceG729.h"
#include "KUBridge.h"
#include "sceNetInet.h"
#include "sceNetResolver.h"

#define N(s) s

Expand Down Expand Up @@ -236,6 +238,8 @@ void RegisterAllModules() {
Register_sceFont();
Register_sceNet();
Register_sceNetAdhoc();
Register_sceNetInet();
Register_sceNetResolver();
Register_sceRtc();
Register_sceWlanDrv();
Register_sceMpeg();
Expand Down
1 change: 1 addition & 0 deletions Core/HLE/proAdhoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "Core/HLE/sceKernelMutex.h"
#include "Core/HLE/sceUtility.h"

// TODO: move this to some common set
#ifdef _WIN32
#undef errno
#undef ESHUTDOWN
Expand Down
Loading

0 comments on commit 62ef20b

Please sign in to comment.