gurkenlabs / litiengine

LITIENGINE 🕹 The pure 2D java game engine.
https://litiengine.com/
MIT License
744 stars 93 forks source link

GamepadManager does not detect any added controllers #429

Open ecchilds opened 2 years ago

ecchilds commented 2 years ago

Describe the bug Game does not detect any added gamepad when I plug one into my computer. I have an event listener to detect when the gamepad is added, but the listener never runs.

Stack Trace

Dec 08, 2021 6:19:44 PM de.gurkenlabs.litiengine.configuration.Configuration load
INFO: Configuration config.properties created
java.lang.UnsatisfiedLinkError: no jinput-dx8_64 in java.library.path: C:\Users\caspar\.jdks\openjdk-17.0.1\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\caspar\AppData\Local\Microsoft\WindowsApps;C:\Users\caspar\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\caspar\AppData\Local\GitHubDesktop\bin;.
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
    at java.base/java.lang.System.loadLibrary(System.java:1989)
    at net.java.games.input.DirectInputEnvironmentPlugin.lambda$loadLibrary$0(DirectInputEnvironmentPlugin.java:73)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at net.java.games.input.DirectInputEnvironmentPlugin.loadLibrary(DirectInputEnvironmentPlugin.java:67)
    at net.java.games.input.DirectInputEnvironmentPlugin.<clinit>(DirectInputEnvironmentPlugin.java:98)
    at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init>(DirectAndRawInputEnvironmentPlugin.java:45)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:134)
    at de.gurkenlabs.litiengine.input.GamepadManager.updateGamepads(GamepadManager.java:307)
    at de.gurkenlabs.litiengine.input.GamepadManager.<init>(GamepadManager.java:90)
    at de.gurkenlabs.litiengine.input.Input$InputGameAdapter.init(Input.java:106)
    at de.gurkenlabs.litiengine.input.Input$InputGameAdapter.initialized(Input.java:83)
    at de.gurkenlabs.litiengine.Game.init(Game.java:493)
    at com.gradle.game.GameApp.main(GameApp.java:14)
java.lang.UnsatisfiedLinkError: no jinput-raw_64 in java.library.path: C:\Users\caspar\.jdks\openjdk-17.0.1\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\caspar\AppData\Local\Microsoft\WindowsApps;C:\Users\caspar\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\caspar\AppData\Local\GitHubDesktop\bin;.
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
    at java.base/java.lang.System.loadLibrary(System.java:1989)
    at net.java.games.input.RawInputEnvironmentPlugin.lambda$loadLibrary$0(RawInputEnvironmentPlugin.java:73)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at net.java.games.input.RawInputEnvironmentPlugin.loadLibrary(RawInputEnvironmentPlugin.java:67)
    at net.java.games.input.RawInputEnvironmentPlugin.<clinit>(RawInputEnvironmentPlugin.java:98)
    at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init>(DirectAndRawInputEnvironmentPlugin.java:46)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:134)
    at de.gurkenlabs.litiengine.input.GamepadManager.updateGamepads(GamepadManager.java:307)
    at de.gurkenlabs.litiengine.input.GamepadManager.<init>(GamepadManager.java:90)
    at de.gurkenlabs.litiengine.input.Input$InputGameAdapter.init(Input.java:106)
    at de.gurkenlabs.litiengine.input.Input$InputGameAdapter.initialized(Input.java:83)
    at de.gurkenlabs.litiengine.Game.init(Game.java:493)
    at com.gradle.game.GameApp.main(GameApp.java:14)
Dec 08, 2021 6:13:17 PM net.java.games.input.ControllerEnvironment log
INFO: net.java.games.input.DirectAndRawInputEnvironmentPlugin is not supported

To Reproduce This error occurs whenever I set input_gamepadSupport to true in config.properties.

This error may be due to natives not being set up correctly. However, after following this guide, I get this error when running gradle includeNatives:

Execution failed for task ':includeNatives'.
> Configuration with name 'runtime' not found.

Expected behavior Gamepad added listener should run when a gamepad is added.

Your System:

Additional context Here's the relevant code (the breakpoint is never reached): image

Here's a screenshot of my build.gradle file: image

Let me know if I should re-categorize this, if it's not a bug.

github-actions[bot] commented 2 years ago

Thank you for your reporting your first LITIENGINE issue! We are looking forward to your further contributions.