From c0410c46ff7c53862c373faed94dc1ac468886c6 Mon Sep 17 00:00:00 2001 From: Glavo Date: Sun, 16 Feb 2025 21:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E6=97=A5=E5=BF=97=E4=B8=AD=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=20PROCESSOR=5FIDENTIFIER=20(#3619)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java | 8 +++++--- .../org/jackhuang/hmcl/countly/CrashReport.java | 4 ++-- .../jackhuang/hmcl/util/platform/Architecture.java | 13 ++----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java b/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java index 4bd9c2838..5fb654d02 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java @@ -225,8 +225,11 @@ public final class Launcher extends Application { LOG.info("Operating System: " + (OperatingSystem.OS_RELEASE_PRETTY_NAME == null ? OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION : OperatingSystem.OS_RELEASE_PRETTY_NAME + " (" + OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION + ')')); - LOG.info("System Architecture: " + Architecture.SYSTEM_ARCH_NAME); - LOG.info("Java Architecture: " + Architecture.CURRENT_ARCH_NAME); + if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { + LOG.info("Processor Identifier: " + System.getenv("PROCESSOR_IDENTIFIER")); + } + LOG.info("System Architecture: " + Architecture.SYSTEM_ARCH.getDisplayName()); + LOG.info("Java Architecture: " + Architecture.CURRENT_ARCH.getDisplayName()); LOG.info("Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor")); LOG.info("Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor")); LOG.info("Java Home: " + System.getProperty("java.home")); @@ -245,7 +248,6 @@ public final class Launcher extends Application { LOG.info("XDG Session Type: " + System.getenv("XDG_SESSION_TYPE")); LOG.info("XDG Current Desktop: " + System.getenv("XDG_CURRENT_DESKTOP")); } - launch(Launcher.class, args); } catch (Throwable e) { // Fucking JavaFX will suppress the exception and will break our crash reporter. CRASH_REPORTER.uncaughtException(Thread.currentThread(), e); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java b/HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java index 6c3847e58..8b1c96eea 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java @@ -43,8 +43,8 @@ public class CrashReport { stackTrace + "\n\n" + "-- System Details --\n" + " Operating System: " + OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION + "\n" + - " System Architecture: " + Architecture.SYSTEM_ARCH_NAME + "\n" + - " Java Architecture: " + Architecture.CURRENT_ARCH_NAME + "\n" + + " System Architecture: " + Architecture.SYSTEM_ARCH.getDisplayName() + "\n" + + " Java Architecture: " + Architecture.CURRENT_ARCH.getDisplayName() + "\n" + " Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n" + " Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n" + " JVM Max Memory: " + Runtime.getRuntime().maxMemory() + "\n" + diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Architecture.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Architecture.java index bd5fc6af6..a22b37139 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Architecture.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Architecture.java @@ -85,8 +85,6 @@ public enum Architecture { return this == X86 || this == X86_64; } - public static final String CURRENT_ARCH_NAME; - public static final String SYSTEM_ARCH_NAME; public static final Architecture CURRENT_ARCH; public static final Architecture SYSTEM_ARCH; @@ -192,8 +190,7 @@ public enum Architecture { } static { - CURRENT_ARCH_NAME = System.getProperty("os.arch"); - CURRENT_ARCH = parseArchName(CURRENT_ARCH_NAME); + CURRENT_ARCH = parseArchName(System.getProperty("os.arch")); String sysArchName = null; if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { @@ -219,12 +216,6 @@ public enum Architecture { } Architecture sysArch = parseArchName(sysArchName); - if (sysArch == UNKNOWN) { - SYSTEM_ARCH_NAME = CURRENT_ARCH_NAME; - SYSTEM_ARCH = CURRENT_ARCH; - } else { - SYSTEM_ARCH_NAME = sysArchName; - SYSTEM_ARCH = sysArch; - } + SYSTEM_ARCH = sysArch == UNKNOWN ? CURRENT_ARCH : sysArch; } }