summaryrefslogtreecommitdiffstats
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-02-25 18:44:13 +0100
committerGitHub <noreply@github.com>2023-02-25 18:44:13 +0100
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
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.gz
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.bz2
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.lz
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.xz
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.tar.zst
yuzu-833afb7ce340030593f5d4fcb3cbd59a19530a7f.zip
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() {
SetMotion(callback, index);
},
});
- motion_devices[index]->ForceUpdate();
+
+ // Restore motion state
+ auto& emulated_motion = controller.motion_values[index].emulated;
+ auto& motion = controller.motion_state[index];
+ emulated_motion.ResetRotations();
+ emulated_motion.ResetQuaternion();
+ motion.accel = emulated_motion.GetAcceleration();
+ motion.gyro = emulated_motion.GetGyroscope();
+ motion.rotation = emulated_motion.GetRotations();
+ motion.orientation = emulated_motion.GetOrientation();
+ motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
}
for (std::size_t index = 0; index < camera_devices.size(); ++index) {