From 1592d50f6567c924735c5ec5b8a4a047ba35dcec Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Fri, 12 Aug 2022 12:09:41 +0700 Subject: [PATCH] Attempt to unlock 120Hz for ProMotion display --- JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java | 16 +--------------- Natives/Info.plist | 2 ++ Natives/JavaLauncher.m | 1 + 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java b/JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java index 80d905c4..ec7d95ee 100644 --- a/JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/JavaApp/src/main/java/org/lwjgl/glfw/GLFW.java @@ -521,7 +521,7 @@ public class GLFW memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.REDBITS, 8); memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.GREENBITS, 8); memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.BLUEBITS, 8); - memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.REFRESHRATE, 60); + memPutInt(mGLFWVideoMode.address() + (long) mGLFWVideoMode.REFRESHRATE, Integer.parseInt(System.getProperty("UIScreen.maximumFramesPerSecond"))); // A way to generate key code names Field[] thisFieldArr = GLFW.class.getFields(); @@ -669,14 +669,6 @@ public class GLFW if (cbfun == null) mGLFWFramebufferSizeCallback = null; else mGLFWFramebufferSizeCallback = GLFWFramebufferSizeCallback.createSafe(nglfwSetFramebufferSizeCallback(window, memAddressSafe(cbfun))); - mGLFWFramebufferSizeCallback = GLFWFramebufferSizeCallback.createSafe(nglfwSetFramebufferSizeCallback(window, memAddressSafe(cbfun))); - - /* - try { - mGLFWFramebufferSizeCallback.invoke(window, Tools.mGLFWWindowWidth, Tools.mGLFWWindowHeight); - } catch (Throwable th) {} - */ - return lastCallback; } @@ -780,12 +772,6 @@ public class GLFW if (cbfun == null) mGLFWWindowSizeCallback = null; else mGLFWWindowSizeCallback = GLFWWindowSizeCallback.createSafe(nglfwSetWindowSizeCallback(window, memAddressSafe(cbfun))); - mGLFWWindowSizeCallback = GLFWWindowSizeCallback.createSafe(nglfwSetWindowSizeCallback(window, memAddressSafe(cbfun))); - - try { - mGLFWWindowSizeCallback.invoke(window, Tools.mGLFWWindowWidth, Tools.mGLFWWindowHeight); - } catch (Throwable th) {} - return lastCallback; } diff --git a/Natives/Info.plist b/Natives/Info.plist index f840da86..6ba134c4 100644 --- a/Natives/Info.plist +++ b/Natives/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion en CFBundleDisplayName diff --git a/Natives/JavaLauncher.m b/Natives/JavaLauncher.m index d33b2566..3bd16ee9 100644 --- a/Natives/JavaLauncher.m +++ b/Natives/JavaLauncher.m @@ -228,6 +228,7 @@ int launchJVM(NSString *username, id launchTarget, int width, int height, int mi margv[++margc] = jnaLibPath; margv[++margc] = userDir; margv[++margc] = userHome; + margv[++margc] = [NSString stringWithFormat:@"-DUIScreen.maximumFramesPerSecond=%d", UIScreen.maximumFramesPerSecond].UTF8String; margv[++margc] = "-Dorg.lwjgl.system.allocator=system"; margv[++margc] = "-Dlog4j2.formatMsgNoLookups=true"; if([getPreference(@"arccapes_enable") boolValue]) {