From f1f5c91386e017f0a4fc1af4ba5ffeb2f575f0a9 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Wed, 4 Mar 2020 14:55:35 +0100 Subject: [PATCH] Fake PSN (#7516) --- rpcs3/Emu/CMakeLists.txt | 4 + rpcs3/Emu/Cell/Modules/cellNetCtl.cpp | 88 +- rpcs3/Emu/Cell/Modules/cellNetCtl.h | 5 - rpcs3/Emu/Cell/Modules/sceNp.cpp | 1179 ++++++++++++++++--------- rpcs3/Emu/Cell/Modules/sceNp.h | 35 +- rpcs3/Emu/Cell/Modules/sceNp2.cpp | 497 +++++++---- rpcs3/Emu/Cell/Modules/sceNp2.h | 190 ++-- rpcs3/Emu/Cell/Modules/sceNpSns.cpp | 9 +- rpcs3/Emu/Cell/lv2/sys_net.cpp | 155 +++- rpcs3/Emu/Cell/lv2/sys_net.h | 4 +- rpcs3/Emu/NP/np_handler.cpp | 405 +++++++++ rpcs3/Emu/NP/np_handler.h | 128 +++ rpcs3/Emu/system_config.h | 12 +- rpcs3/Emu/system_config_types.cpp | 31 + rpcs3/Emu/system_config_types.h | 12 + rpcs3/emucore.vcxproj | 2 + rpcs3/emucore.vcxproj.filters | 9 + rpcs3/rpcs3qt/emu_settings.cpp | 18 + rpcs3/rpcs3qt/emu_settings.h | 15 +- rpcs3/rpcs3qt/settings_dialog.cpp | 45 +- rpcs3/rpcs3qt/settings_dialog.ui | 137 ++- rpcs3/rpcs3qt/tooltips.h | 6 +- 22 files changed, 2198 insertions(+), 788 deletions(-) create mode 100644 rpcs3/Emu/NP/np_handler.cpp create mode 100644 rpcs3/Emu/NP/np_handler.h diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index 941553287d..42f09d4870 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -351,6 +351,10 @@ target_sources(rpcs3_emu PRIVATE Io/GHLtar.cpp ) +# Np +target_sources(rpcs3_emu PRIVATE + NP/np_handler.cpp +) # Memory target_sources(rpcs3_emu PRIVATE diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index e1442d8745..a52d8ccb04 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -2,12 +2,18 @@ #include "Emu/system_config.h" #include "Emu/Cell/PPUModule.h" #include "Emu/IdManager.h" +#include "Emu/Cell/lv2/sys_sync.h" #include "cellGame.h" #include "cellSysutil.h" #include "cellNetCtl.h" #include "Utilities/StrUtil.h" +#include "Emu/IdManager.h" + +#include "Emu/NP/np_handler.h" + +#include LOG_CHANNEL(cellNetCtl); @@ -90,14 +96,14 @@ error_code cellNetCtlInit() { cellNetCtl.warning("cellNetCtlInit()"); - auto net_ctl_manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (net_ctl_manager->is_initialized) + if (nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_TERMINATED; } - net_ctl_manager->is_initialized = true; + nph->is_netctl_init = true; return CELL_OK; } @@ -106,15 +112,17 @@ void cellNetCtlTerm() { cellNetCtl.warning("cellNetCtlTerm()"); - auto net_ctl_manager = g_fxo->get(); - net_ctl_manager->is_initialized = false; + const auto nph = g_fxo->get>(); + nph->is_netctl_init = false; } error_code cellNetCtlGetState(vm::ptr state) { cellNetCtl.trace("cellNetCtlGetState(state=*0x%x)", state); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -124,7 +132,8 @@ error_code cellNetCtlGetState(vm::ptr state) return CELL_NET_CTL_ERROR_INVALID_ADDR; } - *state = g_cfg.net.net_status; + *state = nph->get_net_status(); + return CELL_OK; } @@ -132,7 +141,9 @@ error_code cellNetCtlAddHandler(vm::ptr handler, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -149,7 +160,9 @@ error_code cellNetCtlDelHandler(s32 hid) { cellNetCtl.todo("cellNetCtlDelHandler(hid=0x%x)", hid); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -166,7 +179,9 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) { cellNetCtl.todo("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -183,7 +198,7 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) return CELL_OK; } - if (g_cfg.net.net_status == CELL_NET_CTL_STATE_Disconnected) + if (nph->get_net_status() == CELL_NET_CTL_STATE_Disconnected) { return CELL_NET_CTL_ERROR_NOT_CONNECTED; } @@ -198,15 +213,7 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) } else if (code == CELL_NET_CTL_INFO_IP_ADDRESS) { - if (g_cfg.net.net_status != CELL_NET_CTL_STATE_IPObtained) - { - // 0.0.0.0 seems to be the default address when no ethernet cables are connected to the PS3 - strcpy_trunc(info->ip_address, "0.0.0.0"); - } - else - { - strcpy_trunc(info->ip_address, g_cfg.net.ip_address); - } + strcpy_trunc(info->ip_address, nph->get_ip()); } else if (code == CELL_NET_CTL_INFO_NETMASK) { @@ -224,7 +231,9 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -244,10 +253,17 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptrinit("Delayed cellNetCtlNetStartDialogLoadAsync messages", []() + { + lv2_obj::wait_timeout(500000, nullptr); + + if (thread_ctrl::state() != thread_state::aborting) + { + sysutil_send_system_cmd(CELL_SYSUTIL_NET_CTL_NETSTART_LOADED, 0); + sysutil_send_system_cmd(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0); + } + }); return CELL_OK; } @@ -256,7 +272,9 @@ error_code cellNetCtlNetStartDialogAbortAsync() { cellNetCtl.error("cellNetCtlNetStartDialogAbortAsync()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -268,7 +286,9 @@ error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } @@ -283,15 +303,7 @@ error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptrresult = CELL_NET_CTL_ERROR_NET_NOT_CONNECTED; - } - else - { - // Hack - result->result = CELL_NET_CTL_ERROR_DIALOG_CANCELED; - } + result->result = nph->get_net_status() == CELL_NET_CTL_STATE_IPObtained ? 0 : CELL_NET_CTL_ERROR_DIALOG_CANCELED; sysutil_send_system_cmd(CELL_SYSUTIL_NET_CTL_NETSTART_UNLOADED, 0); @@ -302,7 +314,9 @@ error_code cellNetCtlGetNatInfo(vm::ptr natInfo) { cellNetCtl.warning("cellNetCtlGetNatInfo(natInfo=*0x%x)", natInfo); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_netctl_init) { return CELL_NET_CTL_ERROR_NOT_INITIALIZED; } diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.h b/rpcs3/Emu/Cell/Modules/cellNetCtl.h index 29b053a9a5..d9646f1b50 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.h +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.h @@ -352,8 +352,3 @@ struct CellGameUpdateParam using CellGameUpdateCallback = void(s32 status, s32 error_code, vm::ptr userdata); using CellGameUpdateCallbackEx = void(vm::ptr result, vm::ptr userdata); - -struct cell_net_ctl_manager -{ - atomic_t is_initialized = false; -}; diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index 8e83746795..5bd991fa92 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -11,6 +11,8 @@ #include "sceNp.h" #include "cellSysutil.h" +#include "Emu/NP/np_handler.h" + LOG_CHANNEL(sceNp); template<> @@ -376,15 +378,13 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } -s32 g_psn_connection_status = SCE_NP_MANAGER_STATUS_OFFLINE; - error_code sceNpInit(u32 poolsize, vm::ptr poolptr) { sceNp.warning("sceNpInit(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (manager->is_initialized) + if (nph->is_NP_init) { return SCE_NP_ERROR_ALREADY_INITIALIZED; } @@ -403,7 +403,8 @@ error_code sceNpInit(u32 poolsize, vm::ptr poolptr) return SCE_NP_ERROR_INVALID_ARGUMENT; } - manager->is_initialized = true; + nph->init_NP(poolsize, poolptr); + nph->is_NP_init = true; return CELL_OK; } @@ -412,14 +413,15 @@ error_code sceNpTerm() { sceNp.warning("sceNpTerm()"); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (!manager->is_initialized) + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - manager->is_initialized = false; + nph->terminate_NP(); + nph->is_NP_init = false; return CELL_OK; } @@ -473,7 +475,6 @@ error_code npDrmIsAvailable(vm::cptr k_licensee_addr, vm::cptr drm_pat sceNp.error(u8"npDrmIsAvailable(): Failed to verify sce file “%s”", enc_drm_path); return SCE_NP_DRM_ERROR_NO_ENTITLEMENT; } - } else if (magic == "NPD\0"_u32) { @@ -484,10 +485,10 @@ error_code npDrmIsAvailable(vm::cptr k_licensee_addr, vm::cptr drm_pat if (VerifyEDATHeaderWithKLicense(enc_file, enc_drm_path_local, k_licensee, &contentID)) { const std::string rap_file = rap_dir_path + contentID + ".rap"; - npdrmkeys->devKlic = std::move(k_licensee); + npdrmkeys->devKlic = std::move(k_licensee); if (fs::is_file(vfs::get(rap_file))) - npdrmkeys->rifKey = GetEdatRifKeyFromRapFile(fs::file{ vfs::get(rap_file) }); + npdrmkeys->rifKey = GetEdatRifKeyFromRapFile(fs::file{vfs::get(rap_file)}); else sceNp.warning(u8"npDrmIsAvailable(): Rap file not found: “%s”", rap_file.c_str()); } @@ -615,7 +616,9 @@ error_code sceNpBasicRegisterHandler(vm::cptr context, vm: { sceNp.todo("sceNpBasicRegisterHandler(context=*0x%x, handler=*0x%x, arg=*0x%x)", context, handler, arg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -632,7 +635,9 @@ error_code sceNpBasicRegisterContextSensitiveHandler(vm::cptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -649,7 +654,9 @@ error_code sceNpBasicUnregisterHandler() { sceNp.todo("sceNpBasicUnregisterHandler()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -661,7 +668,9 @@ error_code sceNpBasicSetPresence(vm::cptr data, u64 size) { sceNp.todo("sceNpBasicSetPresence(data=*0x%x, size=%d)", data, size); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -678,7 +687,9 @@ error_code sceNpBasicSetPresenceDetails(vm::cptr pres { sceNp.todo("sceNpBasicSetPresenceDetails(pres=*0x%x, options=0x%x)", pres, options); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -700,7 +711,9 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr pr { sceNp.todo("sceNpBasicSetPresenceDetails2(pres=*0x%x, options=0x%x)", pres, options); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -722,7 +735,9 @@ error_code sceNpBasicSendMessage(vm::cptr to, vm::cptr data, u64 { sceNp.todo("sceNpBasicSendMessage(to=*0x%x, data=*0x%x, size=%d)", to, data, size); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -744,7 +759,9 @@ error_code sceNpBasicSendMessageGui(vm::cptr msg, sys_ { sceNp.todo("sceNpBasicSendMessageGui(msg=*0x%x, containerId=%d)", msg, containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -759,7 +776,7 @@ error_code sceNpBasicSendMessageGui(vm::cptr msg, sys_ return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -771,7 +788,9 @@ error_code sceNpBasicSendMessageAttachment(vm::cptr to, vm::cptr { sceNp.todo("sceNpBasicSendMessageAttachment(to=*0x%x, subject=%s, body=%s, data=%s, size=%d, containerId=%d)", to, subject, body, data, size, containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -786,7 +805,7 @@ error_code sceNpBasicSendMessageAttachment(vm::cptr to, vm::cptr return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -798,7 +817,9 @@ error_code sceNpBasicRecvMessageAttachment(sys_memory_container_t containerId) { sceNp.todo("sceNpBasicRecvMessageAttachment(containerId=%d)", containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -810,7 +831,9 @@ error_code sceNpBasicRecvMessageAttachmentLoad(u32 id, vm::ptr buffer, vm: { sceNp.todo("sceNpBasicRecvMessageAttachmentLoad(id=%d, buffer=*0x%x, size=*0x%x)", id, buffer, size); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -832,7 +855,9 @@ error_code sceNpBasicRecvMessageCustom(u16 mainType, u32 recvOptions, sys_memory { sceNp.todo("sceNpBasicRecvMessageCustom(mainType=%d, recvOptions=%d, containerId=%d)", mainType, recvOptions, containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -849,7 +874,9 @@ error_code sceNpBasicMarkMessageAsUsed(SceNpBasicMessageId msgId) { sceNp.todo("sceNpBasicMarkMessageAsUsed(msgId=%d)", msgId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -866,7 +893,9 @@ error_code sceNpBasicAbortGui() { sceNp.todo("sceNpBasicAbortGui()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -878,7 +907,9 @@ error_code sceNpBasicAddFriend(vm::cptr contact, vm::cptr body, s { sceNp.todo("sceNpBasicAddFriend(contact=*0x%x, body=%s, containerId=%d)", contact, body, containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -893,7 +924,7 @@ error_code sceNpBasicAddFriend(vm::cptr contact, vm::cptr body, s return SCE_NP_BASIC_ERROR_EXCEEDS_MAX; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -905,7 +936,9 @@ error_code sceNpBasicGetFriendListEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetFriendListEntryCount(count=*0x%x)", count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -916,7 +949,7 @@ error_code sceNpBasicGetFriendListEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -931,7 +964,9 @@ error_code sceNpBasicGetFriendListEntry(u32 index, vm::ptr npid) { sceNp.todo("sceNpBasicGetFriendListEntry(index=%d, npid=*0x%x)", index, npid); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -943,7 +978,7 @@ error_code sceNpBasicGetFriendListEntry(u32 index, vm::ptr npid) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -955,7 +990,9 @@ error_code sceNpBasicGetFriendPresenceByIndex(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetFriendPresenceByIndex(index=%d, user=*0x%x, pres=*0x%x, options=%d)", index, user, pres, options); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -973,7 +1010,9 @@ error_code sceNpBasicGetFriendPresenceByIndex2(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetFriendPresenceByIndex2(index=%d, user=*0x%x, pres=*0x%x, options=%d)", index, user, pres, options); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -991,7 +1030,9 @@ error_code sceNpBasicGetFriendPresenceByNpId(vm::cptr npid, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1009,7 +1050,9 @@ error_code sceNpBasicGetFriendPresenceByNpId2(vm::cptr npid, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1027,7 +1070,9 @@ error_code sceNpBasicAddPlayersHistory(vm::cptr npid, vm::ptr des { sceNp.todo("sceNpBasicAddPlayersHistory(npid=*0x%x, description=*0x%x)", npid, description); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1049,7 +1094,9 @@ error_code sceNpBasicAddPlayersHistoryAsync(vm::cptr npids, u32 count, { sceNp.todo("sceNpBasicAddPlayersHistoryAsync(npids=*0x%x, count=%d, description=*0x%x, reqId=*0x%x)", npids, count, description, reqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1089,7 +1136,9 @@ error_code sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count { sceNp.todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count=*0x%x)", options, count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1100,7 +1149,7 @@ error_code sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr count } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1115,7 +1164,9 @@ error_code sceNpBasicGetPlayersHistoryEntry(u32 options, u32 index, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1127,7 +1178,7 @@ error_code sceNpBasicGetPlayersHistoryEntry(u32 options, u32 index, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1139,7 +1190,9 @@ error_code sceNpBasicAddBlockListEntry(vm::cptr npid) { sceNp.warning("sceNpBasicAddBlockListEntry(npid=*0x%x)", npid); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1149,7 +1202,7 @@ error_code sceNpBasicAddBlockListEntry(vm::cptr npid) return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED); } @@ -1161,7 +1214,9 @@ error_code sceNpBasicGetBlockListEntryCount(vm::ptr count) { sceNp.warning("sceNpBasicGetBlockListEntryCount(count=*0x%x)", count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1172,7 +1227,7 @@ error_code sceNpBasicGetBlockListEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1187,7 +1242,9 @@ error_code sceNpBasicGetBlockListEntry(u32 index, vm::ptr npid) { sceNp.todo("sceNpBasicGetBlockListEntry(index=%d, npid=*0x%x)", index, npid); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1199,7 +1256,7 @@ error_code sceNpBasicGetBlockListEntry(u32 index, vm::ptr npid) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1211,7 +1268,9 @@ error_code sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetMessageAttachmentEntryCount(count=*0x%x)", count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1222,7 +1281,7 @@ error_code sceNpBasicGetMessageAttachmentEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1237,7 +1296,9 @@ error_code sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr { sceNp.todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from=*0x%x)", index, from); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1249,7 +1310,7 @@ error_code sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1266,8 +1327,10 @@ error_code sceNpBasicGetCustomInvitationEntryCount(vm::ptr count) return SCE_NP_AUTH_EINVAL; } + const auto nph = g_fxo->get>(); + // TODO: Find the correct test which returns SCE_NP_AUTH_ESRCH - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_AUTH_ESRCH; } @@ -1288,8 +1351,10 @@ error_code sceNpBasicGetCustomInvitationEntry(u32 index, vm::ptr return SCE_NP_AUTH_EINVAL; } + const auto nph = g_fxo->get>(); + // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_AUTH_ESRCH; } @@ -1301,7 +1366,9 @@ error_code sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetMatchingInvitationEntryCount(count=*0x%x)", count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1312,7 +1379,7 @@ error_code sceNpBasicGetMatchingInvitationEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1327,7 +1394,9 @@ error_code sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1339,7 +1408,7 @@ error_code sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1351,7 +1420,9 @@ error_code sceNpBasicGetClanMessageEntryCount(vm::ptr count) { sceNp.todo("sceNpBasicGetClanMessageEntryCount(count=*0x%x)", count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1362,7 +1433,7 @@ error_code sceNpBasicGetClanMessageEntryCount(vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1377,7 +1448,9 @@ error_code sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) { sceNp.todo("sceNpBasicGetClanMessageEntry(index=%d, from=*0x%x)", index, from); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1389,7 +1462,7 @@ error_code sceNpBasicGetClanMessageEntry(u32 index, vm::ptr from) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1401,7 +1474,9 @@ error_code sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) { sceNp.todo("sceNpBasicGetMessageEntryCount(type=%d, count=*0x%x)", type, count); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1412,7 +1487,7 @@ error_code sceNpBasicGetMessageEntryCount(u32 type, vm::ptr count) } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1427,7 +1502,9 @@ error_code sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr { sceNp.todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from=*0x%x)", type, index, from); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1439,7 +1516,7 @@ error_code sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr } // TODO: Find the correct test which returns SCE_NP_ERROR_ID_NOT_FOUND - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_ID_NOT_FOUND; } @@ -1451,7 +1528,9 @@ error_code sceNpBasicGetEvent(vm::ptr event, vm::ptr from, v { sceNp.warning("sceNpBasicGetEvent(event=*0x%x, from=*0x%x, data=*0x%x, size=*0x%x)", event, from, data, size); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } @@ -1685,7 +1764,9 @@ error_code sceNpCustomMenuRegisterActions(vm::cptr menu, vm::pt { sceNp.todo("sceNpCustomMenuRegisterActions(menu=*0x%x, handler=*0x%x, userArg=*0x%x, options=0x%x)", menu, handler, userArg, options); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1702,7 +1783,9 @@ error_code sceNpCustomMenuActionSetActivation(vm::cptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1719,7 +1802,9 @@ error_code sceNpCustomMenuRegisterExceptionList(vm::cptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1742,7 +1827,9 @@ error_code sceNpFriendlist(vm::ptr resultHandler, { sceNp.warning("sceNpFriendlist(resultHandler=*0x%x, userArg=*0x%x, containerId=%d)", resultHandler, userArg, containerId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1759,7 +1846,9 @@ error_code sceNpFriendlistCustom(SceNpFriendlistCustomOptions options, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1776,7 +1865,9 @@ error_code sceNpFriendlistAbortGui() { sceNp.todo("sceNpFriendlistAbortGui()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED; } @@ -1788,19 +1879,19 @@ error_code sceNpLookupInit() { sceNp.todo("sceNpLookupInit()"); - const auto lookup_manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (lookup_manager->is_initialized) + if (nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; } - if (!g_fxo->get()->is_initialized) + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - lookup_manager->is_initialized = true; + nph->is_NP_Lookup_init = true; return CELL_OK; } @@ -1809,19 +1900,19 @@ error_code sceNpLookupTerm() { sceNp.todo("sceNpLookupTerm()"); - const auto lookup_manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (!lookup_manager->is_initialized) + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!g_fxo->get()->is_initialized) + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - lookup_manager->is_initialized = false; + nph->is_NP_Lookup_init = false; return CELL_OK; } @@ -1830,7 +1921,9 @@ error_code sceNpLookupCreateTitleCtx(vm::cptr communicatio { sceNp.todo("sceNpLookupCreateTitleCtx(communicationId=*0x%x, selfNpId=0x%x)", communicationId, selfNpId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1840,22 +1933,22 @@ error_code sceNpLookupCreateTitleCtx(vm::cptr communicatio return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT; } - return CELL_OK; + return not_an_error(nph->create_lookup_context(communicationId)); } -error_code sceNpLookupDestroyTitleCtx(vm::cptr communicationId, vm::cptr selfNpId) +error_code sceNpLookupDestroyTitleCtx(s32 titleCtxId) { - sceNp.todo("sceNpLookupDestroyTitleCtx(communicationId=*0x%x, selfNpId=0x%x)", communicationId, selfNpId); + sceNp.todo("sceNpLookupDestroyTitleCtx(titleCtxId=%d)", titleCtxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!communicationId || !selfNpId) - { - return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT; - } + if (!nph->destroy_lookup_context(titleCtxId)) + return SCE_NP_COMMUNITY_ERROR_INVALID_ID; return CELL_OK; } @@ -1864,12 +1957,14 @@ error_code sceNpLookupCreateTransactionCtx(s32 titleCtxId) { sceNp.todo("sceNpLookupCreateTransactionCtx(titleCtxId=%d)", titleCtxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -1881,7 +1976,9 @@ error_code sceNpLookupDestroyTransactionCtx(s32 transId) { sceNp.todo("sceNpLookupDestroyTransactionCtx(transId=%d)", transId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1893,7 +1990,9 @@ error_code sceNpLookupSetTimeout(s32 ctxId, usecond_t timeout) { sceNp.todo("sceNpLookupSetTimeout(ctxId=%d, timeout=%d)", ctxId, timeout); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1910,7 +2009,9 @@ error_code sceNpLookupAbortTransaction(s32 transId) { sceNp.todo("sceNpLookupAbortTransaction(transId=%d)", transId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1922,7 +2023,9 @@ error_code sceNpLookupWaitAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpLookupWaitAsync(transId=%d, result=%d)", transId, result); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1934,7 +2037,9 @@ error_code sceNpLookupPollAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpLookupPollAsync(transId=%d, result=%d)", transId, result); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1946,7 +2051,9 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr onlineId, vm::pt { sceNp.todo("sceNpLookupNpId(transId=%d, onlineId=*0x%x, npId=*0x%x, option=*0x%x)", transId, onlineId, npId, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1961,7 +2068,7 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr onlineId, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -1973,7 +2080,9 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr onlineId, vm { sceNp.todo("sceNpLookupNpIdAsync(transId=%d, onlineId=*0x%x, npId=*0x%x, prio=%d, option=*0x%x)", transId, onlineId, npId, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -1988,7 +2097,7 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr onlineId, vm return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -1996,11 +2105,15 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr onlineId, vm return CELL_OK; } -error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImage, vm::ptr option) +error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, vm::ptr languages, + vm::ptr countryCode, vm::ptr avatarImage, vm::ptr option) { - sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, option=*0x%x)", transId, npId, userInfo, aboutMe, languages, countryCode, avatarImage, option); + sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, option=*0x%x)", transId, npId, userInfo, aboutMe, + languages, countryCode, avatarImage, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2015,7 +2128,7 @@ error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptrget_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2023,13 +2136,15 @@ error_code sceNpLookupUserProfile(s32 transId, vm::cptr npId, vm::ptr npId, vm::ptr userInfo, vm::ptr aboutMe, - vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImage, s32 prio, vm::ptr option) +error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, vm::ptr languages, + vm::ptr countryCode, vm::ptr avatarImage, s32 prio, vm::ptr option) { - sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", - transId, npId, userInfo, aboutMe, languages, countryCode, avatarImage, prio, option); + sceNp.todo("sceNpLookupUserProfile(transId=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", transId, npId, userInfo, + aboutMe, languages, countryCode, avatarImage, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2044,7 +2159,7 @@ error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm:: return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2053,12 +2168,15 @@ error_code sceNpLookupUserProfileAsync(s32 transId, vm::cptr npId, vm:: } error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, - vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u64 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, vm::ptr option) + vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u64 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, vm::ptr option) { - sceNp.todo("sceNpLookupUserProfileWithAvatarSize(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, option=*0x%x)", - transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, option); + sceNp.todo("sceNpLookupUserProfileWithAvatarSize(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, " + "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, option=*0x%x)", + transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2073,7 +2191,7 @@ error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2082,12 +2200,16 @@ error_code sceNpLookupUserProfileWithAvatarSize(s32 transId, s32 avatarSizeType, } error_code sceNpLookupUserProfileWithAvatarSizeAsync(s32 transId, s32 avatarSizeType, vm::cptr npId, vm::ptr userInfo, vm::ptr aboutMe, - vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u64 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, s32 prio, vm::ptr option) + vm::ptr languages, vm::ptr countryCode, vm::ptr avatarImageData, u64 avatarImageDataMaxSize, vm::ptr avatarImageDataSize, s32 prio, + vm::ptr option) { - sceNp.todo("sceNpLookupUserProfileWithAvatarSizeAsync(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, prio=%d, option=*0x%x)", - transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, prio, option); + sceNp.todo("sceNpLookupUserProfileWithAvatarSizeAsync(transId=%d, avatarSizeType=%d, npId=*0x%x, userInfo=*0x%x, aboutMe=*0x%x, languages=*0x%x, countryCode=*0x%x, avatarImageData=*0x%x, " + "avatarImageDataMaxSize=%d, avatarImageDataSize=*0x%x, prio=%d, option=*0x%x)", + transId, avatarSizeType, npId, userInfo, aboutMe, languages, countryCode, avatarImageData, avatarImageDataMaxSize, avatarImageDataSize, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2102,7 +2224,7 @@ error_code sceNpLookupUserProfileWithAvatarSizeAsync(s32 transId, s32 avatarSize return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2114,7 +2236,9 @@ error_code sceNpLookupAvatarImage(s32 transId, vm::ptr avatarUrl { sceNp.todo("sceNpLookupAvatarImage(transId=%d, avatarUrl=*0x%x, avatarImage=*0x%x, option=*0x%x)", transId, avatarUrl, avatarImage, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2129,7 +2253,7 @@ error_code sceNpLookupAvatarImage(s32 transId, vm::ptr avatarUrl return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2141,7 +2265,9 @@ error_code sceNpLookupAvatarImageAsync(s32 transId, vm::ptr avat { sceNp.todo("sceNpLookupAvatarImageAsync(transId=%d, avatarUrl=*0x%x, avatarImage=*0x%x, prio=%d, option=*0x%x)", transId, avatarUrl, avatarImage, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2156,7 +2282,7 @@ error_code sceNpLookupAvatarImageAsync(s32 transId, vm::ptr avat return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2168,7 +2294,9 @@ error_code sceNpLookupTitleStorage() { UNIMPLEMENTED_FUNC(sceNp); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2180,7 +2308,9 @@ error_code sceNpLookupTitleStorageAsync() { UNIMPLEMENTED_FUNC(sceNp); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2192,7 +2322,9 @@ error_code sceNpLookupTitleSmallStorage(s32 transId, vm::ptr data, u64 max { sceNp.todo("sceNpLookupTitleSmallStorage(transId=%d, data=*0x%x, maxSize=%d, contentLength=*0x%x, option=*0x%x)", transId, data, maxSize, contentLength, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2212,7 +2344,7 @@ error_code sceNpLookupTitleSmallStorage(s32 transId, vm::ptr data, u64 max // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; //} - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2224,7 +2356,9 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u6 { sceNp.todo("sceNpLookupTitleSmallStorageAsync(transId=%d, data=*0x%x, maxSize=%d, contentLength=*0x%x, prio=%d, option=*0x%x)", transId, data, maxSize, contentLength, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Lookup_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -2239,12 +2373,12 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u6 return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - //if (something > maxSize) + // if (something > maxSize) //{ // return SCE_NP_COMMUNITY_ERROR_BODY_TOO_LARGE; //} - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -2254,9 +2388,11 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr data, u6 error_code sceNpManagerRegisterCallback(vm::ptr callback, vm::ptr arg) { - sceNp.todo("sceNpManagerRegisterCallback(callback=*0x%x, arg=*0x%x)", callback, arg); + sceNp.warning("sceNpManagerRegisterCallback(callback=*0x%x, arg=*0x%x)", callback, arg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2271,9 +2407,11 @@ error_code sceNpManagerRegisterCallback(vm::ptr callback, error_code sceNpManagerUnregisterCallback() { - sceNp.todo("sceNpManagerUnregisterCallback()"); + sceNp.warning("sceNpManagerUnregisterCallback()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2283,9 +2421,11 @@ error_code sceNpManagerUnregisterCallback() error_code sceNpManagerGetStatus(vm::ptr status) { - sceNp.warning("sceNpManagerGetStatus(status=*0x%x)", status); + sceNp.trace("sceNpManagerGetStatus(status=*0x%x)", status); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2295,7 +2435,7 @@ error_code sceNpManagerGetStatus(vm::ptr status) return SCE_NP_ERROR_INVALID_ARGUMENT; } - *status = g_psn_connection_status; + *status = nph->get_psn_status(); return CELL_OK; } @@ -2304,7 +2444,9 @@ error_code sceNpManagerGetNetworkTime(vm::ptr pTick) { sceNp.warning("sceNpManagerGetNetworkTime(pTick=*0x%x)", pTick); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2314,18 +2456,18 @@ error_code sceNpManagerGetNetworkTime(vm::ptr pTick) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } // FIXME: Get the network time - auto now = std::chrono::system_clock::now(); + auto now = std::chrono::system_clock::now(); pTick->tick = std::chrono::duration_cast(now.time_since_epoch()).count(); return CELL_OK; @@ -2335,7 +2477,9 @@ error_code sceNpManagerGetOnlineId(vm::ptr onlineId) { sceNp.todo("sceNpManagerGetOnlineId(onlineId=*0x%x)", onlineId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2345,16 +2489,18 @@ error_code sceNpManagerGetOnlineId(vm::ptr onlineId) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } + memcpy(onlineId.get_ptr(), &nph->get_online_id(), onlineId.size()); + return CELL_OK; } @@ -2362,7 +2508,9 @@ error_code sceNpManagerGetNpId(ppu_thread& ppu, vm::ptr npId) { sceNp.todo("sceNpManagerGetNpId(npId=*0x%x)", npId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2372,16 +2520,18 @@ error_code sceNpManagerGetNpId(ppu_thread& ppu, vm::ptr npId) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } + memcpy(npId.get_ptr(), &nph->get_npid(), npId.size()); + return CELL_OK; } @@ -2389,7 +2539,9 @@ error_code sceNpManagerGetOnlineName(vm::ptr onlineName) { sceNp.warning("sceNpManagerGetOnlineName(onlineName=*0x%x)", onlineName); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2399,16 +2551,18 @@ error_code sceNpManagerGetOnlineName(vm::ptr onlineName) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } + memcpy(onlineName.get_ptr(), &nph->get_online_name(), onlineName.size()); + return CELL_OK; } @@ -2416,7 +2570,9 @@ error_code sceNpManagerGetAvatarUrl(vm::ptr avatarUrl) { sceNp.warning("sceNpManagerGetAvatarUrl(avatarUrl=*0x%x)", avatarUrl); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2426,16 +2582,18 @@ error_code sceNpManagerGetAvatarUrl(vm::ptr avatarUrl) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } + memcpy(avatarUrl.get_ptr(), &nph->get_avatar_url(), avatarUrl.size()); + return CELL_OK; } @@ -2443,7 +2601,9 @@ error_code sceNpManagerGetMyLanguages(vm::ptr myLanguages) { sceNp.warning("sceNpManagerGetMyLanguages(myLanguages=*0x%x)", myLanguages); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2453,12 +2613,12 @@ error_code sceNpManagerGetMyLanguages(vm::ptr myLanguages) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2470,7 +2630,9 @@ error_code sceNpManagerGetAccountRegion(vm::ptr countryCode, v { sceNp.warning("sceNpManagerGetAccountRegion(countryCode=*0x%x, language=*0x%x)", countryCode, language); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2480,12 +2642,12 @@ error_code sceNpManagerGetAccountRegion(vm::ptr countryCode, v return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2497,7 +2659,9 @@ error_code sceNpManagerGetAccountAge(vm::ptr age) { sceNp.warning("sceNpManagerGetAccountAge(age=*0x%x)", age); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2507,12 +2671,12 @@ error_code sceNpManagerGetAccountAge(vm::ptr age) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2524,7 +2688,9 @@ error_code sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2534,28 +2700,30 @@ error_code sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptrget_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } // TODO: read user's parental control information *isRestricted = 0; - *age = 18; + *age = 18; return CELL_OK; } error_code sceNpManagerGetChatRestrictionFlag(vm::ptr isRestricted) { - sceNp.warning("sceNpManagerGetChatRestrictionFlag(isRestricted=*0x%x)", isRestricted); + sceNp.trace("sceNpManagerGetChatRestrictionFlag(isRestricted=*0x%x)", isRestricted); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2565,12 +2733,12 @@ error_code sceNpManagerGetChatRestrictionFlag(vm::ptr isRestricted) return SCE_NP_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2585,7 +2753,9 @@ error_code sceNpManagerGetCachedInfo(CellSysutilUserId userId, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2606,10 +2776,11 @@ error_code sceNpManagerGetPsHandle() error_code sceNpManagerRequestTicket(vm::cptr npId, vm::cptr serviceId, vm::cptr cookie, u32 cookieSize, vm::cptr entitlementId, u32 consumedCount) { - sceNp.todo("sceNpManagerRequestTicket(npId=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", - npId, serviceId, cookie, cookieSize, entitlementId, consumedCount); + sceNp.todo("sceNpManagerRequestTicket(npId=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", npId, serviceId, cookie, cookieSize, entitlementId, consumedCount); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2619,12 +2790,12 @@ error_code sceNpManagerRequestTicket(vm::cptr npId, vm::cptr serv return SCE_NP_AUTH_EINVALID_ARGUMENT; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2635,10 +2806,12 @@ error_code sceNpManagerRequestTicket(vm::cptr npId, vm::cptr serv error_code sceNpManagerRequestTicket2(vm::cptr npId, vm::cptr version, vm::cptr serviceId, vm::cptr cookie, u32 cookieSize, vm::cptr entitlementId, u32 consumedCount) { - sceNp.todo("sceNpManagerRequestTicket2(npId=*0x%x, version=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", - npId, version, serviceId, cookie, cookieSize, entitlementId, consumedCount); + sceNp.todo("sceNpManagerRequestTicket2(npId=*0x%x, version=*0x%x, serviceId=%s, cookie=*0x%x, cookieSize=%d, entitlementId=%s, consumedCount=%d)", npId, version, serviceId, cookie, cookieSize, + entitlementId, consumedCount); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2648,12 +2821,12 @@ error_code sceNpManagerRequestTicket2(vm::cptr npId, vm::cptrget_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_ERROR_OFFLINE); } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_LOGGING_IN && g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_LOGGING_IN && nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_ERROR_INVALID_STATE; } @@ -2665,7 +2838,9 @@ error_code sceNpManagerGetTicket(vm::ptr buffer, vm::ptr bufferSize) { sceNp.todo("sceNpManagerGetTicket(buffer=*0x%x, bufferSize=*0x%x)", buffer, bufferSize); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2682,7 +2857,9 @@ error_code sceNpManagerGetTicketParam(s32 paramId, vm::ptr par { sceNp.todo("sceNpManagerGetTicketParam(paramId=%d, param=*0x%x)", paramId, param); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2700,7 +2877,9 @@ error_code sceNpManagerGetEntitlementIdList(vm::ptr entIdLis { sceNp.todo("sceNpManagerGetEntitlementIdList(entIdList=*0x%x, entIdListNum=%d)", entIdList, entIdListNum); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2712,7 +2891,9 @@ error_code sceNpManagerGetEntitlementById(vm::cptr entId, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2735,7 +2916,9 @@ error_code sceNpManagerSubSignin(CellSysutilUserId userId, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2753,7 +2936,9 @@ error_code sceNpManagerSubSignout(vm::ptr npId) { sceNp.todo("sceNpManagerSubSignout(npId=*0x%x)", npId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2838,11 +3023,11 @@ error_code sceNpMatchingGetRoomMemberListLocal(u32 ctx_id, vm::ptr return CELL_OK; } -error_code sceNpMatchingGetRoomListLimitGUI(u32 ctx_id, vm::ptr communicationId, vm::ptr range, - vm::ptr cond, vm::ptr attr, vm::ptr handler, vm::ptr arg) +error_code sceNpMatchingGetRoomListLimitGUI(u32 ctx_id, vm::ptr communicationId, vm::ptr range, vm::ptr cond, + vm::ptr attr, vm::ptr handler, vm::ptr arg) { - sceNp.todo("sceNpMatchingGetRoomListLimitGUI(ctx_id=%d, communicationId=*0x%x, range=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", - ctx_id, communicationId, range, cond, attr, handler, arg); + sceNp.todo( + "sceNpMatchingGetRoomListLimitGUI(ctx_id=%d, communicationId=*0x%x, range=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, range, cond, attr, handler, arg); return CELL_OK; } @@ -2861,20 +3046,20 @@ error_code sceNpMatchingKickRoomMemberWithOpt(u32 ctx_id, vm::cptr return CELL_OK; } -error_code sceNpMatchingQuickMatchGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, - s32 available_num, s32 timeout, vm::ptr handler, vm::ptr arg) +error_code sceNpMatchingQuickMatchGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, s32 available_num, s32 timeout, + vm::ptr handler, vm::ptr arg) { - sceNp.todo("sceNpMatchingQuickMatchGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, available_num=%d, timeout=%d, handler=*0x%x, arg=*0x%x)", - ctx_id, communicationId, cond, available_num, timeout, handler, arg); + sceNp.todo("sceNpMatchingQuickMatchGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, available_num=%d, timeout=%d, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, cond, available_num, timeout, + handler, arg); return CELL_OK; } -error_code sceNpMatchingSendInvitationGUI(u32 ctx_id, vm::cptr room_id, vm::cptr communicationId, vm::cptr dsts, s32 num, - s32 slot_type, vm::cptr subject, vm::cptr body, sys_memory_container_t container, vm::ptr handler, vm::ptr arg) +error_code sceNpMatchingSendInvitationGUI(u32 ctx_id, vm::cptr room_id, vm::cptr communicationId, vm::cptr dsts, s32 num, s32 slot_type, + vm::cptr subject, vm::cptr body, sys_memory_container_t container, vm::ptr handler, vm::ptr arg) { - sceNp.todo("sceNpMatchingSendInvitationGUI(ctx_id=%d, room_id=*0x%x, communicationId=*0x%x, dsts=*0x%x, num=%d, slot_type=%d, subject=%s, body=%s, container=%d, handler=*0x%x, arg=*0x%x)", - ctx_id, room_id, communicationId, dsts, num, slot_type, subject, body, container, handler, arg); + sceNp.todo("sceNpMatchingSendInvitationGUI(ctx_id=%d, room_id=*0x%x, communicationId=*0x%x, dsts=*0x%x, num=%d, slot_type=%d, subject=%s, body=%s, container=%d, handler=*0x%x, arg=*0x%x)", ctx_id, + room_id, communicationId, dsts, num, slot_type, subject, body, container, handler, arg); return CELL_OK; } @@ -2906,11 +3091,10 @@ error_code sceNpMatchingLeaveRoom(u32 ctx_id, vm::cptr room_id, vm: return CELL_OK; } -error_code sceNpMatchingSearchJoinRoomGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, - vm::cptr attr, vm::ptr handler, vm::ptr arg) +error_code sceNpMatchingSearchJoinRoomGUI(u32 ctx_id, vm::cptr communicationId, vm::cptr cond, vm::cptr attr, + vm::ptr handler, vm::ptr arg) { - sceNp.todo("sceNpMatchingSearchJoinRoomGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", - ctx_id, communicationId, cond, attr, handler, arg); + sceNp.todo("sceNpMatchingSearchJoinRoomGUI(ctx_id=%d, communicationId=*0x%x, cond=*0x%x, attr=*0x%x, handler=*0x%x, arg=*0x%x)", ctx_id, communicationId, cond, attr, handler, arg); return CELL_OK; } @@ -2926,7 +3110,9 @@ error_code sceNpProfileCallGui(vm::cptr npid, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2943,7 +3129,9 @@ error_code sceNpProfileAbortGui() { sceNp.todo("sceNpProfileAbortGui()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } @@ -2955,19 +3143,19 @@ error_code sceNpScoreInit() { sceNp.warning("sceNpScoreInit()"); - const auto score_manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (score_manager->is_initialized) + if (nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED; } - if (!g_fxo->get()->is_initialized) + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - score_manager->is_initialized = true; + nph->is_NP_Score_init = true; return CELL_OK; } @@ -2976,19 +3164,19 @@ error_code sceNpScoreTerm() { sceNp.warning("sceNpScoreTerm()"); - const auto score_manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (!score_manager->is_initialized) + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (!g_fxo->get()->is_initialized) + if (!nph->is_NP_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - score_manager->is_initialized = false; + nph->is_NP_Score_init = false; return CELL_OK; } @@ -2997,7 +3185,9 @@ error_code sceNpScoreCreateTitleCtx(vm::cptr communication { sceNp.todo("sceNpScoreCreateTitleCtx(communicationId=*0x%x, passphrase=*0x%x, selfNpId=*0x%x)", communicationId, passphrase, selfNpId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3007,18 +3197,23 @@ error_code sceNpScoreCreateTitleCtx(vm::cptr communication return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT; } - return CELL_OK; + return not_an_error(nph->create_score_context(communicationId, passphrase)); } error_code sceNpScoreDestroyTitleCtx(s32 titleCtxId) { sceNp.todo("sceNpScoreDestroyTitleCtx(titleCtxId=%d)", titleCtxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } + if (!nph->destroy_score_context(titleCtxId)) + return SCE_NP_COMMUNITY_ERROR_INVALID_ID; + return CELL_OK; } @@ -3026,12 +3221,14 @@ error_code sceNpScoreCreateTransactionCtx(s32 titleCtxId) { sceNp.todo("sceNpScoreCreateTransactionCtx(titleCtxId=%d)", titleCtxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } - if (g_psn_connection_status == SCE_NP_MANAGER_STATUS_OFFLINE) + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3043,7 +3240,9 @@ error_code sceNpScoreDestroyTransactionCtx(s32 transId) { sceNp.todo("sceNpScoreDestroyTransactionCtx(transId=%d)", transId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3055,7 +3254,9 @@ error_code sceNpScoreSetTimeout(s32 ctxId, usecond_t timeout) { sceNp.todo("sceNpScoreSetTimeout(ctxId=%d, timeout=%d)", ctxId, timeout); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3072,7 +3273,9 @@ error_code sceNpScoreSetPlayerCharacterId(s32 ctxId, SceNpScorePcId pcId) { sceNp.todo("sceNpScoreSetPlayerCharacterId(ctxId=%d, pcId=%d)", ctxId, pcId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3089,7 +3292,9 @@ error_code sceNpScoreWaitAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpScoreWaitAsync(transId=%d, result=*0x%x)", transId, result); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3106,7 +3311,9 @@ error_code sceNpScorePollAsync(s32 transId, vm::ptr result) { sceNp.todo("sceNpScorePollAsync(transId=%d, result=*0x%x)", transId, result); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3123,7 +3330,9 @@ error_code sceNpScoreGetBoardInfo(s32 transId, SceNpScoreBoardId boardId, vm::pt { sceNp.todo("sceNpScoreGetBoardInfo(transId=%d, boardId=%d, boardInfo=*0x%x, option=*0x%x)", transId, boardId, boardInfo, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3138,7 +3347,7 @@ error_code sceNpScoreGetBoardInfo(s32 transId, SceNpScoreBoardId boardId, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3150,7 +3359,9 @@ error_code sceNpScoreGetBoardInfoAsync(s32 transId, SceNpScoreBoardId boardId, v { sceNp.todo("sceNpScoreGetBoardInfo(transId=%d, boardId=%d, boardInfo=*0x%x, prio=%d, option=*0x%x)", transId, boardId, boardInfo, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3163,13 +3374,15 @@ error_code sceNpScoreGetBoardInfoAsync(s32 transId, SceNpScoreBoardId boardId, v return CELL_OK; } -error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, - vm::cptr gameInfo, vm::ptr tmpRank, vm::ptr option) +error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, vm::cptr gameInfo, + vm::ptr tmpRank, vm::ptr option) { - sceNp.todo("sceNpScoreRecordScore(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, option=*0x%x)", - transId, boardId, score, scoreComment, gameInfo, tmpRank, option); + sceNp.todo( + "sceNpScoreRecordScore(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, tmpRank, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3179,7 +3392,7 @@ error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpSc return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3187,13 +3400,15 @@ error_code sceNpScoreRecordScore(s32 transId, SceNpScoreBoardId boardId, SceNpSc return CELL_OK; } -error_code sceNpScoreRecordScoreAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, - vm::cptr gameInfo, vm::ptr tmpRank, s32 prio, vm::ptr option) +error_code sceNpScoreRecordScoreAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, vm::cptr scoreComment, vm::cptr gameInfo, + vm::ptr tmpRank, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreRecordScoreAsync(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, score, scoreComment, gameInfo, tmpRank, prio, option); + sceNp.todo("sceNpScoreRecordScoreAsync(transId=%d, boardId=%d, score=%d, scoreComment=*0x%x, gameInfo=*0x%x, tmpRank=*0x%x, prio=%d, option=*0x%x)", transId, boardId, score, scoreComment, gameInfo, + tmpRank, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3208,10 +3423,11 @@ error_code sceNpScoreRecordScoreAsync(s32 transId, SceNpScoreBoardId boardId, Sc error_code sceNpScoreRecordGameData(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, u64 totalSize, u64 sendSize, vm::cptr data, vm::ptr option) { - sceNp.todo("sceNpScoreRecordGameData(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, option=*0x%x)", - transId, boardId, score, totalSize, sendSize, data, option); + sceNp.todo("sceNpScoreRecordGameData(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, score, totalSize, sendSize, data, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3226,7 +3442,7 @@ error_code sceNpScoreRecordGameData(s32 transId, SceNpScoreBoardId boardId, SceN return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3236,10 +3452,12 @@ error_code sceNpScoreRecordGameData(s32 transId, SceNpScoreBoardId boardId, SceN error_code sceNpScoreRecordGameDataAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreValue score, u64 totalSize, u64 sendSize, vm::cptr data, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreRecordGameDataAsync(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, score, totalSize, sendSize, data, prio, option); + sceNp.todo( + "sceNpScoreRecordGameDataAsync(transId=%d, boardId=%d, score=%d, totalSize=%d, sendSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, score, totalSize, sendSize, data, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3254,10 +3472,11 @@ error_code sceNpScoreRecordGameDataAsync(s32 transId, SceNpScoreBoardId boardId, error_code sceNpScoreGetGameData(s32 transId, SceNpScoreBoardId boardId, vm::cptr npId, vm::ptr totalSize, u64 recvSize, vm::ptr data, vm::ptr option) { - sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", - transId, boardId, npId, totalSize, recvSize, data, option); + sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, npId, totalSize, recvSize, data, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3272,7 +3491,7 @@ error_code sceNpScoreGetGameData(s32 transId, SceNpScoreBoardId boardId, vm::cpt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3282,10 +3501,12 @@ error_code sceNpScoreGetGameData(s32 transId, SceNpScoreBoardId boardId, vm::cpt error_code sceNpScoreGetGameDataAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr npId, vm::ptr totalSize, u64 recvSize, vm::ptr data, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, npId, totalSize, recvSize, data, prio, option); + sceNp.todo("sceNpScoreGetGameDataAsync(transId=%d, boardId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, npId, totalSize, recvSize, data, prio, + option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3298,14 +3519,17 @@ error_code sceNpScoreGetGameDataAsync(s32 transId, SceNpScoreBoardId boardId, vm return CELL_OK; } -error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u64 npIdArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u64 npIdArraySize, vm::ptr rankArray, u64 rankArraySize, + vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByNpId(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetRankingByNpId(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3325,7 +3549,7 @@ error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3333,14 +3557,17 @@ error_code sceNpScoreGetRankingByNpId(s32 transId, SceNpScoreBoardId boardId, vm return CELL_OK; } -error_code sceNpScoreGetRankingByNpIdAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u64 npIdArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetRankingByNpIdAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr npIdArray, u64 npIdArraySize, vm::ptr rankArray, u64 rankArraySize, + vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByNpIdAsync(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetRankingByNpIdAsync(transId=%d, boardId=%d, npIdArray=*0x%x, npIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, npIdArray, npIdArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3358,14 +3585,17 @@ error_code sceNpScoreGetRankingByNpIdAsync(s32 transId, SceNpScoreBoardId boardI return CELL_OK; } -error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u64 rankArraySize, + vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByRange(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetRankingByRange(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3385,7 +3615,7 @@ error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, S return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3393,14 +3623,17 @@ error_code sceNpScoreGetRankingByRange(s32 transId, SceNpScoreBoardId boardId, S return CELL_OK; } -error_code sceNpScoreGetRankingByRangeAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetRankingByRangeAsync(s32 transId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u64 rankArraySize, + vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByRangeAsync(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetRankingByRangeAsync(transId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3418,14 +3651,16 @@ error_code sceNpScoreGetRankingByRangeAsync(s32 transId, SceNpScoreBoardId board return CELL_OK; } -error_code sceNpScoreGetFriendsRanking(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u64 rankArraySize, - vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetFriendsRanking(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, + u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetFriendsRanking(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetFriendsRanking(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3443,14 +3678,17 @@ error_code sceNpScoreGetFriendsRanking(s32 transId, SceNpScoreBoardId boardId, s return CELL_OK; } -error_code sceNpScoreGetFriendsRankingAsync(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u64 rankArraySize, - vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetFriendsRankingAsync(s32 transId, SceNpScoreBoardId boardId, s32 includeSelf, vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, + u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, + vm::ptr option) { - sceNp.todo("sceNpScoreGetFriendsRankingAsync(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetFriendsRankingAsync(transId=%d, boardId=%d, includeSelf=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, " + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, includeSelf, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3472,7 +3710,9 @@ error_code sceNpScoreCensorComment(s32 transId, vm::cptr comment, vm::ptr< { sceNp.todo("sceNpScoreCensorComment(transId=%d, comment=%s, option=*0x%x)", transId, comment, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3488,7 +3728,7 @@ error_code sceNpScoreCensorComment(s32 transId, vm::cptr comment, vm::ptr< return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3500,7 +3740,9 @@ error_code sceNpScoreCensorCommentAsync(s32 transId, vm::cptr comment, s32 { sceNp.todo("sceNpScoreCensorCommentAsync(transId=%d, comment=%s, prio=%d, option=*0x%x)", transId, comment, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3523,7 +3765,9 @@ error_code sceNpScoreSanitizeComment(s32 transId, vm::cptr comment, vm::pt { sceNp.todo("sceNpScoreSanitizeComment(transId=%d, comment=%s, sanitizedComment=*0x%x, option=*0x%x)", transId, comment, sanitizedComment, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3539,7 +3783,7 @@ error_code sceNpScoreSanitizeComment(s32 transId, vm::cptr comment, vm::pt return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3551,7 +3795,9 @@ error_code sceNpScoreSanitizeCommentAsync(s32 transId, vm::cptr comment, v { sceNp.todo("sceNpScoreSanitizeCommentAsync(transId=%d, comment=%s, sanitizedComment=*0x%x, prio=%d, option=*0x%x)", transId, comment, sanitizedComment, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3570,14 +3816,17 @@ error_code sceNpScoreSanitizeCommentAsync(s32 transId, vm::cptr comment, v return CELL_OK; } -error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, u64 rankArraySize, + vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByNpIdPcId(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetRankingByNpIdPcId(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3597,7 +3846,7 @@ error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3606,13 +3855,16 @@ error_code sceNpScoreGetRankingByNpIdPcId(s32 transId, SceNpScoreBoardId boardId } error_code sceNpScoreGetRankingByNpIdPcIdAsync(s32 transId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) + u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetRankingByNpIdPcIdAsync(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetRankingByNpIdPcIdAsync(transId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, " + "infoArraySize=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3634,7 +3886,9 @@ error_code sceNpScoreAbortTransaction(s32 transId) { sceNp.todo("sceNpScoreAbortTransaction(transId=%d)", transId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3643,14 +3897,17 @@ error_code sceNpScoreAbortTransaction(s32 transId) } error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) + u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, vm::ptr descriptArray, + u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByNpId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetClansMembersRankingByNpId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3670,7 +3927,7 @@ error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanI return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3678,15 +3935,19 @@ error_code sceNpScoreGetClansMembersRankingByNpId(s32 transId, SceNpClanId clanI return CELL_OK; } -error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, + vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, + vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3704,15 +3965,19 @@ error_code sceNpScoreGetClansMembersRankingByNpIdAsync(s32 transId, SceNpClanId return CELL_OK; } -error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, + vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, + vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdPcId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdPcId(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3732,7 +3997,7 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId c return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3740,15 +4005,20 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcId(s32 transId, SceNpClanId c return CELL_OK; } -error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, vm::ptr rankArray, - u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, - vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, - vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, vm::cptr idArray, u64 idArraySize, + vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, + vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); + sceNp.todo( + "sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(transId=%d, clanId=%d, boardId=%d, idArray=*0x%x, idArraySize=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, idArray, idArraySize, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, + lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3766,14 +4036,17 @@ error_code sceNpScoreGetClansMembersRankingByNpIdPcIdAsync(s32 transId, SceNpCla return CELL_OK; } -error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u64 rankArraySize, + vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, + vm::ptr option) { - sceNp.todo("sceNpScoreGetClansRankingByRange(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetClansRankingByRange(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, " + "arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3793,7 +4066,7 @@ error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3801,14 +4074,17 @@ error_code sceNpScoreGetClansRankingByRange(s32 transId, SceNpScoreClansBoardId return CELL_OK; } -error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, - u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, u64 rankArraySize, + vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, + vm::ptr option) { - sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, " + "reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanBoardId, startSerialRank, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3826,13 +4102,15 @@ error_code sceNpScoreGetClansRankingByRangeAsync(s32 transId, SceNpScoreClansBoa return CELL_OK; } -error_code sceNpScoreGetClanMemberGameData(s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, - vm::ptr totalSize, u64 recvSize, vm::ptr data, vm::ptr option) +error_code sceNpScoreGetClanMemberGameData( + s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u64 recvSize, vm::ptr data, vm::ptr option) { - sceNp.todo("sceNpScoreGetClanMemberGameData(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", - transId, boardId, clanId, npId, totalSize, recvSize, data, option); + sceNp.todo("sceNpScoreGetClanMemberGameData(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, option=*0x%x)", transId, boardId, clanId, npId, totalSize, + recvSize, data, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3847,7 +4125,7 @@ error_code sceNpScoreGetClanMemberGameData(s32 transId, SceNpScoreBoardId boardI return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3855,13 +4133,15 @@ error_code sceNpScoreGetClanMemberGameData(s32 transId, SceNpScoreBoardId boardI return CELL_OK; } -error_code sceNpScoreGetClanMemberGameDataAsync(s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, - vm::ptr totalSize, u64 recvSize, vm::ptr data, s32 prio, vm::ptr option) +error_code sceNpScoreGetClanMemberGameDataAsync( + s32 transId, SceNpScoreBoardId boardId, SceNpClanId clanId, vm::cptr npId, vm::ptr totalSize, u64 recvSize, vm::ptr data, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetClanMemberGameDataAsync(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", - transId, boardId, clanId, npId, totalSize, recvSize, data, prio, option); + sceNp.todo("sceNpScoreGetClanMemberGameDataAsync(transId=%d, boardId=%d, clanId=%d, npId=*0x%x, totalSize=*0x%x, recvSize=%d, data=*0x%x, prio=%d, option=*0x%x)", transId, boardId, clanId, npId, + totalSize, recvSize, data, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3874,14 +4154,17 @@ error_code sceNpScoreGetClanMemberGameDataAsync(s32 transId, SceNpScoreBoardId b return CELL_OK; } -error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u64 clanIdArraySize, - vm::ptr rankArray, u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u64 clanIdArraySize, vm::ptr rankArray, + u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansRankingByClanId(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetClansRankingByClanId(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, " + "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3901,7 +4184,7 @@ error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId return SCE_NP_COMMUNITY_ERROR_TOO_MANY_NPID; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3909,14 +4192,17 @@ error_code sceNpScoreGetClansRankingByClanId(s32 transId, SceNpScoreClansBoardId return CELL_OK; } -error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u64 clanIdArraySize, - vm::ptr rankArray, u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, - vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBoardId clanBoardId, vm::cptr clanIdArray, u64 clanIdArraySize, vm::ptr rankArray, + u64 rankArraySize, vm::ptr reserved1, u64 reservedSize1, vm::ptr reserved2, u64 reservedSize2, u64 arrayNum, vm::ptr lastSortDate, + vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetClansRankingByRangeAsync(transId=%d, clanBoardId=%d, clanIdArray=*0x%x, clanIdArraySize=%d, rankArray=*0x%x, rankArraySize=%d, reserved1=*0x%x, reservedSize1=%d, " + "reserved2=*0x%x, reservedSize2=%d, arrayNum=%d, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanBoardId, clanIdArray, clanIdArraySize, rankArray, rankArraySize, reserved1, reservedSize1, reserved2, reservedSize2, arrayNum, lastSortDate, totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3934,15 +4220,18 @@ error_code sceNpScoreGetClansRankingByClanIdAsync(s32 transId, SceNpScoreClansBo return CELL_OK; } -error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, - vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, - u64 infoArraySize, vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, - vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) +error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, + u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, vm::ptr descriptArray, + u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByRange(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", - transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, option); + sceNp.todo("sceNpScoreGetClansMembersRankingByRange(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, option=*0x%x)", + transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, + totalRecord, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -3962,7 +4251,7 @@ error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clan return SCE_NP_COMMUNITY_ERROR_TOO_LARGE_RANGE; } - if (g_psn_connection_status != SCE_NP_MANAGER_STATUS_ONLINE) + if (nph->get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE) { return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; } @@ -3970,15 +4259,18 @@ error_code sceNpScoreGetClansMembersRankingByRange(s32 transId, SceNpClanId clan return CELL_OK; } -error_code sceNpScoreGetClansMembersRankingByRangeAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, - vm::ptr rankArray, u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, - u64 infoArraySize, vm::ptr descriptArray, u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, - vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) +error_code sceNpScoreGetClansMembersRankingByRangeAsync(s32 transId, SceNpClanId clanId, SceNpScoreBoardId boardId, SceNpScoreRankNumber startSerialRank, vm::ptr rankArray, + u64 rankArraySize, vm::ptr commentArray, u64 commentArraySize, vm::ptr infoArray, u64 infoArraySize, vm::ptr descriptArray, + u64 descriptArraySize, u64 arrayNum, vm::ptr clanInfo, vm::ptr lastSortDate, vm::ptr totalRecord, s32 prio, vm::ptr option) { - sceNp.todo("sceNpScoreGetClansMembersRankingByRangeAsync(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", - transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, totalRecord, prio, option); + sceNp.todo("sceNpScoreGetClansMembersRankingByRangeAsync(transId=%d, clanId=%d, boardId=%d, startSerialRank=%d, rankArray=*0x%x, rankArraySize=%d, commentArray=*0x%x, commentArraySize=%d, " + "infoArray=*0x%x, infoArraySize=%d, descriptArray=*0x%x, descriptArraySize=%d, arrayNum=%d, clanInfo=*0x%x, lastSortDate=*0x%x, totalRecord=*0x%x, prio=%d, option=*0x%x)", + transId, clanId, boardId, startSerialRank, rankArray, rankArraySize, commentArray, commentArraySize, infoArray, infoArraySize, descriptArray, descriptArraySize, arrayNum, clanInfo, lastSortDate, + totalRecord, prio, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Score_init) { return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED; } @@ -4000,7 +4292,9 @@ error_code sceNpSignalingCreateCtx(vm::ptr npId, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4010,7 +4304,7 @@ error_code sceNpSignalingCreateCtx(vm::ptr npId, vm::ptr SCE_NP_SIGNALING_CTX_MAX) + // if (current_contexts > SCE_NP_SIGNALING_CTX_MAX) //{ // return SCE_NP_SIGNALING_ERROR_CTX_MAX; //} @@ -4022,7 +4316,9 @@ error_code sceNpSignalingDestroyCtx(u32 ctx_id) { sceNp.todo("sceNpSignalingDestroyCtx(ctx_id=%d)", ctx_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4034,7 +4330,9 @@ error_code sceNpSignalingAddExtendedHandler(u32 ctx_id, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4046,7 +4344,9 @@ error_code sceNpSignalingSetCtxOpt(u32 ctx_id, s32 optname, s32 optval) { sceNp.todo("sceNpSignalingSetCtxOpt(ctx_id=%d, optname=%d, optval=%d)", ctx_id, optname, optval); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4063,7 +4363,9 @@ error_code sceNpSignalingGetCtxOpt(u32 ctx_id, s32 optname, vm::ptr optval) { sceNp.todo("sceNpSignalingGetCtxOpt(ctx_id=%d, optname=%d, optval=*0x%x)", ctx_id, optname, optval); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4080,7 +4382,9 @@ error_code sceNpSignalingActivateConnection(u32 ctx_id, vm::ptr npId, u { sceNp.todo("sceNpSignalingActivateConnection(ctx_id=%d, npId=*0x%x, conn_id=%d)", ctx_id, npId, conn_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4097,7 +4401,9 @@ error_code sceNpSignalingDeactivateConnection(u32 ctx_id, u32 conn_id) { sceNp.todo("sceNpSignalingDeactivateConnection(ctx_id=%d, conn_id=%d)", ctx_id, conn_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4109,7 +4415,9 @@ error_code sceNpSignalingTerminateConnection(u32 ctx_id, u32 conn_id) { sceNp.todo("sceNpSignalingTerminateConnection(ctx_id=%d, conn_id=%d)", ctx_id, conn_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4117,11 +4425,13 @@ error_code sceNpSignalingTerminateConnection(u32 ctx_id, u32 conn_id) return CELL_OK; } -error_code sceNpSignalingGetConnectionStatus(u32 ctx_id, u32 conn_id, vm::ptr conn_status, vm::ptr peer_addr, vm::ptr peer_port) +error_code sceNpSignalingGetConnectionStatus(u32 ctx_id, u32 conn_id, vm::ptr conn_status, vm::ptr peer_addr, vm::ptr peer_port) { sceNp.todo("sceNpSignalingGetConnectionStatus(ctx_id=%d, conn_id=%d, conn_status=*0x%x, peer_addr=*0x%x, peer_port=*0x%x)", ctx_id, conn_id, conn_status, peer_addr, peer_port); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4138,7 +4448,9 @@ error_code sceNpSignalingGetConnectionInfo(u32 ctx_id, u32 conn_id, s32 code, vm { sceNp.todo("sceNpSignalingGetConnectionInfo(ctx_id=%d, conn_id=%d, code=%d, info=*0x%x)", ctx_id, conn_id, code, info); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4155,7 +4467,9 @@ error_code sceNpSignalingGetConnectionFromNpId(u32 ctx_id, vm::ptr npId { sceNp.todo("sceNpSignalingGetConnectionFromNpId(ctx_id=%d, npId=*0x%x, conn_id=*0x%x)", ctx_id, npId, conn_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4168,11 +4482,13 @@ error_code sceNpSignalingGetConnectionFromNpId(u32 ctx_id, vm::ptr npId return CELL_OK; } -error_code sceNpSignalingGetConnectionFromPeerAddress(u32 ctx_id, vm::ptr peer_addr, in_port_t peer_port, vm::ptr conn_id) +error_code sceNpSignalingGetConnectionFromPeerAddress(u32 ctx_id, vm::ptr peer_addr, np_in_port_t peer_port, vm::ptr conn_id) { sceNp.todo("sceNpSignalingGetConnectionFromPeerAddress(ctx_id=%d, peer_addr=*0x%x, peer_port=%d, conn_id=*0x%x)", ctx_id, peer_addr, peer_port, conn_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4189,7 +4505,9 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4207,7 +4525,9 @@ error_code sceNpSignalingGetPeerNetInfo(u32 ctx_id, vm::ptr npId, vm::p { sceNp.todo("sceNpSignalingGetPeerNetInfo(ctx_id=%d, npId=*0x%x, req_id=*0x%x)", ctx_id, npId, req_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4224,7 +4544,9 @@ error_code sceNpSignalingCancelPeerNetInfo(u32 ctx_id, u32 req_id) { sceNp.todo("sceNpSignalingCancelPeerNetInfo(ctx_id=%d, req_id=%d)", ctx_id, req_id); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4236,7 +4558,9 @@ error_code sceNpSignalingGetPeerNetInfoResult(u32 ctx_id, u32 req_id, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_init) { return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED; } @@ -4264,7 +4588,7 @@ error_code sceNpUtilCanonicalizeNpIdForPsp() error_code sceNpUtilCmpNpId(vm::ptr id1, vm::ptr id2) { - sceNp.warning("sceNpUtilCmpNpId(id1=*0x%x, id2=*0x%x)", id1, id2); + sceNp.warning("sceNpUtilCmpNpId(id1=*0x%x(%s), id2=*0x%x(%s))", id1, id1->handle.data, id2, id2->handle.data); if (!id1 || !id2) { @@ -4272,24 +4596,24 @@ error_code sceNpUtilCmpNpId(vm::ptr id1, vm::ptr id2) } // Unknown what this constant means - if (id1->reserved[0] != 1 || id2->reserved[0] != 1) - { - return SCE_NP_UTIL_ERROR_INVALID_NP_ID; - } + // if (id1->reserved[0] != 1 || id2->reserved[0] != 1) + // { + // return SCE_NP_UTIL_ERROR_INVALID_NP_ID; + // } - if (strncmp(id1->handle.data, id2->handle.data, 16) || id1->unk1[0] != id2->unk1[0]) + if (strcmp(id1->handle.data, id2->handle.data))// || id1->unk1[0] != id2->unk1[0]) { return SCE_NP_UTIL_ERROR_NOT_MATCH; } - if (id1->unk1[1] != id2->unk1[1]) - { - // If either is zero they match - if (id1->opt[4] && id2->opt[4]) - { - return SCE_NP_UTIL_ERROR_NOT_MATCH; - } - } + // if (id1->unk1[1] != id2->unk1[1]) + // { + // // If either is zero they match + // if (id1->opt[4] && id2->opt[4]) + // { + // return SCE_NP_UTIL_ERROR_NOT_MATCH; + // } + // } return CELL_OK; } @@ -4481,9 +4805,8 @@ s32 _Z32_sce_np_sysutil_cxml_prepare_docPN16sysutil_cxmlutil11FixedMemoryERN4cxm return CELL_OK; } - -DECLARE(ppu_module_manager::sceNp)("sceNp", []() -{ +DECLARE(ppu_module_manager::sceNp) +("sceNp", []() { REG_FUNC(sceNp, sceNpInit); REG_FUNC(sceNp, sceNpTerm); REG_FUNC(sceNp, sceNpDrmIsAvailable); diff --git a/rpcs3/Emu/Cell/Modules/sceNp.h b/rpcs3/Emu/Cell/Modules/sceNp.h index bbc75b0b31..f1900f9c88 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.h +++ b/rpcs3/Emu/Cell/Modules/sceNp.h @@ -9,14 +9,14 @@ error_code sceNpInit(u32 poolsize, vm::ptr poolptr); error_code sceNpTerm(); -using in_addr_t = u32; -using in_port_t = u16; -using sa_family_t = u8; -using socklen_t = u32; +using np_in_addr_t = u32; +using np_in_port_t = u16; +using np_sa_family_t = u8; +using np_socklen_t = u32; -struct in_addr +struct np_in_addr { - in_addr_t s_addr; // TODO: alignment? + np_in_addr_t np_s_addr; // TODO: alignment? }; using sys_memory_container_t = u32; @@ -1121,8 +1121,8 @@ union SceNpSignalingConnectionInfo SceNpId npId; struct { - be_t addr; // in_addr - be_t port; // in_port_t + np_in_addr addr; // in_addr + np_in_port_t port; // in_port_t } address; be_t packet_loss; }; @@ -1298,22 +1298,3 @@ using SceNpMatchingGUIHandler = void(u32 ctx_id, s32 event, s32 error_code, vm:: using SceNpProfileResultHandler = s32(s32 result, vm::ptr arg); using SceNpManagerSubSigninCallback = void(s32 result, vm::ptr npId, vm::ptr cb_arg); - -// fxm objects - -struct sce_np_manager -{ - std::atomic is_initialized = false; -}; - -struct sce_np_lookup_manager -{ - std::atomic is_initialized = false; -}; - -struct sce_np_score_manager -{ - std::atomic is_initialized = false; -}; - -extern s32 g_psn_connection_status; diff --git a/rpcs3/Emu/Cell/Modules/sceNp2.cpp b/rpcs3/Emu/Cell/Modules/sceNp2.cpp index 086d25bab0..f9e3061723 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp2.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp2.cpp @@ -4,14 +4,15 @@ #include "sceNp.h" #include "sceNp2.h" +#include "Emu/NP/np_handler.h" +#include "cellSysutil.h" LOG_CHANNEL(sceNp2); -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { - format_enum(out, arg, [](auto error) - { + format_enum(out, arg, [](auto error) { switch (error) { STR_CASE(SCE_NP_MATCHING2_ERROR_OUT_OF_MEMORY); @@ -132,11 +133,10 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } -template<> +template <> void fmt_class_string::format(std::string& out, u64 arg) { - format_enum(out, arg, [](auto error) - { + format_enum(out, arg, [](auto error) { switch (error) { STR_CASE(SCE_NP_OAUTH_ERROR_UNKNOWN); @@ -181,9 +181,9 @@ error_code sceNp2Init(u32 poolsize, vm::ptr poolptr) { sceNp2.warning("sceNp2Init(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (manager->is_initialized) + if (nph->is_NP2_init) { return SCE_NP_ERROR_ALREADY_INITIALIZED; } @@ -195,7 +195,7 @@ error_code sceNp2Init(u32 poolsize, vm::ptr poolptr) return result; } - manager->is_initialized = true; + nph->is_NP2_init = true; return CELL_OK; } @@ -210,14 +210,14 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - const auto matching_2_manager = g_fxo->get(); - - if (matching_2_manager->is_initialized) + if (nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED; } @@ -227,7 +227,7 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptris_initialized = true; + nph->is_NP2_Match2_init = true; return CELL_OK; } @@ -236,19 +236,19 @@ error_code sceNp2Term(ppu_thread& ppu) { sceNp2.warning("sceNp2Term()"); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (!manager->is_initialized) + if (!nph->is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } // TODO: does this return on error_code ? sceNpMatching2Term(ppu); - //cellSysutilUnregisterCallbackDispatcher(); + // cellSysutilUnregisterCallbackDispatcher(); sceNpTerm(); - manager->is_initialized = false; + nph->is_NP2_init = false; return CELL_OK; } @@ -263,21 +263,21 @@ error_code sceNpMatching2Term2() { sceNp2.warning("sceNpMatching2Term2()"); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_init) { return SCE_NP_ERROR_NOT_INITIALIZED; } - const auto matching_2_manager = g_fxo->get(); - - if (!matching_2_manager->is_initialized) + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } // TODO: for all contexts: sceNpMatching2DestroyContext - matching_2_manager->is_initialized = false; + nph->is_NP2_Match2_init = false; return CELL_OK; } @@ -286,19 +286,27 @@ error_code sceNpMatching2DestroyContext(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2DestroyContext(ctxId=%d)", ctxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } + if (!nph->destroy_match2_context(ctxId)) + return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; + return CELL_OK; } -error_code sceNpMatching2LeaveLobby(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2LeaveLobby( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2LeaveLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -315,7 +323,9 @@ error_code sceNpMatching2RegisterLobbyMessageCallback(SceNpMatching2ContextId ct { sceNp2.todo("sceNpMatching2RegisterLobbyMessageCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -323,16 +333,19 @@ error_code sceNpMatching2RegisterLobbyMessageCallback(SceNpMatching2ContextId ct return CELL_OK; } -error_code sceNpMatching2GetWorldInfoList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetWorldInfoList( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2GetWorldInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2GetWorldInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -344,7 +357,9 @@ error_code sceNpMatching2RegisterLobbyEventCallback(SceNpMatching2ContextId ctxI { sceNp2.todo("sceNpMatching2RegisterLobbyEventCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -352,11 +367,14 @@ error_code sceNpMatching2RegisterLobbyEventCallback(SceNpMatching2ContextId ctxI return CELL_OK; } -error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, + vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -369,16 +387,19 @@ error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId return CELL_OK; } -error_code sceNpMatching2SearchRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SearchRoom( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2SearchRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2SearchRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -386,11 +407,14 @@ error_code sceNpMatching2SearchRoom(SceNpMatching2ContextId ctxId, vm::cptr connStatus, vm::ptr peerAddr, vm::ptr peerPort) +error_code sceNpMatching2SignalingGetConnectionStatus( + SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, vm::ptr connStatus, vm::ptr peerAddr, vm::ptr peerPort) { sceNp2.todo("sceNpMatching2SignalingGetConnectionStatus(ctxId=%d, roomId=%d, memberId=%d, connStatus=*0x%x, peerAddr=*0x%x, peerPort=*0x%x)", ctxId, roomId, memberId, connStatus, peerAddr, peerPort); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -398,11 +422,14 @@ error_code sceNpMatching2SignalingGetConnectionStatus(SceNpMatching2ContextId ct return CELL_OK; } -error_code sceNpMatching2SetUserInfo(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetUserInfo( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetUserInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -419,7 +446,9 @@ error_code sceNpMatching2GetClanLobbyId(SceNpMatching2ContextId ctxId, SceNpClan { sceNp2.todo("sceNpMatching2GetClanLobbyId(ctxId=%d, clanId=%d, lobbyId=*0x%x)", ctxId, clanId, lobbyId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -427,11 +456,14 @@ error_code sceNpMatching2GetClanLobbyId(SceNpMatching2ContextId ctxId, SceNpClan return CELL_OK; } -error_code sceNpMatching2GetLobbyMemberDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetLobbyMemberDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -448,7 +480,9 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2ContextStart(ctxId=%d)", ctxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -456,11 +490,14 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId) return CELL_OK; } -error_code sceNpMatching2CreateServerContext(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2CreateServerContext( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2CreateServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -473,11 +510,13 @@ error_code sceNpMatching2CreateServerContext(SceNpMatching2ContextId ctxId, vm:: return CELL_OK; } -error_code sceNpMatching2GetMemoryInfo(vm::ptr memInfo) +error_code sceNpMatching2GetMemoryInfo(vm::ptr memInfo) // TODO { sceNp2.todo("sceNpMatching2GetMemoryInfo(memInfo=*0x%x)", memInfo); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -485,16 +524,19 @@ error_code sceNpMatching2GetMemoryInfo(vm::ptr memInfo return CELL_OK; } -error_code sceNpMatching2LeaveRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2LeaveRoom( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2LeaveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -502,16 +544,19 @@ error_code sceNpMatching2LeaveRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetRoomDataExternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2SetRoomDataExternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2SetRoomDataExternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -519,11 +564,14 @@ error_code sceNpMatching2SetRoomDataExternal(SceNpMatching2ContextId ctxId, vm:: return CELL_OK; } -error_code sceNpMatching2SignalingGetConnectionInfo(SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, s32 code, vm::ptr connInfo) +error_code sceNpMatching2SignalingGetConnectionInfo( + SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, s32 code, vm::ptr connInfo) { sceNp2.todo("sceNpMatching2SignalingGetConnectionInfo(ctxId=%d, roomId=%d, memberId=%d, code=%d, connInfo=*0x%x)", ctxId, roomId, memberId, code, connInfo); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -531,11 +579,14 @@ error_code sceNpMatching2SignalingGetConnectionInfo(SceNpMatching2ContextId ctxI return CELL_OK; } -error_code sceNpMatching2SendRoomMessage(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SendRoomMessage( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -548,11 +599,14 @@ error_code sceNpMatching2SendRoomMessage(SceNpMatching2ContextId ctxId, vm::cptr return CELL_OK; } -error_code sceNpMatching2JoinLobby(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2JoinLobby( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2JoinLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -565,11 +619,14 @@ error_code sceNpMatching2JoinLobby(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetRoomMemberDataExternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, + vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetRoomMemberDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -586,7 +643,9 @@ error_code sceNpMatching2AbortRequest(SceNpMatching2ContextId ctxId, SceNpMatchi { sceNp2.todo("sceNpMatching2AbortRequest(ctxId=%d, reqId=%d)", ctxId, reqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -594,16 +653,19 @@ error_code sceNpMatching2AbortRequest(SceNpMatching2ContextId ctxId, SceNpMatchi return CELL_OK; } -error_code sceNpMatching2GetServerInfo(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetServerInfo( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2GetServerInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2GetServerInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -615,7 +677,9 @@ error_code sceNpMatching2GetEventData(SceNpMatching2ContextId ctxId, SceNpMatchi { sceNp2.todo("sceNpMatching2GetEventData(ctxId=%d, eventKey=%d, buf=*0x%x, bufLen=%d)", ctxId, eventKey, buf, bufLen); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -632,7 +696,9 @@ error_code sceNpMatching2GetRoomSlotInfoLocal(SceNpMatching2ContextId ctxId, con { sceNp2.todo("sceNpMatching2GetRoomSlotInfoLocal(ctxId=%d, roomId=%d, roomSlotInfo=*0x%x)", ctxId, roomId, roomSlotInfo); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -640,11 +706,14 @@ error_code sceNpMatching2GetRoomSlotInfoLocal(SceNpMatching2ContextId ctxId, con return CELL_OK; } -error_code sceNpMatching2SendLobbyChatMessage(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SendLobbyChatMessage( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendLobbyChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -661,7 +730,9 @@ error_code sceNpMatching2AbortContextStart(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2AbortContextStart(ctxId=%d)", ctxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -673,7 +744,9 @@ error_code sceNpMatching2GetRoomMemberIdListLocal(SceNpMatching2ContextId ctxId, { sceNp2.todo("sceNpMatching2GetRoomMemberIdListLocal(ctxId=%d, roomId=%d, sortMethod=%d, memberId=*0x%x, memberIdNum=%d)", ctxId, roomId, sortMethod, memberId, memberIdNum); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -681,16 +754,19 @@ error_code sceNpMatching2GetRoomMemberIdListLocal(SceNpMatching2ContextId ctxId, return CELL_OK; } -error_code sceNpMatching2JoinRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2JoinRoom( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2JoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2JoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -698,13 +774,15 @@ error_code sceNpMatching2JoinRoom(SceNpMatching2ContextId ctxId, vm::cptr attrId, u32 attrIdNum, vm::ptr member, vm::ptr buf, u64 bufLen) +error_code sceNpMatching2GetRoomMemberDataInternalLocal(SceNpMatching2ContextId ctxId, SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId memberId, vm::cptr attrId, + u32 attrIdNum, vm::ptr member, vm::ptr buf, u64 bufLen) { - sceNp2.todo("sceNpMatching2GetRoomMemberDataInternalLocal(ctxId=%d, roomId=%d, memberId=%d, attrId=*0x%x, attrIdNum=%d, member=*0x%x, buf=*0x%x, bufLen=%d)", - ctxId, roomId, memberId, attrId, attrIdNum, member, buf, bufLen); + sceNp2.todo("sceNpMatching2GetRoomMemberDataInternalLocal(ctxId=%d, roomId=%d, memberId=%d, attrId=*0x%x, attrIdNum=%d, member=*0x%x, buf=*0x%x, bufLen=%d)", ctxId, roomId, memberId, attrId, + attrIdNum, member, buf, bufLen); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -716,7 +794,9 @@ error_code sceNpMatching2GetCbQueueInfo(SceNpMatching2ContextId ctxId, vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -724,11 +804,14 @@ error_code sceNpMatching2GetCbQueueInfo(SceNpMatching2ContextId ctxId, vm::ptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2KickoutRoomMember( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2KickoutRoomMember(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -745,7 +828,9 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti { sceNp2.todo("sceNpMatching2ContextStartAsync(ctxId=%d, timeout=%d)", ctxId, timeout); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -753,11 +838,14 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti return CELL_OK; } -error_code sceNpMatching2SetSignalingOptParam(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetSignalingOptParam( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetSignalingOptParam(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -774,7 +862,9 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId, { sceNp2.todo("sceNpMatching2RegisterContextCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -782,11 +872,14 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId, return CELL_OK; } -error_code sceNpMatching2SendRoomChatMessage(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SendRoomChatMessage( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendRoomChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -799,16 +892,19 @@ error_code sceNpMatching2SendRoomChatMessage(SceNpMatching2ContextId ctxId, vm:: return CELL_OK; } -error_code sceNpMatching2SetRoomDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetRoomDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -816,16 +912,19 @@ error_code sceNpMatching2SetRoomDataInternal(SceNpMatching2ContextId ctxId, vm:: return CELL_OK; } -error_code sceNpMatching2GetRoomDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetRoomDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -833,16 +932,19 @@ error_code sceNpMatching2GetRoomDataInternal(SceNpMatching2ContextId ctxId, vm:: return CELL_OK; } -error_code sceNpMatching2SignalingGetPingInfo(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SignalingGetPingInfo( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -854,12 +956,14 @@ error_code sceNpMatching2GetServerIdListLocal(SceNpMatching2ContextId ctxId, vm: { sceNp2.todo("sceNpMatching2GetServerIdListLocal(ctxId=%d, serverId=*0x%x, serverIdNum=%d)", ctxId, serverId, serverIdNum); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - return CELL_OK; + return not_an_error(0); // Number of servers } error_code sceNpUtilBuildCdnUrl(vm::cptr url, vm::ptr buf, u64 bufSize, vm::ptr required, vm::ptr option) @@ -872,7 +976,7 @@ error_code sceNpUtilBuildCdnUrl(vm::cptr url, vm::ptr buf, u64 bufSi return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT; } - //if (offline) + // if (offline) //{ // return SCE_NP_ERROR_OFFLINE; //} @@ -880,11 +984,14 @@ error_code sceNpUtilBuildCdnUrl(vm::cptr url, vm::ptr buf, u64 bufSi return CELL_OK; } -error_code sceNpMatching2GrantRoomOwner(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GrantRoomOwner( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GrantRoomOwner(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -897,11 +1004,14 @@ error_code sceNpMatching2GrantRoomOwner(SceNpMatching2ContextId ctxId, vm::cptr< return CELL_OK; } -error_code sceNpMatching2CreateContext(vm::cptr npId, vm::cptr commId, vm::cptr passPhrase, vm::ptr ctxId, s32 option) +error_code sceNpMatching2CreateContext( + vm::cptr npId, vm::cptr commId, vm::cptr passPhrase, vm::ptr ctxId, s32 option) { sceNp2.todo("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x, passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, passPhrase, ctxId, option); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -918,7 +1028,9 @@ error_code sceNpMatching2GetSignalingOptParamLocal(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2GetSignalingOptParamLocal(ctxId=%d, roomId=%d, signalingOptParam=*0x%x)", ctxId, roomId, signalingOptParam); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -930,7 +1042,9 @@ error_code sceNpMatching2RegisterSignalingCallback(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2RegisterSignalingCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -942,7 +1056,9 @@ error_code sceNpMatching2ClearEventData(SceNpMatching2ContextId ctxId, SceNpMatc { sceNp2.todo("sceNpMatching2ClearEventData(ctxId=%d, eventKey=%d)", ctxId, eventKey); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -950,11 +1066,14 @@ error_code sceNpMatching2ClearEventData(SceNpMatching2ContextId ctxId, SceNpMatc return CELL_OK; } -error_code sceNpMatching2GetUserInfoList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetUserInfoList( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetUserInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -967,11 +1086,14 @@ error_code sceNpMatching2GetUserInfoList(SceNpMatching2ContextId ctxId, vm::cptr return CELL_OK; } -error_code sceNpMatching2GetRoomMemberDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetRoomMemberDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -984,11 +1106,14 @@ error_code sceNpMatching2GetRoomMemberDataInternal(SceNpMatching2ContextId ctxId return CELL_OK; } -error_code sceNpMatching2SetRoomMemberDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetRoomMemberDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1001,11 +1126,14 @@ error_code sceNpMatching2SetRoomMemberDataInternal(SceNpMatching2ContextId ctxId return CELL_OK; } -error_code sceNpMatching2JoinProhibitiveRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2JoinProhibitiveRoom( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1022,7 +1150,9 @@ error_code sceNpMatching2SignalingSetCtxOpt(SceNpMatching2ContextId ctxId, s32 o { sceNp2.todo("sceNpMatching2SignalingSetCtxOpt(ctxId=%d, optname=%d, optval=%d)", ctxId, optname, optval); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1030,11 +1160,14 @@ error_code sceNpMatching2SignalingSetCtxOpt(SceNpMatching2ContextId ctxId, s32 o return CELL_OK; } -error_code sceNpMatching2DeleteServerContext(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2DeleteServerContext( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2DeleteServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1051,7 +1184,9 @@ error_code sceNpMatching2SetDefaultRequestOptParam(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2SetDefaultRequestOptParam(ctxId=%d, optParam=*0x%x)", ctxId, optParam); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1068,7 +1203,9 @@ error_code sceNpMatching2RegisterRoomEventCallback(SceNpMatching2ContextId ctxId { sceNp2.todo("sceNpMatching2RegisterRoomEventCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1080,7 +1217,9 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce { sceNp2.todo("sceNpMatching2GetRoomPasswordLocal(ctxId=%d, roomId=%d, withPassword=*0x%x, roomPassword=*0x%x)", ctxId, roomId, withPassword, roomPassword); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1088,11 +1227,14 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce return CELL_OK; } -error_code sceNpMatching2GetRoomDataExternalList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetRoomDataExternalList( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1105,16 +1247,19 @@ error_code sceNpMatching2GetRoomDataExternalList(SceNpMatching2ContextId ctxId, return CELL_OK; } -error_code sceNpMatching2CreateJoinRoom(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2CreateJoinRoom( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { - sceNp2.todo("sceNpMatching2CreateJoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); + sceNp2.warning("sceNpMatching2CreateJoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } - if (!reqParam || !optParam || !assignedReqId) + if (!reqParam || !assignedReqId) { return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; } @@ -1126,7 +1271,9 @@ error_code sceNpMatching2SignalingGetCtxOpt(SceNpMatching2ContextId ctxId, s32 o { sceNp2.todo("sceNpMatching2SignalingGetCtxOpt(ctxId=%d, optname=%d, optval=*0x%x)", ctxId, optname, optval); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1134,11 +1281,14 @@ error_code sceNpMatching2SignalingGetCtxOpt(SceNpMatching2ContextId ctxId, s32 o return CELL_OK; } -error_code sceNpMatching2GetLobbyInfoList(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2GetLobbyInfoList( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2GetLobbyInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1151,11 +1301,14 @@ error_code sceNpMatching2GetLobbyInfoList(SceNpMatching2ContextId ctxId, vm::cpt return CELL_OK; } -error_code sceNpMatching2GetLobbyMemberIdListLocal(SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, vm::ptr memberId, u32 memberIdNum, vm::ptr me) +error_code sceNpMatching2GetLobbyMemberIdListLocal( + SceNpMatching2ContextId ctxId, SceNpMatching2LobbyId lobbyId, vm::ptr memberId, u32 memberIdNum, vm::ptr me) { sceNp2.todo("sceNpMatching2GetLobbyMemberIdListLocal(ctxId=%d, lobbyId=%d, memberId=*0x%x, memberIdNum=%d, me=*0x%x)", ctxId, lobbyId, memberId, memberIdNum, me); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1163,11 +1316,14 @@ error_code sceNpMatching2GetLobbyMemberIdListLocal(SceNpMatching2ContextId ctxId return CELL_OK; } -error_code sceNpMatching2SendLobbyInvitation(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SendLobbyInvitation( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SendLobbyInvitation(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1184,7 +1340,9 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId) { sceNp2.todo("sceNpMatching2ContextStop(ctxId=%d)", ctxId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1192,11 +1350,14 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId) return CELL_OK; } -error_code sceNpMatching2SetLobbyMemberDataInternal(SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) +error_code sceNpMatching2SetLobbyMemberDataInternal( + SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::cptr optParam, vm::ptr assignedReqId) { sceNp2.todo("sceNpMatching2SetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1213,7 +1374,9 @@ error_code sceNpMatching2RegisterRoomMessageCallback(SceNpMatching2ContextId ctx { sceNp2.todo("sceNpMatching2RegisterRoomMessageCallback(ctxId=%d, cbFunc=*0x%x, cbFuncArg=*0x%x)", ctxId, cbFunc, cbFuncArg); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1225,7 +1388,9 @@ error_code sceNpMatching2SignalingCancelPeerNetInfo(SceNpMatching2ContextId ctxI { sceNp2.todo("sceNpMatching2SignalingCancelPeerNetInfo(ctxId=%d, reqId=%d)", ctxId, reqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1237,7 +1402,9 @@ error_code sceNpMatching2SignalingGetLocalNetInfo(vm::ptrget()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1255,7 +1422,9 @@ error_code sceNpMatching2SignalingGetPeerNetInfo(SceNpMatching2ContextId ctxId, { sceNp2.todo("sceNpMatching2SignalingGetPeerNetInfo(ctxId=%d, roomId=%d, roomMemberId=%d, reqId=*0x%x)", ctxId, roomId, roomMemberId, reqId); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1272,7 +1441,9 @@ error_code sceNpMatching2SignalingGetPeerNetInfoResult(SceNpMatching2ContextId c { sceNp2.todo("sceNpMatching2SignalingGetPeerNetInfoResult(ctxId=%d, reqId=%d, netinfo=*0x%x)", ctxId, reqId, netinfo); - if (!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP2_Match2_init) { return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } @@ -1290,14 +1461,14 @@ error_code sceNpAuthOAuthInit() { sceNp2.todo("sceNpAuthOAuthInit()"); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); - if (manager->is_initialized) + if (nph->is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_ALREADY_INITIALIZED; } - manager->is_initialized = true; + nph->is_NP_Auth_init = true; return CELL_OK; } @@ -1306,10 +1477,10 @@ error_code sceNpAuthOAuthTerm() { sceNp2.todo("sceNpAuthOAuthTerm()"); - const auto manager = g_fxo->get(); + const auto nph = g_fxo->get>(); // TODO: check if this might throw SCE_NP_OAUTH_ERROR_NOT_INITIALIZED - manager->is_initialized = false; + nph->is_NP_Auth_init = false; return CELL_OK; } @@ -1318,7 +1489,9 @@ error_code sceNpAuthCreateOAuthRequest() { sceNp2.todo("sceNpAuthCreateOAuthRequest()"); - if(!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1330,7 +1503,9 @@ error_code sceNpAuthDeleteOAuthRequest(SceNpAuthOAuthRequestId reqId) { sceNp2.todo("sceNpAuthDeleteOAuthRequest(reqId=%d)"); - if(!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1342,7 +1517,9 @@ error_code sceNpAuthAbortOAuthRequest(SceNpAuthOAuthRequestId reqId) { sceNp2.todo("sceNpAuthAbortOAuthRequest(reqId=%d)"); - if(!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1354,7 +1531,9 @@ error_code sceNpAuthGetAuthorizationCode(SceNpAuthOAuthRequestId reqId, vm::cptr { sceNp2.todo("sceNpAuthGetAuthorizationCode(reqId=%d, param=*0x%x, authCode=*0x%x, issuerId=%d)", reqId, param, authCode, issuerId); - if(!g_fxo->get()->is_initialized) + const auto nph = g_fxo->get>(); + + if (!nph->is_NP_Auth_init) { return SCE_NP_OAUTH_ERROR_NOT_INITIALIZED; } @@ -1368,8 +1547,8 @@ error_code sceNpAuthGetAuthorizationCode2() return CELL_OK; } -DECLARE(ppu_module_manager::sceNp2)("sceNp2", []() -{ +DECLARE(ppu_module_manager::sceNp2) +("sceNp2", []() { REG_FUNC(sceNp2, sceNpMatching2DestroyContext); REG_FUNC(sceNp2, sceNpMatching2LeaveLobby); REG_FUNC(sceNp2, sceNpMatching2RegisterLobbyMessageCallback); diff --git a/rpcs3/Emu/Cell/Modules/sceNp2.h b/rpcs3/Emu/Cell/Modules/sceNp2.h index 5daed324a6..37a20290be 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp2.h +++ b/rpcs3/Emu/Cell/Modules/sceNp2.h @@ -6,6 +6,8 @@ #include +extern logs::channel sceNp2; + // Error codes enum SceNpMatching2Error : u32 { @@ -485,6 +487,7 @@ typedef u8 SceNpMatching2Operator; typedef u8 SceNpMatching2CastType; typedef u8 SceNpMatching2SessionType; typedef u8 SceNpMatching2SignalingType; +typedef u8 SceNpMatching2SignalingFlag; typedef u8 SceNpMatching2EventCause; typedef u8 SceNpMatching2ServerStatus; typedef u8 SceNpMatching2Role; @@ -537,7 +540,7 @@ struct SceNpMatching2BinAttr { be_t id; u8 padding[2]; - be_t ptr; + vm::bptr ptr; be_t size; }; @@ -587,9 +590,9 @@ struct SceNpMatching2JoinedSessionInfo // User information struct SceNpMatching2UserInfo { - vm::ptr next; + vm::bptr next; SceNpUserInfo2 userInfo; - vm::ptr userBinAttr; + vm::bptr userBinAttr; be_t userBinAttrNum; SceNpMatching2JoinedSessionInfo joinedSessionInfo; be_t joinedSessionInfoNum; @@ -628,15 +631,15 @@ struct SceNpMatching2LobbyMemberBinAttrInternal // Lobby-internal lobby member information struct SceNpMatching2LobbyMemberDataInternal { - vm::ptr next; + vm::bptr next; SceNpUserInfo2 userInfo; CellRtcTick joinDate; be_t memberId; u8 padding[2]; be_t flagAttr; - vm::ptr joinedSessionInfo; + vm::bptr joinedSessionInfo; be_t joinedSessionInfoNum; - vm::ptr lobbyMemberBinAttrInternal; + vm::bptr lobbyMemberBinAttrInternal; be_t lobbyMemberBinAttrInternalNum; // Unsigned ints are be_t not uint, right? }; @@ -661,7 +664,7 @@ struct SceNpMatching2LobbyBinAttrInternal // Lobby-external lobby information struct SceNpMatching2LobbyDataExternal { - vm::ptr next; + vm::bptr next; be_t serverId; u8 padding1[2]; be_t worldId; @@ -670,11 +673,11 @@ struct SceNpMatching2LobbyDataExternal be_t maxSlot; be_t curMemberNum; be_t flagAttr; - vm::ptr lobbySearchableIntAttrExternal; + vm::bptr lobbySearchableIntAttrExternal; be_t lobbySearchableIntAttrExternalNum; - vm::ptr lobbySearchableBinAttrExternal; + vm::bptr lobbySearchableBinAttrExternal; be_t lobbySearchableBinAttrExternalNum; - vm::ptr lobbyBinAttrExternal; + vm::bptr lobbyBinAttrExternal; be_t lobbyBinAttrExternalNum; u8 padding3[4]; }; @@ -689,7 +692,7 @@ struct SceNpMatching2LobbyDataInternal be_t maxSlot; SceNpMatching2LobbyMemberIdList memberIdList; be_t flagAttr; - vm::ptr lobbyBinAttrInternal; + vm::bptr lobbyBinAttrInternal; be_t lobbyBinAttrInternalNum; }; @@ -752,7 +755,7 @@ struct SceNpMatching2RoomMemberBinAttrInternal // External room member data struct SceNpMatching2RoomMemberDataExternal { - vm::ptr next; + vm::bptr next; SceNpUserInfo2 userInfo; CellRtcTick joinDate; SceNpMatching2Role role; @@ -762,27 +765,27 @@ struct SceNpMatching2RoomMemberDataExternal // Internal room member data struct SceNpMatching2RoomMemberDataInternal { - vm::ptr next; + vm::bptr next; SceNpUserInfo2 userInfo; CellRtcTick joinDate; be_t memberId; SceNpMatching2TeamId teamId; u8 padding1[1]; - vm::ptr roomGroup; + vm::bptr roomGroup; SceNpMatching2NatType natType; u8 padding2[3]; be_t flagAttr; - vm::ptr roomMemberBinAttrInternal; + vm::bptr roomMemberBinAttrInternal; be_t roomMemberBinAttrInternalNum; }; // Internal room member data list struct SceNpMatching2RoomMemberDataInternalList { - vm::ptr members; + vm::bptr members; be_t membersNum; - vm::ptr me; - vm::ptr owner; + vm::bptr me; + vm::bptr owner; }; // Internal room binary attribute @@ -797,7 +800,7 @@ struct SceNpMatching2RoomBinAttrInternal // External room data struct SceNpMatching2RoomDataExternal { - vm::ptr next; + vm::bptr next; be_t serverId; u8 padding1[2]; be_t worldId; @@ -810,15 +813,15 @@ struct SceNpMatching2RoomDataExternal be_t openPrivateSlotNum; be_t curMemberNum; be_t passwordSlotMask; - vm::ptr owner; - vm::ptr roomGroup; + vm::bptr owner; + vm::bptr roomGroup; be_t roomGroupNum; be_t flagAttr; - vm::ptr roomSearchableIntAttrExternal; + vm::bptr roomSearchableIntAttrExternal; be_t roomSearchableIntAttrExternalNum; - vm::ptr roomSearchableBinAttrExternal; + vm::bptr roomSearchableBinAttrExternal; be_t roomSearchableBinAttrExternalNum; - vm::ptr roomBinAttrExternal; + vm::bptr roomBinAttrExternal; be_t roomBinAttrExternalNum; }; @@ -833,10 +836,10 @@ struct SceNpMatching2RoomDataInternal be_t passwordSlotMask; be_t maxSlot; SceNpMatching2RoomMemberDataInternalList memberList; - vm::ptr roomGroup; + vm::bptr roomGroup; be_t roomGroupNum; be_t flagAttr; - vm::ptr roomBinAttrInternal; + vm::bptr roomBinAttrInternal; be_t roomBinAttrInternalNum; }; @@ -857,9 +860,9 @@ union SceNpMatching2RoomMessageDestination // Invitation data struct SceNpMatching2InvitationData { - vm::ptr targetSession; + vm::bptr targetSession; be_t targetSessionNum; - vm::ptr optData; + vm::bptr optData; be_t optDataLen; }; @@ -867,7 +870,7 @@ struct SceNpMatching2InvitationData struct SceNpMatching2SignalingOptParam { SceNpMatching2SignalingType type; - u8 reserved1[1]; + SceNpMatching2SignalingFlag flag; be_t hubMemberId; u8 reserved2[4]; }; @@ -875,8 +878,8 @@ struct SceNpMatching2SignalingOptParam // Option parameters for requests struct SceNpMatching2RequestOptParam { - SceNpMatching2RequestCallback cbFunc; - vm::ptr cbFuncArg; + vm::bptr cbFunc; + vm::bptr cbFuncArg; be_t timeout; be_t appReqId; u8 padding[2]; @@ -927,7 +930,7 @@ struct SceNpMatching2GetWorldInfoListRequest // World data list request response data struct SceNpMatching2GetWorldInfoListResponse { - vm::ptr world; + vm::bptr world; be_t worldNum; }; @@ -936,7 +939,7 @@ struct SceNpMatching2SetUserInfoRequest { be_t serverId; u8 padding[2]; - vm::ptr userBinAttr; + vm::bptr userBinAttr; be_t userBinAttrNum; }; @@ -945,7 +948,7 @@ struct SceNpMatching2GetUserInfoListRequest { be_t serverId; u8 padding[2]; - vm::ptr npId; + vm::bptr npId; be_t npIdNum; vm::bptr attrId; be_t attrIdNum; @@ -955,7 +958,7 @@ struct SceNpMatching2GetUserInfoListRequest // User information list acquisition response data struct SceNpMatching2GetUserInfoListResponse { - vm::ptr userInfo; + vm::bptr userInfo; be_t userInfoNum; }; @@ -968,7 +971,7 @@ struct SceNpMatching2GetRoomMemberDataExternalListRequest // External room member data list request response data struct SceNpMatching2GetRoomMemberDataExternalListResponse { - vm::ptr roomMemberDataExternal; + vm::bptr roomMemberDataExternal; be_t roomMemberDataExternalNum; }; @@ -976,11 +979,11 @@ struct SceNpMatching2GetRoomMemberDataExternalListResponse struct SceNpMatching2SetRoomDataExternalRequest { be_t roomId; - vm::ptr roomSearchableIntAttrExternal; + vm::bptr roomSearchableIntAttrExternal; be_t roomSearchableIntAttrExternalNum; - vm::ptr roomSearchableBinAttrExternal; + vm::bptr roomSearchableBinAttrExternal; be_t roomSearchableBinAttrExternalNum; - vm::ptr roomBinAttrExternal; + vm::bptr roomBinAttrExternal; be_t roomBinAttrExternalNum; }; @@ -996,7 +999,7 @@ struct SceNpMatching2GetRoomDataExternalListRequest // External room data list request response data struct SceNpMatching2GetRoomDataExternalListResponse { - vm::ptr roomDataExternal; + vm::bptr roomDataExternal; be_t roomDataExternalNum; }; @@ -1008,44 +1011,44 @@ struct SceNpMatching2CreateJoinRoomRequest be_t lobbyId; be_t maxSlot; be_t flagAttr; - vm::ptr roomBinAttrInternal; + vm::bptr roomBinAttrInternal; be_t roomBinAttrInternalNum; - vm::ptr roomSearchableIntAttrExternal; + vm::bptr roomSearchableIntAttrExternal; be_t roomSearchableIntAttrExternalNum; - vm::ptr roomSearchableBinAttrExternal; + vm::bptr roomSearchableBinAttrExternal; be_t roomSearchableBinAttrExternalNum; - vm::ptr roomBinAttrExternal; + vm::bptr roomBinAttrExternal; be_t roomBinAttrExternalNum; - vm::ptr roomPassword; - vm::ptr groupConfig; + vm::bptr roomPassword; + vm::bptr groupConfig; be_t groupConfigNum; vm::bptr passwordSlotMask; - vm::ptr allowedUser; + vm::bptr allowedUser; be_t allowedUserNum; - vm::ptr blockedUser; + vm::bptr blockedUser; be_t blockedUserNum; - vm::ptr joinRoomGroupLabel; - vm::ptr roomMemberBinAttrInternal; + vm::bptr joinRoomGroupLabel; + vm::bptr roomMemberBinAttrInternal; be_t roomMemberBinAttrInternalNum; SceNpMatching2TeamId teamId; u8 padding2[3]; - SceNpMatching2SignalingOptParam sigOptParam; + vm::bptr sigOptParam; u8 padding3[4]; }; // Create-and-join room request response data struct SceNpMatching2CreateJoinRoomResponse { - vm::ptr roomDataInternal; + vm::bptr roomDataInternal; }; // Join room request parameters struct SceNpMatching2JoinRoomRequest { be_t roomId; - vm::ptr roomPassword; - vm::ptr joinRoomGroupLabel; - vm::ptr roomMemberBinAttrInternal; + vm::bptr roomPassword; + vm::bptr joinRoomGroupLabel; + vm::bptr roomMemberBinAttrInternal; be_t roomMemberBinAttrInternalNum; SceNpMatching2PresenceOptionData optData; SceNpMatching2TeamId teamId; @@ -1055,7 +1058,7 @@ struct SceNpMatching2JoinRoomRequest // Join room request response data struct SceNpMatching2JoinRoomResponse { - vm::ptr roomDataInternal; + vm::bptr roomDataInternal; }; // Leave room request parameters @@ -1094,9 +1097,9 @@ struct SceNpMatching2SearchRoomRequest SceNpMatching2RangeFilter rangeFilter; be_t flagFilter; be_t flagAttr; - vm::ptr intFilter; + vm::bptr intFilter; be_t intFilterNum; - vm::ptr binFilter; + vm::bptr binFilter; be_t binFilterNum; vm::bptr attrId; be_t attrIdNum; @@ -1106,7 +1109,7 @@ struct SceNpMatching2SearchRoomRequest struct SceNpMatching2SearchRoomResponse { SceNpMatching2Range range; - vm::ptr roomDataExternal; + vm::bptr roomDataExternal; }; // Room message send request parameters @@ -1145,9 +1148,9 @@ struct SceNpMatching2SetRoomDataInternalRequest be_t roomId; be_t flagFilter; be_t flagAttr; - vm::ptr roomBinAttrInternal; + vm::bptr roomBinAttrInternal; be_t roomBinAttrInternalNum; - vm::ptr passwordConfig; + vm::bptr passwordConfig; be_t passwordConfigNum; vm::bptr passwordSlotMask; vm::bptr ownerPrivilegeRank; @@ -1166,7 +1169,7 @@ struct SceNpMatching2GetRoomDataInternalRequest // Internal room data request response data struct SceNpMatching2GetRoomDataInternalResponse { - vm::ptr roomDataInternal; + vm::bptr roomDataInternal; }; // Internal room member data configuration request parameters @@ -1178,7 +1181,7 @@ struct SceNpMatching2SetRoomMemberDataInternalRequest u8 padding[5]; be_t flagFilter; be_t flagAttr; - vm::ptr roomMemberBinAttrInternal; + vm::bptr roomMemberBinAttrInternal; be_t roomMemberBinAttrInternalNum; }; @@ -1195,7 +1198,7 @@ struct SceNpMatching2GetRoomMemberDataInternalRequest // Internal room member data request response data struct SceNpMatching2GetRoomMemberDataInternalResponse { - vm::ptr roomMemberDataInternal; + vm::bptr roomMemberDataInternal; }; // Signaling option parameter setting request parameter @@ -1218,16 +1221,16 @@ struct SceNpMatching2GetLobbyInfoListRequest struct SceNpMatching2GetLobbyInfoListResponse { SceNpMatching2Range range; - vm::ptr lobbyDataExternal; + vm::bptr lobbyDataExternal; }; // Lobby joining request parameter struct SceNpMatching2JoinLobbyRequest { be_t lobbyId; - vm::ptr joinedSessionInfo; + vm::bptr joinedSessionInfo; be_t joinedSessionInfoNum; - vm::ptr lobbyMemberBinAttrInternal; + vm::bptr lobbyMemberBinAttrInternal; be_t lobbyMemberBinAttrInternalNum; SceNpMatching2PresenceOptionData optData; u8 padding[4]; @@ -1236,7 +1239,7 @@ struct SceNpMatching2JoinLobbyRequest // Lobby joining response data struct SceNpMatching2JoinLobbyResponse { - vm::ptr lobbyDataInternal; + vm::bptr lobbyDataInternal; }; // Lobby leaving request parameter @@ -1284,9 +1287,9 @@ struct SceNpMatching2SetLobbyMemberDataInternalRequest u8 padding1[2]; be_t flagFilter; be_t flagAttr; - vm::ptr joinedSessionInfo; + vm::bptr joinedSessionInfo; be_t joinedSessionInfoNum; - vm::ptr lobbyMemberBinAttrInternal; + vm::bptr lobbyMemberBinAttrInternal; be_t lobbyMemberBinAttrInternalNum; u8 padding2[4]; }; @@ -1304,7 +1307,7 @@ struct SceNpMatching2GetLobbyMemberDataInternalRequest // Lobby-internal lobby member information acquisition response data struct SceNpMatching2GetLobbyMemberDataInternalResponse { - vm::ptr lobbyMemberDataInternal; + vm::bptr lobbyMemberDataInternal; }; // Request parameters for obtaining a list of lobby-internal lobby member information @@ -1322,7 +1325,7 @@ struct SceNpMatching2GetLobbyMemberDataInternalListRequest // Reponse data for obtaining a list of lobby-internal lobby member information struct SceNpMatching2GetLobbyMemberDataInternalListResponse { - vm::ptr lobbyMemberDataInternal; + vm::bptr lobbyMemberDataInternal; be_t lobbyMemberDataInternalNum; }; @@ -1348,14 +1351,14 @@ struct SceNpMatching2SignalingGetPingInfoResponse struct SceNpMatching2JoinProhibitiveRoomRequest { SceNpMatching2JoinRoomRequest joinParam; - vm::ptr blockedUser; + vm::bptr blockedUser; be_t blockedUserNum; }; // Room member update information struct SceNpMatching2RoomMemberUpdateInfo { - vm::ptr roomMemberDataInternal; + vm::bptr roomMemberDataInternal; SceNpMatching2EventCause eventCause; u8 padding[3]; SceNpMatching2PresenceOptionData optData; @@ -1368,7 +1371,7 @@ struct SceNpMatching2RoomOwnerUpdateInfo be_t newOwner; SceNpMatching2EventCause eventCause; u8 padding[3]; - vm::ptr roomPassword; + vm::bptr roomPassword; SceNpMatching2PresenceOptionData optData; }; @@ -1384,7 +1387,7 @@ struct SceNpMatching2RoomUpdateInfo // Internal room data update information struct SceNpMatching2RoomDataInternalUpdateInfo { - vm::ptr newRoomDataInternal; + vm::bptr newRoomDataInternal; vm::bptr newFlagAttr; vm::bptr prevFlagAttr; vm::bptr newRoomPasswordSlotMask; @@ -1398,7 +1401,7 @@ struct SceNpMatching2RoomDataInternalUpdateInfo // Internal room member data update information struct SceNpMatching2RoomMemberDataInternalUpdateInfo { - vm::ptr newRoomMemberDataInternal; + vm::bptr newRoomMemberDataInternal; vm::bptr newFlagAttr; vm::bptr prevFlagAttr; vm::bptr newTeamId; @@ -1412,8 +1415,8 @@ struct SceNpMatching2RoomMessageInfo b8 filtered; SceNpMatching2CastType castType; u8 padding[2]; - vm::ptr dst; - vm::ptr srcMember; + vm::bptr dst; + vm::bptr srcMember; vm::cptr msg; be_t msgLen; }; @@ -1421,7 +1424,7 @@ struct SceNpMatching2RoomMessageInfo // Lobby member update information struct SceNpMatching2LobbyMemberUpdateInfo { - vm::ptr lobbyMemberDataInternal; + vm::bptr lobbyMemberDataInternal; SceNpMatching2EventCause eventCause; u8 padding[3]; SceNpMatching2PresenceOptionData optData; @@ -1445,7 +1448,7 @@ struct SceNpMatching2LobbyMemberDataInternalUpdateInfo be_t newFlagAttr; SceNpMatching2JoinedSessionInfo newJoinedSessionInfo; be_t newJoinedSessionInfoNum; - vm::ptr newLobbyMemberBinAttrInternal; + vm::bptr newLobbyMemberBinAttrInternal; be_t newLobbyMemberBinAttrInternalNum; }; @@ -1455,8 +1458,8 @@ struct SceNpMatching2LobbyMessageInfo b8 filtered; SceNpMatching2CastType castType; u8 padding[2]; - vm::ptr dst; - vm::ptr srcMember; + vm::bptr dst; + vm::bptr srcMember; vm::cptr msg; be_t msgLen; }; @@ -1466,8 +1469,8 @@ struct SceNpMatching2LobbyInvitationInfo { SceNpMatching2CastType castType; u8 padding[3]; - vm::ptr dst; - vm::ptr srcMember; + vm::bptr dst; + vm::bptr srcMember; SceNpMatching2InvitationData invitationData; }; @@ -1579,20 +1582,3 @@ struct SceNpAuthGetAuthorizationCodeParameter vm::bcptr pClientId; vm::bcptr pScope; }; - -// fxm objects - -struct sce_np_2_manager -{ - std::atomic is_initialized = false; -}; - -struct sce_np_2_matching_manager -{ - std::atomic is_initialized = false; -}; - -struct sce_np_oauth_2_manager -{ - std::atomic is_initialized = false; -}; diff --git a/rpcs3/Emu/Cell/Modules/sceNpSns.cpp b/rpcs3/Emu/Cell/Modules/sceNpSns.cpp index 1f20fd12fc..98802be505 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpSns.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpSns.cpp @@ -4,6 +4,7 @@ #include "sceNpSns.h" #include "sceNp.h" +#include "Emu/NP/np_handler.h" LOG_CHANNEL(sceNpSns); @@ -182,7 +183,9 @@ error_code sceNpSnsFbGetAccessToken(u32 handle, vm::cptrget>(); + + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_SNS_ERROR_NOT_SIGN_IN); } @@ -307,7 +310,9 @@ error_code sceNpSnsFbGetLongAccessToken(u32 handle, vm::cptrget>(); + + if (nph->get_psn_status() == SCE_NP_MANAGER_STATUS_OFFLINE) { return not_an_error(SCE_NP_SNS_ERROR_NOT_SIGN_IN); } diff --git a/rpcs3/Emu/Cell/lv2/sys_net.cpp b/rpcs3/Emu/Cell/lv2/sys_net.cpp index 09d6e697fb..c45ded0f78 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net.cpp @@ -23,6 +23,8 @@ #include #endif +#include "Emu/NP/np_handler.h" + LOG_CHANNEL(sys_net); template<> @@ -155,6 +157,7 @@ static sys_net_error get_last_error(bool is_blocking, int native_error = 0) ERROR_CASE(EALREADY); ERROR_CASE(ENOTCONN); ERROR_CASE(ECONNRESET); + ERROR_CASE(EADDRINUSE); default: sys_net.error("Unknown/illegal socket error: %d", native_error); } @@ -335,8 +338,8 @@ struct network_thread using network_context = named_thread; -lv2_socket::lv2_socket(lv2_socket::socket_type s) - : socket(s) +lv2_socket::lv2_socket(lv2_socket::socket_type s, s32 s_type) + : socket(s), type(s_type) { // Set non-blocking #ifdef _WIN32 @@ -454,7 +457,7 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr return 0; } - auto newsock = std::make_shared(native_socket); + auto newsock = std::make_shared(native_socket, 0); result = idm::import_existing(newsock); @@ -491,7 +494,8 @@ error_code sys_net_bnet_bind(ppu_thread& ppu, s32 s, vm::cptr sys_net.warning("sys_net_bnet_bind(s=%d, addr=*0x%x, addrlen=%u)", s, addr, addrlen); - if (addr->sa_family != SYS_NET_AF_INET) + // 0 presumably defaults to AF_INET(to check?) + if (addr->sa_family != SYS_NET_AF_INET && addr->sa_family != 0) { sys_net.error("sys_net_bnet_bind(s=%d): unsupported sa_family (%d)", s, addr->sa_family); return -SYS_NET_EAFNOSUPPORT; @@ -507,6 +511,18 @@ error_code sys_net_bnet_bind(ppu_thread& ppu, s32 s, vm::cptr const auto sock = idm::check(s, [&](lv2_socket& sock) -> sys_net_error { + if (sock.type == SYS_NET_SOCK_DGRAM_P2P) + { + const u16 daport = reinterpret_cast(addr.get_ptr())->sin_port; + const u16 davport = reinterpret_cast(addr.get_ptr())->sin_vport; + sys_net.warning("Trying to bind %s:%d:%d", inet_ntoa(name.sin_addr), daport, davport); + name.sin_port = std::bit_cast>(daport + davport); // htons(daport + davport) + } + else + { + sys_net.warning("Trying to bind %s:%d", inet_ntoa(name.sin_addr), std::bit_cast, u16>(name.sin_port)); // ntohs(name.sin_port) + } + std::lock_guard lock(sock.mutex); if (::bind(sock.socket, reinterpret_cast(&name), namelen) == 0) @@ -545,21 +561,27 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr(psa_in->sin_addr); ::socklen_t namelen = sizeof(name); + sys_net.warning("Attempting to connect on %s:%d", inet_ntoa(name.sin_addr), std::bit_cast, u16>(name.sin_port)); // ntohs(name.sin_port) + const auto sock = idm::check(s, [&](lv2_socket& sock) { std::lock_guard lock(sock.mutex); if (addr->sa_family == 0 && !psa_in->sin_port && !psa_in->sin_addr) { + const auto nph = g_fxo->get>(); + // Hack for DNS (8.8.8.8:53) name.sin_port = std::bit_cast>(53); - name.sin_addr.s_addr = 0x08080808; + name.sin_addr.s_addr = nph->get_dns(); // Overwrite arg (probably used to validate recvfrom addr) psa_in->sin_family = SYS_NET_AF_INET; psa_in->sin_port = 53; - psa_in->sin_addr = 0x08080808; - sys_net.warning("sys_net_bnet_connect(s=%d): using DNS 8.8.8.8:53..."); + psa_in->sin_addr = nph->get_dns(); + sys_net.warning("sys_net_bnet_connect: using DNS..."); + + nph->add_dns_spy(s); } else if (addr->sa_family != SYS_NET_AF_INET) { @@ -717,6 +739,17 @@ error_code sys_net_bnet_getpeername(ppu_thread& ppu, s32 s, vm::ptrsin_port = std::bit_cast, u16>(reinterpret_cast(&native_addr)->sin_port); paddr->sin_addr = std::bit_cast, u32>(reinterpret_cast(&native_addr)->sin_addr.s_addr); paddr->sin_zero = 0; + + if (sock.type == SYS_NET_SOCK_DGRAM_P2P) + { + vm::ptr paddr_p2p = vm::cast(addr.addr()); + paddr_p2p->sin_vport = paddr_p2p->sin_port - 3658; + paddr_p2p->sin_port = 3658; + in_addr rep; + rep.s_addr = htonl(paddr->sin_addr); + sys_net.error("Reporting P2P socket address as %s:%d:%d", inet_ntoa(rep), paddr_p2p->sin_port, paddr_p2p->sin_vport); + } + return {}; } @@ -1037,16 +1070,54 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 native_flags |= MSG_WAITALL; } + s32 type = 0; + const auto sock = idm::check(s, [&](lv2_socket& sock) { + type = sock.type; std::lock_guard lock(sock.mutex); //if (!(sock.events & lv2_socket::poll::read)) { + const auto nph = g_fxo->get>(); + if (nph->is_dns(s) && nph->is_dns_queue(s)) + { + const auto packet = nph->get_dns_packet(s); + ASSERT(packet.size() < len); + + memcpy(buf.get_ptr(), packet.data(), packet.size()); + native_result = packet.size(); + + native_addr.ss_family = AF_INET; + (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_port = std::bit_cast>(53); // htons(53) + (reinterpret_cast<::sockaddr_in*>(&native_addr))->sin_addr.s_addr = nph->get_dns(); + + return true; + } + native_result = ::recvfrom(sock.socket, reinterpret_cast(buf.get_ptr()), len, native_flags, reinterpret_cast(&native_addr), &native_addrlen); if (native_result >= 0) { + if (sys_net.enabled == logs::level::trace) + { + std::string datrace; + const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + + u8* dabuf = static_cast(buf.get_ptr()); + + for (s32 index = 0; index < native_result; index++) + { + if ((index % 16) == 0) + datrace += '\n'; + + datrace += hex[(dabuf[index] >> 4) & 15]; + datrace += hex[(dabuf[index]) & 15]; + datrace += ' '; + } + sys_net.trace("DNS RESULT: %s", datrace); + } + return true; } @@ -1083,6 +1154,8 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 if (!sock) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error recvfrom(bad socket)"); return -SYS_NET_EBADF; } @@ -1093,6 +1166,9 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 return not_an_error(-result); } + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error recvfrom(result early): %d", result); + return -result; } @@ -1110,11 +1186,15 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 if (result) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error recvfrom(result): %d", result); return -result; } if (ppu.gpr[3] == static_cast(-SYS_NET_EINTR)) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error recvfrom(interrupted)"); return -SYS_NET_EINTR; } } @@ -1141,9 +1221,23 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr buf, u32 paddr->sin_port = std::bit_cast, u16>(reinterpret_cast(&native_addr)->sin_port); paddr->sin_addr = std::bit_cast, u32>(reinterpret_cast(&native_addr)->sin_addr.s_addr); paddr->sin_zero = 0; + + if (type == SYS_NET_SOCK_DGRAM_P2P) + { + vm::ptr paddr_p2p = vm::cast(addr.addr()); + paddr_p2p->sin_vport = paddr_p2p->sin_port - 3658; + paddr_p2p->sin_port = 3658; + + const u16 daport = reinterpret_cast(addr.get_ptr())->sin_port; + const u16 davport = reinterpret_cast(addr.get_ptr())->sin_vport; + sys_net.error("Received a P2P packet from %s:%d:%d", inet_ntoa(reinterpret_cast<::sockaddr_in*>(&native_addr)->sin_addr), daport, davport); + } } // Length + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Ok recvfrom: %d", native_result); + return not_an_error(native_result); } @@ -1207,12 +1301,34 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr buf, u32 l native_flags |= MSG_WAITALL; } + s32 type = 0; const auto sock = idm::check(s, [&](lv2_socket& sock) { + type = sock.type; + if (sock.type == SYS_NET_SOCK_DGRAM_P2P) + { + const u16 daport = reinterpret_cast(addr.get_ptr())->sin_port; + const u16 davport = reinterpret_cast(addr.get_ptr())->sin_vport; + sys_net.error("Sending a P2P packet to %s:%d:%d", inet_ntoa(name.sin_addr), daport, davport); + name.sin_port = std::bit_cast>(daport + davport); // htons(daport + davport) + } + std::lock_guard lock(sock.mutex); //if (!(sock.events & lv2_socket::poll::write)) { + const auto nph = g_fxo->get>(); + if (nph->is_dns(s)) + { + const s32 ret_analyzer = nph->analyze_dns_packet(s, static_cast(buf.get_ptr()), len); + // Check if the packet is intercepted + if (ret_analyzer >= 0) + { + native_result = ret_analyzer; + return true; + } + } + native_result = ::sendto(sock.socket, reinterpret_cast(buf.get_ptr()), len, native_flags, addr ? reinterpret_cast(&name) : nullptr, addr ? namelen : 0); if (native_result >= 0) @@ -1253,16 +1369,20 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr buf, u32 l if (!sock) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error sendto(bad socket)"); return -SYS_NET_EBADF; } if (!sock.ret && result) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error sendto(early result): %d", result); + if (result == SYS_NET_EWOULDBLOCK) { return not_an_error(-result); } - return -result; } @@ -1280,16 +1400,23 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr buf, u32 l if (result) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error sendto(result): %d", result); return -result; } if (ppu.gpr[3] == static_cast(-SYS_NET_EINTR)) { + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Error sendto(interrupted)"); return -SYS_NET_EINTR; } } // Length + if (type == SYS_NET_SOCK_DGRAM_P2P) + sys_net.error("Ok sendto: %d", native_result); + return not_an_error(native_result); } @@ -1576,7 +1703,7 @@ error_code sys_net_bnet_socket(ppu_thread& ppu, s32 family, s32 type, s32 protoc return -get_last_error(false); } - const s32 s = idm::import_existing(std::make_shared(native_socket)); + const s32 s = idm::import_existing(std::make_shared(native_socket, type)); if (s == id_manager::id_traits::invalid) { @@ -1602,6 +1729,9 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s) if (!sock->queue.empty()) sys_net.error("CLOSE"); + const auto nph = g_fxo->get>(); + nph->remove_dns_spy(s); + return CELL_OK; } @@ -1638,7 +1768,12 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr fds, s32 n if (auto sock = idm::check_unlocked(fds[i].fd)) { - if (fds[i].events & ~(SYS_NET_POLLIN | SYS_NET_POLLOUT)) + // Check for fake packet for dns interceptions + const auto nph = g_fxo->get>(); + if (fds[i].events & SYS_NET_POLLIN && nph->is_dns(fds[i].fd) && nph->is_dns_queue(fds[i].fd)) + fds[i].revents |= SYS_NET_POLLIN; + + if (fds[i].events & ~(SYS_NET_POLLIN | SYS_NET_POLLOUT | SYS_NET_POLLERR)) sys_net.error("sys_net_bnet_poll(fd=%d): events=0x%x", fds[i].fd, fds[i].events); _fds[i].fd = sock->socket; if (fds[i].events & SYS_NET_POLLIN) diff --git a/rpcs3/Emu/Cell/lv2/sys_net.h b/rpcs3/Emu/Cell/lv2/sys_net.h index 7f3f0adfcc..2dc8ce3dea 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net.h +++ b/rpcs3/Emu/Cell/lv2/sys_net.h @@ -328,7 +328,7 @@ struct lv2_socket final __bitset_enum_max }; - lv2_socket(socket_type s); + lv2_socket(socket_type s, s32 s_type); ~lv2_socket(); shared_mutex mutex; @@ -353,6 +353,8 @@ struct lv2_socket final // Unsupported option s32 so_tcp_maxseg = 1500; + s32 type = 0; + // Value keepers #ifdef _WIN32 s32 so_reuseaddr = 0; diff --git a/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/Emu/NP/np_handler.cpp new file mode 100644 index 0000000000..e625953a67 --- /dev/null +++ b/rpcs3/Emu/NP/np_handler.cpp @@ -0,0 +1,405 @@ +#include "stdafx.h" +#include +#include "Emu/system_config.h" +#include "np_handler.h" +#include "Emu/Cell/PPUModule.h" +#include "Emu/Cell/Modules/sceNp.h" +#include "Emu/Cell/Modules/sceNp2.h" +#include "Emu/Cell/Modules/cellNetCtl.h" +#include "Utilities/StrUtil.h" +#include "Emu/Cell/Modules/cellSysutil.h" +#include "Emu/IdManager.h" + +#ifdef _WIN32 +#include +#include +#else +#include +#include +#include +#include +#endif + +extern logs::channel sys_net; +extern logs::channel sceNp2; +extern logs::channel sceNp; + +np_handler::np_handler() +{ + is_connected = (g_cfg.net.net_active == np_internet_status::enabled); + is_psn_active = (g_cfg.net.psn_status >= np_psn_status::fake); + + // Validate IP/Get from host? + if (get_net_status() == CELL_NET_CTL_STATE_IPObtained) + { + // cur_ip = g_cfg.net.ip_address; + + // Attempt to get actual IP address + const char* google_dns_server = "8.8.8.8"; + const int dns_port = 53; + + struct sockaddr_in serv; + const int sock = socket(AF_INET, SOCK_DGRAM, 0); + + ASSERT(sock >= 0); + + memset(&serv, 0, sizeof(serv)); + serv.sin_family = AF_INET; + serv.sin_addr.s_addr = inet_addr(google_dns_server); + serv.sin_port = std::bit_cast>(dns_port); // htons(dns_port) + + int err = connect(sock, reinterpret_cast(&serv), sizeof(serv)); + if (err < 0) + { + sys_net.error("Failed to connect to google dns for IP discovery"); + is_connected = false; + cur_ip = "0.0.0.0"; + } + else + { + struct sockaddr_in name; + socklen_t namelen = sizeof(name); + err = getsockname(sock, reinterpret_cast(&name), &namelen); + + char buffer[80]; + const char* p = inet_ntop(AF_INET, &name.sin_addr, buffer, 80); + + if (p == nullptr) + { + sys_net.error("Failed to convert address for IP discovery"); + is_connected = false; + cur_ip = "0.0.0.0"; + } + cur_ip = p; + + struct in_addr addr; + inet_pton(AF_INET, cur_ip.c_str(), &addr); + cur_addr = addr.s_addr; + } + +#ifdef _WIN32 + closesocket(sock); +#else + close(sock); +#endif + + // Convert dns address + std::string s_dns = g_cfg.net.dns; + in_addr conv; + if (!inet_pton(AF_INET, s_dns.c_str(), &conv)) + { + sys_net.error("Provided IP(%s) address for DNS is invalid!", s_dns); + is_connected = false; + conv.s_addr = 0; + cur_ip = "0.0.0.0"; + } + dns = conv.s_addr; + + // Init switch map for dns + auto swaps = fmt::split(g_cfg.net.swap_list, {"&&"}); + for (std::size_t i = 0; i < swaps.size(); i++) + { + auto host_and_ip = fmt::split(swaps[i], {"="}); + if (host_and_ip.size() != 2) + continue; + + in_addr conv; + if (!inet_pton(AF_INET, host_and_ip[1].c_str(), &conv)) + { + sys_net.error("IP(%s) provided for %s in the switch list is invalid!", host_and_ip[1], host_and_ip[0]); + conv.s_addr = 0; + } + + switch_map[host_and_ip[0]] = conv.s_addr; + } + } + else + { + cur_ip = "0.0.0.0"; + dns = 0; + } +} + +void np_handler::init_NP(u32 poolsize, vm::ptr poolptr) +{ + // Init memory pool + mpool = poolptr; + mpool_size = poolsize; + mpool_avail = poolsize; + mpool_allocs.clear(); + + memset(&npid, 0, sizeof(npid)); + memset(&online_name, 0, sizeof(online_name)); + memset(&avatar_url, 0, sizeof(avatar_url)); + + if (g_cfg.net.psn_status >= np_psn_status::fake) + { + std::string s_npid = g_cfg.net.psn_npid; + ASSERT(s_npid != ""); // It should be generated in settings window if empty + + strncpy(npid.handle.data, s_npid.c_str(), sizeof(npid.handle.data)); + } + + switch (g_cfg.net.psn_status) + { + case np_psn_status::disabled: + break; + case np_psn_status::fake: + { + strncpy(online_name.data, "RPCS3's user", sizeof(online_name.data)); + strncpy(avatar_url.data, "https://i.imgur.com/AfWIyQP.jpg", sizeof(avatar_url.data)); + break; + } + default: + break; + } +} + +void np_handler::terminate_NP() +{ + is_psn_active = false; + + // Reset memory pool + mpool.set(0); + mpool_size = 0; + mpool_avail = 0; + mpool_allocs.clear(); +} + +vm::addr_t np_handler::allocate(u32 size) +{ + // Align allocs + const u32 alloc_size = ::align(size, 4); + if (alloc_size > mpool_avail) + { + sceNp.error("Not enough memory available in NP pool!"); + return vm::cast(0); + } + + u32 last_free = 0; + bool found_space = false; + + for (auto& a : mpool_allocs) + { + if ((a.first - last_free) >= alloc_size) + { + found_space = true; + break; + } + + last_free = a.first + a.second; + } + + if (!found_space) + { + if ((mpool_size - last_free) < alloc_size) + { + sceNp.error("Not enough memory available in NP pool(continuous block)!"); + return vm::cast(0); + } + } + + mpool_allocs.emplace(last_free, alloc_size); + mpool_avail -= alloc_size; + + memset((static_cast(mpool.get_ptr())) + last_free, 0, alloc_size); + + return vm::cast(mpool.addr() + last_free); +} + +void np_handler::operator()() +{ +} + +s32 np_handler::get_net_status() const +{ + return is_connected ? CELL_NET_CTL_STATE_IPObtained : CELL_NET_CTL_STATE_Disconnected; +} + +s32 np_handler::get_psn_status() const +{ + return is_psn_active ? SCE_NP_MANAGER_STATUS_ONLINE : SCE_NP_MANAGER_STATUS_OFFLINE; +} + +const std::string& np_handler::get_ip() const +{ + return cur_ip; +} + +u32 np_handler::get_dns() const +{ + return dns; +} + +const SceNpId& np_handler::get_npid() const +{ + return npid; +} + +const SceNpOnlineId& np_handler::get_online_id() const +{ + return npid.handle; +} + +const SceNpOnlineName& np_handler::get_online_name() const +{ + return online_name; +} + +const SceNpAvatarUrl& np_handler::get_avatar_url() const +{ + return avatar_url; +} + +void np_handler::add_dns_spy(u32 sock) +{ + dns_spylist.emplace(std::make_pair(sock, std::queue>())); +} + +void np_handler::remove_dns_spy(u32 sock) +{ + dns_spylist.erase(sock); +} + +bool np_handler::is_dns(u32 sock) const +{ + return dns_spylist.count(sock) != 0; +} + +bool np_handler::is_dns_queue(u32 sock) const +{ + return !dns_spylist.at(sock).empty(); +} + +std::vector np_handler::get_dns_packet(u32 sock) +{ + auto ret_vec = std::move(dns_spylist.at(sock).front()); + dns_spylist.at(sock).pop(); + + return ret_vec; +} + +s32 np_handler::analyze_dns_packet(s32 s, const u8* buf, u32 len) +{ + if (sys_net.enabled == logs::level::trace) + { + std::string datrace; + const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + + for (u32 index = 0; index < len; index++) + { + if ((index % 16) == 0) + datrace += '\n'; + + datrace += hex[(buf[index] >> 4) & 15]; + datrace += hex[(buf[index]) & 15]; + datrace += ' '; + } + sys_net.trace("DNS REQUEST: %s", datrace); + } + + struct dns_header + { + u16 id; // identification number + + u8 rd : 1; // recursion desired + u8 tc : 1; // truncated message + u8 aa : 1; // authoritive answer + u8 opcode : 4; // purpose of message + u8 qr : 1; // query/response flag + + u8 rcode : 4; // response code + u8 cd : 1; // checking disabled + u8 ad : 1; // authenticated data + u8 z : 1; // its z! reserved + u8 ra : 1; // recursion available + + be_t q_count; // number of question entries + be_t ans_count; // number of answer entries + be_t auth_count; // number of authority entries + be_t add_count; // number of resource entries + }; + + if (len < sizeof(dns_header)) + return -1; + + const dns_header* dhead = reinterpret_cast(buf); + // We are only looking for queries not truncated(todo?), only handle one dns query at a time(todo?) + if (dhead->qr != 0 || dhead->tc != 0 || dhead->q_count != 1 || dhead->ans_count != 0 || dhead->auth_count != 0 || dhead->add_count != 0) + return -1; + + // Get the actual address + u8 count = 0; + std::string host{}; + for (u32 i = sizeof(dns_header); (i < len) && buf[i] != 0; i++) + { + if (count == 0) + { + count = buf[i]; + if (i != sizeof(dns_header)) + { + host += '.'; + } + } + else + { + host += static_cast(buf[i]); + count--; + } + } + + sys_net.warning("DNS query for %s", host); + + if (switch_map.count(host)) + { + // design fake packet + std::vector fake(len); + memcpy(fake.data(), buf, len); + dns_header* fake_header = reinterpret_cast(fake.data()); + fake_header->qr = 1; + fake_header->ra = 1; + fake_header->ans_count = 1; + fake.insert(fake.end(), {0xC0, 0x0C}); // Ref to name in header + fake.insert(fake.end(), {0x00, 0x01}); // IPv4 + fake.insert(fake.end(), {0x00, 0x01}); // Class? + fake.insert(fake.end(), {0x00, 0x00, 0x00, 0x3B}); // TTL + fake.insert(fake.end(), {0x00, 0x04}); // Size of data + u32 ip = switch_map[host]; + u8* ptr_ip = reinterpret_cast(&ip); + fake.insert(fake.end(), ptr_ip, ptr_ip + 4); // IP + + sys_net.warning("Solving %s to %d.%d.%d.%d", host, ptr_ip[0], ptr_ip[1], ptr_ip[2], ptr_ip[3]); + + dns_spylist[s].push(std::move(fake)); + return len; + } + + return -1; +} + +s32 np_handler::create_score_context(vm::cptr communicationId, vm::cptr passphrase) +{ + return static_cast(idm::make(communicationId, passphrase)); +} +bool np_handler::destroy_score_context(s32 ctx_id) +{ + return idm::remove(static_cast(ctx_id)); +} + +u16 np_handler::create_match2_context(vm::cptr communicationId, vm::cptr passphrase) +{ + return static_cast(idm::make(communicationId, passphrase)); +} +bool np_handler::destroy_match2_context(u16 ctx_id) +{ + return idm::remove(static_cast(ctx_id)); +} + +s32 np_handler::create_lookup_context(vm::cptr communicationId) +{ + return static_cast(idm::make(communicationId)); +} +bool np_handler::destroy_lookup_context(s32 ctx_id) +{ + return idm::remove(static_cast(ctx_id)); +} diff --git a/rpcs3/Emu/NP/np_handler.h b/rpcs3/Emu/NP/np_handler.h new file mode 100644 index 0000000000..4b1e0c5907 --- /dev/null +++ b/rpcs3/Emu/NP/np_handler.h @@ -0,0 +1,128 @@ +#pragma once + +#include "Emu/Memory/vm_ptr.h" +#include "Emu/Cell/Modules/sceNp.h" +#include "Emu/Cell/Modules/sceNp2.h" + +#include +#include + +class np_handler +{ +public: + np_handler(); + + s32 get_psn_status() const; + s32 get_net_status() const; + + const std::string& get_ip() const; + u32 get_dns() const; + + const SceNpId& get_npid() const; + const SceNpOnlineId& get_online_id() const; + const SceNpOnlineName& get_online_name() const; + const SceNpAvatarUrl& get_avatar_url() const; + + // DNS hooking functions + void add_dns_spy(u32 sock); + void remove_dns_spy(u32 sock); + bool is_dns(u32 sock) const; + bool is_dns_queue(u32 sock) const; + std::vector get_dns_packet(u32 sock); + s32 analyze_dns_packet(s32 s, const u8* buf, u32 len); + + void operator()(); + + void init_NP(u32 poolsize, vm::ptr poolptr); + void terminate_NP(); + + bool is_netctl_init = false; + bool is_NP_init = false; + bool is_NP_Lookup_init = false; + bool is_NP_Score_init = false; + bool is_NP2_init = false; + bool is_NP2_Match2_init = false; + bool is_NP_Auth_init = false; + + // Score related + struct score_ctx + { + score_ctx(vm::cptr communicationId, vm::cptr passphrase) + { + memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId)); + memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase)); + } + + static const u32 id_base = 1; + static const u32 id_step = 1; + static const u32 id_count = 32; + + SceNpCommunicationId communicationId; + SceNpCommunicationPassphrase passphrase; + }; + s32 create_score_context(vm::cptr communicationId, vm::cptr passphrase); + bool destroy_score_context(s32 ctx_id); + + // Match2 related + struct match2_ctx + { + match2_ctx(vm::cptr communicationId, vm::cptr passphrase) + { + memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId)); + memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase)); + } + + static const u32 id_base = 1; + static const u32 id_step = 1; + static const u32 id_count = 255; + + SceNpCommunicationId communicationId; + SceNpCommunicationPassphrase passphrase; + }; + u16 create_match2_context(vm::cptr communicationId, vm::cptr passphrase); + bool destroy_match2_context(u16 ctx_id); + + struct lookup_ctx + { + lookup_ctx(vm::cptr communicationId) + { + memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId)); + } + + static const u32 id_base = 1; + static const u32 id_step = 1; + static const u32 id_count = 32; + + SceNpCommunicationId communicationId; + SceNpCommunicationPassphrase passphrase; + }; + s32 create_lookup_context(vm::cptr communicationId); + bool destroy_lookup_context(s32 ctx_id); + + static constexpr std::string_view thread_name = "NP Handler Thread"; + +protected: + bool is_connected = false; + bool is_psn_active = false; + + // Net infos + std::string cur_ip{}; + u32 cur_addr = 0; + u32 dns = 0x08080808; + + // User infos + SceNpId npid{}; + SceNpOnlineName online_name{}; + SceNpAvatarUrl avatar_url{}; + + // DNS related + std::map>> dns_spylist{}; + std::map switch_map{}; + + // Memory pool for sceNp/sceNp2 + vm::ptr mpool{}; + u32 mpool_size = 0; + u32 mpool_avail = 0; + std::map mpool_allocs{}; // offset/size + vm::addr_t allocate(u32 size); +}; diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 07672f92a9..36eac3566f 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -234,11 +234,15 @@ struct cfg_root : cfg::node { node_net(cfg::node* _this) : cfg::node(_this, "Net") {} - cfg::_enum net_status{ this, "Connection status" }; - cfg::string ip_address{ this, "IP address", "192.168.1.1" }; - - } net{ this }; + cfg::_enum net_active{this, "Internet enabled", np_internet_status::disabled}; + cfg::string ip_address{this, "IP address", "0.0.0.0"}; + cfg::string dns{this, "DNS address", "8.8.8.8"}; + cfg::string swap_list{this, "IP swap list", ""}; + cfg::_enum psn_status{this, "PSN status", np_psn_status::disabled}; + cfg::string psn_npid{this, "NPID", ""}; + } net{this}; + struct node_misc : cfg::node { node_misc(cfg::node* _this) : cfg::node(_this, "Miscellaneous") {} diff --git a/rpcs3/Emu/system_config_types.cpp b/rpcs3/Emu/system_config_types.cpp index 8c418e6cf3..179dabf7a4 100644 --- a/rpcs3/Emu/system_config_types.cpp +++ b/rpcs3/Emu/system_config_types.cpp @@ -205,3 +205,34 @@ void fmt_class_string::format(std::string& out, u64 arg) return unknown; }); } + +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](np_internet_status value) + { + switch (value) + { + case np_internet_status::disabled: return "Disconnected"; + case np_internet_status::enabled: return "Connected"; + } + + return unknown; + }); +} + +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](np_psn_status value) + { + switch (value) + { + case np_psn_status::disabled: return "Disconnected"; + case np_psn_status::fake: return "Simulated"; + } + + return unknown; + }); +} + diff --git a/rpcs3/Emu/system_config_types.h b/rpcs3/Emu/system_config_types.h index 3ba520ae33..ecdde50d3c 100644 --- a/rpcs3/Emu/system_config_types.h +++ b/rpcs3/Emu/system_config_types.h @@ -167,3 +167,15 @@ enum class enter_button_assign circle, // CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CIRCLE cross // CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS }; + +enum class np_internet_status +{ + disabled, + enabled, +}; + +enum np_psn_status +{ + disabled, + fake, +}; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index e5ebfbbde7..35ca859685 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -80,6 +80,7 @@ + NotUsing @@ -426,6 +427,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 38d60c01d6..5904971ffb 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -72,6 +72,9 @@ {f368580d-07bc-4c8b-b488-a4198f2dd17d} + + {652ce43e-72db-42cd-831a-0e194f67e731} + @@ -911,6 +914,9 @@ Emu\GPU\RSX\Overlays + + Emu\NP + @@ -1741,5 +1747,8 @@ Emu\Io + + Emu\NP + \ No newline at end of file diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 55c7845a02..e0a50f30e8 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -10,6 +10,7 @@ #include "Utilities/StrUtil.h" #include +#include #if defined(_WIN32) || defined(HAVE_VULKAN) #include "Emu/RSX/VK/VKHelpers.h" @@ -551,6 +552,23 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, SettingsType ty }); } +void emu_settings::EnhanceEdit(QLineEdit* edit, SettingsType type) +{ + if (!edit) + { + cfg_log.fatal("EnhanceEdit '%s' was used with an invalid object", GetSettingName(type)); + return; + } + + const std::string set_text = GetSetting(type); + edit->setText(qstr(set_text)); + + connect(edit, &QLineEdit::textChanged, [=, this](const QString &text) + { + SetSetting(type, sstr(text)); + }); +} + std::vector emu_settings::GetLoadedLibraries() { return m_currentSettings["Core"]["Load libraries"].as, std::initializer_list>({}); diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index cd79745e96..0369de793c 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -138,7 +138,11 @@ public: WindowTitleFormat, // Network - ConnectionStatus, + InternetStatus, + DNSAddress, + IpSwapList, + PSNStatus, + PSNNPID, // System Language, @@ -228,6 +232,9 @@ public: /** Connects a double spin box with the target settings type*/ void EnhanceDoubleSpinBox(QDoubleSpinBox* slider, SettingsType type, const QString& prefix = "", const QString& suffix = ""); + /** Connects a line edit with the target settings type*/ + void EnhanceEdit(QLineEdit* edit, SettingsType type); + std::vector GetLoadedLibraries(); void SaveSelectedLibraries(const std::vector& libs); @@ -379,7 +386,11 @@ private: { WindowTitleFormat, { "Miscellaneous", "Window Title Format" }}, // Networking - { ConnectionStatus, { "Net", "Connection status"}}, + { InternetStatus, { "Net", "Internet enabled"}}, + { DNSAddress, { "Net", "DNS address"}}, + { IpSwapList, { "Net", "IP swap list"}}, + { PSNStatus, { "Net", "PSN status"}}, + { PSNNPID, { "Net", "NPID"}}, // System { Language, { "System", "Language"}}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 7b2fae1d9a..bb4961b680 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -902,11 +902,52 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // | |\ | __/ |_ \ V V / (_) | | | < | | (_| | |_) | // |_| \_|\___|\__| \_/\_/ \___/|_| |_|\_\ |_|\__,_|_.__/ + // Edits + + xemu_settings->EnhanceEdit(ui->edit_dns, emu_settings::DNSAddress); + SubscribeTooltip(ui->edit_dns, tooltips.settings.dns); + + xemu_settings->EnhanceEdit(ui->edit_npid, emu_settings::PSNNPID); + SubscribeTooltip(ui->edit_npid, tooltips.settings.psn_npid); + + xemu_settings->EnhanceEdit(ui->edit_swaps, emu_settings::IpSwapList); + SubscribeTooltip(ui->edit_swaps, tooltips.settings.dns_swap); + // Comboboxes - xemu_settings->EnhanceComboBox(ui->netStatusBox, emu_settings::ConnectionStatus); - SubscribeTooltip(ui->gb_network_status, tooltips.settings.net_status); + xemu_settings->EnhanceComboBox(ui->netStatusBox, emu_settings::InternetStatus); + SubscribeTooltip(ui->netStatusBox, tooltips.settings.net_status); + connect(ui->netStatusBox, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) + { + ui->edit_dns->setEnabled(index > 0); + }); + ui->edit_dns->setEnabled(ui->netStatusBox->currentIndex() > 0); + + connect(ui->psnStatusBox, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) + { + ui->edit_npid->setEnabled(index > 0); + + if (index > 0 && ui->edit_npid->text() == "") + { + QString gen_npid = "RPCS3_"; + + constexpr char list_chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; + + std::srand(time(0)); + + for (int i = 0; i < 10; i++) + { + gen_npid += list_chars[std::rand() % (sizeof(list_chars) - 1)]; + } + + ui->edit_npid->setText(gen_npid); + } + }); + + xemu_settings->EnhanceComboBox(ui->psnStatusBox, emu_settings::PSNStatus); + SubscribeTooltip(ui->psnStatusBox, tooltips.settings.psn_status); // _ _ _______ _ // /\ | | | | |__ __| | | diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 2a2b99b807..2d12f3c9cc 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -1487,24 +1487,145 @@ - + - Network Status + Network Configuration - + - + + + Network Status + + + + + + + + + + + + DNS + + + + + + + 0 + 0 + + + + + + + + + + + IP/Hosts switches + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + - - - - + + + PSN Configuration + + + + + + PSN Status + + + + + + + + + + + + PSN settings + + + + + + + + NPID: + + + + + + + + 0 + 0 + + + + 16 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index a69a2056c8..f6e3f99e3b 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -170,7 +170,11 @@ public: // network - const QString net_status = tr("Leave as disconnected unless you're debugging.\nRPCS3 has no online support."); + const QString net_status = tr("If set to Connected, RPCS3 will allow programs to use your internet connection."); + const QString psn_status = tr("If set to Simulated, RPCS3 will fake PSN connection as best as it can."); + const QString dns = tr("DNS used to resolve hostnames by applications"); + const QString psn_npid = tr("Identifier representing your account"); + const QString dns_swap = tr("DNS Swap List"); // system