From 335127af6921ce298a6dd63682895768c6b06e86 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 19:06:33 +1000 Subject: Impl'd IsUserAccountSwitchLocked, SetAudioOutVolume, GetAudioOutVolume & Partial impl of GetAccumulatedSuspendedTickChangedEvent IPC-100 was changed to InitializeApplicationInfoOld instead of InitializeApplicationInfo. IPC-150 makes an indentical call to IPC-100 however does extra processing. They should not have the same name as it's quite confusing to debug. --- src/core/hle/service/acc/acc.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service/acc/acc.cpp') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index cb66e344b..7a4fd636b 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -12,13 +12,17 @@ #include "common/swap.h" #include "core/constants.h" #include "core/core_timing.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/patch_manager.h" #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/process.h" #include "core/hle/service/acc/acc.h" #include "core/hle/service/acc/acc_aa.h" #include "core/hle/service/acc/acc_su.h" #include "core/hle/service/acc/acc_u0.h" #include "core/hle/service/acc/acc_u1.h" #include "core/hle/service/acc/profile_manager.h" +#include "core/loader/loader.h" namespace Service::Account { @@ -213,7 +217,7 @@ void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestCon rb.Push(profile_manager->CanSystemRegisterUser()); } -void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { +void Module::Interface::InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -226,6 +230,29 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo rb.PushIpcInterface(); } +void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + FileSys::NACP nacp; + const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); + + bool is_locked = false; + + if (res != Loader::ResultStatus::Success) { + FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; + auto [nacp_unique, discard] = pm.GetControlMetadata(); + + if (nacp_unique != nullptr) { + is_locked = nacp_unique->GetUserAccountSwitchLock(); + } + } else { + is_locked = nacp.GetUserAccountSwitchLock(); + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw(is_locked); +} + void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); // A u8 is passed into this function which we can safely ignore. It's to determine if we have -- cgit v1.2.3 From 5fb6781c6104a618ee366c444725e32765a0c534 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 20:18:35 +1000 Subject: Cleanup --- src/core/hle/service/acc/acc.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service/acc/acc.cpp') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 7a4fd636b..f02f54f91 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -233,13 +233,13 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); FileSys::NACP nacp; - const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); + const auto res = system.GetAppLoader().ReadControlData(nacp); bool is_locked = false; if (res != Loader::ResultStatus::Success) { - FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; - auto [nacp_unique, discard] = pm.GetControlMetadata(); + FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()}; + auto nacp_unique = pm.GetControlMetadata().first; if (nacp_unique != nullptr) { is_locked = nacp_unique->GetUserAccountSwitchLock(); @@ -250,7 +250,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.PushRaw(is_locked); + rb.Push(is_locked); } void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { @@ -278,19 +278,22 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex } Module::Interface::Interface(std::shared_ptr module, - std::shared_ptr profile_manager, const char* name) + std::shared_ptr profile_manager, Core::System& system, + const char* name) : ServiceFramework(name), module(std::move(module)), - profile_manager(std::move(profile_manager)) {} + profile_manager(std::move(profile_manager)), system(system) {} Module::Interface::~Interface() = default; void InstallInterfaces(SM::ServiceManager& service_manager) { auto module = std::make_shared(); auto profile_manager = std::make_shared(); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); + Core::System& system = Core::System::GetInstance(); + + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); } } // namespace Service::Account -- cgit v1.2.3 From 6ca20ad7ba594fd01c01e8d56e5e02d84609d9e1 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Mon, 17 Jun 2019 08:17:26 +1000 Subject: Addressed issues --- src/core/hle/service/acc/acc.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/core/hle/service/acc/acc.cpp') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f02f54f91..025714e5a 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -243,6 +243,8 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx if (nacp_unique != nullptr) { is_locked = nacp_unique->GetUserAccountSwitchLock(); + } else { + LOG_ERROR(Service_ACC, "nacp_unique is null!"); } } else { is_locked = nacp.GetUserAccountSwitchLock(); @@ -285,15 +287,18 @@ Module::Interface::Interface(std::shared_ptr module, Module::Interface::~Interface() = default; -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(Core::System& system) { auto module = std::make_shared(); auto profile_manager = std::make_shared(); - Core::System& system = Core::System::GetInstance(); - std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); - std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); - std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); - std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); } } // namespace Service::Account -- cgit v1.2.3