using XInput, is it possible to get an image of the controller?

561 views Asked by At

In my simple mind, it seems useful to ship a nice image of your joystick with an index of the button and axis locations on the image. Can such a thing be queried through the XInput or DirectInput APIs? Would it be driver-specific, and if so which drivers support this?

In particular, I want to support Logitech wheels and XBOX 360 controllers. The Logitech Profiler seems to come with this information (or pull it from the driver). Is it accessible in my code as well?

I see the image of the joystick show up in the game controller properties, but I assume that entire property page is reported from the driver?

2

There are 2 answers

1
JHagdahl On

XInput does not supply this and it is not supposed to, XInput is an interface for accessing the state of the controller and the capabilities of the controller. This is something that you would detect manually in your code, finding the correct device id and I believe this is what the Logitech Profiler does as well (since it is a custom application for Logitech), it simply has the images as resources in the program itself.

What is commonly done is that you contact Microsoft, Sony, Nintendo or Logitech and they will have high quality images of their controllers that are approved for use in games. Specifically for images of the controller in console games there are certain requirements that you need to follow. The same requirements do not follow for games for windows and other operating systems but you should still be able to retrieve this information from Microsoft and Logitech.

By retrieving the resources yourself you can also convert them to a format that suits the interface where you are presenting them.

0
Eglin On

Since the Windows XInput API was created specifically for the XBox 360 controller, it's possible to make a great deal of assumptions about the controller layout. Even now, after the release of official drivers for the XBOne gamepad, the official API documents go out of their way to explicitly limit discussion to the 360 pads.