diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index 11bb84e3b0..8d65b3fe28 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -16,8 +16,6 @@ #include "Core/KeyMap.h" #include "Core/HLE/sceCtrl.h" -static double newVibrationTime = 0.0; - // Utilities to dynamically load XInput. Adapted from SDL. #if !PPSSPP_PLATFORM(UWP) @@ -258,11 +256,11 @@ void XinputDevice::ApplyButtons(int pad, const XINPUT_STATE &state) { void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { if (PSP_IsInited()) { - newVibrationTime = time_now_d(); + newVibrationTime_ = time_now_d(); // We have to run PPSSPP_XInputSetState at time intervals // since it bugs otherwise with very high fast-forward speeds // and freezes at constant vibration or no vibration at all. - if (newVibrationTime - prevVibrationTime >= 1.0 / 64.0) { + if (newVibrationTime_ - prevVibrationTime >= 1.0 / 64.0) { if (GetUIState() == UISTATE_INGAME) { vibration.wLeftMotorSpeed = sceCtrlGetLeftVibration(); // use any value between 0-65535 here vibration.wRightMotorSpeed = sceCtrlGetRightVibration(); // use any value between 0-65535 here @@ -275,7 +273,7 @@ void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { PPSSPP_XInputSetState(pad, &vibration); prevVibration[pad] = vibration; } - prevVibrationTime = newVibrationTime; + prevVibrationTime = newVibrationTime_; } } else { DWORD dwResult = PPSSPP_XInputSetState(pad, &vibration); @@ -284,4 +282,3 @@ void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { } } } - diff --git a/Windows/XinputDevice.h b/Windows/XinputDevice.h index 858e3fc3ed..af8f43c4fc 100644 --- a/Windows/XinputDevice.h +++ b/Windows/XinputDevice.h @@ -21,4 +21,5 @@ private: float prevAxisValue_[4][6]{}; bool notified_[XUSER_MAX_COUNT]{}; u32 prevButtons_[4]{}; + double newVibrationTime_ = 0.0; };