From a69f86a248c0b2b087907378c591cb637330a981 Mon Sep 17 00:00:00 2001 From: Glavo Date: Thu, 31 Jul 2025 17:16:06 +0800 Subject: [PATCH] update --- .../main/java/org/jackhuang/hmcl/EntryPoint.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java index 8b6b5a636..b1eec3288 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java @@ -44,15 +44,23 @@ public final class EntryPoint { System.getProperties().putIfAbsent("javafx.autoproxy.disable", "true"); System.getProperties().putIfAbsent("http.agent", "HMCL/" + Metadata.VERSION); + createHMCLDirectories(); + LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs")); + if ("true".equalsIgnoreCase(System.getenv("HMCL_FORCE_GPU"))) System.getProperties().putIfAbsent("prism.forceGPU", "true"); String animationFrameRate = System.getenv("HMCL_ANIMATION_FRAME_RATE"); - if (animationFrameRate != null) - System.getProperties().putIfAbsent("javafx.animation.pulse", animationFrameRate); + if (animationFrameRate != null) { + try { + if (Integer.parseInt(animationFrameRate) <= 0) + throw new NumberFormatException(animationFrameRate); - createHMCLDirectories(); - LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs")); + System.getProperties().putIfAbsent("javafx.animation.pulse", animationFrameRate); + } catch (NumberFormatException e) { + LOG.warning("Invalid animation frame rate: " + animationFrameRate); + } + } checkDirectoryPath();