dinput: Move gain support from effect to device

Vitaliy Margolen wine-devel at kievinfo.com
Thu Jan 29 19:58:34 CST 2009


Vincent Pelletier wrote:
> Hi.
> 
> Windows supports setting force feedback effect gain at 2 levels:
> - device
> - effect
> There is support for the former on Linux, but not for the latter.
> 
> 
> +	DWORD				ff_gain;
>  };
...
> +      This->ff_gain = max(0, (int) pd->dwData);
First why do you typecase DWORD to (int) to assign to DWORD? Second DWORD
will always be > 0. If you want to check it against limit then just check it
being <= 10000 otherwise return error.

> +      if (This->joyfd != -1) {
You should be checking This->base.acquired instead of fd.

> +        event.value = This->ff_gain * 0xFFFF / 10000;
You should use MulDiv instead because this can be optimized out by compiler
into something that won't be as accurate.

Vitaliy.



More information about the wine-devel mailing list