js6pak / mojangfix

Minecraft b1.7.3 mod that fixes skins, authentication and more
https://modrinth.com/mod/mojangfix
GNU Lesser General Public License v3.0
17 stars 7 forks source link

[Feature Request / Vanilla Bug] LWJGL Exception While Entering Full Screen Mode #6

Open halotroop2288 opened 2 years ago

halotroop2288 commented 2 years ago

I'm not sure what plays into this bug, but sometimes, vanilla b1.7.3 will just crash when you press F11 to enter fullscreen mode. Can you add a fix for this bug in this mod?

Stacktrace ``` org.lwjgl.LWJGLException: Failed to set display mode (-2). at org.lwjgl.opengl.WindowsDisplay.nSwitchDisplayMode(Native Method) at org.lwjgl.opengl.WindowsDisplay.switchDisplayMode(WindowsDisplay.java:359) at org.lwjgl.opengl.Display.switchDisplayMode(Display.java:359) at org.lwjgl.opengl.Display.setDisplayModeAndFullscreenInternal(Display.java:507) at org.lwjgl.opengl.Display.setFullscreen(Display.java:475) at net.minecraft.client.Minecraft.method_2136(Minecraft.java:1184) at net.minecraft.class_32.method_132(class_32.java:131) at net.minecraft.class_32.method_130(class_32.java:112) at net.minecraft.client.Minecraft.method_2137(Minecraft.java:1299) at net.minecraft.client.Minecraft.run(Minecraft.java:754) at java.lang.Thread.run(Thread.java:750) java.lang.IllegalStateException: Keyboard must be created before you can read events at org.lwjgl.input.Keyboard.next(Keyboard.java:475) at net.minecraft.class_32.method_130(class_32.java:111) at net.minecraft.client.Minecraft.method_2137(Minecraft.java:1299) at net.minecraft.client.Minecraft.run(Minecraft.java:754) at java.lang.Thread.run(Thread.java:750) ```
js6pak commented 2 years ago

Does it also happen in vanilla? Babric (and by extension mojangfix) use master branch lwjgl (https://github.com/babric/lwjgl) so it might be caused by that (on the other hand it fixes fullscreen on linux :sweat_smile:)

halotroop2288 commented 2 years ago

Yes. It happens in vanilla without Fabric installed too. It happens on both the latest LWJGL2 2.9.4-nightly provided by PolyMC, and on stable 2.9.3. Note that I am using PolyMC as my launcher. And Java 8 Temurin.

js6pak commented 2 years ago

I love how the relevant code https://github.com/babric/lwjgl/blob/master/src/native/windows/display.c#L145 wasn't touched in 17 years... The return code is DISP_CHANGE_BADMODE whatever that means. Does the crash happen every time you try to enter fullscreen?

js6pak commented 2 years ago

Do you have multiple monitors? And if so is it crashing when you try to fullscreen on every one of them?

halotroop2288 commented 2 years ago

It happens within a certain time of starting the game. The exception might be a hint as to why. Maybe the "keyboard" only gets set up later, and that causes LWJGL to shit itself. It fails to bind a controller for the keyboard too, but that never seems to become an issue.

halotroop2288 commented 2 years ago

I do have multiple monitors. I don't know if that's causing it, but it seems unlikely because it only happens sometimes, and I always use my main monitor.

js6pak commented 2 years ago

I wouldn't worry about the keyboard stuff too much, it looks like it just crashes before it has a chance to initialize it.

js6pak commented 2 years ago

As I don't have a windows machine with a multi monitor setup I asked @calmilamsy to test and but he can't reproduce the issue.

halotroop2288 commented 2 years ago

I don't trust calmilamsy anyway. That's like asking LexManos for help. So, ask someone else.

halotroop2288 commented 2 years ago

This bug only occurs while using an incompatible version of Java (in this case Java 17).

halotroop2288 commented 2 years ago

OK, nevermind. This bug DOES occur while using Java 8. I thought it was connected to a similar bug that DOES occur only in Java 17, the resolution being incorrect!