[PATCH] Fix Bug in DeadZone calculation

Kuba Ober kuba at mareimbrium.org
Wed Aug 15 08:24:30 CDT 2007


> >> Artur Szymiec wrote:
> >>> Here is attached patch
> >>> for joystick_linuxinput.c where bug in dead zone
> >>> calculation make joystick unusable. After correction
> >>> tested in two games and works properly.

> >> Thanks for spotting the problem. Unfortunately your patch has few
> >> problems too. I'll sending a better patch.

> > What kind of problems do you mean ?

> You calculating center wrong:
> > +	ret = (props->lMax-props->lMin)/2;
>
> This won't work for min=1000 max=2000.

But it does. Maybe you meant if min/max were switched? In such case

ret = (props->lMax-props->lMin)/2;
if (props->lMax < props->lMin) ret = -ret;

Cheers, Kuba



More information about the wine-devel mailing list