diff options
| author | 2024-02-27 12:26:26 -0500 | |
|---|---|---|
| committer | 2024-02-27 12:26:26 -0500 | |
| commit | dc94882c9062ab88d3d5de35dcb8731111baaea2 (patch) | |
| tree | b00be6f4a4b2c826f116e212e15f4498e4b50504 /src/core/hle | |
| parent | Merge pull request #13175 from liamwhite/asan (diff) | |
| parent | service: hid: Migrate HidServer to new IPC (diff) | |
| download | yuzu-dc94882c9062ab88d3d5de35dcb8731111baaea2.tar.gz yuzu-dc94882c9062ab88d3d5de35dcb8731111baaea2.tar.xz yuzu-dc94882c9062ab88d3d5de35dcb8731111baaea2.zip | |
Merge pull request #13135 from german77/hid-interface
service: hid: Migrate HidServer to new IPC
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/hid/active_vibration_device_list.cpp | 53 | ||||
| -rw-r--r-- | src/core/hle/service/hid/active_vibration_device_list.h | 39 | ||||
| -rw-r--r-- | src/core/hle/service/hid/applet_resource.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/hid/applet_resource.h | 36 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_server.cpp | 2609 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid_server.h | 352 |
6 files changed, 1153 insertions, 1970 deletions
diff --git a/src/core/hle/service/hid/active_vibration_device_list.cpp b/src/core/hle/service/hid/active_vibration_device_list.cpp new file mode 100644 index 000000000..c440f8382 --- /dev/null +++ b/src/core/hle/service/hid/active_vibration_device_list.cpp | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/service/cmif_serialization.h" | ||
| 6 | #include "core/hle/service/hid/active_vibration_device_list.h" | ||
| 7 | #include "hid_core/hid_result.h" | ||
| 8 | #include "hid_core/hid_util.h" | ||
| 9 | #include "hid_core/resource_manager.h" | ||
| 10 | #include "hid_core/resources/vibration/vibration_device.h" | ||
| 11 | |||
| 12 | namespace Service::HID { | ||
| 13 | |||
| 14 | IActiveVibrationDeviceList::IActiveVibrationDeviceList(Core::System& system_, | ||
| 15 | std::shared_ptr<ResourceManager> resource) | ||
| 16 | : ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) { | ||
| 17 | // clang-format off | ||
| 18 | static const FunctionInfo functions[] = { | ||
| 19 | {0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"}, | ||
| 20 | }; | ||
| 21 | // clang-format on | ||
| 22 | |||
| 23 | RegisterHandlers(functions); | ||
| 24 | } | ||
| 25 | |||
| 26 | IActiveVibrationDeviceList::~IActiveVibrationDeviceList() = default; | ||
| 27 | |||
| 28 | Result IActiveVibrationDeviceList::ActivateVibrationDevice( | ||
| 29 | Core::HID::VibrationDeviceHandle vibration_device_handle) { | ||
| 30 | LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}", | ||
| 31 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, | ||
| 32 | vibration_device_handle.device_index); | ||
| 33 | |||
| 34 | std::scoped_lock lock{mutex}; | ||
| 35 | |||
| 36 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); | ||
| 37 | |||
| 38 | for (std::size_t i = 0; i < list_size; i++) { | ||
| 39 | if (vibration_device_handle.device_index == vibration_device_list[i].device_index && | ||
| 40 | vibration_device_handle.npad_id == vibration_device_list[i].npad_id && | ||
| 41 | vibration_device_handle.npad_type == vibration_device_list[i].npad_type) { | ||
| 42 | R_SUCCEED(); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | R_UNLESS(list_size < MaxVibrationDevicesHandles, ResultVibrationDeviceIndexOutOfRange); | ||
| 47 | R_TRY(resource_manager->GetVibrationDevice(vibration_device_handle)->Activate()); | ||
| 48 | |||
| 49 | vibration_device_list[list_size++] = vibration_device_handle; | ||
| 50 | R_SUCCEED(); | ||
| 51 | } | ||
| 52 | |||
| 53 | } // namespace Service::HID | ||
diff --git a/src/core/hle/service/hid/active_vibration_device_list.h b/src/core/hle/service/hid/active_vibration_device_list.h new file mode 100644 index 000000000..beaa44d97 --- /dev/null +++ b/src/core/hle/service/hid/active_vibration_device_list.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <array> | ||
| 7 | #include <memory> | ||
| 8 | #include <mutex> | ||
| 9 | |||
| 10 | #include "core/hle/service/cmif_types.h" | ||
| 11 | #include "core/hle/service/service.h" | ||
| 12 | #include "hid_core/hid_types.h" | ||
| 13 | |||
| 14 | namespace Core { | ||
| 15 | class System; | ||
| 16 | } | ||
| 17 | |||
| 18 | namespace Service::HID { | ||
| 19 | class ResourceManager; | ||
| 20 | |||
| 21 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { | ||
| 22 | public: | ||
| 23 | explicit IActiveVibrationDeviceList(Core::System& system_, | ||
| 24 | std::shared_ptr<ResourceManager> resource); | ||
| 25 | ~IActiveVibrationDeviceList() override; | ||
| 26 | |||
| 27 | private: | ||
| 28 | static constexpr std::size_t MaxVibrationDevicesHandles{0x100}; | ||
| 29 | |||
| 30 | Result ActivateVibrationDevice(Core::HID::VibrationDeviceHandle vibration_device_handle); | ||
| 31 | |||
| 32 | mutable std::mutex mutex; | ||
| 33 | std::size_t list_size{}; | ||
| 34 | std::array<Core::HID::VibrationDeviceHandle, MaxVibrationDevicesHandles> | ||
| 35 | vibration_device_list{}; | ||
| 36 | std::shared_ptr<ResourceManager> resource_manager; | ||
| 37 | }; | ||
| 38 | |||
| 39 | } // namespace Service::HID | ||
diff --git a/src/core/hle/service/hid/applet_resource.cpp b/src/core/hle/service/hid/applet_resource.cpp new file mode 100644 index 000000000..4814d7ad5 --- /dev/null +++ b/src/core/hle/service/hid/applet_resource.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/kernel/k_shared_memory.h" | ||
| 6 | #include "core/hle/service/cmif_serialization.h" | ||
| 7 | #include "core/hle/service/hid/applet_resource.h" | ||
| 8 | #include "hid_core/resource_manager.h" | ||
| 9 | |||
| 10 | namespace Service::HID { | ||
| 11 | |||
| 12 | IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource, | ||
| 13 | u64 applet_resource_user_id) | ||
| 14 | : ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id}, | ||
| 15 | resource_manager{resource} { | ||
| 16 | static const FunctionInfo functions[] = { | ||
| 17 | {0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"}, | ||
| 18 | }; | ||
| 19 | RegisterHandlers(functions); | ||
| 20 | } | ||
| 21 | |||
| 22 | IAppletResource::~IAppletResource() { | ||
| 23 | resource_manager->FreeAppletResourceId(aruid); | ||
| 24 | } | ||
| 25 | |||
| 26 | Result IAppletResource::GetSharedMemoryHandle( | ||
| 27 | OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle) { | ||
| 28 | const auto result = resource_manager->GetSharedMemoryHandle(out_shared_memory_handle, aruid); | ||
| 29 | |||
| 30 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", aruid, result.raw); | ||
| 31 | R_RETURN(result); | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Service::HID | ||
diff --git a/src/core/hle/service/hid/applet_resource.h b/src/core/hle/service/hid/applet_resource.h new file mode 100644 index 000000000..d1e7db9b1 --- /dev/null +++ b/src/core/hle/service/hid/applet_resource.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <memory> | ||
| 7 | |||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "core/hle/service/cmif_types.h" | ||
| 10 | #include "core/hle/service/service.h" | ||
| 11 | |||
| 12 | namespace Core { | ||
| 13 | class System; | ||
| 14 | } | ||
| 15 | |||
| 16 | namespace Kernel { | ||
| 17 | class KSharedMemory; | ||
| 18 | } | ||
| 19 | |||
| 20 | namespace Service::HID { | ||
| 21 | class ResourceManager; | ||
| 22 | |||
| 23 | class IAppletResource final : public ServiceFramework<IAppletResource> { | ||
| 24 | public: | ||
| 25 | explicit IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource, | ||
| 26 | u64 applet_resource_user_id); | ||
| 27 | ~IAppletResource() override; | ||
| 28 | |||
| 29 | private: | ||
| 30 | Result GetSharedMemoryHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle); | ||
| 31 | |||
| 32 | u64 aruid{}; | ||
| 33 | std::shared_ptr<ResourceManager> resource_manager; | ||
| 34 | }; | ||
| 35 | |||
| 36 | } // namespace Service::HID | ||
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 3603d8ccf..926a3bfe9 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include <array> | 4 | #include <array> |
| 5 | |||
| 5 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 6 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 7 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| @@ -9,6 +10,8 @@ | |||
| 9 | #include "core/hle/kernel/k_transfer_memory.h" | 10 | #include "core/hle/kernel/k_transfer_memory.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/kernel.h" |
| 11 | #include "core/hle/service/cmif_serialization.h" | 12 | #include "core/hle/service/cmif_serialization.h" |
| 13 | #include "core/hle/service/hid/active_vibration_device_list.h" | ||
| 14 | #include "core/hle/service/hid/applet_resource.h" | ||
| 12 | #include "core/hle/service/hid/hid_server.h" | 15 | #include "core/hle/service/hid/hid_server.h" |
| 13 | #include "core/hle/service/ipc_helpers.h" | 16 | #include "core/hle/service/ipc_helpers.h" |
| 14 | #include "core/memory.h" | 17 | #include "core/memory.h" |
| @@ -36,168 +39,107 @@ | |||
| 36 | 39 | ||
| 37 | namespace Service::HID { | 40 | namespace Service::HID { |
| 38 | 41 | ||
| 39 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { | ||
| 40 | public: | ||
| 41 | explicit IActiveVibrationDeviceList(Core::System& system_, | ||
| 42 | std::shared_ptr<ResourceManager> resource) | ||
| 43 | : ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) { | ||
| 44 | // clang-format off | ||
| 45 | static const FunctionInfo functions[] = { | ||
| 46 | {0, &IActiveVibrationDeviceList::ActivateVibrationDevice, "ActivateVibrationDevice"}, | ||
| 47 | }; | ||
| 48 | // clang-format on | ||
| 49 | |||
| 50 | RegisterHandlers(functions); | ||
| 51 | } | ||
| 52 | |||
| 53 | private: | ||
| 54 | void ActivateVibrationDevice(HLERequestContext& ctx) { | ||
| 55 | IPC::RequestParser rp{ctx}; | ||
| 56 | const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()}; | ||
| 57 | |||
| 58 | LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}", | ||
| 59 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, | ||
| 60 | vibration_device_handle.device_index); | ||
| 61 | |||
| 62 | const auto result = ActivateVibrationDeviceImpl(vibration_device_handle); | ||
| 63 | |||
| 64 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 65 | rb.Push(result); | ||
| 66 | } | ||
| 67 | |||
| 68 | Result ActivateVibrationDeviceImpl(const Core::HID::VibrationDeviceHandle& handle) { | ||
| 69 | std::scoped_lock lock{mutex}; | ||
| 70 | |||
| 71 | const Result is_valid = IsVibrationHandleValid(handle); | ||
| 72 | if (is_valid.IsError()) { | ||
| 73 | return is_valid; | ||
| 74 | } | ||
| 75 | |||
| 76 | for (std::size_t i = 0; i < list_size; i++) { | ||
| 77 | if (handle.device_index == vibration_device_list[i].device_index && | ||
| 78 | handle.npad_id == vibration_device_list[i].npad_id && | ||
| 79 | handle.npad_type == vibration_device_list[i].npad_type) { | ||
| 80 | return ResultSuccess; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | if (list_size == vibration_device_list.size()) { | ||
| 84 | return ResultVibrationDeviceIndexOutOfRange; | ||
| 85 | } | ||
| 86 | const Result result = resource_manager->GetVibrationDevice(handle)->Activate(); | ||
| 87 | if (result.IsError()) { | ||
| 88 | return result; | ||
| 89 | } | ||
| 90 | vibration_device_list[list_size++] = handle; | ||
| 91 | return ResultSuccess; | ||
| 92 | } | ||
| 93 | |||
| 94 | mutable std::mutex mutex; | ||
| 95 | std::size_t list_size{}; | ||
| 96 | std::array<Core::HID::VibrationDeviceHandle, 0x100> vibration_device_list{}; | ||
| 97 | std::shared_ptr<ResourceManager> resource_manager; | ||
| 98 | }; | ||
| 99 | |||
| 100 | IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> resource, | 42 | IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> resource, |
| 101 | std::shared_ptr<HidFirmwareSettings> settings) | 43 | std::shared_ptr<HidFirmwareSettings> settings) |
| 102 | : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { | 44 | : ServiceFramework{system_, "hid"}, resource_manager{resource}, firmware_settings{settings} { |
| 103 | // clang-format off | 45 | // clang-format off |
| 104 | static const FunctionInfo functions[] = { | 46 | static const FunctionInfo functions[] = { |
| 105 | {0, &IHidServer::CreateAppletResource, "CreateAppletResource"}, | 47 | {0, C<&IHidServer::CreateAppletResource>, "CreateAppletResource"}, |
| 106 | {1, &IHidServer::ActivateDebugPad, "ActivateDebugPad"}, | 48 | {1, C<&IHidServer::ActivateDebugPad>, "ActivateDebugPad"}, |
| 107 | {11, &IHidServer::ActivateTouchScreen, "ActivateTouchScreen"}, | 49 | {11, C<&IHidServer::ActivateTouchScreen>, "ActivateTouchScreen"}, |
| 108 | {21, &IHidServer::ActivateMouse, "ActivateMouse"}, | 50 | {21, C<&IHidServer::ActivateMouse>, "ActivateMouse"}, |
| 109 | {26, nullptr, "ActivateDebugMouse"}, | 51 | {26, nullptr, "ActivateDebugMouse"}, |
| 110 | {31, &IHidServer::ActivateKeyboard, "ActivateKeyboard"}, | 52 | {31, C<&IHidServer::ActivateKeyboard>, "ActivateKeyboard"}, |
| 111 | {32, &IHidServer::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, | 53 | {32, C<&IHidServer::SendKeyboardLockKeyEvent>, "SendKeyboardLockKeyEvent"}, |
| 112 | {40, &IHidServer::AcquireXpadIdEventHandle, "AcquireXpadIdEventHandle"}, | 54 | {40, C<&IHidServer::AcquireXpadIdEventHandle>, "AcquireXpadIdEventHandle"}, |
| 113 | {41, &IHidServer::ReleaseXpadIdEventHandle, "ReleaseXpadIdEventHandle"}, | 55 | {41, C<&IHidServer::ReleaseXpadIdEventHandle>, "ReleaseXpadIdEventHandle"}, |
| 114 | {51, &IHidServer::ActivateXpad, "ActivateXpad"}, | 56 | {51, C<&IHidServer::ActivateXpad>, "ActivateXpad"}, |
| 115 | {55, &IHidServer::GetXpadIds, "GetXpadIds"}, | 57 | {55, C<&IHidServer::GetXpadIds>, "GetXpadIds"}, |
| 116 | {56, &IHidServer::ActivateJoyXpad, "ActivateJoyXpad"}, | 58 | {56, C<&IHidServer::ActivateJoyXpad>, "ActivateJoyXpad"}, |
| 117 | {58, &IHidServer::GetJoyXpadLifoHandle, "GetJoyXpadLifoHandle"}, | 59 | {58, C<&IHidServer::GetJoyXpadLifoHandle>, "GetJoyXpadLifoHandle"}, |
| 118 | {59, &IHidServer::GetJoyXpadIds, "GetJoyXpadIds"}, | 60 | {59, C<&IHidServer::GetJoyXpadIds>, "GetJoyXpadIds"}, |
| 119 | {60, &IHidServer::ActivateSixAxisSensor, "ActivateSixAxisSensor"}, | 61 | {60, C<&IHidServer::ActivateSixAxisSensor>, "ActivateSixAxisSensor"}, |
| 120 | {61, &IHidServer::DeactivateSixAxisSensor, "DeactivateSixAxisSensor"}, | 62 | {61, C<&IHidServer::DeactivateSixAxisSensor>, "DeactivateSixAxisSensor"}, |
| 121 | {62, &IHidServer::GetSixAxisSensorLifoHandle, "GetSixAxisSensorLifoHandle"}, | 63 | {62, C<&IHidServer::GetSixAxisSensorLifoHandle>, "GetSixAxisSensorLifoHandle"}, |
| 122 | {63, &IHidServer::ActivateJoySixAxisSensor, "ActivateJoySixAxisSensor"}, | 64 | {63, C<&IHidServer::ActivateJoySixAxisSensor>, "ActivateJoySixAxisSensor"}, |
| 123 | {64, &IHidServer::DeactivateJoySixAxisSensor, "DeactivateJoySixAxisSensor"}, | 65 | {64, C<&IHidServer::DeactivateJoySixAxisSensor>, "DeactivateJoySixAxisSensor"}, |
| 124 | {65, &IHidServer::GetJoySixAxisSensorLifoHandle, "GetJoySixAxisSensorLifoHandle"}, | 66 | {65, C<&IHidServer::GetJoySixAxisSensorLifoHandle>, "GetJoySixAxisSensorLifoHandle"}, |
| 125 | {66, &IHidServer::StartSixAxisSensor, "StartSixAxisSensor"}, | 67 | {66, C<&IHidServer::StartSixAxisSensor>, "StartSixAxisSensor"}, |
| 126 | {67, &IHidServer::StopSixAxisSensor, "StopSixAxisSensor"}, | 68 | {67, C<&IHidServer::StopSixAxisSensor>, "StopSixAxisSensor"}, |
| 127 | {68, &IHidServer::IsSixAxisSensorFusionEnabled, "IsSixAxisSensorFusionEnabled"}, | 69 | {68, C<&IHidServer::IsSixAxisSensorFusionEnabled>, "IsSixAxisSensorFusionEnabled"}, |
| 128 | {69, &IHidServer::EnableSixAxisSensorFusion, "EnableSixAxisSensorFusion"}, | 70 | {69, C<&IHidServer::EnableSixAxisSensorFusion>, "EnableSixAxisSensorFusion"}, |
| 129 | {70, &IHidServer::SetSixAxisSensorFusionParameters, "SetSixAxisSensorFusionParameters"}, | 71 | {70, C<&IHidServer::SetSixAxisSensorFusionParameters>, "SetSixAxisSensorFusionParameters"}, |
| 130 | {71, &IHidServer::GetSixAxisSensorFusionParameters, "GetSixAxisSensorFusionParameters"}, | 72 | {71, C<&IHidServer::GetSixAxisSensorFusionParameters>, "GetSixAxisSensorFusionParameters"}, |
| 131 | {72, &IHidServer::ResetSixAxisSensorFusionParameters, "ResetSixAxisSensorFusionParameters"}, | 73 | {72, C<&IHidServer::ResetSixAxisSensorFusionParameters>, "ResetSixAxisSensorFusionParameters"}, |
| 132 | {73, nullptr, "SetAccelerometerParameters"}, | 74 | {73, nullptr, "SetAccelerometerParameters"}, |
| 133 | {74, nullptr, "GetAccelerometerParameters"}, | 75 | {74, nullptr, "GetAccelerometerParameters"}, |
| 134 | {75, nullptr, "ResetAccelerometerParameters"}, | 76 | {75, nullptr, "ResetAccelerometerParameters"}, |
| 135 | {76, nullptr, "SetAccelerometerPlayMode"}, | 77 | {76, nullptr, "SetAccelerometerPlayMode"}, |
| 136 | {77, nullptr, "GetAccelerometerPlayMode"}, | 78 | {77, nullptr, "GetAccelerometerPlayMode"}, |
| 137 | {78, nullptr, "ResetAccelerometerPlayMode"}, | 79 | {78, nullptr, "ResetAccelerometerPlayMode"}, |
| 138 | {79, &IHidServer::SetGyroscopeZeroDriftMode, "SetGyroscopeZeroDriftMode"}, | 80 | {79, C<&IHidServer::SetGyroscopeZeroDriftMode>, "SetGyroscopeZeroDriftMode"}, |
| 139 | {80, &IHidServer::GetGyroscopeZeroDriftMode, "GetGyroscopeZeroDriftMode"}, | 81 | {80, C<&IHidServer::GetGyroscopeZeroDriftMode>, "GetGyroscopeZeroDriftMode"}, |
| 140 | {81, &IHidServer::ResetGyroscopeZeroDriftMode, "ResetGyroscopeZeroDriftMode"}, | 82 | {81, C<&IHidServer::ResetGyroscopeZeroDriftMode>, "ResetGyroscopeZeroDriftMode"}, |
| 141 | {82, &IHidServer::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, | 83 | {82, C<&IHidServer::IsSixAxisSensorAtRest>, "IsSixAxisSensorAtRest"}, |
| 142 | {83, &IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor, "IsFirmwareUpdateAvailableForSixAxisSensor"}, | 84 | {83, C<&IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor>, "IsFirmwareUpdateAvailableForSixAxisSensor"}, |
| 143 | {84, &IHidServer::EnableSixAxisSensorUnalteredPassthrough, "EnableSixAxisSensorUnalteredPassthrough"}, | 85 | {84, C<&IHidServer::EnableSixAxisSensorUnalteredPassthrough>, "EnableSixAxisSensorUnalteredPassthrough"}, |
| 144 | {85, &IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled, "IsSixAxisSensorUnalteredPassthroughEnabled"}, | 86 | {85, C<&IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled>, "IsSixAxisSensorUnalteredPassthroughEnabled"}, |
| 145 | {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, | 87 | {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, |
| 146 | {87, &IHidServer::LoadSixAxisSensorCalibrationParameter, "LoadSixAxisSensorCalibrationParameter"}, | 88 | {87, C<&IHidServer::LoadSixAxisSensorCalibrationParameter>, "LoadSixAxisSensorCalibrationParameter"}, |
| 147 | {88, &IHidServer::GetSixAxisSensorIcInformation, "GetSixAxisSensorIcInformation"}, | 89 | {88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, |
| 148 | {89, &IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, | 90 | {89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, |
| 149 | {91, &IHidServer::ActivateGesture, "ActivateGesture"}, | 91 | {91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, |
| 150 | {100, &IHidServer::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, | 92 | {100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, |
| 151 | {101, &IHidServer::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, | 93 | {101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, |
| 152 | {102, &IHidServer::SetSupportedNpadIdType, "SetSupportedNpadIdType"}, | 94 | {102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, |
| 153 | {103, &IHidServer::ActivateNpad, "ActivateNpad"}, | 95 | {103, C<&IHidServer::ActivateNpad>, "ActivateNpad"}, |
| 154 | {104, &IHidServer::DeactivateNpad, "DeactivateNpad"}, | 96 | {104, C<&IHidServer::DeactivateNpad>, "DeactivateNpad"}, |
| 155 | {106, &IHidServer::AcquireNpadStyleSetUpdateEventHandle, "AcquireNpadStyleSetUpdateEventHandle"}, | 97 | {106, C<&IHidServer::AcquireNpadStyleSetUpdateEventHandle>, "AcquireNpadStyleSetUpdateEventHandle"}, |
| 156 | {107, &IHidServer::DisconnectNpad, "DisconnectNpad"}, | 98 | {107, C<&IHidServer::DisconnectNpad>, "DisconnectNpad"}, |
| 157 | {108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, | 99 | {108, C<&IHidServer::GetPlayerLedPattern>, "GetPlayerLedPattern"}, |
| 158 | {109, &IHidServer::ActivateNpadWithRevision, "ActivateNpadWithRevision"}, | 100 | {109, C<&IHidServer::ActivateNpadWithRevision>, "ActivateNpadWithRevision"}, |
| 159 | {120, &IHidServer::SetNpadJoyHoldType, "SetNpadJoyHoldType"}, | 101 | {120, C<&IHidServer::SetNpadJoyHoldType>, "SetNpadJoyHoldType"}, |
| 160 | {121, &IHidServer::GetNpadJoyHoldType, "GetNpadJoyHoldType"}, | 102 | {121, C<&IHidServer::GetNpadJoyHoldType>, "GetNpadJoyHoldType"}, |
| 161 | {122, &IHidServer::SetNpadJoyAssignmentModeSingleByDefault, "SetNpadJoyAssignmentModeSingleByDefault"}, | 103 | {122, C<&IHidServer::SetNpadJoyAssignmentModeSingleByDefault>, "SetNpadJoyAssignmentModeSingleByDefault"}, |
| 162 | {123, &IHidServer::SetNpadJoyAssignmentModeSingle, "SetNpadJoyAssignmentModeSingle"}, | 104 | {123, C<&IHidServer::SetNpadJoyAssignmentModeSingle>, "SetNpadJoyAssignmentModeSingle"}, |
| 163 | {124, &IHidServer::SetNpadJoyAssignmentModeDual, "SetNpadJoyAssignmentModeDual"}, | 105 | {124, C<&IHidServer::SetNpadJoyAssignmentModeDual>, "SetNpadJoyAssignmentModeDual"}, |
| 164 | {125, &IHidServer::MergeSingleJoyAsDualJoy, "MergeSingleJoyAsDualJoy"}, | 106 | {125, C<&IHidServer::MergeSingleJoyAsDualJoy>, "MergeSingleJoyAsDualJoy"}, |
| 165 | {126, &IHidServer::StartLrAssignmentMode, "StartLrAssignmentMode"}, | 107 | {126, C<&IHidServer::StartLrAssignmentMode>, "StartLrAssignmentMode"}, |
| 166 | {127, &IHidServer::StopLrAssignmentMode, "StopLrAssignmentMode"}, | 108 | {127, C<&IHidServer::StopLrAssignmentMode>, "StopLrAssignmentMode"}, |
| 167 | {128, &IHidServer::SetNpadHandheldActivationMode, "SetNpadHandheldActivationMode"}, | 109 | {128, C<&IHidServer::SetNpadHandheldActivationMode>, "SetNpadHandheldActivationMode"}, |
| 168 | {129, &IHidServer::GetNpadHandheldActivationMode, "GetNpadHandheldActivationMode"}, | 110 | {129, C<&IHidServer::GetNpadHandheldActivationMode>, "GetNpadHandheldActivationMode"}, |
| 169 | {130, &IHidServer::SwapNpadAssignment, "SwapNpadAssignment"}, | 111 | {130, C<&IHidServer::SwapNpadAssignment>, "SwapNpadAssignment"}, |
| 170 | {131, &IHidServer::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"}, | 112 | {131, C<&IHidServer::IsUnintendedHomeButtonInputProtectionEnabled>, "IsUnintendedHomeButtonInputProtectionEnabled"}, |
| 171 | {132, &IHidServer::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"}, | 113 | {132, C<&IHidServer::EnableUnintendedHomeButtonInputProtection>, "EnableUnintendedHomeButtonInputProtection"}, |
| 172 | {133, &IHidServer::SetNpadJoyAssignmentModeSingleWithDestination, "SetNpadJoyAssignmentModeSingleWithDestination"}, | 114 | {133, C<&IHidServer::SetNpadJoyAssignmentModeSingleWithDestination>, "SetNpadJoyAssignmentModeSingleWithDestination"}, |
| 173 | {134, &IHidServer::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"}, | 115 | {134, C<&IHidServer::SetNpadAnalogStickUseCenterClamp>, "SetNpadAnalogStickUseCenterClamp"}, |
| 174 | {135, &IHidServer::SetNpadCaptureButtonAssignment, "SetNpadCaptureButtonAssignment"}, | 116 | {135, C<&IHidServer::SetNpadCaptureButtonAssignment>, "SetNpadCaptureButtonAssignment"}, |
| 175 | {136, &IHidServer::ClearNpadCaptureButtonAssignment, "ClearNpadCaptureButtonAssignment"}, | 117 | {136, C<&IHidServer::ClearNpadCaptureButtonAssignment>, "ClearNpadCaptureButtonAssignment"}, |
| 176 | {200, &IHidServer::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"}, | 118 | {200, C<&IHidServer::GetVibrationDeviceInfo>, "GetVibrationDeviceInfo"}, |
| 177 | {201, &IHidServer::SendVibrationValue, "SendVibrationValue"}, | 119 | {201, C<&IHidServer::SendVibrationValue>, "SendVibrationValue"}, |
| 178 | {202, &IHidServer::GetActualVibrationValue, "GetActualVibrationValue"}, | 120 | {202, C<&IHidServer::GetActualVibrationValue>, "GetActualVibrationValue"}, |
| 179 | {203, &IHidServer::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"}, | 121 | {203, C<&IHidServer::CreateActiveVibrationDeviceList>, "CreateActiveVibrationDeviceList"}, |
| 180 | {204, &IHidServer::PermitVibration, "PermitVibration"}, | 122 | {204, C<&IHidServer::PermitVibration>, "PermitVibration"}, |
| 181 | {205, &IHidServer::IsVibrationPermitted, "IsVibrationPermitted"}, | 123 | {205, C<&IHidServer::IsVibrationPermitted>, "IsVibrationPermitted"}, |
| 182 | {206, &IHidServer::SendVibrationValues, "SendVibrationValues"}, | 124 | {206, C<&IHidServer::SendVibrationValues>, "SendVibrationValues"}, |
| 183 | {207, &IHidServer::SendVibrationGcErmCommand, "SendVibrationGcErmCommand"}, | 125 | {207, C<&IHidServer::SendVibrationGcErmCommand>, "SendVibrationGcErmCommand"}, |
| 184 | {208, &IHidServer::GetActualVibrationGcErmCommand, "GetActualVibrationGcErmCommand"}, | 126 | {208, C<&IHidServer::GetActualVibrationGcErmCommand>, "GetActualVibrationGcErmCommand"}, |
| 185 | {209, &IHidServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, | 127 | {209, C<&IHidServer::BeginPermitVibrationSession>, "BeginPermitVibrationSession"}, |
| 186 | {210, &IHidServer::EndPermitVibrationSession, "EndPermitVibrationSession"}, | 128 | {210, C<&IHidServer::EndPermitVibrationSession>, "EndPermitVibrationSession"}, |
| 187 | {211, &IHidServer::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"}, | 129 | {211, C<&IHidServer::IsVibrationDeviceMounted>, "IsVibrationDeviceMounted"}, |
| 188 | {212, &IHidServer::SendVibrationValueInBool, "SendVibrationValueInBool"}, | 130 | {212, C<&IHidServer::SendVibrationValueInBool>, "SendVibrationValueInBool"}, |
| 189 | {300, &IHidServer::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"}, | 131 | {300, C<&IHidServer::ActivateConsoleSixAxisSensor>, "ActivateConsoleSixAxisSensor"}, |
| 190 | {301, &IHidServer::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, | 132 | {301, C<&IHidServer::StartConsoleSixAxisSensor>, "StartConsoleSixAxisSensor"}, |
| 191 | {302, &IHidServer::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"}, | 133 | {302, C<&IHidServer::StopConsoleSixAxisSensor>, "StopConsoleSixAxisSensor"}, |
| 192 | {303, &IHidServer::ActivateSevenSixAxisSensor, "ActivateSevenSixAxisSensor"}, | 134 | {303, C<&IHidServer::ActivateSevenSixAxisSensor>, "ActivateSevenSixAxisSensor"}, |
| 193 | {304, &IHidServer::StartSevenSixAxisSensor, "StartSevenSixAxisSensor"}, | 135 | {304, C<&IHidServer::StartSevenSixAxisSensor>, "StartSevenSixAxisSensor"}, |
| 194 | {305, &IHidServer::StopSevenSixAxisSensor, "StopSevenSixAxisSensor"}, | 136 | {305, C<&IHidServer::StopSevenSixAxisSensor>, "StopSevenSixAxisSensor"}, |
| 195 | {306, &IHidServer::InitializeSevenSixAxisSensor, "InitializeSevenSixAxisSensor"}, | 137 | {306, C<&IHidServer::InitializeSevenSixAxisSensor>, "InitializeSevenSixAxisSensor"}, |
| 196 | {307, &IHidServer::FinalizeSevenSixAxisSensor, "FinalizeSevenSixAxisSensor"}, | 138 | {307, C<&IHidServer::FinalizeSevenSixAxisSensor>, "FinalizeSevenSixAxisSensor"}, |
| 197 | {308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, | 139 | {308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, |
| 198 | {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, | 140 | {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, |
| 199 | {310, &IHidServer::ResetSevenSixAxisSensorTimestamp, "ResetSevenSixAxisSensorTimestamp"}, | 141 | {310, C<&IHidServer::ResetSevenSixAxisSensorTimestamp>, "ResetSevenSixAxisSensorTimestamp"}, |
| 200 | {400, &IHidServer::IsUsbFullKeyControllerEnabled, "IsUsbFullKeyControllerEnabled"}, | 142 | {400, C<&IHidServer::IsUsbFullKeyControllerEnabled>, "IsUsbFullKeyControllerEnabled"}, |
| 201 | {401, nullptr, "EnableUsbFullKeyController"}, | 143 | {401, nullptr, "EnableUsbFullKeyController"}, |
| 202 | {402, nullptr, "IsUsbFullKeyControllerConnected"}, | 144 | {402, nullptr, "IsUsbFullKeyControllerConnected"}, |
| 203 | {403, nullptr, "HasBattery"}, | 145 | {403, nullptr, "HasBattery"}, |
| @@ -206,41 +148,41 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r | |||
| 206 | {406, nullptr, "GetNpadLeftRightInterfaceType"}, | 148 | {406, nullptr, "GetNpadLeftRightInterfaceType"}, |
| 207 | {407, nullptr, "GetNpadOfHighestBatteryLevel"}, | 149 | {407, nullptr, "GetNpadOfHighestBatteryLevel"}, |
| 208 | {408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, | 150 | {408, nullptr, "GetNpadOfHighestBatteryLevelForJoyRight"}, |
| 209 | {500, &IHidServer::GetPalmaConnectionHandle, "GetPalmaConnectionHandle"}, | 151 | {500, C<&IHidServer::GetPalmaConnectionHandle>, "GetPalmaConnectionHandle"}, |
| 210 | {501, &IHidServer::InitializePalma, "InitializePalma"}, | 152 | {501, C<&IHidServer::InitializePalma>, "InitializePalma"}, |
| 211 | {502, &IHidServer::AcquirePalmaOperationCompleteEvent, "AcquirePalmaOperationCompleteEvent"}, | 153 | {502, C<&IHidServer::AcquirePalmaOperationCompleteEvent>, "AcquirePalmaOperationCompleteEvent"}, |
| 212 | {503, &IHidServer::GetPalmaOperationInfo, "GetPalmaOperationInfo"}, | 154 | {503, C<&IHidServer::GetPalmaOperationInfo>, "GetPalmaOperationInfo"}, |
| 213 | {504, &IHidServer::PlayPalmaActivity, "PlayPalmaActivity"}, | 155 | {504, C<&IHidServer::PlayPalmaActivity>, "PlayPalmaActivity"}, |
| 214 | {505, &IHidServer::SetPalmaFrModeType, "SetPalmaFrModeType"}, | 156 | {505, C<&IHidServer::SetPalmaFrModeType>, "SetPalmaFrModeType"}, |
| 215 | {506, &IHidServer::ReadPalmaStep, "ReadPalmaStep"}, | 157 | {506, C<&IHidServer::ReadPalmaStep>, "ReadPalmaStep"}, |
| 216 | {507, &IHidServer::EnablePalmaStep, "EnablePalmaStep"}, | 158 | {507, C<&IHidServer::EnablePalmaStep>, "EnablePalmaStep"}, |
| 217 | {508, &IHidServer::ResetPalmaStep, "ResetPalmaStep"}, | 159 | {508, C<&IHidServer::ResetPalmaStep>, "ResetPalmaStep"}, |
| 218 | {509, &IHidServer::ReadPalmaApplicationSection, "ReadPalmaApplicationSection"}, | 160 | {509, C<&IHidServer::ReadPalmaApplicationSection>, "ReadPalmaApplicationSection"}, |
| 219 | {510, &IHidServer::WritePalmaApplicationSection, "WritePalmaApplicationSection"}, | 161 | {510, C<&IHidServer::WritePalmaApplicationSection>, "WritePalmaApplicationSection"}, |
| 220 | {511, &IHidServer::ReadPalmaUniqueCode, "ReadPalmaUniqueCode"}, | 162 | {511, C<&IHidServer::ReadPalmaUniqueCode>, "ReadPalmaUniqueCode"}, |
| 221 | {512, &IHidServer::SetPalmaUniqueCodeInvalid, "SetPalmaUniqueCodeInvalid"}, | 163 | {512, C<&IHidServer::SetPalmaUniqueCodeInvalid>, "SetPalmaUniqueCodeInvalid"}, |
| 222 | {513, &IHidServer::WritePalmaActivityEntry, "WritePalmaActivityEntry"}, | 164 | {513, C<&IHidServer::WritePalmaActivityEntry>, "WritePalmaActivityEntry"}, |
| 223 | {514, &IHidServer::WritePalmaRgbLedPatternEntry, "WritePalmaRgbLedPatternEntry"}, | 165 | {514, C<&IHidServer::WritePalmaRgbLedPatternEntry>, "WritePalmaRgbLedPatternEntry"}, |
| 224 | {515, &IHidServer::WritePalmaWaveEntry, "WritePalmaWaveEntry"}, | 166 | {515, C<&IHidServer::WritePalmaWaveEntry>, "WritePalmaWaveEntry"}, |
| 225 | {516, &IHidServer::SetPalmaDataBaseIdentificationVersion, "SetPalmaDataBaseIdentificationVersion"}, | 167 | {516, C<&IHidServer::SetPalmaDataBaseIdentificationVersion>, "SetPalmaDataBaseIdentificationVersion"}, |
| 226 | {517, &IHidServer::GetPalmaDataBaseIdentificationVersion, "GetPalmaDataBaseIdentificationVersion"}, | 168 | {517, C<&IHidServer::GetPalmaDataBaseIdentificationVersion>, "GetPalmaDataBaseIdentificationVersion"}, |
| 227 | {518, &IHidServer::SuspendPalmaFeature, "SuspendPalmaFeature"}, | 169 | {518, C<&IHidServer::SuspendPalmaFeature>, "SuspendPalmaFeature"}, |
| 228 | {519, &IHidServer::GetPalmaOperationResult, "GetPalmaOperationResult"}, | 170 | {519, C<&IHidServer::GetPalmaOperationResult>, "GetPalmaOperationResult"}, |
| 229 | {520, &IHidServer::ReadPalmaPlayLog, "ReadPalmaPlayLog"}, | 171 | {520, C<&IHidServer::ReadPalmaPlayLog>, "ReadPalmaPlayLog"}, |
| 230 | {521, &IHidServer::ResetPalmaPlayLog, "ResetPalmaPlayLog"}, | 172 | {521, C<&IHidServer::ResetPalmaPlayLog>, "ResetPalmaPlayLog"}, |
| 231 | {522, &IHidServer::SetIsPalmaAllConnectable, "SetIsPalmaAllConnectable"}, | 173 | {522, C<&IHidServer::SetIsPalmaAllConnectable>, "SetIsPalmaAllConnectable"}, |
| 232 | {523, &IHidServer::SetIsPalmaPairedConnectable, "SetIsPalmaPairedConnectable"}, | 174 | {523, C<&IHidServer::SetIsPalmaPairedConnectable>, "SetIsPalmaPairedConnectable"}, |
| 233 | {524, &IHidServer::PairPalma, "PairPalma"}, | 175 | {524, C<&IHidServer::PairPalma>, "PairPalma"}, |
| 234 | {525, &IHidServer::SetPalmaBoostMode, "SetPalmaBoostMode"}, | 176 | {525, C<&IHidServer::SetPalmaBoostMode>, "SetPalmaBoostMode"}, |
| 235 | {526, &IHidServer::CancelWritePalmaWaveEntry, "CancelWritePalmaWaveEntry"}, | 177 | {526, C<&IHidServer::CancelWritePalmaWaveEntry>, "CancelWritePalmaWaveEntry"}, |
| 236 | {527, &IHidServer::EnablePalmaBoostMode, "EnablePalmaBoostMode"}, | 178 | {527, C<&IHidServer::EnablePalmaBoostMode>, "EnablePalmaBoostMode"}, |
| 237 | {528, &IHidServer::GetPalmaBluetoothAddress, "GetPalmaBluetoothAddress"}, | 179 | {528, C<&IHidServer::GetPalmaBluetoothAddress>, "GetPalmaBluetoothAddress"}, |
| 238 | {529, &IHidServer::SetDisallowedPalmaConnection, "SetDisallowedPalmaConnection"}, | 180 | {529, C<&IHidServer::SetDisallowedPalmaConnection>, "SetDisallowedPalmaConnection"}, |
| 239 | {1000, &IHidServer::SetNpadCommunicationMode, "SetNpadCommunicationMode"}, | 181 | {1000, C<&IHidServer::SetNpadCommunicationMode>, "SetNpadCommunicationMode"}, |
| 240 | {1001, &IHidServer::GetNpadCommunicationMode, "GetNpadCommunicationMode"}, | 182 | {1001, C<&IHidServer::GetNpadCommunicationMode>, "GetNpadCommunicationMode"}, |
| 241 | {1002, &IHidServer::SetTouchScreenConfiguration, "SetTouchScreenConfiguration"}, | 183 | {1002, C<&IHidServer::SetTouchScreenConfiguration>, "SetTouchScreenConfiguration"}, |
| 242 | {1003, &IHidServer::IsFirmwareUpdateNeededForNotification, "IsFirmwareUpdateNeededForNotification"}, | 184 | {1003, C<&IHidServer::IsFirmwareUpdateNeededForNotification>, "IsFirmwareUpdateNeededForNotification"}, |
| 243 | {1004, &IHidServer::SetTouchScreenResolution, "SetTouchScreenResolution"}, | 185 | {1004, C<&IHidServer::SetTouchScreenResolution>, "SetTouchScreenResolution"}, |
| 244 | {2000, nullptr, "ActivateDigitizer"}, | 186 | {2000, nullptr, "ActivateDigitizer"}, |
| 245 | }; | 187 | }; |
| 246 | // clang-format on | 188 | // clang-format on |
| @@ -250,890 +192,455 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r | |||
| 250 | 192 | ||
| 251 | IHidServer::~IHidServer() = default; | 193 | IHidServer::~IHidServer() = default; |
| 252 | 194 | ||
| 253 | void IHidServer::CreateAppletResource(HLERequestContext& ctx) { | 195 | Result IHidServer::CreateAppletResource(OutInterface<IAppletResource> out_applet_resource, |
| 254 | IPC::RequestParser rp{ctx}; | 196 | ClientAppletResourceUserId aruid) { |
| 255 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 197 | const auto result = GetResourceManager()->CreateAppletResource(aruid.pid); |
| 256 | |||
| 257 | Result result = GetResourceManager()->CreateAppletResource(applet_resource_user_id); | ||
| 258 | 198 | ||
| 259 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", | 199 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", aruid.pid, |
| 260 | applet_resource_user_id, result.raw); | 200 | result.raw); |
| 261 | 201 | ||
| 262 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 202 | *out_applet_resource = std::make_shared<IAppletResource>(system, resource_manager, aruid.pid); |
| 263 | rb.Push(result); | 203 | R_SUCCEED(); |
| 264 | rb.PushIpcInterface<IAppletResource>(system, resource_manager, applet_resource_user_id); | ||
| 265 | } | 204 | } |
| 266 | 205 | ||
| 267 | void IHidServer::ActivateDebugPad(HLERequestContext& ctx) { | 206 | Result IHidServer::ActivateDebugPad(ClientAppletResourceUserId aruid) { |
| 268 | IPC::RequestParser rp{ctx}; | 207 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 269 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 270 | |||
| 271 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 272 | |||
| 273 | Result result = ResultSuccess; | ||
| 274 | auto debug_pad = GetResourceManager()->GetDebugPad(); | ||
| 275 | 208 | ||
| 276 | if (!firmware_settings->IsDeviceManaged()) { | 209 | if (!firmware_settings->IsDeviceManaged()) { |
| 277 | result = debug_pad->Activate(); | 210 | R_TRY(GetResourceManager()->GetDebugPad()->Activate()); |
| 278 | } | ||
| 279 | |||
| 280 | if (result.IsSuccess()) { | ||
| 281 | result = debug_pad->Activate(applet_resource_user_id); | ||
| 282 | } | 211 | } |
| 283 | 212 | ||
| 284 | IPC::ResponseBuilder rb{ctx, 2}; | 213 | R_RETURN(GetResourceManager()->GetDebugPad()->Activate(aruid.pid)); |
| 285 | rb.Push(result); | ||
| 286 | } | 214 | } |
| 287 | 215 | ||
| 288 | void IHidServer::ActivateTouchScreen(HLERequestContext& ctx) { | 216 | Result IHidServer::ActivateTouchScreen(ClientAppletResourceUserId aruid) { |
| 289 | IPC::RequestParser rp{ctx}; | 217 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 290 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 291 | |||
| 292 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 293 | |||
| 294 | Result result = ResultSuccess; | ||
| 295 | auto touch_screen = GetResourceManager()->GetTouchScreen(); | ||
| 296 | 218 | ||
| 297 | if (!firmware_settings->IsDeviceManaged()) { | 219 | if (!firmware_settings->IsDeviceManaged()) { |
| 298 | result = touch_screen->Activate(); | 220 | R_TRY(GetResourceManager()->GetTouchScreen()->Activate()); |
| 299 | } | ||
| 300 | |||
| 301 | if (result.IsSuccess()) { | ||
| 302 | result = touch_screen->Activate(applet_resource_user_id); | ||
| 303 | } | 221 | } |
| 304 | 222 | ||
| 305 | IPC::ResponseBuilder rb{ctx, 2}; | 223 | R_RETURN(GetResourceManager()->GetTouchScreen()->Activate(aruid.pid)); |
| 306 | rb.Push(result); | ||
| 307 | } | 224 | } |
| 308 | 225 | ||
| 309 | void IHidServer::ActivateMouse(HLERequestContext& ctx) { | 226 | Result IHidServer::ActivateMouse(ClientAppletResourceUserId aruid) { |
| 310 | IPC::RequestParser rp{ctx}; | 227 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 311 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 312 | |||
| 313 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 314 | |||
| 315 | Result result = ResultSuccess; | ||
| 316 | auto mouse = GetResourceManager()->GetMouse(); | ||
| 317 | 228 | ||
| 318 | if (!firmware_settings->IsDeviceManaged()) { | 229 | if (!firmware_settings->IsDeviceManaged()) { |
| 319 | result = mouse->Activate(); | 230 | R_TRY(GetResourceManager()->GetMouse()->Activate()); |
| 320 | } | ||
| 321 | |||
| 322 | if (result.IsSuccess()) { | ||
| 323 | result = mouse->Activate(applet_resource_user_id); | ||
| 324 | } | 231 | } |
| 325 | 232 | ||
| 326 | IPC::ResponseBuilder rb{ctx, 2}; | 233 | R_RETURN(GetResourceManager()->GetMouse()->Activate(aruid.pid)); |
| 327 | rb.Push(result); | ||
| 328 | } | 234 | } |
| 329 | 235 | ||
| 330 | void IHidServer::ActivateKeyboard(HLERequestContext& ctx) { | 236 | Result IHidServer::ActivateKeyboard(ClientAppletResourceUserId aruid) { |
| 331 | IPC::RequestParser rp{ctx}; | 237 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 332 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 333 | |||
| 334 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 335 | |||
| 336 | Result result = ResultSuccess; | ||
| 337 | auto keyboard = GetResourceManager()->GetKeyboard(); | ||
| 338 | 238 | ||
| 339 | if (!firmware_settings->IsDeviceManaged()) { | 239 | if (!firmware_settings->IsDeviceManaged()) { |
| 340 | result = keyboard->Activate(); | 240 | R_TRY(GetResourceManager()->GetKeyboard()->Activate()); |
| 341 | } | 241 | } |
| 342 | 242 | ||
| 343 | if (result.IsSuccess()) { | 243 | R_RETURN(GetResourceManager()->GetKeyboard()->Activate(aruid.pid)); |
| 344 | result = keyboard->Activate(applet_resource_user_id); | ||
| 345 | } | ||
| 346 | |||
| 347 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 348 | rb.Push(result); | ||
| 349 | } | 244 | } |
| 350 | 245 | ||
| 351 | void IHidServer::SendKeyboardLockKeyEvent(HLERequestContext& ctx) { | 246 | Result IHidServer::SendKeyboardLockKeyEvent(u32 flags) { |
| 352 | IPC::RequestParser rp{ctx}; | ||
| 353 | const auto flags{rp.Pop<u32>()}; | ||
| 354 | |||
| 355 | LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); | 247 | LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); |
| 356 | 248 | R_SUCCEED(); | |
| 357 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 358 | rb.Push(ResultSuccess); | ||
| 359 | } | 249 | } |
| 360 | 250 | ||
| 361 | void IHidServer::AcquireXpadIdEventHandle(HLERequestContext& ctx) { | 251 | Result IHidServer::AcquireXpadIdEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event, |
| 362 | IPC::RequestParser rp{ctx}; | 252 | ClientAppletResourceUserId aruid) { |
| 363 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 253 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 364 | |||
| 365 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 366 | 254 | ||
| 367 | // This function has been stubbed since 10.0.0+ | 255 | // This function has been stubbed since 10.0.0+ |
| 368 | 256 | *out_event = nullptr; | |
| 369 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 257 | R_SUCCEED(); |
| 370 | rb.Push(ResultSuccess); | ||
| 371 | // Handle returned is null here | ||
| 372 | } | 258 | } |
| 373 | 259 | ||
| 374 | void IHidServer::ReleaseXpadIdEventHandle(HLERequestContext& ctx) { | 260 | Result IHidServer::ReleaseXpadIdEventHandle(ClientAppletResourceUserId aruid) { |
| 375 | IPC::RequestParser rp{ctx}; | 261 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 376 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 377 | |||
| 378 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 379 | 262 | ||
| 380 | // This function has been stubbed since 10.0.0+ | 263 | // This function has been stubbed since 10.0.0+ |
| 381 | 264 | R_SUCCEED(); | |
| 382 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 383 | rb.Push(ResultSuccess); | ||
| 384 | } | 265 | } |
| 385 | 266 | ||
| 386 | void IHidServer::ActivateXpad(HLERequestContext& ctx) { | 267 | Result IHidServer::ActivateXpad(u32 basic_xpad_id, ClientAppletResourceUserId aruid) { |
| 387 | IPC::RequestParser rp{ctx}; | 268 | LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}", basic_xpad_id, |
| 388 | struct Parameters { | 269 | aruid.pid); |
| 389 | u32 basic_xpad_id; | ||
| 390 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 391 | u64 applet_resource_user_id; | ||
| 392 | }; | ||
| 393 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 394 | |||
| 395 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 396 | |||
| 397 | LOG_DEBUG(Service_HID, "called, basic_xpad_id={}, applet_resource_user_id={}", | ||
| 398 | parameters.basic_xpad_id, parameters.applet_resource_user_id); | ||
| 399 | 270 | ||
| 400 | // This function has been stubbed since 10.0.0+ | 271 | // This function has been stubbed since 10.0.0+ |
| 401 | 272 | R_SUCCEED(); | |
| 402 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 403 | rb.Push(ResultSuccess); | ||
| 404 | } | 273 | } |
| 405 | 274 | ||
| 406 | void IHidServer::GetXpadIds(HLERequestContext& ctx) { | 275 | Result IHidServer::GetXpadIds(Out<u64> out_count, |
| 276 | OutArray<u32, BufferAttr_HipcPointer> out_basic_pad_ids) { | ||
| 407 | LOG_DEBUG(Service_HID, "called"); | 277 | LOG_DEBUG(Service_HID, "called"); |
| 408 | 278 | ||
| 409 | // This function has been hardcoded since 10.0.0+ | 279 | // This function has been hardcoded since 10.0.0+ |
| 410 | const std::array<u32, 4> basic_xpad_id{0, 1, 2, 3}; | 280 | out_basic_pad_ids[0] = 0; |
| 411 | ctx.WriteBuffer(basic_xpad_id); | 281 | out_basic_pad_ids[1] = 1; |
| 412 | 282 | out_basic_pad_ids[2] = 2; | |
| 413 | IPC::ResponseBuilder rb{ctx, 4}; | 283 | out_basic_pad_ids[3] = 3; |
| 414 | rb.Push(ResultSuccess); | 284 | *out_count = 4; |
| 415 | rb.Push<s64>(basic_xpad_id.size()); | 285 | R_SUCCEED(); |
| 416 | } | 286 | } |
| 417 | 287 | ||
| 418 | void IHidServer::ActivateJoyXpad(HLERequestContext& ctx) { | 288 | Result IHidServer::ActivateJoyXpad(u32 joy_xpad_id) { |
| 419 | IPC::RequestParser rp{ctx}; | ||
| 420 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 421 | |||
| 422 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 289 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 423 | 290 | ||
| 424 | // This function has been stubbed since 10.0.0+ | 291 | // This function has been stubbed since 10.0.0+ |
| 425 | 292 | R_SUCCEED(); | |
| 426 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 427 | rb.Push(ResultSuccess); | ||
| 428 | } | 293 | } |
| 429 | 294 | ||
| 430 | void IHidServer::GetJoyXpadLifoHandle(HLERequestContext& ctx) { | 295 | Result IHidServer::GetJoyXpadLifoHandle( |
| 431 | IPC::RequestParser rp{ctx}; | 296 | OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, u32 joy_xpad_id) { |
| 432 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 433 | |||
| 434 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 297 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 435 | 298 | ||
| 436 | // This function has been stubbed since 10.0.0+ | 299 | // This function has been stubbed since 10.0.0+ |
| 437 | 300 | *out_shared_memory_handle = nullptr; | |
| 438 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 301 | R_SUCCEED(); |
| 439 | rb.Push(ResultSuccess); | ||
| 440 | // Handle returned is null here | ||
| 441 | } | 302 | } |
| 442 | 303 | ||
| 443 | void IHidServer::GetJoyXpadIds(HLERequestContext& ctx) { | 304 | Result IHidServer::GetJoyXpadIds(Out<s64> out_basic_xpad_id_count) { |
| 444 | LOG_DEBUG(Service_HID, "called"); | 305 | LOG_DEBUG(Service_HID, "called"); |
| 445 | 306 | ||
| 446 | // This function has been hardcoded since 10.0.0+ | 307 | // This function has been hardcoded since 10.0.0+ |
| 447 | const s64 basic_xpad_id_count{}; | 308 | *out_basic_xpad_id_count = 0; |
| 448 | 309 | R_SUCCEED(); | |
| 449 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 450 | rb.Push(ResultSuccess); | ||
| 451 | rb.Push(basic_xpad_id_count); | ||
| 452 | } | 310 | } |
| 453 | 311 | ||
| 454 | void IHidServer::ActivateSixAxisSensor(HLERequestContext& ctx) { | 312 | Result IHidServer::ActivateSixAxisSensor(u32 joy_xpad_id) { |
| 455 | IPC::RequestParser rp{ctx}; | ||
| 456 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 457 | |||
| 458 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 313 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 459 | 314 | ||
| 460 | // This function has been stubbed since 10.0.0+ | 315 | // This function has been stubbed since 10.0.0+ |
| 461 | 316 | R_SUCCEED(); | |
| 462 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 463 | rb.Push(ResultSuccess); | ||
| 464 | } | 317 | } |
| 465 | 318 | ||
| 466 | void IHidServer::DeactivateSixAxisSensor(HLERequestContext& ctx) { | 319 | Result IHidServer::DeactivateSixAxisSensor(u32 joy_xpad_id) { |
| 467 | IPC::RequestParser rp{ctx}; | ||
| 468 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 469 | |||
| 470 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 320 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 471 | 321 | ||
| 472 | // This function has been stubbed since 10.0.0+ | 322 | // This function has been stubbed since 10.0.0+ |
| 473 | 323 | R_SUCCEED(); | |
| 474 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 475 | rb.Push(ResultSuccess); | ||
| 476 | } | 324 | } |
| 477 | 325 | ||
| 478 | void IHidServer::GetSixAxisSensorLifoHandle(HLERequestContext& ctx) { | 326 | Result IHidServer::GetSixAxisSensorLifoHandle( |
| 479 | IPC::RequestParser rp{ctx}; | 327 | OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, u32 joy_xpad_id) { |
| 480 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 481 | |||
| 482 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 328 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 483 | 329 | ||
| 484 | // This function has been stubbed since 10.0.0+ | 330 | // This function has been stubbed since 10.0.0+ |
| 485 | 331 | *out_shared_memory_handle = nullptr; | |
| 486 | IPC::ResponseBuilder rb{ctx, 2}; | 332 | R_SUCCEED(); |
| 487 | rb.Push(ResultSuccess); | ||
| 488 | } | 333 | } |
| 489 | 334 | ||
| 490 | void IHidServer::ActivateJoySixAxisSensor(HLERequestContext& ctx) { | 335 | Result IHidServer::ActivateJoySixAxisSensor(u32 joy_xpad_id) { |
| 491 | IPC::RequestParser rp{ctx}; | ||
| 492 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 493 | |||
| 494 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 336 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 495 | 337 | ||
| 496 | // This function has been stubbed since 10.0.0+ | 338 | // This function has been stubbed since 10.0.0+ |
| 497 | 339 | R_SUCCEED(); | |
| 498 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 499 | rb.Push(ResultSuccess); | ||
| 500 | } | 340 | } |
| 501 | 341 | ||
| 502 | void IHidServer::DeactivateJoySixAxisSensor(HLERequestContext& ctx) { | 342 | Result IHidServer::DeactivateJoySixAxisSensor(u32 joy_xpad_id) { |
| 503 | IPC::RequestParser rp{ctx}; | ||
| 504 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 505 | |||
| 506 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 343 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 507 | 344 | ||
| 508 | // This function has been stubbed since 10.0.0+ | 345 | // This function has been stubbed since 10.0.0+ |
| 509 | 346 | R_SUCCEED(); | |
| 510 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 511 | rb.Push(ResultSuccess); | ||
| 512 | } | 347 | } |
| 513 | 348 | ||
| 514 | void IHidServer::GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx) { | 349 | Result IHidServer::GetJoySixAxisSensorLifoHandle( |
| 515 | IPC::RequestParser rp{ctx}; | 350 | OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, u32 joy_xpad_id) { |
| 516 | const auto joy_xpad_id{rp.Pop<u32>()}; | ||
| 517 | |||
| 518 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); | 351 | LOG_DEBUG(Service_HID, "called, joy_xpad_id={}", joy_xpad_id); |
| 519 | 352 | ||
| 520 | // This function has been stubbed since 10.0.0+ | 353 | // This function has been stubbed since 10.0.0+ |
| 521 | 354 | *out_shared_memory_handle = nullptr; | |
| 522 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 355 | R_SUCCEED(); |
| 523 | rb.Push(ResultSuccess); | ||
| 524 | // Handle returned is null here | ||
| 525 | } | 356 | } |
| 526 | 357 | ||
| 527 | void IHidServer::StartSixAxisSensor(HLERequestContext& ctx) { | 358 | Result IHidServer::StartSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 528 | IPC::RequestParser rp{ctx}; | 359 | ClientAppletResourceUserId aruid) { |
| 529 | struct Parameters { | ||
| 530 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 531 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 532 | u64 applet_resource_user_id; | ||
| 533 | }; | ||
| 534 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 535 | |||
| 536 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 537 | |||
| 538 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 539 | const auto result = six_axis->SetSixAxisEnabled(parameters.sixaxis_handle, true); | ||
| 540 | |||
| 541 | LOG_DEBUG(Service_HID, | 360 | LOG_DEBUG(Service_HID, |
| 542 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 361 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 543 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 362 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 544 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 363 | aruid.pid); |
| 545 | 364 | ||
| 546 | IPC::ResponseBuilder rb{ctx, 2}; | 365 | R_RETURN(GetResourceManager()->GetSixAxis()->SetSixAxisEnabled(sixaxis_handle, true)); |
| 547 | rb.Push(result); | ||
| 548 | } | 366 | } |
| 549 | 367 | ||
| 550 | void IHidServer::StopSixAxisSensor(HLERequestContext& ctx) { | 368 | Result IHidServer::StopSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 551 | IPC::RequestParser rp{ctx}; | 369 | ClientAppletResourceUserId aruid) { |
| 552 | struct Parameters { | ||
| 553 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 554 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 555 | u64 applet_resource_user_id; | ||
| 556 | }; | ||
| 557 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 558 | |||
| 559 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 560 | |||
| 561 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 562 | const auto result = six_axis->SetSixAxisEnabled(parameters.sixaxis_handle, false); | ||
| 563 | |||
| 564 | LOG_DEBUG(Service_HID, | 370 | LOG_DEBUG(Service_HID, |
| 565 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 371 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 566 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 372 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 567 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 373 | aruid.pid); |
| 568 | 374 | ||
| 569 | IPC::ResponseBuilder rb{ctx, 2}; | 375 | R_RETURN(GetResourceManager()->GetSixAxis()->SetSixAxisEnabled(sixaxis_handle, false)); |
| 570 | rb.Push(result); | ||
| 571 | } | 376 | } |
| 572 | 377 | ||
| 573 | void IHidServer::IsSixAxisSensorFusionEnabled(HLERequestContext& ctx) { | 378 | Result IHidServer::IsSixAxisSensorFusionEnabled(Out<bool> out_is_enabled, |
| 574 | IPC::RequestParser rp{ctx}; | 379 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 575 | struct Parameters { | 380 | ClientAppletResourceUserId aruid) { |
| 576 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 577 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 578 | u64 applet_resource_user_id; | ||
| 579 | }; | ||
| 580 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 581 | |||
| 582 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 583 | |||
| 584 | bool is_enabled{}; | ||
| 585 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 586 | const auto result = | ||
| 587 | six_axis->IsSixAxisSensorFusionEnabled(parameters.sixaxis_handle, is_enabled); | ||
| 588 | |||
| 589 | LOG_DEBUG(Service_HID, | 381 | LOG_DEBUG(Service_HID, |
| 590 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 382 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 591 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 383 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 592 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 384 | aruid.pid); |
| 593 | 385 | ||
| 594 | IPC::ResponseBuilder rb{ctx, 3}; | 386 | R_RETURN(GetResourceManager()->GetSixAxis()->IsSixAxisSensorFusionEnabled(sixaxis_handle, |
| 595 | rb.Push(result); | 387 | *out_is_enabled)); |
| 596 | rb.Push(is_enabled); | ||
| 597 | } | 388 | } |
| 598 | 389 | ||
| 599 | void IHidServer::EnableSixAxisSensorFusion(HLERequestContext& ctx) { | 390 | Result IHidServer::EnableSixAxisSensorFusion(bool is_enabled, |
| 600 | IPC::RequestParser rp{ctx}; | 391 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 601 | struct Parameters { | 392 | ClientAppletResourceUserId aruid) { |
| 602 | bool enable_sixaxis_sensor_fusion; | ||
| 603 | INSERT_PADDING_BYTES_NOINIT(3); | ||
| 604 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 605 | u64 applet_resource_user_id; | ||
| 606 | }; | ||
| 607 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 608 | |||
| 609 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 610 | |||
| 611 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 612 | const auto result = six_axis->SetSixAxisFusionEnabled(parameters.sixaxis_handle, | ||
| 613 | parameters.enable_sixaxis_sensor_fusion); | ||
| 614 | |||
| 615 | LOG_DEBUG(Service_HID, | 393 | LOG_DEBUG(Service_HID, |
| 616 | "called, enable_sixaxis_sensor_fusion={}, npad_type={}, npad_id={}, " | 394 | "called, is_enabled={}, npad_type={}, npad_id={}, " |
| 617 | "device_index={}, applet_resource_user_id={}", | 395 | "device_index={}, applet_resource_user_id={}", |
| 618 | parameters.enable_sixaxis_sensor_fusion, parameters.sixaxis_handle.npad_type, | 396 | is_enabled, sixaxis_handle.npad_type, sixaxis_handle.npad_id, |
| 619 | parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index, | 397 | sixaxis_handle.device_index, aruid.pid); |
| 620 | parameters.applet_resource_user_id); | ||
| 621 | 398 | ||
| 622 | IPC::ResponseBuilder rb{ctx, 2}; | 399 | R_RETURN( |
| 623 | rb.Push(result); | 400 | GetResourceManager()->GetSixAxis()->SetSixAxisFusionEnabled(sixaxis_handle, is_enabled)); |
| 624 | } | 401 | } |
| 625 | 402 | ||
| 626 | void IHidServer::SetSixAxisSensorFusionParameters(HLERequestContext& ctx) { | 403 | Result IHidServer::SetSixAxisSensorFusionParameters( |
| 627 | IPC::RequestParser rp{ctx}; | 404 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 628 | struct Parameters { | 405 | Core::HID::SixAxisSensorFusionParameters sixaxis_fusion, ClientAppletResourceUserId aruid) { |
| 629 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 630 | Core::HID::SixAxisSensorFusionParameters sixaxis_fusion; | ||
| 631 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 632 | u64 applet_resource_user_id; | ||
| 633 | }; | ||
| 634 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 635 | |||
| 636 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 637 | |||
| 638 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 639 | const auto result = | ||
| 640 | six_axis->SetSixAxisFusionParameters(parameters.sixaxis_handle, parameters.sixaxis_fusion); | ||
| 641 | |||
| 642 | LOG_DEBUG(Service_HID, | 406 | LOG_DEBUG(Service_HID, |
| 643 | "called, npad_type={}, npad_id={}, device_index={}, parameter1={}, " | 407 | "called, npad_type={}, npad_id={}, device_index={}, parameter1={}, " |
| 644 | "parameter2={}, applet_resource_user_id={}", | 408 | "parameter2={}, applet_resource_user_id={}", |
| 645 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 409 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 646 | parameters.sixaxis_handle.device_index, parameters.sixaxis_fusion.parameter1, | 410 | sixaxis_fusion.parameter1, sixaxis_fusion.parameter2, aruid.pid); |
| 647 | parameters.sixaxis_fusion.parameter2, parameters.applet_resource_user_id); | ||
| 648 | 411 | ||
| 649 | IPC::ResponseBuilder rb{ctx, 2}; | 412 | R_RETURN(GetResourceManager()->GetSixAxis()->SetSixAxisFusionParameters(sixaxis_handle, |
| 650 | rb.Push(result); | 413 | sixaxis_fusion)); |
| 651 | } | 414 | } |
| 652 | 415 | ||
| 653 | void IHidServer::GetSixAxisSensorFusionParameters(HLERequestContext& ctx) { | 416 | Result IHidServer::GetSixAxisSensorFusionParameters( |
| 654 | IPC::RequestParser rp{ctx}; | 417 | Out<Core::HID::SixAxisSensorFusionParameters> out_fusion_parameters, |
| 655 | struct Parameters { | 418 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid) { |
| 656 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 657 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 658 | u64 applet_resource_user_id; | ||
| 659 | }; | ||
| 660 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 661 | |||
| 662 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 663 | |||
| 664 | Core::HID::SixAxisSensorFusionParameters fusion_parameters{}; | ||
| 665 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 666 | const auto result = | ||
| 667 | six_axis->GetSixAxisFusionParameters(parameters.sixaxis_handle, fusion_parameters); | ||
| 668 | |||
| 669 | LOG_DEBUG(Service_HID, | 419 | LOG_DEBUG(Service_HID, |
| 670 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 420 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 671 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 421 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 672 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 422 | aruid.pid); |
| 673 | 423 | ||
| 674 | IPC::ResponseBuilder rb{ctx, 4}; | 424 | R_RETURN(GetResourceManager()->GetSixAxis()->GetSixAxisFusionParameters( |
| 675 | rb.Push(result); | 425 | sixaxis_handle, *out_fusion_parameters)); |
| 676 | rb.PushRaw(fusion_parameters); | ||
| 677 | } | 426 | } |
| 678 | 427 | ||
| 679 | void IHidServer::ResetSixAxisSensorFusionParameters(HLERequestContext& ctx) { | 428 | Result IHidServer::ResetSixAxisSensorFusionParameters(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 680 | IPC::RequestParser rp{ctx}; | 429 | ClientAppletResourceUserId aruid) { |
| 681 | struct Parameters { | 430 | LOG_DEBUG(Service_HID, |
| 682 | Core::HID::SixAxisSensorHandle sixaxis_handle; | 431 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 683 | INSERT_PADDING_WORDS_NOINIT(1); | 432 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 684 | u64 applet_resource_user_id; | 433 | aruid.pid); |
| 685 | }; | ||
| 686 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 687 | |||
| 688 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 689 | 434 | ||
| 690 | // Since these parameters are unknown just use what HW outputs | 435 | // Since these parameters are unknown just use what HW outputs |
| 691 | const Core::HID::SixAxisSensorFusionParameters fusion_parameters{ | 436 | const Core::HID::SixAxisSensorFusionParameters fusion_parameters{ |
| 692 | .parameter1 = 0.03f, | 437 | .parameter1 = 0.03f, |
| 693 | .parameter2 = 0.4f, | 438 | .parameter2 = 0.4f, |
| 694 | }; | 439 | }; |
| 695 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 696 | const auto result1 = | ||
| 697 | six_axis->SetSixAxisFusionParameters(parameters.sixaxis_handle, fusion_parameters); | ||
| 698 | const auto result2 = six_axis->SetSixAxisFusionEnabled(parameters.sixaxis_handle, true); | ||
| 699 | 440 | ||
| 700 | LOG_DEBUG(Service_HID, | 441 | R_TRY(GetResourceManager()->GetSixAxis()->SetSixAxisFusionParameters(sixaxis_handle, |
| 701 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 442 | fusion_parameters)); |
| 702 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 443 | R_RETURN(GetResourceManager()->GetSixAxis()->SetSixAxisFusionEnabled(sixaxis_handle, true)); |
| 703 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 704 | |||
| 705 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 706 | if (result1.IsError()) { | ||
| 707 | rb.Push(result1); | ||
| 708 | return; | ||
| 709 | } | ||
| 710 | rb.Push(result2); | ||
| 711 | } | 444 | } |
| 712 | 445 | ||
| 713 | void IHidServer::SetGyroscopeZeroDriftMode(HLERequestContext& ctx) { | 446 | Result IHidServer::SetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 714 | IPC::RequestParser rp{ctx}; | 447 | Core::HID::GyroscopeZeroDriftMode drift_mode, |
| 715 | const auto sixaxis_handle{rp.PopRaw<Core::HID::SixAxisSensorHandle>()}; | 448 | ClientAppletResourceUserId aruid) { |
| 716 | const auto drift_mode{rp.PopEnum<Core::HID::GyroscopeZeroDriftMode>()}; | ||
| 717 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 718 | |||
| 719 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 720 | const auto result = six_axis->SetGyroscopeZeroDriftMode(sixaxis_handle, drift_mode); | ||
| 721 | |||
| 722 | LOG_DEBUG(Service_HID, | 449 | LOG_DEBUG(Service_HID, |
| 723 | "called, npad_type={}, npad_id={}, device_index={}, drift_mode={}, " | 450 | "called, npad_type={}, npad_id={}, device_index={}, drift_mode={}, " |
| 724 | "applet_resource_user_id={}", | 451 | "applet_resource_user_id={}", |
| 725 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, | 452 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 726 | drift_mode, applet_resource_user_id); | 453 | drift_mode, aruid.pid); |
| 727 | 454 | ||
| 728 | IPC::ResponseBuilder rb{ctx, 2}; | 455 | R_RETURN( |
| 729 | rb.Push(result); | 456 | GetResourceManager()->GetSixAxis()->SetGyroscopeZeroDriftMode(sixaxis_handle, drift_mode)); |
| 730 | } | 457 | } |
| 731 | 458 | ||
| 732 | void IHidServer::GetGyroscopeZeroDriftMode(HLERequestContext& ctx) { | 459 | Result IHidServer::GetGyroscopeZeroDriftMode(Out<Core::HID::GyroscopeZeroDriftMode> out_drift_mode, |
| 733 | IPC::RequestParser rp{ctx}; | 460 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 734 | struct Parameters { | 461 | ClientAppletResourceUserId aruid) { |
| 735 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 736 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 737 | u64 applet_resource_user_id; | ||
| 738 | }; | ||
| 739 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 740 | |||
| 741 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 742 | |||
| 743 | auto drift_mode{Core::HID::GyroscopeZeroDriftMode::Standard}; | ||
| 744 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 745 | const auto result = six_axis->GetGyroscopeZeroDriftMode(parameters.sixaxis_handle, drift_mode); | ||
| 746 | |||
| 747 | LOG_DEBUG(Service_HID, | 462 | LOG_DEBUG(Service_HID, |
| 748 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 463 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 749 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 464 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 750 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 465 | aruid.pid); |
| 751 | 466 | ||
| 752 | IPC::ResponseBuilder rb{ctx, 3}; | 467 | R_RETURN(GetResourceManager()->GetSixAxis()->GetGyroscopeZeroDriftMode(sixaxis_handle, |
| 753 | rb.Push(result); | 468 | *out_drift_mode)); |
| 754 | rb.PushEnum(drift_mode); | ||
| 755 | } | 469 | } |
| 756 | 470 | ||
| 757 | void IHidServer::ResetGyroscopeZeroDriftMode(HLERequestContext& ctx) { | 471 | Result IHidServer::ResetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 758 | IPC::RequestParser rp{ctx}; | 472 | ClientAppletResourceUserId aruid) { |
| 759 | struct Parameters { | ||
| 760 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 761 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 762 | u64 applet_resource_user_id; | ||
| 763 | }; | ||
| 764 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 765 | |||
| 766 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 767 | |||
| 768 | const auto drift_mode{Core::HID::GyroscopeZeroDriftMode::Standard}; | ||
| 769 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 770 | const auto result = six_axis->SetGyroscopeZeroDriftMode(parameters.sixaxis_handle, drift_mode); | ||
| 771 | |||
| 772 | LOG_DEBUG(Service_HID, | 473 | LOG_DEBUG(Service_HID, |
| 773 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 474 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 774 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 475 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 775 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 476 | aruid.pid); |
| 776 | 477 | ||
| 777 | IPC::ResponseBuilder rb{ctx, 2}; | 478 | const auto drift_mode{Core::HID::GyroscopeZeroDriftMode::Standard}; |
| 778 | rb.Push(result); | 479 | R_RETURN( |
| 480 | GetResourceManager()->GetSixAxis()->SetGyroscopeZeroDriftMode(sixaxis_handle, drift_mode)); | ||
| 779 | } | 481 | } |
| 780 | 482 | ||
| 781 | void IHidServer::IsSixAxisSensorAtRest(HLERequestContext& ctx) { | 483 | Result IHidServer::IsSixAxisSensorAtRest(Out<bool> out_is_at_rest, |
| 782 | IPC::RequestParser rp{ctx}; | 484 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 783 | struct Parameters { | 485 | ClientAppletResourceUserId aruid) { |
| 784 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 785 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 786 | u64 applet_resource_user_id; | ||
| 787 | }; | ||
| 788 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 789 | |||
| 790 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 791 | |||
| 792 | bool is_at_rest{}; | ||
| 793 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 794 | six_axis->IsSixAxisSensorAtRest(parameters.sixaxis_handle, is_at_rest); | ||
| 795 | |||
| 796 | LOG_DEBUG(Service_HID, | 486 | LOG_DEBUG(Service_HID, |
| 797 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 487 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 798 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 488 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, |
| 799 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | 489 | aruid.pid); |
| 800 | 490 | ||
| 801 | IPC::ResponseBuilder rb{ctx, 3}; | 491 | R_RETURN( |
| 802 | rb.Push(ResultSuccess); | 492 | GetResourceManager()->GetSixAxis()->IsSixAxisSensorAtRest(sixaxis_handle, *out_is_at_rest)); |
| 803 | rb.Push(is_at_rest); | ||
| 804 | } | 493 | } |
| 805 | 494 | ||
| 806 | void IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx) { | 495 | Result IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor( |
| 807 | IPC::RequestParser rp{ctx}; | 496 | Out<bool> out_is_firmware_available, Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 808 | struct Parameters { | 497 | ClientAppletResourceUserId aruid) { |
| 809 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 810 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 811 | u64 applet_resource_user_id; | ||
| 812 | }; | ||
| 813 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 814 | |||
| 815 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 816 | |||
| 817 | bool is_firmware_available{}; | ||
| 818 | auto controller = GetResourceManager()->GetNpad(); | ||
| 819 | controller->IsFirmwareUpdateAvailableForSixAxisSensor( | ||
| 820 | parameters.applet_resource_user_id, parameters.sixaxis_handle, is_firmware_available); | ||
| 821 | |||
| 822 | LOG_WARNING( | 498 | LOG_WARNING( |
| 823 | Service_HID, | 499 | Service_HID, |
| 824 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 500 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 825 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 501 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, aruid.pid); |
| 826 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 827 | 502 | ||
| 828 | IPC::ResponseBuilder rb{ctx, 3}; | 503 | R_RETURN(GetResourceManager()->GetNpad()->IsFirmwareUpdateAvailableForSixAxisSensor( |
| 829 | rb.Push(ResultSuccess); | 504 | aruid.pid, sixaxis_handle, *out_is_firmware_available)); |
| 830 | rb.Push(is_firmware_available); | ||
| 831 | } | 505 | } |
| 832 | 506 | ||
| 833 | void IHidServer::EnableSixAxisSensorUnalteredPassthrough(HLERequestContext& ctx) { | 507 | Result IHidServer::EnableSixAxisSensorUnalteredPassthrough( |
| 834 | IPC::RequestParser rp{ctx}; | 508 | bool is_enabled, Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 835 | struct Parameters { | 509 | ClientAppletResourceUserId aruid) { |
| 836 | bool enabled; | ||
| 837 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 838 | u64 applet_resource_user_id; | ||
| 839 | }; | ||
| 840 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 841 | |||
| 842 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 843 | |||
| 844 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 845 | const auto result = six_axis->EnableSixAxisSensorUnalteredPassthrough(parameters.sixaxis_handle, | ||
| 846 | parameters.enabled); | ||
| 847 | |||
| 848 | LOG_DEBUG(Service_HID, | 510 | LOG_DEBUG(Service_HID, |
| 849 | "(STUBBED) called, enabled={}, npad_type={}, npad_id={}, device_index={}, " | 511 | "(STUBBED) called, enabled={}, npad_type={}, npad_id={}, device_index={}, " |
| 850 | "applet_resource_user_id={}", | 512 | "applet_resource_user_id={}", |
| 851 | parameters.enabled, parameters.sixaxis_handle.npad_type, | 513 | is_enabled, sixaxis_handle.npad_type, sixaxis_handle.npad_id, |
| 852 | parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index, | 514 | sixaxis_handle.device_index, aruid.pid); |
| 853 | parameters.applet_resource_user_id); | ||
| 854 | 515 | ||
| 855 | IPC::ResponseBuilder rb{ctx, 2}; | 516 | R_RETURN(GetResourceManager()->GetSixAxis()->EnableSixAxisSensorUnalteredPassthrough( |
| 856 | rb.Push(result); | 517 | sixaxis_handle, is_enabled)); |
| 857 | } | 518 | } |
| 858 | 519 | ||
| 859 | void IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled(HLERequestContext& ctx) { | 520 | Result IHidServer::IsSixAxisSensorUnalteredPassthroughEnabled( |
| 860 | IPC::RequestParser rp{ctx}; | 521 | Out<bool> out_is_enabled, Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 861 | struct Parameters { | 522 | ClientAppletResourceUserId aruid) { |
| 862 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 863 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 864 | u64 applet_resource_user_id; | ||
| 865 | }; | ||
| 866 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 867 | |||
| 868 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 869 | |||
| 870 | bool is_unaltered_sisxaxis_enabled{}; | ||
| 871 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 872 | const auto result = six_axis->IsSixAxisSensorUnalteredPassthroughEnabled( | ||
| 873 | parameters.sixaxis_handle, is_unaltered_sisxaxis_enabled); | ||
| 874 | |||
| 875 | LOG_DEBUG( | 523 | LOG_DEBUG( |
| 876 | Service_HID, | 524 | Service_HID, |
| 877 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 525 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 878 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 526 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, aruid.pid); |
| 879 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 880 | 527 | ||
| 881 | IPC::ResponseBuilder rb{ctx, 3}; | 528 | R_RETURN(GetResourceManager()->GetSixAxis()->IsSixAxisSensorUnalteredPassthroughEnabled( |
| 882 | rb.Push(result); | 529 | sixaxis_handle, *out_is_enabled)); |
| 883 | rb.Push(is_unaltered_sisxaxis_enabled); | ||
| 884 | } | 530 | } |
| 885 | 531 | ||
| 886 | void IHidServer::LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx) { | 532 | Result IHidServer::LoadSixAxisSensorCalibrationParameter( |
| 887 | IPC::RequestParser rp{ctx}; | 533 | OutLargeData<Core::HID::SixAxisSensorCalibrationParameter, BufferAttr_HipcMapAlias> |
| 888 | struct Parameters { | 534 | out_calibration, |
| 889 | Core::HID::SixAxisSensorHandle sixaxis_handle; | 535 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid) { |
| 890 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 891 | u64 applet_resource_user_id; | ||
| 892 | }; | ||
| 893 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 894 | |||
| 895 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 896 | |||
| 897 | Core::HID::SixAxisSensorCalibrationParameter calibration{}; | ||
| 898 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 899 | const auto result = | ||
| 900 | six_axis->LoadSixAxisSensorCalibrationParameter(parameters.sixaxis_handle, calibration); | ||
| 901 | |||
| 902 | LOG_WARNING( | 536 | LOG_WARNING( |
| 903 | Service_HID, | 537 | Service_HID, |
| 904 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 538 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 905 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 539 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, aruid.pid); |
| 906 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 907 | |||
| 908 | if (result.IsSuccess()) { | ||
| 909 | ctx.WriteBuffer(calibration); | ||
| 910 | } | ||
| 911 | 540 | ||
| 912 | IPC::ResponseBuilder rb{ctx, 2}; | 541 | R_RETURN(GetResourceManager()->GetSixAxis()->LoadSixAxisSensorCalibrationParameter( |
| 913 | rb.Push(result); | 542 | sixaxis_handle, *out_calibration)); |
| 914 | } | 543 | } |
| 915 | 544 | ||
| 916 | void IHidServer::GetSixAxisSensorIcInformation(HLERequestContext& ctx) { | 545 | Result IHidServer::GetSixAxisSensorIcInformation( |
| 917 | IPC::RequestParser rp{ctx}; | 546 | OutLargeData<Core::HID::SixAxisSensorIcInformation, BufferAttr_HipcPointer> out_ic_information, |
| 918 | struct Parameters { | 547 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid) { |
| 919 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 920 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 921 | u64 applet_resource_user_id; | ||
| 922 | }; | ||
| 923 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 924 | |||
| 925 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 926 | |||
| 927 | Core::HID::SixAxisSensorIcInformation ic_information{}; | ||
| 928 | auto six_axis = GetResourceManager()->GetSixAxis(); | ||
| 929 | const auto result = | ||
| 930 | six_axis->GetSixAxisSensorIcInformation(parameters.sixaxis_handle, ic_information); | ||
| 931 | |||
| 932 | LOG_WARNING( | 548 | LOG_WARNING( |
| 933 | Service_HID, | 549 | Service_HID, |
| 934 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 550 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 935 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 551 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, aruid.pid); |
| 936 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 937 | 552 | ||
| 938 | if (result.IsSuccess()) { | 553 | R_RETURN(GetResourceManager()->GetSixAxis()->GetSixAxisSensorIcInformation( |
| 939 | ctx.WriteBuffer(ic_information); | 554 | sixaxis_handle, *out_ic_information)); |
| 940 | } | ||
| 941 | |||
| 942 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 943 | rb.Push(result); | ||
| 944 | } | 555 | } |
| 945 | 556 | ||
| 946 | void IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx) { | 557 | Result IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned( |
| 947 | IPC::RequestParser rp{ctx}; | 558 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid) { |
| 948 | struct Parameters { | ||
| 949 | Core::HID::SixAxisSensorHandle sixaxis_handle; | ||
| 950 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 951 | u64 applet_resource_user_id; | ||
| 952 | }; | ||
| 953 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 954 | |||
| 955 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 956 | |||
| 957 | auto controller = GetResourceManager()->GetNpad(); | ||
| 958 | const auto result = controller->ResetIsSixAxisSensorDeviceNewlyAssigned( | ||
| 959 | parameters.applet_resource_user_id, parameters.sixaxis_handle); | ||
| 960 | |||
| 961 | LOG_WARNING( | 559 | LOG_WARNING( |
| 962 | Service_HID, | 560 | Service_HID, |
| 963 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 561 | "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 964 | parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, | 562 | sixaxis_handle.npad_type, sixaxis_handle.npad_id, sixaxis_handle.device_index, aruid.pid); |
| 965 | parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); | ||
| 966 | 563 | ||
| 967 | IPC::ResponseBuilder rb{ctx, 2}; | 564 | R_RETURN(GetResourceManager()->GetNpad()->ResetIsSixAxisSensorDeviceNewlyAssigned( |
| 968 | rb.Push(result); | 565 | aruid.pid, sixaxis_handle)); |
| 969 | } | 566 | } |
| 970 | 567 | ||
| 971 | void IHidServer::ActivateGesture(HLERequestContext& ctx) { | 568 | Result IHidServer::ActivateGesture(u32 basic_gesture_id, ClientAppletResourceUserId aruid) { |
| 972 | IPC::RequestParser rp{ctx}; | ||
| 973 | struct Parameters { | ||
| 974 | u32 basic_gesture_id; | ||
| 975 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 976 | u64 applet_resource_user_id; | ||
| 977 | }; | ||
| 978 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 979 | |||
| 980 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 981 | |||
| 982 | LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", | 569 | LOG_INFO(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}", |
| 983 | parameters.basic_gesture_id, parameters.applet_resource_user_id); | 570 | basic_gesture_id, aruid.pid); |
| 984 | |||
| 985 | Result result = ResultSuccess; | ||
| 986 | auto gesture = GetResourceManager()->GetGesture(); | ||
| 987 | 571 | ||
| 988 | if (!firmware_settings->IsDeviceManaged()) { | 572 | if (!firmware_settings->IsDeviceManaged()) { |
| 989 | result = gesture->Activate(); | 573 | R_TRY(GetResourceManager()->GetGesture()->Activate()); |
| 990 | } | ||
| 991 | |||
| 992 | if (result.IsSuccess()) { | ||
| 993 | result = gesture->Activate(parameters.applet_resource_user_id, parameters.basic_gesture_id); | ||
| 994 | } | 574 | } |
| 995 | 575 | ||
| 996 | IPC::ResponseBuilder rb{ctx, 2}; | 576 | R_RETURN(GetResourceManager()->GetGesture()->Activate(aruid.pid, basic_gesture_id)); |
| 997 | rb.Push(result); | ||
| 998 | } | 577 | } |
| 999 | 578 | ||
| 1000 | void IHidServer::SetSupportedNpadStyleSet(HLERequestContext& ctx) { | 579 | Result IHidServer::SetSupportedNpadStyleSet(Core::HID::NpadStyleSet supported_style_set, |
| 1001 | IPC::RequestParser rp{ctx}; | 580 | ClientAppletResourceUserId aruid) { |
| 1002 | struct Parameters { | ||
| 1003 | Core::HID::NpadStyleSet supported_style_set; | ||
| 1004 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1005 | u64 applet_resource_user_id; | ||
| 1006 | }; | ||
| 1007 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1008 | |||
| 1009 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1010 | |||
| 1011 | LOG_DEBUG(Service_HID, "called, supported_style_set={}, applet_resource_user_id={}", | 581 | LOG_DEBUG(Service_HID, "called, supported_style_set={}, applet_resource_user_id={}", |
| 1012 | parameters.supported_style_set, parameters.applet_resource_user_id); | 582 | supported_style_set, aruid.pid); |
| 1013 | 583 | ||
| 1014 | const auto npad = GetResourceManager()->GetNpad(); | 584 | R_TRY( |
| 1015 | const Result result = npad->SetSupportedNpadStyleSet(parameters.applet_resource_user_id, | 585 | GetResourceManager()->GetNpad()->SetSupportedNpadStyleSet(aruid.pid, supported_style_set)); |
| 1016 | parameters.supported_style_set); | ||
| 1017 | 586 | ||
| 1018 | if (result.IsSuccess()) { | 587 | Core::HID::NpadStyleTag style_tag{supported_style_set}; |
| 1019 | Core::HID::NpadStyleTag style_tag{parameters.supported_style_set}; | 588 | const auto revision = GetResourceManager()->GetNpad()->GetRevision(aruid.pid); |
| 1020 | const auto revision = npad->GetRevision(parameters.applet_resource_user_id); | ||
| 1021 | 589 | ||
| 1022 | if (style_tag.palma != 0 && revision < NpadRevision::Revision3) { | 590 | if (style_tag.palma != 0 && revision < NpadRevision::Revision3) { |
| 1023 | // GetResourceManager()->GetPalma()->EnableBoostMode(parameters.applet_resource_user_id, | 591 | // GetResourceManager()->GetPalma()->EnableBoostMode(aruid.pid, true); |
| 1024 | // true); | ||
| 1025 | } | ||
| 1026 | } | 592 | } |
| 1027 | 593 | ||
| 1028 | IPC::ResponseBuilder rb{ctx, 2}; | 594 | R_SUCCEED() |
| 1029 | rb.Push(result); | ||
| 1030 | } | 595 | } |
| 1031 | 596 | ||
| 1032 | void IHidServer::GetSupportedNpadStyleSet(HLERequestContext& ctx) { | 597 | Result IHidServer::GetSupportedNpadStyleSet(Out<Core::HID::NpadStyleSet> out_supported_style_set, |
| 1033 | IPC::RequestParser rp{ctx}; | 598 | ClientAppletResourceUserId aruid) { |
| 1034 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 599 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1035 | 600 | ||
| 1036 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 601 | R_RETURN(GetResourceManager()->GetNpad()->GetSupportedNpadStyleSet(aruid.pid, |
| 1037 | 602 | *out_supported_style_set)); | |
| 1038 | Core::HID::NpadStyleSet supported_style_set{}; | ||
| 1039 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1040 | const auto result = | ||
| 1041 | npad->GetSupportedNpadStyleSet(applet_resource_user_id, supported_style_set); | ||
| 1042 | |||
| 1043 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 1044 | rb.Push(result); | ||
| 1045 | rb.PushEnum(supported_style_set); | ||
| 1046 | } | 603 | } |
| 1047 | 604 | ||
| 1048 | void IHidServer::SetSupportedNpadIdType(HLERequestContext& ctx) { | 605 | Result IHidServer::SetSupportedNpadIdType( |
| 1049 | IPC::RequestParser rp{ctx}; | 606 | ClientAppletResourceUserId aruid, |
| 1050 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 607 | InArray<Core::HID::NpadIdType, BufferAttr_HipcPointer> supported_npad_list) { |
| 1051 | const auto buffer = ctx.ReadBuffer(); | 608 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1052 | const std::size_t elements = ctx.GetReadBufferNumElements<Core::HID::NpadIdType>(); | ||
| 1053 | |||
| 1054 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1055 | 609 | ||
| 1056 | std::vector<Core::HID::NpadIdType> supported_npad_list(elements); | 610 | R_RETURN( |
| 1057 | memcpy(supported_npad_list.data(), buffer.data(), buffer.size()); | 611 | GetResourceManager()->GetNpad()->SetSupportedNpadIdType(aruid.pid, supported_npad_list)); |
| 1058 | |||
| 1059 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1060 | const Result result = | ||
| 1061 | npad->SetSupportedNpadIdType(applet_resource_user_id, supported_npad_list); | ||
| 1062 | |||
| 1063 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1064 | rb.Push(result); | ||
| 1065 | } | 612 | } |
| 1066 | 613 | ||
| 1067 | void IHidServer::ActivateNpad(HLERequestContext& ctx) { | 614 | Result IHidServer::ActivateNpad(ClientAppletResourceUserId aruid) { |
| 1068 | IPC::RequestParser rp{ctx}; | 615 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1069 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1070 | |||
| 1071 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1072 | 616 | ||
| 1073 | auto npad = GetResourceManager()->GetNpad(); | 617 | auto npad = GetResourceManager()->GetNpad(); |
| 1074 | 618 | ||
| 1075 | npad->SetRevision(applet_resource_user_id, NpadRevision::Revision0); | 619 | GetResourceManager()->GetNpad()->SetRevision(aruid.pid, NpadRevision::Revision0); |
| 1076 | const Result result = npad->Activate(applet_resource_user_id); | 620 | R_RETURN(GetResourceManager()->GetNpad()->Activate(aruid.pid)); |
| 1077 | |||
| 1078 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1079 | rb.Push(result); | ||
| 1080 | } | 621 | } |
| 1081 | 622 | ||
| 1082 | void IHidServer::DeactivateNpad(HLERequestContext& ctx) { | 623 | Result IHidServer::DeactivateNpad(ClientAppletResourceUserId aruid) { |
| 1083 | IPC::RequestParser rp{ctx}; | 624 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1084 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1085 | |||
| 1086 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1087 | 625 | ||
| 1088 | // This function does nothing since 10.0.0+ | 626 | // This function does nothing since 10.0.0+ |
| 1089 | 627 | R_SUCCEED(); | |
| 1090 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1091 | rb.Push(ResultSuccess); | ||
| 1092 | } | 628 | } |
| 1093 | 629 | ||
| 1094 | void IHidServer::AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx) { | 630 | Result IHidServer::AcquireNpadStyleSetUpdateEventHandle( |
| 1095 | IPC::RequestParser rp{ctx}; | 631 | OutCopyHandle<Kernel::KReadableEvent> out_event, Core::HID::NpadIdType npad_id, |
| 1096 | struct Parameters { | 632 | ClientAppletResourceUserId aruid, u64 unknown) { |
| 1097 | Core::HID::NpadIdType npad_id; | 633 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}, unknown={}", npad_id, |
| 1098 | INSERT_PADDING_WORDS_NOINIT(1); | 634 | aruid.pid, unknown); |
| 1099 | u64 applet_resource_user_id; | ||
| 1100 | u64 unknown; | ||
| 1101 | }; | ||
| 1102 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1103 | 635 | ||
| 1104 | const auto parameters{rp.PopRaw<Parameters>()}; | 636 | R_RETURN(GetResourceManager()->GetNpad()->AcquireNpadStyleSetUpdateEventHandle( |
| 1105 | 637 | aruid.pid, out_event, npad_id)); | |
| 1106 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}, unknown={}", | ||
| 1107 | parameters.npad_id, parameters.applet_resource_user_id, parameters.unknown); | ||
| 1108 | |||
| 1109 | Kernel::KReadableEvent* style_set_update_event; | ||
| 1110 | const auto result = GetResourceManager()->GetNpad()->AcquireNpadStyleSetUpdateEventHandle( | ||
| 1111 | parameters.applet_resource_user_id, &style_set_update_event, parameters.npad_id); | ||
| 1112 | |||
| 1113 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 1114 | rb.Push(result); | ||
| 1115 | rb.PushCopyObjects(style_set_update_event); | ||
| 1116 | } | 638 | } |
| 1117 | 639 | ||
| 1118 | void IHidServer::DisconnectNpad(HLERequestContext& ctx) { | 640 | Result IHidServer::DisconnectNpad(Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid) { |
| 1119 | IPC::RequestParser rp{ctx}; | 641 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid); |
| 1120 | struct Parameters { | ||
| 1121 | Core::HID::NpadIdType npad_id; | ||
| 1122 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1123 | u64 applet_resource_user_id; | ||
| 1124 | }; | ||
| 1125 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1126 | |||
| 1127 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1128 | |||
| 1129 | auto controller = GetResourceManager()->GetNpad(); | ||
| 1130 | controller->DisconnectNpad(parameters.applet_resource_user_id, parameters.npad_id); | ||
| 1131 | 642 | ||
| 1132 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, | 643 | R_RETURN(GetResourceManager()->GetNpad()->DisconnectNpad(aruid.pid, npad_id)); |
| 1133 | parameters.applet_resource_user_id); | ||
| 1134 | |||
| 1135 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1136 | rb.Push(ResultSuccess); | ||
| 1137 | } | 644 | } |
| 1138 | 645 | ||
| 1139 | Result IHidServer::GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern, | 646 | Result IHidServer::GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern, |
| @@ -1171,833 +678,445 @@ Result IHidServer::GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_patter | |||
| 1171 | } | 678 | } |
| 1172 | } | 679 | } |
| 1173 | 680 | ||
| 1174 | void IHidServer::ActivateNpadWithRevision(HLERequestContext& ctx) { | 681 | Result IHidServer::ActivateNpadWithRevision(NpadRevision revision, |
| 1175 | IPC::RequestParser rp{ctx}; | 682 | ClientAppletResourceUserId aruid) { |
| 1176 | struct Parameters { | 683 | LOG_DEBUG(Service_HID, "called, revision={}, applet_resource_user_id={}", revision, aruid.pid); |
| 1177 | NpadRevision revision; | ||
| 1178 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1179 | u64 applet_resource_user_id; | ||
| 1180 | }; | ||
| 1181 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1182 | |||
| 1183 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1184 | |||
| 1185 | LOG_DEBUG(Service_HID, "called, revision={}, applet_resource_user_id={}", parameters.revision, | ||
| 1186 | parameters.applet_resource_user_id); | ||
| 1187 | |||
| 1188 | auto npad = GetResourceManager()->GetNpad(); | ||
| 1189 | |||
| 1190 | npad->SetRevision(parameters.applet_resource_user_id, parameters.revision); | ||
| 1191 | const auto result = npad->Activate(parameters.applet_resource_user_id); | ||
| 1192 | 684 | ||
| 1193 | IPC::ResponseBuilder rb{ctx, 2}; | 685 | GetResourceManager()->GetNpad()->SetRevision(aruid.pid, revision); |
| 1194 | rb.Push(result); | 686 | R_RETURN(GetResourceManager()->GetNpad()->Activate(aruid.pid)); |
| 1195 | } | 687 | } |
| 1196 | 688 | ||
| 1197 | void IHidServer::SetNpadJoyHoldType(HLERequestContext& ctx) { | 689 | Result IHidServer::SetNpadJoyHoldType(ClientAppletResourceUserId aruid, NpadJoyHoldType hold_type) { |
| 1198 | IPC::RequestParser rp{ctx}; | 690 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, hold_type={}", aruid.pid, |
| 1199 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 691 | hold_type); |
| 1200 | const auto hold_type{rp.PopEnum<NpadJoyHoldType>()}; | ||
| 1201 | |||
| 1202 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, hold_type={}", | ||
| 1203 | applet_resource_user_id, hold_type); | ||
| 1204 | 692 | ||
| 1205 | if (hold_type != NpadJoyHoldType::Horizontal && hold_type != NpadJoyHoldType::Vertical) { | 693 | if (hold_type != NpadJoyHoldType::Horizontal && hold_type != NpadJoyHoldType::Vertical) { |
| 1206 | // This should crash console | 694 | // This should crash console |
| 1207 | ASSERT_MSG(false, "Invalid npad joy hold type"); | 695 | ASSERT_MSG(false, "Invalid npad joy hold type"); |
| 1208 | } | 696 | } |
| 1209 | 697 | ||
| 1210 | const auto npad = GetResourceManager()->GetNpad(); | 698 | R_RETURN(GetResourceManager()->GetNpad()->SetNpadJoyHoldType(aruid.pid, hold_type)); |
| 1211 | const auto result = npad->SetNpadJoyHoldType(applet_resource_user_id, hold_type); | ||
| 1212 | |||
| 1213 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1214 | rb.Push(result); | ||
| 1215 | } | 699 | } |
| 1216 | 700 | ||
| 1217 | void IHidServer::GetNpadJoyHoldType(HLERequestContext& ctx) { | 701 | Result IHidServer::GetNpadJoyHoldType(Out<NpadJoyHoldType> out_hold_type, |
| 1218 | IPC::RequestParser rp{ctx}; | 702 | ClientAppletResourceUserId aruid) { |
| 1219 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 703 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1220 | |||
| 1221 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1222 | 704 | ||
| 1223 | NpadJoyHoldType hold_type{}; | 705 | R_RETURN(GetResourceManager()->GetNpad()->GetNpadJoyHoldType(aruid.pid, *out_hold_type)); |
| 1224 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1225 | const auto result = npad->GetNpadJoyHoldType(applet_resource_user_id, hold_type); | ||
| 1226 | |||
| 1227 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 1228 | rb.Push(result); | ||
| 1229 | rb.PushEnum(hold_type); | ||
| 1230 | } | 706 | } |
| 1231 | 707 | ||
| 1232 | void IHidServer::SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx) { | 708 | Result IHidServer::SetNpadJoyAssignmentModeSingleByDefault(Core::HID::NpadIdType npad_id, |
| 1233 | IPC::RequestParser rp{ctx}; | 709 | ClientAppletResourceUserId aruid) { |
| 1234 | struct Parameters { | 710 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid); |
| 1235 | Core::HID::NpadIdType npad_id; | ||
| 1236 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1237 | u64 applet_resource_user_id; | ||
| 1238 | }; | ||
| 1239 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1240 | |||
| 1241 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1242 | 711 | ||
| 1243 | Core::HID::NpadIdType new_npad_id{}; | 712 | Core::HID::NpadIdType new_npad_id{}; |
| 1244 | auto controller = GetResourceManager()->GetNpad(); | 713 | GetResourceManager()->GetNpad()->SetNpadMode( |
| 1245 | controller->SetNpadMode(parameters.applet_resource_user_id, new_npad_id, parameters.npad_id, | 714 | aruid.pid, new_npad_id, npad_id, NpadJoyDeviceType::Left, NpadJoyAssignmentMode::Single); |
| 1246 | NpadJoyDeviceType::Left, NpadJoyAssignmentMode::Single); | 715 | R_SUCCEED(); |
| 1247 | |||
| 1248 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, | ||
| 1249 | parameters.applet_resource_user_id); | ||
| 1250 | |||
| 1251 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1252 | rb.Push(ResultSuccess); | ||
| 1253 | } | 716 | } |
| 1254 | 717 | ||
| 1255 | void IHidServer::SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx) { | 718 | Result IHidServer::SetNpadJoyAssignmentModeSingle(Core::HID::NpadIdType npad_id, |
| 1256 | IPC::RequestParser rp{ctx}; | 719 | ClientAppletResourceUserId aruid, |
| 1257 | struct Parameters { | 720 | NpadJoyDeviceType npad_joy_device_type) { |
| 1258 | Core::HID::NpadIdType npad_id; | ||
| 1259 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1260 | u64 applet_resource_user_id; | ||
| 1261 | NpadJoyDeviceType npad_joy_device_type; | ||
| 1262 | }; | ||
| 1263 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1264 | |||
| 1265 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1266 | |||
| 1267 | Core::HID::NpadIdType new_npad_id{}; | ||
| 1268 | auto controller = GetResourceManager()->GetNpad(); | ||
| 1269 | controller->SetNpadMode(parameters.applet_resource_user_id, new_npad_id, parameters.npad_id, | ||
| 1270 | parameters.npad_joy_device_type, NpadJoyAssignmentMode::Single); | ||
| 1271 | |||
| 1272 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", | 721 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", |
| 1273 | parameters.npad_id, parameters.applet_resource_user_id, | 722 | npad_id, aruid.pid, npad_joy_device_type); |
| 1274 | parameters.npad_joy_device_type); | ||
| 1275 | 723 | ||
| 1276 | IPC::ResponseBuilder rb{ctx, 2}; | 724 | Core::HID::NpadIdType new_npad_id{}; |
| 1277 | rb.Push(ResultSuccess); | 725 | GetResourceManager()->GetNpad()->SetNpadMode( |
| 726 | aruid.pid, new_npad_id, npad_id, npad_joy_device_type, NpadJoyAssignmentMode::Single); | ||
| 727 | R_SUCCEED(); | ||
| 1278 | } | 728 | } |
| 1279 | 729 | ||
| 1280 | void IHidServer::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) { | 730 | Result IHidServer::SetNpadJoyAssignmentModeDual(Core::HID::NpadIdType npad_id, |
| 1281 | IPC::RequestParser rp{ctx}; | 731 | ClientAppletResourceUserId aruid) { |
| 1282 | struct Parameters { | 732 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid); |
| 1283 | Core::HID::NpadIdType npad_id; | ||
| 1284 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1285 | u64 applet_resource_user_id; | ||
| 1286 | }; | ||
| 1287 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1288 | |||
| 1289 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1290 | 733 | ||
| 1291 | Core::HID::NpadIdType new_npad_id{}; | 734 | Core::HID::NpadIdType new_npad_id{}; |
| 1292 | auto controller = GetResourceManager()->GetNpad(); | 735 | GetResourceManager()->GetNpad()->SetNpadMode(aruid.pid, new_npad_id, npad_id, {}, |
| 1293 | controller->SetNpadMode(parameters.applet_resource_user_id, new_npad_id, parameters.npad_id, {}, | 736 | NpadJoyAssignmentMode::Dual); |
| 1294 | NpadJoyAssignmentMode::Dual); | 737 | R_SUCCEED(); |
| 1295 | |||
| 1296 | LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, | ||
| 1297 | parameters.applet_resource_user_id); // Spams a lot when controller applet is open | ||
| 1298 | |||
| 1299 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1300 | rb.Push(ResultSuccess); | ||
| 1301 | } | 738 | } |
| 1302 | 739 | ||
| 1303 | void IHidServer::MergeSingleJoyAsDualJoy(HLERequestContext& ctx) { | 740 | Result IHidServer::MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1, |
| 1304 | IPC::RequestParser rp{ctx}; | 741 | Core::HID::NpadIdType npad_id_2, |
| 1305 | const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()}; | 742 | ClientAppletResourceUserId aruid) { |
| 1306 | const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 1307 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1308 | |||
| 1309 | auto controller = GetResourceManager()->GetNpad(); | ||
| 1310 | const auto result = | ||
| 1311 | controller->MergeSingleJoyAsDualJoy(applet_resource_user_id, npad_id_1, npad_id_2); | ||
| 1312 | |||
| 1313 | LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}", | 743 | LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}", |
| 1314 | npad_id_1, npad_id_2, applet_resource_user_id); | 744 | npad_id_1, npad_id_2, aruid.pid); |
| 1315 | 745 | ||
| 1316 | IPC::ResponseBuilder rb{ctx, 2}; | 746 | R_RETURN( |
| 1317 | rb.Push(result); | 747 | GetResourceManager()->GetNpad()->MergeSingleJoyAsDualJoy(aruid.pid, npad_id_1, npad_id_2)); |
| 1318 | } | 748 | } |
| 1319 | 749 | ||
| 1320 | void IHidServer::StartLrAssignmentMode(HLERequestContext& ctx) { | 750 | Result IHidServer::StartLrAssignmentMode(ClientAppletResourceUserId aruid) { |
| 1321 | IPC::RequestParser rp{ctx}; | 751 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1322 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1323 | |||
| 1324 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1325 | |||
| 1326 | GetResourceManager()->GetNpad()->StartLrAssignmentMode(applet_resource_user_id); | ||
| 1327 | 752 | ||
| 1328 | IPC::ResponseBuilder rb{ctx, 2}; | 753 | GetResourceManager()->GetNpad()->StartLrAssignmentMode(aruid.pid); |
| 1329 | rb.Push(ResultSuccess); | 754 | R_SUCCEED(); |
| 1330 | } | 755 | } |
| 1331 | 756 | ||
| 1332 | void IHidServer::StopLrAssignmentMode(HLERequestContext& ctx) { | 757 | Result IHidServer::StopLrAssignmentMode(ClientAppletResourceUserId aruid) { |
| 1333 | IPC::RequestParser rp{ctx}; | 758 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1334 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1335 | 759 | ||
| 1336 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 760 | GetResourceManager()->GetNpad()->StopLrAssignmentMode(aruid.pid); |
| 1337 | 761 | R_SUCCEED(); | |
| 1338 | GetResourceManager()->GetNpad()->StopLrAssignmentMode(applet_resource_user_id); | ||
| 1339 | |||
| 1340 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1341 | rb.Push(ResultSuccess); | ||
| 1342 | } | 762 | } |
| 1343 | 763 | ||
| 1344 | void IHidServer::SetNpadHandheldActivationMode(HLERequestContext& ctx) { | 764 | Result IHidServer::SetNpadHandheldActivationMode(ClientAppletResourceUserId aruid, |
| 1345 | IPC::RequestParser rp{ctx}; | 765 | NpadHandheldActivationMode activation_mode) { |
| 1346 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 766 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, activation_mode={}", aruid.pid, |
| 1347 | const auto activation_mode{rp.PopEnum<NpadHandheldActivationMode>()}; | 767 | activation_mode); |
| 1348 | |||
| 1349 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, activation_mode={}", | ||
| 1350 | applet_resource_user_id, activation_mode); | ||
| 1351 | 768 | ||
| 1352 | if (activation_mode >= NpadHandheldActivationMode::MaxActivationMode) { | 769 | if (activation_mode >= NpadHandheldActivationMode::MaxActivationMode) { |
| 1353 | // Console should crash here | 770 | // Console should crash here |
| 1354 | ASSERT_MSG(false, "Activation mode should be always None, Single or Dual"); | 771 | ASSERT_MSG(false, "Activation mode should be always None, Single or Dual"); |
| 1355 | IPC::ResponseBuilder rb{ctx, 2}; | 772 | R_SUCCEED(); |
| 1356 | rb.Push(ResultSuccess); | ||
| 1357 | return; | ||
| 1358 | } | 773 | } |
| 1359 | 774 | ||
| 1360 | const auto npad = GetResourceManager()->GetNpad(); | 775 | R_RETURN( |
| 1361 | const auto result = | 776 | GetResourceManager()->GetNpad()->SetNpadHandheldActivationMode(aruid.pid, activation_mode)); |
| 1362 | npad->SetNpadHandheldActivationMode(applet_resource_user_id, activation_mode); | ||
| 1363 | |||
| 1364 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1365 | rb.Push(result); | ||
| 1366 | } | 777 | } |
| 1367 | 778 | ||
| 1368 | void IHidServer::GetNpadHandheldActivationMode(HLERequestContext& ctx) { | 779 | Result IHidServer::GetNpadHandheldActivationMode( |
| 1369 | IPC::RequestParser rp{ctx}; | 780 | Out<NpadHandheldActivationMode> out_activation_mode, ClientAppletResourceUserId aruid) { |
| 1370 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 781 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1371 | |||
| 1372 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1373 | 782 | ||
| 1374 | NpadHandheldActivationMode activation_mode{}; | 783 | R_RETURN(GetResourceManager()->GetNpad()->GetNpadHandheldActivationMode(aruid.pid, |
| 1375 | const auto npad = GetResourceManager()->GetNpad(); | 784 | *out_activation_mode)); |
| 1376 | const auto result = | ||
| 1377 | npad->GetNpadHandheldActivationMode(applet_resource_user_id, activation_mode); | ||
| 1378 | |||
| 1379 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 1380 | rb.Push(result); | ||
| 1381 | rb.PushEnum(activation_mode); | ||
| 1382 | } | 785 | } |
| 1383 | 786 | ||
| 1384 | void IHidServer::SwapNpadAssignment(HLERequestContext& ctx) { | 787 | Result IHidServer::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, |
| 1385 | IPC::RequestParser rp{ctx}; | 788 | Core::HID::NpadIdType npad_id_2, |
| 1386 | const auto npad_id_1{rp.PopEnum<Core::HID::NpadIdType>()}; | 789 | ClientAppletResourceUserId aruid) { |
| 1387 | const auto npad_id_2{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 1388 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1389 | |||
| 1390 | LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}", | 790 | LOG_DEBUG(Service_HID, "called, npad_id_1={}, npad_id_2={}, applet_resource_user_id={}", |
| 1391 | npad_id_1, npad_id_2, applet_resource_user_id); | 791 | npad_id_1, npad_id_2, aruid.pid); |
| 1392 | |||
| 1393 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1394 | const auto result = npad->SwapNpadAssignment(applet_resource_user_id, npad_id_1, npad_id_2); | ||
| 1395 | 792 | ||
| 1396 | IPC::ResponseBuilder rb{ctx, 2}; | 793 | R_RETURN(GetResourceManager()->GetNpad()->SwapNpadAssignment(aruid.pid, npad_id_1, npad_id_2)) |
| 1397 | rb.Push(result); | ||
| 1398 | } | 794 | } |
| 1399 | 795 | ||
| 1400 | void IHidServer::IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx) { | 796 | Result IHidServer::IsUnintendedHomeButtonInputProtectionEnabled(Out<bool> out_is_enabled, |
| 1401 | IPC::RequestParser rp{ctx}; | 797 | Core::HID::NpadIdType npad_id, |
| 1402 | struct Parameters { | 798 | ClientAppletResourceUserId aruid) { |
| 1403 | Core::HID::NpadIdType npad_id; | 799 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", npad_id, aruid.pid); |
| 1404 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1405 | u64 applet_resource_user_id; | ||
| 1406 | }; | ||
| 1407 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1408 | |||
| 1409 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1410 | 800 | ||
| 1411 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, | 801 | R_UNLESS(IsNpadIdValid(npad_id), ResultInvalidNpadId); |
| 1412 | parameters.applet_resource_user_id); | 802 | R_RETURN(GetResourceManager()->GetNpad()->IsUnintendedHomeButtonInputProtectionEnabled( |
| 1413 | 803 | *out_is_enabled, aruid.pid, npad_id)); | |
| 1414 | if (!IsNpadIdValid(parameters.npad_id)) { | ||
| 1415 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 1416 | rb.Push(ResultInvalidNpadId); | ||
| 1417 | return; | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | bool is_enabled{}; | ||
| 1421 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1422 | const auto result = npad->IsUnintendedHomeButtonInputProtectionEnabled( | ||
| 1423 | is_enabled, parameters.applet_resource_user_id, parameters.npad_id); | ||
| 1424 | |||
| 1425 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 1426 | rb.Push(result); | ||
| 1427 | rb.Push(is_enabled); | ||
| 1428 | } | 804 | } |
| 1429 | 805 | ||
| 1430 | void IHidServer::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) { | 806 | Result IHidServer::EnableUnintendedHomeButtonInputProtection(bool is_enabled, |
| 1431 | IPC::RequestParser rp{ctx}; | 807 | Core::HID::NpadIdType npad_id, |
| 1432 | struct Parameters { | 808 | ClientAppletResourceUserId aruid) { |
| 1433 | bool is_enabled; | ||
| 1434 | INSERT_PADDING_BYTES_NOINIT(3); | ||
| 1435 | Core::HID::NpadIdType npad_id; | ||
| 1436 | u64 applet_resource_user_id; | ||
| 1437 | }; | ||
| 1438 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1439 | |||
| 1440 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1441 | |||
| 1442 | LOG_DEBUG(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}", | 809 | LOG_DEBUG(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}", |
| 1443 | parameters.is_enabled, parameters.npad_id, parameters.applet_resource_user_id); | 810 | is_enabled, npad_id, aruid.pid); |
| 1444 | |||
| 1445 | if (!IsNpadIdValid(parameters.npad_id)) { | ||
| 1446 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 1447 | rb.Push(ResultInvalidNpadId); | ||
| 1448 | return; | ||
| 1449 | } | ||
| 1450 | |||
| 1451 | const auto npad = GetResourceManager()->GetNpad(); | ||
| 1452 | const auto result = npad->EnableUnintendedHomeButtonInputProtection( | ||
| 1453 | parameters.applet_resource_user_id, parameters.npad_id, parameters.is_enabled); | ||
| 1454 | 811 | ||
| 1455 | IPC::ResponseBuilder rb{ctx, 2}; | 812 | R_UNLESS(IsNpadIdValid(npad_id), ResultInvalidNpadId); |
| 1456 | rb.Push(result); | 813 | R_RETURN(GetResourceManager()->GetNpad()->EnableUnintendedHomeButtonInputProtection( |
| 814 | aruid.pid, npad_id, is_enabled)); | ||
| 1457 | } | 815 | } |
| 1458 | 816 | ||
| 1459 | void IHidServer::SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx) { | 817 | Result IHidServer::SetNpadJoyAssignmentModeSingleWithDestination( |
| 1460 | IPC::RequestParser rp{ctx}; | 818 | Out<bool> out_is_reassigned, Out<Core::HID::NpadIdType> out_new_npad_id, |
| 1461 | struct Parameters { | 819 | Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid, |
| 1462 | Core::HID::NpadIdType npad_id; | 820 | NpadJoyDeviceType npad_joy_device_type) { |
| 1463 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1464 | u64 applet_resource_user_id; | ||
| 1465 | NpadJoyDeviceType npad_joy_device_type; | ||
| 1466 | }; | ||
| 1467 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1468 | |||
| 1469 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1470 | |||
| 1471 | Core::HID::NpadIdType new_npad_id{}; | ||
| 1472 | auto controller = GetResourceManager()->GetNpad(); | ||
| 1473 | const auto is_reassigned = | ||
| 1474 | controller->SetNpadMode(parameters.applet_resource_user_id, new_npad_id, parameters.npad_id, | ||
| 1475 | parameters.npad_joy_device_type, NpadJoyAssignmentMode::Single); | ||
| 1476 | |||
| 1477 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", | 821 | LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", |
| 1478 | parameters.npad_id, parameters.applet_resource_user_id, | 822 | npad_id, aruid.pid, npad_joy_device_type); |
| 1479 | parameters.npad_joy_device_type); | ||
| 1480 | 823 | ||
| 1481 | IPC::ResponseBuilder rb{ctx, 4}; | 824 | *out_is_reassigned = GetResourceManager()->GetNpad()->SetNpadMode( |
| 1482 | rb.Push(ResultSuccess); | 825 | aruid.pid, *out_new_npad_id, npad_id, npad_joy_device_type, NpadJoyAssignmentMode::Single); |
| 1483 | rb.Push(is_reassigned); | ||
| 1484 | rb.PushEnum(new_npad_id); | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | void IHidServer::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) { | ||
| 1488 | IPC::RequestParser rp{ctx}; | ||
| 1489 | struct Parameters { | ||
| 1490 | bool use_center_clamp; | ||
| 1491 | INSERT_PADDING_BYTES_NOINIT(7); | ||
| 1492 | u64 applet_resource_user_id; | ||
| 1493 | }; | ||
| 1494 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1495 | 826 | ||
| 1496 | const auto parameters{rp.PopRaw<Parameters>()}; | 827 | R_SUCCEED(); |
| 828 | } | ||
| 1497 | 829 | ||
| 830 | Result IHidServer::SetNpadAnalogStickUseCenterClamp(bool use_center_clamp, | ||
| 831 | ClientAppletResourceUserId aruid) { | ||
| 1498 | LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}", | 832 | LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}", |
| 1499 | parameters.use_center_clamp, parameters.applet_resource_user_id); | 833 | use_center_clamp, aruid.pid); |
| 1500 | |||
| 1501 | GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp( | ||
| 1502 | parameters.applet_resource_user_id, parameters.use_center_clamp); | ||
| 1503 | 834 | ||
| 1504 | IPC::ResponseBuilder rb{ctx, 2}; | 835 | GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp(aruid.pid, use_center_clamp); |
| 1505 | rb.Push(ResultSuccess); | 836 | R_SUCCEED(); |
| 1506 | } | 837 | } |
| 1507 | 838 | ||
| 1508 | void IHidServer::SetNpadCaptureButtonAssignment(HLERequestContext& ctx) { | 839 | Result IHidServer::SetNpadCaptureButtonAssignment(Core::HID::NpadStyleSet npad_styleset, |
| 1509 | IPC::RequestParser rp{ctx}; | 840 | ClientAppletResourceUserId aruid, |
| 1510 | struct Parameters { | 841 | Core::HID::NpadButton button) { |
| 1511 | Core::HID::NpadStyleSet npad_styleset; | ||
| 1512 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1513 | u64 applet_resource_user_id; | ||
| 1514 | Core::HID::NpadButton button; | ||
| 1515 | }; | ||
| 1516 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1517 | |||
| 1518 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1519 | |||
| 1520 | LOG_INFO(Service_HID, "called, npad_styleset={}, applet_resource_user_id={}, button={}", | 842 | LOG_INFO(Service_HID, "called, npad_styleset={}, applet_resource_user_id={}, button={}", |
| 1521 | parameters.npad_styleset, parameters.applet_resource_user_id, parameters.button); | 843 | npad_styleset, aruid.pid, button); |
| 1522 | |||
| 1523 | const auto result = GetResourceManager()->GetNpad()->SetNpadCaptureButtonAssignment( | ||
| 1524 | parameters.applet_resource_user_id, parameters.npad_styleset, parameters.button); | ||
| 1525 | 844 | ||
| 1526 | IPC::ResponseBuilder rb{ctx, 2}; | 845 | R_RETURN(GetResourceManager()->GetNpad()->SetNpadCaptureButtonAssignment( |
| 1527 | rb.Push(result); | 846 | aruid.pid, npad_styleset, button)); |
| 1528 | } | 847 | } |
| 1529 | 848 | ||
| 1530 | void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) { | 849 | Result IHidServer::ClearNpadCaptureButtonAssignment(ClientAppletResourceUserId aruid) { |
| 1531 | IPC::RequestParser rp{ctx}; | 850 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1532 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1533 | 851 | ||
| 1534 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 852 | R_RETURN(GetResourceManager()->GetNpad()->ClearNpadCaptureButtonAssignment(aruid.pid)); |
| 1535 | |||
| 1536 | const auto result = | ||
| 1537 | GetResourceManager()->GetNpad()->ClearNpadCaptureButtonAssignment(applet_resource_user_id); | ||
| 1538 | |||
| 1539 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1540 | rb.Push(result); | ||
| 1541 | } | 853 | } |
| 1542 | 854 | ||
| 1543 | void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) { | 855 | Result IHidServer::GetVibrationDeviceInfo( |
| 1544 | IPC::RequestParser rp{ctx}; | 856 | Out<Core::HID::VibrationDeviceInfo> out_vibration_device_info, |
| 1545 | const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()}; | 857 | Core::HID::VibrationDeviceHandle vibration_device_handle) { |
| 858 | LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}", | ||
| 859 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, | ||
| 860 | vibration_device_handle.device_index); | ||
| 1546 | 861 | ||
| 1547 | Core::HID::VibrationDeviceInfo vibration_device_info{}; | 862 | R_RETURN(GetResourceManager()->GetVibrationDeviceInfo(*out_vibration_device_info, |
| 1548 | const auto result = GetResourceManager()->GetVibrationDeviceInfo(vibration_device_info, | 863 | vibration_device_handle)); |
| 1549 | vibration_device_handle); | ||
| 1550 | |||
| 1551 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 1552 | rb.Push(result); | ||
| 1553 | rb.PushRaw(vibration_device_info); | ||
| 1554 | } | 864 | } |
| 1555 | 865 | ||
| 1556 | void IHidServer::SendVibrationValue(HLERequestContext& ctx) { | 866 | Result IHidServer::SendVibrationValue(Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 1557 | IPC::RequestParser rp{ctx}; | 867 | Core::HID::VibrationValue vibration_value, |
| 1558 | struct Parameters { | 868 | ClientAppletResourceUserId aruid) { |
| 1559 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1560 | Core::HID::VibrationValue vibration_value; | ||
| 1561 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1562 | u64 applet_resource_user_id; | ||
| 1563 | }; | ||
| 1564 | static_assert(sizeof(Parameters) == 0x20, "Parameters has incorrect size."); | ||
| 1565 | |||
| 1566 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1567 | |||
| 1568 | LOG_DEBUG(Service_HID, | 869 | LOG_DEBUG(Service_HID, |
| 1569 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 870 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 1570 | parameters.vibration_device_handle.npad_type, | 871 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1571 | parameters.vibration_device_handle.npad_id, | 872 | vibration_device_handle.device_index, aruid.pid); |
| 1572 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); | ||
| 1573 | |||
| 1574 | GetResourceManager()->SendVibrationValue(parameters.applet_resource_user_id, | ||
| 1575 | parameters.vibration_device_handle, | ||
| 1576 | parameters.vibration_value); | ||
| 1577 | 873 | ||
| 1578 | IPC::ResponseBuilder rb{ctx, 2}; | 874 | GetResourceManager()->SendVibrationValue(aruid.pid, vibration_device_handle, vibration_value); |
| 1579 | rb.Push(ResultSuccess); | 875 | R_SUCCEED() |
| 1580 | } | 876 | } |
| 1581 | 877 | ||
| 1582 | void IHidServer::GetActualVibrationValue(HLERequestContext& ctx) { | 878 | Result IHidServer::GetActualVibrationValue(Out<Core::HID::VibrationValue> out_vibration_value, |
| 1583 | IPC::RequestParser rp{ctx}; | 879 | Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 1584 | struct Parameters { | 880 | ClientAppletResourceUserId aruid) { |
| 1585 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1586 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1587 | u64 applet_resource_user_id; | ||
| 1588 | }; | ||
| 1589 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1590 | |||
| 1591 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1592 | |||
| 1593 | LOG_DEBUG(Service_HID, | 881 | LOG_DEBUG(Service_HID, |
| 1594 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 882 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 1595 | parameters.vibration_device_handle.npad_type, | 883 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1596 | parameters.vibration_device_handle.npad_id, | 884 | vibration_device_handle.device_index, aruid.pid); |
| 1597 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); | ||
| 1598 | 885 | ||
| 1599 | bool has_active_aruid{}; | 886 | bool has_active_aruid{}; |
| 1600 | NpadVibrationDevice* device{nullptr}; | 887 | R_TRY(GetResourceManager()->IsVibrationAruidActive(aruid.pid, has_active_aruid)); |
| 1601 | Core::HID::VibrationValue vibration_value{}; | ||
| 1602 | Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id, | ||
| 1603 | has_active_aruid); | ||
| 1604 | 888 | ||
| 1605 | if (result.IsSuccess() && has_active_aruid) { | 889 | if (!has_active_aruid) { |
| 1606 | result = IsVibrationHandleValid(parameters.vibration_device_handle); | 890 | *out_vibration_value = Core::HID::DEFAULT_VIBRATION_VALUE; |
| 1607 | } | 891 | R_SUCCEED(); |
| 1608 | if (result.IsSuccess() && has_active_aruid) { | ||
| 1609 | device = GetResourceManager()->GetNSVibrationDevice(parameters.vibration_device_handle); | ||
| 1610 | } | ||
| 1611 | if (device != nullptr) { | ||
| 1612 | result = device->GetActualVibrationValue(vibration_value); | ||
| 1613 | } | 892 | } |
| 1614 | if (result.IsError()) { | 893 | |
| 1615 | vibration_value = Core::HID::DEFAULT_VIBRATION_VALUE; | 894 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); |
| 895 | NpadVibrationDevice* device = | ||
| 896 | GetResourceManager()->GetNSVibrationDevice(vibration_device_handle); | ||
| 897 | |||
| 898 | if (device == nullptr || R_FAILED(device->GetActualVibrationValue(*out_vibration_value))) { | ||
| 899 | *out_vibration_value = Core::HID::DEFAULT_VIBRATION_VALUE; | ||
| 1616 | } | 900 | } |
| 1617 | 901 | ||
| 1618 | IPC::ResponseBuilder rb{ctx, 6}; | 902 | R_SUCCEED(); |
| 1619 | rb.Push(ResultSuccess); | ||
| 1620 | rb.PushRaw(vibration_value); | ||
| 1621 | } | 903 | } |
| 1622 | 904 | ||
| 1623 | void IHidServer::CreateActiveVibrationDeviceList(HLERequestContext& ctx) { | 905 | Result IHidServer::CreateActiveVibrationDeviceList( |
| 906 | OutInterface<IActiveVibrationDeviceList> out_interface) { | ||
| 1624 | LOG_DEBUG(Service_HID, "called"); | 907 | LOG_DEBUG(Service_HID, "called"); |
| 1625 | 908 | ||
| 1626 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 909 | *out_interface = std::make_shared<IActiveVibrationDeviceList>(system, GetResourceManager()); |
| 1627 | rb.Push(ResultSuccess); | 910 | R_SUCCEED(); |
| 1628 | rb.PushIpcInterface<IActiveVibrationDeviceList>(system, GetResourceManager()); | ||
| 1629 | } | 911 | } |
| 1630 | 912 | ||
| 1631 | void IHidServer::PermitVibration(HLERequestContext& ctx) { | 913 | Result IHidServer::PermitVibration(bool can_vibrate) { |
| 1632 | IPC::RequestParser rp{ctx}; | ||
| 1633 | const auto can_vibrate{rp.Pop<bool>()}; | ||
| 1634 | |||
| 1635 | LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); | 914 | LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); |
| 1636 | 915 | ||
| 1637 | const auto result = | 916 | R_RETURN(GetResourceManager()->GetNpad()->GetVibrationHandler()->SetVibrationMasterVolume( |
| 1638 | GetResourceManager()->GetNpad()->GetVibrationHandler()->SetVibrationMasterVolume( | 917 | can_vibrate ? 1.0f : 0.0f)); |
| 1639 | can_vibrate ? 1.0f : 0.0f); | ||
| 1640 | |||
| 1641 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1642 | rb.Push(result); | ||
| 1643 | } | 918 | } |
| 1644 | 919 | ||
| 1645 | void IHidServer::IsVibrationPermitted(HLERequestContext& ctx) { | 920 | Result IHidServer::IsVibrationPermitted(Out<bool> out_is_permitted) { |
| 1646 | LOG_DEBUG(Service_HID, "called"); | 921 | LOG_DEBUG(Service_HID, "called"); |
| 1647 | 922 | ||
| 1648 | f32 master_volume{}; | 923 | f32 master_volume{}; |
| 1649 | const auto result = | 924 | R_TRY(GetResourceManager()->GetNpad()->GetVibrationHandler()->GetVibrationMasterVolume( |
| 1650 | GetResourceManager()->GetNpad()->GetVibrationHandler()->GetVibrationMasterVolume( | 925 | master_volume)); |
| 1651 | master_volume); | ||
| 1652 | 926 | ||
| 1653 | IPC::ResponseBuilder rb{ctx, 3}; | 927 | *out_is_permitted = master_volume > 0.0f; |
| 1654 | rb.Push(result); | 928 | R_SUCCEED(); |
| 1655 | rb.Push(master_volume > 0.0f); | ||
| 1656 | } | 929 | } |
| 1657 | 930 | ||
| 1658 | void IHidServer::SendVibrationValues(HLERequestContext& ctx) { | 931 | Result IHidServer::SendVibrationValues( |
| 1659 | IPC::RequestParser rp{ctx}; | 932 | ClientAppletResourceUserId aruid, |
| 1660 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 933 | InArray<Core::HID::VibrationDeviceHandle, BufferAttr_HipcPointer> vibration_handles, |
| 1661 | 934 | InArray<Core::HID::VibrationValue, BufferAttr_HipcPointer> vibration_values) { | |
| 1662 | const auto handle_data = ctx.ReadBuffer(0); | 935 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1663 | const auto handle_count = ctx.GetReadBufferNumElements<Core::HID::VibrationDeviceHandle>(0); | ||
| 1664 | const auto vibration_data = ctx.ReadBuffer(1); | ||
| 1665 | const auto vibration_count = ctx.GetReadBufferNumElements<Core::HID::VibrationValue>(1); | ||
| 1666 | 936 | ||
| 1667 | auto vibration_device_handles = | 937 | R_UNLESS(vibration_handles.size() == vibration_values.size(), ResultVibrationArraySizeMismatch); |
| 1668 | std::span(reinterpret_cast<const Core::HID::VibrationDeviceHandle*>(handle_data.data()), | ||
| 1669 | handle_count); | ||
| 1670 | auto vibration_values = std::span( | ||
| 1671 | reinterpret_cast<const Core::HID::VibrationValue*>(vibration_data.data()), vibration_count); | ||
| 1672 | 938 | ||
| 1673 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 939 | for (std::size_t i = 0; i < vibration_handles.size(); i++) { |
| 1674 | 940 | R_TRY(GetResourceManager()->SendVibrationValue(aruid.pid, vibration_handles[i], | |
| 1675 | Result result = ResultSuccess; | 941 | vibration_values[i])); |
| 1676 | if (handle_count != vibration_count) { | ||
| 1677 | result = ResultVibrationArraySizeMismatch; | ||
| 1678 | } | ||
| 1679 | |||
| 1680 | for (std::size_t i = 0; i < handle_count; i++) { | ||
| 1681 | if (result.IsSuccess()) { | ||
| 1682 | result = GetResourceManager()->SendVibrationValue( | ||
| 1683 | applet_resource_user_id, vibration_device_handles[i], vibration_values[i]); | ||
| 1684 | } | ||
| 1685 | } | 942 | } |
| 1686 | 943 | ||
| 1687 | IPC::ResponseBuilder rb{ctx, 2}; | 944 | R_SUCCEED(); |
| 1688 | rb.Push(result); | ||
| 1689 | } | 945 | } |
| 1690 | 946 | ||
| 1691 | void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) { | 947 | Result IHidServer::SendVibrationGcErmCommand( |
| 1692 | IPC::RequestParser rp{ctx}; | 948 | Core::HID::VibrationDeviceHandle vibration_device_handle, ClientAppletResourceUserId aruid, |
| 1693 | struct Parameters { | 949 | Core::HID::VibrationGcErmCommand gc_erm_command) { |
| 1694 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1695 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1696 | u64 applet_resource_user_id; | ||
| 1697 | Core::HID::VibrationGcErmCommand gc_erm_command; | ||
| 1698 | }; | ||
| 1699 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1700 | |||
| 1701 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1702 | |||
| 1703 | LOG_DEBUG(Service_HID, | 950 | LOG_DEBUG(Service_HID, |
| 1704 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, " | 951 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, " |
| 1705 | "gc_erm_command={}", | 952 | "gc_erm_command={}", |
| 1706 | parameters.vibration_device_handle.npad_type, | 953 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1707 | parameters.vibration_device_handle.npad_id, | 954 | vibration_device_handle.device_index, aruid.pid, gc_erm_command); |
| 1708 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id, | ||
| 1709 | parameters.gc_erm_command); | ||
| 1710 | 955 | ||
| 1711 | bool has_active_aruid{}; | 956 | bool has_active_aruid{}; |
| 1712 | NpadGcVibrationDevice* gc_device{nullptr}; | 957 | R_TRY(GetResourceManager()->IsVibrationAruidActive(aruid.pid, has_active_aruid)); |
| 1713 | Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id, | ||
| 1714 | has_active_aruid); | ||
| 1715 | 958 | ||
| 1716 | if (result.IsSuccess() && has_active_aruid) { | 959 | if (!has_active_aruid) { |
| 1717 | result = IsVibrationHandleValid(parameters.vibration_device_handle); | 960 | R_SUCCEED(); |
| 1718 | } | ||
| 1719 | if (result.IsSuccess() && has_active_aruid) { | ||
| 1720 | gc_device = GetResourceManager()->GetGcVibrationDevice(parameters.vibration_device_handle); | ||
| 1721 | } | 961 | } |
| 962 | |||
| 963 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); | ||
| 964 | NpadGcVibrationDevice* gc_device = | ||
| 965 | GetResourceManager()->GetGcVibrationDevice(vibration_device_handle); | ||
| 1722 | if (gc_device != nullptr) { | 966 | if (gc_device != nullptr) { |
| 1723 | result = gc_device->SendVibrationGcErmCommand(parameters.gc_erm_command); | 967 | R_RETURN(gc_device->SendVibrationGcErmCommand(gc_erm_command)); |
| 1724 | } | 968 | } |
| 1725 | 969 | ||
| 1726 | IPC::ResponseBuilder rb{ctx, 2}; | 970 | R_SUCCEED(); |
| 1727 | rb.Push(result); | ||
| 1728 | } | 971 | } |
| 1729 | 972 | ||
| 1730 | void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) { | 973 | Result IHidServer::GetActualVibrationGcErmCommand( |
| 1731 | IPC::RequestParser rp{ctx}; | 974 | Out<Core::HID::VibrationGcErmCommand> out_gc_erm_command, |
| 1732 | struct Parameters { | 975 | Core::HID::VibrationDeviceHandle vibration_device_handle, ClientAppletResourceUserId aruid) { |
| 1733 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1734 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1735 | u64 applet_resource_user_id; | ||
| 1736 | }; | ||
| 1737 | |||
| 1738 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1739 | |||
| 1740 | LOG_DEBUG(Service_HID, | 976 | LOG_DEBUG(Service_HID, |
| 1741 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 977 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 1742 | parameters.vibration_device_handle.npad_type, | 978 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1743 | parameters.vibration_device_handle.npad_id, | 979 | vibration_device_handle.device_index, aruid.pid); |
| 1744 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); | ||
| 1745 | 980 | ||
| 1746 | bool has_active_aruid{}; | 981 | bool has_active_aruid{}; |
| 1747 | NpadGcVibrationDevice* gc_device{nullptr}; | 982 | R_TRY(GetResourceManager()->IsVibrationAruidActive(aruid.pid, has_active_aruid)); |
| 1748 | Core::HID::VibrationGcErmCommand gc_erm_command{}; | ||
| 1749 | Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id, | ||
| 1750 | has_active_aruid); | ||
| 1751 | 983 | ||
| 1752 | if (result.IsSuccess() && has_active_aruid) { | 984 | if (!has_active_aruid) { |
| 1753 | result = IsVibrationHandleValid(parameters.vibration_device_handle); | 985 | *out_gc_erm_command = Core::HID::VibrationGcErmCommand::Stop; |
| 1754 | } | ||
| 1755 | if (result.IsSuccess() && has_active_aruid) { | ||
| 1756 | gc_device = GetResourceManager()->GetGcVibrationDevice(parameters.vibration_device_handle); | ||
| 1757 | } | ||
| 1758 | if (gc_device != nullptr) { | ||
| 1759 | result = gc_device->GetActualVibrationGcErmCommand(gc_erm_command); | ||
| 1760 | } | ||
| 1761 | if (result.IsError()) { | ||
| 1762 | gc_erm_command = Core::HID::VibrationGcErmCommand::Stop; | ||
| 1763 | } | 986 | } |
| 1764 | 987 | ||
| 1765 | IPC::ResponseBuilder rb{ctx, 4}; | 988 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); |
| 1766 | rb.Push(ResultSuccess); | 989 | NpadGcVibrationDevice* gc_device = |
| 1767 | rb.PushEnum(gc_erm_command); | 990 | GetResourceManager()->GetGcVibrationDevice(vibration_device_handle); |
| 1768 | } | ||
| 1769 | 991 | ||
| 1770 | void IHidServer::BeginPermitVibrationSession(HLERequestContext& ctx) { | 992 | if (gc_device == nullptr || |
| 1771 | IPC::RequestParser rp{ctx}; | 993 | R_FAILED(gc_device->GetActualVibrationGcErmCommand(*out_gc_erm_command))) { |
| 1772 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 994 | *out_gc_erm_command = Core::HID::VibrationGcErmCommand::Stop; |
| 995 | } | ||
| 1773 | 996 | ||
| 1774 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 997 | R_SUCCEED(); |
| 998 | } | ||
| 1775 | 999 | ||
| 1776 | const auto result = | 1000 | Result IHidServer::BeginPermitVibrationSession(ClientAppletResourceUserId aruid) { |
| 1777 | GetResourceManager()->GetNpad()->GetVibrationHandler()->BeginPermitVibrationSession( | 1001 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1778 | applet_resource_user_id); | ||
| 1779 | 1002 | ||
| 1780 | IPC::ResponseBuilder rb{ctx, 2}; | 1003 | R_RETURN(GetResourceManager()->GetNpad()->GetVibrationHandler()->BeginPermitVibrationSession( |
| 1781 | rb.Push(result); | 1004 | aruid.pid)); |
| 1782 | } | 1005 | } |
| 1783 | 1006 | ||
| 1784 | void IHidServer::EndPermitVibrationSession(HLERequestContext& ctx) { | 1007 | Result IHidServer::EndPermitVibrationSession(ClientAppletResourceUserId aruid) { |
| 1785 | LOG_DEBUG(Service_HID, "called"); | 1008 | LOG_DEBUG(Service_HID, "called"); |
| 1786 | 1009 | ||
| 1787 | const auto result = | 1010 | R_RETURN(GetResourceManager()->GetNpad()->GetVibrationHandler()->EndPermitVibrationSession()); |
| 1788 | GetResourceManager()->GetNpad()->GetVibrationHandler()->EndPermitVibrationSession(); | ||
| 1789 | |||
| 1790 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1791 | rb.Push(result); | ||
| 1792 | } | 1011 | } |
| 1793 | 1012 | ||
| 1794 | void IHidServer::IsVibrationDeviceMounted(HLERequestContext& ctx) { | 1013 | Result IHidServer::IsVibrationDeviceMounted( |
| 1795 | IPC::RequestParser rp{ctx}; | 1014 | Out<bool> out_is_mounted, Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 1796 | struct Parameters { | 1015 | ClientAppletResourceUserId aruid) { |
| 1797 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1798 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1799 | u64 applet_resource_user_id; | ||
| 1800 | }; | ||
| 1801 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1802 | |||
| 1803 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1804 | |||
| 1805 | LOG_DEBUG(Service_HID, | 1016 | LOG_DEBUG(Service_HID, |
| 1806 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", | 1017 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}", |
| 1807 | parameters.vibration_device_handle.npad_type, | 1018 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1808 | parameters.vibration_device_handle.npad_id, | 1019 | vibration_device_handle.device_index, aruid.pid); |
| 1809 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); | ||
| 1810 | 1020 | ||
| 1811 | bool is_mounted{}; | 1021 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); |
| 1812 | NpadVibrationBase* device{nullptr}; | ||
| 1813 | Result result = IsVibrationHandleValid(parameters.vibration_device_handle); | ||
| 1814 | 1022 | ||
| 1815 | if (result.IsSuccess()) { | 1023 | NpadVibrationBase* device = GetResourceManager()->GetVibrationDevice(vibration_device_handle); |
| 1816 | device = GetResourceManager()->GetVibrationDevice(parameters.vibration_device_handle); | ||
| 1817 | } | ||
| 1818 | 1024 | ||
| 1819 | if (device != nullptr) { | 1025 | if (device != nullptr) { |
| 1820 | is_mounted = device->IsVibrationMounted(); | 1026 | *out_is_mounted = device->IsVibrationMounted(); |
| 1821 | } | 1027 | } |
| 1822 | 1028 | ||
| 1823 | IPC::ResponseBuilder rb{ctx, 3}; | 1029 | R_SUCCEED(); |
| 1824 | rb.Push(result); | ||
| 1825 | rb.Push(is_mounted); | ||
| 1826 | } | 1030 | } |
| 1827 | 1031 | ||
| 1828 | void IHidServer::SendVibrationValueInBool(HLERequestContext& ctx) { | 1032 | Result IHidServer::SendVibrationValueInBool( |
| 1829 | IPC::RequestParser rp{ctx}; | 1033 | bool is_vibrating, Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 1830 | struct Parameters { | 1034 | ClientAppletResourceUserId aruid) { |
| 1831 | Core::HID::VibrationDeviceHandle vibration_device_handle; | ||
| 1832 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1833 | u64 applet_resource_user_id; | ||
| 1834 | bool is_vibrating; | ||
| 1835 | }; | ||
| 1836 | static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); | ||
| 1837 | |||
| 1838 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1839 | |||
| 1840 | LOG_DEBUG(Service_HID, | 1035 | LOG_DEBUG(Service_HID, |
| 1841 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, " | 1036 | "called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, " |
| 1842 | "is_vibrating={}", | 1037 | "is_vibrating={}", |
| 1843 | parameters.vibration_device_handle.npad_type, | 1038 | vibration_device_handle.npad_type, vibration_device_handle.npad_id, |
| 1844 | parameters.vibration_device_handle.npad_id, | 1039 | vibration_device_handle.device_index, aruid.pid, is_vibrating); |
| 1845 | parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id, | ||
| 1846 | parameters.is_vibrating); | ||
| 1847 | 1040 | ||
| 1848 | bool has_active_aruid{}; | 1041 | bool has_active_aruid{}; |
| 1849 | NpadN64VibrationDevice* n64_device{nullptr}; | 1042 | R_TRY(GetResourceManager()->IsVibrationAruidActive(aruid.pid, has_active_aruid)); |
| 1850 | Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id, | ||
| 1851 | has_active_aruid); | ||
| 1852 | 1043 | ||
| 1853 | if (result.IsSuccess() && has_active_aruid) { | 1044 | if (!has_active_aruid) { |
| 1854 | result = IsVibrationHandleValid(parameters.vibration_device_handle); | 1045 | R_SUCCEED(); |
| 1855 | } | ||
| 1856 | if (result.IsSuccess() && has_active_aruid) { | ||
| 1857 | n64_device = | ||
| 1858 | GetResourceManager()->GetN64VibrationDevice(parameters.vibration_device_handle); | ||
| 1859 | } | 1046 | } |
| 1047 | |||
| 1048 | R_TRY(IsVibrationHandleValid(vibration_device_handle)); | ||
| 1049 | NpadN64VibrationDevice* n64_device = | ||
| 1050 | GetResourceManager()->GetN64VibrationDevice(vibration_device_handle); | ||
| 1051 | |||
| 1860 | if (n64_device != nullptr) { | 1052 | if (n64_device != nullptr) { |
| 1861 | result = n64_device->SendValueInBool(parameters.is_vibrating); | 1053 | R_TRY(n64_device->SendValueInBool(is_vibrating)); |
| 1862 | } | 1054 | } |
| 1863 | 1055 | ||
| 1864 | IPC::ResponseBuilder rb{ctx, 2}; | 1056 | R_SUCCEED(); |
| 1865 | rb.Push(result); | ||
| 1866 | } | 1057 | } |
| 1867 | 1058 | ||
| 1868 | void IHidServer::ActivateConsoleSixAxisSensor(HLERequestContext& ctx) { | 1059 | Result IHidServer::ActivateConsoleSixAxisSensor(ClientAppletResourceUserId aruid) { |
| 1869 | IPC::RequestParser rp{ctx}; | 1060 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1870 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1871 | |||
| 1872 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1873 | |||
| 1874 | Result result = ResultSuccess; | ||
| 1875 | auto console_sixaxis = GetResourceManager()->GetConsoleSixAxis(); | ||
| 1876 | 1061 | ||
| 1877 | if (!firmware_settings->IsDeviceManaged()) { | 1062 | if (!firmware_settings->IsDeviceManaged()) { |
| 1878 | result = console_sixaxis->Activate(); | 1063 | R_TRY(GetResourceManager()->GetConsoleSixAxis()->Activate()); |
| 1879 | } | ||
| 1880 | |||
| 1881 | if (result.IsSuccess()) { | ||
| 1882 | result = console_sixaxis->Activate(applet_resource_user_id); | ||
| 1883 | } | 1064 | } |
| 1884 | 1065 | ||
| 1885 | IPC::ResponseBuilder rb{ctx, 2}; | 1066 | R_RETURN(GetResourceManager()->GetConsoleSixAxis()->Activate(aruid.pid)); |
| 1886 | rb.Push(result); | ||
| 1887 | } | 1067 | } |
| 1888 | 1068 | ||
| 1889 | void IHidServer::StartConsoleSixAxisSensor(HLERequestContext& ctx) { | 1069 | Result IHidServer::StartConsoleSixAxisSensor( |
| 1890 | IPC::RequestParser rp{ctx}; | 1070 | Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle, |
| 1891 | struct Parameters { | 1071 | ClientAppletResourceUserId aruid) { |
| 1892 | Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle; | ||
| 1893 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1894 | u64 applet_resource_user_id; | ||
| 1895 | }; | ||
| 1896 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1897 | |||
| 1898 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1899 | |||
| 1900 | LOG_WARNING(Service_HID, | 1072 | LOG_WARNING(Service_HID, |
| 1901 | "(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}", | 1073 | "(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}", |
| 1902 | parameters.console_sixaxis_handle.unknown_1, | 1074 | console_sixaxis_handle.unknown_1, console_sixaxis_handle.unknown_2, aruid.pid); |
| 1903 | parameters.console_sixaxis_handle.unknown_2, parameters.applet_resource_user_id); | 1075 | R_SUCCEED(); |
| 1904 | |||
| 1905 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1906 | rb.Push(ResultSuccess); | ||
| 1907 | } | 1076 | } |
| 1908 | 1077 | ||
| 1909 | void IHidServer::StopConsoleSixAxisSensor(HLERequestContext& ctx) { | 1078 | Result IHidServer::StopConsoleSixAxisSensor( |
| 1910 | IPC::RequestParser rp{ctx}; | 1079 | Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle, |
| 1911 | struct Parameters { | 1080 | ClientAppletResourceUserId aruid) { |
| 1912 | Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle; | ||
| 1913 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 1914 | u64 applet_resource_user_id; | ||
| 1915 | }; | ||
| 1916 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 1917 | |||
| 1918 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 1919 | |||
| 1920 | LOG_WARNING(Service_HID, | 1081 | LOG_WARNING(Service_HID, |
| 1921 | "(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}", | 1082 | "(STUBBED) called, unknown_1={}, unknown_2={}, applet_resource_user_id={}", |
| 1922 | parameters.console_sixaxis_handle.unknown_1, | 1083 | console_sixaxis_handle.unknown_1, console_sixaxis_handle.unknown_2, aruid.pid); |
| 1923 | parameters.console_sixaxis_handle.unknown_2, parameters.applet_resource_user_id); | 1084 | R_SUCCEED(); |
| 1924 | |||
| 1925 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1926 | rb.Push(ResultSuccess); | ||
| 1927 | } | 1085 | } |
| 1928 | 1086 | ||
| 1929 | void IHidServer::ActivateSevenSixAxisSensor(HLERequestContext& ctx) { | 1087 | Result IHidServer::ActivateSevenSixAxisSensor(ClientAppletResourceUserId aruid) { |
| 1930 | IPC::RequestParser rp{ctx}; | 1088 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 1931 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 1932 | |||
| 1933 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 1934 | |||
| 1935 | Result result = ResultSuccess; | ||
| 1936 | auto seven_sixaxis = GetResourceManager()->GetSevenSixAxis(); | ||
| 1937 | 1089 | ||
| 1938 | if (!firmware_settings->IsDeviceManaged()) { | 1090 | if (!firmware_settings->IsDeviceManaged()) { |
| 1939 | result = seven_sixaxis->Activate(); | 1091 | R_TRY(GetResourceManager()->GetSevenSixAxis()->Activate()); |
| 1940 | } | 1092 | } |
| 1941 | 1093 | ||
| 1942 | if (result.IsSuccess()) { | 1094 | GetResourceManager()->GetSevenSixAxis()->Activate(aruid.pid); |
| 1943 | seven_sixaxis->Activate(applet_resource_user_id); | 1095 | R_SUCCEED(); |
| 1944 | } | ||
| 1945 | |||
| 1946 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1947 | rb.Push(ResultSuccess); | ||
| 1948 | } | 1096 | } |
| 1949 | 1097 | ||
| 1950 | void IHidServer::StartSevenSixAxisSensor(HLERequestContext& ctx) { | 1098 | Result IHidServer::StartSevenSixAxisSensor(ClientAppletResourceUserId aruid) { |
| 1951 | IPC::RequestParser rp{ctx}; | 1099 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); |
| 1952 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1100 | R_SUCCEED(); |
| 1953 | |||
| 1954 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", | ||
| 1955 | applet_resource_user_id); | ||
| 1956 | |||
| 1957 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1958 | rb.Push(ResultSuccess); | ||
| 1959 | } | 1101 | } |
| 1960 | 1102 | ||
| 1961 | void IHidServer::StopSevenSixAxisSensor(HLERequestContext& ctx) { | 1103 | Result IHidServer::StopSevenSixAxisSensor(ClientAppletResourceUserId aruid) { |
| 1962 | IPC::RequestParser rp{ctx}; | 1104 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); |
| 1963 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1105 | R_SUCCEED(); |
| 1964 | |||
| 1965 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", | ||
| 1966 | applet_resource_user_id); | ||
| 1967 | |||
| 1968 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1969 | rb.Push(ResultSuccess); | ||
| 1970 | } | 1106 | } |
| 1971 | 1107 | ||
| 1972 | void IHidServer::InitializeSevenSixAxisSensor(HLERequestContext& ctx) { | 1108 | Result IHidServer::InitializeSevenSixAxisSensor(ClientAppletResourceUserId aruid, u64 t_mem_1_size, |
| 1973 | IPC::RequestParser rp{ctx}; | 1109 | u64 t_mem_2_size, |
| 1974 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1110 | InCopyHandle<Kernel::KTransferMemory> t_mem_1, |
| 1975 | const auto t_mem_1_size{rp.Pop<u64>()}; | 1111 | InCopyHandle<Kernel::KTransferMemory> t_mem_2) { |
| 1976 | const auto t_mem_2_size{rp.Pop<u64>()}; | 1112 | LOG_WARNING(Service_HID, |
| 1977 | const auto t_mem_1_handle{ctx.GetCopyHandle(0)}; | 1113 | "called, t_mem_1_size=0x{:08X}, t_mem_2_size=0x{:08X}, " |
| 1978 | const auto t_mem_2_handle{ctx.GetCopyHandle(1)}; | 1114 | "applet_resource_user_id={}", |
| 1115 | t_mem_1_size, t_mem_2_size, aruid.pid); | ||
| 1979 | 1116 | ||
| 1980 | ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes"); | 1117 | ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes"); |
| 1981 | ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes"); | 1118 | ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes"); |
| 1982 | 1119 | ||
| 1983 | auto t_mem_1 = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_1_handle); | ||
| 1984 | |||
| 1985 | if (t_mem_1.IsNull()) { | ||
| 1986 | LOG_ERROR(Service_HID, "t_mem_1 is a nullptr for handle=0x{:08X}", t_mem_1_handle); | ||
| 1987 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1988 | rb.Push(ResultUnknown); | ||
| 1989 | return; | ||
| 1990 | } | ||
| 1991 | |||
| 1992 | auto t_mem_2 = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_2_handle); | ||
| 1993 | |||
| 1994 | if (t_mem_2.IsNull()) { | ||
| 1995 | LOG_ERROR(Service_HID, "t_mem_2 is a nullptr for handle=0x{:08X}", t_mem_2_handle); | ||
| 1996 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1997 | rb.Push(ResultUnknown); | ||
| 1998 | return; | ||
| 1999 | } | ||
| 2000 | |||
| 2001 | ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size"); | 1120 | ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size"); |
| 2002 | ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size"); | 1121 | ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size"); |
| 2003 | 1122 | ||
| @@ -2007,519 +1126,309 @@ void IHidServer::InitializeSevenSixAxisSensor(HLERequestContext& ctx) { | |||
| 2007 | 1126 | ||
| 2008 | GetResourceManager()->GetSevenSixAxis()->SetTransferMemoryAddress(t_mem_1->GetSourceAddress()); | 1127 | GetResourceManager()->GetSevenSixAxis()->SetTransferMemoryAddress(t_mem_1->GetSourceAddress()); |
| 2009 | 1128 | ||
| 2010 | LOG_WARNING(Service_HID, | 1129 | R_SUCCEED(); |
| 2011 | "called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, " | ||
| 2012 | "applet_resource_user_id={}", | ||
| 2013 | t_mem_1_handle, t_mem_2_handle, applet_resource_user_id); | ||
| 2014 | |||
| 2015 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2016 | rb.Push(ResultSuccess); | ||
| 2017 | } | 1130 | } |
| 2018 | 1131 | ||
| 2019 | void IHidServer::FinalizeSevenSixAxisSensor(HLERequestContext& ctx) { | 1132 | Result IHidServer::FinalizeSevenSixAxisSensor(ClientAppletResourceUserId aruid) { |
| 2020 | IPC::RequestParser rp{ctx}; | 1133 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); |
| 2021 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 2022 | |||
| 2023 | LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", | ||
| 2024 | applet_resource_user_id); | ||
| 2025 | 1134 | ||
| 2026 | IPC::ResponseBuilder rb{ctx, 2}; | 1135 | R_SUCCEED(); |
| 2027 | rb.Push(ResultSuccess); | ||
| 2028 | } | 1136 | } |
| 2029 | 1137 | ||
| 2030 | void IHidServer::ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx) { | 1138 | Result IHidServer::ResetSevenSixAxisSensorTimestamp(ClientAppletResourceUserId aruid) { |
| 2031 | IPC::RequestParser rp{ctx}; | 1139 | LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 2032 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 2033 | 1140 | ||
| 2034 | GetResourceManager()->GetSevenSixAxis()->ResetTimestamp(); | 1141 | GetResourceManager()->GetSevenSixAxis()->ResetTimestamp(); |
| 2035 | 1142 | R_SUCCEED(); | |
| 2036 | LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 2037 | |||
| 2038 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2039 | rb.Push(ResultSuccess); | ||
| 2040 | } | 1143 | } |
| 2041 | 1144 | ||
| 2042 | void IHidServer::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) { | 1145 | Result IHidServer::IsUsbFullKeyControllerEnabled(Out<bool> out_is_enabled, |
| 2043 | IPC::RequestParser rp{ctx}; | 1146 | ClientAppletResourceUserId aruid) { |
| 2044 | |||
| 2045 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1147 | LOG_WARNING(Service_HID, "(STUBBED) called"); |
| 2046 | 1148 | ||
| 2047 | IPC::ResponseBuilder rb{ctx, 3}; | 1149 | *out_is_enabled = false; |
| 2048 | rb.Push(ResultSuccess); | 1150 | R_SUCCEED(); |
| 2049 | rb.Push(false); | ||
| 2050 | } | 1151 | } |
| 2051 | 1152 | ||
| 2052 | void IHidServer::GetPalmaConnectionHandle(HLERequestContext& ctx) { | 1153 | Result IHidServer::GetPalmaConnectionHandle(Out<Palma::PalmaConnectionHandle> out_handle, |
| 2053 | IPC::RequestParser rp{ctx}; | 1154 | Core::HID::NpadIdType npad_id, |
| 2054 | struct Parameters { | 1155 | ClientAppletResourceUserId aruid) { |
| 2055 | Core::HID::NpadIdType npad_id; | 1156 | LOG_WARNING(Service_HID, "(STUBBED) called, npad_id={}, applet_resource_user_id={}", npad_id, |
| 2056 | INSERT_PADDING_WORDS_NOINIT(1); | 1157 | aruid.pid); |
| 2057 | u64 applet_resource_user_id; | ||
| 2058 | }; | ||
| 2059 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 2060 | |||
| 2061 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 2062 | |||
| 2063 | LOG_WARNING(Service_HID, "(STUBBED) called, npad_id={}, applet_resource_user_id={}", | ||
| 2064 | parameters.npad_id, parameters.applet_resource_user_id); | ||
| 2065 | |||
| 2066 | Palma::PalmaConnectionHandle handle; | ||
| 2067 | auto controller = GetResourceManager()->GetPalma(); | ||
| 2068 | const auto result = controller->GetPalmaConnectionHandle(parameters.npad_id, handle); | ||
| 2069 | 1158 | ||
| 2070 | IPC::ResponseBuilder rb{ctx, 4}; | 1159 | R_RETURN(GetResourceManager()->GetPalma()->GetPalmaConnectionHandle(npad_id, *out_handle)); |
| 2071 | rb.Push(result); | ||
| 2072 | rb.PushRaw(handle); | ||
| 2073 | } | 1160 | } |
| 2074 | 1161 | ||
| 2075 | void IHidServer::InitializePalma(HLERequestContext& ctx) { | 1162 | Result IHidServer::InitializePalma(Palma::PalmaConnectionHandle connection_handle) { |
| 2076 | IPC::RequestParser rp{ctx}; | ||
| 2077 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2078 | |||
| 2079 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1163 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2080 | 1164 | ||
| 2081 | auto controller = GetResourceManager()->GetPalma(); | 1165 | R_RETURN(GetResourceManager()->GetPalma()->InitializePalma(connection_handle)); |
| 2082 | const auto result = controller->InitializePalma(connection_handle); | ||
| 2083 | |||
| 2084 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2085 | rb.Push(result); | ||
| 2086 | } | 1166 | } |
| 2087 | 1167 | ||
| 2088 | void IHidServer::AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx) { | 1168 | Result IHidServer::AcquirePalmaOperationCompleteEvent( |
| 2089 | IPC::RequestParser rp{ctx}; | 1169 | OutCopyHandle<Kernel::KReadableEvent> out_event, |
| 2090 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | 1170 | Palma::PalmaConnectionHandle connection_handle) { |
| 2091 | |||
| 2092 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1171 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2093 | 1172 | ||
| 2094 | auto controller = GetResourceManager()->GetPalma(); | 1173 | *out_event = |
| 2095 | 1174 | &GetResourceManager()->GetPalma()->AcquirePalmaOperationCompleteEvent(connection_handle); | |
| 2096 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 1175 | R_SUCCEED(); |
| 2097 | rb.Push(ResultSuccess); | ||
| 2098 | rb.PushCopyObjects(controller->AcquirePalmaOperationCompleteEvent(connection_handle)); | ||
| 2099 | } | 1176 | } |
| 2100 | 1177 | ||
| 2101 | void IHidServer::GetPalmaOperationInfo(HLERequestContext& ctx) { | 1178 | Result IHidServer::GetPalmaOperationInfo(Out<Palma::PalmaOperationType> out_operation_type, |
| 2102 | IPC::RequestParser rp{ctx}; | 1179 | Palma::PalmaConnectionHandle connection_handle, |
| 2103 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | 1180 | OutBuffer<BufferAttr_HipcMapAlias> out_data) { |
| 2104 | |||
| 2105 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1181 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2106 | 1182 | ||
| 2107 | Palma::PalmaOperationType operation_type; | 1183 | R_RETURN(GetResourceManager()->GetPalma()->GetPalmaOperationInfo( |
| 2108 | Palma::PalmaOperationData data; | 1184 | connection_handle, *out_operation_type, out_data)); |
| 2109 | auto controller = GetResourceManager()->GetPalma(); | ||
| 2110 | const auto result = controller->GetPalmaOperationInfo(connection_handle, operation_type, data); | ||
| 2111 | |||
| 2112 | if (result.IsError()) { | ||
| 2113 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2114 | rb.Push(result); | ||
| 2115 | } | ||
| 2116 | |||
| 2117 | ctx.WriteBuffer(data); | ||
| 2118 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 2119 | rb.Push(result); | ||
| 2120 | rb.Push(static_cast<u64>(operation_type)); | ||
| 2121 | } | 1185 | } |
| 2122 | 1186 | ||
| 2123 | void IHidServer::PlayPalmaActivity(HLERequestContext& ctx) { | 1187 | Result IHidServer::PlayPalmaActivity(Palma::PalmaConnectionHandle connection_handle, |
| 2124 | IPC::RequestParser rp{ctx}; | 1188 | u64 palma_activity) { |
| 2125 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2126 | const auto palma_activity{rp.Pop<u64>()}; | ||
| 2127 | |||
| 2128 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, palma_activity={}", | 1189 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, palma_activity={}", |
| 2129 | connection_handle.npad_id, palma_activity); | 1190 | connection_handle.npad_id, palma_activity); |
| 2130 | 1191 | ||
| 2131 | auto controller = GetResourceManager()->GetPalma(); | 1192 | R_RETURN( |
| 2132 | const auto result = controller->PlayPalmaActivity(connection_handle, palma_activity); | 1193 | GetResourceManager()->GetPalma()->PlayPalmaActivity(connection_handle, palma_activity)); |
| 2133 | |||
| 2134 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2135 | rb.Push(result); | ||
| 2136 | } | 1194 | } |
| 2137 | 1195 | ||
| 2138 | void IHidServer::SetPalmaFrModeType(HLERequestContext& ctx) { | 1196 | Result IHidServer::SetPalmaFrModeType(Palma::PalmaConnectionHandle connection_handle, |
| 2139 | IPC::RequestParser rp{ctx}; | 1197 | Palma::PalmaFrModeType fr_mode) { |
| 2140 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2141 | const auto fr_mode{rp.PopEnum<Palma::PalmaFrModeType>()}; | ||
| 2142 | |||
| 2143 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, fr_mode={}", | 1198 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, fr_mode={}", |
| 2144 | connection_handle.npad_id, fr_mode); | 1199 | connection_handle.npad_id, fr_mode); |
| 2145 | 1200 | ||
| 2146 | auto controller = GetResourceManager()->GetPalma(); | 1201 | R_RETURN(GetResourceManager()->GetPalma()->SetPalmaFrModeType(connection_handle, fr_mode)); |
| 2147 | const auto result = controller->SetPalmaFrModeType(connection_handle, fr_mode); | ||
| 2148 | |||
| 2149 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2150 | rb.Push(result); | ||
| 2151 | } | 1202 | } |
| 2152 | 1203 | ||
| 2153 | void IHidServer::ReadPalmaStep(HLERequestContext& ctx) { | 1204 | Result IHidServer::ReadPalmaStep(Palma::PalmaConnectionHandle connection_handle) { |
| 2154 | IPC::RequestParser rp{ctx}; | ||
| 2155 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2156 | |||
| 2157 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1205 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2158 | 1206 | ||
| 2159 | auto controller = GetResourceManager()->GetPalma(); | 1207 | R_RETURN(GetResourceManager()->GetPalma()->ReadPalmaStep(connection_handle)); |
| 2160 | const auto result = controller->ReadPalmaStep(connection_handle); | ||
| 2161 | |||
| 2162 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2163 | rb.Push(result); | ||
| 2164 | } | 1208 | } |
| 2165 | 1209 | ||
| 2166 | void IHidServer::EnablePalmaStep(HLERequestContext& ctx) { | 1210 | Result IHidServer::EnablePalmaStep(bool is_enabled, |
| 2167 | IPC::RequestParser rp{ctx}; | 1211 | Palma::PalmaConnectionHandle connection_handle) { |
| 2168 | struct Parameters { | ||
| 2169 | bool is_enabled; | ||
| 2170 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 2171 | Palma::PalmaConnectionHandle connection_handle; | ||
| 2172 | }; | ||
| 2173 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 2174 | |||
| 2175 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 2176 | |||
| 2177 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, is_enabled={}", | 1212 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, is_enabled={}", |
| 2178 | parameters.connection_handle.npad_id, parameters.is_enabled); | 1213 | connection_handle.npad_id, is_enabled); |
| 2179 | 1214 | ||
| 2180 | auto controller = GetResourceManager()->GetPalma(); | 1215 | R_RETURN(GetResourceManager()->GetPalma()->EnablePalmaStep(connection_handle, is_enabled)); |
| 2181 | const auto result = | ||
| 2182 | controller->EnablePalmaStep(parameters.connection_handle, parameters.is_enabled); | ||
| 2183 | |||
| 2184 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2185 | rb.Push(result); | ||
| 2186 | } | 1216 | } |
| 2187 | 1217 | ||
| 2188 | void IHidServer::ResetPalmaStep(HLERequestContext& ctx) { | 1218 | Result IHidServer::ResetPalmaStep(Palma::PalmaConnectionHandle connection_handle) { |
| 2189 | IPC::RequestParser rp{ctx}; | ||
| 2190 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2191 | |||
| 2192 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1219 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2193 | 1220 | ||
| 2194 | auto controller = GetResourceManager()->GetPalma(); | 1221 | R_RETURN(GetResourceManager()->GetPalma()->ResetPalmaStep(connection_handle)); |
| 2195 | const auto result = controller->ResetPalmaStep(connection_handle); | ||
| 2196 | |||
| 2197 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2198 | rb.Push(result); | ||
| 2199 | } | 1222 | } |
| 2200 | 1223 | ||
| 2201 | void IHidServer::ReadPalmaApplicationSection(HLERequestContext& ctx) { | 1224 | Result IHidServer::ReadPalmaApplicationSection(Palma::PalmaConnectionHandle connection_handle, |
| 2202 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1225 | u64 offset, u64 size) { |
| 2203 | 1226 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, offset={}, size={}", | |
| 2204 | IPC::ResponseBuilder rb{ctx, 2}; | 1227 | connection_handle.npad_id, offset, size); |
| 2205 | rb.Push(ResultSuccess); | 1228 | R_SUCCEED(); |
| 2206 | } | 1229 | } |
| 2207 | 1230 | ||
| 2208 | void IHidServer::WritePalmaApplicationSection(HLERequestContext& ctx) { | 1231 | Result IHidServer::WritePalmaApplicationSection( |
| 2209 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1232 | Palma::PalmaConnectionHandle connection_handle, u64 offset, u64 size, |
| 2210 | 1233 | InLargeData<Palma::PalmaApplicationSection, BufferAttr_HipcPointer> data) { | |
| 2211 | IPC::ResponseBuilder rb{ctx, 2}; | 1234 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, offset={}, size={}", |
| 2212 | rb.Push(ResultSuccess); | 1235 | connection_handle.npad_id, offset, size); |
| 1236 | R_SUCCEED(); | ||
| 2213 | } | 1237 | } |
| 2214 | 1238 | ||
| 2215 | void IHidServer::ReadPalmaUniqueCode(HLERequestContext& ctx) { | 1239 | Result IHidServer::ReadPalmaUniqueCode(Palma::PalmaConnectionHandle connection_handle) { |
| 2216 | IPC::RequestParser rp{ctx}; | ||
| 2217 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2218 | |||
| 2219 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1240 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2220 | 1241 | ||
| 2221 | GetResourceManager()->GetPalma()->ReadPalmaUniqueCode(connection_handle); | 1242 | GetResourceManager()->GetPalma()->ReadPalmaUniqueCode(connection_handle); |
| 2222 | 1243 | R_SUCCEED(); | |
| 2223 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2224 | rb.Push(ResultSuccess); | ||
| 2225 | } | 1244 | } |
| 2226 | 1245 | ||
| 2227 | void IHidServer::SetPalmaUniqueCodeInvalid(HLERequestContext& ctx) { | 1246 | Result IHidServer::SetPalmaUniqueCodeInvalid(Palma::PalmaConnectionHandle connection_handle) { |
| 2228 | IPC::RequestParser rp{ctx}; | ||
| 2229 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2230 | |||
| 2231 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1247 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2232 | 1248 | ||
| 2233 | GetResourceManager()->GetPalma()->SetPalmaUniqueCodeInvalid(connection_handle); | 1249 | GetResourceManager()->GetPalma()->SetPalmaUniqueCodeInvalid(connection_handle); |
| 2234 | 1250 | R_SUCCEED(); | |
| 2235 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2236 | rb.Push(ResultSuccess); | ||
| 2237 | } | 1251 | } |
| 2238 | 1252 | ||
| 2239 | void IHidServer::WritePalmaActivityEntry(HLERequestContext& ctx) { | 1253 | Result IHidServer::WritePalmaActivityEntry(Palma::PalmaConnectionHandle connection_handle, |
| 2240 | LOG_CRITICAL(Service_HID, "(STUBBED) called"); | 1254 | Palma::PalmaActivityEntry activity_entry) { |
| 2241 | 1255 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | |
| 2242 | IPC::ResponseBuilder rb{ctx, 2}; | 1256 | R_SUCCEED(); |
| 2243 | rb.Push(ResultSuccess); | ||
| 2244 | } | 1257 | } |
| 2245 | 1258 | ||
| 2246 | void IHidServer::WritePalmaRgbLedPatternEntry(HLERequestContext& ctx) { | 1259 | Result IHidServer::WritePalmaRgbLedPatternEntry(Palma::PalmaConnectionHandle connection_handle, |
| 2247 | IPC::RequestParser rp{ctx}; | 1260 | u64 unknown, |
| 2248 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | 1261 | InBuffer<BufferAttr_HipcMapAlias> led_pattern) { |
| 2249 | const auto unknown{rp.Pop<u64>()}; | ||
| 2250 | |||
| 2251 | [[maybe_unused]] const auto buffer = ctx.ReadBuffer(); | ||
| 2252 | |||
| 2253 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}", | 1262 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}", |
| 2254 | connection_handle.npad_id, unknown); | 1263 | connection_handle.npad_id, unknown); |
| 2255 | 1264 | ||
| 2256 | GetResourceManager()->GetPalma()->WritePalmaRgbLedPatternEntry(connection_handle, unknown); | 1265 | GetResourceManager()->GetPalma()->WritePalmaRgbLedPatternEntry(connection_handle, unknown); |
| 2257 | 1266 | R_SUCCEED(); | |
| 2258 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2259 | rb.Push(ResultSuccess); | ||
| 2260 | } | 1267 | } |
| 2261 | 1268 | ||
| 2262 | void IHidServer::WritePalmaWaveEntry(HLERequestContext& ctx) { | 1269 | Result IHidServer::WritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle, |
| 2263 | IPC::RequestParser rp{ctx}; | 1270 | Palma::PalmaWaveSet wave_set, u64 unknown, u64 t_mem_size, |
| 2264 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | 1271 | u64 size, InCopyHandle<Kernel::KTransferMemory> t_mem) { |
| 2265 | const auto wave_set{rp.PopEnum<Palma::PalmaWaveSet>()}; | 1272 | ASSERT_MSG(t_mem->GetSize() == t_mem_size, "t_mem has incorrect size"); |
| 2266 | const auto unknown{rp.Pop<u64>()}; | ||
| 2267 | const auto t_mem_size{rp.Pop<u64>()}; | ||
| 2268 | const auto t_mem_handle{ctx.GetCopyHandle(0)}; | ||
| 2269 | const auto size{rp.Pop<u64>()}; | ||
| 2270 | |||
| 2271 | ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes"); | ||
| 2272 | |||
| 2273 | auto t_mem = ctx.GetObjectFromHandle<Kernel::KTransferMemory>(t_mem_handle); | ||
| 2274 | |||
| 2275 | if (t_mem.IsNull()) { | ||
| 2276 | LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); | ||
| 2277 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2278 | rb.Push(ResultUnknown); | ||
| 2279 | return; | ||
| 2280 | } | ||
| 2281 | |||
| 2282 | ASSERT_MSG(t_mem->GetSize() == 0x3000, "t_mem has incorrect size"); | ||
| 2283 | 1273 | ||
| 2284 | LOG_WARNING(Service_HID, | 1274 | LOG_WARNING( |
| 2285 | "(STUBBED) called, connection_handle={}, wave_set={}, unknown={}, " | 1275 | Service_HID, |
| 2286 | "t_mem_handle=0x{:08X}, t_mem_size={}, size={}", | 1276 | "(STUBBED) called, connection_handle={}, wave_set={}, unknown={}, t_mem_size={}, size={}", |
| 2287 | connection_handle.npad_id, wave_set, unknown, t_mem_handle, t_mem_size, size); | 1277 | connection_handle.npad_id, wave_set, unknown, t_mem_size, size); |
| 2288 | 1278 | ||
| 2289 | GetResourceManager()->GetPalma()->WritePalmaWaveEntry(connection_handle, wave_set, | 1279 | GetResourceManager()->GetPalma()->WritePalmaWaveEntry(connection_handle, wave_set, |
| 2290 | t_mem->GetSourceAddress(), t_mem_size); | 1280 | t_mem->GetSourceAddress(), t_mem_size); |
| 2291 | 1281 | R_SUCCEED(); | |
| 2292 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2293 | rb.Push(ResultSuccess); | ||
| 2294 | } | 1282 | } |
| 2295 | 1283 | ||
| 2296 | void IHidServer::SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) { | 1284 | Result IHidServer::SetPalmaDataBaseIdentificationVersion( |
| 2297 | IPC::RequestParser rp{ctx}; | 1285 | s32 database_id_version, Palma::PalmaConnectionHandle connection_handle) { |
| 2298 | struct Parameters { | ||
| 2299 | s32 database_id_version; | ||
| 2300 | INSERT_PADDING_WORDS_NOINIT(1); | ||
| 2301 | Palma::PalmaConnectionHandle connection_handle; | ||
| 2302 | }; | ||
| 2303 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 2304 | |||
| 2305 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 2306 | |||
| 2307 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, database_id_version={}", | 1286 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, database_id_version={}", |
| 2308 | parameters.connection_handle.npad_id, parameters.database_id_version); | 1287 | connection_handle.npad_id, database_id_version); |
| 2309 | 1288 | ||
| 2310 | GetResourceManager()->GetPalma()->SetPalmaDataBaseIdentificationVersion( | 1289 | GetResourceManager()->GetPalma()->SetPalmaDataBaseIdentificationVersion(connection_handle, |
| 2311 | parameters.connection_handle, parameters.database_id_version); | 1290 | database_id_version); |
| 2312 | 1291 | R_SUCCEED(); | |
| 2313 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2314 | rb.Push(ResultSuccess); | ||
| 2315 | } | 1292 | } |
| 2316 | 1293 | ||
| 2317 | void IHidServer::GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) { | 1294 | Result IHidServer::GetPalmaDataBaseIdentificationVersion( |
| 2318 | IPC::RequestParser rp{ctx}; | 1295 | Palma::PalmaConnectionHandle connection_handle) { |
| 2319 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2320 | |||
| 2321 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1296 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2322 | 1297 | ||
| 2323 | GetResourceManager()->GetPalma()->GetPalmaDataBaseIdentificationVersion(connection_handle); | 1298 | R_RETURN( |
| 2324 | 1299 | GetResourceManager()->GetPalma()->GetPalmaDataBaseIdentificationVersion(connection_handle)); | |
| 2325 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2326 | rb.Push(ResultSuccess); | ||
| 2327 | } | 1300 | } |
| 2328 | 1301 | ||
| 2329 | void IHidServer::SuspendPalmaFeature(HLERequestContext& ctx) { | 1302 | Result IHidServer::SuspendPalmaFeature(Palma::PalmaFeature feature, |
| 2330 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1303 | Palma::PalmaConnectionHandle connection_handle) { |
| 2331 | 1304 | LOG_WARNING(Service_HID, "(STUBBED) called, feature={}, connection_handle={}", feature, | |
| 2332 | IPC::ResponseBuilder rb{ctx, 2}; | 1305 | connection_handle.npad_id); |
| 2333 | rb.Push(ResultSuccess); | 1306 | R_SUCCEED(); |
| 2334 | } | 1307 | } |
| 2335 | 1308 | ||
| 2336 | void IHidServer::GetPalmaOperationResult(HLERequestContext& ctx) { | 1309 | Result IHidServer::GetPalmaOperationResult(Palma::PalmaConnectionHandle connection_handle) { |
| 2337 | IPC::RequestParser rp{ctx}; | ||
| 2338 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2339 | |||
| 2340 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1310 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2341 | 1311 | ||
| 2342 | const auto result = | 1312 | R_RETURN(GetResourceManager()->GetPalma()->GetPalmaOperationResult(connection_handle)); |
| 2343 | GetResourceManager()->GetPalma()->GetPalmaOperationResult(connection_handle); | ||
| 2344 | |||
| 2345 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2346 | rb.Push(result); | ||
| 2347 | } | 1313 | } |
| 2348 | 1314 | ||
| 2349 | void IHidServer::ReadPalmaPlayLog(HLERequestContext& ctx) { | 1315 | Result IHidServer::ReadPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle) { |
| 2350 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1316 | LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}, connection_handle={}", unknown, |
| 2351 | 1317 | connection_handle.npad_id); | |
| 2352 | IPC::ResponseBuilder rb{ctx, 2}; | 1318 | R_SUCCEED(); |
| 2353 | rb.Push(ResultSuccess); | ||
| 2354 | } | 1319 | } |
| 2355 | 1320 | ||
| 2356 | void IHidServer::ResetPalmaPlayLog(HLERequestContext& ctx) { | 1321 | Result IHidServer::ResetPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle) { |
| 2357 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1322 | LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}, connection_handle={}", unknown, |
| 2358 | 1323 | connection_handle.npad_id); | |
| 2359 | IPC::ResponseBuilder rb{ctx, 2}; | 1324 | R_SUCCEED(); |
| 2360 | rb.Push(ResultSuccess); | ||
| 2361 | } | 1325 | } |
| 2362 | 1326 | ||
| 2363 | void IHidServer::SetIsPalmaAllConnectable(HLERequestContext& ctx) { | 1327 | Result IHidServer::SetIsPalmaAllConnectable(bool is_palma_all_connectable, |
| 2364 | IPC::RequestParser rp{ctx}; | 1328 | ClientAppletResourceUserId aruid) { |
| 2365 | struct Parameters { | ||
| 2366 | bool is_palma_all_connectable; | ||
| 2367 | INSERT_PADDING_BYTES_NOINIT(7); | ||
| 2368 | u64 applet_resource_user_id; | ||
| 2369 | }; | ||
| 2370 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 2371 | |||
| 2372 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 2373 | |||
| 2374 | LOG_WARNING(Service_HID, | 1329 | LOG_WARNING(Service_HID, |
| 2375 | "(STUBBED) called, is_palma_all_connectable={},applet_resource_user_id={}", | 1330 | "(STUBBED) called, is_palma_all_connectable={}, applet_resource_user_id={}", |
| 2376 | parameters.is_palma_all_connectable, parameters.applet_resource_user_id); | 1331 | is_palma_all_connectable, aruid.pid); |
| 2377 | |||
| 2378 | GetResourceManager()->GetPalma()->SetIsPalmaAllConnectable(parameters.is_palma_all_connectable); | ||
| 2379 | 1332 | ||
| 2380 | IPC::ResponseBuilder rb{ctx, 2}; | 1333 | GetResourceManager()->GetPalma()->SetIsPalmaAllConnectable(is_palma_all_connectable); |
| 2381 | rb.Push(ResultSuccess); | 1334 | R_SUCCEED(); |
| 2382 | } | 1335 | } |
| 2383 | 1336 | ||
| 2384 | void IHidServer::SetIsPalmaPairedConnectable(HLERequestContext& ctx) { | 1337 | Result IHidServer::SetIsPalmaPairedConnectable(bool is_palma_paired_connectable, |
| 2385 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1338 | ClientAppletResourceUserId aruid) { |
| 2386 | 1339 | LOG_WARNING(Service_HID, | |
| 2387 | IPC::ResponseBuilder rb{ctx, 2}; | 1340 | "(STUBBED) called, is_palma_paired_connectable={}, applet_resource_user_id={}", |
| 2388 | rb.Push(ResultSuccess); | 1341 | is_palma_paired_connectable, aruid.pid); |
| 1342 | R_SUCCEED(); | ||
| 2389 | } | 1343 | } |
| 2390 | 1344 | ||
| 2391 | void IHidServer::PairPalma(HLERequestContext& ctx) { | 1345 | Result IHidServer::PairPalma(Palma::PalmaConnectionHandle connection_handle) { |
| 2392 | IPC::RequestParser rp{ctx}; | ||
| 2393 | const auto connection_handle{rp.PopRaw<Palma::PalmaConnectionHandle>()}; | ||
| 2394 | |||
| 2395 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | 1346 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2396 | 1347 | ||
| 2397 | GetResourceManager()->GetPalma()->PairPalma(connection_handle); | 1348 | GetResourceManager()->GetPalma()->PairPalma(connection_handle); |
| 2398 | 1349 | R_SUCCEED(); | |
| 2399 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2400 | rb.Push(ResultSuccess); | ||
| 2401 | } | 1350 | } |
| 2402 | 1351 | ||
| 2403 | void IHidServer::SetPalmaBoostMode(HLERequestContext& ctx) { | 1352 | Result IHidServer::SetPalmaBoostMode(bool is_enabled) { |
| 2404 | IPC::RequestParser rp{ctx}; | 1353 | LOG_WARNING(Service_HID, "(STUBBED) called, is_enabled={}", is_enabled); |
| 2405 | const auto palma_boost_mode{rp.Pop<bool>()}; | ||
| 2406 | |||
| 2407 | LOG_WARNING(Service_HID, "(STUBBED) called, palma_boost_mode={}", palma_boost_mode); | ||
| 2408 | |||
| 2409 | GetResourceManager()->GetPalma()->SetPalmaBoostMode(palma_boost_mode); | ||
| 2410 | 1354 | ||
| 2411 | IPC::ResponseBuilder rb{ctx, 2}; | 1355 | GetResourceManager()->GetPalma()->SetPalmaBoostMode(is_enabled); |
| 2412 | rb.Push(ResultSuccess); | 1356 | R_SUCCEED(); |
| 2413 | } | 1357 | } |
| 2414 | 1358 | ||
| 2415 | void IHidServer::CancelWritePalmaWaveEntry(HLERequestContext& ctx) { | 1359 | Result IHidServer::CancelWritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle) { |
| 2416 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1360 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); |
| 2417 | 1361 | R_SUCCEED(); | |
| 2418 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2419 | rb.Push(ResultSuccess); | ||
| 2420 | } | 1362 | } |
| 2421 | 1363 | ||
| 2422 | void IHidServer::EnablePalmaBoostMode(HLERequestContext& ctx) { | 1364 | Result IHidServer::EnablePalmaBoostMode(bool is_enabled, ClientAppletResourceUserId aruid) { |
| 2423 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1365 | LOG_WARNING(Service_HID, "(STUBBED) called, is_enabled={}, applet_resource_user_id={}", |
| 2424 | 1366 | is_enabled, aruid.pid); | |
| 2425 | IPC::ResponseBuilder rb{ctx, 2}; | 1367 | R_SUCCEED(); |
| 2426 | rb.Push(ResultSuccess); | ||
| 2427 | } | 1368 | } |
| 2428 | 1369 | ||
| 2429 | void IHidServer::GetPalmaBluetoothAddress(HLERequestContext& ctx) { | 1370 | Result IHidServer::GetPalmaBluetoothAddress(Out<Palma::Address> out_bt_address, |
| 2430 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1371 | Palma::PalmaConnectionHandle connection_handle) { |
| 2431 | 1372 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}", connection_handle.npad_id); | |
| 2432 | IPC::ResponseBuilder rb{ctx, 2}; | 1373 | R_SUCCEED(); |
| 2433 | rb.Push(ResultSuccess); | ||
| 2434 | } | 1374 | } |
| 2435 | 1375 | ||
| 2436 | void IHidServer::SetDisallowedPalmaConnection(HLERequestContext& ctx) { | 1376 | Result IHidServer::SetDisallowedPalmaConnection( |
| 2437 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 1377 | ClientAppletResourceUserId aruid, |
| 2438 | 1378 | InArray<Palma::Address, BufferAttr_HipcPointer> disallowed_address) { | |
| 2439 | IPC::ResponseBuilder rb{ctx, 2}; | 1379 | LOG_DEBUG(Service_HID, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); |
| 2440 | rb.Push(ResultSuccess); | 1380 | R_SUCCEED(); |
| 2441 | } | 1381 | } |
| 2442 | 1382 | ||
| 2443 | void IHidServer::SetNpadCommunicationMode(HLERequestContext& ctx) { | 1383 | Result IHidServer::SetNpadCommunicationMode(ClientAppletResourceUserId aruid, |
| 2444 | IPC::RequestParser rp{ctx}; | 1384 | NpadCommunicationMode communication_mode) { |
| 2445 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1385 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, communication_mode={}", aruid.pid, |
| 2446 | const auto communication_mode{rp.PopEnum<NpadCommunicationMode>()}; | 1386 | communication_mode); |
| 2447 | |||
| 2448 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, communication_mode={}", | ||
| 2449 | applet_resource_user_id, communication_mode); | ||
| 2450 | 1387 | ||
| 2451 | // This function has been stubbed since 2.0.0+ | 1388 | // This function has been stubbed since 2.0.0+ |
| 2452 | 1389 | R_SUCCEED(); | |
| 2453 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2454 | rb.Push(ResultSuccess); | ||
| 2455 | } | 1390 | } |
| 2456 | 1391 | ||
| 2457 | void IHidServer::GetNpadCommunicationMode(HLERequestContext& ctx) { | 1392 | Result IHidServer::GetNpadCommunicationMode(Out<NpadCommunicationMode> out_communication_mode, |
| 2458 | IPC::RequestParser rp{ctx}; | 1393 | ClientAppletResourceUserId aruid) { |
| 2459 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1394 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", aruid.pid); |
| 2460 | |||
| 2461 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 2462 | 1395 | ||
| 2463 | // This function has been stubbed since 2.0.0+ | 1396 | // This function has been stubbed since 2.0.0+ |
| 2464 | 1397 | *out_communication_mode = NpadCommunicationMode::Default; | |
| 2465 | IPC::ResponseBuilder rb{ctx, 4}; | 1398 | R_SUCCEED(); |
| 2466 | rb.Push(ResultSuccess); | ||
| 2467 | rb.PushEnum(NpadCommunicationMode::Default); | ||
| 2468 | } | 1399 | } |
| 2469 | 1400 | ||
| 2470 | void IHidServer::SetTouchScreenConfiguration(HLERequestContext& ctx) { | 1401 | Result IHidServer::SetTouchScreenConfiguration( |
| 2471 | IPC::RequestParser rp{ctx}; | 1402 | Core::HID::TouchScreenConfigurationForNx touchscreen_config, ClientAppletResourceUserId aruid) { |
| 2472 | auto touchscreen_config{rp.PopRaw<Core::HID::TouchScreenConfigurationForNx>()}; | ||
| 2473 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 2474 | |||
| 2475 | LOG_INFO(Service_HID, "called, touchscreen_config={}, applet_resource_user_id={}", | 1403 | LOG_INFO(Service_HID, "called, touchscreen_config={}, applet_resource_user_id={}", |
| 2476 | touchscreen_config.mode, applet_resource_user_id); | 1404 | touchscreen_config.mode, aruid.pid); |
| 2477 | 1405 | ||
| 2478 | if (touchscreen_config.mode != Core::HID::TouchScreenModeForNx::Heat2 && | 1406 | if (touchscreen_config.mode != Core::HID::TouchScreenModeForNx::Heat2 && |
| 2479 | touchscreen_config.mode != Core::HID::TouchScreenModeForNx::Finger) { | 1407 | touchscreen_config.mode != Core::HID::TouchScreenModeForNx::Finger) { |
| 2480 | touchscreen_config.mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; | 1408 | touchscreen_config.mode = Core::HID::TouchScreenModeForNx::UseSystemSetting; |
| 2481 | } | 1409 | } |
| 2482 | 1410 | ||
| 2483 | const Result result = GetResourceManager()->GetTouchScreen()->SetTouchScreenConfiguration( | 1411 | R_RETURN(GetResourceManager()->GetTouchScreen()->SetTouchScreenConfiguration(touchscreen_config, |
| 2484 | touchscreen_config, applet_resource_user_id); | 1412 | aruid.pid)); |
| 2485 | |||
| 2486 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 2487 | rb.Push(result); | ||
| 2488 | } | 1413 | } |
| 2489 | 1414 | ||
| 2490 | void IHidServer::IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx) { | 1415 | Result IHidServer::IsFirmwareUpdateNeededForNotification(Out<bool> out_is_firmware_update_needed, |
| 2491 | IPC::RequestParser rp{ctx}; | 1416 | s32 unknown, |
| 2492 | struct Parameters { | 1417 | ClientAppletResourceUserId aruid) { |
| 2493 | s32 unknown; | 1418 | LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}, applet_resource_user_id={}", unknown, |
| 2494 | INSERT_PADDING_WORDS_NOINIT(1); | 1419 | aruid.pid); |
| 2495 | u64 applet_resource_user_id; | ||
| 2496 | }; | ||
| 2497 | static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); | ||
| 2498 | |||
| 2499 | const auto parameters{rp.PopRaw<Parameters>()}; | ||
| 2500 | 1420 | ||
| 2501 | LOG_WARNING(Service_HID, "(STUBBED) called, unknown={}, applet_resource_user_id={}", | 1421 | *out_is_firmware_update_needed = false; |
| 2502 | parameters.unknown, parameters.applet_resource_user_id); | 1422 | R_SUCCEED(); |
| 2503 | |||
| 2504 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 2505 | rb.Push(ResultSuccess); | ||
| 2506 | rb.Push(false); | ||
| 2507 | } | 1423 | } |
| 2508 | 1424 | ||
| 2509 | void IHidServer::SetTouchScreenResolution(HLERequestContext& ctx) { | 1425 | Result IHidServer::SetTouchScreenResolution(u32 width, u32 height, |
| 2510 | IPC::RequestParser rp{ctx}; | 1426 | ClientAppletResourceUserId aruid) { |
| 2511 | const auto width{rp.Pop<u32>()}; | ||
| 2512 | const auto height{rp.Pop<u32>()}; | ||
| 2513 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 2514 | |||
| 2515 | LOG_INFO(Service_HID, "called, width={}, height={}, applet_resource_user_id={}", width, height, | 1427 | LOG_INFO(Service_HID, "called, width={}, height={}, applet_resource_user_id={}", width, height, |
| 2516 | applet_resource_user_id); | 1428 | aruid.pid); |
| 2517 | |||
| 2518 | GetResourceManager()->GetTouchScreen()->SetTouchScreenResolution(width, height, | ||
| 2519 | applet_resource_user_id); | ||
| 2520 | 1429 | ||
| 2521 | IPC::ResponseBuilder rb{ctx, 2}; | 1430 | GetResourceManager()->GetTouchScreen()->SetTouchScreenResolution(width, height, aruid.pid); |
| 2522 | rb.Push(ResultSuccess); | 1431 | R_SUCCEED(); |
| 2523 | } | 1432 | } |
| 2524 | 1433 | ||
| 2525 | std::shared_ptr<ResourceManager> IHidServer::GetResourceManager() { | 1434 | std::shared_ptr<ResourceManager> IHidServer::GetResourceManager() { |
diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index faf775689..cfa31c2de 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h | |||
| @@ -6,12 +6,20 @@ | |||
| 6 | #include "core/hle/service/cmif_types.h" | 6 | #include "core/hle/service/cmif_types.h" |
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | #include "hid_core/hid_types.h" | 8 | #include "hid_core/hid_types.h" |
| 9 | #include "hid_core/resources/npad/npad_types.h" | ||
| 10 | #include "hid_core/resources/palma/palma.h" | ||
| 9 | 11 | ||
| 10 | namespace Core { | 12 | namespace Core { |
| 11 | class System; | 13 | class System; |
| 12 | } | 14 | } |
| 13 | 15 | ||
| 16 | namespace Kernel { | ||
| 17 | class KReadableEvent; | ||
| 18 | } | ||
| 19 | |||
| 14 | namespace Service::HID { | 20 | namespace Service::HID { |
| 21 | class IActiveVibrationDeviceList; | ||
| 22 | class IAppletResource; | ||
| 15 | class ResourceManager; | 23 | class ResourceManager; |
| 16 | class HidFirmwareSettings; | 24 | class HidFirmwareSettings; |
| 17 | 25 | ||
| @@ -24,128 +32,232 @@ public: | |||
| 24 | std::shared_ptr<ResourceManager> GetResourceManager(); | 32 | std::shared_ptr<ResourceManager> GetResourceManager(); |
| 25 | 33 | ||
| 26 | private: | 34 | private: |
| 27 | void CreateAppletResource(HLERequestContext& ctx); | 35 | Result CreateAppletResource(OutInterface<IAppletResource> out_applet_resource, |
| 28 | void ActivateDebugPad(HLERequestContext& ctx); | 36 | ClientAppletResourceUserId aruid); |
| 29 | void ActivateTouchScreen(HLERequestContext& ctx); | 37 | Result ActivateDebugPad(ClientAppletResourceUserId aruid); |
| 30 | void ActivateMouse(HLERequestContext& ctx); | 38 | Result ActivateTouchScreen(ClientAppletResourceUserId aruid); |
| 31 | void ActivateKeyboard(HLERequestContext& ctx); | 39 | Result ActivateMouse(ClientAppletResourceUserId aruid); |
| 32 | void SendKeyboardLockKeyEvent(HLERequestContext& ctx); | 40 | Result ActivateKeyboard(ClientAppletResourceUserId aruid); |
| 33 | void AcquireXpadIdEventHandle(HLERequestContext& ctx); | 41 | Result SendKeyboardLockKeyEvent(u32 flags); |
| 34 | void ReleaseXpadIdEventHandle(HLERequestContext& ctx); | 42 | Result AcquireXpadIdEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event, |
| 35 | void ActivateXpad(HLERequestContext& ctx); | 43 | ClientAppletResourceUserId aruid); |
| 36 | void GetXpadIds(HLERequestContext& ctx); | 44 | Result ReleaseXpadIdEventHandle(ClientAppletResourceUserId aruid); |
| 37 | void ActivateJoyXpad(HLERequestContext& ctx); | 45 | Result ActivateXpad(u32 basic_xpad_id, ClientAppletResourceUserId aruid); |
| 38 | void GetJoyXpadLifoHandle(HLERequestContext& ctx); | 46 | Result GetXpadIds(Out<u64> out_count, OutArray<u32, BufferAttr_HipcPointer> out_basic_pad_ids); |
| 39 | void GetJoyXpadIds(HLERequestContext& ctx); | 47 | Result ActivateJoyXpad(u32 joy_xpad_id); |
| 40 | void ActivateSixAxisSensor(HLERequestContext& ctx); | 48 | Result GetJoyXpadLifoHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, |
| 41 | void DeactivateSixAxisSensor(HLERequestContext& ctx); | 49 | u32 joy_xpad_id); |
| 42 | void GetSixAxisSensorLifoHandle(HLERequestContext& ctx); | 50 | Result GetJoyXpadIds(Out<s64> out_basic_xpad_id_count); |
| 43 | void ActivateJoySixAxisSensor(HLERequestContext& ctx); | 51 | Result ActivateSixAxisSensor(u32 joy_xpad_id); |
| 44 | void DeactivateJoySixAxisSensor(HLERequestContext& ctx); | 52 | Result DeactivateSixAxisSensor(u32 joy_xpad_id); |
| 45 | void GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx); | 53 | Result GetSixAxisSensorLifoHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, |
| 46 | void StartSixAxisSensor(HLERequestContext& ctx); | 54 | u32 joy_xpad_id); |
| 47 | void StopSixAxisSensor(HLERequestContext& ctx); | 55 | Result ActivateJoySixAxisSensor(u32 joy_xpad_id); |
| 48 | void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx); | 56 | Result DeactivateJoySixAxisSensor(u32 joy_xpad_id); |
| 49 | void EnableSixAxisSensorFusion(HLERequestContext& ctx); | 57 | Result GetJoySixAxisSensorLifoHandle( |
| 50 | void SetSixAxisSensorFusionParameters(HLERequestContext& ctx); | 58 | OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, u32 joy_xpad_id); |
| 51 | void GetSixAxisSensorFusionParameters(HLERequestContext& ctx); | 59 | Result StartSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 52 | void ResetSixAxisSensorFusionParameters(HLERequestContext& ctx); | 60 | ClientAppletResourceUserId aruid); |
| 53 | void SetGyroscopeZeroDriftMode(HLERequestContext& ctx); | 61 | Result StopSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 54 | void GetGyroscopeZeroDriftMode(HLERequestContext& ctx); | 62 | ClientAppletResourceUserId aruid); |
| 55 | void ResetGyroscopeZeroDriftMode(HLERequestContext& ctx); | 63 | Result IsSixAxisSensorFusionEnabled(Out<bool> out_is_enabled, |
| 56 | void IsSixAxisSensorAtRest(HLERequestContext& ctx); | 64 | Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 57 | void IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx); | 65 | ClientAppletResourceUserId aruid); |
| 58 | void EnableSixAxisSensorUnalteredPassthrough(HLERequestContext& ctx); | 66 | Result EnableSixAxisSensorFusion(bool is_enabled, Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 59 | void IsSixAxisSensorUnalteredPassthroughEnabled(HLERequestContext& ctx); | 67 | ClientAppletResourceUserId aruid); |
| 60 | void LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx); | 68 | Result SetSixAxisSensorFusionParameters(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 61 | void GetSixAxisSensorIcInformation(HLERequestContext& ctx); | 69 | Core::HID::SixAxisSensorFusionParameters sixaxis_fusion, |
| 62 | void ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx); | 70 | ClientAppletResourceUserId aruid); |
| 63 | void ActivateGesture(HLERequestContext& ctx); | 71 | Result GetSixAxisSensorFusionParameters( |
| 64 | void SetSupportedNpadStyleSet(HLERequestContext& ctx); | 72 | Out<Core::HID::SixAxisSensorFusionParameters> out_fusion_parameters, |
| 65 | void GetSupportedNpadStyleSet(HLERequestContext& ctx); | 73 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid); |
| 66 | void SetSupportedNpadIdType(HLERequestContext& ctx); | 74 | Result ResetSixAxisSensorFusionParameters(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 67 | void ActivateNpad(HLERequestContext& ctx); | 75 | ClientAppletResourceUserId aruid); |
| 68 | void DeactivateNpad(HLERequestContext& ctx); | 76 | Result SetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle, |
| 69 | void AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx); | 77 | Core::HID::GyroscopeZeroDriftMode drift_mode, |
| 70 | void DisconnectNpad(HLERequestContext& ctx); | 78 | ClientAppletResourceUserId aruid); |
| 79 | Result GetGyroscopeZeroDriftMode(Out<Core::HID::GyroscopeZeroDriftMode> out_drift_mode, | ||
| 80 | Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 81 | ClientAppletResourceUserId aruid); | ||
| 82 | Result ResetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 83 | ClientAppletResourceUserId aruid); | ||
| 84 | Result IsSixAxisSensorAtRest(Out<bool> out_is_at_rest, | ||
| 85 | Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 86 | ClientAppletResourceUserId aruid); | ||
| 87 | Result IsFirmwareUpdateAvailableForSixAxisSensor(Out<bool> out_is_firmware_available, | ||
| 88 | Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 89 | ClientAppletResourceUserId aruid); | ||
| 90 | Result EnableSixAxisSensorUnalteredPassthrough(bool is_enabled, | ||
| 91 | Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 92 | ClientAppletResourceUserId aruid); | ||
| 93 | Result IsSixAxisSensorUnalteredPassthroughEnabled(Out<bool> out_is_enabled, | ||
| 94 | Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 95 | ClientAppletResourceUserId aruid); | ||
| 96 | Result LoadSixAxisSensorCalibrationParameter( | ||
| 97 | OutLargeData<Core::HID::SixAxisSensorCalibrationParameter, BufferAttr_HipcMapAlias> | ||
| 98 | out_calibration, | ||
| 99 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid); | ||
| 100 | Result GetSixAxisSensorIcInformation( | ||
| 101 | OutLargeData<Core::HID::SixAxisSensorIcInformation, BufferAttr_HipcPointer> | ||
| 102 | out_ic_information, | ||
| 103 | Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid); | ||
| 104 | Result ResetIsSixAxisSensorDeviceNewlyAssigned(Core::HID::SixAxisSensorHandle sixaxis_handle, | ||
| 105 | ClientAppletResourceUserId aruid); | ||
| 106 | Result ActivateGesture(u32 basic_gesture_id, ClientAppletResourceUserId aruid); | ||
| 107 | Result SetSupportedNpadStyleSet(Core::HID::NpadStyleSet supported_style_set, | ||
| 108 | ClientAppletResourceUserId aruid); | ||
| 109 | Result GetSupportedNpadStyleSet(Out<Core::HID::NpadStyleSet> out_supported_style_set, | ||
| 110 | ClientAppletResourceUserId aruid); | ||
| 111 | Result SetSupportedNpadIdType( | ||
| 112 | ClientAppletResourceUserId aruid, | ||
| 113 | InArray<Core::HID::NpadIdType, BufferAttr_HipcPointer> supported_npad_list); | ||
| 114 | Result ActivateNpad(ClientAppletResourceUserId aruid); | ||
| 115 | Result DeactivateNpad(ClientAppletResourceUserId aruid); | ||
| 116 | Result AcquireNpadStyleSetUpdateEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event, | ||
| 117 | Core::HID::NpadIdType npad_id, | ||
| 118 | ClientAppletResourceUserId aruid, u64 unknown); | ||
| 119 | Result DisconnectNpad(Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid); | ||
| 71 | Result GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern, | 120 | Result GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern, |
| 72 | Core::HID::NpadIdType npad_id); | 121 | Core::HID::NpadIdType npad_id); |
| 73 | void ActivateNpadWithRevision(HLERequestContext& ctx); | 122 | Result ActivateNpadWithRevision(NpadRevision revision, ClientAppletResourceUserId aruid); |
| 74 | void SetNpadJoyHoldType(HLERequestContext& ctx); | 123 | Result SetNpadJoyHoldType(ClientAppletResourceUserId aruid, NpadJoyHoldType hold_type); |
| 75 | void GetNpadJoyHoldType(HLERequestContext& ctx); | 124 | Result GetNpadJoyHoldType(Out<NpadJoyHoldType> out_hold_type, ClientAppletResourceUserId aruid); |
| 76 | void SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx); | 125 | Result SetNpadJoyAssignmentModeSingleByDefault(Core::HID::NpadIdType npad_id, |
| 77 | void SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx); | 126 | ClientAppletResourceUserId aruid); |
| 78 | void SetNpadJoyAssignmentModeDual(HLERequestContext& ctx); | 127 | Result SetNpadJoyAssignmentModeSingle(Core::HID::NpadIdType npad_id, |
| 79 | void MergeSingleJoyAsDualJoy(HLERequestContext& ctx); | 128 | ClientAppletResourceUserId aruid, |
| 80 | void StartLrAssignmentMode(HLERequestContext& ctx); | 129 | NpadJoyDeviceType npad_joy_device_type); |
| 81 | void StopLrAssignmentMode(HLERequestContext& ctx); | 130 | Result SetNpadJoyAssignmentModeDual(Core::HID::NpadIdType npad_id, |
| 82 | void SetNpadHandheldActivationMode(HLERequestContext& ctx); | 131 | ClientAppletResourceUserId aruid); |
| 83 | void GetNpadHandheldActivationMode(HLERequestContext& ctx); | 132 | Result MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2, |
| 84 | void SwapNpadAssignment(HLERequestContext& ctx); | 133 | ClientAppletResourceUserId aruid); |
| 85 | void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx); | 134 | Result StartLrAssignmentMode(ClientAppletResourceUserId aruid); |
| 86 | void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx); | 135 | Result StopLrAssignmentMode(ClientAppletResourceUserId aruid); |
| 87 | void SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx); | 136 | Result SetNpadHandheldActivationMode(ClientAppletResourceUserId aruid, |
| 88 | void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx); | 137 | NpadHandheldActivationMode activation_mode); |
| 89 | void SetNpadCaptureButtonAssignment(HLERequestContext& ctx); | 138 | Result GetNpadHandheldActivationMode(Out<NpadHandheldActivationMode> out_activation_mode, |
| 90 | void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx); | 139 | ClientAppletResourceUserId aruid); |
| 91 | void GetVibrationDeviceInfo(HLERequestContext& ctx); | 140 | Result SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2, |
| 92 | void SendVibrationValue(HLERequestContext& ctx); | 141 | ClientAppletResourceUserId aruid); |
| 93 | void GetActualVibrationValue(HLERequestContext& ctx); | 142 | Result IsUnintendedHomeButtonInputProtectionEnabled(Out<bool> out_is_enabled, |
| 94 | void CreateActiveVibrationDeviceList(HLERequestContext& ctx); | 143 | Core::HID::NpadIdType npad_id, |
| 95 | void PermitVibration(HLERequestContext& ctx); | 144 | ClientAppletResourceUserId aruid); |
| 96 | void IsVibrationPermitted(HLERequestContext& ctx); | 145 | Result EnableUnintendedHomeButtonInputProtection(bool is_enabled, Core::HID::NpadIdType npad_id, |
| 97 | void SendVibrationValues(HLERequestContext& ctx); | 146 | ClientAppletResourceUserId aruid); |
| 98 | void SendVibrationGcErmCommand(HLERequestContext& ctx); | 147 | Result SetNpadJoyAssignmentModeSingleWithDestination(Out<bool> out_is_reassigned, |
| 99 | void GetActualVibrationGcErmCommand(HLERequestContext& ctx); | 148 | Out<Core::HID::NpadIdType> out_new_npad_id, |
| 100 | void BeginPermitVibrationSession(HLERequestContext& ctx); | 149 | Core::HID::NpadIdType npad_id, |
| 101 | void EndPermitVibrationSession(HLERequestContext& ctx); | 150 | ClientAppletResourceUserId aruid, |
| 102 | void IsVibrationDeviceMounted(HLERequestContext& ctx); | 151 | NpadJoyDeviceType npad_joy_device_type); |
| 103 | void SendVibrationValueInBool(HLERequestContext& ctx); | 152 | Result SetNpadAnalogStickUseCenterClamp(bool use_center_clamp, |
| 104 | void ActivateConsoleSixAxisSensor(HLERequestContext& ctx); | 153 | ClientAppletResourceUserId aruid); |
| 105 | void StartConsoleSixAxisSensor(HLERequestContext& ctx); | 154 | Result SetNpadCaptureButtonAssignment(Core::HID::NpadStyleSet npad_styleset, |
| 106 | void StopConsoleSixAxisSensor(HLERequestContext& ctx); | 155 | ClientAppletResourceUserId aruid, |
| 107 | void ActivateSevenSixAxisSensor(HLERequestContext& ctx); | 156 | Core::HID::NpadButton button); |
| 108 | void StartSevenSixAxisSensor(HLERequestContext& ctx); | 157 | Result ClearNpadCaptureButtonAssignment(ClientAppletResourceUserId aruid); |
| 109 | void StopSevenSixAxisSensor(HLERequestContext& ctx); | 158 | Result GetVibrationDeviceInfo(Out<Core::HID::VibrationDeviceInfo> out_vibration_device_info, |
| 110 | void InitializeSevenSixAxisSensor(HLERequestContext& ctx); | 159 | Core::HID::VibrationDeviceHandle vibration_device_handle); |
| 111 | void FinalizeSevenSixAxisSensor(HLERequestContext& ctx); | 160 | Result SendVibrationValue(Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 112 | void ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx); | 161 | Core::HID::VibrationValue vibration_value, |
| 113 | void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); | 162 | ClientAppletResourceUserId aruid); |
| 114 | void GetPalmaConnectionHandle(HLERequestContext& ctx); | 163 | Result GetActualVibrationValue(Out<Core::HID::VibrationValue> out_vibration_value, |
| 115 | void InitializePalma(HLERequestContext& ctx); | 164 | Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 116 | void AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx); | 165 | ClientAppletResourceUserId aruid); |
| 117 | void GetPalmaOperationInfo(HLERequestContext& ctx); | 166 | Result CreateActiveVibrationDeviceList(OutInterface<IActiveVibrationDeviceList> out_interface); |
| 118 | void PlayPalmaActivity(HLERequestContext& ctx); | 167 | Result PermitVibration(bool can_vibrate); |
| 119 | void SetPalmaFrModeType(HLERequestContext& ctx); | 168 | Result IsVibrationPermitted(Out<bool> out_is_permitted); |
| 120 | void ReadPalmaStep(HLERequestContext& ctx); | 169 | Result SendVibrationValues( |
| 121 | void EnablePalmaStep(HLERequestContext& ctx); | 170 | ClientAppletResourceUserId aruid, |
| 122 | void ResetPalmaStep(HLERequestContext& ctx); | 171 | InArray<Core::HID::VibrationDeviceHandle, BufferAttr_HipcPointer> vibration_handles, |
| 123 | void ReadPalmaApplicationSection(HLERequestContext& ctx); | 172 | InArray<Core::HID::VibrationValue, BufferAttr_HipcPointer> vibration_values); |
| 124 | void WritePalmaApplicationSection(HLERequestContext& ctx); | 173 | Result SendVibrationGcErmCommand(Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 125 | void ReadPalmaUniqueCode(HLERequestContext& ctx); | 174 | ClientAppletResourceUserId aruid, |
| 126 | void SetPalmaUniqueCodeInvalid(HLERequestContext& ctx); | 175 | Core::HID::VibrationGcErmCommand gc_erm_command); |
| 127 | void WritePalmaActivityEntry(HLERequestContext& ctx); | 176 | Result GetActualVibrationGcErmCommand(Out<Core::HID::VibrationGcErmCommand> out_gc_erm_command, |
| 128 | void WritePalmaRgbLedPatternEntry(HLERequestContext& ctx); | 177 | Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 129 | void WritePalmaWaveEntry(HLERequestContext& ctx); | 178 | ClientAppletResourceUserId aruid); |
| 130 | void SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx); | 179 | Result BeginPermitVibrationSession(ClientAppletResourceUserId aruid); |
| 131 | void GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx); | 180 | Result EndPermitVibrationSession(ClientAppletResourceUserId aruid); |
| 132 | void SuspendPalmaFeature(HLERequestContext& ctx); | 181 | Result IsVibrationDeviceMounted(Out<bool> out_is_mounted, |
| 133 | void GetPalmaOperationResult(HLERequestContext& ctx); | 182 | Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 134 | void ReadPalmaPlayLog(HLERequestContext& ctx); | 183 | ClientAppletResourceUserId aruid); |
| 135 | void ResetPalmaPlayLog(HLERequestContext& ctx); | 184 | Result SendVibrationValueInBool(bool is_vibrating, |
| 136 | void SetIsPalmaAllConnectable(HLERequestContext& ctx); | 185 | Core::HID::VibrationDeviceHandle vibration_device_handle, |
| 137 | void SetIsPalmaPairedConnectable(HLERequestContext& ctx); | 186 | ClientAppletResourceUserId aruid); |
| 138 | void PairPalma(HLERequestContext& ctx); | 187 | Result ActivateConsoleSixAxisSensor(ClientAppletResourceUserId aruid); |
| 139 | void SetPalmaBoostMode(HLERequestContext& ctx); | 188 | Result StartConsoleSixAxisSensor(Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle, |
| 140 | void CancelWritePalmaWaveEntry(HLERequestContext& ctx); | 189 | ClientAppletResourceUserId aruid); |
| 141 | void EnablePalmaBoostMode(HLERequestContext& ctx); | 190 | Result StopConsoleSixAxisSensor(Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle, |
| 142 | void GetPalmaBluetoothAddress(HLERequestContext& ctx); | 191 | ClientAppletResourceUserId aruid); |
| 143 | void SetDisallowedPalmaConnection(HLERequestContext& ctx); | 192 | Result ActivateSevenSixAxisSensor(ClientAppletResourceUserId aruid); |
| 144 | void SetNpadCommunicationMode(HLERequestContext& ctx); | 193 | Result StartSevenSixAxisSensor(ClientAppletResourceUserId aruid); |
| 145 | void GetNpadCommunicationMode(HLERequestContext& ctx); | 194 | Result StopSevenSixAxisSensor(ClientAppletResourceUserId aruid); |
| 146 | void SetTouchScreenConfiguration(HLERequestContext& ctx); | 195 | Result InitializeSevenSixAxisSensor(ClientAppletResourceUserId aruid, u64 t_mem_1_size, |
| 147 | void IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx); | 196 | u64 t_mem_2_size, |
| 148 | void SetTouchScreenResolution(HLERequestContext& ctx); | 197 | InCopyHandle<Kernel::KTransferMemory> t_mem_1, |
| 198 | InCopyHandle<Kernel::KTransferMemory> t_mem_2); | ||
| 199 | Result FinalizeSevenSixAxisSensor(ClientAppletResourceUserId aruid); | ||
| 200 | Result ResetSevenSixAxisSensorTimestamp(ClientAppletResourceUserId aruid); | ||
| 201 | Result IsUsbFullKeyControllerEnabled(Out<bool> out_is_enabled, | ||
| 202 | ClientAppletResourceUserId aruid); | ||
| 203 | Result GetPalmaConnectionHandle(Out<Palma::PalmaConnectionHandle> out_handle, | ||
| 204 | Core::HID::NpadIdType npad_id, | ||
| 205 | ClientAppletResourceUserId aruid); | ||
| 206 | Result InitializePalma(Palma::PalmaConnectionHandle connection_handle); | ||
| 207 | Result AcquirePalmaOperationCompleteEvent(OutCopyHandle<Kernel::KReadableEvent> out_event, | ||
| 208 | Palma::PalmaConnectionHandle connection_handle); | ||
| 209 | Result GetPalmaOperationInfo(Out<Palma::PalmaOperationType> out_operation_type, | ||
| 210 | Palma::PalmaConnectionHandle connection_handle, | ||
| 211 | OutBuffer<BufferAttr_HipcMapAlias> out_data); | ||
| 212 | Result PlayPalmaActivity(Palma::PalmaConnectionHandle connection_handle, u64 palma_activity); | ||
| 213 | Result SetPalmaFrModeType(Palma::PalmaConnectionHandle connection_handle, | ||
| 214 | Palma::PalmaFrModeType fr_mode); | ||
| 215 | Result ReadPalmaStep(Palma::PalmaConnectionHandle connection_handle); | ||
| 216 | Result EnablePalmaStep(bool is_enabled, Palma::PalmaConnectionHandle connection_handle); | ||
| 217 | Result ResetPalmaStep(Palma::PalmaConnectionHandle connection_handle); | ||
| 218 | Result ReadPalmaApplicationSection(Palma::PalmaConnectionHandle connection_handle, u64 offset, | ||
| 219 | u64 size); | ||
| 220 | Result WritePalmaApplicationSection( | ||
| 221 | Palma::PalmaConnectionHandle connection_handle, u64 offset, u64 size, | ||
| 222 | InLargeData<Palma::PalmaApplicationSection, BufferAttr_HipcPointer> data); | ||
| 223 | Result ReadPalmaUniqueCode(Palma::PalmaConnectionHandle connection_handle); | ||
| 224 | Result SetPalmaUniqueCodeInvalid(Palma::PalmaConnectionHandle connection_handle); | ||
| 225 | Result WritePalmaActivityEntry(Palma::PalmaConnectionHandle connection_handle, | ||
| 226 | Palma::PalmaActivityEntry activity_entry); | ||
| 227 | Result WritePalmaRgbLedPatternEntry(Palma::PalmaConnectionHandle connection_handle, u64 unknown, | ||
| 228 | InBuffer<BufferAttr_HipcMapAlias> led_pattern); | ||
| 229 | Result WritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle, | ||
| 230 | Palma::PalmaWaveSet wave_set, u64 unknown, u64 t_mem_size, u64 size, | ||
| 231 | InCopyHandle<Kernel::KTransferMemory> t_mem); | ||
| 232 | Result SetPalmaDataBaseIdentificationVersion(s32 database_id_version, | ||
| 233 | Palma::PalmaConnectionHandle connection_handle); | ||
| 234 | Result GetPalmaDataBaseIdentificationVersion(Palma::PalmaConnectionHandle connection_handle); | ||
| 235 | Result SuspendPalmaFeature(Palma::PalmaFeature feature, | ||
| 236 | Palma::PalmaConnectionHandle connection_handle); | ||
| 237 | Result GetPalmaOperationResult(Palma::PalmaConnectionHandle connection_handle); | ||
| 238 | Result ReadPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle); | ||
| 239 | Result ResetPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle); | ||
| 240 | Result SetIsPalmaAllConnectable(bool is_palma_all_connectable, ClientAppletResourceUserId arui); | ||
| 241 | Result SetIsPalmaPairedConnectable(bool is_palma_paired_connectable, | ||
| 242 | ClientAppletResourceUserId aruid); | ||
| 243 | Result PairPalma(Palma::PalmaConnectionHandle connection_handle); | ||
| 244 | Result SetPalmaBoostMode(bool is_enabled); | ||
| 245 | Result CancelWritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle); | ||
| 246 | Result EnablePalmaBoostMode(bool is_enabled, ClientAppletResourceUserId aruid); | ||
| 247 | Result GetPalmaBluetoothAddress(Out<Palma::Address> out_bt_address, | ||
| 248 | Palma::PalmaConnectionHandle connection_handle); | ||
| 249 | Result SetDisallowedPalmaConnection( | ||
| 250 | ClientAppletResourceUserId aruid, | ||
| 251 | InArray<Palma::Address, BufferAttr_HipcPointer> disallowed_address); | ||
| 252 | Result SetNpadCommunicationMode(ClientAppletResourceUserId aruid, | ||
| 253 | NpadCommunicationMode communication_mode); | ||
| 254 | Result GetNpadCommunicationMode(Out<NpadCommunicationMode> out_communication_mode, | ||
| 255 | ClientAppletResourceUserId aruid); | ||
| 256 | Result SetTouchScreenConfiguration(Core::HID::TouchScreenConfigurationForNx touchscreen_config, | ||
| 257 | ClientAppletResourceUserId aruid); | ||
| 258 | Result IsFirmwareUpdateNeededForNotification(Out<bool> out_is_firmware_update_needed, | ||
| 259 | s32 unknown, ClientAppletResourceUserId aruid); | ||
| 260 | Result SetTouchScreenResolution(u32 width, u32 height, ClientAppletResourceUserId aruid); | ||
| 149 | 261 | ||
| 150 | std::shared_ptr<ResourceManager> resource_manager; | 262 | std::shared_ptr<ResourceManager> resource_manager; |
| 151 | std::shared_ptr<HidFirmwareSettings> firmware_settings; | 263 | std::shared_ptr<HidFirmwareSettings> firmware_settings; |