[PATCH 1/2] dinput: Fix phase conversion on periodic effects

Bruno Jesus 00cpxxx at gmail.com
Wed Sep 14 00:25:32 CDT 2016


Based on idea by Elias Vanderstuyft.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
---
 dlls/dinput/effect_linuxinput.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index 9205c9c..bb45792 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -632,7 +632,8 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
 
             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) */
+            /* phase ranges from 0 - 35999 in dinput and 0 - 65535 on linux */
+            This->effect.u.periodic.phase = (tsp->dwPhase / 36) * 65;
             /* dinput uses microseconds, linux uses miliseconds */
             if (tsp->dwPeriod <= 1000)
                 This->effect.u.periodic.period = 1;
-- 
2.9.3




More information about the wine-patches mailing list