Joystick patches to Wine[X]


News : My patches have been accepted into the main WineX CVS as of 7/12/02

I've found that the dinput joystick support in wine[x] doesn't seem to work with Aces High.

There were a few problems, and one annoyance -- there was no POV hat support.
I've put together a patch for wine which helps it work with AH, and has POV support for some joysticks.
(See below for the gory details of the patch)

If you use the new LinuxInput device (aka the evdev module) all joysticks with POV hats should work.

This is the supported joystick list if you are using the joydev module :
If you have another joystick, and would like support, what I need is the exact name reported by the driver, the number of axes (including the rudder) and the number of POV hats on it. Email me, and I'll add support for your joystick!

The patch is now for both the legacy joystick drivers (module joydev) and for the new input-core drivers (evdev). The new drivers work for all joysticks because they support POV hats explicitly. The legacy drivers make them appear as regular axis, and thus require that we know the exact joystick we're dealing with.

The patch can be found here.

You should place it in the directory above the one where you  the WineX source, and the one with the wine source should be called (or symlinked to by) wine.  Then you do :
$ patch -p0 < joypov2.patch
Now you can recompile / reinstall wine by :
$ make depend && make && make install
Good luck! Let me know if you run into problems, or if you don't :)



Here are the gory details of how it all works (taken from my post to wienx-devel)

I've been hacking away at joystick POV hat support for winex.
Unfortunately Linux reports POV hats as regular axes, but I've found
that SDL provides support by keeping a list of joystick names and
information about them -- how many axes, POV hats, and trackballs so you
can map an axis to a POV or to a regular axis.
I've taken this idea and the joystick definitions from SDL code. (+
added the def for my joystick :) )
(I didn't actually take any code other than the joystick list, since SDL
is under LGPL, and winex is under a more restrictive license I think..
anyway..)
I've patched the appropriate functions (joy_polldev, GetCapabilites,
EnumObjects) to handle POV hats.

Also, there are bugfixes :

- Set the default range to 0 to 65535 (which is Windows defaults)
instead of the -32768 to +32767 (linux defaults)

- Fix appropriate functions to return DIERR_NOTACQUIRED when the device
is not acquired.
This is because some games have loops that do something like :
while () {
Poll Joystick
if (DIERR_NOTACQUIRED) {
acquire;
continue;
}
}

- Made the EnumObjects code call GetCapabilities so code isn't
duplicated

- Made the map_axis #define be optimized for the default case
(no need to scale in this case, just add 32768)

What I did NOT do :

I have to do all this for the linuxinput.c file.
(Or maybe just roll both of those into one? Is there are reason they are
separate?)

I did not implement support for the "analog POV hat" that SDL has -- but
this is only for one particular joystick "Wingman Extreme Analog", and
its commented out in the SDL code anyway, and since I don't have that
joystick and can't test it, I decided not to implement that yet.
And the next patch which added the linuxinput support :
 
Hi all,

Finally found the time to complete my joystick POV patch.
Now both linux.c and linuxinput.c support POV hats, as well as a bunch
of bugfixes in linuxinput.c .
(Looks like that code wasn't excercised a lot :) )
POV support for linuxinput (ie. /dev/input/eventX devices) was much
easier to implement because the API actually supports POV hats, so the
code is much cleaner and smaller.
There were also a number of bugfixes, including :
* made the center for map_position be the actual center of the range, not 0
* put in DIERR_NOTACQUIRED returns where needed
* the iterator for looking at keys pressed was too small (BYTE) and
wrapped causing a hang (KEY_MAX is bigger than 255!)
* EnumObjects was not supposed to return DIERR_NOTACQUIRED -- it should
not care

The only change to the legacy joystick (linux.c) driver was to remove
the joystick description for analog joysticks -- I have to get one to
write support for it :)

Well, I hope this patch is submittable now :)

Patch attached, comments / questions welcome.

--Lev Iserovich



Contact me : [email protected]


(c) 2002 Lev Iserovich
I'm in no way affiliated with Aces High, HiTech Creations, Transgaming Technologies, or any other company or entity mentioned here.