VERY experimental Nintendo Switch 2 emulator
C++
Refactored profile manager sharing
David Marcec56aa6b1c1497
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cppindex e74379a241..22e44368a4 100644--- a/src/core/hle/service/acc/acc.cpp+++ b/src/core/hle/service/acc/acc.cpp@@ -197,17 +197,18 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCoLOG_DEBUG(Service_ACC, "called");}-Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)- : ServiceFramework(name), module(std::move(module)) {- profile_manager = std::make_unique<ProfileManager>();-}+Module::Interface::Interface(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager, const char* name)+ : ServiceFramework(name), module(std::move(module)),+ profile_manager(std::make_shared<ProfileManager>(*profile_manager)) {}void InstallInterfaces(SM::ServiceManager& service_manager) {auto module = std::make_shared<Module>();- std::make_shared<ACC_AA>(module)->InstallAsService(service_manager);- std::make_shared<ACC_SU>(module)->InstallAsService(service_manager);- std::make_shared<ACC_U0>(module)->InstallAsService(service_manager);- std::make_shared<ACC_U1>(module)->InstallAsService(service_manager);+ auto profile_manager = std::make_shared<ProfileManager>();+ std::make_shared<ACC_AA>(module, profile_manager)->InstallAsService(service_manager);+ std::make_shared<ACC_SU>(module, profile_manager)->InstallAsService(service_manager);+ std::make_shared<ACC_U0>(module, profile_manager)->InstallAsService(service_manager);+ std::make_shared<ACC_U1>(module, profile_manager)->InstallAsService(service_manager);}} // namespace Service::Accountdiff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.hindex 89d92c1c7c..a94e6f5886 100644--- a/src/core/hle/service/acc/acc.h+++ b/src/core/hle/service/acc/acc.h@@ -13,7 +13,8 @@ class Module final {public:class Interface : public ServiceFramework<Interface> {public:- explicit Interface(std::shared_ptr<Module> module, const char* name);+ explicit Interface(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager, const char* name);void GetUserCount(Kernel::HLERequestContext& ctx);void GetUserExistence(Kernel::HLERequestContext& ctx);@@ -25,11 +26,9 @@ public:void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx);void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx);- private:- std::unique_ptr<ProfileManager> profile_manager{};-protected:std::shared_ptr<Module> module;+ std::shared_ptr<ProfileManager> profile_manager;};};diff --git a/src/core/hle/service/acc/acc_aa.cpp b/src/core/hle/service/acc/acc_aa.cppindex 280b3e464e..9bd595a37b 100644--- a/src/core/hle/service/acc/acc_aa.cpp+++ b/src/core/hle/service/acc/acc_aa.cpp@@ -6,7 +6,8 @@namespace Service::Account {-ACC_AA::ACC_AA(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "acc:aa") {+ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager)+ : Module::Interface(std::move(module), std::move(profile_manager), "acc:aa") {static const FunctionInfo functions[] = {{0, nullptr, "EnsureCacheAsync"},{1, nullptr, "LoadCache"},diff --git a/src/core/hle/service/acc/acc_aa.h b/src/core/hle/service/acc/acc_aa.hindex 796f7ef85d..2e08c781a6 100644--- a/src/core/hle/service/acc/acc_aa.h+++ b/src/core/hle/service/acc/acc_aa.h@@ -10,7 +10,8 @@ namespace Service::Account {class ACC_AA final : public Module::Interface {public:- explicit ACC_AA(std::shared_ptr<Module> module);+ explicit ACC_AA(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager);};} // namespace Service::Accountdiff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cppindex 5973768bea..0218ee8595 100644--- a/src/core/hle/service/acc/acc_su.cpp+++ b/src/core/hle/service/acc/acc_su.cpp@@ -6,7 +6,8 @@namespace Service::Account {-ACC_SU::ACC_SU(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "acc:su") {+ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager)+ : Module::Interface(std::move(module), std::move(profile_manager), "acc:su") {static const FunctionInfo functions[] = {{0, &ACC_SU::GetUserCount, "GetUserCount"},{1, &ACC_SU::GetUserExistence, "GetUserExistence"},diff --git a/src/core/hle/service/acc/acc_su.h b/src/core/hle/service/acc/acc_su.hindex 3894a6991b..79a47d88d1 100644--- a/src/core/hle/service/acc/acc_su.h+++ b/src/core/hle/service/acc/acc_su.h@@ -11,7 +11,8 @@ namespace Account {class ACC_SU final : public Module::Interface {public:- explicit ACC_SU(std::shared_ptr<Module> module);+ explicit ACC_SU(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager);};} // namespace Accountdiff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cppindex b6fe45dd8d..84a4d05b89 100644--- a/src/core/hle/service/acc/acc_u0.cpp+++ b/src/core/hle/service/acc/acc_u0.cpp@@ -6,7 +6,8 @@namespace Service::Account {-ACC_U0::ACC_U0(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "acc:u0") {+ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager)+ : Module::Interface(std::move(module), std::move(profile_manager), "acc:u0") {static const FunctionInfo functions[] = {{0, &ACC_U0::GetUserCount, "GetUserCount"},{1, &ACC_U0::GetUserExistence, "GetUserExistence"},diff --git a/src/core/hle/service/acc/acc_u0.h b/src/core/hle/service/acc/acc_u0.hindex 6ded596b32..e8a114f996 100644--- a/src/core/hle/service/acc/acc_u0.h+++ b/src/core/hle/service/acc/acc_u0.h@@ -10,7 +10,8 @@ namespace Service::Account {class ACC_U0 final : public Module::Interface {public:- explicit ACC_U0(std::shared_ptr<Module> module);+ explicit ACC_U0(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager);};} // namespace Service::Accountdiff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cppindex 99e3f1ef6c..4956939498 100644--- a/src/core/hle/service/acc/acc_u1.cpp+++ b/src/core/hle/service/acc/acc_u1.cpp@@ -6,7 +6,8 @@namespace Service::Account {-ACC_U1::ACC_U1(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "acc:u1") {+ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager)+ : Module::Interface(std::move(module), std::move(profile_manager), "acc:u1") {static const FunctionInfo functions[] = {{0, &ACC_U1::GetUserCount, "GetUserCount"},{1, &ACC_U1::GetUserExistence, "GetUserExistence"},diff --git a/src/core/hle/service/acc/acc_u1.h b/src/core/hle/service/acc/acc_u1.hindex 5e3e7659b8..a77520e6f1 100644--- a/src/core/hle/service/acc/acc_u1.h+++ b/src/core/hle/service/acc/acc_u1.h@@ -10,7 +10,8 @@ namespace Service::Account {class ACC_U1 final : public Module::Interface {public:- explicit ACC_U1(std::shared_ptr<Module> module);+ explicit ACC_U1(std::shared_ptr<Module> module,+ std::shared_ptr<ProfileManager> profile_manager);};} // namespace Service::Account