30 Jan
2009
30 Jan
'09
1:58 a.m.
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.