XBox 360 controller rumbers

I have a feeling this is a commonly asked question, how can I get Xbox 360 rumblers to work? I’ve noticed there is a method in LWJGL’s controller class called getRumbers(); (Rumbler[])

(To my understanding, can the JNI even “talk back” to the native code, or am I not understanding how this works?)

I plan on just having a simple method in my already existing class, like

//Probably works ALLOT differently than this.
joystick.vibrateLeft(10 /*The intensity*/);
joystick.vibrateRight(10 /*The intensity*/);

I wrote the Xbox 360 mapping on the Libgdx forum: Xbox360 GamePad Mappings and my current game is designed for gamepads.
I havent spent much time trying to get the rumblers to work, but even with emulators its pretty common that they just dont do anything D:

I’ve tried printing controller.getRumblers().length and it returned 0.

So is it hopeless, or are there other options?

Trying right now. Are you using lwjgl only or libgdx ?

LWJGL, and JInput.

LWJGL! He is a fangirl of it!

Dont have a lwjgl only setup right now.

How about getRumblerCount() ?

This is how it should work: RumbleTest.java

but if the array is empty… =/

Yeah, the log for the app you sent me puts out this:

WARNING: Found unknown Windows version: Windows 8
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
Scanning HID Keyboard Device
Found 0 rumblers
Scanning HID Keyboard Device
Found 0 rumblers
Scanning HID Keyboard Device
Found 0 rumblers
Scanning HID Keyboard Device
Found 0 rumblers
Scanning HID-compliant mouse
Found 0 rumblers
Scanning HID-compliant mouse
Found 0 rumblers
Scanning HID-compliant consumer control device
Found 0 rumblers
Scanning HID-compliant system controller
Found 0 rumblers
Scanning Controller (Afterglow Gamepad for Xbox 360)
Found 0 rumblers
Scanning USB Gaming Mouse
Found 0 rumblers
Scanning USB Gaming Mouse
Found 0 rumblers
Scanning USB Gaming Mouse
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers
Scanning USB Gaming Mouse
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers
Scanning USB Receiver
Found 0 rumblers

Short version: you can’t, sorry. Blame Microsoft. :frowning:

Long version: On windows there are two input APIs: the older DirectInput, and the newer XInput. DirectInput has been around for ages, and pretty much all controllers use it and are supported by it. It worked great, but it was a bit complicated due to supporting lots of different device capabilities (dpads, analog sticks, sliders, buttons, flight stick hats, vibration, etc.).

When the 360 came out, MS also released the XInput API. It’s a simpler input api largely built around the 360 input devices, and works on Windows and 360, to make it easier to port games between the two. The 360 pad on windows can be used under each device, but to try and drive XInput use, the 360 pad is somewhat nerfed if you use DirectInput, and you can’t use the rumble if you’re talking to it via DirectInput (IIRC you also can’t get all of the button states, and you can’t talk to the center ring leds, or get the battery status). If you use XInput you get all functionality, but you can only talk to official 360 pads.

LWJGL only uses DirectInput, so you get nerfed 360 support. Which is a shame, but writing an entire back-end for one controller kinda sucks.