Commit f2bdd8d9 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Clamp joystick position values to min-max range.

parent a5d288f0
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment