From 1b984738ab7cd2031237e9d97f04ce1ff1ad88bb Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Sun, 21 Jan 2024 13:51:50 -0600 Subject: service: hid: Implement EnableAppletForInput --- src/hid_core/resources/npad/npad.cpp | 13 +++++++++++++ src/hid_core/resources/npad/npad.h | 2 ++ 2 files changed, 15 insertions(+) (limited to 'src/hid_core/resources') diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 212f01429..d13a489c9 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -480,6 +480,10 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { continue; } + if (!data->flag.enable_pad_input) { + continue; + } + RequestPadStateUpdate(aruid, controller.device->GetNpadIdType()); auto& pad_state = controller.npad_pad_state; auto& libnx_state = controller.npad_libnx_state; @@ -1316,4 +1320,13 @@ void NPad::UpdateHandheldAbstractState() { abstracted_pads[NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld)].Update(); } +void NPad::EnableAppletToGetInput(u64 aruid) { + std::scoped_lock lock{mutex}; + std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex}; + + for (auto& abstract_pad : abstracted_pads) { + abstract_pad.EnableAppletToGetInput(aruid); + } +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 18b25c688..88289fa2b 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -153,6 +153,8 @@ public: void UpdateHandheldAbstractState(); + void EnableAppletToGetInput(u64 aruid); + private: struct NpadControllerData { NpadInternalState* shared_memory = nullptr; -- cgit v1.2.3