Hi all, after some manual testing I noticed that the joystick structure member dwButtonNumber is not the last button pressed but instead the count of pressed buttons. There is a bit field of buttons set in the structure member dwButton, to fix the number in dwButtonNumber I guess the easiest way is to count the bits set.
I think that keeping a counter with ++/-- operations could lead to out of sync situations if the joystick is not polled fast enough.
Is there any precedent need for this in wine? Is there an accepted solution for it? Internet searching shows different ways like bit counting with shift, using cpu instructions or internal compiler functions.
Best wishes, Bruno
On 23 March 2015 at 15:47, Bruno Jesus 00cpxxx@gmail.com wrote:
Is there any precedent need for this in wine? Is there an accepted solution for it? Internet searching shows different ways like bit counting with shift, using cpu instructions or internal compiler functions.
We have e.g. count_bits() in dlls/wined3d/util.c, but you'll probably want to use __builtin_popcount() on gcc.