I paste you my patch here :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| Index: coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java =================================================================== --- coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java (revision 247) +++ coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java (working copy) -169,6 +169,21 @@ e.printStackTrace(); } } + } else { + controllers = new ArrayList(); + for (Object ceName : loadedPlugins) { + try { + Class ceClass = Class.forName((String) ceName); + ControllerEnvironment ce = (ControllerEnvironment) ceClass.newInstance(); + if (ce.isSupported()) { + addControllers(ce.getControllers()); + } else { + logln(ceClass.getName() + " is not supported"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } } Controller[] ret = new Controller[controllers.size()]; Iterator it = controllers.iterator(); Index: plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java =================================================================== --- plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java (revision 247) +++ plugins/windows/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java (working copy) -111,28 +111,20 @@ } } - private final Controller[] controllers; + private Controller[] controllers = new Controller[0]; private final List active_devices = new ArrayList(); private final DummyWindow window; public DirectInputEnvironmentPlugin() { DummyWindow window = null; - Controller[] controllers = new Controller[]{}; if(isSupported()) { try { window = new DummyWindow(); - try { - controllers = enumControllers(window); - } catch (IOException e) { - window.destroy(); - throw e; - } } catch (IOException e) { logln("Failed to enumerate devices: " + e.getMessage()); } this.window = window; - this.controllers = controllers; AccessController.doPrivileged( new PrivilegedAction() { public final Object run() { -144,12 +136,23 @@ this.window = null; - this.controllers = controllers; } } public final Controller[] getControllers() { - return controllers; + if (this.window != null) { + try { + try { + this.controllers = this.enumControllers(this.window); + } catch (IOException e) { + this.window.destroy(); + throw e; + } + } catch (IOException e) { + logln("Failed to enumerate devices: " + e.getMessage()); + } + } + return this.controllers; } private final Component[] createComponents(IDirectInputDevice device, boolean map_mouse_buttons) { |
As you could see, I only upgrade DirectInputEnvironnementPlugin (and DefaultControllerEnvironnement

)
May be you will need to change the implicit for-each for Java 1.4.
The patch works well for me. I suppose it could be applied to other platforms.