From 62f5d398ca1b9c0f9522c66071e3be539589b1d2 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 26 Oct 2025 13:19:42 -0400 Subject: [PATCH] v3.3.0: fixed deprecated platform checking logic --- .../main/java/com/watabou/utils/DeviceCompat.java | 7 ++++--- .../desktop/DesktopLaunchValidator.java | 3 ++- .../desktop/DesktopLauncher.java | 15 +++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java b/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java index da5d7a3b7..952e00a56 100644 --- a/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java +++ b/SPD-classes/src/main/java/com/watabou/utils/DeviceCompat.java @@ -23,6 +23,7 @@ package com.watabou.utils; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; +import com.badlogic.gdx.utils.Os; import com.badlogic.gdx.utils.SharedLibraryLoader; import com.watabou.noosa.Game; @@ -35,15 +36,15 @@ public class DeviceCompat { } public static boolean isAndroid(){ - return SharedLibraryLoader.isAndroid; + return SharedLibraryLoader.os == Os.Android; } public static boolean isiOS(){ - return SharedLibraryLoader.isIos; + return SharedLibraryLoader.os == Os.IOS; } public static boolean isDesktop(){ - return SharedLibraryLoader.isWindows || SharedLibraryLoader.isMac || SharedLibraryLoader.isLinux; + return SharedLibraryLoader.os == Os.Windows || SharedLibraryLoader.os == Os.MacOsX || SharedLibraryLoader.os == Os.Linux; } public static boolean hasHardKeyboard(){ diff --git a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLaunchValidator.java b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLaunchValidator.java index 00506cd0c..b55f43f06 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLaunchValidator.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLaunchValidator.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.desktop; +import com.badlogic.gdx.utils.Os; import com.badlogic.gdx.utils.SharedLibraryLoader; import java.io.BufferedReader; @@ -36,7 +37,7 @@ public class DesktopLaunchValidator { public static boolean verifyValidJVMState(String[] args){ //mac computers require the -XstartOnFirstThread JVM argument - if (SharedLibraryLoader.isMac){ + if (SharedLibraryLoader.os == Os.MacOsX){ // If XstartOnFirstThread is present and enabled, we can return true if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + diff --git a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java index c0090d36b..b5c7c8f37 100644 --- a/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java +++ b/desktop/src/main/java/com/shatteredpixel/shatteredpixeldungeon/desktop/DesktopLauncher.java @@ -26,6 +26,8 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3FileHandle; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Preferences; +import com.badlogic.gdx.utils.Architecture; +import com.badlogic.gdx.utils.Os; import com.badlogic.gdx.utils.SharedLibraryLoader; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; @@ -54,10 +56,11 @@ public class DesktopLauncher { //detection for FreeBSD (which is equivalent to linux for us) //TODO might want to merge request this to libGDX if (System.getProperty("os.name").contains("FreeBSD")) { - SharedLibraryLoader.isLinux = true; + SharedLibraryLoader.os = Os.Linux; //this overrides incorrect values set in SharedLibraryLoader's static initializer - SharedLibraryLoader.isIos = false; - SharedLibraryLoader.is64Bit = System.getProperty("os.arch").contains("64") || System.getProperty("os.arch").startsWith("armv8"); + if (System.getProperty("os.arch").contains("64") || System.getProperty("os.arch").startsWith("armv8")){ + SharedLibraryLoader.bitness = Architecture.Bitness._64; + } } final String title; @@ -145,17 +148,17 @@ public class DesktopLauncher { String basePath = ""; Files.FileType baseFileType = null; - if (SharedLibraryLoader.isWindows) { + if (SharedLibraryLoader.os == Os.Windows) { if (System.getProperties().getProperty("os.name").equals("Windows XP")) { basePath = "Application Data/." + vendor + "/" + title + "/"; } else { basePath = "AppData/Roaming/." + vendor + "/" + title + "/"; } baseFileType = Files.FileType.External; - } else if (SharedLibraryLoader.isMac) { + } else if (SharedLibraryLoader.os == Os.MacOsX) { basePath = "Library/Application Support/" + title + "/"; baseFileType = Files.FileType.External; - } else if (SharedLibraryLoader.isLinux) { + } else if (SharedLibraryLoader.os == Os.Linux) { String XDGHome = System.getenv("XDG_DATA_HOME"); if (XDGHome == null) XDGHome = System.getProperty("user.home") + "/.local/share";