diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-08 02:41:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 02:41:06 +0100 |
commit | 2a4ac7cfac9ebdc916a95dbc576a850162886b13 (patch) | |
tree | 152196b6412c5ef7118810fbceb92804f079d4ba /src/hid_core/resources/npad/npad.cpp | |
parent | Merge pull request #12599 from german77/settings (diff) | |
parent | service: hid: Implement GetLastActiveNpad (diff) | |
download | yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.gz yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.bz2 yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.lz yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.xz yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.zst yuzu-2a4ac7cfac9ebdc916a95dbc576a850162886b13.zip |
Diffstat (limited to 'src/hid_core/resources/npad/npad.cpp')
-rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 97f31d26e..1f8a0f8ab 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -1344,4 +1344,49 @@ AppletDetailedUiType NPad::GetAppletDetailedUiType(Core::HID::NpadIdType npad_id }; } +Result NPad::SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set, + Core::HID::NpadButton button_assignment) { + std::scoped_lock lock{mutex}; + return npad_resource.SetNpadCaptureButtonAssignment(aruid, npad_style_set, button_assignment); +} + +Result NPad::ClearNpadCaptureButtonAssignment(u64 aruid) { + std::scoped_lock lock{mutex}; + return npad_resource.ClearNpadCaptureButtonAssignment(aruid); +} + +std::size_t NPad::GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list, + u64 aruid) const { + std::scoped_lock lock{mutex}; + return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid); +} + +Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) { + std::scoped_lock lock{mutex}; + const auto result = npad_resource.SetNpadSystemExtStateEnabled(aruid, is_enabled); + + if (result.IsSuccess()) { + std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex}; + // TODO: abstracted_pad->EnableAppletToGetInput(aruid); + } + + return result; +} + +Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) { + std::scoped_lock lock{mutex}; + bool is_currently_enabled{}; + Result result = npad_resource.IsAssigningSingleOnSlSrPressEnabled(is_currently_enabled, aruid); + if (result.IsSuccess() && is_enabled != is_currently_enabled) { + result = npad_resource.SetAssigningSingleOnSlSrPress(aruid, is_enabled); + } + return result; +} + +Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const { + std::scoped_lock lock{mutex}; + out_npad_id = hid_core.GetLastActiveController(); + return ResultSuccess; +} + } // namespace Service::HID |