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?
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.