diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-01-08 09:28:24 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2019-01-17 12:10:50 -0600 |
| commit | 52aa39991ca9964f491ee241f04f31eb6864ae9e (patch) | |
| tree | fa6ca09437cab28e0e53ae0ecf6422116b56fa24 /Source/Core/InputCommon/ControllerInterface/ForceFeedback | |
| parent | 3627ef8a0489765eb10ab29a7988866b52493239 (diff) | |
ControllerInterface: evdev: Cleanup rumble effect processing so effects aren't removed and re-uploaded with every SetState() call. Split the "LeftRight" output into separate "Strong" and "Weak" outputs. Other minor cleanups.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ForceFeedback')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp index 26112015af..baa3018616 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp @@ -13,14 +13,6 @@ namespace ciface { namespace ForceFeedback { -// 100Hz which homebrew docs very roughly imply is within WiiMote normal -// range, used for periodic haptic effects though often ignored by devices -constexpr int RUMBLE_PERIOD = DI_SECONDS / 100; -// This needs to be at least as long as the longest rumble that might ever be played. -// Too short and it's going to stop in the middle of a long effect. -// "INFINITE" is invalid for ramp effects and probably not sensible. -constexpr int RUMBLE_LENGTH_MAX = DI_SECONDS * 10; - // Template instantiation: template class ForceFeedbackDevice::TypedForce<DICONSTANTFORCE>; template class ForceFeedbackDevice::TypedForce<DIRAMPFORCE>; @@ -96,7 +88,7 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i DIEFFECT eff{}; eff.dwSize = sizeof(eff); eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; - eff.dwDuration = RUMBLE_LENGTH_MAX; + eff.dwDuration = DI_SECONDS / 1000 * RUMBLE_LENGTH_MS; eff.dwSamplePeriod = 0; eff.dwGain = DI_FFNOMINALMAX; eff.dwTriggerButton = DIEB_NOTRIGGER; @@ -113,10 +105,9 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i diRF.lStart = diRF.lEnd = 0; DIPERIODIC diPE{}; diPE.dwMagnitude = 0; - // Is it sensible to have a zero-offset? diPE.lOffset = 0; diPE.dwPhase = 0; - diPE.dwPeriod = RUMBLE_PERIOD; + diPE.dwPeriod = DI_SECONDS / 1000 * RUMBLE_PERIOD_MS; for (auto& f : force_type_names) { |
