summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar german772021-11-01 19:49:14 -0600
committerGravatar Narr the Reg2021-11-24 20:30:27 -0600
commit136eb9c4c2b2425c2dd45a79cf444dee7170714d (patch)
tree74a055a08126fdd33b2071baa08125177847db6e /src/core/hid/emulated_controller.cpp
parentsecond commit lion review (diff)
downloadyuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.gz
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.xz
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.zip
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 7bab00bb1..2db2b4da0 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::
644 }); 644 });
645 emulated.UpdateRotation(raw_status.delta_timestamp); 645 emulated.UpdateRotation(raw_status.delta_timestamp);
646 emulated.UpdateOrientation(raw_status.delta_timestamp); 646 emulated.UpdateOrientation(raw_status.delta_timestamp);
647 force_update_motion = raw_status.force_update;
647 648
648 if (is_configuring) { 649 if (is_configuring) {
649 TriggerOnChange(ControllerTriggerType::Motion, false); 650 TriggerOnChange(ControllerTriggerType::Motion, false);
@@ -653,7 +654,7 @@ void EmulatedController::SetMotion(Common::Input::CallbackStatus callback, std::
653 auto& motion = controller.motion_state[index]; 654 auto& motion = controller.motion_state[index];
654 motion.accel = emulated.GetAcceleration(); 655 motion.accel = emulated.GetAcceleration();
655 motion.gyro = emulated.GetGyroscope(); 656 motion.gyro = emulated.GetGyroscope();
656 motion.rotation = emulated.GetGyroscope(); 657 motion.rotation = emulated.GetRotations();
657 motion.orientation = emulated.GetOrientation(); 658 motion.orientation = emulated.GetOrientation();
658 motion.is_at_rest = emulated.IsMoving(motion_sensitivity); 659 motion.is_at_rest = emulated.IsMoving(motion_sensitivity);
659 660
@@ -962,6 +963,14 @@ NpadGcTriggerState EmulatedController::GetTriggers() const {
962} 963}
963 964
964MotionState EmulatedController::GetMotions() const { 965MotionState EmulatedController::GetMotions() const {
966 if (force_update_motion) {
967 for (auto& device : motion_devices) {
968 if (!device) {
969 continue;
970 }
971 device->ForceUpdate();
972 }
973 }
965 return controller.motion_state; 974 return controller.motion_state;
966} 975}
967 976