mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
InputCommon: Make Wiimote rumble variable thread safe
This commit is contained in:
@ -82,14 +82,14 @@ using UndetectableSignedAnalogInput = SignedInput<false>;
|
||||
class Motor final : public Core::Device::Output
|
||||
{
|
||||
public:
|
||||
Motor(ControlState* value) : m_value(*value) {}
|
||||
Motor(std::atomic<ControlState>* 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<ControlState>& m_value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -1377,7 +1377,8 @@ void Device::UpdateRumble()
|
||||
{
|
||||
static constexpr auto rumble_period = std::chrono::milliseconds(100);
|
||||
|
||||
const auto on_time = std::chrono::duration_cast<Clock::duration>(rumble_period * m_rumble_level);
|
||||
const auto on_time =
|
||||
std::chrono::duration_cast<Clock::duration>(rumble_period * m_rumble_level.load());
|
||||
const auto off_time = rumble_period - on_time;
|
||||
|
||||
const auto now = Clock::now();
|
||||
|
Reference in New Issue
Block a user