summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar liamwhite2023-02-25 12:44:13 -0500
committerGravatar GitHub2023-02-25 12:44:13 -0500
commit833afb7ce340030593f5d4fcb3cbd59a19530a7f (patch)
treee6f89696755222f2604cdd1a77b6e62dc32cd724 /src/core/hid/emulated_controller.cpp
parentMerge pull request #9857 from german77/fwupdate (diff)
parentcore: hid: Restore motion state on refresh and clamp motion values (diff)
downloadyuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.gz
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.xz
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.zip
Merge pull request #9848 from german77/metroid_motion
input_common: Implement dedicated motion from mouse
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp12
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) {