Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (778)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Erroneous Events fired by creating new DefaultControllerEnvironment  (Read 2751 times)
0 Members and 1 Guest are viewing this topic.
Offline taifunbrowser

Senior Newbie

« Posted 2008-07-17 05:01:34 »

Behavior: Everytime I use the ControllerEnvironment class (and trigger the static-construction of the DefaultControllerEnvironment), I know these two things happen

1.) Because of my win32 system, the "DirectAndRawInputControllerEnvironment" is picked
2.) The DirectInputControllerEnvironment is set up
3.) The RawInputControllerEnvironment is set up

SOMEWHERE in those 3 steps, all buttons of all my controllers send off a "hello world" event (that is, they appear in the event queue) .
Sometimes they have value=0, sometimes value = 1. Sometimes they send a value=0 and then a nanosecond later again with value = 1.

They're giving me problems, because I can't tell them apart from actual events.

I'm thinking these erroneous events (because they are created everytime the environment is set back up, and are not triggered by button presses) are some sort of debugging, and I would like to know how to disable it

Thanks, I really love using this library! - the JTouhou project! Mixed 3d and 2d, a multiplatform port for the classic dojin-soft series by Shanghai alice!
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #1 - Posted 2008-07-17 06:23:10 »


It's not something we've done on purpose. I suspect that it's driver related. Some controllers are not very callibratable and fire off events all the time, one of my joysticks is never silent, but that's the hardware, not JInput. If the events only happen on startup it's not the same thing though. All I can suggest is that you try ignoring any events that happen in the first 'x' milliseconds, but it's an odd one that I've not heard of before.
What OS are you using, and what device causes the problems?



Offline taifunbrowser

Senior Newbie

« Reply #2 - Posted 2008-07-17 13:39:37 »

Link to adapter:
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.set(null,new DefaultControllerEnvironment()); //DefaultControllerEnvironment made public.
         } catch (Exception e){

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:
[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". - the JTouhou project! Mixed 3d and 2d, a multiplatform port for the classic dojin-soft series by Shanghai alice!
Pages: [1]
  ignore  |  Print  

hadezbladez (350 views)
2018-11-16 13:46:03

hadezbladez (183 views)
2018-11-16 13:41:33

hadezbladez (349 views)
2018-11-16 13:35:35

hadezbladez (85 views)
2018-11-16 13:32:03

EgonOlsen (2179 views)
2018-06-10 19:43:48

EgonOlsen (2221 views)
2018-06-10 19:43:44

EgonOlsen (1379 views)
2018-06-10 19:43:20

DesertCoockie (2012 views)
2018-05-13 18:23:11

nelsongames (1671 views)
2018-04-24 18:15:36

nelsongames (2309 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!