3 Small Questions from a New Guy

First of all, I really want to thank you guys for developing JInput. It really works great
and I really appreciate all the time you put in to this project (I hope I can do something
with it that makes it all worth it, lol)

Im having one issue when i try to poll my mouse.

Here is some background info:

  • Im using the 3 apps from the FreeFodder tutorial by Robert Schuster
  • it is a Logitech USB TrackBall mouse
  • There is no version number anywhere but i downloaded my JInput binaries between
    January and March of this year (2005)
  • Im using windows xp pro

Here is the get controllers list:

run:
[] Creating Saitek Cyborg Force Rumble Pad polling = true
[] 0 - Mouse Mouse (mouse)
[] 1 - Keyboard (Keyboard) (buttons)
[] 2 - Saitek Cyborg Force Rumble Pad Saitek Cyborg Force Rumble Pad (stick)
[] Create effect : DIERR_INVALIDPARAM
[] Create effect : DIERR_INVALIDPARAM

Here is the details for controller 0 (the mouse)

run:
[] Creating Saitek Cyborg Force Rumble Pad polling = true
[] name: Mouse Mouse
[] type: mouse
[] port: Unknown
[] subcontroller: 0
[] name: Mouse Mouse ball
[] type: ball
[] port: Unknown
[] axes:
[] 0 - X-axis - x - relative - arbitrary - analog - 0.0
[] 1 - Y-axis - y - relative - arbitrary - analog - 0.0
[] subcontroller: 1
[] name: Mouse Mouse buttons
[] type: buttons
[] port: Unknown
[] axes:
[] 0 - Button 0 - left - absolute - normalized - digital - 0.0
[] 1 - Button 1 - right - absolute - normalized - digital - 0.0
[] 2 - Button 2 - middle - absolute - normalized - digital - 0.0
[] 3 - Button 3 - side - absolute - normalized - digital - 0.0
[] 4 - Button 4 - extra - absolute - normalized - digital - 0.0
[] Create effect : DIERR_INVALIDPARAM
[] Create effect : DIERR_INVALIDPARAM

And this is the error i get if i try to poll anything (0-4) on the mouse

run:
[] Creating Saitek Cyborg Force Rumble Pad polling = true
[] The provided index is out of range for this controller.
[] Use a value between 0 and -1
[] Create effect : DIERR_INVALIDPARAM
[] Create effect : DIERR_INVALIDPARAM

So, yea, i cant use the mouse.
The game controller and the keyboard work perfectly though.

My two other questions:
1 - i downloaded JInput for windows about 6 months ago.
should i download a new version?

2 - is the only way to get game controller events to continuously poll in a timed thread
like the tutorial example?
Or is there a “Listener” type class that will return changes in the controller?

	// installs a timer which is activated every 10 ms
	new Timer(10, new ActionListener() {
		public void actionPerformed(ActionEvent ae) {
			// update all Axis instances of this controller
			controller.poll();
			
			// update the text field's contents
			pollField.setText(String.valueOf(axis.getPollData()));
		}
	}).start();

Thanks for reading and for any help!

Mice are tricky ebcause they typically show up as two sub-controllers, one for the X and Y (0 in your case) and one for the buttons (1 in your case.)

You need to get the sub-controller and poll it, not poll the mouse itself. Are you doing this?

It wouldnt hurt to use the latest released builds. If your really brave you can download the CVS and build it but tehre’s no gaurantee that the CVS is ina release state at any given time.

By its nature JInput is a polled input API. Most games want this as they simply poll once per frame.

Any sort of call-back mechanism yo uwoudl have to build untop of it by launching a thread that polls periodically and dispatches callbacks.

Great! Thanks alot. Those were exactly the anwers i was looking for.
I dont believe i was polling the mouse’s subcontroller.
The programs from the tutorial only polled regular controllers.
Thanks again for the clarification!

My pleasure. Its a common mistake,. Even I made it once and I’m pretty much the “original author” of the API ;D

(I say “pretty much” becasue a good friend of mine actually wrote most of it but I took it over when he left Sun, did a bit of cleanup and then released it )

