From f3ceebabd9e45d14f8396ef47691d2a9e87731d9 Mon Sep 17 00:00:00 2001 From: Silent Date: Thu, 18 Jul 2024 12:29:43 +0200 Subject: [PATCH] sceNp: Improve SceNpCommunicationId logging --- rpcs3/Emu/Cell/Modules/sceNp.cpp | 6 +++--- rpcs3/Emu/NP/np_helpers.cpp | 5 +++++ rpcs3/Emu/NP/np_helpers.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index d8ece152a4..8081d12310 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -922,7 +922,7 @@ error_code sceNpDrmProcessExitSpawn2(ppu_thread& ppu, vm::cptr klicensee, vm error_code sceNpBasicRegisterHandler(vm::cptr context, vm::ptr handler, vm::ptr arg) { - sceNp.warning("sceNpBasicRegisterHandler(context=*0x%x(%s), handler=*0x%x, arg=*0x%x)", context, context ? static_cast(context->data) : "", handler, arg); + sceNp.warning("sceNpBasicRegisterHandler(context=*0x%x(%s), handler=*0x%x, arg=*0x%x)", context, context ? context->data : "", handler, arg); auto& nph = g_fxo->get>(); @@ -948,7 +948,7 @@ error_code sceNpBasicRegisterHandler(vm::cptr context, vm: error_code sceNpBasicRegisterContextSensitiveHandler(vm::cptr context, vm::ptr handler, vm::ptr arg) { - sceNp.notice("sceNpBasicRegisterContextSensitiveHandler(context=*0x%x, handler=*0x%x, arg=*0x%x)", context, handler, arg); + sceNp.notice("sceNpBasicRegisterContextSensitiveHandler(context=*0x%x(%s), handler=*0x%x, arg=*0x%x)", context, context ? context->data : "", handler, arg); auto& nph = g_fxo->get>(); @@ -5300,7 +5300,7 @@ error_code sceNpScoreTerm() error_code sceNpScoreCreateTitleCtx(vm::cptr communicationId, vm::cptr passphrase, vm::cptr selfNpId) { - sceNp.warning("sceNpScoreCreateTitleCtx(communicationId=*0x%x, passphrase=*0x%x, selfNpId=*0x%x)", communicationId, passphrase, selfNpId); + sceNp.warning("sceNpScoreCreateTitleCtx(communicationId=*0x%x(%s), passphrase=*0x%x, selfNpId=*0x%x)", communicationId, communicationId ? np::communication_id_to_string(*communicationId).c_str() : "", passphrase, selfNpId); auto& nph = g_fxo->get>(); diff --git a/rpcs3/Emu/NP/np_helpers.cpp b/rpcs3/Emu/NP/np_helpers.cpp index ab4f95b197..3576d5c683 100644 --- a/rpcs3/Emu/NP/np_helpers.cpp +++ b/rpcs3/Emu/NP/np_helpers.cpp @@ -22,6 +22,11 @@ namespace np return fmt::format("%02X:%02X:%02X:%02X:%02X:%02X", ether[0], ether[1], ether[2], ether[3], ether[4], ether[5]); } + std::string communication_id_to_string(const SceNpCommunicationId& communicationId) + { + return fmt::format("%s_%02d", communicationId.data, communicationId.num); + } + void strings_to_userinfo(std::string_view npid, std::string_view online_name, std::string_view avatar_url, SceNpUserInfo& user_info) { memset(&user_info, 0, sizeof(user_info)); diff --git a/rpcs3/Emu/NP/np_helpers.h b/rpcs3/Emu/NP/np_helpers.h index 749e2a59bd..c5375235f3 100644 --- a/rpcs3/Emu/NP/np_helpers.h +++ b/rpcs3/Emu/NP/np_helpers.h @@ -9,6 +9,7 @@ namespace np { std::string ip_to_string(u32 addr); std::string ether_to_string(std::array& ether); + std::string communication_id_to_string(const SceNpCommunicationId& communicationId); void string_to_npid(std::string_view str, SceNpId& npid); void string_to_online_name(std::string_view str, SceNpOnlineName& online_name);