0

I'm trying to detect a Controller device with JInput. It works fine on my Win7 32 bit PC and Java 32 bit VM. But unfortunally it doesn't find the controller, when i start the programm on a Win7 64 bit PC with Java 64 Bit VM. My code is like this:

private boolean init() {

    ControllerEnvironment env = new DirectAndRawInputEnvironmentPlugin();

    Controller[] cs = env.getControllers();

    for (int i = 0; i < cs.length; i++) {

        if (cs[i].getName().contains("TM3 PTT")) {
            pttController = cs[i];
        }
    }

    if (pttController == null || !pttController.poll()) {
        pttController = null;
        return false;
    }

    return true;

}

Anyone has an idea, what i am doing wrong? Thank you.

Blakhar
  • 204
  • 3
  • 13
  • Does it use a library which loads a DLL? Is the 64-bit version of the DLL available? – Peter Lawrey Sep 25 '12 at 15:12
  • Yes we started small test jar and it detected the device. But i guess not with the DirectAndRawInputEnvironmentPlugin() method, but ControllerEnvironment.getDefaultEnvironment(). The problem is that it doesn't refresh the device list. – Blakhar Sep 25 '12 at 16:14
  • I have a similar issue, everything online suggests that it should work and that there's nothing left to do, but it doesn't detect anything. – Zytron Mar 17 '23 at 21:55

1 Answers1

0

You shouldn't be constructing the controller environment youself, use the static method on ControllerEnvironment.getDefaultEnvironment().

See the getting started guide here.

Endolf
  • 120
  • 9