diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-22 01:15:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 01:15:53 +0100 |
commit | 57ff934f0d356fda9a5c381eee6032500e24dcf8 (patch) | |
tree | 4e021ddda3f833ad155e367f3f9e00d3732669ae /src | |
parent | Merge pull request #12735 from german77/disable-vibration (diff) | |
parent | service: hid: Implement EnableAppletForInput (diff) | |
download | yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar.gz yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar.bz2 yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar.lz yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar.xz yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.tar.zst yuzu-57ff934f0d356fda9a5c381eee6032500e24dcf8.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/hid/hid_system_server.cpp | 4 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 13 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.h | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 4466a189b..bf27ddfbf 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -533,7 +533,7 @@ void IHidSystemServer::EnableAppletToGetInput(HLERequestContext& ctx) { parameters.is_enabled, parameters.applet_resource_user_id); GetResourceManager()->EnableInput(parameters.applet_resource_user_id, parameters.is_enabled); - // GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); + GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -596,7 +596,7 @@ void IHidSystemServer::EnableAppletToGetPadInput(HLERequestContext& ctx) { parameters.is_enabled, parameters.applet_resource_user_id); GetResourceManager()->EnablePadInput(parameters.applet_resource_user_id, parameters.is_enabled); - // GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); + GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); 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; |