Bruno Jesus : dinput: Fix calculation of too small periods for periodic effect.
Alexandre Julliard
julliard at winehq.org
Thu Aug 25 10:39:36 CDT 2016
Module: wine
Branch: master
Commit: 7d88a12dc0371eb655f4aeec7bff4985c171311e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d88a12dc0371eb655f4aeec7bff4985c171311e
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Wed Aug 24 22:55:56 2016 -0300
dinput: Fix calculation of too small periods for periodic effect.
Based on ideas by Elias Vanderstuyft.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/effect_linuxinput.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index bbcadf5..0d2fdf5 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -588,19 +588,29 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
if (dwFlags & DIEP_TRIGGERREPEATINTERVAL)
This->effect.trigger.interval = peff->dwTriggerRepeatInterval / 1000;
- if (dwFlags & DIEP_TYPESPECIFICPARAMS) {
- if (!(peff->lpvTypeSpecificParams))
- return DIERR_INCOMPLETEEFFECT;
- if (type == DIEFT_PERIODIC) {
- LPCDIPERIODIC tsp;
+ if (dwFlags & DIEP_TYPESPECIFICPARAMS)
+ {
+ if (!(peff->lpvTypeSpecificParams))
+ return DIERR_INCOMPLETEEFFECT;
+
+ if (type == DIEFT_PERIODIC)
+ {
+ DIPERIODIC *tsp;
if (peff->cbTypeSpecificParams != sizeof(DIPERIODIC))
return DIERR_INVALIDPARAM;
tsp = peff->lpvTypeSpecificParams;
- This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
- This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
- This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
- This->effect.u.periodic.period = tsp->dwPeriod / 1000;
- } else if (type == DIEFT_CONSTANTFORCE) {
+
+ This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
+ This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
+ This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
+ /* dinput uses microseconds, linux uses miliseconds */
+ if (tsp->dwPeriod <= 1000)
+ This->effect.u.periodic.period = 1;
+ else
+ This->effect.u.periodic.period = tsp->dwPeriod / 1000;
+ }
+ else if (type == DIEFT_CONSTANTFORCE)
+ {
LPCDICONSTANTFORCE tsp;
if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
return DIERR_INVALIDPARAM;
More information about the wine-cvs
mailing list