jmonkeyengine: App crashes with setUseJoysticks=true on lwjgl2 and windows 11
The app crashes with setUseJoysticks=true on lwjgl2 and Windows 11, both with the joystick connected and disconnected.
Details:
- windowds-11
- jdk-11
- jme-3.6.0-beta1.
- lwjgl2
public class Main extends SimpleApplication {
/**
* Start the jMonkeyEngine application
* @param args
*/
public static void main(String[] args) {
Main app = new Main();
AppSettings settings = new AppSettings(true);
settings.setUseJoysticks(true); //I have not connected the joystick.
settings.setResolution(1280, 720);
app.setSettings(settings);
app.setShowSettings(true);
app.setPauseOnLostFocus(false);
app.start();
}
...
}
gen 25, 2023 5:08:32 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-beta1
* Branch: HEAD
* Git Hash: ee91fb8
* Build Date: 2023-01-24
gen 25, 2023 5:08:32 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
* Graphics Adapter: igdumdim64
* Driver Version: null
* Scaling Factor: 1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/xxxx/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.6.0-beta1/f3f826a70693ae115c1e84a0ddd8ca971f61a4bb/jme3-core-3.6.0-beta1.jar) to method sun.nio.ch.DirectBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
gen 25, 2023 5:08:32 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: Intel
* Renderer: Intel(R) Iris(R) Xe Graphics
* OpenGL Version: 3.2.0 - Build 31.0.101.3358
* GLSL Version: 1.50 - Build 31.0.101.3358
* Profile: Core
gen 25, 2023 5:08:32 PM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
WARNING: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 2
- Comments: 17 (17 by maintainers)
I failed to reproduce this issue on my WIndows 11 laptop. No joystick was connected. Here is the output:
No crash, but it appears Jinput 2.0.9 is confused by Windows 11, which was officially released in October 2021, 3+ years after Jinput 2.0.9.
Unfortunately there is a problem, setting the
useDefaultPlugin=false
property the joystick doesn’t work.Tried again with both joystick connected and disconnected. The application starts but freezes (Not Responding).
This is all the log when the mouse and joystick are connected:
This is all the log when mouse and joystick are disconnected:
Edit: Sometimes the game starts correctly, like 1 time out of 20.
This is the log when it works (mouse and joystick disconnected):
My previous test was with JDK 17. I tried again with the Zulu 11.0.18+10 JDK and still no crash.
@capdevon : could you provide a crash log, please?
I think this disables the whole library plugin from working, this is the documentation provided: https://github.com/jinput/jinput/blob/447ec94f22f9023e551a7c25ea2bd8470d5646db/coreAPI/src/main/java/net/java/games/input/package.html#L9
And this is the source where the
useDefaultPlugin
property is being utilized, a lot of spaghetti code everywhere: https://github.com/jinput/jinput/blob/447ec94f22f9023e551a7c25ea2bd8470d5646db/coreAPI/src/main/java/net/java/games/input/DefaultControllerEnvironment.java#L101-L154I don’t know how jinput works under the hood and in which parts does jme rely on it, but seems jinput provides system plugins under
plugins
folder and aPluginLoader
, so you have to assign which plugin should be loaded on runtime, and in this case Wyatt @capdevon has disabled the default plugin, i am not sure what is the “default plugin”, this needs some investigations…EDIT: Alright, i have found the usage, joystick support for lwjgl-2 desktop: https://github.com/jMonkeyEngine/jmonkeyengine/blob/7a5d085ff5274b651401d1460a7bf72abd006ac4/jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java#L125-L126
I added that property and it works fine now. Thanks so much for the help guys! Let me know if you want to create a PR or if I have to close the issue.