diff options
| author | 2021-10-24 20:28:54 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:26 -0600 | |
| commit | c6c32daf40ae1c720f0a2897c538bb1117371ea5 (patch) | |
| tree | 26879cbeb2162e706086818ad501a8f2730206d5 /src/input_common/helpers | |
| parent | service/hid: Fix memory allocated incorrectly (diff) | |
| download | yuzu-c6c32daf40ae1c720f0a2897c538bb1117371ea5.tar.gz yuzu-c6c32daf40ae1c720f0a2897c538bb1117371ea5.tar.xz yuzu-c6c32daf40ae1c720f0a2897c538bb1117371ea5.zip | |
input_common: Add manual update options to input devices
Diffstat (limited to 'src/input_common/helpers')
| -rw-r--r-- | src/input_common/helpers/stick_from_buttons.cpp | 16 | ||||
| -rw-r--r-- | src/input_common/helpers/touch_from_buttons.cpp | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp index 38f150746..9101f11ce 100644 --- a/src/input_common/helpers/stick_from_buttons.cpp +++ b/src/input_common/helpers/stick_from_buttons.cpp | |||
| @@ -200,6 +200,22 @@ public: | |||
| 200 | TriggerOnChange(status); | 200 | TriggerOnChange(status); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | void ForceUpdate() override{ | ||
| 204 | up->ForceUpdate(); | ||
| 205 | down->ForceUpdate(); | ||
| 206 | left->ForceUpdate(); | ||
| 207 | right->ForceUpdate(); | ||
| 208 | modifier->ForceUpdate(); | ||
| 209 | } | ||
| 210 | |||
| 211 | void SoftUpdate() override { | ||
| 212 | Input::CallbackStatus status{ | ||
| 213 | .type = Input::InputType::Stick, | ||
| 214 | .stick_status = GetStatus(), | ||
| 215 | }; | ||
| 216 | TriggerOnChange(status); | ||
| 217 | } | ||
| 218 | |||
| 203 | Input::StickStatus GetStatus() const { | 219 | Input::StickStatus GetStatus() const { |
| 204 | Input::StickStatus status{}; | 220 | Input::StickStatus status{}; |
| 205 | status.x.properties = properties; | 221 | status.x.properties = properties; |
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp index 2abfaf841..bb2bad5b1 100644 --- a/src/input_common/helpers/touch_from_buttons.cpp +++ b/src/input_common/helpers/touch_from_buttons.cpp | |||
| @@ -17,6 +17,7 @@ public: | |||
| 17 | Input::InputCallback button_up_callback{ | 17 | Input::InputCallback button_up_callback{ |
| 18 | [this](Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; | 18 | [this](Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; |
| 19 | button->SetCallback(button_up_callback); | 19 | button->SetCallback(button_up_callback); |
| 20 | button->ForceUpdate(); | ||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | Input::TouchStatus GetStatus(bool pressed) const { | 23 | Input::TouchStatus GetStatus(bool pressed) const { |