Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException with DualShock USB Controller #27

Open
GoogleCodeExporter opened this issue Feb 25, 2016 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

I connected a PS2 DualShock 2 Controller to my Linux PC with a USB adapter; it 
worked perfectly well in other Linux games, e.g. the shooter "Jamestown". So 
the pad itself is functional and recognized by Linux. But in my LIBGDX game, 
trying to determine the "pov(0)" value does not return any result when pressing 
the DPAD or moving the analog sticks; however, it does so when I use a "normal" 
PC USB-Pad instead of the DualShock. So, the "getPov()"-method works with a 
regular PC USB pad, but not the DualShock on an adapter.

When I press the "X" button of the DualShock pad, I get this stacktrace:

Exception in thread "LWJGL Application" 
com.badlogic.gdx.utils.GdxRuntimeException: 
java.lang.ArrayIndexOutOfBoundsException: 0
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at com.badlogic.gdx.controllers.desktop.ois.OisJoystick.getPov(OisJoystick.java:108)
    at com.badlogic.gdx.controllers.desktop.OisControllers$OisController.getPov(OisControllers.java:134)
    at com.bombermaniacs.gdx.game.GameScreen.doRender(GameScreen.java:127)

So, while I'm trying to determine the state of the DPAD, I get no reaction on 
that, but instead pressing a face button results in this exception. I'm a bit 
at a loss; with a normal PC USB pad, it works, so the LIBGDX code certainly 
isn't completely faulty. On the other hand, other software on my system can 
handle the DualShock without problems, so there must be an issue in the 
controller handling layer of LIBGDX.

I used LIBGDX 0.9.8, Java 1.6.0_20, on OpenSUSE Linux 11.4 (Kernel 2.6.37.6). 
Here is the log output when connecting the pad:

Feb 17 21:49:43 MSCLINUXPC kernel: [127140.189989] usb 1-1.4: new low speed USB 
device using ehci_hcd and address 8
Feb 17 21:49:43 MSCLINUXPC kernel: [127140.278658] usb 1-1.4: New USB device 
found, idVendor=6666, idProduct=0667
Feb 17 21:49:43 MSCLINUXPC kernel: [127140.278660] usb 1-1.4: New USB device 
strings: Mfr=0, Product=0, SerialNumber=0
Feb 17 21:49:43 MSCLINUXPC kernel: [127140.282154] input: HID 6666:0667 as 
/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input9
Feb 17 21:49:43 MSCLINUXPC kernel: [127140.282292] generic-usb 
0003:6666:0667.0007: input,hidraw0: USB HID v1.00 Joystick [HID 6666:0667] on 
usb-0000:00:1a.0-1.4/input0

Please let me know if I can provide any other useful information.

Original issue reported on code.google.com by marcelsc...@yahoo.com on 17 Feb 2013 at 8:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant