diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp index d68b0441a6..82e2cfedda 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp @@ -82,14 +82,14 @@ using UndetectableSignedAnalogInput = SignedInput; class Motor final : public Core::Device::Output { public: - Motor(ControlState* value) : m_value(*value) {} + Motor(std::atomic* value) : m_value(*value) {} std::string GetName() const override { return "Motor"; } void SetState(ControlState state) override { m_value = state; } private: - ControlState& m_value; + std::atomic& m_value; }; template @@ -1377,7 +1377,8 @@ void Device::UpdateRumble() { static constexpr auto rumble_period = std::chrono::milliseconds(100); - const auto on_time = std::chrono::duration_cast(rumble_period * m_rumble_level); + const auto on_time = + std::chrono::duration_cast(rumble_period * m_rumble_level.load()); const auto off_time = rumble_period - on_time; const auto now = Clock::now(); diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.h b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.h index b6c96d0238..4d93584a67 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.h +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include #include @@ -262,7 +263,7 @@ private: bool m_rumble = false; // For pulse of rumble motor to simulate multiple levels. - ControlState m_rumble_level = 0; + std::atomic m_rumble_level; Clock::time_point m_last_rumble_change = Clock::now(); // Assume mode is disabled so one gets set.