Xbox 360 Controller: D-Pad and Vibration

I got jinput working with my xbox360 controller and I am really impressed so far (aside from the lack of API and any commenting lol), but I have two questions:

How do I access the D-Pad values, and is it possible to vibrate the controller (if not through jinput then by some other means, as long as it’s not too complicated).

There are other posts on this forum asking similar questions.

There are some features that are only exposed using xinput, yet another input API from microsoft to add to the (at least) 2 they already had. As I only know of the 360 controller using it, it’s not something that has had much attention.

Feel free to write the plugin for JInput to get those last 2 bits on the controller working :slight_smile:

Endolf

Ah sorry I searched for “D-Pad” and “Vibrate” and came up with nothing relevant.

Aw man that sucks, gah maybe I should just switch over to C# & XNA.

Oh noes! He’s gonna switch! Quick Endolf, code it up!

Kev

Hi

You seem to have a very niche market. There are not a huge number of people with 360 controllers connected to Java games. If supporting those 2 features for that small number of people is that important to you, maybe switching is worth it. I’ve yet to see it being that important, which is why I’ve neither changed techs, or implemented the plugin.

Endolf

Which, rather frustratingly, supports all the 360’s functionality, but very little of any other controller. Frankly I think MS really screwed up with XInput by fragmenting the controller support. The presense of XBCD (which is a custom driver which makes all of the 360 pad usable via DirectInput) suggests that MS deliberately nerfed the DI support rather than any hardware limitation.

aoen, you can use this class to read state from an Xbox 360 controller (which in turn uses JInput):
http://code.google.com/p/pg3b/source/browse/trunk/Java/src/pg3b/XboxController.java
Everything works, except for the Guide button and Start button. I know the Guide button doesn’t work even with XNA. Not sure about the Start button. Oh, I didn’t bother with the vibration. You might be able to get that to work through JInput.

I wrote a tiny native lib to access XInput, which is MS’s Xbox 360 controller API. It differs from DirectInput in that you can access the start button and the left and right triggers do not share the same axis. The latter is a huge issue, eg in a racing game you might want to press both triggers simultaneously to brake and gas, but with DirectInput this will result in +1 and -1 on the same axis, so you get 0 (which means neither trigger is pressed!). XInput provides access to the rumblers, but I don’t have the need for those.

The native code is only a couple lines (XInput is very simple):
http://code.google.com/p/pg3b/source/browse/trunk/Java/jni/xinput/xinput.c

I wrote a little abstraction layer that seamlessly provides Xbox 360 controller access with XInput on Windows, and JInput everywhere else:
http://code.google.com/p/pg3b/source/browse/#svn/trunk/Java/src/pg3b/xboxcontroller