Cannot find any joysticks?

I’m attempting to implement gamepad functionality into my project using a Thrustmaster T-WIRELESS gamepad, but when I attempt to read joysticks it throws “java.lang.IllegalStateException: Cannot find any joysticks!” The gamepad works well in any other application I’ve tested. I am using the beta, and the following code:

[java]

Joystick[] joysticks = inputManager.getJoysticks();

if (joysticks == null) {

throw new IllegalStateException(“Cannot find any joysticks!”);

}

[/java]



I tried downloading the most recent nightly and applying it, but the issue remained. Can anyone suggest an angle for troubleshooting?

Are you on Windows?



Please run the following test:

http://www.newdawnsoftware.com/resources/jinput/webstart/jinput-event.html



You should see several windows pop-up, one for each input device. Check to make sure your gamepad has a window of its own and that the buttons work.

@Momoko_Fan said:
Are you on Windows?

Please run the following test:
http://www.newdawnsoftware.com/resources/jinput/webstart/jinput-event.html

You should see several windows pop-up, one for each input device. Check to make sure your gamepad has a window of its own and that the buttons work.


Yes, I am running Windows 7 Pro 64-bit. Yes, my gamepad had a window of its own using that link and all buttons are responsive.

[Edit] I also tried it on my netbook (Win7 Starter 32bit) with a fresh SDK install and got the same results.

The gamepad I’m having trouble with can be found here: http://www.thrustmaster.com/en_UK/products/t-wireless-3-1-rumble-force. It’s a 3-in-1 that is supposed to be PC/PS2/PS3 compatible. As mentioned, it works fine in any other application and also using the test applet that Momoko pointed me toward. I’m tempted to try a linux environment using the same hardware to see if the problem follows.



Can anyone else confirm being able to use a Thrustmaster wireless gamepad in a similar environment to mine?

I have explicit checks to make sure that “mouse”, “keyboard”, and “unknown” devices are not added into the list of joysticks. I removed “unknown” from that list (its in SVN now). Can you try it now?

First, I tried it from SVN and got the same result. This is my first experience using Ant, so I figured I could have done something wrong (very good chance) and tried again using last night’s build (jME3_2012-01-20), same result :frowning:

Hm looks like I only removed one of the checks … There was another one I didn’t notice.

Can you try now?

I just tried it again and got the same result. To make sure I’m applying the latest libs properly using the nightly builds – I just download, unzip, and copy lib* to JME install path libs folder (C:Program Files (x86)jmonkeyplatformjmonkeyplatformlibs in my case), right?

@knucklesandwich said:
I just tried it again and got the same result. To make sure I'm applying the latest libs properly using the nightly builds -- I just download, unzip, and copy lib* to JME install path libs folder (C:Program Files (x86)jmonkeyplatformjmonkeyplatformlibs in my case), right?

No, you check the nightly update center and just update xD
@normen said:
No, you check the nightly update center and just update xD

Well that was much easier!

Unfortunately, I still get the error :(

I guess that means your gamepad tells us its a keyboard or a mouse then? Perhaps you could debug inside JInputJoyInput and see if your joystick is even listed. Its possible we are using an old version or something

I added the following line of code to a method I use for configuring my application settings:

[java]

defaultSettings.putBoolean(“DisableJoysticks”, false);

[/java]

…and now it works!!!



I thought maybe it was something that was caused by disabling the settings window to override with my own static settings (and then not furnishing the line of code above), but I just tried adding the following code to a vanilla SimpleApplication project and it didn’t work:

[java]

Joystick[] joysticks = inputManager.getJoysticks();

if (joysticks == null) {

throw new IllegalStateException(“Cannot find any joysticks!”);

}

[/java]



So it looks like it’s something to do with initializing the settings in a SimpleApplication. I hope my explanation is clear enough to help you fix it. At any rate, thank you very much for the pointers and (to all devs past/present) thank you for all your hard work on JME – this beast is beautiful.