diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 087fd796c6..c0e52b71a7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -388,14 +388,6 @@ add_library(core STATIC hle/result.h hle/service/acc/acc.cpp hle/service/acc/acc.h - hle/service/acc/acc_aa.cpp - hle/service/acc/acc_aa.h - hle/service/acc/acc_su.cpp - hle/service/acc/acc_su.h - hle/service/acc/acc_u0.cpp - hle/service/acc/acc_u0.h - hle/service/acc/acc_u1.cpp - hle/service/acc/acc_u1.h hle/service/acc/async_context.cpp hle/service/acc/async_context.h hle/service/acc/errors.h @@ -768,8 +760,8 @@ add_library(core STATIC hle/service/mii/types/ver3_store_data.h hle/service/mm/mm_u.cpp hle/service/mm/mm_u.h - hle/service/mnpp/mnpp_app.cpp - hle/service/mnpp/mnpp_app.h + hle/service/mnpp/mnpp.cpp + hle/service/mnpp/mnpp.h hle/service/ncm/ncm.cpp hle/service/ncm/ncm.h hle/service/nfc/common/amiibo_crypto.cpp diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 9a8324fbf9..37826b0752 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -21,10 +21,6 @@ #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.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/async_context.h" #include "core/hle/service/acc/errors.h" #include "core/hle/service/acc/profile_manager.h" @@ -1244,19 +1240,416 @@ Module::Interface::Interface(std::shared_ptr module_, Module::Interface::~Interface() = default; +class ACC_AA final : public Module::Interface { +public: + explicit ACC_AA(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnsureCacheAsync"}, + {1, nullptr, "LoadCache"}, + {2, nullptr, "GetDeviceAccountId"}, + {50, nullptr, "RegisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 + {51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 + }; + // clang-format on + RegisterHandlers(functions); + } + ~ACC_AA() override = default; +}; + +class ACC_SU final : public Module::Interface { +public: + explicit ACC_SU(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_SU::GetUserCount, "GetUserCount"}, + {1, &ACC_SU::GetUserExistence, "GetUserExistence"}, + {2, &ACC_SU::ListAllUsers, "ListAllUsers"}, + {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_SU::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + {52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, // 19.0.0+ + {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, + {150, nullptr, "AuthenticateApplicationAsync"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {190, nullptr, "GetUserLastOpenedApplication"}, + {191, nullptr, "ActivateOpenContextHolder"}, + {200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, + {201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, + {202, nullptr, "CancelUserRegistration"}, + {203, &ACC_SU::DeleteUser, "DeleteUser"}, + {204, &ACC_SU::SetUserPosition, "SetUserPosition"}, + {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, + {206, nullptr, "CompleteUserRegistrationForcibly"}, + {210, nullptr, "CreateFloatingRegistrationRequest"}, + {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + {230, nullptr, "AuthenticateServiceAsync"}, + {250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, + {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + {299, nullptr, "SuspendBackgroundDaemon"}, + {400, nullptr, "SetPinCode"}, // 18.0.0+ + {401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ + {402, nullptr, "GetPinCode"}, // 18.0.0+ + {403, nullptr, "GetPinCodeParity"}, + {404, nullptr, "VerifyPinCode"}, + {405, nullptr, "IsPinCodeVerificationForbidden"}, + {410, nullptr, "GetPinCodeErrorCount"}, // 18.0.0+ + {411, nullptr, "ResetPinCodeErrorCount"}, // 18.0.0+ + {412, nullptr, "IncrementPinCodeErrorCount"}, // 18.0.0+ + {900, nullptr, "SetUserUnqualifiedForDebug"}, + {901, nullptr, "UnsetUserUnqualifiedForDebug"}, + {902, nullptr, "ListUsersUnqualifiedForDebug"}, + {910, nullptr, "RefreshFirmwareSettingsForDebug"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + ~ACC_SU() override = default; +}; + +class ACC_U0 final : public Module::Interface { +public: + ACC_U0(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_U0::GetUserCount, "GetUserCount"}, + {1, &ACC_U0::GetUserExistence, "GetUserExistence"}, + {2, &ACC_U0::ListAllUsers, "ListAllUsers"}, + {3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_U0::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, // 3.0.0+ + {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, + {52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + {60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 + {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ + {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, + {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, + {102, nullptr, "AuthenticateApplicationAsync"}, + {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ + {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {120, nullptr, "CreateGuestLoginRequest"}, + {130, nullptr, "LoadOpenContext"}, // 5.0.0+ + {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ + {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ + {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ + {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ + {160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + ~ACC_U0() override = default; +}; + +class ACC_U1 final : public Module::Interface { +public: + ACC_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ACC_U1::GetUserCount, "GetUserCount"}, + {1, &ACC_U1::GetUserExistence, "GetUserExistence"}, + {2, &ACC_U1::ListAllUsers, "ListAllUsers"}, + {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, + {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, + {5, &ACC_U1::GetProfile, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, + {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, + {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, + {150, nullptr, "AuthenticateApplicationAsync"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {190, nullptr, "GetUserLastOpenedApplication"}, + {191, nullptr, "ActivateOpenContextHolder"}, + {401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ + {402, nullptr, "GetPinCode"}, // 18.0.0+ + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + ~ACC_U1() override = default; +}; + +class DAUTH_0 final : public ServiceFramework { +public: + explicit DAUTH_0(Core::System& system_) : ServiceFramework{system_, "dauth:0"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, + {1, nullptr, "LoadAuthenticationTokenCache"}, + {2, nullptr, "InvalidateAuthenticationTokenCache"}, + {3, nullptr, "IsDeviceAuthenticationTokenCacheAvailable"}, + {10, nullptr, "EnsureEdgeTokenCacheAsync"}, + {11, nullptr, "LoadEdgeTokenCache"}, + {12, nullptr, "InvalidateEdgeTokenCache"}, + {13, nullptr, "IsEdgeTokenCacheAvailable"}, + {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"}, + {21, nullptr, "LoadApplicationAuthenticationTokenCache"}, + {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"}, + {23, nullptr, "IsApplicationAuthenticationCacheAvailable"}, + {24, nullptr, "InvalidateApplicationAuthenticationCache"}, + {30, nullptr, "EnsureGameCardAuthenticationCacheAsync"}, + {31, nullptr, "LoadGameCardAuthenticationTokenCache"}, + {32, nullptr, "IsGameCardAuthenticationCacheAvailable"}, + {33, nullptr, "InvalidateGameCardAuthenticationCache"}, + {1000, nullptr, "GetInactiveElicenseUsedEvent"}, + {9000, nullptr, "ImportVirtualClientCertificate"}, + {9010, nullptr, "DeleteVirtualClientCertificate"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class ACC_E final : public Module::Interface { +public: + explicit ACC_E(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e") { + // clang-format off + static const FunctionInfo functions[] = { + { 0, nullptr, "GetUserCount"}, + { 1, nullptr, "GetUserExistence"}, + { 2, nullptr, "ListAllUsers"}, + { 3, nullptr, "ListOpenUsers"}, + { 4, nullptr, "GetLastOpenedUser"}, + { 5, nullptr, "GetProfile"}, + { 6, nullptr, "GetProfileDigest"}, + { 50, nullptr, "IsUserRegistrationRequestPermitted"}, + { 51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + { 52, nullptr, "TrySelectUserWithoutInteraction"}, + { 99, nullptr, "DebugActivateOpenContextRetention"}, + { 100, nullptr, "GetUserRegistrationNotifier"}, + { 101, nullptr, "GetUserStateChangeNotifier"}, + { 102, nullptr, "GetBaasAccountManagerForSystemService"}, + { 103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + { 104, nullptr, "GetProfileUpdateNotifier"}, + { 105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + { 106, nullptr, "GetProfileSyncNotifier"}, + { 110, nullptr, "StoreSaveDataThumbnail"}, + { 111, nullptr, "ClearSaveDataThumbnail"}, + { 112, nullptr, "LoadSaveDataThumbnail"}, + { 113, nullptr, "GetSaveDataThumbnailExistence"}, + { 120, nullptr, "ListOpenUsersInApplication"}, + { 130, nullptr, "ActivateOpenContextRetention"}, + { 140, nullptr, "ListQualifiedUsers"}, + { 151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + { 152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + { 170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + { 191, nullptr, "UpdateNotificationReceiverInfo"}, + { 200, nullptr, "BeginUserRegistration"}, + { 201, nullptr, "CompleteUserRegistration"}, + { 202, nullptr, "CancelUserRegistration"}, + { 203, nullptr, "DeleteUser"}, + { 204, nullptr, "SetUserPosition"}, + { 205, nullptr, "GetProfileEditor"}, + { 206, nullptr, "CompleteUserRegistrationForcibly"}, + { 210, nullptr, "CreateFloatingRegistrationRequest"}, + { 211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, + { 212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, + { 213, nullptr, "CreateProcedureToCreateUserWithNintendoAccount"}, + { 214, nullptr, "ResumeProcedureToCreateUserWithNintendoAccount"}, + { 215, nullptr, "ResumeProcedureToCreateUserWithNintendoAccountAfterApplyResponse"}, + { 230, nullptr, "AuthenticateServiceAsync"}, + { 250, nullptr, "GetBaasAccountAdministrator"}, + { 251, nullptr, "SynchronizeNetworkServiceAccountsSnapshotAsync"}, + { 290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, + { 291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, + { 292, nullptr, "ProxyProcedureForDeviceMigrationAuthenticatingOperatingUser"}, + { 293, nullptr, "ProxyProcedureForDeviceMigrationDownload"}, + { 299, nullptr, "SuspendBackgroundDaemon"}, + { 350, nullptr, "CreateDeviceMigrationUserExportRequest"}, + { 351, nullptr, "UploadNasCredential"}, + { 352, nullptr, "CreateDeviceMigrationUserImportRequest"}, + { 353, nullptr, "DeleteUserMigrationSaveData"}, + { 400, nullptr, "SetPinCode"}, + { 401, nullptr, "GetPinCodeLength"}, + { 402, nullptr, "GetPinCode"}, + { 403, nullptr, "GetPinCodeParity"}, + { 404, nullptr, "VerifyPinCode"}, + { 405, nullptr, "IsPinCodeVerificationForbidden"}, + { 410, nullptr, "GetPinCodeErrorCount"}, + { 411, nullptr, "ResetPinCodeErrorCount"}, + { 412, nullptr, "IncrementPinCodeErrorCount"}, + { 413, nullptr, "SetPinCodeErrorCount"}, + { 420, nullptr, "SetStartPenaltyTime"}, + { 421, nullptr, "GetStartPenaltyTime"}, + { 900, nullptr, "SetUserUnqualifiedForDebug"}, + { 901, nullptr, "UnsetUserUnqualifiedForDebug"}, + { 902, nullptr, "ListUsersUnqualifiedForDebug"}, + { 910, nullptr, "RefreshFirmwareSettingsForDebug"}, + { 997, nullptr, "DebugInvalidateTokenCacheForUser"}, + { 998, nullptr, "DebugSetUserStateClose"}, + { 999, nullptr, "DebugSetUserStateOpen"}, + { 1000, nullptr, "CreateIAccountEntityServiceForApplication"}, + { 1100, nullptr, "CreateIUserStateManager"}, + { 10050, nullptr, "IsUserRegistrationRequestPermittedForAccountPolicy"}, + { 10105, nullptr, "CheckNetworkServiceAvailabilityAsyncForAccountPolicy"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class ACC_E_U1 final : public Module::Interface { +public: + explicit ACC_E_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u1") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetUserCount"}, + {1, nullptr, "GetUserExistence"}, + {2, nullptr, "ListAllUsers"}, + {3, nullptr, "ListOpenUsers"}, + {4, nullptr, "GetLastOpenedUser"}, + {5, nullptr, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, nullptr, "IsUserRegistrationRequestPermitted"}, + {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, nullptr, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, nullptr, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, nullptr, "ListQualifiedUsers"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + {191, nullptr, "UpdateNotificationReceiverInfo"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class ACC_E_U2 final : public Module::Interface { +public: + explicit ACC_E_U2(std::shared_ptr module_, std::shared_ptr profile_manager_, Core::System& system_) + : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:e:u2") { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetUserCount"}, + {1, nullptr, "GetUserExistence"}, + {2, nullptr, "ListAllUsers"}, + {3, nullptr, "ListOpenUsers"}, + {4, nullptr, "GetLastOpenedUser"}, + {5, nullptr, "GetProfile"}, + {6, nullptr, "GetProfileDigest"}, + {50, nullptr, "#IsUserRegistrationRequestPermitted"}, + {51, nullptr, "TrySelectUserWithoutInteractionDeprecated"}, + {52, nullptr, "TrySelectUserWithoutInteraction"}, + {99, nullptr, "DebugActivateOpenContextRetention"}, + {100, nullptr, "GetUserRegistrationNotifier"}, + {101, nullptr, "GetUserStateChangeNotifier"}, + {102, nullptr, "GetBaasAccountManagerForSystemService"}, + {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, + {104, nullptr, "GetProfileUpdateNotifier"}, + {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, + {106, nullptr, "GetProfileSyncNotifier"}, + {110, nullptr, "StoreSaveDataThumbnail"}, + {111, nullptr, "ClearSaveDataThumbnail"}, + {112, nullptr, "LoadSaveDataThumbnail"}, + {113, nullptr, "GetSaveDataThumbnailExistence"}, + {120, nullptr, "ListOpenUsersInApplication"}, + {130, nullptr, "ActivateOpenContextRetention"}, + {140, nullptr, "ListQualifiedUsers"}, + {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, + {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, + {170, nullptr, "GetNasOp2MembershipStateChangeNotifier"}, + {191, nullptr, "UpdateNotificationReceiverInfo"}, + {205, nullptr, "GetProfileEditor"}, + {401, nullptr, "GetPinCodeLength"}, + {402, nullptr, "GetPinCode"}, + {403, nullptr, "GetPinCodeParity"}, + {404, nullptr, "VerifyPinCode"}, + {405, nullptr, "IsPinCodeVerificationForbidden"}, + {997, nullptr, "DebugInvalidateTokenCacheForUser"}, + {998, nullptr, "DebugSetUserStateClose"}, + {999, nullptr, "DebugSetUserStateOpen"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto module = std::make_shared(); auto profile_manager = std::make_shared(); auto server_manager = std::make_unique(system); - server_manager->RegisterNamedService("acc:aa", - std::make_shared(module, profile_manager, system)); - server_manager->RegisterNamedService("acc:su", - std::make_shared(module, profile_manager, system)); - server_manager->RegisterNamedService("acc:u0", - std::make_shared(module, profile_manager, system)); - server_manager->RegisterNamedService("acc:u1", - std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:aa", std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:su", std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:u0", std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:u1", std::make_shared(module, profile_manager, system)); + + server_manager->RegisterNamedService("acc:e", std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:e:u1", std::make_shared(module, profile_manager, system)); + server_manager->RegisterNamedService("acc:e:u2", std::make_shared(module, profile_manager, system)); + + server_manager->RegisterNamedService("dauth:0", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/acc/acc_aa.cpp b/src/core/hle/service/acc/acc_aa.cpp deleted file mode 100644 index 90ed0f5197..0000000000 --- a/src/core/hle/service/acc/acc_aa.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/acc/acc_aa.h" - -namespace Service::Account { - -ACC_AA::ACC_AA(std::shared_ptr module_, std::shared_ptr profile_manager_, - Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "EnsureCacheAsync"}, - {1, nullptr, "LoadCache"}, - {2, nullptr, "GetDeviceAccountId"}, - {50, nullptr, "RegisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 - {51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0 - }; - // clang-format on - RegisterHandlers(functions); -} - -ACC_AA::~ACC_AA() = default; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_aa.h b/src/core/hle/service/acc/acc_aa.h deleted file mode 100644 index 623daeaef0..0000000000 --- a/src/core/hle/service/acc/acc_aa.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/acc/acc.h" - -namespace Service::Account { - -class ACC_AA final : public Module::Interface { -public: - explicit ACC_AA(std::shared_ptr module_, - std::shared_ptr profile_manager_, Core::System& system_); - ~ACC_AA() override; -}; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp deleted file mode 100644 index 195af7ff69..0000000000 --- a/src/core/hle/service/acc/acc_su.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/acc/acc_su.h" - -namespace Service::Account { - -ACC_SU::ACC_SU(std::shared_ptr module_, std::shared_ptr profile_manager_, - Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_SU::GetUserCount, "GetUserCount"}, - {1, &ACC_SU::GetUserExistence, "GetUserExistence"}, - {2, &ACC_SU::ListAllUsers, "ListAllUsers"}, - {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_SU::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_SU::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - {52, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, // 19.0.0+ - {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, &ACC_SU::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, - {150, nullptr, "AuthenticateApplicationAsync"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {190, nullptr, "GetUserLastOpenedApplication"}, - {191, nullptr, "ActivateOpenContextHolder"}, - {200, &ACC_SU::BeginUserRegistration, "BeginUserRegistration"}, - {201, &ACC_SU::CompleteUserRegistration, "CompleteUserRegistration"}, - {202, nullptr, "CancelUserRegistration"}, - {203, &ACC_SU::DeleteUser, "DeleteUser"}, - {204, &ACC_SU::SetUserPosition, "SetUserPosition"}, - {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, - {206, nullptr, "CompleteUserRegistrationForcibly"}, - {210, nullptr, "CreateFloatingRegistrationRequest"}, - {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, - {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, - {230, nullptr, "AuthenticateServiceAsync"}, - {250, &ACC_SU::GetBaasAccountAdministrator, "GetBaasAccountAdministrator"}, - {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, - {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, - {299, nullptr, "SuspendBackgroundDaemon"}, - {400, nullptr, "SetPinCode"}, // 18.0.0+ - {401, &ACC_SU::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ - {402, nullptr, "GetPinCode"}, // 18.0.0+ - {410, nullptr, "GetPinCodeErrorCount"}, // 18.0.0+ - {411, nullptr, "ResetPinCodeErrorCount"}, // 18.0.0+ - {412, nullptr, "IncrementPinCodeErrorCount"}, // 18.0.0+ - {900, nullptr, "SetUserUnqualifiedForDebug"}, - {901, nullptr, "UnsetUserUnqualifiedForDebug"}, - {902, nullptr, "ListUsersUnqualifiedForDebug"}, - {910, nullptr, "RefreshFirmwareSettingsForDebug"}, - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ACC_SU::~ACC_SU() = default; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_su.h b/src/core/hle/service/acc/acc_su.h deleted file mode 100644 index 8daef38b8b..0000000000 --- a/src/core/hle/service/acc/acc_su.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/acc/acc.h" - -namespace Service::Account { - -class ACC_SU final : public Module::Interface { -public: - explicit ACC_SU(std::shared_ptr module_, - std::shared_ptr profile_manager_, Core::System& system_); - ~ACC_SU() override; -}; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp deleted file mode 100644 index df4e5ad00b..0000000000 --- a/src/core/hle/service/acc/acc_u0.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/acc/acc_u0.h" - -namespace Service::Account { - -ACC_U0::ACC_U0(std::shared_ptr module_, std::shared_ptr profile_manager_, - Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_U0::GetUserCount, "GetUserCount"}, - {1, &ACC_U0::GetUserExistence, "GetUserExistence"}, - {2, &ACC_U0::ListAllUsers, "ListAllUsers"}, - {3, &ACC_U0::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_U0::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_U0::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, // 3.0.0+ - {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_U0::TrySelectUserWithoutInteractionDeprecated, "TrySelectUserWithoutInteractionDeprecated"}, - {52, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - {60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 - {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ - {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, - {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, - {102, nullptr, "AuthenticateApplicationAsync"}, - {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ - {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {120, nullptr, "CreateGuestLoginRequest"}, - {130, nullptr, "LoadOpenContext"}, // 5.0.0+ - {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ - {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ - {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ - {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ - {160, &ACC_U0::InitializeApplicationInfoV2, "InitializeApplicationInfoV2"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ACC_U0::~ACC_U0() = default; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_u0.h b/src/core/hle/service/acc/acc_u0.h deleted file mode 100644 index 35cd4b492c..0000000000 --- a/src/core/hle/service/acc/acc_u0.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/acc/acc.h" - -namespace Service::Account { - -class ACC_U0 final : public Module::Interface { -public: - explicit ACC_U0(std::shared_ptr module_, - std::shared_ptr profile_manager_, Core::System& system_); - ~ACC_U0() override; -}; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp deleted file mode 100644 index c39e916366..0000000000 --- a/src/core/hle/service/acc/acc_u1.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/acc/acc_u1.h" - -namespace Service::Account { - -ACC_U1::ACC_U1(std::shared_ptr module_, std::shared_ptr profile_manager_, - Core::System& system_) - : Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") { - // clang-format off - static const FunctionInfo functions[] = { - {0, &ACC_U1::GetUserCount, "GetUserCount"}, - {1, &ACC_U1::GetUserExistence, "GetUserExistence"}, - {2, &ACC_U1::ListAllUsers, "ListAllUsers"}, - {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, - {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, - {5, &ACC_U1::GetProfile, "GetProfile"}, - {6, nullptr, "GetProfileDigest"}, - {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, - {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, - {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, - {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, nullptr, "GetUserRegistrationNotifier"}, - {101, nullptr, "GetUserStateChangeNotifier"}, - {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, - {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, - {104, nullptr, "GetProfileUpdateNotifier"}, - {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, - {106, nullptr, "GetProfileSyncNotifier"}, - {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, - {111, nullptr, "ClearSaveDataThumbnail"}, - {112, nullptr, "LoadSaveDataThumbnail"}, - {113, nullptr, "GetSaveDataThumbnailExistence"}, - {120, nullptr, "ListOpenUsersInApplication"}, - {130, nullptr, "ActivateOpenContextRetention"}, - {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, - {150, nullptr, "AuthenticateApplicationAsync"}, - {151, nullptr, "EnsureSignedDeviceIdentifierCacheForNintendoAccountAsync"}, - {152, nullptr, "LoadSignedDeviceIdentifierCacheForNintendoAccount"}, - {190, nullptr, "GetUserLastOpenedApplication"}, - {191, nullptr, "ActivateOpenContextHolder"}, - {401, &ACC_U1::GetPinCodeLength, "GetPinCodeLength"}, // 18.0.0+ - {402, nullptr, "GetPinCode"}, // 18.0.0+ - {997, nullptr, "DebugInvalidateTokenCacheForUser"}, - {998, nullptr, "DebugSetUserStateClose"}, - {999, nullptr, "DebugSetUserStateOpen"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -ACC_U1::~ACC_U1() = default; - -} // namespace Service::Account diff --git a/src/core/hle/service/acc/acc_u1.h b/src/core/hle/service/acc/acc_u1.h deleted file mode 100644 index e711d39252..0000000000 --- a/src/core/hle/service/acc/acc_u1.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/acc/acc.h" - -namespace Service::Account { - -class ACC_U1 final : public Module::Interface { -public: - explicit ACC_U1(std::shared_ptr module_, - std::shared_ptr profile_manager_, Core::System& system_); - ~ACC_U1() override; -}; - -} // namespace Service::Account diff --git a/src/core/hle/service/bpc/bpc.cpp b/src/core/hle/service/bpc/bpc.cpp index 91b15e256c..6fd7001821 100644 --- a/src/core/hle/service/bpc/bpc.cpp +++ b/src/core/hle/service/bpc/bpc.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -54,11 +57,58 @@ public: } }; +class BPC_C final : public ServiceFramework { +public: + explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "ShutdownSystem"}, + {1, nullptr, "RebootSystem"}, + {2, nullptr, "GetWakeupReason"}, + {3, nullptr, "GetShutdownReason"}, + {4, nullptr, "GetAcOk"}, + {5, nullptr, "GetPowerEvent"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class BPC_B final : public ServiceFramework { +public: + explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetSleepButtonState"}, + {1, nullptr, "GetPowerButtonEvent"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class BPC_W final : public ServiceFramework { +public: + explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "CreateWakeupTimer"}, + {1, nullptr, "CancelWakeupTimer"}, + {2, nullptr, "EnableWakeupTimerOnDevice"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); server_manager->RegisterNamedService("bpc", std::make_shared(system)); server_manager->RegisterNamedService("bpc:r", std::make_shared(system)); + server_manager->RegisterNamedService("bpc:c", std::make_shared(system)); + server_manager->RegisterNamedService("bpc:b", std::make_shared(system)); + server_manager->RegisterNamedService("bpc:w", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 47eedd73b2..25096ff36f 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -16,27 +19,77 @@ namespace Service::HID { +class IHidTemporaryServer final : public ServiceFramework { +public: + explicit IHidTemporaryServer(Core::System& system_) + : ServiceFramework{system_, "hid:tmp"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"}, + }; + // clang-format on + RegisterHandlers(functions); + } + ~IHidTemporaryServer() override = default; +}; + +class AHID_CD final : public ServiceFramework { +public: + explicit AHID_CD(Core::System& system_) + : ServiceFramework{system_, "ahid:cd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AcquireDevice"}, + {1, nullptr, "ReleaseDevice"}, + {2, nullptr, "GetCtrlSession"}, + {3, nullptr, "GetReadSession"}, + {4, nullptr, "GetWriteSession"}, + }; + // clang-format on + RegisterHandlers(functions); + } + ~AHID_CD() override = default; +}; + +class AHID_HDR final : public ServiceFramework { +public: + explicit AHID_HDR(Core::System& system_) + : ServiceFramework{system_, "ahid:hdr"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetDeviceEntries"}, + {1, nullptr, "GetDeviceList"}, + {2, nullptr, "GetDeviceParameters"}, + {3, nullptr, "AttachDevice"}, + {4, nullptr, "DetachDevice"}, + {5, nullptr, "SetDeviceFilter"}, + }; + // clang-format on + RegisterHandlers(functions); + } + ~AHID_HDR() override = default; +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); - std::shared_ptr firmware_settings = - std::make_shared(system); - std::shared_ptr resource_manager = - std::make_shared(system, firmware_settings); + auto firmware_settings = std::make_shared(system); + auto resource_manager = std::make_shared(system, firmware_settings); resource_manager->Initialize(); - server_manager->RegisterNamedService( - "hid", std::make_shared(system, resource_manager, firmware_settings)); - server_manager->RegisterNamedService( - "hid:dbg", std::make_shared(system, resource_manager, firmware_settings)); - server_manager->RegisterNamedService( - "hid:sys", std::make_shared(system, resource_manager, firmware_settings)); + server_manager->RegisterNamedService("hid", std::make_shared(system, resource_manager, firmware_settings)); + server_manager->RegisterNamedService("hid:dbg", std::make_shared(system, resource_manager, firmware_settings)); + server_manager->RegisterNamedService("hid:sys", std::make_shared(system, resource_manager, firmware_settings)); + server_manager->RegisterNamedService("hid:tmp", std::make_shared(system)); server_manager->RegisterNamedService("hidbus", std::make_shared(system)); server_manager->RegisterNamedService("irs", std::make_shared(system)); server_manager->RegisterNamedService("irs:sys", std::make_shared(system)); + server_manager->RegisterNamedService("ahid:cd", std::make_shared(system)); + server_manager->RegisterNamedService("ahid:hdr", std::make_shared(system)); + server_manager->RegisterNamedService("xcd:sys", std::make_shared(system)); system.RunServer(std::move(server_manager)); diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 3820e15c36..f3c01b5d89 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -38,10 +38,30 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr { +public: + explicit MNPP_SYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + {10, nullptr, "Cmd10"}, + {100, nullptr, "Cmd100"}, + {200, nullptr, "Cmd200"}, + {300, nullptr, "Cmd300"}, + {400, nullptr, "Cmd400"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + +class MNPP_WEB final : public ServiceFramework { +public: + explicit MNPP_WEB(Core::System& system_) : ServiceFramework{system_, "mnpp:web"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Cmd0"}, + {1, nullptr, "Cmd1"}, + {10, nullptr, "Cmd10"}, + {20, nullptr, "Cmd20"}, + {100, nullptr, "Cmd100"}, + }; + // clang-format on + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); server_manager->RegisterNamedService("mnpp:app", std::make_shared(system)); + server_manager->RegisterNamedService("mnpp:sys", std::make_shared(system)); + server_manager->RegisterNamedService("mnpp:web", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/mnpp/mnpp_app.h b/src/core/hle/service/mnpp/mnpp.h similarity index 100% rename from src/core/hle/service/mnpp/mnpp_app.h rename to src/core/hle/service/mnpp/mnpp.h diff --git a/src/core/hle/service/services.cpp b/src/core/hle/service/services.cpp index 28eb618090..01fce2ac00 100644 --- a/src/core/hle/service/services.cpp +++ b/src/core/hle/service/services.cpp @@ -37,7 +37,7 @@ #include "core/hle/service/mig/mig.h" #include "core/hle/service/mii/mii.h" #include "core/hle/service/mm/mm_u.h" -#include "core/hle/service/mnpp/mnpp_app.h" +#include "core/hle/service/mnpp/mnpp.h" #include "core/hle/service/ncm/ncm.h" #include "core/hle/service/nfc/nfc.h" #include "core/hle/service/nfp/nfp.h" diff --git a/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp b/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp index a80f8271f9..e84f38f2e9 100644 --- a/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp +++ b/src/hid_core/resources/abstracted_pad/abstract_battery_handler.cpp @@ -53,12 +53,11 @@ Result NpadAbstractBatteryHandler::DecrementRefCounter() { Result NpadAbstractBatteryHandler::UpdateBatteryState(u64 aruid) { const auto npad_index = NpadIdTypeToIndex(properties_handler->GetNpadId()); AruidData* aruid_data = applet_resource_holder->applet_resource->GetAruidData(aruid); - if (aruid_data == nullptr) { + if (aruid_data == nullptr || aruid_data->shared_memory_format == nullptr) { return ResultSuccess; } - auto& npad_internal_state = - aruid_data->shared_memory_format->npad.npad_entry[npad_index].internal_state; + auto& npad_internal_state = aruid_data->shared_memory_format->npad.npad_entry[npad_index].internal_state; auto& system_properties = npad_internal_state.system_properties; system_properties.is_charging_joy_dual.Assign(dual_battery.is_charging); diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index a2fd23b534..e7a1ee2bf3 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -80,7 +80,11 @@ Result NPad::Activate(u64 aruid) { std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex}; auto* data = applet_resource_holder.applet_resource->GetAruidData(aruid); - const auto aruid_index = applet_resource_holder.applet_resource->GetIndexFromAruid(aruid); + auto aruid_index = applet_resource_holder.applet_resource->GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + LOG_ERROR(Service_HID, "Invalid aruid:{:016X}", aruid); + aruid_index = 0; + } if (data == nullptr || !data->flag.is_assigned) { return ResultSuccess; @@ -1099,13 +1103,16 @@ Result NPad::RegisterAppletResourceUserId(u64 aruid) { void NPad::UnregisterAppletResourceUserId(u64 aruid) { // TODO: Remove this once abstract pad is emulated properly - const auto aruid_index = npad_resource.GetIndexFromAruid(aruid); + auto aruid_index = npad_resource.GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + LOG_ERROR(Service_HID, "Invalid aruid:{:016X}", aruid); + aruid_index = 0; + } for (auto& controller : controller_data[aruid_index]) { controller.is_active = false; controller.is_connected = false; controller.shared_memory = nullptr; } - npad_resource.UnregisterAppletResourceUserId(aruid); } diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp index 54f7acab12..a1b483d7b8 100644 --- a/src/hid_core/resources/npad/npad_resource.cpp +++ b/src/hid_core/resources/npad/npad_resource.cpp @@ -71,6 +71,9 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) { void NPadResource::UnregisterAppletResourceUserId(u64 aruid) { const u64 aruid_index = GetIndexFromAruid(aruid); + if (aruid_index >= AruidIndexMax) { + return; + } FreeAppletResourceId(aruid); if (aruid_index < AruidIndexMax) {