diff options
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index ecab85893..c7f0af71f 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -979,7 +979,6 @@ void EmulatedController::SetMotion(const Common::Input::CallbackStatus& callback | |||
| 979 | emulated.SetUserGyroThreshold(raw_status.gyro.x.properties.threshold); | 979 | emulated.SetUserGyroThreshold(raw_status.gyro.x.properties.threshold); |
| 980 | emulated.UpdateRotation(raw_status.delta_timestamp); | 980 | emulated.UpdateRotation(raw_status.delta_timestamp); |
| 981 | emulated.UpdateOrientation(raw_status.delta_timestamp); | 981 | emulated.UpdateOrientation(raw_status.delta_timestamp); |
| 982 | force_update_motion = raw_status.force_update; | ||
| 983 | 982 | ||
| 984 | auto& motion = controller.motion_state[index]; | 983 | auto& motion = controller.motion_state[index]; |
| 985 | motion.accel = emulated.GetAcceleration(); | 984 | motion.accel = emulated.GetAcceleration(); |
| @@ -1618,19 +1617,6 @@ NpadGcTriggerState EmulatedController::GetTriggers() const { | |||
| 1618 | 1617 | ||
| 1619 | MotionState EmulatedController::GetMotions() const { | 1618 | MotionState EmulatedController::GetMotions() const { |
| 1620 | std::unique_lock lock{mutex}; | 1619 | std::unique_lock lock{mutex}; |
| 1621 | |||
| 1622 | // Some drivers like mouse motion need constant refreshing | ||
| 1623 | if (force_update_motion) { | ||
| 1624 | for (auto& device : motion_devices) { | ||
| 1625 | if (!device) { | ||
| 1626 | continue; | ||
| 1627 | } | ||
| 1628 | lock.unlock(); | ||
| 1629 | device->ForceUpdate(); | ||
| 1630 | lock.lock(); | ||
| 1631 | } | ||
| 1632 | } | ||
| 1633 | |||
| 1634 | return controller.motion_state; | 1620 | return controller.motion_state; |
| 1635 | } | 1621 | } |
| 1636 | 1622 | ||
| @@ -1696,8 +1682,21 @@ void EmulatedController::DeleteCallback(int key) { | |||
| 1696 | callback_list.erase(iterator); | 1682 | callback_list.erase(iterator); |
| 1697 | } | 1683 | } |
| 1698 | 1684 | ||
| 1699 | void EmulatedController::TurboButtonUpdate() { | 1685 | void EmulatedController::StatusUpdate() { |
| 1700 | turbo_button_state = (turbo_button_state + 1) % (TURBO_BUTTON_DELAY * 2); | 1686 | turbo_button_state = (turbo_button_state + 1) % (TURBO_BUTTON_DELAY * 2); |
| 1687 | |||
| 1688 | // Some drivers like key motion need constant refreshing | ||
| 1689 | for (std::size_t index = 0; index < motion_devices.size(); ++index) { | ||
| 1690 | const auto& raw_status = controller.motion_values[index].raw_status; | ||
| 1691 | auto& device = motion_devices[index]; | ||
| 1692 | if (!raw_status.force_update) { | ||
| 1693 | continue; | ||
| 1694 | } | ||
| 1695 | if (!device) { | ||
| 1696 | continue; | ||
| 1697 | } | ||
| 1698 | device->ForceUpdate(); | ||
| 1699 | } | ||
| 1701 | } | 1700 | } |
| 1702 | 1701 | ||
| 1703 | NpadButton EmulatedController::GetTurboButtonMask() const { | 1702 | NpadButton EmulatedController::GetTurboButtonMask() const { |