service/acc: Clean up account service implementation

- Remove unused function stubs
- Add version information comments
- Add clang-format markers
- Remove duplicate TrySelectUserWithoutInteraction function
- Fix formatting and code style
This commit is contained in:
Zephyron 2025-02-09 11:36:58 +10:00
parent 646af3c143
commit 6917a22a2c
No known key found for this signature in database
3 changed files with 82 additions and 138 deletions

View file

@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm> #include <algorithm>
@ -77,33 +76,34 @@ class IManagerForSystemService final : public ServiceFramework<IManagerForSystem
public: public:
explicit IManagerForSystemService(Core::System& system_, Common::UUID uuid) explicit IManagerForSystemService(Core::System& system_, Common::UUID uuid)
: ServiceFramework{system_, "IManagerForSystemService"}, account_id{uuid} { : ServiceFramework{system_, "IManagerForSystemService"}, account_id{uuid} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"}, {0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"},
{1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, {1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"},
{2, nullptr, "EnsureIdTokenCacheAsync"}, {2, nullptr, "EnsureIdTokenCacheAsync"},
{3, nullptr, "LoadIdTokenCache"}, {3, nullptr, "LoadIdTokenCache"},
{100, nullptr, "SetSystemProgramIdentification"}, {100, nullptr, "SetSystemProgramIdentification"},
{101, nullptr, "RefreshNotificationTokenAsync"}, {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+
{110, nullptr, "GetServiceEntryRequirementCache"}, {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+
{111, nullptr, "InvalidateServiceEntryRequirementCache"}, {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+
{112, nullptr, "InvalidateTokenCache"}, {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0
{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+
{120, D<&IManagerForSystemService::GetNintendoAccountId>, "GetNintendoAccountId"}, {120, nullptr, "GetNintendoAccountId"},
{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+
{130, D<&IManagerForSystemService::GetNintendoAccountUserResourceCache>, "GetNintendoAccountUserResourceCache"}, {130, nullptr, "GetNintendoAccountUserResourceCache"},
{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"},
{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"},
{133, nullptr, "GetNintendoAccountVerificationUrlCache"}, {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+
{134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, {134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+
{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+
{140, nullptr, "GetNetworkServiceLicenseCache"}, {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
{143, D<&IManagerForSystemService::GetNetworkServiceLicenseCacheEx>, "GetNetworkServiceLicenseCacheEx"},
{150, nullptr, "CreateAuthorizationRequest"}, {150, nullptr, "CreateAuthorizationRequest"},
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -120,28 +120,6 @@ private:
R_SUCCEED(); R_SUCCEED();
} }
Result GetNetworkServiceLicenseCacheEx() {
LOG_DEBUG(Service_ACC, "(STUBBED) called.");
R_THROW(ResultUnknown);
}
void GetNintendoAccountId(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Returns a u64 Nintendo Account ID
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push<u64>(0); // Nintendo Account ID stub
}
void GetNintendoAccountUserResourceCache(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Takes buffer of type 0x6 (out buffer) for NintendoAccountUserResourceCache
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
Common::UUID account_id; Common::UUID account_id;
}; };
@ -150,6 +128,7 @@ class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegi
public: public:
explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID) explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IFloatingRegistrationRequest"} { : ServiceFramework{system_, "IFloatingRegistrationRequest"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
{12, nullptr, "GetAccountId"}, {12, nullptr, "GetAccountId"},
@ -157,13 +136,14 @@ public:
{14, nullptr, "GetNickname"}, {14, nullptr, "GetNickname"},
{15, nullptr, "GetProfileImage"}, {15, nullptr, "GetProfileImage"},
{21, nullptr, "LoadIdTokenCache"}, {21, nullptr, "LoadIdTokenCache"},
{100, nullptr, "RegisterUser"}, {100, nullptr, "RegisterUser"}, // [1.0.0-3.0.2] RegisterAsync
{101, nullptr, "RegisterUserWithUid"}, {101, nullptr, "RegisterUserWithUid"}, // [1.0.0-3.0.2] RegisterWithUidAsync
{102, nullptr, "RegisterNetworkServiceAccountAsync"}, {102, nullptr, "RegisterNetworkServiceAccountAsync"}, // 4.0.0+
{103, nullptr, "RegisterNetworkServiceAccountWithUidAsync"}, {103, nullptr, "RegisterNetworkServiceAccountWithUidAsync"}, // 4.0.0+
{110, nullptr, "SetSystemProgramIdentification"}, {110, nullptr, "SetSystemProgramIdentification"},
{111, nullptr, "EnsureIdTokenCacheAsync"}, {111, nullptr, "EnsureIdTokenCacheAsync"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -173,28 +153,29 @@ class IAdministrator final : public ServiceFramework<IAdministrator> {
public: public:
explicit IAdministrator(Core::System& system_, Common::UUID) explicit IAdministrator(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAdministrator"} { : ServiceFramework{system_, "IAdministrator"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CheckAvailability"}, {0, nullptr, "CheckAvailability"},
{1, nullptr, "GetAccountId"}, {1, nullptr, "GetAccountId"},
{2, nullptr, "EnsureIdTokenCacheAsync"}, {2, nullptr, "EnsureIdTokenCacheAsync"},
{3, nullptr, "LoadIdTokenCache"}, {3, nullptr, "LoadIdTokenCache"},
{100, nullptr, "SetSystemProgramIdentification"}, {100, nullptr, "SetSystemProgramIdentification"},
{101, nullptr, "RefreshNotificationTokenAsync"}, {101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+
{110, nullptr, "GetServiceEntryRequirementCache"}, {110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+
{111, nullptr, "InvalidateServiceEntryRequirementCache"}, {111, nullptr, "InvalidateServiceEntryRequirementCache"}, // 4.0.0+
{112, nullptr, "InvalidateTokenCache"}, {112, nullptr, "InvalidateTokenCache"}, // 4.0.0 - 6.2.0
{113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, {113, nullptr, "GetServiceEntryRequirementCacheForOnlinePlay"}, // 6.1.0+
{120, nullptr, "GetNintendoAccountId"}, {120, nullptr, "GetNintendoAccountId"},
{121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, {121, nullptr, "CalculateNintendoAccountAuthenticationFingerprint"}, // 9.0.0+
{130, nullptr, "GetNintendoAccountUserResourceCache"}, {130, nullptr, "GetNintendoAccountUserResourceCache"},
{131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"}, {131, nullptr, "RefreshNintendoAccountUserResourceCacheAsync"},
{132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"}, {132, nullptr, "RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed"},
{133, nullptr, "GetNintendoAccountVerificationUrlCache"}, {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+
{134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync"}, {134, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsync"}, // 9.0.0+
{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+
{140, nullptr, "GetNetworkServiceLicenseCache"}, {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
{143, nullptr, "GetNetworkServiceLicenseCacheEx"}, {143, nullptr, "GetNetworkServiceLicenseCacheEx"},
{150, nullptr, "CreateAuthorizationRequest"}, {150, nullptr, "CreateAuthorizationRequest"},
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
@ -211,18 +192,19 @@ public:
{252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"}, {252, nullptr, "ResumeProcedureToLinkWithNintendoAccount"},
{255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"}, {255, nullptr, "CreateProcedureToUpdateLinkageStateOfNintendoAccount"},
{256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"}, {256, nullptr, "ResumeProcedureToUpdateLinkageStateOfNintendoAccount"},
{260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount"}, {260, nullptr, "CreateProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+
{261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount"}, {261, nullptr, "ResumeProcedureToLinkNnidWithNintendoAccount"}, // 3.0.0+
{280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"}, {280, nullptr, "ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount"},
{290, nullptr, "GetRequestForNintendoAccountUserResourceView"}, {290, nullptr, "GetRequestForNintendoAccountUserResourceView"}, // 8.0.0+
{300, nullptr, "TryRecoverNintendoAccountUserStateAsync"}, {300, nullptr, "TryRecoverNintendoAccountUserStateAsync"}, // 6.0.0+
{400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay"}, {400, nullptr, "IsServiceEntryRequirementCacheRefreshRequiredForOnlinePlay"}, // 6.1.0+
{401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync"}, {401, nullptr, "RefreshServiceEntryRequirementCacheForOnlinePlayAsync"}, // 6.1.0+
{900, nullptr, "GetAuthenticationInfoForWin"}, {900, nullptr, "GetAuthenticationInfoForWin"}, // 9.0.0+
{901, nullptr, "ImportAsyncForWin"}, {901, nullptr, "ImportAsyncForWin"}, // 9.0.0+
{997, nullptr, "DebugUnlinkNintendoAccountAsync"}, {997, nullptr, "DebugUnlinkNintendoAccountAsync"},
{998, nullptr, "DebugSetAvailabilityErrorDetail"}, {998, nullptr, "DebugSetAvailabilityErrorDetail"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -232,6 +214,7 @@ class IAuthorizationRequest final : public ServiceFramework<IAuthorizationReques
public: public:
explicit IAuthorizationRequest(Core::System& system_, Common::UUID) explicit IAuthorizationRequest(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAuthorizationRequest"} { : ServiceFramework{system_, "IAuthorizationRequest"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
{10, nullptr, "InvokeWithoutInteractionAsync"}, {10, nullptr, "InvokeWithoutInteractionAsync"},
@ -240,6 +223,7 @@ public:
{21, nullptr, "GetIdToken"}, {21, nullptr, "GetIdToken"},
{22, nullptr, "GetState"}, {22, nullptr, "GetState"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -249,6 +233,7 @@ class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> {
public: public:
explicit IOAuthProcedure(Core::System& system_, Common::UUID) explicit IOAuthProcedure(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IOAuthProcedure"} { : ServiceFramework{system_, "IOAuthProcedure"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
{1, nullptr, "GetRequest"}, {1, nullptr, "GetRequest"},
@ -256,6 +241,7 @@ public:
{3, nullptr, "ApplyResponseAsync"}, {3, nullptr, "ApplyResponseAsync"},
{10, nullptr, "Suspend"}, {10, nullptr, "Suspend"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -266,6 +252,7 @@ class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProced
public: public:
explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID) explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} { : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
{1, nullptr, "GetRequest"}, {1, nullptr, "GetRequest"},
@ -277,6 +264,7 @@ public:
{102, nullptr, "GetNickname"}, {102, nullptr, "GetNickname"},
{103, nullptr, "GetProfileImage"}, {103, nullptr, "GetProfileImage"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -287,6 +275,7 @@ class IOAuthProcedureForNintendoAccountLinkage final
public: public:
explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID) explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} { : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
{1, nullptr, "GetRequest"}, {1, nullptr, "GetRequest"},
@ -295,9 +284,10 @@ public:
{10, nullptr, "Suspend"}, {10, nullptr, "Suspend"},
{100, nullptr, "GetRequestWithTheme"}, {100, nullptr, "GetRequestWithTheme"},
{101, nullptr, "IsNetworkServiceAccountReplaced"}, {101, nullptr, "IsNetworkServiceAccountReplaced"},
{199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, {199, nullptr, "GetUrlForIntroductionOfExtraMembership"}, // 2.0.0 - 5.1.0
{200, nullptr, "ApplyAsyncWithAuthorizedToken"}, {200, nullptr, "ApplyAsyncWithAuthorizedToken"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -307,9 +297,11 @@ class INotifier final : public ServiceFramework<INotifier> {
public: public:
explicit INotifier(Core::System& system_, Common::UUID) explicit INotifier(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "INotifier"} { : ServiceFramework{system_, "INotifier"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSystemEvent"}, {0, nullptr, "GetSystemEvent"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -325,9 +317,6 @@ public:
{1, &IProfileCommon::GetBase, "GetBase"}, {1, &IProfileCommon::GetBase, "GetBase"},
{10, &IProfileCommon::GetImageSize, "GetImageSize"}, {10, &IProfileCommon::GetImageSize, "GetImageSize"},
{11, &IProfileCommon::LoadImage, "LoadImage"}, {11, &IProfileCommon::LoadImage, "LoadImage"},
{20, D<&IProfileCommon::IsLinkedWithNintendoAccount>, "IsLinkedWithNintendoAccount"},
{21, D<&IProfileCommon::GetNintendoAccountUserResourceCache>, "GetNintendoAccountUserResourceCache"},
{30, D<&IProfileCommon::GetNintendoAccountId>, "GetNintendoAccountId"}
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
@ -336,7 +325,6 @@ public:
static const FunctionInfo editor_functions[] = { static const FunctionInfo editor_functions[] = {
{100, &IProfileCommon::Store, "Store"}, {100, &IProfileCommon::Store, "Store"},
{101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, {101, &IProfileCommon::StoreWithImage, "StoreWithImage"},
{110, D<&IProfileCommon::StoreSaveDataThumbnailApplication>, "StoreSaveDataThumbnailApplication"}
}; };
RegisterHandlers(editor_functions); RegisterHandlers(editor_functions);
@ -498,42 +486,6 @@ protected:
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void GetNintendoAccountId(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Returns a u64 Nintendo Account ID
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push<u64>(0); // Nintendo Account ID stub
}
void GetNintendoAccountUserResourceCache(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Takes buffer of type 0x6 (out buffer) for NintendoAccountUserResourceCache
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IsLinkedWithNintendoAccount(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Returns bool IsLinked and u64 NintendoAccountId
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push<u64>(0); // Not linked
}
void StoreSaveDataThumbnailApplication(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called");
// Takes ApplicationId (u64) and two buffers:
// Buffer[0x19] = Thumbnail data
// Buffer[0x5] = Unknown data
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
ProfileManager& profile_manager; ProfileManager& profile_manager;
Common::UUID user_id{}; ///< The user id this profile refers to. Common::UUID user_id{}; ///< The user id this profile refers to.
}; };
@ -556,9 +508,11 @@ class ISessionObject final : public ServiceFramework<ISessionObject> {
public: public:
explicit ISessionObject(Core::System& system_, Common::UUID) explicit ISessionObject(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "ISessionObject"} { : ServiceFramework{system_, "ISessionObject"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{999, nullptr, "Dummy"}, {999, nullptr, "Dummy"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -568,6 +522,7 @@ class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> {
public: public:
explicit IGuestLoginRequest(Core::System& system_, Common::UUID) explicit IGuestLoginRequest(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IGuestLoginRequest"} { : ServiceFramework{system_, "IGuestLoginRequest"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSessionId"}, {0, nullptr, "GetSessionId"},
{11, nullptr, "Unknown"}, // 1.0.0 - 2.3.0 (the name is blank on Switchbrew) {11, nullptr, "Unknown"}, // 1.0.0 - 2.3.0 (the name is blank on Switchbrew)
@ -577,6 +532,7 @@ public:
{15, nullptr, "GetProfileImage"}, {15, nullptr, "GetProfileImage"},
{21, nullptr, "LoadIdTokenCache"}, // 3.0.0+ {21, nullptr, "LoadIdTokenCache"}, // 3.0.0+
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -616,6 +572,7 @@ public:
: ServiceFramework{system_, "IManagerForApplication"}, : ServiceFramework{system_, "IManagerForApplication"},
ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)}, ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)},
profile_manager{profile_manager_} { profile_manager{profile_manager_} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
{1, &IManagerForApplication::GetAccountId, "GetAccountId"}, {1, &IManagerForApplication::GetAccountId, "GetAccountId"},
@ -626,6 +583,7 @@ public:
{160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"}, {160, &IManagerForApplication::StoreOpenContext, "StoreOpenContext"},
{170, nullptr, "LoadNetworkServiceLicenseKindAsync"}, {170, nullptr, "LoadNetworkServiceLicenseKindAsync"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -695,6 +653,7 @@ class IAsyncNetworkServiceLicenseKindContext final
public: public:
explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID) explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} { : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetSystemEvent"}, {0, nullptr, "GetSystemEvent"},
{1, nullptr, "Cancel"}, {1, nullptr, "Cancel"},
@ -702,6 +661,7 @@ public:
{3, nullptr, "GetResult"}, {3, nullptr, "GetResult"},
{4, nullptr, "GetNetworkServiceLicenseKind"}, {4, nullptr, "GetNetworkServiceLicenseKind"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -713,6 +673,7 @@ class IOAuthProcedureForUserRegistration final
public: public:
explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID) explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} { : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "PrepareAsync"}, {0, nullptr, "PrepareAsync"},
{1, nullptr, "GetRequest"}, {1, nullptr, "GetRequest"},
@ -726,6 +687,7 @@ public:
{110, nullptr, "RegisterUserAsync"}, {110, nullptr, "RegisterUserAsync"},
{111, nullptr, "GetUid"}, {111, nullptr, "GetUid"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -734,6 +696,7 @@ public:
class DAUTH_O final : public ServiceFramework<DAUTH_O> { class DAUTH_O final : public ServiceFramework<DAUTH_O> {
public: public:
explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, {0, nullptr, "EnsureAuthenticationTokenCacheAsync"},
{1, nullptr, "LoadAuthenticationTokenCache"}, {1, nullptr, "LoadAuthenticationTokenCache"},
@ -749,6 +712,7 @@ public:
{23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, {23, nullptr, "IsApplicationAuthenticationCacheAvailable"},
{24, nullptr, "InvalidateApplicationAuthenticationCache"}, {24, nullptr, "InvalidateApplicationAuthenticationCache"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -759,12 +723,14 @@ class IAsyncResult final : public ServiceFramework<IAsyncResult> {
public: public:
explicit IAsyncResult(Core::System& system_, Common::UUID) explicit IAsyncResult(Core::System& system_, Common::UUID)
: ServiceFramework{system_, "IAsyncResult"} { : ServiceFramework{system_, "IAsyncResult"} {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetResult"}, {0, nullptr, "GetResult"},
{1, nullptr, "Cancel"}, {1, nullptr, "Cancel"},
{2, nullptr, "IsAvailable"}, {2, nullptr, "IsAvailable"},
{3, nullptr, "GetSystemEvent"}, {3, nullptr, "GetSystemEvent"},
}; };
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@ -855,7 +821,7 @@ Result Module::Interface::InitializeApplicationInfoBase() {
const auto result = system.GetARPManager().GetLaunchProperty( const auto result = system.GetARPManager().GetLaunchProperty(
&launch_property, system.GetApplicationProcessProgramID()); &launch_property, system.GetApplicationProcessProgramID());
if (result != Loader::ResultStatus::Success) { if (result != ResultSuccess) {
LOG_ERROR(Service_ACC, "Failed to get launch property"); LOG_ERROR(Service_ACC, "Failed to get launch property");
return Account::ResultInvalidApplication; return Account::ResultInvalidApplication;
} }
@ -977,13 +943,16 @@ void Module::Interface::ListOpenContextStoredUsers(HLERequestContext& ctx) {
} }
void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx) { void Module::Interface::StoreSaveDataThumbnailApplication(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "(STUBBED) called"); IPC::RequestParser rp{ctx};
const auto uuid = rp.PopRaw<Common::UUID>();
// Takes ApplicationId (u64) and two buffers: LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString());
// Buffer[0x19] = Thumbnail data
// Buffer[0x5] = Unknown data // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable
IPC::ResponseBuilder rb{ctx, 2}; // way of confirming things like the TID, we're going to assume a non zero value for the time
rb.Push(ResultSuccess); // being.
constexpr u64 tid{1};
StoreSaveDataThumbnail(ctx, uuid, tid);
} }
void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& ctx) { void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& ctx) {
@ -1033,29 +1002,6 @@ void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Com
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void Module::Interface::TrySelectUserWithoutInteractionDeprecated(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
// access to use the network or not by the looks of it
IPC::ResponseBuilder rb{ctx, 6};
if (profile_manager->GetUserCount() != 1) {
rb.Push(ResultSuccess);
rb.PushRaw(Common::InvalidUUID);
return;
}
const auto user_list = profile_manager->GetAllUsers();
if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) {
rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code
rb.PushRaw(Common::InvalidUUID);
return;
}
// Select the first user we have
rb.Push(ResultSuccess);
rb.PushRaw(profile_manager->GetUser(0)->uuid);
}
void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx) { void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
// A u8 is passed into this function which we can safely ignore. It's to determine if we have // A u8 is passed into this function which we can safely ignore. It's to determine if we have
@ -1082,8 +1028,8 @@ void Module::Interface::TrySelectUserWithoutInteraction(HLERequestContext& ctx)
Module::Interface::Interface(std::shared_ptr<Module> module_, Module::Interface::Interface(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_, std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_, const char* name) Core::System& system_, const char* name)
: ServiceFramework{system_, name}, module{std::move(module_)}, : ServiceFramework{system_, name}, module{std::move(module_)}, profile_manager{std::move(
profile_manager{std::move(profile_manager_)} {} profile_manager_)} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;

View file

@ -30,7 +30,6 @@ public:
void InitializeApplicationInfoRestricted(HLERequestContext& ctx); void InitializeApplicationInfoRestricted(HLERequestContext& ctx);
void GetBaasAccountManagerForApplication(HLERequestContext& ctx); void GetBaasAccountManagerForApplication(HLERequestContext& ctx);
void IsUserRegistrationRequestPermitted(HLERequestContext& ctx); void IsUserRegistrationRequestPermitted(HLERequestContext& ctx);
void TrySelectUserWithoutInteractionDeprecated(HLERequestContext& ctx);
void TrySelectUserWithoutInteraction(HLERequestContext& ctx); void TrySelectUserWithoutInteraction(HLERequestContext& ctx);
void IsUserAccountSwitchLocked(HLERequestContext& ctx); void IsUserAccountSwitchLocked(HLERequestContext& ctx);
void InitializeApplicationInfoV2(HLERequestContext& ctx); void InitializeApplicationInfoV2(HLERequestContext& ctx);

View file

@ -18,8 +18,7 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
{5, &ACC_SU::GetProfile, "GetProfile"}, {5, &ACC_SU::GetProfile, "GetProfile"},
{6, nullptr, "GetProfileDigest"}, {6, nullptr, "GetProfileDigest"},
{50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},
{51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"},
{52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, // 19.0.0+
{60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"},
{99, nullptr, "DebugActivateOpenContextRetention"}, {99, nullptr, "DebugActivateOpenContextRetention"},
{100, nullptr, "GetUserRegistrationNotifier"}, {100, nullptr, "GetUserRegistrationNotifier"},