diff options
| author | 2021-11-14 14:09:29 -0600 | |
|---|---|---|
| committer | 2021-11-24 20:30:28 -0600 | |
| commit | 654d76e79e84a3384fa503fac9003a5d0a32f28b (patch) | |
| tree | 7a0d436a55aa73401d7b77bae4870c10ceca16cd /src/core/hid/input_converter.cpp | |
| parent | input_common: Allow keyboard to be backwards compatible (diff) | |
| download | yuzu-654d76e79e84a3384fa503fac9003a5d0a32f28b.tar.gz yuzu-654d76e79e84a3384fa503fac9003a5d0a32f28b.tar.xz yuzu-654d76e79e84a3384fa503fac9003a5d0a32f28b.zip | |
core/hid: Fully implement native mouse
Diffstat (limited to 'src/core/hid/input_converter.cpp')
| -rw-r--r-- | src/core/hid/input_converter.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 480b862fd..c4e653956 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp | |||
| @@ -242,6 +242,27 @@ Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackSta | |||
| 242 | return status; | 242 | return status; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | Common::Input::AnalogStatus TransformToAnalog(const Common::Input::CallbackStatus& callback) { | ||
| 246 | Common::Input::AnalogStatus status{}; | ||
| 247 | |||
| 248 | switch (callback.type) { | ||
| 249 | case Common::Input::InputType::Analog: | ||
| 250 | status.properties = callback.analog_status.properties; | ||
| 251 | status.raw_value = callback.analog_status.raw_value; | ||
| 252 | break; | ||
| 253 | default: | ||
| 254 | LOG_ERROR(Input, "Conversion from type {} to analog not implemented", callback.type); | ||
| 255 | break; | ||
| 256 | } | ||
| 257 | |||
| 258 | SanitizeAnalog(status, false); | ||
| 259 | |||
| 260 | // Adjust if value is inverted | ||
| 261 | status.value = status.properties.inverted ? -status.value : status.value; | ||
| 262 | |||
| 263 | return status; | ||
| 264 | } | ||
| 265 | |||
| 245 | void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value) { | 266 | void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value) { |
| 246 | const auto& properties = analog.properties; | 267 | const auto& properties = analog.properties; |
| 247 | float& raw_value = analog.raw_value; | 268 | float& raw_value = analog.raw_value; |