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.

crash

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I failed to reproduce this issue on my WIndows 11 laptop. No joystick was connected. Here is the output:

Jan 26, 2023 10:11:15 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-SNAPSHOT
 * Branch: master
 * Git Hash: ead32f1
 * Build Date: 2023-01-26
Jan 26, 2023 10:11:16 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: C:\WINDOWS\System32\DriverStore\FileRepository\nvhm.inf_amd64_4a2f8a62d5686839\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvhm.inf_amd64_4a2f8a62d5686839\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvhm.inf_amd64_4a2f8a62d5686839\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvhm.inf_amd64_4a2f8a62d5686839\nvldumdx.dll
 * Driver Version: null
 * Scaling Factor: 1
Jan 26, 2023 10:11:16 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 2070/PCIe/SSE2
 * OpenGL Version: 3.2.0 NVIDIA 512.78
 * GLSL Version: 1.50 NVIDIA via Cg compiler
 * Profile: Core
Jan 26, 2023 10:11:16 AM net.java.games.input.DefaultControllerEnvironment getControllers
WARNING: Found unknown Windows version: Windows 11
Jan 26, 2023 10:11:16 AM net.java.games.input.DefaultControllerEnvironment getControllers
WARNING: Attempting to use default windows plug-in.
Jan 26, 2023 10:11:16 AM net.java.games.input.ControllerEnvironment log
INFO: Failed to initialize device HIDI2C Device because of: java.io.IOException: Failed to acquire device (8007001e)
Jan 26, 2023 10:11:17 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Jan 26, 2023 10:11:17 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Jan 26, 2023 10:11:17 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jan 26, 2023 10:11:17 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4

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.

	/**
	 * Start the jMonkeyEngine application
	 * @param args
	 */
	public static void main(String[] args) {

		Main app = new Main();

		System.setProperty("net.java.games.input.useDefaultPlugin", "false");
		AppSettings settings = new AppSettings(true);
		settings.setUseJoysticks(true); //With Joystick connected
		settings.setResolution(1280, 720);

		app.setSettings(settings);
		app.setShowSettings(true);
		app.setPauseOnLostFocus(false);
		app.start();
	}

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:

gen 27, 2023 10:16:51 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-beta1
 * Branch: HEAD
 * Git Hash: ee91fb8
 * Build Date: 2023-01-24
gen 27, 2023 10:16:52 AM 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 27, 2023 10:16:52 AM 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 27, 2023 10:16:52 AM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
WARNING: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.
gen 27, 2023 10:16:52 AM net.java.games.input.ControllerEnvironment log
INFO: Failed to initialize device TUF GAMING M3 because of: java.io.IOException: Failed to acquire device (8007001e)

This is all the log when mouse and joystick are disconnected:

gen 27, 2023 10:16:51 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-beta1
 * Branch: HEAD
 * Git Hash: ee91fb8
 * Build Date: 2023-01-24
gen 27, 2023 10:16:52 AM 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 27, 2023 10:16:52 AM 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 27, 2023 10:16:52 AM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
WARNING: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.

Edit: Sometimes the game starts correctly, like 1 time out of 20.

This is the log when it works (mouse and joystick disconnected):

gen 27, 2023 10:28:33 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-beta1
 * Branch: HEAD
 * Git Hash: ee91fb8
 * Build Date: 2023-01-24
gen 27, 2023 10:28:34 AM 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/xxxxx/.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 27, 2023 10:28:34 AM 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 27, 2023 10:28:34 AM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
WARNING: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.
gen 27, 2023 10:28:34 AM net.java.games.input.ControllerEnvironment log
INFO: Failed to initialize device HIDI2C Device because of: java.io.IOException: Failed to acquire device (8007001e)
gen 27, 2023 10:28:34 AM net.java.games.input.ControllerEnvironment log
INFO: Failed to initialize device HIDI2C Device because of: java.io.IOException: Failed to acquire device (8007001e)
gen 27, 2023 10:28:35 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
gen 27, 2023 10:28:35 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
gen 27, 2023 10:28:35 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
gen 27, 2023 10:28:35 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Libbulletjme version 17.5.4 initializing

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-L154

I 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 a PluginLoader, 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.

	/**
	 * Start the jMonkeyEngine application
	 * @param args
	 */
	public static void main(String[] args) {

		Main app = new Main();

		System.setProperty("net.java.games.input.useDefaultPlugin", "false");
		AppSettings settings = new AppSettings(true);
		settings.setUseJoysticks(true); //With Joystick disconnected
		settings.setResolution(1280, 720);

		app.setSettings(settings);
		app.setShowSettings(true);
		app.setPauseOnLostFocus(false);
		app.start();
	}