DInput axis mapping explanation

Aric Stewart aric at codeweavers.com
Mon Jun 15 12:16:24 CDT 2015

On 6/11/15 7:32 PM, Michael Gardner wrote:
> Please forgive me if this is the wrong list or a stupid question, but I already tried wine-users and the WineHQ forums and no one could answer. I'm trying to understand Wine's DirectInput axis mapping feature (registry key HKEY_CURRENT_USER\Software\Wine\DirectInput). The documentation at http://wiki.winehq.org/UsefulRegistryKeys gives some details but seems to assume you already know how the feature works. (You could also consider this an RFE for better DInput axis mapping docs, which I'd be happy to write if I can first understand the feature.)
> I understand that I can make a registry key with the same name as my joystick device and a value that's a comma-separated list of axes, which will act as some kind of mapping. But how does this mapping work? What is being mapped to what, exactly? The docs give an example mapping without explaining what it does, or how you'd arrive at that mapping given whatever result you're looking for.
> I've also read https://forum.winehq.org/viewtopic.php?t=14899, but it also doesn't explain how these mappings work in the abstract.
> Once again, my apologies if this is the wrong place, but if there's anyone who might have the knowledge I'm looking for then it would be the Wine devs.

I can try here as I have been doing work in dinput recently, though not in that direct area. This registry key is really only important for Linux users. The mac presently determines the axis map itself internally. 

What this appears to do is be defining the axis map for the device.  When we get a report from the device we get a bunch of values, but we do not (currently) know immediately which value corresponds to which axis.

We guess the following: "X", "Y", "Z", "Rx", "Ry", "Rz", "Slider1", "Slider2", "POV1", "POV2", "POV3", "POV4"
(note that POV controls count as 2 axis)

But if your controller does not have that order, or maybe has POV1 but no slider, then you will find that your controller does not behave as you expect or hope, So you need to make a custom axis map for your device to represent what controls are present and in which order the values for the controls are being presented.

Now, that being said, I am doing HID work, that will eventually replace all the underlying structure for dinput and such and it will know that axis map properly so this configuration will stop being necessary.  However for now, that is what is going on.


More information about the wine-devel mailing list