Skip to content

Instantly share code, notes, and snippets.

@RecursiveG
Created April 15, 2023 16:47
Show Gist options
  • Save RecursiveG/1ae18279de79492282022dbb1ed04bbf to your computer and use it in GitHub Desktop.
Save RecursiveG/1ae18279de79492282022dbb1ed04bbf to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# https://bugs.mojang.com/browse/MC-122477
# Replaces the extracted libglfw.so with this custom built one.
# How that can be done depends on your launcher.
# Minecraft version doesn't matter but GLFW version should match.
#
set -xe
# GLFW for LWJGL 3.3.1: https://github.com/glfw/glfw/archive/97da62a027794d9ff0f4512268cb9a73a8fb5073.zip
wget 'https://github.com/glfw/glfw/archive/97da62a027794d9ff0f4512268cb9a73a8fb5073.zip'
unzip 97da62a027794d9ff0f4512268cb9a73a8fb5073.zip
mv glfw-97da62a027794d9ff0f4512268cb9a73a8fb5073 glfw
patch glfw/src/x11_window.c << 'EOF'
@@ -1130,6 +1130,8 @@
keycode = event->xkey.keycode;
filtered = XFilterEvent(event, None);
+ if (filtered)
+ return;
if (_glfw.x11.randr.available)
{
EOF
mkdir build
cmake -S glfw -B build\
-D BUILD_SHARED_LIBS=YES\
-D GLFW_BUILD_EXAMPLES=NO\
-D GLFW_BUILD_TESTS=NO\
-D GLFW_BUILD_DOCS=NO
cmake --build build
@lizquilty
Copy link

This isnt working for me on 1.20.1 - even manually patching/editing that and latest version no luck

@wojtekojtek
Copy link

wojtekojtek commented Jun 26, 2024

Fixed - thank you!

The issue is that the official launcher may re-extract and overwrites the native files everytime it launches the game. I use my homebrewed launcher so it isn't an issue for me. But I don't know how to make the official launcher (or any launcher you are using) work.

I made it read-only so it shouldn't overwrite it.

edit:
I was using Fabric 1.20.6, Kubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment