From a9b124f9c6db132dbee10079a22409630034869c Mon Sep 17 00:00:00 2001 From: zeph Date: Mon, 8 Dec 2025 03:49:56 +0100 Subject: [PATCH] Clans: make instance a shared_ptr --- rpcs3/Emu/Cell/Modules/sceNpClans.cpp | 5 +++-- rpcs3/Emu/NP/clans_client.cpp | 22 +++++++++++----------- rpcs3/Emu/NP/clans_client.h | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/sceNpClans.cpp b/rpcs3/Emu/Cell/Modules/sceNpClans.cpp index f8bcd44373..3e6ad94663 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpClans.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpClans.cpp @@ -5,6 +5,7 @@ #include "Emu/NP/clans_client.h" #include "sceNp.h" +#include #include "sceNpClans.h" @@ -97,7 +98,7 @@ error_code sceNpClansInit(vm::cptr commId, vm::cptr client = std::make_shared(); clans_manager.client = client; clans_manager.is_initialized = true; @@ -113,7 +114,7 @@ error_code sceNpClansTerm() return SCE_NP_CLANS_ERROR_NOT_INITIALIZED; } - delete clans_manager.client; + clans_manager.client.reset(); clans_manager.is_initialized = false; return CELL_OK; diff --git a/rpcs3/Emu/NP/clans_client.cpp b/rpcs3/Emu/NP/clans_client.cpp index 96591eb006..cb78c4aa46 100644 --- a/rpcs3/Emu/NP/clans_client.cpp +++ b/rpcs3/Emu/NP/clans_client.cpp @@ -350,8 +350,8 @@ namespace clan .role = static_cast(role_int), .status = static_cast(status_int)}; - strcpy_trunc(entry.info.name, name_str.c_str()); - strcpy_trunc(entry.info.tag, tag_str.c_str()); + strcpy_trunc(entry.info.name, name_str); + strcpy_trunc(entry.info.tag, tag_str); clanList[i] = entry; i++; @@ -396,9 +396,9 @@ namespace clan .description = "", }}; - strcpy_trunc(clanInfo->info.name, name_str.c_str()); - strcpy_trunc(clanInfo->info.tag, tag_str.c_str()); - strcpy_trunc(clanInfo->updatable.description, description_str.c_str()); + strcpy_trunc(clanInfo->info.name, name_str); + strcpy_trunc(clanInfo->info.tag, tag_str); + strcpy_trunc(clanInfo->updatable.description, description_str); return SCE_NP_CLANS_SUCCESS; } @@ -453,7 +453,7 @@ namespace clan std::string description_str = description.text().as_string(); char description_char[256] = {0}; - strcpy_trunc(description_char, description_str.c_str()); + strcpy_trunc(description_char, description_str); *memInfo = SceNpClansMemberEntry { @@ -523,7 +523,7 @@ namespace clan std::string description_str = info.child("description").text().as_string(); char description_char[256] = {0}; - strcpy_trunc(description_char, description_str.c_str()); + strcpy_trunc(description_char, description_str); SceNpClansMemberEntry entry = SceNpClansMemberEntry { @@ -689,8 +689,8 @@ namespace clan .reserved = {0, 0}, }; - strcpy_trunc(entry.name, name_str.c_str()); - strcpy_trunc(entry.tag, tag_str.c_str()); + strcpy_trunc(entry.name, name_str); + strcpy_trunc(entry.tag, tag_str); clanList[i] = entry; i++; @@ -973,8 +973,8 @@ namespace clan .postedBy = clanId, }; - strcpy_trunc(entry.message.subject, subject_str.c_str()); - strcpy_trunc(entry.message.body, msg_str.c_str()); + strcpy_trunc(entry.message.subject, subject_str); + strcpy_trunc(entry.message.body, msg_str); announcements[i] = entry; i++; diff --git a/rpcs3/Emu/NP/clans_client.h b/rpcs3/Emu/NP/clans_client.h index 57aadad3b4..1d4b8b06c0 100644 --- a/rpcs3/Emu/NP/clans_client.h +++ b/rpcs3/Emu/NP/clans_client.h @@ -116,5 +116,5 @@ namespace clan struct sce_np_clans_manager { atomic_t is_initialized = false; - clan::clans_client* client; + std::shared_ptr client; };