From 61c4ad6d89b805a115078adadbf0ce4ee2c50542 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 26 Sep 2026 11:22:33 +0000 Subject: [PATCH] 2026-09-26 11:22:33 Signed-off-by: lizzie --- .../am/service/application_functions.cpp | 19 +- .../am/service/application_functions.h | 1 + src/core/hle/service/am/service/storage.cpp | 14 +- src/core/hle/service/am/service/storage.h | 1 + .../service/am/service/storage_accessor.cpp | 30 +- .../hle/service/am/service/storage_accessor.h | 2 + src/core/hle/service/apm/apm_interface.cpp | 14 - src/core/hle/service/apm/apm_interface.h | 13 + .../hle/service/audio/audio_controller.cpp | 18 +- src/core/hle/service/audio/audio_controller.h | 2 +- src/core/hle/service/audio/audio_device.cpp | 18 +- src/core/hle/service/audio/audio_device.h | 1 + src/core/hle/service/bcat/bcat_service.cpp | 75 ++-- src/core/hle/service/bcat/bcat_service.h | 1 + .../hle/service/bcat/news/news_service.cpp | 14 +- src/core/hle/service/bcat/news/news_service.h | 9 +- src/core/hle/service/fatal/fatal.cpp | 31 +- src/core/hle/service/fatal/fatal_p.cpp | 14 - src/core/hle/service/fatal/fatal_p.h | 24 -- src/core/hle/service/fatal/fatal_u.cpp | 20 -- src/core/hle/service/fatal/fatal_u.h | 16 - .../hle/service/filesystem/fsp/fsp_srv.cpp | 17 +- src/core/hle/service/filesystem/fsp/fsp_srv.h | 1 + src/core/hle/service/glue/arp.cpp | 25 -- src/core/hle/service/glue/arp.h | 23 ++ src/core/hle/service/glue/bgtc.cpp | 10 +- src/core/hle/service/glue/bgtc.h | 6 + src/core/hle/service/hid/hid.cpp | 335 +++++++++++++++++- src/core/hle/service/hid/hid_debug_server.cpp | 294 --------------- src/core/hle/service/hid/hid_debug_server.h | 26 -- src/core/hle/service/hid/hid_server.cpp | 18 +- src/core/hle/service/hid/hid_server.h | 2 + .../hle/service/hid/hid_system_server.cpp | 246 ------------- src/core/hle/service/hid/hid_system_server.h | 246 +++++++++++++ src/core/hle/service/hid/irs.cpp | 14 +- src/core/hle/service/hid/irs.h | 2 + .../ns/application_manager_interface.cpp | 26 +- .../ns/application_manager_interface.h | 1 + .../hle/service/olsc/daemon_controller.cpp | 16 +- src/core/hle/service/olsc/daemon_controller.h | 2 + src/core/hle/service/service.h | 19 +- src/core/hle/service/sm/sm_controller.cpp | 9 - src/core/hle/service/sm/sm_controller.h | 12 + 43 files changed, 812 insertions(+), 875 deletions(-) delete mode 100644 src/core/hle/service/fatal/fatal_p.cpp delete mode 100644 src/core/hle/service/fatal/fatal_p.h delete mode 100644 src/core/hle/service/fatal/fatal_u.cpp delete mode 100644 src/core/hle/service/fatal/fatal_u.h diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 65a84259a7..b8b68055b5 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -51,10 +51,8 @@ FileSys::PatchManager::Metadata GetApplicationMetadata(Core::System& system, u64 } // Anonymous namespace -IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ptr applet) - : ServiceFramework{system_, "IApplicationFunctions"}, m_applet{std::move(applet)} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IApplicationFunctions::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{1, D<&IApplicationFunctions::PopLaunchParameter>, "PopLaunchParameter"}, FunctionInfo{10, nullptr, "CreateApplicationAndPushAndRequestToStart"}, FunctionInfo{11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"}, @@ -122,13 +120,16 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ FunctionInfo{330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] FunctionInfo{500, nullptr, "StartContinuousRecordingFlushForDebug"}, FunctionInfo{1000, nullptr, "CreateMovieMaker"}, - FunctionInfo{1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"}, - }; - // clang-format on - - RegisterHandlers(functions); + FunctionInfo{1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"} + ); + return HandlerTableGenerateWithFind(key, functions); } +IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ptr applet) + : ServiceFramework{system_, "IApplicationFunctions"} + , m_applet{std::move(applet)} +{} + IApplicationFunctions::~IApplicationFunctions() = default; Result IApplicationFunctions::PopLaunchParameter(Out> out_storage, diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.h index b97ed7e25e..83f16877b3 100644 --- a/src/core/hle/service/am/service/application_functions.h +++ b/src/core/hle/service/am/service/application_functions.h @@ -84,6 +84,7 @@ private: Result GetUnknownEvent210(OutCopyHandle out_event); Result Unknown330(Out out); Result PrepareForJit(); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/storage.cpp b/src/core/hle/service/am/service/storage.cpp index d9aaa9cf0c..9b51933881 100644 --- a/src/core/hle/service/am/service/storage.cpp +++ b/src/core/hle/service/am/service/storage.cpp @@ -12,14 +12,16 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* IStorage::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStorage::Open>, "Open"}, + FunctionInfo{1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IStorage::IStorage(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorage"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - FunctionInfo{0, D<&IStorage::Open>, "Open"}, - FunctionInfo{1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"}, - }; - - RegisterHandlers(functions); } IStorage::IStorage(Core::System& system_, std::vector&& data) diff --git a/src/core/hle/service/am/service/storage.h b/src/core/hle/service/am/service/storage.h index cde2ed0ead..e6693d5a74 100644 --- a/src/core/hle/service/am/service/storage.h +++ b/src/core/hle/service/am/service/storage.h @@ -29,6 +29,7 @@ private: Result OpenTransferStorage( Out> out_transfer_storage_accessor); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_impl; }; diff --git a/src/core/hle/service/am/service/storage_accessor.cpp b/src/core/hle/service/am/service/storage_accessor.cpp index b747f4cbbb..a461cf60c4 100644 --- a/src/core/hle/service/am/service/storage_accessor.cpp +++ b/src/core/hle/service/am/service/storage_accessor.cpp @@ -8,16 +8,18 @@ namespace Service::AM { +ServiceFrameworkBase::FunctionInfoBase const* IStorageAccessor::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&IStorageAccessor::GetSize>, "GetSize"}, + FunctionInfo{10, D<&IStorageAccessor::Write>, "Write"}, + FunctionInfo{11, D<&IStorageAccessor::Read>, "Read"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + IStorageAccessor::IStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - FunctionInfo{0, D<&IStorageAccessor::GetSize>, "GetSize"}, - FunctionInfo{10, D<&IStorageAccessor::Write>, "Write"}, - FunctionInfo{11, D<&IStorageAccessor::Read>, "Read"}, - }; - - RegisterHandlers(functions); } IStorageAccessor::~IStorageAccessor() = default; @@ -38,15 +40,17 @@ Result IStorageAccessor::Read(OutBuffer out_buffer, s R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size())); } +ServiceFrameworkBase::FunctionInfoBase const* ITransferStorageAccessor::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, + FunctionInfo{1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"} + ); + return HandlerTableGenerateWithFind(key, functions); +} + ITransferStorageAccessor::ITransferStorageAccessor(Core::System& system_, std::shared_ptr impl) : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} { - static const FunctionInfo functions[] = { - FunctionInfo{0, D<&ITransferStorageAccessor::GetSize>, "GetSize"}, - FunctionInfo{1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"}, - }; - - RegisterHandlers(functions); } ITransferStorageAccessor::~ITransferStorageAccessor() = default; diff --git a/src/core/hle/service/am/service/storage_accessor.h b/src/core/hle/service/am/service/storage_accessor.h index 1a01730e00..13b3b42758 100644 --- a/src/core/hle/service/am/service/storage_accessor.h +++ b/src/core/hle/service/am/service/storage_accessor.h @@ -19,6 +19,7 @@ private: Result Write(InBuffer buffer, s64 offset); Result Read(OutBuffer out_buffer, s64 offset); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_impl; }; @@ -32,6 +33,7 @@ private: Result GetSize(Out out_size); Result GetHandle(Out out_size, OutCopyHandle out_handle); + FunctionInfoBase const* FindRequest(u32 key) override; const std::shared_ptr m_impl; }; diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp index 11427fe836..b5b2b03fc4 100644 --- a/src/core/hle/service/apm/apm_interface.cpp +++ b/src/core/hle/service/apm/apm_interface.cpp @@ -96,20 +96,6 @@ void APM::IsCpuOverclockEnabled(HLERequestContext& ctx) { APM_Sys::APM_Sys(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "apm:sys"}, controller{controller_} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{0, nullptr, "RequestPerformanceMode"}, - FunctionInfo{1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, - FunctionInfo{2, nullptr, "GetThrottlingState"}, - FunctionInfo{3, nullptr, "GetLastThrottlingState"}, - FunctionInfo{4, nullptr, "ClearLastThrottlingState"}, - FunctionInfo{5, nullptr, "LoadAndApplySettings"}, - FunctionInfo{6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, - FunctionInfo{7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"}, - }; - // clang-format on - - RegisterHandlers(functions); } APM_Sys::~APM_Sys() = default; diff --git a/src/core/hle/service/apm/apm_interface.h b/src/core/hle/service/apm/apm_interface.h index b71f06d224..ba5b33ca1c 100644 --- a/src/core/hle/service/apm/apm_interface.h +++ b/src/core/hle/service/apm/apm_interface.h @@ -44,6 +44,19 @@ private: void GetPerformanceEvent(HLERequestContext& ctx); void GetCurrentPerformanceConfiguration(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "RequestPerformanceMode"}, + FunctionInfo{1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, + FunctionInfo{2, nullptr, "GetThrottlingState"}, + FunctionInfo{3, nullptr, "GetLastThrottlingState"}, + FunctionInfo{4, nullptr, "ClearLastThrottlingState"}, + FunctionInfo{5, nullptr, "LoadAndApplySettings"}, + FunctionInfo{6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, + FunctionInfo{7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"} + ); Controller& controller; }; diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp index fd2c56c14e..2951029943 100644 --- a/src/core/hle/service/audio/audio_controller.cpp +++ b/src/core/hle/service/audio/audio_controller.cpp @@ -20,10 +20,8 @@ namespace Service::Audio { -IAudioController::IAudioController(Core::System& system_) - : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IAudioController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&IAudioController::GetTargetVolume>, "GetTargetVolume"}, FunctionInfo{1, D<&IAudioController::SetTargetVolume>, "SetTargetVolume"}, FunctionInfo{2, D<&IAudioController::GetTargetVolumeMin>, "GetTargetVolumeMin"}, @@ -84,13 +82,13 @@ IAudioController::IAudioController(Core::System& system_) FunctionInfo{50001, nullptr, "OverrideDefaultTargetForDebug"}, //19.0.0-19.0.1 FunctionInfo{50003, nullptr, "SetForceOverrideExternalDeviceNameForDebug"}, //19.0.0+ FunctionInfo{50004, nullptr, "ClearForceOverrideExternalDeviceNameForDebug"} //19.0.0+ - }; - // clang-format on + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); - - m_set_sys = - system.ServiceManager().GetService("set:sys", true); +IAudioController::IAudioController(Core::System& system_) + : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { + m_set_sys = system.ServiceManager().GetService("set:sys", true); notification_event = service_context.CreateEvent("IAudioController:NotificationEvent"); // Probably shouldn't do this in constructor? diff --git a/src/core/hle/service/audio/audio_controller.h b/src/core/hle/service/audio/audio_controller.h index ff51f4c244..090f7c6633 100644 --- a/src/core/hle/service/audio/audio_controller.h +++ b/src/core/hle/service/audio/audio_controller.h @@ -59,8 +59,8 @@ private: Result AcquireTargetNotification(OutCopyHandle out_notification_event); Result Unknown5000(Out> out_audio_controller); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; - Kernel::KEvent* notification_event; std::shared_ptr m_set_sys; std::array m_target_volumes{{15, 15, 15, 15, 15, 15}}; diff --git a/src/core/hle/service/audio/audio_device.cpp b/src/core/hle/service/audio/audio_device.cpp index bdd9a27473..61cda0de1f 100644 --- a/src/core/hle/service/audio/audio_device.cpp +++ b/src/core/hle/service/audio/audio_device.cpp @@ -12,12 +12,8 @@ namespace Service::Audio { using namespace AudioCore::Renderer; -IAudioDevice::IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision, - u32 device_num) - : ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"}, - impl{std::make_unique(system_, applet_resource_user_id, revision)}, - event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} { - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IAudioDevice::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&IAudioDevice::ListAudioDeviceName>, "ListAudioDeviceName"}, FunctionInfo{1, D<&IAudioDevice::SetAudioDeviceOutputVolume>, "SetAudioDeviceOutputVolume"}, FunctionInfo{2, D<&IAudioDevice::GetAudioDeviceOutputVolume>, "GetAudioDeviceOutputVolume"}, @@ -39,9 +35,15 @@ IAudioDevice::IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u FunctionInfo{19, D<&IAudioDevice::SetAudioDeviceOutputVolumeAutoTuneEnabled>, "SetAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ FunctionInfo{20, D<&IAudioDevice::IsAudioDeviceOutputVolumeAutoTuneEnabled>, "IsAudioDeviceOutputVolumeAutoTuneEnabled"}, //18.0.0+ FunctionInfo{21, nullptr, "IsActiveOutputDeviceEstimatedLowLatency"} //21.0.0+ - }; - RegisterHandlers(functions); + ); + return HandlerTableGenerateWithFind(key, functions); +} +IAudioDevice::IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision, + u32 device_num) + : ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"}, + impl{std::make_unique(system_, applet_resource_user_id, revision)}, + event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} { event->Signal(system.Kernel()); } diff --git a/src/core/hle/service/audio/audio_device.h b/src/core/hle/service/audio/audio_device.h index f6c12fbfeb..4a866838cb 100644 --- a/src/core/hle/service/audio/audio_device.h +++ b/src/core/hle/service/audio/audio_device.h @@ -55,6 +55,7 @@ private: Result SetAudioDeviceOutputVolumeAutoTuneEnabled(bool enabled); Result IsAudioDeviceOutputVolumeAutoTuneEnabled(Out out_enabled); + FunctionInfoBase const* FindRequest(u32 key) override; KernelHelpers::ServiceContext service_context; std::unique_ptr impl; Kernel::KEvent* event; diff --git a/src/core/hle/service/bcat/bcat_service.cpp b/src/core/hle/service/bcat/bcat_service.cpp index f1e5b8b039..0610e4f0c9 100644 --- a/src/core/hle/service/bcat/bcat_service.cpp +++ b/src/core/hle/service/bcat/bcat_service.cpp @@ -24,45 +24,46 @@ static u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { return out; } -IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_, u64 program_id_) - : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_}, - progress{{ - ProgressServiceBackend{system_, "Normal"}, - ProgressServiceBackend{system_, "Directory"}, - }} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, - FunctionInfo{10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, - FunctionInfo{10200, nullptr, "CancelSyncDeliveryCacheRequest"}, - FunctionInfo{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, - FunctionInfo{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, - FunctionInfo{20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, - FunctionInfo{20301, nullptr, "RequestSuspendDeliveryTask"}, - FunctionInfo{20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, - FunctionInfo{20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, - FunctionInfo{20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, - FunctionInfo{30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, - FunctionInfo{30101, nullptr, "Unknown30101"}, //2.0.0-2.3.0 - FunctionInfo{30102, nullptr, "Unknown30102"}, //2.0.0-2.3.0 - FunctionInfo{30200, nullptr, "RegisterBackgroundDeliveryTask"}, - FunctionInfo{30201, nullptr, "UnregisterBackgroundDeliveryTask"}, - FunctionInfo{30202, nullptr, "BlockDeliveryTask"}, - FunctionInfo{30203, nullptr, "UnblockDeliveryTask"}, - FunctionInfo{30210, nullptr, "SetDeliveryTaskTimer"}, - FunctionInfo{30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, - FunctionInfo{90100, nullptr, "GetDeliveryTaskList"}, - FunctionInfo{90101, nullptr, "GetDeliveryTaskListForSystem"}, //11.0.0+ - FunctionInfo{90200, nullptr, "GetDeliveryList"}, - FunctionInfo{90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, - FunctionInfo{90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, - FunctionInfo{90300, nullptr, "GetPushNotificationLog"}, - FunctionInfo{90301, nullptr, "GetDeliveryCacheStorageUsage"}, //11.0.0+ - }; - // clang-format on - RegisterHandlers(functions); +ServiceFrameworkBase::FunctionInfoBase const* IBcatService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( + FunctionInfo{10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, + FunctionInfo{10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, + FunctionInfo{10200, nullptr, "CancelSyncDeliveryCacheRequest"}, + FunctionInfo{20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, + FunctionInfo{20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, + FunctionInfo{20300, nullptr, "GetDeliveryCacheStorageUpdateNotifier"}, + FunctionInfo{20301, nullptr, "RequestSuspendDeliveryTask"}, + FunctionInfo{20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, + FunctionInfo{20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, + FunctionInfo{20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, + FunctionInfo{30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"}, + FunctionInfo{30101, nullptr, "Unknown30101"}, //2.0.0-2.3.0 + FunctionInfo{30102, nullptr, "Unknown30102"}, //2.0.0-2.3.0 + FunctionInfo{30200, nullptr, "RegisterBackgroundDeliveryTask"}, + FunctionInfo{30201, nullptr, "UnregisterBackgroundDeliveryTask"}, + FunctionInfo{30202, nullptr, "BlockDeliveryTask"}, + FunctionInfo{30203, nullptr, "UnblockDeliveryTask"}, + FunctionInfo{30210, nullptr, "SetDeliveryTaskTimer"}, + FunctionInfo{30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, + FunctionInfo{90100, nullptr, "GetDeliveryTaskList"}, + FunctionInfo{90101, nullptr, "GetDeliveryTaskListForSystem"}, //11.0.0+ + FunctionInfo{90200, nullptr, "GetDeliveryList"}, + FunctionInfo{90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, + FunctionInfo{90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, + FunctionInfo{90300, nullptr, "GetPushNotificationLog"}, + FunctionInfo{90301, nullptr, "GetDeliveryCacheStorageUsage"} //11.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); } +IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_, u64 program_id_) + : ServiceFramework{system_, "IBcatService"}, backend{backend_}, program_id{program_id_} + , progress{{ + ProgressServiceBackend{system_, "Normal"}, + ProgressServiceBackend{system_, "Directory"}, + }} +{} + IBcatService::~IBcatService() = default; Result IBcatService::RequestSyncDeliveryCache( diff --git a/src/core/hle/service/bcat/bcat_service.h b/src/core/hle/service/bcat/bcat_service.h index 5e11059a78..cfccd17c09 100644 --- a/src/core/hle/service/bcat/bcat_service.h +++ b/src/core/hle/service/bcat/bcat_service.h @@ -41,6 +41,7 @@ private: ProgressServiceBackend& GetProgressBackend(SyncType type); const ProgressServiceBackend& GetProgressBackend(SyncType type) const; + FunctionInfoBase const* FindRequest(u32 key) override; BcatBackend& backend; u64 program_id; std::array(SyncType::Count)> progress; diff --git a/src/core/hle/service/bcat/news/news_service.cpp b/src/core/hle/service/bcat/news/news_service.cpp index d865d04249..84173ecfe9 100644 --- a/src/core/hle/service/bcat/news/news_service.cpp +++ b/src/core/hle/service/bcat/news/news_service.cpp @@ -12,9 +12,8 @@ namespace Service::News { -INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* INewsService::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{10100, D<&INewsService::PostLocalNews>, "PostLocalNews"}, FunctionInfo{20100, D<&INewsService::SetPassphrase>, "SetPassphrase"}, FunctionInfo{30100, D<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"}, @@ -33,11 +32,12 @@ INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "I FunctionInfo{40101, D<&INewsService::RequestAutoSubscription>, "RequestAutoSubscription"}, //3.0.0+ FunctionInfo{40200, D<&INewsService::ClearStorage>, "ClearStorage"}, FunctionInfo{40201, D<&INewsService::ClearSubscriptionStatusAll>, "ClearSubscriptionStatusAll"}, - FunctionInfo{90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"}, - }; - // clang-format on + FunctionInfo{90100, D<&INewsService::GetNewsDatabaseDump>, "GetNewsDatabaseDump"} + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { } INewsService::~INewsService() = default; diff --git a/src/core/hle/service/bcat/news/news_service.h b/src/core/hle/service/bcat/news/news_service.h index 1a320df02f..0ff9b4464c 100644 --- a/src/core/hle/service/bcat/news/news_service.h +++ b/src/core/hle/service/bcat/news/news_service.h @@ -22,22 +22,15 @@ public: private: Result PostLocalNews(InBuffer buffer_data); - Result SetPassphrase(InBuffer buffer_data); - Result GetSubscriptionStatus(Out out_status, InBuffer buffer_data); - Result GetTopicList(Out out_count, OutBuffer out_topics, s32 filter); - Result IsSystemUpdateRequired(Out out_is_system_update_required); - Result RequestAutoSubscription(u64 value); - Result ClearStorage(); - Result ClearSubscriptionStatusAll(); - Result GetNewsDatabaseDump(); + FunctionInfoBase const* FindRequest(u32 key) override; }; } // namespace Service::News diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index db48526614..fd5da76a16 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -13,8 +13,6 @@ #include "common/swap.h" #include "core/core.h" #include "core/hle/service/fatal/fatal.h" -#include "core/hle/service/fatal/fatal_p.h" -#include "core/hle/service/fatal/fatal_u.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/server_manager.h" #include "core/reporter.h" @@ -167,6 +165,35 @@ void Module::Interface::ThrowFatalWithCpuContext(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +class Fatal_P final : public Module::Interface { +public: + explicit Fatal_P(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:p") {} + ~Fatal_P() override = default; + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "GetFatalEvent"}, + FunctionInfo{10, nullptr, "GetFatalContext"} + ); +}; + +class Fatal_U final : public Module::Interface { +public: + explicit Fatal_U(std::shared_ptr module_, Core::System& system_) : Interface(std::move(module_), system_, "fatal:u") {} + ~Fatal_U() override = default; + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Fatal_U::ThrowFatal, "ThrowFatal"}, + FunctionInfo{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, + FunctionInfo{2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"} + ); +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto module = std::make_shared(); diff --git a/src/core/hle/service/fatal/fatal_p.cpp b/src/core/hle/service/fatal/fatal_p.cpp deleted file mode 100644 index 77e451c4e1..0000000000 --- a/src/core/hle/service/fatal/fatal_p.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/fatal/fatal_p.h" - -namespace Service::Fatal { - -Fatal_P::Fatal_P(std::shared_ptr module_, Core::System& system_) - : Interface(std::move(module_), system_, "fatal:p") { -} - -Fatal_P::~Fatal_P() = default; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_p.h b/src/core/hle/service/fatal/fatal_p.h deleted file mode 100644 index 73bdc2bcaf..0000000000 --- a/src/core/hle/service/fatal/fatal_p.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/fatal/fatal.h" - -namespace Service::Fatal { - -class Fatal_P final : public Module::Interface { -public: - explicit Fatal_P(std::shared_ptr module_, Core::System& system_); - ~Fatal_P() override; - - FunctionInfoBase const* FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetFatalEvent"}, - FunctionInfo{10, nullptr, "GetFatalContext"} - ); -}; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.cpp b/src/core/hle/service/fatal/fatal_u.cpp deleted file mode 100644 index 354fadcaa6..0000000000 --- a/src/core/hle/service/fatal/fatal_u.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/fatal/fatal_u.h" - -namespace Service::Fatal { - -Fatal_U::Fatal_U(std::shared_ptr module_, Core::System& system_) - : Interface(std::move(module_), system_, "fatal:u") { - static const FunctionInfo functions[] = { - FunctionInfo{0, &Fatal_U::ThrowFatal, "ThrowFatal"}, - FunctionInfo{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"}, - FunctionInfo{2, &Fatal_U::ThrowFatalWithCpuContext, "ThrowFatalWithCpuContext"}, - }; - RegisterHandlers(functions); -} - -Fatal_U::~Fatal_U() = default; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/fatal/fatal_u.h b/src/core/hle/service/fatal/fatal_u.h deleted file mode 100644 index 65fbe26961..0000000000 --- a/src/core/hle/service/fatal/fatal_u.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/fatal/fatal.h" - -namespace Service::Fatal { - -class Fatal_U final : public Module::Interface { -public: - explicit Fatal_U(std::shared_ptr module_, Core::System& system_); - ~Fatal_U() override; -}; - -} // namespace Service::Fatal diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index d9d78091d5..13f3ff7475 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp @@ -47,11 +47,8 @@ namespace Service::FileSystem { -FSP_SRV::FSP_SRV(Core::System& system_) - : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, - content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* FSP_SRV::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, nullptr, "OpenFileSystem"}, FunctionInfo{1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"}, FunctionInfo{2, D<&FSP_SRV::OpenDataFileSystemByCurrentProcess>, "OpenDataFileSystemByCurrentProcess"}, @@ -179,11 +176,13 @@ FSP_SRV::FSP_SRV(Core::System& system_) FunctionInfo{1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, FunctionInfo{1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, FunctionInfo{1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"}, - FunctionInfo{1300, nullptr, "OpenBisWiper"}, - }; - // clang-format on - RegisterHandlers(functions); + FunctionInfo{1300, nullptr, "OpenBisWiper"} + ); + return HandlerTableGenerateWithFind(key, functions); +} +FSP_SRV::FSP_SRV(Core::System& system_) + : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { if (Settings::values.enable_fs_access_log) { access_log_mode = AccessLogMode::SdCard; } diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index 156cf4e571..31f5cb5026 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h @@ -115,6 +115,7 @@ private: s64 available_size, s64 journal_size); Result GetCacheStorageSize(s32 index, Out out_data_size, Out out_journal_size); + FunctionInfoBase const* FindRequest(u32 key) override; FileSystemController& fsc; const FileSys::ContentProvider& content_provider; const Core::Reporter& reporter; diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 540ccb42e6..858d3f3ed0 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -35,22 +35,6 @@ std::optional GetTitleIDForProcessID(Core::System& system, u64 process_id) ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_) : ServiceFramework{system_, "arp:r"}, manager{manager_} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, - FunctionInfo{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, - FunctionInfo{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, - FunctionInfo{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, - FunctionInfo{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, - FunctionInfo{5, nullptr, "ListApplicationInstanceId"}, - FunctionInfo{6, nullptr, "GetMicroApplicationInstanceId"}, - FunctionInfo{7, nullptr, "GetApplicationCertificate"}, - FunctionInfo{9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, - FunctionInfo{9999, nullptr, "GetPreomiaApplicationControlProperty"}, - }; - // clang-format on - - RegisterHandlers(functions); } ARP_R::~ARP_R() = default; @@ -245,15 +229,6 @@ private: ARP_W::ARP_W(Core::System& system_, ARPManager& manager_) : ServiceFramework{system_, "arp:w"}, manager{manager_} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, - FunctionInfo{1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, - FunctionInfo{2, nullptr, "AcquireUpdater"} - }; - // clang-format on - - RegisterHandlers(functions); } ARP_W::~ARP_W() = default; diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h index 5bce801755..8c300fdfdc 100644 --- a/src/core/hle/service/glue/arp.h +++ b/src/core/hle/service/glue/arp.h @@ -21,6 +21,21 @@ private: void GetApplicationControlProperty(HLERequestContext& ctx); void GetApplicationControlPropertyWithApplicationId(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, + FunctionInfo{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"}, + FunctionInfo{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"}, + FunctionInfo{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"}, + FunctionInfo{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"}, + FunctionInfo{5, nullptr, "ListApplicationInstanceId"}, + FunctionInfo{6, nullptr, "GetMicroApplicationInstanceId"}, + FunctionInfo{7, nullptr, "GetApplicationCertificate"}, + FunctionInfo{9998, nullptr, "GetPreomiaApplicationLaunchProperty"}, + FunctionInfo{9999, nullptr, "GetPreomiaApplicationControlProperty"} + ); const ARPManager& manager; }; @@ -33,6 +48,14 @@ private: void AcquireRegistrar(HLERequestContext& ctx); void UnregisterApplicationInstance(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, + FunctionInfo{1, &ARP_W::UnregisterApplicationInstance , "UnregisterApplicationInstance "}, + FunctionInfo{2, nullptr, "AcquireUpdater"} + ); ARPManager& manager; std::shared_ptr registrar; }; diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index b64e0c23a4..7c7b5ea13c 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -11,15 +11,7 @@ namespace Service::Glue { -BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{100, &BGTC_T::OpenTaskService, "OpenTaskService"}, - }; - // clang-format on - - RegisterHandlers(functions); -} +BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {} BGTC_T::~BGTC_T() = default; diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h index 4e323f4671..e2b2c7c9d3 100644 --- a/src/core/hle/service/glue/bgtc.h +++ b/src/core/hle/service/glue/bgtc.h @@ -17,6 +17,12 @@ public: ~BGTC_T() override; void OpenTaskService(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{100, &BGTC_T::OpenTaskService, "OpenTaskService"} + ); }; class ITaskService final : public ServiceFramework { diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 859a153dd3..4f2d7d7aaa 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -16,6 +16,11 @@ #include "core/hle/service/server_manager.h" #include "hid_core/resource_manager.h" #include "hid_core/resources/hid_firmware_settings.h" +#include "core/hle/service/ipc_helpers.h" +#include "hid_core/hid_types.h" +#include "hid_core/resources/touch_screen/gesture.h" +#include "hid_core/resources/touch_screen/touch_screen.h" +#include "core/hle/service/cmif_serialization.h" namespace Service::HID { @@ -25,8 +30,8 @@ public: : ServiceFramework{system_, "hid:tmp"} {} static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"} - ); + FunctionInfo{0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"} + ); FunctionInfoBase const* FindRequest(u32 key) override { return HandlerTableGenerateWithFind(key, functions); } @@ -39,12 +44,12 @@ public: : ServiceFramework{system_, "ahid:cd"} {} static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "AcquireDevice"}, - FunctionInfo{1, nullptr, "ReleaseDevice"}, - FunctionInfo{2, nullptr, "GetCtrlSession"}, - FunctionInfo{3, nullptr, "GetReadSession"}, - FunctionInfo{4, nullptr, "GetWriteSession"} - ); + FunctionInfo{0, nullptr, "AcquireDevice"}, + FunctionInfo{1, nullptr, "ReleaseDevice"}, + FunctionInfo{2, nullptr, "GetCtrlSession"}, + FunctionInfo{3, nullptr, "GetReadSession"}, + FunctionInfo{4, nullptr, "GetWriteSession"} + ); FunctionInfoBase const* FindRequest(u32 key) override { return HandlerTableGenerateWithFind(key, functions); } @@ -57,19 +62,319 @@ public: : ServiceFramework{system_, "ahid:hdr"} {} static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetDeviceEntries"}, - FunctionInfo{1, nullptr, "GetDeviceList"}, - FunctionInfo{2, nullptr, "GetDeviceParameters"}, - FunctionInfo{3, nullptr, "AttachDevice"}, - FunctionInfo{4, nullptr, "DetachDevice"}, - FunctionInfo{5, nullptr, "SetDeviceFilter"} - ); + FunctionInfo{0, nullptr, "GetDeviceEntries"}, + FunctionInfo{1, nullptr, "GetDeviceList"}, + FunctionInfo{2, nullptr, "GetDeviceParameters"}, + FunctionInfo{3, nullptr, "AttachDevice"}, + FunctionInfo{4, nullptr, "DetachDevice"}, + FunctionInfo{5, nullptr, "SetDeviceFilter"} + ); FunctionInfoBase const* FindRequest(u32 key) override { return HandlerTableGenerateWithFind(key, functions); } ~AHID_HDR() override = default; }; +class IHidDebugServer final : public ServiceFramework { +public: + explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings) + : ServiceFramework{system_, "hid:dbg"} + , resource_manager{resource} + , firmware_settings{settings} + {} + + ~IHidDebugServer() override = default; + + Result DeactivateTouchScreen() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); + } + + R_SUCCEED(); + } + + Result SetTouchScreenAutoPilotState( + InArray auto_pilot_buffer) { + AutoPilotState auto_pilot{}; + + auto_pilot.count = + static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); + memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), + auto_pilot.count * sizeof(TouchState)); + + LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); + + R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); + } + + Result UnsetTouchScreenAutoPilotState() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); + } + + Result GetTouchScreenConfiguration( + Out out_touchscreen_config, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); + + R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( + *out_touchscreen_config, aruid.pid)); + + if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && + out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { + out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; + } + + R_SUCCEED(); + } + + Result ProcessTouchScreenAutoTune() { + LOG_INFO(Service_HID, "called"); + R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); + } + + Result ForceStopTouchScreenManagement() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_SUCCEED(); + } + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsTouchI2cManaged()) { + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(touch_screen->IsActive(is_touch_active)); + R_TRY(gesture->IsActive(is_gesture_active)); + + if (is_touch_active) { + R_TRY(touch_screen->Deactivate()); + } + if (is_gesture_active) { + R_TRY(gesture->Deactivate()); + } + } + + R_SUCCEED(); + } + + Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, + ClientAppletResourceUserId aruid) { + LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", + basic_gesture_id, aruid.pid); + + auto touch_screen = GetResourceManager()->GetTouchScreen(); + auto gesture = GetResourceManager()->GetGesture(); + + if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { + R_TRY(gesture->Activate()); + R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); + R_TRY(touch_screen->Activate()); + R_TRY(touch_screen->Activate(aruid.pid)); + } + + R_SUCCEED(); + } + + Result IsTouchScreenManaged(Out out_is_managed) { + LOG_INFO(Service_HID, "called"); + + bool is_touch_active{}; + bool is_gesture_active{}; + R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); + R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); + + *out_is_managed = is_touch_active || is_gesture_active; + R_SUCCEED(); + } + + Result DeactivateGesture() { + LOG_INFO(Service_HID, "called"); + + if (!firmware_settings->IsDeviceManaged()) { + R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); + } + + R_SUCCEED(); + } + + std::shared_ptr GetResourceManager() { + resource_manager->Initialize(); + return resource_manager; + } + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, nullptr, "DeactivateDebugPad"}, + FunctionInfo{1, nullptr, "SetDebugPadAutoPilotState"}, + FunctionInfo{2, nullptr, "UnsetDebugPadAutoPilotState"}, + FunctionInfo{10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, + FunctionInfo{11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, + FunctionInfo{12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, + FunctionInfo{13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, + FunctionInfo{14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, + FunctionInfo{15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, + FunctionInfo{16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, + FunctionInfo{17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, + FunctionInfo{20, nullptr, "DeactivateMouse"}, + FunctionInfo{21, nullptr, "SetMouseAutoPilotState"}, + FunctionInfo{22, nullptr, "UnsetMouseAutoPilotState"}, + FunctionInfo{23, nullptr, "AddMouseSideWheelDelta"}, + FunctionInfo{25, nullptr, "SetDebugMouseAutoPilotState"}, + FunctionInfo{26, nullptr, "UnsetDebugMouseAutoPilotState"}, + FunctionInfo{30, nullptr, "DeactivateKeyboard"}, + FunctionInfo{31, nullptr, "SetKeyboardAutoPilotState"}, + FunctionInfo{32, nullptr, "UnsetKeyboardAutoPilotState"}, + FunctionInfo{50, nullptr, "DeactivateXpad"}, + FunctionInfo{51, nullptr, "SetXpadAutoPilotState"}, + FunctionInfo{52, nullptr, "UnsetXpadAutoPilotState"}, + FunctionInfo{53, nullptr, "DeactivateJoyXpad"}, + FunctionInfo{60, nullptr, "ClearNpadSystemCommonPolicy"}, + FunctionInfo{61, nullptr, "DeactivateNpad"}, + FunctionInfo{62, nullptr, "ForceDisconnectNpad"}, + FunctionInfo{91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, + FunctionInfo{110, nullptr, "DeactivateHomeButton"}, + FunctionInfo{111, nullptr, "SetHomeButtonAutoPilotState"}, + FunctionInfo{112, nullptr, "UnsetHomeButtonAutoPilotState"}, + FunctionInfo{120, nullptr, "DeactivateSleepButton"}, + FunctionInfo{121, nullptr, "SetSleepButtonAutoPilotState"}, + FunctionInfo{122, nullptr, "UnsetSleepButtonAutoPilotState"}, + FunctionInfo{123, nullptr, "DeactivateInputDetector"}, + FunctionInfo{130, nullptr, "DeactivateCaptureButton"}, + FunctionInfo{131, nullptr, "SetCaptureButtonAutoPilotState"}, + FunctionInfo{132, nullptr, "UnsetCaptureButtonAutoPilotState"}, + FunctionInfo{133, nullptr, "SetShiftAccelerometerCalibrationValue"}, + FunctionInfo{134, nullptr, "GetShiftAccelerometerCalibrationValue"}, + FunctionInfo{135, nullptr, "SetShiftGyroscopeCalibrationValue"}, + FunctionInfo{136, nullptr, "GetShiftGyroscopeCalibrationValue"}, + FunctionInfo{140, nullptr, "DeactivateConsoleSixAxisSensor"}, + FunctionInfo{141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, + FunctionInfo{142, nullptr, "DeactivateSevenSixAxisSensor"}, + FunctionInfo{143, nullptr, "GetConsoleSixAxisSensorCountStates"}, + FunctionInfo{144, nullptr, "GetAccelerometerFsr"}, + FunctionInfo{145, nullptr, "SetAccelerometerFsr"}, + FunctionInfo{146, nullptr, "GetAccelerometerOdr"}, + FunctionInfo{147, nullptr, "SetAccelerometerOdr"}, + FunctionInfo{148, nullptr, "GetGyroscopeFsr"}, + FunctionInfo{149, nullptr, "SetGyroscopeFsr"}, + FunctionInfo{150, nullptr, "GetGyroscopeOdr"}, + FunctionInfo{151, nullptr, "SetGyroscopeOdr"}, + FunctionInfo{152, nullptr, "GetWhoAmI"}, + FunctionInfo{201, nullptr, "ActivateFirmwareUpdate"}, + FunctionInfo{202, nullptr, "DeactivateFirmwareUpdate"}, + FunctionInfo{203, nullptr, "StartFirmwareUpdate"}, + FunctionInfo{204, nullptr, "GetFirmwareUpdateStage"}, + FunctionInfo{205, nullptr, "GetFirmwareVersion"}, + FunctionInfo{206, nullptr, "GetDestinationFirmwareVersion"}, + FunctionInfo{207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, + FunctionInfo{208, nullptr, "StartFirmwareUpdateForRevert"}, + FunctionInfo{209, nullptr, "GetAvailableFirmwareVersionForRevert"}, + FunctionInfo{210, nullptr, "IsFirmwareUpdatingDevice"}, + FunctionInfo{211, nullptr, "StartFirmwareUpdateIndividual"}, + FunctionInfo{212, nullptr, "GetDetailFirmwareVersion"}, // 19.0.0+ + FunctionInfo{215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, + FunctionInfo{216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, + FunctionInfo{221, nullptr, "UpdateControllerColor"}, + FunctionInfo{222, nullptr, "ConnectUsbPadsAsync"}, + FunctionInfo{223, nullptr, "DisconnectUsbPadsAsync"}, + FunctionInfo{224, nullptr, "UpdateDesignInfo"}, + FunctionInfo{225, nullptr, "GetUniquePadDriverState"}, + FunctionInfo{226, nullptr, "GetSixAxisSensorDriverStates"}, + FunctionInfo{227, nullptr, "GetRxPacketHistory"}, + FunctionInfo{228, nullptr, "AcquireOperationEventHandle"}, + FunctionInfo{229, nullptr, "ReadSerialFlash"}, + FunctionInfo{230, nullptr, "WriteSerialFlash"}, + FunctionInfo{231, nullptr, "GetOperationResult"}, + FunctionInfo{232, nullptr, "EnableShipmentMode"}, + FunctionInfo{233, nullptr, "ClearPairingInfo"}, + FunctionInfo{234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, + FunctionInfo{235, nullptr, "EnableAnalogStickPower"}, + FunctionInfo{236, nullptr, "RequestKuinaUartClockCal"}, + FunctionInfo{237, nullptr, "GetKuinaUartClockCal"}, + FunctionInfo{238, nullptr, "SetKuinaUartClockTrim"}, + FunctionInfo{239, nullptr, "KuinaLoopbackTest"}, + FunctionInfo{240, nullptr, "RequestBatteryVoltage"}, + FunctionInfo{241, nullptr, "GetBatteryVoltage"}, + FunctionInfo{242, nullptr, "GetUniquePadPowerInfo"}, + FunctionInfo{243, nullptr, "RebootUniquePad"}, + FunctionInfo{244, nullptr, "RequestKuinaFirmwareVersion"}, + FunctionInfo{245, nullptr, "GetKuinaFirmwareVersion"}, + FunctionInfo{246, nullptr, "GetVidPid"}, + FunctionInfo{247, nullptr, "GetAnalogStickCalibrationValue"}, + FunctionInfo{248, nullptr, "GetUniquePadIdsFull"}, + FunctionInfo{249, nullptr, "ConnectUniquePad"}, + FunctionInfo{250, nullptr, "IsVirtual"}, + FunctionInfo{251, nullptr, "GetAnalogStickModuleParam"}, + FunctionInfo{253, nullptr, "ClearStorageForShipment"}, //19.0.0+ + FunctionInfo{261, nullptr, "UpdateDesignInfo12"}, //21.0.0+ + FunctionInfo{262, nullptr, "GetUniquePadButtonCount"}, //21.0.0+ + FunctionInfo{267, nullptr, "SetAnalogStickCalibration"}, //21.0.0+ + FunctionInfo{268, nullptr, "ResetAnalogStickCalibration"}, //21.0.0+ + FunctionInfo{301, nullptr, "GetAbstractedPadHandles"}, + FunctionInfo{302, nullptr, "GetAbstractedPadState"}, + FunctionInfo{303, nullptr, "GetAbstractedPadsState"}, + FunctionInfo{321, nullptr, "SetAutoPilotVirtualPadState"}, + FunctionInfo{322, nullptr, "UnsetAutoPilotVirtualPadState"}, + FunctionInfo{323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, + FunctionInfo{324, nullptr, "AttachHdlsWorkBuffer"}, + FunctionInfo{325, nullptr, "ReleaseHdlsWorkBuffer"}, + FunctionInfo{326, nullptr, "DumpHdlsNpadAssignmentState"}, + FunctionInfo{327, nullptr, "DumpHdlsStates"}, + FunctionInfo{328, nullptr, "ApplyHdlsNpadAssignmentState"}, + FunctionInfo{329, nullptr, "ApplyHdlsStateList"}, + FunctionInfo{330, nullptr, "AttachHdlsVirtualDevice"}, + FunctionInfo{331, nullptr, "DetachHdlsVirtualDevice"}, + FunctionInfo{332, nullptr, "SetHdlsState"}, + FunctionInfo{350, nullptr, "AddRegisteredDevice"}, + FunctionInfo{351, nullptr, "GetRegisteredDevicesCountDebug"}, //17.0.0-18.1.0 + FunctionInfo{352, nullptr, "DeleteRegisteredDevicesDebug"}, //17.0.0-18.1.0 + FunctionInfo{400, nullptr, "DisableExternalMcuOnNxDevice"}, + FunctionInfo{401, nullptr, "DisableRailDeviceFiltering"}, + FunctionInfo{402, nullptr, "EnableWiredPairing"}, + FunctionInfo{403, nullptr, "EnableShipmentModeAutoClear"}, + FunctionInfo{404, nullptr, "SetRailEnabled"}, + FunctionInfo{500, nullptr, "SetFactoryInt"}, + FunctionInfo{501, nullptr, "IsFactoryBootEnabled"}, + FunctionInfo{550, nullptr, "SetAnalogStickModelDataTemporarily"}, + FunctionInfo{551, nullptr, "GetAnalogStickModelData"}, + FunctionInfo{552, nullptr, "ResetAnalogStickModelData"}, + FunctionInfo{600, nullptr, "ConvertPadState"}, + FunctionInfo{601, nullptr, "IsButtonConfigSupported"}, //18.0.0+ + FunctionInfo{602, nullptr, "IsButtonConfigEmbeddedSupported"}, //18.0.0+ + FunctionInfo{603, nullptr, "DeleteButtonConfig"}, //18.0.0+ + FunctionInfo{604, nullptr, "DeleteButtonConfigEmbedded"}, //18.0.0+ + FunctionInfo{605, nullptr, "SetButtonConfigEnabled"}, //18.0.0+ + FunctionInfo{606, nullptr, "SetButtonConfigEmbeddedEnabled"}, //18.0.0+ + FunctionInfo{607, nullptr, "IsButtonConfigEnabled"}, //18.0.0+ + FunctionInfo{608, nullptr, "IsButtonConfigEmbeddedEnabled"}, //18.0.0+ + FunctionInfo{609, nullptr, "SetButtonConfigEmbedded"}, //18.0.0+ + FunctionInfo{610, nullptr, "SetButtonConfigFull"}, //18.0.0+ + FunctionInfo{611, nullptr, "SetButtonConfigLeft"}, //18.0.0+ + FunctionInfo{612, nullptr, "SetButtonConfigRight"}, //18.0.0+ + FunctionInfo{613, nullptr, "GetButtonConfigEmbedded"}, //18.0.0+ + FunctionInfo{614, nullptr, "GetButtonConfigFull"}, //18.0.0+ + FunctionInfo{615, nullptr, "GetButtonConfigLeft"}, //18.0.0+ + FunctionInfo{616, nullptr, "GetButtonConfigRight"}, //18.0.0+ + FunctionInfo{650, nullptr, "AddButtonPlayData"}, + FunctionInfo{651, nullptr, "StartButtonPlayData"}, + FunctionInfo{652, nullptr, "StopButtonPlayData"}, + FunctionInfo{700, nullptr, "GetRailAttachEventCount"}, //21.0.0+ + FunctionInfo{2000, nullptr, "DeactivateDigitizer"}, + FunctionInfo{2001, nullptr, "SetDigitizerAutoPilotState"}, + FunctionInfo{2002, nullptr, "UnsetDigitizerAutoPilotState"}, + FunctionInfo{3000, nullptr, "ReloadFirmwareDebugSettings"} + ); + std::shared_ptr resource_manager; + std::shared_ptr firmware_settings; +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto firmware_settings = std::make_shared(system); diff --git a/src/core/hle/service/hid/hid_debug_server.cpp b/src/core/hle/service/hid/hid_debug_server.cpp index 4bee02bc3d..c9248a2152 100644 --- a/src/core/hle/service/hid/hid_debug_server.cpp +++ b/src/core/hle/service/hid/hid_debug_server.cpp @@ -18,298 +18,4 @@ namespace Service::HID { -IHidDebugServer::IHidDebugServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings) - : ServiceFramework{system_, "hid:dbg"}, resource_manager{resource}, firmware_settings{ - settings} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{0, nullptr, "DeactivateDebugPad"}, - FunctionInfo{1, nullptr, "SetDebugPadAutoPilotState"}, - FunctionInfo{2, nullptr, "UnsetDebugPadAutoPilotState"}, - FunctionInfo{10, C<&IHidDebugServer::DeactivateTouchScreen>, "DeactivateTouchScreen"}, - FunctionInfo{11, C<&IHidDebugServer::SetTouchScreenAutoPilotState>, "SetTouchScreenAutoPilotState"}, - FunctionInfo{12, C<&IHidDebugServer::UnsetTouchScreenAutoPilotState>, "UnsetTouchScreenAutoPilotState"}, - FunctionInfo{13, C<&IHidDebugServer::GetTouchScreenConfiguration>, "GetTouchScreenConfiguration"}, - FunctionInfo{14, C<&IHidDebugServer::ProcessTouchScreenAutoTune>, "ProcessTouchScreenAutoTune"}, - FunctionInfo{15, C<&IHidDebugServer::ForceStopTouchScreenManagement>, "ForceStopTouchScreenManagement"}, - FunctionInfo{16, C<&IHidDebugServer::ForceRestartTouchScreenManagement>, "ForceRestartTouchScreenManagement"}, - FunctionInfo{17, C<&IHidDebugServer::IsTouchScreenManaged>, "IsTouchScreenManaged"}, - FunctionInfo{20, nullptr, "DeactivateMouse"}, - FunctionInfo{21, nullptr, "SetMouseAutoPilotState"}, - FunctionInfo{22, nullptr, "UnsetMouseAutoPilotState"}, - FunctionInfo{23, nullptr, "AddMouseSideWheelDelta"}, - FunctionInfo{25, nullptr, "SetDebugMouseAutoPilotState"}, - FunctionInfo{26, nullptr, "UnsetDebugMouseAutoPilotState"}, - FunctionInfo{30, nullptr, "DeactivateKeyboard"}, - FunctionInfo{31, nullptr, "SetKeyboardAutoPilotState"}, - FunctionInfo{32, nullptr, "UnsetKeyboardAutoPilotState"}, - FunctionInfo{50, nullptr, "DeactivateXpad"}, - FunctionInfo{51, nullptr, "SetXpadAutoPilotState"}, - FunctionInfo{52, nullptr, "UnsetXpadAutoPilotState"}, - FunctionInfo{53, nullptr, "DeactivateJoyXpad"}, - FunctionInfo{60, nullptr, "ClearNpadSystemCommonPolicy"}, - FunctionInfo{61, nullptr, "DeactivateNpad"}, - FunctionInfo{62, nullptr, "ForceDisconnectNpad"}, - FunctionInfo{91, C<&IHidDebugServer::DeactivateGesture>, "DeactivateGesture"}, - FunctionInfo{110, nullptr, "DeactivateHomeButton"}, - FunctionInfo{111, nullptr, "SetHomeButtonAutoPilotState"}, - FunctionInfo{112, nullptr, "UnsetHomeButtonAutoPilotState"}, - FunctionInfo{120, nullptr, "DeactivateSleepButton"}, - FunctionInfo{121, nullptr, "SetSleepButtonAutoPilotState"}, - FunctionInfo{122, nullptr, "UnsetSleepButtonAutoPilotState"}, - FunctionInfo{123, nullptr, "DeactivateInputDetector"}, - FunctionInfo{130, nullptr, "DeactivateCaptureButton"}, - FunctionInfo{131, nullptr, "SetCaptureButtonAutoPilotState"}, - FunctionInfo{132, nullptr, "UnsetCaptureButtonAutoPilotState"}, - FunctionInfo{133, nullptr, "SetShiftAccelerometerCalibrationValue"}, - FunctionInfo{134, nullptr, "GetShiftAccelerometerCalibrationValue"}, - FunctionInfo{135, nullptr, "SetShiftGyroscopeCalibrationValue"}, - FunctionInfo{136, nullptr, "GetShiftGyroscopeCalibrationValue"}, - FunctionInfo{140, nullptr, "DeactivateConsoleSixAxisSensor"}, - FunctionInfo{141, nullptr, "GetConsoleSixAxisSensorSamplingFrequency"}, - FunctionInfo{142, nullptr, "DeactivateSevenSixAxisSensor"}, - FunctionInfo{143, nullptr, "GetConsoleSixAxisSensorCountStates"}, - FunctionInfo{144, nullptr, "GetAccelerometerFsr"}, - FunctionInfo{145, nullptr, "SetAccelerometerFsr"}, - FunctionInfo{146, nullptr, "GetAccelerometerOdr"}, - FunctionInfo{147, nullptr, "SetAccelerometerOdr"}, - FunctionInfo{148, nullptr, "GetGyroscopeFsr"}, - FunctionInfo{149, nullptr, "SetGyroscopeFsr"}, - FunctionInfo{150, nullptr, "GetGyroscopeOdr"}, - FunctionInfo{151, nullptr, "SetGyroscopeOdr"}, - FunctionInfo{152, nullptr, "GetWhoAmI"}, - FunctionInfo{201, nullptr, "ActivateFirmwareUpdate"}, - FunctionInfo{202, nullptr, "DeactivateFirmwareUpdate"}, - FunctionInfo{203, nullptr, "StartFirmwareUpdate"}, - FunctionInfo{204, nullptr, "GetFirmwareUpdateStage"}, - FunctionInfo{205, nullptr, "GetFirmwareVersion"}, - FunctionInfo{206, nullptr, "GetDestinationFirmwareVersion"}, - FunctionInfo{207, nullptr, "DiscardFirmwareInfoCacheForRevert"}, - FunctionInfo{208, nullptr, "StartFirmwareUpdateForRevert"}, - FunctionInfo{209, nullptr, "GetAvailableFirmwareVersionForRevert"}, - FunctionInfo{210, nullptr, "IsFirmwareUpdatingDevice"}, - FunctionInfo{211, nullptr, "StartFirmwareUpdateIndividual"}, - FunctionInfo{212, nullptr, "GetDetailFirmwareVersion"}, // 19.0.0+ - FunctionInfo{215, nullptr, "SetUsbFirmwareForceUpdateEnabled"}, - FunctionInfo{216, nullptr, "SetAllKuinaDevicesToFirmwareUpdateMode"}, - FunctionInfo{221, nullptr, "UpdateControllerColor"}, - FunctionInfo{222, nullptr, "ConnectUsbPadsAsync"}, - FunctionInfo{223, nullptr, "DisconnectUsbPadsAsync"}, - FunctionInfo{224, nullptr, "UpdateDesignInfo"}, - FunctionInfo{225, nullptr, "GetUniquePadDriverState"}, - FunctionInfo{226, nullptr, "GetSixAxisSensorDriverStates"}, - FunctionInfo{227, nullptr, "GetRxPacketHistory"}, - FunctionInfo{228, nullptr, "AcquireOperationEventHandle"}, - FunctionInfo{229, nullptr, "ReadSerialFlash"}, - FunctionInfo{230, nullptr, "WriteSerialFlash"}, - FunctionInfo{231, nullptr, "GetOperationResult"}, - FunctionInfo{232, nullptr, "EnableShipmentMode"}, - FunctionInfo{233, nullptr, "ClearPairingInfo"}, - FunctionInfo{234, nullptr, "GetUniquePadDeviceTypeSetInternal"}, - FunctionInfo{235, nullptr, "EnableAnalogStickPower"}, - FunctionInfo{236, nullptr, "RequestKuinaUartClockCal"}, - FunctionInfo{237, nullptr, "GetKuinaUartClockCal"}, - FunctionInfo{238, nullptr, "SetKuinaUartClockTrim"}, - FunctionInfo{239, nullptr, "KuinaLoopbackTest"}, - FunctionInfo{240, nullptr, "RequestBatteryVoltage"}, - FunctionInfo{241, nullptr, "GetBatteryVoltage"}, - FunctionInfo{242, nullptr, "GetUniquePadPowerInfo"}, - FunctionInfo{243, nullptr, "RebootUniquePad"}, - FunctionInfo{244, nullptr, "RequestKuinaFirmwareVersion"}, - FunctionInfo{245, nullptr, "GetKuinaFirmwareVersion"}, - FunctionInfo{246, nullptr, "GetVidPid"}, - FunctionInfo{247, nullptr, "GetAnalogStickCalibrationValue"}, - FunctionInfo{248, nullptr, "GetUniquePadIdsFull"}, - FunctionInfo{249, nullptr, "ConnectUniquePad"}, - FunctionInfo{250, nullptr, "IsVirtual"}, - FunctionInfo{251, nullptr, "GetAnalogStickModuleParam"}, - FunctionInfo{253, nullptr, "ClearStorageForShipment"}, //19.0.0+ - FunctionInfo{261, nullptr, "UpdateDesignInfo12"}, //21.0.0+ - FunctionInfo{262, nullptr, "GetUniquePadButtonCount"}, //21.0.0+ - FunctionInfo{267, nullptr, "SetAnalogStickCalibration"}, //21.0.0+ - FunctionInfo{268, nullptr, "ResetAnalogStickCalibration"}, //21.0.0+ - FunctionInfo{301, nullptr, "GetAbstractedPadHandles"}, - FunctionInfo{302, nullptr, "GetAbstractedPadState"}, - FunctionInfo{303, nullptr, "GetAbstractedPadsState"}, - FunctionInfo{321, nullptr, "SetAutoPilotVirtualPadState"}, - FunctionInfo{322, nullptr, "UnsetAutoPilotVirtualPadState"}, - FunctionInfo{323, nullptr, "UnsetAllAutoPilotVirtualPadState"}, - FunctionInfo{324, nullptr, "AttachHdlsWorkBuffer"}, - FunctionInfo{325, nullptr, "ReleaseHdlsWorkBuffer"}, - FunctionInfo{326, nullptr, "DumpHdlsNpadAssignmentState"}, - FunctionInfo{327, nullptr, "DumpHdlsStates"}, - FunctionInfo{328, nullptr, "ApplyHdlsNpadAssignmentState"}, - FunctionInfo{329, nullptr, "ApplyHdlsStateList"}, - FunctionInfo{330, nullptr, "AttachHdlsVirtualDevice"}, - FunctionInfo{331, nullptr, "DetachHdlsVirtualDevice"}, - FunctionInfo{332, nullptr, "SetHdlsState"}, - FunctionInfo{350, nullptr, "AddRegisteredDevice"}, - FunctionInfo{351, nullptr, "GetRegisteredDevicesCountDebug"}, //17.0.0-18.1.0 - FunctionInfo{352, nullptr, "DeleteRegisteredDevicesDebug"}, //17.0.0-18.1.0 - FunctionInfo{400, nullptr, "DisableExternalMcuOnNxDevice"}, - FunctionInfo{401, nullptr, "DisableRailDeviceFiltering"}, - FunctionInfo{402, nullptr, "EnableWiredPairing"}, - FunctionInfo{403, nullptr, "EnableShipmentModeAutoClear"}, - FunctionInfo{404, nullptr, "SetRailEnabled"}, - FunctionInfo{500, nullptr, "SetFactoryInt"}, - FunctionInfo{501, nullptr, "IsFactoryBootEnabled"}, - FunctionInfo{550, nullptr, "SetAnalogStickModelDataTemporarily"}, - FunctionInfo{551, nullptr, "GetAnalogStickModelData"}, - FunctionInfo{552, nullptr, "ResetAnalogStickModelData"}, - FunctionInfo{600, nullptr, "ConvertPadState"}, - FunctionInfo{601, nullptr, "IsButtonConfigSupported"}, //18.0.0+ - FunctionInfo{602, nullptr, "IsButtonConfigEmbeddedSupported"}, //18.0.0+ - FunctionInfo{603, nullptr, "DeleteButtonConfig"}, //18.0.0+ - FunctionInfo{604, nullptr, "DeleteButtonConfigEmbedded"}, //18.0.0+ - FunctionInfo{605, nullptr, "SetButtonConfigEnabled"}, //18.0.0+ - FunctionInfo{606, nullptr, "SetButtonConfigEmbeddedEnabled"}, //18.0.0+ - FunctionInfo{607, nullptr, "IsButtonConfigEnabled"}, //18.0.0+ - FunctionInfo{608, nullptr, "IsButtonConfigEmbeddedEnabled"}, //18.0.0+ - FunctionInfo{609, nullptr, "SetButtonConfigEmbedded"}, //18.0.0+ - FunctionInfo{610, nullptr, "SetButtonConfigFull"}, //18.0.0+ - FunctionInfo{611, nullptr, "SetButtonConfigLeft"}, //18.0.0+ - FunctionInfo{612, nullptr, "SetButtonConfigRight"}, //18.0.0+ - FunctionInfo{613, nullptr, "GetButtonConfigEmbedded"}, //18.0.0+ - FunctionInfo{614, nullptr, "GetButtonConfigFull"}, //18.0.0+ - FunctionInfo{615, nullptr, "GetButtonConfigLeft"}, //18.0.0+ - FunctionInfo{616, nullptr, "GetButtonConfigRight"}, //18.0.0+ - FunctionInfo{650, nullptr, "AddButtonPlayData"}, - FunctionInfo{651, nullptr, "StartButtonPlayData"}, - FunctionInfo{652, nullptr, "StopButtonPlayData"}, - FunctionInfo{700, nullptr, "GetRailAttachEventCount"}, //21.0.0+ - FunctionInfo{2000, nullptr, "DeactivateDigitizer"}, - FunctionInfo{2001, nullptr, "SetDigitizerAutoPilotState"}, - FunctionInfo{2002, nullptr, "UnsetDigitizerAutoPilotState"}, - FunctionInfo{3000, nullptr, "ReloadFirmwareDebugSettings"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IHidDebugServer::~IHidDebugServer() = default; - -Result IHidDebugServer::DeactivateTouchScreen() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetTouchScreen()->Deactivate()); - } - - R_SUCCEED(); -} - -Result IHidDebugServer::SetTouchScreenAutoPilotState( - InArray auto_pilot_buffer) { - AutoPilotState auto_pilot{}; - - auto_pilot.count = - static_cast((std::min)(auto_pilot_buffer.size(), auto_pilot.state.size())); - memcpy(auto_pilot.state.data(), auto_pilot_buffer.data(), - auto_pilot.count * sizeof(TouchState)); - - LOG_INFO(Service_HID, "called, auto_pilot_count={}", auto_pilot.count); - - R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenAutoPilotState(auto_pilot)); -} - -Result IHidDebugServer::UnsetTouchScreenAutoPilotState() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->UnsetTouchScreenAutoPilotState()); -} - -Result IHidDebugServer::GetTouchScreenConfiguration( - Out out_touchscreen_config, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); - - R_TRY(GetResourceManager()->GetTouchScreen()->GetTouchScreenConfiguration( - *out_touchscreen_config, aruid.pid)); - - if (out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Heat2 && - out_touchscreen_config->mode != Core::HID::TouchScreenModeForNx::Finger) { - out_touchscreen_config->mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; - } - - R_SUCCEED(); -} - -Result IHidDebugServer::ProcessTouchScreenAutoTune() { - LOG_INFO(Service_HID, "called"); - R_RETURN(GetResourceManager()->GetTouchScreen()->ProcessTouchScreenAutoTune()); -} - -Result IHidDebugServer::ForceStopTouchScreenManagement() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_SUCCEED(); - } - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsTouchI2cManaged()) { - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(touch_screen->IsActive(is_touch_active)); - R_TRY(gesture->IsActive(is_gesture_active)); - - if (is_touch_active) { - R_TRY(touch_screen->Deactivate()); - } - if (is_gesture_active) { - R_TRY(gesture->Deactivate()); - } - } - - R_SUCCEED(); -} - -Result IHidDebugServer::ForceRestartTouchScreenManagement(u32 basic_gesture_id, - ClientAppletResourceUserId aruid) { - LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", - basic_gesture_id, aruid.pid); - - auto touch_screen = GetResourceManager()->GetTouchScreen(); - auto gesture = GetResourceManager()->GetGesture(); - - if (firmware_settings->IsDeviceManaged() && firmware_settings->IsTouchI2cManaged()) { - R_TRY(gesture->Activate()); - R_TRY(gesture->Activate(aruid.pid, basic_gesture_id)); - R_TRY(touch_screen->Activate()); - R_TRY(touch_screen->Activate(aruid.pid)); - } - - R_SUCCEED(); -} - -Result IHidDebugServer::IsTouchScreenManaged(Out out_is_managed) { - LOG_INFO(Service_HID, "called"); - - bool is_touch_active{}; - bool is_gesture_active{}; - R_TRY(GetResourceManager()->GetTouchScreen()->IsActive(is_touch_active)); - R_TRY(GetResourceManager()->GetGesture()->IsActive(is_gesture_active)); - - *out_is_managed = is_touch_active || is_gesture_active; - R_SUCCEED(); -} - -Result IHidDebugServer::DeactivateGesture() { - LOG_INFO(Service_HID, "called"); - - if (!firmware_settings->IsDeviceManaged()) { - R_RETURN(GetResourceManager()->GetGesture()->Deactivate()); - } - - R_SUCCEED(); -} - -std::shared_ptr IHidDebugServer::GetResourceManager() { - resource_manager->Initialize(); - return resource_manager; -} - } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_debug_server.h b/src/core/hle/service/hid/hid_debug_server.h index 3a483f07e5..3eb1ce3f2e 100644 --- a/src/core/hle/service/hid/hid_debug_server.h +++ b/src/core/hle/service/hid/hid_debug_server.h @@ -15,31 +15,5 @@ namespace Service::HID { class ResourceManager; class HidFirmwareSettings; -class IHidDebugServer final : public ServiceFramework { -public: - explicit IHidDebugServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings); - ~IHidDebugServer() override; - -private: - Result DeactivateTouchScreen(); - Result SetTouchScreenAutoPilotState( - InArray auto_pilot_buffer); - Result UnsetTouchScreenAutoPilotState(); - Result GetTouchScreenConfiguration( - Out out_touchscreen_config, - ClientAppletResourceUserId aruid); - Result ProcessTouchScreenAutoTune(); - Result ForceStopTouchScreenManagement(); - Result ForceRestartTouchScreenManagement(u32 basic_gesture_id, - ClientAppletResourceUserId aruid); - Result IsTouchScreenManaged(Out out_is_managed); - Result DeactivateGesture(); - - std::shared_ptr GetResourceManager(); - - std::shared_ptr resource_manager; - std::shared_ptr firmware_settings; -}; } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 938379c0cf..04294cf15a 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp @@ -42,11 +42,8 @@ namespace Service::HID { -IHidServer::IHidServer(Core::System& system_, std::shared_ptr resource, - std::shared_ptr settings) - : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IHidServer::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, FunctionInfo{1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, FunctionInfo{11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, @@ -237,12 +234,15 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr r FunctionInfo{3013, nullptr, "SetDebugPadGenericPadMap"}, //21.0.0+ FunctionInfo{3014, nullptr, "GetDebugPadKeyboardMap"}, //21.0.0+ FunctionInfo{3015, nullptr, "SetDebugPadKeyboardMap"}, //21.0.0+ - FunctionInfo{3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion"}, //21.0.0+ + FunctionInfo{3150, C<&IHidServer::SetMouseLibraryVersion>, "SetMouseLibraryVersion"} //21.0.0+ // What? -- {12010, nullptr, "SetButtonConfigLeft"}, - }; - // clang-format on + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +IHidServer::IHidServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings) + : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { } IHidServer::~IHidServer() = default; diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index 57a1a04b9c..e198901de4 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h @@ -265,6 +265,8 @@ private: Result SetTouchScreenResolution(u32 width, u32 height, ClientAppletResourceUserId aruid); Result SetMouseLibraryVersion(ClientAppletResourceUserId aruid); + FunctionInfoBase const* FindRequest(u32 key) override; + std::shared_ptr resource_manager; std::shared_ptr firmware_settings; }; diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index d46be24c80..4df021f443 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -22,252 +22,6 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr settings) : ServiceFramework{system_, "hid:sys"}, service_context{system_, service_name}, resource_manager{resource}, firmware_settings{settings} { - // clang-format off - static const FunctionInfo functions[] = { - FunctionInfo{31, nullptr, "SendKeyboardLockKeyEvent"}, - FunctionInfo{101, nullptr, "AcquireHomeButtonEventHandle"}, - FunctionInfo{111, nullptr, "ActivateHomeButton"}, - FunctionInfo{121, nullptr, "AcquireSleepButtonEventHandle"}, - FunctionInfo{131, nullptr, "ActivateSleepButton"}, - FunctionInfo{141, nullptr, "AcquireCaptureButtonEventHandle"}, - FunctionInfo{151, nullptr, "ActivateCaptureButton"}, - FunctionInfo{161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, - FunctionInfo{210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, - FunctionInfo{211, nullptr, "GetNpadsWithNfc"}, - FunctionInfo{212, nullptr, "AcquireNfcActivateEventHandle"}, - FunctionInfo{213, nullptr, "ActivateNfc"}, - FunctionInfo{214, nullptr, "GetXcdHandleForNpadWithNfc"}, - FunctionInfo{215, nullptr, "IsNfcActivated"}, - FunctionInfo{216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, - FunctionInfo{217, nullptr, "SetNfcEvent"}, - FunctionInfo{218, nullptr, "GetNfcInfo"}, - FunctionInfo{219, nullptr, "StartNfcDiscovery"}, - FunctionInfo{220, nullptr, "StopNfcDiscovery"}, - FunctionInfo{221, nullptr, "StartNtagRead"}, - FunctionInfo{222, nullptr, "StartNtagWrite"}, - FunctionInfo{223, nullptr, "SendNfcRawData"}, - FunctionInfo{224, nullptr, "RegisterMifareKey"}, - FunctionInfo{225, nullptr, "ClearMifareKey"}, - FunctionInfo{226, nullptr, "StartMifareRead"}, - FunctionInfo{227, nullptr, "StartMifareWrite"}, - FunctionInfo{230, nullptr, "AcquireIrSensorEventHndle" }, - FunctionInfo{231, nullptr, "ActivateIrSensor"}, - FunctionInfo{232, nullptr, "GetIrSensorState"}, - FunctionInfo{233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, - FunctionInfo{234, nullptr, "GetNpadJoyHoldType"}, - FunctionInfo{241, nullptr, "GetDataFormat"}, - FunctionInfo{242, nullptr, "SetDataFormat"}, - FunctionInfo{243, nullptr, "GetMcuState"}, - FunctionInfo{244, nullptr, "SetMcuState"}, - FunctionInfo{245, nullptr, "GetMcuVersionForNfc"}, - FunctionInfo{246, nullptr, "CheckNfcDevicePower"}, - FunctionInfo{247, nullptr, "SetMcuStateImmediate"}, - FunctionInfo{301, nullptr, "ActivateNpadSystem"}, - FunctionInfo{303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, - FunctionInfo{304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, - FunctionInfo{305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, - FunctionInfo{306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, - FunctionInfo{307, nullptr, "GetNpadSystemExtStyle"}, - FunctionInfo{308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, - FunctionInfo{309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, - FunctionInfo{310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, - FunctionInfo{311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, - FunctionInfo{312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, - FunctionInfo{313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, - FunctionInfo{314, nullptr, "GetAppletFooterUiType"}, - FunctionInfo{315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, - FunctionInfo{316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, - FunctionInfo{317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, - FunctionInfo{318, &IHidSystemServer::HasBattery, "HasBattery"}, - FunctionInfo{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, - FunctionInfo{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, - FunctionInfo{322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, - FunctionInfo{323, nullptr, "GetLastActiveUniquePad"}, - FunctionInfo{324, nullptr, "GetUniquePadButtonSet"}, - FunctionInfo{325, nullptr, "GetUniquePadColor"}, - FunctionInfo{326, nullptr, "GetUniquePadAppletDetailedUiType"}, - FunctionInfo{327, nullptr, "GetAbstractedPadIdDataFromNpad"}, - FunctionInfo{328, nullptr, "AttachAbstractedPadToNpad"}, - FunctionInfo{329, nullptr, "DetachAbstractedPadAll"}, - FunctionInfo{330, nullptr, "CheckAbstractedPadConnection"}, - FunctionInfo{332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType"}, //19.0.0+ - FunctionInfo{333, nullptr, "SetNpadUserSpgApplet"}, //20.0.0+ - FunctionInfo{334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle"}, //20.0.0+ - FunctionInfo{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, - FunctionInfo{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, - FunctionInfo{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, - FunctionInfo{504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, - FunctionInfo{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, - FunctionInfo{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, - FunctionInfo{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, - FunctionInfo{510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, - FunctionInfo{511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, - FunctionInfo{512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, - FunctionInfo{513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, - FunctionInfo{514, nullptr, "Unknown514"}, - FunctionInfo{520, nullptr, "EnableHandheldHids"}, - FunctionInfo{521, nullptr, "DisableHandheldHids"}, - FunctionInfo{522, nullptr, "SetJoyConRailEnabled"}, - FunctionInfo{523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, - FunctionInfo{524, nullptr, "IsHandheldHidsEnabled"}, - FunctionInfo{525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, - FunctionInfo{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, - FunctionInfo{541, nullptr, "GetPlayReportControllerUsages"}, - FunctionInfo{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, - FunctionInfo{543, nullptr, "GetRegisteredDevicesOld"}, - FunctionInfo{544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, - FunctionInfo{545, nullptr, "SendConnectionTrigger"}, - FunctionInfo{546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, - FunctionInfo{547, nullptr, "GetAllowedBluetoothLinksCount"}, - FunctionInfo{548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, - FunctionInfo{549, nullptr, "GetConnectableRegisteredDevices"}, - FunctionInfo{551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport"}, //20.0.0+ //mocked via 548 for Diablo 3 (at least) - FunctionInfo{700, nullptr, "ActivateUniquePad"}, - FunctionInfo{702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, - FunctionInfo{703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, - FunctionInfo{711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle"}, //20.0.0+ - FunctionInfo{712, nullptr, "GetUniquePadColor12"}, //20.0.0+ - FunctionInfo{751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, - FunctionInfo{800, nullptr, "ListSixAxisSensorHandles"}, - FunctionInfo{801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, - FunctionInfo{802, nullptr, "ResetSixAxisSensorCalibrationValues"}, - FunctionInfo{803, nullptr, "StartSixAxisSensorUserCalibration"}, - FunctionInfo{804, nullptr, "CancelSixAxisSensorUserCalibration"}, - FunctionInfo{805, nullptr, "GetUniquePadBluetoothAddress"}, - FunctionInfo{806, nullptr, "DisconnectUniquePad"}, - FunctionInfo{807, nullptr, "GetUniquePadType"}, - FunctionInfo{808, nullptr, "GetUniquePadInterface"}, - FunctionInfo{809, nullptr, "GetUniquePadSerialNumber"}, - FunctionInfo{810, nullptr, "GetUniquePadControllerNumber"}, - FunctionInfo{811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, - FunctionInfo{812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, - FunctionInfo{813, nullptr, "GetDeviceType"}, - FunctionInfo{821, nullptr, "StartAnalogStickManualCalibration"}, - FunctionInfo{822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, - FunctionInfo{823, nullptr, "CancelAnalogStickManualCalibration"}, - FunctionInfo{824, nullptr, "ResetAnalogStickManualCalibration"}, - FunctionInfo{825, nullptr, "GetAnalogStickState"}, - FunctionInfo{826, nullptr, "GetAnalogStickManualCalibrationStage"}, - FunctionInfo{827, nullptr, "IsAnalogStickButtonPressed"}, - FunctionInfo{828, nullptr, "IsAnalogStickInReleasePosition"}, - FunctionInfo{829, nullptr, "IsAnalogStickInCircumference"}, - FunctionInfo{830, nullptr, "SetNotificationLedPattern"}, - FunctionInfo{831, nullptr, "SetNotificationLedPatternWithTimeout"}, - FunctionInfo{832, nullptr, "PrepareHidsForNotificationWake"}, - FunctionInfo{850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, - FunctionInfo{851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, - FunctionInfo{852, nullptr, "IsUsbConnected"}, - FunctionInfo{870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, - FunctionInfo{900, nullptr, "ActivateInputDetector"}, - FunctionInfo{901, nullptr, "NotifyInputDetector"}, - FunctionInfo{1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, - FunctionInfo{1001, nullptr, "GetFirmwareVersion"}, - FunctionInfo{1002, nullptr, "GetAvailableFirmwareVersion"}, - FunctionInfo{1003, nullptr, "IsFirmwareUpdateAvailable"}, - FunctionInfo{1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, - FunctionInfo{1005, nullptr, "StartFirmwareUpdate"}, - FunctionInfo{1006, nullptr, "AbortFirmwareUpdate"}, - FunctionInfo{1007, nullptr, "GetFirmwareUpdateState"}, - FunctionInfo{1008, nullptr, "ActivateAudioControl"}, - FunctionInfo{1009, nullptr, "AcquireAudioControlEventHandle"}, - FunctionInfo{1010, nullptr, "GetAudioControlStates"}, - FunctionInfo{1011, nullptr, "DeactivateAudioControl"}, - FunctionInfo{1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, - FunctionInfo{1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, - FunctionInfo{1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, - FunctionInfo{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, - FunctionInfo{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, - FunctionInfo{1100, nullptr, "GetHidbusSystemServiceObject"}, - FunctionInfo{1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, - FunctionInfo{1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, - FunctionInfo{1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, - FunctionInfo{1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, - FunctionInfo{1133, nullptr, "StartUsbFirmwareUpdate"}, - FunctionInfo{1134, nullptr, "GetUsbFirmwareUpdateState"}, - FunctionInfo{1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, - FunctionInfo{1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, - FunctionInfo{1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, - FunctionInfo{1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, - FunctionInfo{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, - FunctionInfo{1154, nullptr, "IsFirmwareAvailableForNotification"}, - FunctionInfo{1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, - FunctionInfo{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, - FunctionInfo{1157, nullptr, "CancelConnectionTrigger"}, - FunctionInfo{1158, nullptr, "SetConnectionLimitForSplay"}, //20.1.0+ - FunctionInfo{1159, nullptr, "ClearConnectionLimitForSplay"}, //20.1.0+ - FunctionInfo{1200, nullptr, "IsButtonConfigSupported"}, - FunctionInfo{1201, nullptr, "IsButtonConfigEmbeddedSupported"}, - FunctionInfo{1202, nullptr, "DeleteButtonConfig"}, - FunctionInfo{1203, nullptr, "DeleteButtonConfigEmbedded"}, - FunctionInfo{1204, nullptr, "SetButtonConfigEnabled"}, - FunctionInfo{1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, - FunctionInfo{1206, nullptr, "IsButtonConfigEnabled"}, - FunctionInfo{1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, - FunctionInfo{1208, nullptr, "SetButtonConfigEmbedded"}, - FunctionInfo{1209, nullptr, "SetButtonConfigFull"}, - FunctionInfo{1210, nullptr, "SetButtonConfigLeft"}, - FunctionInfo{1211, nullptr, "SetButtonConfigRight"}, - FunctionInfo{1212, nullptr, "GetButtonConfigEmbedded"}, - FunctionInfo{1213, nullptr, "GetButtonConfigFull"}, - FunctionInfo{1214, nullptr, "GetButtonConfigLeft"}, - FunctionInfo{1215, nullptr, "GetButtonConfigRight"}, - FunctionInfo{1250, nullptr, "IsCustomButtonConfigSupported"}, - FunctionInfo{1251, nullptr, "IsDefaultButtonConfigEmbedded"}, - FunctionInfo{1252, nullptr, "IsDefaultButtonConfigFull"}, - FunctionInfo{1253, nullptr, "IsDefaultButtonConfigLeft"}, - FunctionInfo{1254, nullptr, "IsDefaultButtonConfigRight"}, - FunctionInfo{1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, - FunctionInfo{1256, nullptr, "IsButtonConfigStorageFullEmpty"}, - FunctionInfo{1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, - FunctionInfo{1258, nullptr, "IsButtonConfigStorageRightEmpty"}, - FunctionInfo{1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, - FunctionInfo{1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, - FunctionInfo{1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, - FunctionInfo{1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, - FunctionInfo{1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, - FunctionInfo{1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, - FunctionInfo{1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, - FunctionInfo{1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, - FunctionInfo{1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, - FunctionInfo{1268, nullptr, "DeleteButtonConfigStorageFull"}, - FunctionInfo{1269, nullptr, "DeleteButtonConfigStorageLeft"}, - FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, - FunctionInfo{1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, - FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, - FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, - FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, - FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, - FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, - FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, - FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, - FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, - FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, - FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, - FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, - FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, - FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, - FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, - FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, - FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, - FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, - FunctionInfo{1290, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1291, nullptr, "DeleteButtonConfigStorageRight"}, - FunctionInfo{1308, nullptr, "SetButtonConfigVisible"}, //18.0.0+ - FunctionInfo{1309, nullptr, "IsButtonConfigVisible"}, //18.0.0+ - FunctionInfo{1320, nullptr, "WakeTouchScreenUp"}, //17.0.0+ - FunctionInfo{1321, nullptr, "PutTouchScreenToSleep"}, //17.0.0+ - FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, //20.0.0+ - FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, //21.0.0+ - FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, //21.0.0+ - FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, //21.0.0+ - FunctionInfo{1326, nullptr, "SetTouchScreenOffset"}, //21.0.0+ - FunctionInfo{1420, nullptr, "GetAppletResourceProperty"}, //19.0.0+ - FunctionInfo{12010, nullptr, "SetButtonConfigLeft"} //11.0.0-17.0.1 - }; - // clang-format on - - RegisterHandlers(functions); joy_detach_event = service_context.CreateEvent("IHidSystemServer::JoyDetachEvent"); acquire_device_registered_event = diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index 1a4f244d72..5412468e54 100644 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h @@ -81,6 +81,252 @@ private: std::shared_ptr GetResourceManager(); + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{31, nullptr, "SendKeyboardLockKeyEvent"}, + FunctionInfo{101, nullptr, "AcquireHomeButtonEventHandle"}, + FunctionInfo{111, nullptr, "ActivateHomeButton"}, + FunctionInfo{121, nullptr, "AcquireSleepButtonEventHandle"}, + FunctionInfo{131, nullptr, "ActivateSleepButton"}, + FunctionInfo{141, nullptr, "AcquireCaptureButtonEventHandle"}, + FunctionInfo{151, nullptr, "ActivateCaptureButton"}, + FunctionInfo{161, &IHidSystemServer::GetPlatformConfig, "GetPlatformConfig"}, + FunctionInfo{210, nullptr, "AcquireNfcDeviceUpdateEventHandle"}, + FunctionInfo{211, nullptr, "GetNpadsWithNfc"}, + FunctionInfo{212, nullptr, "AcquireNfcActivateEventHandle"}, + FunctionInfo{213, nullptr, "ActivateNfc"}, + FunctionInfo{214, nullptr, "GetXcdHandleForNpadWithNfc"}, + FunctionInfo{215, nullptr, "IsNfcActivated"}, + FunctionInfo{216, nullptr, "GetAbstractedPadIdForNpadWithNfc"}, + FunctionInfo{217, nullptr, "SetNfcEvent"}, + FunctionInfo{218, nullptr, "GetNfcInfo"}, + FunctionInfo{219, nullptr, "StartNfcDiscovery"}, + FunctionInfo{220, nullptr, "StopNfcDiscovery"}, + FunctionInfo{221, nullptr, "StartNtagRead"}, + FunctionInfo{222, nullptr, "StartNtagWrite"}, + FunctionInfo{223, nullptr, "SendNfcRawData"}, + FunctionInfo{224, nullptr, "RegisterMifareKey"}, + FunctionInfo{225, nullptr, "ClearMifareKey"}, + FunctionInfo{226, nullptr, "StartMifareRead"}, + FunctionInfo{227, nullptr, "StartMifareWrite"}, + FunctionInfo{230, nullptr, "AcquireIrSensorEventHndle" }, + FunctionInfo{231, nullptr, "ActivateIrSensor"}, + FunctionInfo{232, nullptr, "GetIrSensorState"}, + FunctionInfo{233, nullptr, "GetXcdHandleForNpadWihIrSensor" }, + FunctionInfo{234, nullptr, "GetNpadJoyHoldType"}, + FunctionInfo{241, nullptr, "GetDataFormat"}, + FunctionInfo{242, nullptr, "SetDataFormat"}, + FunctionInfo{243, nullptr, "GetMcuState"}, + FunctionInfo{244, nullptr, "SetMcuState"}, + FunctionInfo{245, nullptr, "GetMcuVersionForNfc"}, + FunctionInfo{246, nullptr, "CheckNfcDevicePower"}, + FunctionInfo{247, nullptr, "SetMcuStateImmediate"}, + FunctionInfo{301, nullptr, "ActivateNpadSystem"}, + FunctionInfo{303, &IHidSystemServer::ApplyNpadSystemCommonPolicy, "ApplyNpadSystemCommonPolicy"}, + FunctionInfo{304, &IHidSystemServer::EnableAssigningSingleOnSlSrPress, "EnableAssigningSingleOnSlSrPress"}, + FunctionInfo{305, &IHidSystemServer::DisableAssigningSingleOnSlSrPress, "DisableAssigningSingleOnSlSrPress"}, + FunctionInfo{306, &IHidSystemServer::GetLastActiveNpad, "GetLastActiveNpad"}, + FunctionInfo{307, nullptr, "GetNpadSystemExtStyle"}, + FunctionInfo{308, &IHidSystemServer::ApplyNpadSystemCommonPolicyFull, "ApplyNpadSystemCommonPolicyFull"}, + FunctionInfo{309, &IHidSystemServer::GetNpadFullKeyGripColor, "GetNpadFullKeyGripColor"}, + FunctionInfo{310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"}, + FunctionInfo{311, nullptr, "SetNpadPlayerLedBlinkingDevice"}, + FunctionInfo{312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"}, + FunctionInfo{313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"}, + FunctionInfo{314, nullptr, "GetAppletFooterUiType"}, + FunctionInfo{315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"}, + FunctionInfo{316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"}, + FunctionInfo{317, &IHidSystemServer::GetNpadLeftRightInterfaceType, "GetNpadLeftRightInterfaceType"}, + FunctionInfo{318, &IHidSystemServer::HasBattery, "HasBattery"}, + FunctionInfo{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"}, + FunctionInfo{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, + FunctionInfo{322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"}, + FunctionInfo{323, nullptr, "GetLastActiveUniquePad"}, + FunctionInfo{324, nullptr, "GetUniquePadButtonSet"}, + FunctionInfo{325, nullptr, "GetUniquePadColor"}, + FunctionInfo{326, nullptr, "GetUniquePadAppletDetailedUiType"}, + FunctionInfo{327, nullptr, "GetAbstractedPadIdDataFromNpad"}, + FunctionInfo{328, nullptr, "AttachAbstractedPadToNpad"}, + FunctionInfo{329, nullptr, "DetachAbstractedPadAll"}, + FunctionInfo{330, nullptr, "CheckAbstractedPadConnection"}, + FunctionInfo{332, nullptr, "ConvertAppletDetailedUiTypeFromPlayReportType"}, //19.0.0+ + FunctionInfo{333, nullptr, "SetNpadUserSpgApplet"}, //20.0.0+ + FunctionInfo{334, nullptr, "AcquireUniquePadButtonStateChangedEventHandle"}, //20.0.0+ + FunctionInfo{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"}, + FunctionInfo{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"}, + FunctionInfo{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"}, + FunctionInfo{504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"}, + FunctionInfo{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"}, + FunctionInfo{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"}, + FunctionInfo{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"}, + FunctionInfo{510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"}, + FunctionInfo{511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"}, + FunctionInfo{512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, + FunctionInfo{513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, + FunctionInfo{514, nullptr, "Unknown514"}, + FunctionInfo{520, nullptr, "EnableHandheldHids"}, + FunctionInfo{521, nullptr, "DisableHandheldHids"}, + FunctionInfo{522, nullptr, "SetJoyConRailEnabled"}, + FunctionInfo{523, &IHidSystemServer::IsJoyConRailEnabled, "IsJoyConRailEnabled"}, + FunctionInfo{524, nullptr, "IsHandheldHidsEnabled"}, + FunctionInfo{525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"}, + FunctionInfo{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, + FunctionInfo{541, nullptr, "GetPlayReportControllerUsages"}, + FunctionInfo{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, + FunctionInfo{543, nullptr, "GetRegisteredDevicesOld"}, + FunctionInfo{544, &IHidSystemServer::AcquireConnectionTriggerTimeoutEvent, "AcquireConnectionTriggerTimeoutEvent"}, + FunctionInfo{545, nullptr, "SendConnectionTrigger"}, + FunctionInfo{546, &IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport, "AcquireDeviceRegisteredEventForControllerSupport"}, + FunctionInfo{547, nullptr, "GetAllowedBluetoothLinksCount"}, + FunctionInfo{548, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevices"}, + FunctionInfo{549, nullptr, "GetConnectableRegisteredDevices"}, + FunctionInfo{551, &IHidSystemServer::GetRegisteredDevices, "GetRegisteredDevicesForControllerSupport"}, //20.0.0+ //mocked via 548 for Diablo 3 (at least) + FunctionInfo{700, nullptr, "ActivateUniquePad"}, + FunctionInfo{702, &IHidSystemServer::AcquireUniquePadConnectionEventHandle, "AcquireUniquePadConnectionEventHandle"}, + FunctionInfo{703, &IHidSystemServer::GetUniquePadIds, "GetUniquePadIds"}, + FunctionInfo{711, nullptr, "AcquireUniquePadConnectionOnHandheldForNsEventHandle"}, //20.0.0+ + FunctionInfo{712, nullptr, "GetUniquePadColor12"}, //20.0.0+ + FunctionInfo{751, &IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle, "AcquireJoyDetachOnBluetoothOffEventHandle"}, + FunctionInfo{800, nullptr, "ListSixAxisSensorHandles"}, + FunctionInfo{801, nullptr, "IsSixAxisSensorUserCalibrationSupported"}, + FunctionInfo{802, nullptr, "ResetSixAxisSensorCalibrationValues"}, + FunctionInfo{803, nullptr, "StartSixAxisSensorUserCalibration"}, + FunctionInfo{804, nullptr, "CancelSixAxisSensorUserCalibration"}, + FunctionInfo{805, nullptr, "GetUniquePadBluetoothAddress"}, + FunctionInfo{806, nullptr, "DisconnectUniquePad"}, + FunctionInfo{807, nullptr, "GetUniquePadType"}, + FunctionInfo{808, nullptr, "GetUniquePadInterface"}, + FunctionInfo{809, nullptr, "GetUniquePadSerialNumber"}, + FunctionInfo{810, nullptr, "GetUniquePadControllerNumber"}, + FunctionInfo{811, nullptr, "GetSixAxisSensorUserCalibrationStage"}, + FunctionInfo{812, nullptr, "GetConsoleUniqueSixAxisSensorHandle"}, + FunctionInfo{813, nullptr, "GetDeviceType"}, + FunctionInfo{821, nullptr, "StartAnalogStickManualCalibration"}, + FunctionInfo{822, nullptr, "RetryCurrentAnalogStickManualCalibrationStage"}, + FunctionInfo{823, nullptr, "CancelAnalogStickManualCalibration"}, + FunctionInfo{824, nullptr, "ResetAnalogStickManualCalibration"}, + FunctionInfo{825, nullptr, "GetAnalogStickState"}, + FunctionInfo{826, nullptr, "GetAnalogStickManualCalibrationStage"}, + FunctionInfo{827, nullptr, "IsAnalogStickButtonPressed"}, + FunctionInfo{828, nullptr, "IsAnalogStickInReleasePosition"}, + FunctionInfo{829, nullptr, "IsAnalogStickInCircumference"}, + FunctionInfo{830, nullptr, "SetNotificationLedPattern"}, + FunctionInfo{831, nullptr, "SetNotificationLedPatternWithTimeout"}, + FunctionInfo{832, nullptr, "PrepareHidsForNotificationWake"}, + FunctionInfo{850, &IHidSystemServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, + FunctionInfo{851, &IHidSystemServer::EnableUsbFullKeyController, "EnableUsbFullKeyController"}, + FunctionInfo{852, nullptr, "IsUsbConnected"}, + FunctionInfo{870, &IHidSystemServer::IsHandheldButtonPressedOnConsoleMode, "IsHandheldButtonPressedOnConsoleMode"}, + FunctionInfo{900, nullptr, "ActivateInputDetector"}, + FunctionInfo{901, nullptr, "NotifyInputDetector"}, + FunctionInfo{1000, &IHidSystemServer::InitializeFirmwareUpdate, "InitializeFirmwareUpdate"}, + FunctionInfo{1001, nullptr, "GetFirmwareVersion"}, + FunctionInfo{1002, nullptr, "GetAvailableFirmwareVersion"}, + FunctionInfo{1003, nullptr, "IsFirmwareUpdateAvailable"}, + FunctionInfo{1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"}, + FunctionInfo{1005, nullptr, "StartFirmwareUpdate"}, + FunctionInfo{1006, nullptr, "AbortFirmwareUpdate"}, + FunctionInfo{1007, nullptr, "GetFirmwareUpdateState"}, + FunctionInfo{1008, nullptr, "ActivateAudioControl"}, + FunctionInfo{1009, nullptr, "AcquireAudioControlEventHandle"}, + FunctionInfo{1010, nullptr, "GetAudioControlStates"}, + FunctionInfo{1011, nullptr, "DeactivateAudioControl"}, + FunctionInfo{1012, nullptr, "GetFirmwareVersionStringForUserSupportPage"}, + FunctionInfo{1050, nullptr, "IsSixAxisSensorAccurateUserCalibrationSupported"}, + FunctionInfo{1051, nullptr, "StartSixAxisSensorAccurateUserCalibration"}, + FunctionInfo{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, + FunctionInfo{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, + FunctionInfo{1100, nullptr, "GetHidbusSystemServiceObject"}, + FunctionInfo{1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"}, + FunctionInfo{1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"}, + FunctionInfo{1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"}, + FunctionInfo{1132, &IHidSystemServer::CheckUsbFirmwareUpdateRequired, "CheckUsbFirmwareUpdateRequired"}, + FunctionInfo{1133, nullptr, "StartUsbFirmwareUpdate"}, + FunctionInfo{1134, nullptr, "GetUsbFirmwareUpdateState"}, + FunctionInfo{1135, &IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory, "InitializeUsbFirmwareUpdateWithoutMemory"}, + FunctionInfo{1150, &IHidSystemServer::SetTouchScreenMagnification, "SetTouchScreenMagnification"}, + FunctionInfo{1151, &IHidSystemServer::GetTouchScreenFirmwareVersion, "GetTouchScreenFirmwareVersion"}, + FunctionInfo{1152, &IHidSystemServer::SetTouchScreenDefaultConfiguration, "SetTouchScreenDefaultConfiguration"}, + FunctionInfo{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"}, + FunctionInfo{1154, nullptr, "IsFirmwareAvailableForNotification"}, + FunctionInfo{1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"}, + FunctionInfo{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, + FunctionInfo{1157, nullptr, "CancelConnectionTrigger"}, + FunctionInfo{1158, nullptr, "SetConnectionLimitForSplay"}, //20.1.0+ + FunctionInfo{1159, nullptr, "ClearConnectionLimitForSplay"}, //20.1.0+ + FunctionInfo{1200, nullptr, "IsButtonConfigSupported"}, + FunctionInfo{1201, nullptr, "IsButtonConfigEmbeddedSupported"}, + FunctionInfo{1202, nullptr, "DeleteButtonConfig"}, + FunctionInfo{1203, nullptr, "DeleteButtonConfigEmbedded"}, + FunctionInfo{1204, nullptr, "SetButtonConfigEnabled"}, + FunctionInfo{1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, + FunctionInfo{1206, nullptr, "IsButtonConfigEnabled"}, + FunctionInfo{1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, + FunctionInfo{1208, nullptr, "SetButtonConfigEmbedded"}, + FunctionInfo{1209, nullptr, "SetButtonConfigFull"}, + FunctionInfo{1210, nullptr, "SetButtonConfigLeft"}, + FunctionInfo{1211, nullptr, "SetButtonConfigRight"}, + FunctionInfo{1212, nullptr, "GetButtonConfigEmbedded"}, + FunctionInfo{1213, nullptr, "GetButtonConfigFull"}, + FunctionInfo{1214, nullptr, "GetButtonConfigLeft"}, + FunctionInfo{1215, nullptr, "GetButtonConfigRight"}, + FunctionInfo{1250, nullptr, "IsCustomButtonConfigSupported"}, + FunctionInfo{1251, nullptr, "IsDefaultButtonConfigEmbedded"}, + FunctionInfo{1252, nullptr, "IsDefaultButtonConfigFull"}, + FunctionInfo{1253, nullptr, "IsDefaultButtonConfigLeft"}, + FunctionInfo{1254, nullptr, "IsDefaultButtonConfigRight"}, + FunctionInfo{1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, + FunctionInfo{1256, nullptr, "IsButtonConfigStorageFullEmpty"}, + FunctionInfo{1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, + FunctionInfo{1258, nullptr, "IsButtonConfigStorageRightEmpty"}, + FunctionInfo{1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, + FunctionInfo{1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, + FunctionInfo{1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, + FunctionInfo{1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, + FunctionInfo{1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, + FunctionInfo{1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, + FunctionInfo{1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, + FunctionInfo{1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, + FunctionInfo{1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, + FunctionInfo{1268, nullptr, "DeleteButtonConfigStorageFull"}, + FunctionInfo{1269, nullptr, "DeleteButtonConfigStorageLeft"}, + FunctionInfo{1270, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, + FunctionInfo{1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"}, + FunctionInfo{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + FunctionInfo{1274, nullptr, "SetDefaultButtonConfig"}, + FunctionInfo{1275, nullptr, "SetAllDefaultButtonConfig"}, + FunctionInfo{1276, nullptr, "SetHidButtonConfigEmbedded"}, + FunctionInfo{1277, nullptr, "SetHidButtonConfigFull"}, + FunctionInfo{1278, nullptr, "SetHidButtonConfigLeft"}, + FunctionInfo{1279, nullptr, "SetHidButtonConfigRight"}, + FunctionInfo{1280, nullptr, "GetHidButtonConfigEmbedded"}, + FunctionInfo{1281, nullptr, "GetHidButtonConfigFull"}, + FunctionInfo{1282, nullptr, "GetHidButtonConfigLeft"}, + FunctionInfo{1283, nullptr, "GetHidButtonConfigRight"}, + FunctionInfo{1284, nullptr, "GetButtonConfigStorageEmbedded"}, + FunctionInfo{1285, nullptr, "GetButtonConfigStorageFull"}, + FunctionInfo{1286, nullptr, "GetButtonConfigStorageLeft"}, + FunctionInfo{1287, nullptr, "GetButtonConfigStorageRight"}, + FunctionInfo{1288, nullptr, "SetButtonConfigStorageEmbedded"}, + FunctionInfo{1289, nullptr, "SetButtonConfigStorageFull"}, + FunctionInfo{1290, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1291, nullptr, "DeleteButtonConfigStorageRight"}, + FunctionInfo{1308, nullptr, "SetButtonConfigVisible"}, //18.0.0+ + FunctionInfo{1309, nullptr, "IsButtonConfigVisible"}, //18.0.0+ + FunctionInfo{1320, nullptr, "WakeTouchScreenUp"}, //17.0.0+ + FunctionInfo{1321, nullptr, "PutTouchScreenToSleep"}, //17.0.0+ + FunctionInfo{1322, nullptr, "AcquireTouchScreenAsyncWakeCompletedEvent"}, //20.0.0+ + FunctionInfo{1323, nullptr, "StartTouchScreenAutoTuneForSystemSettings"}, //21.0.0+ + FunctionInfo{1324, nullptr, "AcquireTouchScreenAutoTuneCompletedEvent"}, //21.0.0+ + FunctionInfo{1325, nullptr, "IsTouchScreenAutoTuneRequiredForRepairProviderReplacement"}, //21.0.0+ + FunctionInfo{1326, nullptr, "SetTouchScreenOffset"}, //21.0.0+ + FunctionInfo{1420, nullptr, "GetAppletResourceProperty"}, //19.0.0+ + FunctionInfo{12010, nullptr, "SetButtonConfigLeft"} //11.0.0-17.0.1 + ); + Kernel::KEvent* acquire_connection_trigger_timeout_event; Kernel::KEvent* acquire_device_registered_event; Kernel::KEvent* joy_detach_event; diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 43aabd36d4..42fc07c066 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -29,9 +29,8 @@ namespace Service::IRS { -IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IRS::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{302, C<&IRS::ActivateIrsensor>, "ActivateIrsensor"}, FunctionInfo{303, C<&IRS::DeactivateIrsensor>, "DeactivateIrsensor"}, FunctionInfo{304, C<&IRS::GetIrsensorSharedMemoryHandle>, "GetIrsensorSharedMemoryHandle"}, @@ -49,12 +48,13 @@ IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { FunctionInfo{316, C<&IRS::RunImageTransferExProcessor>, "RunImageTransferExProcessor"}, FunctionInfo{317, C<&IRS::RunIrLedProcessor>, "RunIrLedProcessor"}, FunctionInfo{318, C<&IRS::StopImageProcessorAsync>, "StopImageProcessorAsync"}, - FunctionInfo{319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"}, - }; - // clang-format on + FunctionInfo{319, C<&IRS::ActivateIrsensorWithFunctionLevel>, "ActivateIrsensorWithFunctionLevel"} + ); + return HandlerTableGenerateWithFind(key, functions); +} +IRS::IRS(Core::System& system_) : ServiceFramework{system_, "irs"} { u8* raw_shared_memory = system.Kernel().GetIrsSharedMem().GetPointer(); - RegisterHandlers(functions); shared_memory = std::construct_at(reinterpret_cast(raw_shared_memory)); npad_device = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); diff --git a/src/core/hle/service/hid/irs.h b/src/core/hle/service/hid/irs.h index b7266a6ce5..e00d3c2ade 100644 --- a/src/core/hle/service/hid/irs.h +++ b/src/core/hle/service/hid/irs.h @@ -154,6 +154,8 @@ private: return static_cast(*processors[index]); } + FunctionInfoBase const* FindRequest(u32 key) override; + Core::HID::EmulatedController* npad_device = nullptr; StatusManager* shared_memory = nullptr; std::array, 9> processors{}; diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 0217b23d7f..010551427b 100644 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp @@ -25,15 +25,8 @@ namespace Service::NS { -IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) - : ServiceFramework{system_, "IApplicationManagerInterface"}, - service_context{system, "IApplicationManagerInterface"}, - record_update_system_event{service_context}, sd_card_mount_status_event{service_context}, - gamecard_update_detection_event{service_context}, - gamecard_mount_status_event{service_context}, gamecard_mount_failure_event{service_context}, - gamecard_waken_ready_event{service_context}, unknown_event{service_context} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IApplicationManagerInterface::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&IApplicationManagerInterface::ListApplicationRecord>, "ListApplicationRecord"}, FunctionInfo{1, nullptr, "GenerateApplicationRecordCount"}, FunctionInfo{2, D<&IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent>, "GetApplicationRecordUpdateSystemEvent"}, @@ -479,11 +472,18 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ FunctionInfo{4105, D<&IApplicationManagerInterface::Unknown4105>, "Unknown4105"}, //23.0.0+ FunctionInfo{5000, nullptr, "Unknown5000"}, //18.0.0+ FunctionInfo{5001, nullptr, "Unknown5001"}, //18.0.0+ - FunctionInfo{9999, nullptr, "GetApplicationCertificate"}, //10.0.0-10.2.0 - }; - // clang-format on + FunctionInfo{9999, nullptr, "GetApplicationCertificate"} //10.0.0-10.2.0 + ); + return HandlerTableGenerateWithFind(key, functions); +} - RegisterHandlers(functions); +IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) + : ServiceFramework{system_, "IApplicationManagerInterface"}, + service_context{system, "IApplicationManagerInterface"}, + record_update_system_event{service_context}, sd_card_mount_status_event{service_context}, + gamecard_update_detection_event{service_context}, + gamecard_mount_status_event{service_context}, gamecard_mount_failure_event{service_context}, + gamecard_waken_ready_event{service_context}, unknown_event{service_context} { } IApplicationManagerInterface::~IApplicationManagerInterface() = default; diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.h index c4ca66f319..2f9e3ebe87 100644 --- a/src/core/hle/service/ns/application_manager_interface.h +++ b/src/core/hle/service/ns/application_manager_interface.h @@ -85,6 +85,7 @@ public: void PushApplicationRecord(HLERequestContext& ctx); void ListApplicationTitle(HLERequestContext& ctx); void ListApplicationIcon(HLERequestContext& ctx); + FunctionInfoBase const* FindRequest(u32 key) override; private: KernelHelpers::ServiceContext service_context; diff --git a/src/core/hle/service/olsc/daemon_controller.cpp b/src/core/hle/service/olsc/daemon_controller.cpp index 9678dbc8de..af56bd311f 100644 --- a/src/core/hle/service/olsc/daemon_controller.cpp +++ b/src/core/hle/service/olsc/daemon_controller.cpp @@ -9,10 +9,8 @@ namespace Service::OLSC { -IDaemonController::IDaemonController(Core::System& system_) - : ServiceFramework{system_, "IDaemonController"} { - // clang-format off - static const FunctionInfo functions[] = { +ServiceFrameworkBase::FunctionInfoBase const* IDaemonController::FindRequest(u32 key) { + static constexpr auto functions = CreateStaticMap( FunctionInfo{0, D<&IDaemonController::GetApplicationAutoTransferSetting>, "GetApplicationAutoTransferSetting"}, FunctionInfo{1, D<&IDaemonController::SetApplicationAutoTransferSetting>, "SetApplicationAutoTransferSetting"}, FunctionInfo{2, D<&IDaemonController::GetGlobalAutoUploadSetting>, "GetGlobalAutoUploadSetting"}, @@ -23,13 +21,13 @@ IDaemonController::IDaemonController(Core::System& system_) FunctionInfo{10, nullptr, "CreateForbiddenSaveDataInidication"}, FunctionInfo{11, D<&IDaemonController::StopAutonomyTaskExecution>, "StopAutonomyTaskExecution"}, FunctionInfo{12, D<&IDaemonController::GetAutonomyTaskStatus>, "GetAutonomyTaskStatus"}, - FunctionInfo{13, nullptr, "Unknown13_20_0_0_Plus"}, // 20.0.0+ - }; - // clang-format on - - RegisterHandlers(functions); + FunctionInfo{13, nullptr, "Unknown13_20_0_0_Plus"} // 20.0.0+ + ); + return HandlerTableGenerateWithFind(key, functions); } +IDaemonController::IDaemonController(Core::System& system_) : ServiceFramework{system_, "IDaemonController"} {} + IDaemonController::~IDaemonController() = default; Result IDaemonController::GetApplicationAutoTransferSetting(Out out_is_enabled, diff --git a/src/core/hle/service/olsc/daemon_controller.h b/src/core/hle/service/olsc/daemon_controller.h index 70f3d9e235..8efa90f405 100644 --- a/src/core/hle/service/olsc/daemon_controller.h +++ b/src/core/hle/service/olsc/daemon_controller.h @@ -38,6 +38,8 @@ private: Result GetAutonomyTaskStatus(Out out_status, Common::UUID user_id); + FunctionInfoBase const* FindRequest(u32 key) override; + // Internal in-memory state to back the above APIs struct AppKey { Common::UUID user_id; diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 7a34b09c24..bc7fd251c5 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -108,7 +108,6 @@ private: virtual FunctionInfoBase const* FindRequest(u32 key) = 0; virtual FunctionInfoBase const* FindRequestTipc(u32 key) = 0; - void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info); protected: @@ -132,8 +131,7 @@ protected: /** * Framework for implementing HLE services. Dispatches on the header id of incoming SyncRequests * based on a table mapping header ids to handler functions. Service implementations should inherit - * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) and - * populate it with handlers by calling #RegisterHandlers. + * from ServiceFramework using the CRTP (`class Foo : public ServiceFramework { ... };`) * * In order to avoid duplicating code in the binary and exposing too many implementation details in * the header, this class is split into a non-templated base (ServiceFrameworkBase) and a template @@ -196,17 +194,10 @@ protected: {} FunctionInfoBase const* FindRequest(u32 key) override { - auto it = handlers.find(key); - return it != handlers.end() ? std::addressof(it->second) : nullptr; + UNREACHABLE(); } - - /// Registers handlers in the service. - template - constexpr void RegisterHandlers(const FunctionInfoTyped (&functions)[N]) { - // Usually this array is sorted by id already, so hint to insert at the end - handlers.reserve(handlers.size() + N); - for (std::size_t i = 0; i < N; ++i) - handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); + FunctionInfoBase const* FindRequestTipc(u32 key) override { + UNREACHABLE(); } protected: @@ -237,8 +228,6 @@ private: // Cast back up to our original types and call the member function (static_cast(object)->*HandlerFnP(member))(ctx); } - - ::Common::unordered_map handlers; }; } // namespace Service diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp index 2173564733..1cbb27c3a4 100644 --- a/src/core/hle/service/sm/sm_controller.cpp +++ b/src/core/hle/service/sm/sm_controller.cpp @@ -112,15 +112,6 @@ void Controller::SetPointerBufferSize(HLERequestContext& ctx) { // https://switchbrew.org/wiki/IPC_Marshalling Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} { - static const FunctionInfo functions[] = { - FunctionInfo{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, - FunctionInfo{1, nullptr, "CopyFromCurrentDomain"}, - FunctionInfo{2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, - FunctionInfo{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, - FunctionInfo{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, - FunctionInfo{5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"}, //TODO: where does this come from - }; - RegisterHandlers(functions); } Controller::~Controller() = default; diff --git a/src/core/hle/service/sm/sm_controller.h b/src/core/hle/service/sm/sm_controller.h index f7e529a269..e80605b3e8 100644 --- a/src/core/hle/service/sm/sm_controller.h +++ b/src/core/hle/service/sm/sm_controller.h @@ -22,6 +22,18 @@ private: void CloneCurrentObjectEx(HLERequestContext& ctx); void QueryPointerBufferSize(HLERequestContext& ctx); void SetPointerBufferSize(HLERequestContext& ctx); + + FunctionInfoBase const* FindRequest(u32 key) override { + return HandlerTableGenerateWithFind(key, functions); + } + static constexpr auto functions = CreateStaticMap( + FunctionInfo{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, + FunctionInfo{1, nullptr, "CopyFromCurrentDomain"}, + FunctionInfo{2, &Controller::CloneCurrentObject, "CloneCurrentObject"}, + FunctionInfo{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, + FunctionInfo{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"}, + FunctionInfo{5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"} //TODO: where does this come from + ); }; } // namespace Service::SM