Is DirectInput capable of telling WHICH axes are present on a stick?

566 Views Asked by At

I am currently writing a .Net DirectInput wrapper DLL to allow event-based reporting of stick input from other languages (I am using AutoHotkey).
I currently use SharpDX to read stick data, but SharpDX only seems to report how many axes a stick reports, not which axes a stick reports.
For example, it is entirely possible for a stick to have 7 axes, but no X axis (You can see this by installing vJoy and configuring which axes it has - in the vJoy configuration utility, untick the X axis. Notice in joy.cpl that the X axis is gone).
Reading the stick caps via SharpDX (Using eg SharpDX.DirectInput.Joystick.Capabilities.AxeCount), there seems to be no way to tell that the missing axis is X.
Is the underlying DirectInput API able to represent this info, or would I have to go to something like RawInput to get at this info?

1

There are 1 best solutions below

1
Clive Galway On BEST ANSWER

So I worked this one out for myself.

Using SharpDX, you can use Joystick.GetObjectPropertiesByName("X") where "X" is the name of an axis. You can call ToString() on a JoystickOffset to get the name of the axis.
If you do this in a try block, then if it hits the catch, that axis does not exist on that stick.