Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  XBox 360 controller rumbers  (Read 580 times)
0 Members and 1 Guest are viewing this topic.
Offline Spacebeans
« Posted 2014-06-09 04:20:48 »

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
1  
2  
3  
//Probably works ALLOT differently than this.
joystick.vibrateLeft(10 /*The intensity*/);
joystick.vibrateRight(10 /*The intensity*/);
Online Cero
« Reply #1 - Posted 2014-06-09 04:46:14 »

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:

Offline Spacebeans
« Reply #2 - Posted 2014-06-09 04:49:05 »

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

So is it hopeless, or are there other options?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Cero
« Reply #3 - Posted 2014-06-09 04:51:41 »

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

Offline Spacebeans
« Reply #4 - Posted 2014-06-09 04:52:03 »

LWJGL, and JInput.
Offline Jacob Pickens
« Reply #5 - Posted 2014-06-09 04:52:11 »

LWJGL! He is a fangirl of it!
Online Cero
« Reply #6 - Posted 2014-06-09 04:57:26 »

Dont have a lwjgl only setup right now.

How about getRumblerCount() ?

Online Cero
« Reply #7 - Posted 2014-06-09 05:01:35 »

This is how it should work: RumbleTest.java

but if the array is empty... =/

Offline Spacebeans
« Reply #8 - Posted 2014-06-09 05:04:19 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
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
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2014-06-09 10:13:28 »

I have a feeling this is a commonly asked question, how can I get Xbox 360 rumblers to work?

Short version: you can't, sorry. Blame Microsoft. Sad

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.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xFryIx (62 views)
2014-11-13 12:34:49

digdugdiggy (41 views)
2014-11-12 21:11:50

digdugdiggy (34 views)
2014-11-12 21:10:15

digdugdiggy (30 views)
2014-11-12 21:09:33

kovacsa (52 views)
2014-11-07 19:57:14

TehJavaDev (56 views)
2014-11-03 22:04:50

BurntPizza (55 views)
2014-11-03 18:54:52

moogie (70 views)
2014-11-03 06:22:04

CopyableCougar4 (70 views)
2014-11-01 23:36:41

DarkCart (155 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!