From 966c6e94df5972a84acdc3fe45d0134f6d8254fc Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Thu, 12 Feb 2026 02:27:47 +0800 Subject: [PATCH 01/15] update --- .../main/java/org/jackhuang/hmcl/Main.java | 13 +++++++ .../org/jackhuang/hmcl/util/WineDetector.java | 39 +++++++++++++++++++ .../resources/assets/lang/boot.properties | 4 +- .../resources/assets/lang/boot_zh.properties | 3 +- .../assets/lang/boot_zh_Hant.properties | 1 + 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java index adc1f208b5..6b59ae7bc1 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java @@ -18,6 +18,7 @@ package org.jackhuang.hmcl; import org.jackhuang.hmcl.util.SwingUtils; +import org.jackhuang.hmcl.util.WineDetector; import javax.swing.*; import java.net.URISyntaxException; @@ -125,6 +126,17 @@ private static void checkDirectoryPath() { } } + private static void checkWine() { + if (WineDetector.isRunningUnderWine()) { + SwingUtils.initLookAndFeel(); + ResourceBundle resourceBundle = BootProperties.getResourceBundle(); + String warningTitle = resourceBundle.getString("boot.message.warning"); + String warningMessage = resourceBundle.getString("boot.wine_warning"); + System.err.println("HMCL is running under Wine or its distributions!"); + SwingUtils.showWarningDialog(warningMessage, warningTitle); + } + } + private static String getThisJarPath() { ProtectionDomain protectionDomain = Main.class.getProtectionDomain(); if (protectionDomain == null) @@ -143,6 +155,7 @@ private static String getThisJarPath() { public static void main(String[] args) throws Throwable { checkDirectoryPath(); + checkWine(); if (getJavaFeatureVersion(System.getProperty("java.version")) >= MINIMUM_JAVA_VERSION) { EntryPoint.main(args); } else { diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java new file mode 100644 index 0000000000..9eb5b9ca8c --- /dev/null +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java @@ -0,0 +1,39 @@ +package org.jackhuang.hmcl.util; + +public final class WineDetector { + public static boolean isRunningUnderWine() { + String osName = System.getProperty("os.name", ""); + if (!osName.toLowerCase(java.util.Locale.ROOT).contains("win")) { + return false; + } + + return checkWineRegistryKey() && checkWineEnv(); + } + + private static boolean checkWineRegistryKey() { + Process process = null; + try { + process = Runtime.getRuntime().exec( + new String[]{"reg", "query", "HKLM\\Software\\Wine", "/reg:64"} + ); + if (!process.waitFor(800, java.util.concurrent.TimeUnit.MILLISECONDS)) { + process.destroyForcibly(); + return false; + } + return process.exitValue() == 0; + } catch (Exception e) { + return false; + } finally { + if (process != null && process.isAlive()) { + process.destroy(); + } + } + } + + private static boolean checkWineEnv() { + return System.getenv("WINEPREFIX") != null; + } + + private WineDetector() { + } +} \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index c6b43070ef..f84766126b 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -18,5 +18,7 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? +boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues. -boot.message.error=Error \ No newline at end of file +boot.message.error=Error +boot.message.warning=Warning \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 6ac05b2c26..2e81ab4700 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -19,4 +19,5 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.message.error=错误 \ No newline at end of file +boot.message.error=错误 +boot.message.warning=警告 \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index 78c25c4149..fdb58fe14f 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -20,3 +20,4 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行, boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? boot.message.error=錯誤 +boot.message.warning=警告 From 0cde6b7036493895065bb43649edf55e48e27b72 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Thu, 12 Feb 2026 02:40:11 +0800 Subject: [PATCH 02/15] update --- .../org/jackhuang/hmcl/util/WineDetector.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java index 9eb5b9ca8c..d5e3c374a6 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java @@ -1,3 +1,21 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2026 huangyuhui and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.jackhuang.hmcl.util; public final class WineDetector { From 98fb634cb91b927f546084f5f2d1088e486ad44b Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Thu, 12 Feb 2026 02:41:20 +0800 Subject: [PATCH 03/15] update --- .../src/main/java/org/jackhuang/hmcl/util/WineDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java index d5e3c374a6..ae99432a96 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java @@ -54,4 +54,4 @@ private static boolean checkWineEnv() { private WineDetector() { } -} \ No newline at end of file +} From 5b52991a1809eb8580bbf1a8b03a448086bc7c66 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Thu, 12 Feb 2026 13:06:14 +0800 Subject: [PATCH 04/15] update --- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 1 + HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 2e81ab4700..b193e745a4 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,6 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? +boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n它将继续启动,但您可能会遇到不少问题。 boot.message.error=错误 boot.message.warning=警告 \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index fdb58fe14f..cdd5b26e18 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,6 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? +boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平台的,我們建議您直接在主機系統上執行。\n它仍會繼續啟動,但您可能會遇到諸多問題。 boot.message.error=錯誤 boot.message.warning=警告 From 50f543641bae00531c8d9460c6d5163806231f72 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:49:39 +0800 Subject: [PATCH 05/15] update --- HMCLBoot/src/main/resources/assets/lang/boot.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index f84766126b..69a2879f6c 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? -boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues. +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise. boot.message.error=Error boot.message.warning=Warning \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index b193e745a4..05566f8733 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n它将继续启动,但您可能会遇到不少问题。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n您可以继续启动,但可能会遇到一些问题。 boot.message.error=错误 boot.message.warning=警告 \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index cdd5b26e18..d69cbc24ed 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? -boot.wine_warning=You are currently running HMCL under Wine or one of its distributions.\nHMCL is cross-platform; we recommend running it directly on your host OS.\nIt will continue to launch, but you may encounter some issues.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平台的,我們建議您直接在主機系統上執行。\n它仍會繼續啟動,但您可能會遇到諸多問題。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n您可以繼續啟動,但可能會遇到一些問題。 boot.message.error=錯誤 boot.message.warning=警告 From 20ed61ad0c22b9d0f974afaafd24ebe684f8e73d Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 03:24:41 +0800 Subject: [PATCH 06/15] update --- HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java | 8 +++++++- HMCLBoot/src/main/resources/assets/lang/boot.properties | 2 +- .../src/main/resources/assets/lang/boot_zh.properties | 2 +- .../main/resources/assets/lang/boot_zh_Hant.properties | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java index 6b59ae7bc1..27ec44ef3d 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java @@ -133,7 +133,13 @@ private static void checkWine() { String warningTitle = resourceBundle.getString("boot.message.warning"); String warningMessage = resourceBundle.getString("boot.wine_warning"); System.err.println("HMCL is running under Wine or its distributions!"); - SwingUtils.showWarningDialog(warningMessage, warningTitle); + + int result = JOptionPane.showOptionDialog(null, warningMessage, warningTitle, JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE, null, null, null); + + if (result == JOptionPane.CANCEL_OPTION) { + System.exit(1); + } } } diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 69a2879f6c..075f2729a4 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise. +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise. boot.message.error=Error boot.message.warning=Warning \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 05566f8733..3514e0f563 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n您可以继续启动,但可能会遇到一些问题。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下 “确定” 以继续,但可能会遇到一些问题。 boot.message.error=错误 boot.message.warning=警告 \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index d69cbc24ed..e407abc1a3 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nYou may continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n您可以繼續啟動,但可能會遇到一些問題。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下 “確定” 以繼續,但可能會遇到一些問題。 boot.message.error=錯誤 boot.message.warning=警告 From bfece6f2261f8fc8f7aaf3a58b9a931648011f2b Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 03:26:08 +0800 Subject: [PATCH 07/15] update --- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 3514e0f563..a8e3399361 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下 “确定” 以继续,但可能会遇到一些问题。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下 “确定” 以继续,但它可能会遇到一些问题。 boot.message.error=错误 boot.message.warning=警告 \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index e407abc1a3..d900e7501b 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下 “確定” 以繼續,但可能會遇到一些問題。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下 “確定” 以繼續,但它可能會遇到一些問題。 boot.message.error=錯誤 boot.message.warning=警告 From 6458d8b16fb033197b19d9ca75d5692172d5101e Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 03:38:14 +0800 Subject: [PATCH 08/15] update --- HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java | 2 +- HMCLBoot/src/main/resources/assets/lang/boot.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java index 27ec44ef3d..49fe2c7b6b 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java @@ -132,7 +132,7 @@ private static void checkWine() { ResourceBundle resourceBundle = BootProperties.getResourceBundle(); String warningTitle = resourceBundle.getString("boot.message.warning"); String warningMessage = resourceBundle.getString("boot.wine_warning"); - System.err.println("HMCL is running under Wine or its distributions!"); + System.err.println("HMCL is running under Wine or its distributions! It's not recommended!"); int result = JOptionPane.showOptionDialog(null, warningMessage, warningTitle, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 075f2729a4..054f060f53 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -21,4 +21,4 @@ boot.manual_update=HMCL cannot complete automatic updates in the current environ boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise. boot.message.error=Error -boot.message.warning=Warning \ No newline at end of file +boot.message.warning=Warning diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index a8e3399361..4be29e197e 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -21,4 +21,4 @@ boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下 boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下 “确定” 以继续,但它可能会遇到一些问题。 boot.message.error=错误 -boot.message.warning=警告 \ No newline at end of file +boot.message.warning=警告 From 90828f27819832a595f80679681ca8246f08e3f3 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 14:13:41 +0800 Subject: [PATCH 09/15] l10n update --- HMCLBoot/src/main/resources/assets/lang/boot.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 054f060f53..5547d7c620 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise. +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise. boot.message.error=Error boot.message.warning=Warning diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 4be29e197e..c3a1641992 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下 “确定” 以继续,但它可能会遇到一些问题。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下“确定”以继续,但请注意,此操作可能会引发一些问题。 boot.message.error=错误 boot.message.warning=警告 diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index d900e7501b..01b684d440 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,7 +18,7 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress “OK” to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下 “確定” 以繼續,但它可能會遇到一些問題。 +boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下「確定」以繼續,但請注意,此操作可能會引發一些問題。 boot.message.error=錯誤 boot.message.warning=警告 From b37081152b08d52172aa3db177f340141de48a43 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 22:15:42 +0800 Subject: [PATCH 10/15] move --- .../java/org/jackhuang/hmcl/EntryPoint.java | 20 ++++++++++++++++++- .../resources/assets/lang/I18N.properties | 1 + .../resources/assets/lang/I18N_zh.properties | 1 + .../assets/lang/I18N_zh_CN.properties | 1 + .../main/java/org/jackhuang/hmcl/Main.java | 19 ------------------ .../resources/assets/lang/boot.properties | 1 - .../resources/assets/lang/boot_zh.properties | 1 - .../assets/lang/boot_zh_Hant.properties | 1 - .../hmcl/util/platform}/WineDetector.java | 5 ++--- 9 files changed, 24 insertions(+), 26 deletions(-) rename {HMCLBoot/src/main/java/org/jackhuang/hmcl/util => HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform}/WineDetector.java (91%) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java index 83623c86d0..378ead796d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java @@ -24,7 +24,9 @@ import org.jackhuang.hmcl.util.io.FileUtils; import org.jackhuang.hmcl.util.io.JarUtils; import org.jackhuang.hmcl.util.platform.OperatingSystem; +import org.jackhuang.hmcl.util.platform.WineDetector; +import javax.swing.*; import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -46,9 +48,11 @@ public static void main(String[] args) { System.getProperties().putIfAbsent("javafx.autoproxy.disable", "true"); System.getProperties().putIfAbsent("http.agent", "HMCL/" + Metadata.VERSION); - createHMCLDirectories(); LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs")); + checkWine(); + + createHMCLDirectories(); setupJavaFXVMOptions(); if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS) { @@ -223,6 +227,20 @@ private static void verifyJavaFX() { } } + private static void checkWine() { + if (WineDetector.isRunningUnderWine()) { + SwingUtils.initLookAndFeel(); + LOG.error("HMCL is running under Wine or its distributions!"); + + int result = JOptionPane.showOptionDialog(null, i18n("fatal.wine_warning"), i18n("message.warning"), JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE, null, null, null); + + if (result == JOptionPane.CANCEL_OPTION) { + exit(1); + } + } + } + private static void addEnableNativeAccess() { if (JavaRuntime.CURRENT_VERSION > 21) { try { diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 2f682895b8..e0bf005d36 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -459,6 +459,7 @@ fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher has provided \n\ If you are using the Qualcomm platform, you may need to install the OpenGL Compatibility Pack before playing games.\n\ Click the link to navigate to the Microsoft Store and install the compatibility pack. +fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise. file=File diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 94b50e0302..8101f42cf6 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -420,6 +420,7 @@ fatal.unsupported_platform=Minecraft 尚未對您的平臺提供完善支援, fatal.unsupported_platform.loongarch=Hello Minecraft! Launcher 已為龍芯提供支援。\n如果遇到問題,你可以點擊右上角幫助按鈕進行求助。 fatal.unsupported_platform.macos_arm64=Hello Minecraft! Launcher 已為 Apple Silicon 平臺提供支援。使用 ARM 原生 Java 啟動遊戲以獲得更流暢的遊戲體驗。\n如果你在遊戲中遭遇問題,使用 x86-64 架構的 Java 啟動遊戲可能有更好的相容性。 fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher 已為 Windows on Arm 平臺提供原生支援。如果你在遊戲中遭遇問題,請嘗試使用 x86 架構的 Java 啟動遊戲。\n\n如果你正在使用高通平臺,你可能需要安裝 OpenGL 相容包後才能進行遊戲。點擊連結前往 Microsoft Store 安裝相容包。 +fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下「確定」以繼續,但請注意,此操作可能會引發一些問題。 file=檔案 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index c85d174044..8d83b13d15 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -424,6 +424,7 @@ fatal.unsupported_platform=Minecraft 尚未对你的平台提供完善支持, fatal.unsupported_platform.loongarch=Hello Minecraft! Launcher 已为龙芯提供支持。\n如果遇到问题,你可以点击右上角帮助按钮进行求助。 fatal.unsupported_platform.macos_arm64=Hello Minecraft! Launcher 已为 Apple Silicon 平台提供支持。使用 ARM 原生 Java 启动游戏以获得更流畅的游戏体验。\n如果你在游戏中遇到问题,使用 x86-64 架构的 Java 启动游戏可能有更好的兼容性。\n如遇到问题,你可以点击右上角帮助按钮进行求助。 fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher 已为 Windows on Arm 平台提供原生支持。如果你在游戏中遇到问题,请尝试使用 x86 架构的 Java 启动游戏。\n如果你正在使用 高通 平台,你可能需要安装 OpenGL 兼容包 后才能进行游戏。点击链接前往 Microsoft Store 安装兼容包。\n如遇到问题,你可以点击右上角帮助按钮进行求助。 +fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下“确定”以继续,但请注意,此操作可能会引发一些问题。 file=文件 diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java index 49fe2c7b6b..adc1f208b5 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java @@ -18,7 +18,6 @@ package org.jackhuang.hmcl; import org.jackhuang.hmcl.util.SwingUtils; -import org.jackhuang.hmcl.util.WineDetector; import javax.swing.*; import java.net.URISyntaxException; @@ -126,23 +125,6 @@ private static void checkDirectoryPath() { } } - private static void checkWine() { - if (WineDetector.isRunningUnderWine()) { - SwingUtils.initLookAndFeel(); - ResourceBundle resourceBundle = BootProperties.getResourceBundle(); - String warningTitle = resourceBundle.getString("boot.message.warning"); - String warningMessage = resourceBundle.getString("boot.wine_warning"); - System.err.println("HMCL is running under Wine or its distributions! It's not recommended!"); - - int result = JOptionPane.showOptionDialog(null, warningMessage, warningTitle, JOptionPane.OK_CANCEL_OPTION, - JOptionPane.WARNING_MESSAGE, null, null, null); - - if (result == JOptionPane.CANCEL_OPTION) { - System.exit(1); - } - } - } - private static String getThisJarPath() { ProtectionDomain protectionDomain = Main.class.getProtectionDomain(); if (protectionDomain == null) @@ -161,7 +143,6 @@ private static String getThisJarPath() { public static void main(String[] args) throws Throwable { checkDirectoryPath(); - checkWine(); if (getJavaFeatureVersion(System.getProperty("java.version")) >= MINIMUM_JAVA_VERSION) { EntryPoint.main(args); } else { diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 5547d7c620..6b94898201 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -18,7 +18,6 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise. boot.message.error=Error boot.message.warning=Warning diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index c3a1641992..f636bbfc17 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -18,7 +18,6 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下“确定”以继续,但请注意,此操作可能会引发一些问题。 boot.message.error=错误 boot.message.warning=警告 diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index 01b684d440..fdb58fe14f 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -18,7 +18,6 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行,但依然支援使用 Java 6~16 啟動遊戲。請安裝最新版本的 Java 再嘗試開啟 HMCL。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。 boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? -boot.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下「確定」以繼續,但請注意,此操作可能會引發一些問題。 boot.message.error=錯誤 boot.message.warning=警告 diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java similarity index 91% rename from HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java rename to HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java index ae99432a96..bc68411ae9 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/util/WineDetector.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java @@ -16,12 +16,11 @@ * along with this program. If not, see . */ -package org.jackhuang.hmcl.util; +package org.jackhuang.hmcl.util.platform; public final class WineDetector { public static boolean isRunningUnderWine() { - String osName = System.getProperty("os.name", ""); - if (!osName.toLowerCase(java.util.Locale.ROOT).contains("win")) { + if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { return false; } From 85547f370235a9344bbdc839e2d53a0464b80483 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 22:17:22 +0800 Subject: [PATCH 11/15] update --- HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java index 378ead796d..deed1b0327 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java @@ -230,7 +230,7 @@ private static void verifyJavaFX() { private static void checkWine() { if (WineDetector.isRunningUnderWine()) { SwingUtils.initLookAndFeel(); - LOG.error("HMCL is running under Wine or its distributions!"); + LOG.warning("HMCL is running under Wine or its distributions!"); int result = JOptionPane.showOptionDialog(null, i18n("fatal.wine_warning"), i18n("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); From bda7c896edada97554a988f5ed74f727c93f56ce Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 22:19:43 +0800 Subject: [PATCH 12/15] update --- HMCLBoot/src/main/resources/assets/lang/boot.properties | 1 - HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 1 - HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties | 1 - 3 files changed, 3 deletions(-) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 6b94898201..2fb5ad5908 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -20,4 +20,3 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still s boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? boot.message.error=Error -boot.message.warning=Warning diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index f636bbfc17..4df4afabdc 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -20,4 +20,3 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行, boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? boot.message.error=错误 -boot.message.warning=警告 diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties index fdb58fe14f..78c25c4149 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh_Hant.properties @@ -20,4 +20,3 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能執行, boot.manual_update=HMCL 在當前環境無法完成自動更新,請手動下載最新版本的 HMCL。\n是否前往下載頁面? boot.message.error=錯誤 -boot.message.warning=警告 From 1a94affccf1b49280bb4bc436a8a0df0b95d0085 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 14 Feb 2026 22:20:55 +0800 Subject: [PATCH 13/15] update --- HMCLBoot/src/main/resources/assets/lang/boot.properties | 2 +- HMCLBoot/src/main/resources/assets/lang/boot_zh.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HMCLBoot/src/main/resources/assets/lang/boot.properties b/HMCLBoot/src/main/resources/assets/lang/boot.properties index 2fb5ad5908..c6b43070ef 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot.properties @@ -19,4 +19,4 @@ boot.unsupported_java_version=HMCL requires Java 17 or later to run, but still supports launching games with Java 6~16. Please install the latest version of Java and try opening HMCL again.\nYou can keep your old version of Java. HMCL can detect and manage multiple Java installations, and will automatically select the appropriate Java version for your game. boot.manual_update=HMCL cannot complete automatic updates in the current environment. Please download the latest version of HMCL manually.\nWould you like to go to the download page? -boot.message.error=Error +boot.message.error=Error \ No newline at end of file diff --git a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties index 4df4afabdc..6ac05b2c26 100644 --- a/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties +++ b/HMCLBoot/src/main/resources/assets/lang/boot_zh.properties @@ -19,4 +19,4 @@ boot.unsupported_java_version=HMCL 需要 Java 17 或更高版本才能运行,但依然支持使用 Java 6~16 启动游戏。请安装最新版本的 Java 再尝试启动 HMCL。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。 boot.manual_update=HMCL 在当前环境无法完成自动更新,请手动下载最新版本的 HMCL。\n是否前往下载页面? -boot.message.error=错误 +boot.message.error=错误 \ No newline at end of file From 54ce211a875b05cd622c58e3e85b0b75912fb876 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:46:10 +0800 Subject: [PATCH 14/15] update --- HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java | 2 +- .../org/jackhuang/hmcl/util/platform/WineDetector.java | 8 +++++--- 2 files changed, 6 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 deed1b0327..ef84614a2d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java @@ -228,7 +228,7 @@ private static void verifyJavaFX() { } private static void checkWine() { - if (WineDetector.isRunningUnderWine()) { + if (WineDetector.IN_WINE) { SwingUtils.initLookAndFeel(); LOG.warning("HMCL is running under Wine or its distributions!"); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java index bc68411ae9..268c4b9784 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java @@ -19,8 +19,10 @@ package org.jackhuang.hmcl.util.platform; public final class WineDetector { - public static boolean isRunningUnderWine() { - if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { + public static final boolean IN_WINE = isRunningUnderWine(); + + private static boolean isRunningUnderWine() { + if (OperatingSystem.CURRENT_OS != OperatingSystem.WINDOWS) { return false; } @@ -31,7 +33,7 @@ private static boolean checkWineRegistryKey() { Process process = null; try { process = Runtime.getRuntime().exec( - new String[]{"reg", "query", "HKLM\\Software\\Wine", "/reg:64"} + new String[]{"reg", "query", "HKLM\\Software\\Wine"} ); if (!process.waitFor(800, java.util.concurrent.TimeUnit.MILLISECONDS)) { process.destroyForcibly(); From af5b6e353de1e807a1eb3f416531eae72eeb2ae8 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Mon, 16 Feb 2026 23:17:35 +0800 Subject: [PATCH 15/15] update --- .../java/org/jackhuang/hmcl/util/platform/WineDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java index 268c4b9784..69b9e0766f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java @@ -44,7 +44,7 @@ private static boolean checkWineRegistryKey() { return false; } finally { if (process != null && process.isAlive()) { - process.destroy(); + process.destroyForcibly(); } } }