From 6b0f655434ef8b9b1f63b380a70bd511021049b6 Mon Sep 17 00:00:00 2001 From: Player Name Date: Sun, 24 Sep 2023 13:47:11 -0400 Subject: [PATCH] Configurable FPS --- client/src/main/java/rt4/GameShell.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/rt4/GameShell.java b/client/src/main/java/rt4/GameShell.java index 736818a..80a799d 100644 --- a/client/src/main/java/rt4/GameShell.java +++ b/client/src/main/java/rt4/GameShell.java @@ -728,11 +728,18 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene } private final void configureTargetFPS() { - int refreshRate = getCurrentDevice().getDisplayMode().getRefreshRate(); - if (refreshRate == java.awt.DisplayMode.REFRESH_RATE_UNKNOWN) { - refreshRate = 60; //just assume 60hz and call it a day. + int targetFps = 0; + String clientFps = System.getProperty("clientFps"); + if (clientFps != null) { + targetFps = Integer.parseInt(clientFps); //if invalid number, we're happy to get the exception + } + if (targetFps == 0) { + targetFps = getCurrentDevice().getDisplayMode().getRefreshRate(); + if (targetFps == java.awt.DisplayMode.REFRESH_RATE_UNKNOWN) { + targetFps = 60; //just assume 60hz and call it a day. + } } - GameShell.setFpsTarget(refreshRate); + GameShell.setFpsTarget(targetFps); } @OriginalMember(owner = "client!rc", name = "windowOpened", descriptor = "(Ljava/awt/event/WindowEvent;)V")