Link to adapter: http://www.play-asia.com/paOS-13-71-6m-49-en-70-qc3.html
With a MadCatz dance pad
(I’m suspecting its the adapter, not the pad though lol) I’m on windows VISTA, but I get the same problem on my XP)
Here’s the offending code.
Field defaultEnvironment;
try { //Replace controllerenvironment with new one, unfortunately we can't dispose old one correctly till shutdown
defaultEnvironment = ControllerEnvironment.class.getDeclaredField("defaultEnvironment");
defaultEnvironment.setAccessible(true);
defaultEnvironment.set(null,new DefaultControllerEnvironment()); //DefaultControllerEnvironment made public.
} catch (Exception e){
e.printStackTrace();
}
This is the only way I’ve found to actually refresh the list of controllers.
Maybe one of the Win32 components created in the DirectInputControllernvironment is triggering the state info things whenever its created?
Here’s the debug:
Refreshed:71045.44189948
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
[HID Keyboard Device, HID Keyboard Device, HID-compliant mouse, Logitech Gaming Keyboard, Logitech Gaming Keyboard, G15 Keyboard, Dual USB Force Feedback Joypad (MP-8866), Dual USB Force Feedback Joypad (MP-8866), 4 axis 16 button joystick, 4 axis 16 button joystick]
rz: -0.007827878 @ 71045.93283804
z: -0.007827878 @ 71045.93334332
y: -0.007827878 @ 71045.93373372
x: -0.007827878 @ 71045.93407944
rz: -0.007827878 @ 71045.93718604
z: -0.007827878 @ 71045.93919352
y: -0.007827878 @ 71045.94007088
x: -0.007827878 @ 71045.94045692
slider: -1.0 @ 71045.9409122
slider: -1.0 @ 71045.94123924
rz: 1.0 @ 71045.94304308
z: 1.0 @ 71045.9433288
y: 1.0 @ 71045.94360948
x: 1.0 @ 71045.94386904
slider: -1.0 @ 71045.94459044
slider: -1.0 @ 71045.94500684
So, I execute the aforementioned code to refresh the controllers, and then this output comes. The Controller sending these is the “4 axis 16 button joystick” listed here (the superdualjoybox) The time is in seconds (nanos / 1e9)
My solution: Those “-0.007827878” in value() seem to be specific to the first few erroneous events: Whenever I press actual buttons, I get nice clean 0.0 and 1.0 results. So, solution: if you get -0.007827878, ignore the next event unless its also -0.007827878.
Nevermind. The one that works best is just ignoring input for a second or so. I grey-out the refresh button during this time to the user “gets it”.