winejoystick.drv: Add axis remapping support

Adolfo R. Brandes arbrandes at
Wed Feb 27 13:54:26 CST 2008

Hi there,

On Wed, Feb 27, 2008 at 3:44 PM, Vitaliy Margolen
<wine-devel at> wrote:
>  Don't do that. Keep it uniform. As-is it's a pain to configure. You want to
>  introduce even more?

 Actually, this was my shot at improving that particular aspect of
the configuration.  As it is in dinput/joystick_linux.c, it's a bit of
a shot in the dark as to what is "Slider1", "Slider2", and so on.  The
way I did it, you can run jstest to find out what each of your axes
are named, and use those names in regedit.

 I realize this introduces confusion.  It's just that I think the
previous standard requires a bit of a revision, in that there should
be a more reliable way of determining what each axis in your joystick
is called (and what wine expects it to be called).  Maybe
joystick_linux should be patched too?

>  do not mix tabs and spaces!

 Sorry about that, you're right.  I'm used to using tabs, and have
just found out the hard way that wine uses 4 spaces. ;)

>  The way you using this function it makes much more sense to return static
>  text ex:
>  static const char *axis_name(unsigned char type)

 Good idea, it really does make much more sense.

>  BTW what will that "?" do? I don't see you comparing it against anything.

 The "?"s represent gaps in the ABS_* series of constants in
linux/input.h, which is the basis for the naming scheme I followed
(and jstest also follows, which is the whole point).  The premise is
that all axes will always be properly identified by linux as one of
those constants.  The "?" is just a way of failing on purpose, i.e.,
when an axis is not properly named.

>  Disabling axis might not be a bad thing, especially for testing. I don't
>  think you need to worry about extra axis on the device that are not mapped
>  to anything.

 I was worried about having two (or more) linux axes mapped to the
same wine one.  That's the reason behind the fatal error.

>  You need both X and Y axis for [a POV] to work. You have to check that both are
>  present.

 You're right, I better improve the logic here, too.

> Also what about multiple POVs? Here you checking for only one.

 It seems that the only pertinent JOYINFOEX constants from mmsystem.h
"JOY_RETURNPOV2". I'm assuming that more hats simply won't register.
Bear with me, everything I know about the Windows joystick API has
been gathered from reading this driver, and it seems like there's a
fundamental difference between DirectInput devices and "regular" ones.
 Correct me if I'm wrong, but it looks to me like multiple POVs (or
more than 6 axes) aren't supported here.

 However, it makes sense for the user to map HAT2X and HAT2Y to the
"u" and "v" axes, for example.  I'll see what I can do.

>  Now that you can remap axis it's not guaranteed that 6th axes is the speed
>  and so on.

 Yes, that's correct.  I previously tried a different approach,
basing the selection of x, y, z, r, u, and v on what the axis is
actually named (i.e., "Throttle" = z, "Rudder" = r), but that actually
moots the whole point.  It turns out that it doesn't matter what the
axis' nominal function is; what matters is the order in which they
appear.  For instance, my joystick's rudder is actually named "Rz",
which would wrongly map to "v" (as opposed to "r").  What's important
is not for wine to know the difference between "Throttle" and
"Rudder", but for the user to know what each axis is named and in what
order they are presented to the application, so that he can then
reoder them as he pleases.

 I'm gonna work on a better version of the patch, and thanks for the tips!


More information about the wine-devel mailing list