Vitaliy Margolen : dinput: Clamp joystick position values to min-max range.
Alexandre Julliard
julliard at winehq.org
Tue May 13 14:10:33 CDT 2008
Module: wine
Branch: master
Commit: f2bdd8d96c5b0f3cf1f12568677d2ff57e7e6c31
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f2bdd8d96c5b0f3cf1f12568677d2ff57e7e6c31
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Tue May 13 07:33:31 2008 -0600
dinput: Clamp joystick position values to min-max range.
---
dlls/dinput/joystick_linuxinput.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 50befd9..13bc1fb 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -110,6 +110,10 @@ LONG joystick_map_axis(ObjProps *props, int val)
ret = MulDiv( val, props->lMax - props->lMin, dev_range ) +
(props->lMin + props->lMax) / 2;
+ /* Clamp in case or rounding errors */
+ if (ret > props->lMax) ret = props->lMax;
+ else if (ret < props->lMin) ret = props->lMin;
+
TRACE( "(%d <%d> %d) -> (%d <%d> %d): val=%d ret=%d\n",
props->lDevMin, dead_zone, props->lDevMax,
props->lMin, props->lDeadZone, props->lMax,
More information about the wine-cvs
mailing list