diff options
author | german77 <juangerman-13@hotmail.com> | 2021-11-16 00:57:41 +0100 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-01-07 04:26:05 +0100 |
commit | 72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6 (patch) | |
tree | 1be3b99cfa76a7e7c360fa467d8ea6de69a29dc8 /src/core/hid | |
parent | core/hid: Add home and screenshot button support (diff) | |
download | yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar.gz yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar.bz2 yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar.lz yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar.xz yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.tar.zst yuzu-72c8a94a6cdb4d3f322fa6d4b06eab824f53dba6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hid/emulated_controller.cpp | 19 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.h | 10 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 9f68a41cc..6209c707e 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -351,6 +351,19 @@ void EmulatedController::DisableConfiguration() { } } +void EmulatedController::EnableSystemButtons() { + system_buttons_enabled = true; +} + +void EmulatedController::DisableSystemButtons() { + system_buttons_enabled = false; +} + +void EmulatedController::ResetSystemButtons() { + controller.home_button_state.home.Assign(false); + controller.capture_button_state.capture.Assign(false); +} + bool EmulatedController::IsConfiguring() const { return is_configuring; } @@ -596,9 +609,15 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback controller.npad_button_state.right_sr.Assign(current_status.value); break; case Settings::NativeButton::Home: + if (!system_buttons_enabled) { + break; + } controller.home_button_state.home.Assign(current_status.value); break; case Settings::NativeButton::Screenshot: + if (!system_buttons_enabled) { + break; + } controller.capture_button_state.capture.Assign(current_status.value); break; } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index bee16a8ed..a63a83cce 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -200,6 +200,15 @@ public: /// Returns the emulated controller into normal mode, allowing the modification of the HID state void DisableConfiguration(); + /// Enables Home and Screenshot buttons + void EnableSystemButtons(); + + /// Disables Home and Screenshot buttons + void DisableSystemButtons(); + + /// Sets Home and Screenshot buttons to false + void ResetSystemButtons(); + /// Returns true if the emulated controller is in configuring mode bool IsConfiguring() const; @@ -391,6 +400,7 @@ private: NpadStyleTag supported_style_tag{NpadStyleSet::All}; bool is_connected{false}; bool is_configuring{false}; + bool system_buttons_enabled{true}; f32 motion_sensitivity{0.01f}; bool force_update_motion{false}; |