From 92fcc6d15a1bf2f3db4e8409bf751a5ec08fa32e Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 7 Nov 2018 11:45:01 +1100 Subject: Implement acc:TrySelectUserWithoutInteraction Needed for Shantae - Half-Genie Hero - Ultimate Edition! --- src/core/hle/service/acc/acc.cpp | 21 +++++++++++++++++++++ src/core/hle/service/acc/acc.h | 1 + src/core/hle/service/acc/acc_su.cpp | 2 +- src/core/hle/service/acc/acc_u0.cpp | 2 +- src/core/hle/service/acc/acc_u1.cpp | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index c6437a671..870410476 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -242,6 +242,27 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo LOG_DEBUG(Service_ACC, "called"); } +void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { + // A u8 is passed into this function which we can safely ignore. It's to determain if we have + // access to use the network or not by the looks of it + IPC::ResponseBuilder rb{ctx, 6}; + if (profile_manager->GetUserCount() != 1) { + rb.Push(RESULT_SUCCESS); + rb.PushRaw(INVALID_UUID); + return; + } + auto user_list = profile_manager->GetAllUsers(); + if (user_list.empty()) { + rb.Push(ResultCode(-1)); // TODO(ogniK): Find the correct error code + rb.PushRaw(INVALID_UUID); + return; + } + + // Select the first user we have + rb.Push(RESULT_SUCCESS); + rb.PushRaw(profile_manager->GetUser(0)->uuid); +} + Module::Interface::Interface(std::shared_ptr module, std::shared_ptr profile_manager, const char* name) : ServiceFramework(name), module(std::move(module)), diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index c7ed74351..89b2104fa 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -27,6 +27,7 @@ public: void InitializeApplicationInfo(Kernel::HLERequestContext& ctx); void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx); void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); + void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); protected: std::shared_ptr module; diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp index ad455c3a7..5e2030355 100644 --- a/src/core/hle/service/acc/acc_su.cpp +++ b/src/core/hle/service/acc/acc_su.cpp @@ -17,7 +17,7 @@ ACC_SU::ACC_SU(std::shared_ptr module, std::shared_ptr p {5, &ACC_SU::GetProfile, "GetProfile"}, {6, nullptr, "GetProfileDigest"}, {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, nullptr, "TrySelectUserWithoutInteraction"}, + {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, {60, nullptr, "ListOpenContextStoredUsers"}, {100, nullptr, "GetUserRegistrationNotifier"}, {101, nullptr, "GetUserStateChangeNotifier"}, diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index 72d4adf35..a4d705b45 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp @@ -17,7 +17,7 @@ ACC_U0::ACC_U0(std::shared_ptr module, std::shared_ptr p {5, &ACC_U0::GetProfile, "GetProfile"}, {6, nullptr, "GetProfileDigest"}, {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, nullptr, "TrySelectUserWithoutInteraction"}, + {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, {60, nullptr, "ListOpenContextStoredUsers"}, {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp index d480f08e5..8fffc93b5 100644 --- a/src/core/hle/service/acc/acc_u1.cpp +++ b/src/core/hle/service/acc/acc_u1.cpp @@ -17,7 +17,7 @@ ACC_U1::ACC_U1(std::shared_ptr module, std::shared_ptr p {5, &ACC_U1::GetProfile, "GetProfile"}, {6, nullptr, "GetProfileDigest"}, {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, nullptr, "TrySelectUserWithoutInteraction"}, + {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, {60, nullptr, "ListOpenContextStoredUsers"}, {100, nullptr, "GetUserRegistrationNotifier"}, {101, nullptr, "GetUserStateChangeNotifier"}, -- cgit v1.2.3 From 49cb4fa37b297a8d9a92209a2d7b5bdb16baa424 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 7 Nov 2018 11:46:04 +1100 Subject: Added missing log --- src/core/hle/service/acc/acc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 870410476..18c68e69a 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -243,6 +243,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo } 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 determain if we have // access to use the network or not by the looks of it IPC::ResponseBuilder rb{ctx, 6}; -- cgit v1.2.3 From ad45d688714f53fbceb83bad1e00a6d55f473b00 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 7 Nov 2018 12:04:43 +1100 Subject: fixed spelling error --- src/core/hle/service/acc/acc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 18c68e69a..8318eff5f 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -244,7 +244,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo 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 determain if we have + // A u8 is passed into this function which we can safely ignore. It's to determine if we have // access to use the network or not by the looks of it IPC::ResponseBuilder rb{ctx, 6}; if (profile_manager->GetUserCount() != 1) { -- cgit v1.2.3