[quote=“Jeff,post:4,topic:24459”]
Then I got hold of it and butchured it to death :slight_smile:

The DIERR_INVALIDPARAM messages are a bit worrying, I’ll have to have a dig into it, my guess from not looking at the code is that it’s creating effects the device doesn’t support. This is worrying as if I recall right, it only tries to create 2, weak rumble and strong rumble.

Guess i’ll have to boot into windows tonight :confused:

Endolf

[quote=“endolf,post:5,topic:24459”]

I’d put it “Then Jeremy took it over and really made it sing!” ;D

Hi

I’ve stuck a new jinput windows build up here, it’s got some more rumbler debug statements in it, can you test it can send me the results please?

Thanks

Endolf

Oh wow, haha. I didnt realize there were more posts in here!
I came back to see if i could learn a little something from reading
the other posts.

The DIERR_INVALIDPARAM messages are a bit worrying, I’ll have to have a dig into it

Yea. I didnt now what they meant - but everything was working well so I didnt worry about it.
My controller doesnt have rumblers or “effects”.
I was kind of too ecstatic when i got the game controllers working at 2 in the morning to worry about it, haha.

I’ve stuck a new jinput windows build up here, it’s got some more rumbler debug statements in it,
can you test it can send me the results please?

I dont know if that was directed towards me or jeff - but since he recommended i update
anyway - ill download a recent build and post the output i get.

Night guys. Thanks again for your great work and support.

Good News, Bad News.

Good News: Your debug statements came up
Bad News: You broke the 3 tutorial apps i was using, lol. Now the controller doesnt work.
It probably has something to do with the files in this build being named differently than the files
in the build i had.

The Build I Had

jinput.jar
jutils.jar
dxinput.jar
dxinput.dll

The Build I Downloaded from Your Link

jinput.jar
jinput-dxplugin.dll

Also, I apparently DO have rumble on my controller and never noticed.
I also have a small button that says “digital” on it next to the small “rumble” button
and also a mysterious little red button thats never done anything.

For the eagle eyed youll see the list lists my controller #5 and later i call it with #2 -
I unplugged my keyboard and the index number changed.

Anyway, you broke it - now you fix it, haha!
Thanks again Guys.

Heres the ouput:

Listing Controllers

C:\A\Java\JInput\TutorialOne2\src>ant listControllers
Buildfile: build.xml

listControllers:

init:

compile:

-determinePlugin:

run:
[] OS name is: Windows XP
[] DX8 plugin is supported
[] OS name is: Windows XP
[] DX8 plugin is supported
[] Creating Microsoft Wireless Optical Desktop« 2.10 polling = false
[] Creating Microsoft Wireless Optical Desktop« 2.10 polling = false
[] Creating Microsoft Wireless Optical Desktop« 2.10 polling = false
[] Creating Saitek Cyborg Force Rumble Pad polling = true
[] OS name is: Windows XP
[] DX8 plugin is supported
[] 0 - Mouse Mouse (mouse)
[] 1 - Keyboard (Keyboard) (buttons)
[] 2 - Microsoft Wireless Optical Desktop« 2.10 Microsoft Wireless Optical Desktop« 2.10 (stick)
[] 3 - Microsoft Wireless Optical Desktop« 2.10 Microsoft Wireless Optical Desktop« 2.10 (stick)
[] 4 - Microsoft Wireless Optical Desktop« 2.10 Microsoft Wireless Optical Desktop« 2.10 (stick)
[] 5 - Saitek Cyborg Force Rumble Pad Saitek Cyborg Force Rumble Pad (stick)
[] Reseting rumbler X Axis before exit
[] Reseting rumbler Y Axis before exit
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Create effect : DIERR_INVALIDPARAM
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Create effect : DIERR_INVALIDPARAM

Controller Details

C:\A\Java\JInput\TutorialOne2\src>ant controllerDetails -Dcontroller=2
Buildfile: build.xml

controllerDetails:

init:

compile:

-determinePlugin:

