This project is read-only.

Strange mapping of DirectInput gamepad buttons

Nov 6, 2011 at 8:07 PM

Hello, I'm trying to use Nuclex.Input to add PC gamepad support to my XNA game.  An issue I'm encountering is that my pad's Start button is being mapped to the RightStick value in the GamePadState object Nuclex is returning, while the Select button is coming in as the LeftStick value.  Is this by design for some reason, or am I doing something wrong?  Thanks in advance for your help.

Nov 6, 2011 at 9:12 PM

In XINPUT, the buttons are clearly spelled out (see XINPUT_GAMEPAD), but with DirectInput, I have nothing to work with: it's just an array of 128 buttons in whatever order the manufacturer felt like using.

What I did was map the DirectInput buttons to XNA in the order my Xbox 360 controller reports them (if accessed via DirectInput), in the hope that this ordering might be something of an undocumented standard, but there are a whole lot of game pads where it doesn't match.

There's a GetExtendedState() method you can use to obtain the entire DirectInput state with the buttons as an array, that makes it slightly easier to provide custom button mapping functionality to the user, but that's all I can offer...

Nov 6, 2011 at 9:39 PM

Okay, thanks for your informative reply.  It helps to know what my options are.

Thanks also for creating the library in the first place!  It is a big time saver for me.