aboutsummaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-01 19:49:14 -0600
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-24 20:30:27 -0600
commit136eb9c4c2b2425c2dd45a79cf444dee7170714d (patch)
tree74a055a08126fdd33b2071baa08125177847db6e /src/core/hid/emulated_controller.cpp
parent77fa4d4bf60526826ef8b53ee3870f7d2a761976 (diff)
core/hid: Fully emulate motion from button
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 7bab00bb1b..2db2b4da09 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -644,6 +644,7 @@ void EmulatedController::SetMotion(Common::Input::CallbackStatus callback, std::
});
emulated.UpdateRotation(raw_status.delta_timestamp);
emulated.UpdateOrientation(raw_status.delta_timestamp);
+ force_update_motion = raw_status.force_update;
if (is_configuring) {
TriggerOnChange(ControllerTriggerType::Motion, false);
@@ -653,7 +654,7 @@ void EmulatedController::SetMotion(Common::Input::CallbackStatus callback, std::
auto& motion = controller.motion_state[index];
motion.accel = emulated.GetAcceleration();
motion.gyro = emulated.GetGyroscope();
- motion.rotation = emulated.GetGyroscope();
+ motion.rotation = emulated.GetRotations();
motion.orientation = emulated.GetOrientation();
motion.is_at_rest = emulated.IsMoving(motion_sensitivity);
@@ -962,6 +963,14 @@ NpadGcTriggerState EmulatedController::GetTriggers() const {
}
MotionState EmulatedController::GetMotions() const {
+ if (force_update_motion) {
+ for (auto& device : motion_devices) {
+ if (!device) {
+ continue;
+ }
+ device->ForceUpdate();
+ }
+ }
return controller.motion_state;
}