run:
[] OS name is: Windows XP
[] DX8 plugin is supported
[] OS name is: Windows XP
[] DX8 plugin is supported
[] Creating Saitek Cyborg Force Rumble Pad polling = true
[] OS name is: Windows XP
[] DX8 plugin is supported
[] name: Saitek Cyborg Force Rumble Pad Saitek Cyborg Force Rumble Pad
[] type: stick
[] port: Unknown
[] java.lang.NoSuchMethodError: net.java.games.input.Controller.getAxes()[Lnet/java/games/input/Axis;
[] at net.java.games.input.tutorialone.ControllerDetails.print ControllerDetails(ControllerDetails.java:74)
[] at net.java.games.input.tutorialone.ControllerDetails.main(ControllerDetails.java:46)
[] Reseting rumbler X Axis before exit
[] Reseting rumbler Y Axis before exit
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Create effect : DIERR_INVALIDPARAM
[] Supported effects: Constant force Ramp force Periodic force Per
iodic force Periodic force Periodic force Periodic force Condition force Co
ndition force Condition force Condition force Custom force Hardware force H
ardware force Hardware force Hardware force
[] Create effect : DIERR_INVALIDPARAM
[] Exception in thread “main”
[] Java Result: 1

Hi

Looks like you are using a fairly old build. That tutorial was written when we had some problems getting people up and running with it.

The build you are trying is the newer ‘simple’ builds, you’ll find you have 1 jar and 1 dll, with the jar anywhere on your classpath, and the directory the dll is in being pointed to by java.library.path it will run fine.

eg.

say you have the following dir structure

appPath/bin
appPath/lib
appPath/src

where your own classes are compiled into bin (maybe in a jar), your source code for your own files is in src, and lib contains both the dll and the jinput.jar

just run java -cp ;appPath/lib/jinput.jar -Djava.library.path=appPath/lib/

HTH

Thanks for running the tests, I can see that you have 4 axis that support effects, I only have two on the test stick I bought so I can’t be certain, but I’ll have a look. I’ll have a hunt around and see if I can find out what other axis your devices supports and why it seems to cause jinput a problem.

Thanks

Endolf

Hi

Uploaded another build with some more debug to here. If this shows what I think it will, then I should be able to sort the problem. And my guess would be that you’ll have 4 axis rumbling :slight_smile:

Could you confirm which device you have. I think I can guess from the saitek website, but I’m not certain. I think it’s the P2500.

Thanks

Endolf

Hey Endolf.

That tutorial was written when we had some problems getting people up and running with it.

Haha, just my luck. I got it working the first time i tried -
but the “easy” version stumps me.

Realistically I think the problem is the 3 apps from the tutorial.
I think they are throwing a lot of the errors.
So its not you, me or the builds.

The latest build didnt even get as far as listing the controllers.
I havent had time recently - but today i think ill take the time to write my own
demo app and my guess is that everything will work just fine.

Because, if you look at my last post (#8 i think) in the controller
details errors there is this line:

  [] java.lang.NoSuchMethodError: net.java.games.input.Controller.getAxes()[Lnet/java/games/input/Axis;
     []     at net.java.games.input.tutorialone.ControllerDetails.print ControllerDetails(ControllerDetails.java:74)
     []     at net.java.games.input.tutorialone.ControllerDetails.main(ControllerDetails.java:46)

Did you change any of the method names?
I think the app is trying to call a method that may have changed in the last 6 months
(my orig version was from around February 05).

I think it’s the P2500.

I didnt check the site but the controller says P2500 on the
left controller arm so im guessing youre right, haha.
I didnt even know that, haha. I should have posted that before. Sorry.

Thanks for running the tests

Seriously - Thank You. Ill run as many tests as you need, haha.
Its well worth it. Im starting to write my first 3D app and the moment
i can use a controller to traverse the environment i think im going to
weep like a child, haha. So yea - thanks again, haha.

List Controllers

C:\A\Java\JInput\TutorialOne2\src>ant listControllers
Buildfile: build.xml

listControllers:

init:

compile:

-determinePlugin:

run:
[] java.lang.UnsupportedClassVersionError: net/java/games/util/plugins/Plugins (Unsupported major.minor version 49.0)
[] at java.lang.ClassLoader.defineClass0(Native Method)
[] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
[] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[] at java.net.URLClassLoader.defineClass(URLClassLoader.java: 251)
[] at java.net.URLClassLoader.access$100(URLClassLoader.java:5 5)
[] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[] at java.security.AccessController.doPrivileged(Native Method)
[] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[] at net.java.games.input.ControllerEnvironment.(ControllerEnvironment.java:73)
[] at net.java.games.input.tutorialone.ListControllers.main(ListControllers.java:21)
[] Exception in thread “main”
[] Java Result: 1

Ahhh

yeah, we actually changed the API, Axes implied it was for joysticks, but buttons and keys were sub classes, so we changed it so you now have components.

There are javadocs on the jinput.dev.java.net files section, I can upload uncompressed ones to newdawnsoftware if people want.

damn damn damn. Sorry, thats my fault. Looks like i forgot to commit the changes to the build files so that it builds 1.4 compatable code. I’m using 1.5.

I’ve uploaded a new copy of the file, and updated the ant scripts.

If you download the zip, and extract the 2 files, then in the directory you extracted them to run

java -cp jinput.jar -Djava.library.path=. net.java.games.input.test.ControllerReadTest

it will run the test that come with jinput, there are also ControllerTextTest and RumbleTest tests in the jar.

HTH

Endolf

I’ve uploaded a new copy of the file, and updated the ant scripts.
If you download the zip, and extract the 2 files

Er - youre going to have to forgive me - download from where?
What ant scripts?
https://jinput.dev.java.net/ ?
In the “docs and files” i only saw 8-24-05 as the latest version.

Just in case i downloaded that one and I redownloaded the zip from the last
link you posted (in case it pointed to a new zip) and ran both of them and
got the same error message.

There are javadocs on the jinput.dev.java.net files section,
I can upload uncompressed ones to newdawnsoftware if people want.

What is newdawnsoftware?

it will run the test that come with jinput,

Sorry! I didnt know there were built in tests. i would have ran those
instead of that old tutorial had i known!

I was going to upgrade to 1.5 anyway.
This is a dumb question im sure - but i can still write 1.4.2 compatible code
with 1.5 right?

Thanks again!

Run (same message for both downloads)

C:\A\Java\JInput\JInput 8-28\2>java -cp jinput.jar -Djava.library.path=. ne
t.java.games.input.test.ControllerReadTest
Exception in thread “main” java.lang.UnsupportedClassVersionError: net/java
/games/util/plugins/Plugins (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.ja
va:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at net.java.games.input.ControllerEnvironment.(ControllerEn
vironment.java:73)
at net.java.games.input.test.ControllerReadTest.(ControllerRe
adTest.java:249)
at net.java.games.input.test.ControllerReadTest.main(ControllerRead
Test.java:299)

Hi

newdawnsoftware is where most of the jinput files end up. It’s a server a friend and I run www.newdawnsoftware.com. The zip I gave you the other day came from there. jinput.dev.java.net just points to those files for some of them :). I’ve not bothered updating the link on jinput as these builds for you are just debug builds.

You can build 1.4 compatable code with 1.5, the target=“1.4” option should do it.

In case there is a cache or something in between, I’ve copied it to a new fille here.

Endolf.

P.S.

Check your personal messages :slight_smile:

I downloaded from tht link and got the same error from the last times.
Is it that i am using 1.4?

Ill update to 1.5 (but other people im writing code with are using
1.4 so the JInput code will still have to work for them anyway).

what is the - target=“1.4” option?
I wont have to type that everytime i want to compile
something will i?

Sorry for the “noobish” questions, haha. Thanks!
I sent you a PM.

Hi

Right, i’ve installed 1.4.2_09 on my windows box and actually read the error log you posted. It was jutils as well that needed rebuilding. I’ve done that, and uploaded a new dist here. I’ve tested it myself too :slight_smile:

It now works with 1.4 :slight_smile:

Endolf

yeah if your working with 1.5 aqnd you need to share class fiels with 1,4 users you’ll have to tell the compiler that every time you compile.

Luckily most IDE’s have somepalce in the p[roject you cna set thisonce and then forget it.

Endolf,
You’re a god. All is working perfectly.
Mouse, Controller, Keyboard - all great.
The first time i ran the test i got 4 of these on the command line:
DI_BUFFEROVERFLOW
But the 2 times afterwards i only got that message once.
I dont know what that means - but like i said everything worked perfectly.
Im exhausted, today was a VERY long day, haha.
I can sleep well knowing this works great.
Thanks again for all your help!

Jeff,
I think im going to update to 1.5.
I write code in TextPad and i checked and it has a parameter line for the
compiler so youre right - i think i can add that option in
there and not even have to worry about it.
Thank god, haha.

C:\A\Java\JInput\JInput 8-29>java -cp jinput.jar -Djava.library.path=. net.
java.games.input.test.ControllerReadTest
OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating Saitek Cyborg Force Rumble Pad polling = true
Supported effects: Constant force Ramp force Periodic force Periodic force
Periodic force Periodic force Periodic force Condition force Condition forc
e Condition force Condition force Custom force Hardware force Hardware forc
e Hardware force Hardware force
effect is in the x axis
Supported effects: Constant force Ramp force Periodic force Periodic force
Periodic force Periodic force Periodic force Condition force Condition forc
e Condition force Condition force Custom force Hardware force Hardware forc
e Hardware force Hardware force
effect is in the y axis
Supported effects: Constant force Ramp force Periodic force Periodic force
Periodic force Periodic force Periodic force Condition force Condition forc
e Condition force Condition force Custom force Hardware force Hardware forc
e Hardware force Hardware force
effect is in the rx axis
Create effect : DIERR_INVALIDPARAM
Supported effects: Constant force Ramp force Periodic force Periodic force
Periodic force Periodic force Periodic force Condition force Condition forc
e Condition force Condition force Custom force Hardware force Hardware forc
e Hardware force Hardware force
effect is in the z axis
Create effect : DIERR_INVALIDPARAM
Component count = 2
Component count = 5
Component count = 124
Component count = 17
DI_BUFFEROVERFLOW

Endolf,
There is a bad error when running the test with my wireless keyboard.
I never had the keyboard plugged in at the same time as the controller
so i never noticed.
I just downloaded the source code for the ControllerReadTest,
compiled it and ran it.
I got the error (listed below) that just repeated over and over so it
jammed everything else.
I disabled the wireless desktop and it worked perfectly like before.
Then I disabled the wireless mouse so i know its definitely the wireless keyboard.

From reading the error - it must be trying to poll something out of bounds
which is why the error repeats every time there is a poll.

The keyboard is a Microsoft Wireless Comfort Keyboard 1.0A Model 1027
http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=028

yup, thats right - a tilting scroll wheel on the mouse.
im living the dream.

java.lang.ArrayIndexOutOfBoundsException: 165
at net.java.games.input.DirectInputAxis.getPollData(DirectInputAxis
.java:148)
at net.java.games.input.test.AxisPanel.poll(ControllerReadTest.java
:74)
at net.java.games.input.test.ControllerWindow.poll(ControllerReadTe
st.java:235)
at net.java.games.input.test.ControllerReadTest$1.run(ControllerRea
dTest.java:262)
at java.lang.Thread.run(Thread.java:534)
java.lang.ArrayIndexOutOfBoundsException: 166
at net.java.games.input.DirectInputAxis.getPollData(DirectInputAxis
.java:148)
at net.java.games.input.test.AxisPanel.poll(ControllerReadTest.java
:74)
at net.java.games.input.test.ControllerWindow.poll(ControllerReadTe
st.java:235)
at net.java.games.input.test.ControllerReadTest$1.run(ControllerRea
dTest.java:262)
at java.lang.Thread.run(Thread.java:534)

Repeating Indefinitely