From e71193b69ba426f92c1d07cd91fc25e32a7b70d9 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 25 Oct 2024 19:45:42 +0800 Subject: [PATCH 1/2] fix GameLauncher --- .../src/forge/app/GameLauncher.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/forge-gui-mobile-dev/src/forge/app/GameLauncher.java b/forge-gui-mobile-dev/src/forge/app/GameLauncher.java index 046c6c126ba..a924eaee7da 100644 --- a/forge-gui-mobile-dev/src/forge/app/GameLauncher.java +++ b/forge-gui-mobile-dev/src/forge/app/GameLauncher.java @@ -16,19 +16,7 @@ public class GameLauncher { public GameLauncher(final String versionString) { - // Set this to "true" to make the mobile game port run as a full-screen desktop application - boolean desktopMode = true;//cmd.hasOption("fullscreen"); - // Set this to the location where you want the mobile game port to look for assets when working as a full-screen desktop application - // (uncomment the bottom version and comment the top one to load the res folder from the current folder the .jar is in if you would - // like to make the game load from a desktop game folder configuration). - //String desktopModeAssetsDir = "../forge-gui/"; - String desktopModeAssetsDir = "./"; - if (!Files.exists(Paths.get(desktopModeAssetsDir + "res"))) - desktopModeAssetsDir = "../forge-gui/";//try IDE run - - String assetsDir = "./"; - if (!Files.exists(Paths.get(assetsDir + "res"))) - assetsDir = "../forge-gui/"; + String assetsDir = Files.exists(Paths.get("./res")) ? "./" : "../forge-gui/"; // Place the file "switch_orientation.ini" to your assets folder to make the game switch to landscape orientation (unless desktopMode = true) String switchOrientationFile = assetsDir + "switch_orientation.ini"; @@ -39,7 +27,7 @@ public GameLauncher(final String versionString) { Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setResizable(false); ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice - desktopMode ? desktopModeAssetsDir : assetsDir, false, false, 0, false, 0, "", ""); + assetsDir, false, false, 0, false, 0, "", ""); if (Config.instance().getSettingData().fullScreen) { config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode()); config.setAutoIconify(true); @@ -58,8 +46,7 @@ public boolean closeRequested() { } }); - if (desktopMode) - config.setHdpiMode(HdpiMode.Logical); + config.setHdpiMode(HdpiMode.Logical); new Lwjgl3Application(start, config); } From ca6c105aff5411140b6e90a0d7f7c96b2c6565a7 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 25 Oct 2024 19:50:44 +0800 Subject: [PATCH 2/2] move check --- forge-gui-mobile/src/forge/assets/AssetsDownloader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forge-gui-mobile/src/forge/assets/AssetsDownloader.java b/forge-gui-mobile/src/forge/assets/AssetsDownloader.java index a7b00d4ac43..ff736e80d99 100644 --- a/forge-gui-mobile/src/forge/assets/AssetsDownloader.java +++ b/forge-gui-mobile/src/forge/assets/AssetsDownloader.java @@ -42,8 +42,7 @@ public static void checkForUpdates(boolean exited, Runnable runnable) { return; } } - //currently for desktop/mobile-dev release on github - final String releaseTag = Forge.getDeviceAdapter().getReleaseTag(GITHUB_RELEASES_URL_ATOM); + final String packageSize = GuiBase.isAndroid() ? "160MB" : "270MB"; final String apkSize = "12MB"; @@ -58,6 +57,8 @@ public static void checkForUpdates(boolean exited, Runnable runnable) { String message; boolean connectedToInternet = Forge.getDeviceAdapter().isConnectedToInternet(); if (connectedToInternet) { + //currently for desktop/mobile-dev release on github + final String releaseTag = Forge.getDeviceAdapter().getReleaseTag(GITHUB_RELEASES_URL_ATOM); try { URL versionUrl = new URL(versionText); String version = FileUtil.readFileToString(versionUrl);