Skip to content
Open
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,9 @@
[submodule "externals/openal-soft"]
path = externals/openal-soft
url = https://github.com/shadexternals/openal-soft.git
[submodule "externals/cppcodec"]
path = externals/cppcodec
url = https://github.com/tplgy/cppcodec.git
[submodule "externals/ixwebsocket"]
path = externals/ixwebsocket
url = https://github.com/machinezone/IXWebSocket
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ endif()
add_subdirectory(externals)
include_directories(src)

set(SHAD_NET src/core/shadnet/matching_context.cpp
src/core/shadnet/matching_context.h
src/core/shadnet/matching_json.cpp
src/core/shadnet/matching_json.h
)

set(AJM_LIB src/core/libraries/ajm/ajm.cpp
src/core/libraries/ajm/ajm.h
src/core/libraries/ajm/ajm_aac.cpp
Expand Down Expand Up @@ -860,6 +866,7 @@ set(CORE src/core/aerolib/stubs.cpp
${CAMERA_LIBS}
${COMPANION_LIBS}
${DEV_TOOLS}
${SHAD_NET}
src/core/debug_state.cpp
src/core/debug_state.h
src/core/debugger.cpp
Expand Down Expand Up @@ -1137,7 +1144,7 @@ create_target_directory_groups(shadps4)

target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 SDL3_mixer::SDL3_mixer pugixml::pugixml)
target_link_libraries(shadps4 PRIVATE stb::headers libusb::usb lfreist-hwinfo::hwinfo nlohmann_json::nlohmann_json miniz::miniz fdk-aac CLI11::CLI11 OpenAL::OpenAL Cpp_Httplib)
target_link_libraries(shadps4 PRIVATE stb::headers libusb::usb lfreist-hwinfo::hwinfo nlohmann_json::nlohmann_json miniz::miniz fdk-aac CLI11::CLI11 OpenAL::OpenAL Cpp_Httplib Cppcodec ixwebsocket)

target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
Expand Down
11 changes: 11 additions & 0 deletions externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,14 @@ endif()
add_library(Cpp_Httplib INTERFACE)
target_include_directories(Cpp_Httplib INTERFACE cpp-httplib/)

# cppcodec
add_library(Cppcodec INTERFACE)
target_include_directories(Cppcodec INTERFACE cppcodec/)

# IXWebSocket
if (NOT TARGET ixwebsocket)
if (NOT WIN32)
set(USE_TLS ON CACHE BOOL "" FORCE)
endif()
add_subdirectory(ixwebsocket)
endif()
1 change: 1 addition & 0 deletions externals/cppcodec
Submodule cppcodec added at 8019b8
1 change: 1 addition & 0 deletions externals/ixwebsocket
Submodule ixwebsocket added at 150e3d
1 change: 1 addition & 0 deletions src/common/logging/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
CLS(ImGui) \
CLS(Input) \
CLS(Tty) \
CLS(ShadNet) \
CLS(Loader)

// GetClassName is a macro defined by Windows.h, grrr...
Expand Down
1 change: 1 addition & 0 deletions src/common/logging/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ enum class Class : u8 {
Loader, ///< ROM loader
Input, ///< Input emulation
Tty, ///< Debug output from emu
ShadNet, ///< ShadNet
Count ///< Total number of logging classes
};

Expand Down
13 changes: 13 additions & 0 deletions src/core/libraries/np/np_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Libraries::Np::NpManager {
static bool g_signed_in = false;
static s32 g_active_requests = 0;
static std::mutex g_request_mutex;
OrbisNpTitleId g_np_title_id = {};

static std::map<std::string, std::function<void()>> g_np_callbacks;
static std::mutex g_np_callbacks_mutex;
Expand Down Expand Up @@ -686,6 +687,17 @@ sceNpGetUserIdByAccountId(u64 account_id, Libraries::UserService::OrbisUserServi
return ORBIS_OK;
}

s32 PS4_SYSV_ABI sceNpSetNpTitleId(OrbisNpTitleId* title_id, OrbisNpTitleSecret* title_secret) {
if (!title_id || !title_secret) {
return ORBIS_NP_ERROR_INVALID_ARGUMENT;
}
LOG_DEBUG(Lib_NpManager, "titleId = {}", title_id->id);

g_np_title_id = *title_id;

return ORBIS_OK;
}

s32 PS4_SYSV_ABI sceNpHasSignedUp(Libraries::UserService::OrbisUserServiceUserId user_id,
bool* has_signed_up) {
LOG_DEBUG(Lib_NpManager, "called");
Expand Down Expand Up @@ -825,6 +837,7 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("XDncXQIJUSk", "libSceNpManager", 1, "libSceNpManager", sceNpGetOnlineId);
LIB_FUNCTION("eQH7nWPcAgc", "libSceNpManager", 1, "libSceNpManager", sceNpGetState);
LIB_FUNCTION("VgYczPGB5ss", "libSceNpManager", 1, "libSceNpManager", sceNpGetUserIdByAccountId);
LIB_FUNCTION("Ec63y59l9tw", "libSceNpManager", 1, "libSceNpManager", sceNpSetNpTitleId);
LIB_FUNCTION("Oad3rvY-NJQ", "libSceNpManager", 1, "libSceNpManager", sceNpHasSignedUp);
LIB_FUNCTION("3Zl8BePTh9Y", "libSceNpManager", 1, "libSceNpManager", sceNpCheckCallback);
LIB_FUNCTION("JELHf4xPufo", "libSceNpManager", 1, "libSceNpManager", sceNpCheckCallbackForLib);
Expand Down
12 changes: 12 additions & 0 deletions src/core/libraries/np/np_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <functional>
#include <string>

#include "common/types.h"
#include "core/libraries/np/np_error.h"
Expand Down Expand Up @@ -90,6 +91,15 @@ struct OrbisNpCreateAsyncRequestParameter {
u8 padding[4];
};

struct OrbisNpTitleId {
char id[33];
u8 padding[3];
};

struct OrbisNpTitleSecret {
u8 data[128];
};

void RegisterNpCallback(std::string key, std::function<void()> cb);
void DeregisterNpCallback(std::string key);

Expand All @@ -98,5 +108,7 @@ s32 PS4_SYSV_ABI sceNpGetNpId(Libraries::UserService::OrbisUserServiceUserId use
s32 PS4_SYSV_ABI sceNpGetOnlineId(Libraries::UserService::OrbisUserServiceUserId user_id,
OrbisNpOnlineId* online_id);

extern OrbisNpTitleId g_np_title_id;

void RegisterLib(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Np::NpManager
Loading
Loading