Controllers and Keyboard

Started by snraeoj, December 18, 2005, 18:21:05

Previous topic - Next topic

snraeoj

Hi there.
First of all good work.

But i found 2 issues about Controller and Keyboard:

First:
If there is a USB Device with more than "72 Components", i  get a index out of bound exception at Controller.java line 56.
OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating Logitech Freedom 2.4 USB polling = false
Creating USB Receiver polling = false
Creating USB Receiver polling = false
Creating USB Receiver polling = false
Creating ET-0405A-UV2.0-3 polling = false
OS name is: Windows XP
DX8 plugin is supported
Error
org.lwjgl.LWJGLException: Failed to initialise controllers
	at org.lwjgl.input.Controllers.create(Controllers.java:82)
	at de.byteholder.metaspace.engine.input.InputTask.start(InputTask.java:135)
	at de.byteholder.metaspace.engine.Kernel.addTask(Kernel.java:180)
	at de.byteholder.metaspace.client.MetaSpaceClient.<init>(MetaSpaceClient.java:39)
	at de.byteholder.metaspace.client.MetaSpaceClient.<init>(MetaSpaceClient.java:23)
	at de.byteholder.metaspace.client.MetaSpaceClient.main(MetaSpaceClient.java:53)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 72
	at net.java.games.input.DirectInputAxis.getPollData(DirectInputAxis.java:148)
	at org.lwjgl.input.JInputController.<init>(JInputController.java:79)
	at org.lwjgl.input.Controllers.createController(Controllers.java:94)
	at org.lwjgl.input.Controllers.create(Controllers.java:77)
	... 5 more


I made a ugly hack: in Controllers.java #56 i inserted:
if(c.getComponents().length < 70){
					createController(c);
		}


I tried to hunt down which of my Inputdevices creates this exception, but the exception occured even if only my Keyboard and my Mouse were plugged in (both USB). So i think the source is a USB Controller.

Second one:
I cant say if this is because of my hack (i think so, but i read a older post of sb who had the same issue)

If i create the controllers, i dont have a keyboard focus at startup. If you minimze the window of the app and maximize it, the keyboard focus is grabbed.
But if i dont create the controllers, the keyboard focus is normal.
As i said above, the keyboard is usb.

My conclusion is, that the Controller.create overrides sth usb keyboard specific.

I'm wondering, because the mouse isnt effected.

And btw, i had a funny behavior:
I programmed sth with lwjgl for an hour and went away for a time.
My computer was idleing for about 4 to 5 hours, and went to sleep mode i think. When i came back, and started the app which uses lwjl, there always was a directInput failure (ERR_GENERIC if i remember correctly). A restart of my computer helped....


best regards
Snareoj
mpf i to misspelled my nick at registering :P