diff options
| author | 2023-02-21 21:47:47 -0600 | |
|---|---|---|
| committer | 2023-02-21 21:55:23 -0600 | |
| commit | 739a81055f8f33ab0987ee730370a0535a1bdf05 (patch) | |
| tree | 8d7acb47d0b2915112f13aaa9542368cf8c5b8ce /src/core/hid/emulated_controller.cpp | |
| parent | input_common: Implement dedicated motion from mouse (diff) | |
| download | yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.tar.gz yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.tar.xz yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.zip | |
core: hid: Restore motion state on refresh and clamp motion values
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 6d5a3dead..a29c9a6f8 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -363,7 +363,17 @@ void EmulatedController::ReloadInput() { | |||
| 363 | SetMotion(callback, index); | 363 | SetMotion(callback, index); |
| 364 | }, | 364 | }, |
| 365 | }); | 365 | }); |
| 366 | motion_devices[index]->ForceUpdate(); | 366 | |
| 367 | // Restore motion state | ||
| 368 | auto& emulated_motion = controller.motion_values[index].emulated; | ||
| 369 | auto& motion = controller.motion_state[index]; | ||
| 370 | emulated_motion.ResetRotations(); | ||
| 371 | emulated_motion.ResetQuaternion(); | ||
| 372 | motion.accel = emulated_motion.GetAcceleration(); | ||
| 373 | motion.gyro = emulated_motion.GetGyroscope(); | ||
| 374 | motion.rotation = emulated_motion.GetRotations(); | ||
| 375 | motion.orientation = emulated_motion.GetOrientation(); | ||
| 376 | motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity); | ||
| 367 | } | 377 | } |
| 368 | 378 | ||
| 369 | for (std::size_t index = 0; index < camera_devices.size(); ++index) { | 379 | for (std::size_t index = 0; index < camera_devices.size(); ++index) { |