From a0de377ccfdc40e44a3d2d8a4a5a2f17cff0afe2 Mon Sep 17 00:00:00 2001 From: Darien Johnson <84008186+CADIndie@users.noreply.github.com> Date: Wed, 18 Dec 2024 01:41:48 -0500 Subject: [PATCH] Revert "Implement Config System" This reverts commit ece0ce6f92fb14d58fbe0a4ea4b01cdb3748cb47. --- src/main/java/pojlib/API.java | 12 ++++++ src/main/java/pojlib/util/ConfigUtil.java | 39 ------------------- src/main/java/pojlib/util/Constants.java | 1 - src/main/java/pojlib/util/JREUtils.java | 7 ++-- .../pojlib/util/json/MinecraftInstances.java | 3 +- 5 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 src/main/java/pojlib/util/ConfigUtil.java diff --git a/src/main/java/pojlib/API.java b/src/main/java/pojlib/API.java index c7c5eaa8..9d09fc7e 100644 --- a/src/main/java/pojlib/API.java +++ b/src/main/java/pojlib/API.java @@ -7,13 +7,17 @@ import androidx.annotation.Nullable; +import com.google.gson.JsonObject; + import pojlib.account.MinecraftAccount; +import pojlib.account.Msa; import pojlib.util.Logger; import pojlib.util.json.MinecraftInstances; import pojlib.util.Constants; import pojlib.account.LoginHelper; import java.io.IOException; +import java.util.Date; /** * This class is the only class used by the launcher to communicate and talk to pojlib. This keeps pojlib and launcher separate. @@ -24,17 +28,25 @@ public class API { public static String msaMessage = ""; public static String model = "Quest"; + private static boolean hasQueried = false; + private static JsonObject initialResponse; public static boolean finishedDownloading = true; public static boolean ignoreInstanceName; + public static boolean customRAMValue = false; public static double downloadStatus = 0; public static String currentDownload = ""; public static String profileImage; public static String profileName; public static String profileUUID; + public static String memoryValue = "1800"; + public static boolean developerMods; public static MinecraftAccount currentAcc; public static boolean isDemoMode; public static MinecraftInstances.Instance currentInstance; + public static boolean advancedDebugger; + + /** * Add a mod to an instance * diff --git a/src/main/java/pojlib/util/ConfigUtil.java b/src/main/java/pojlib/util/ConfigUtil.java deleted file mode 100644 index 8322b882..00000000 --- a/src/main/java/pojlib/util/ConfigUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package pojlib.util; - -import java.io.File; -import java.util.ArrayList; - -public class ConfigUtil { - - public static Config config; - public static File configFile = new File(Constants.CONFIG_PATH); - - public static void LoadConfig() { - if (configFile.exists()) { - config = GsonUtils.jsonFileToObject(configFile.getAbsolutePath(), Config.class); - } else { - config = new Config(); - GsonUtils.objectToJsonFile(configFile.getAbsolutePath(), config); - } - } - - public static void SaveConfig() { - GsonUtils.objectToJsonFile(configFile.getAbsolutePath(), config); - LoadConfig(); - } - - public static class Config { - public boolean acceptedLegal = false; - public boolean setDevMods = false; - public boolean setCustomRAM = false; - public String customRAMValue = "2048"; - public int lastSelectedInstance = 0; - public int lastSelectedAccount = 0; - public ArrayList accounts = new ArrayList<>(); - } - - public static class Accounts { - public String username; - public String uuid; - } -} \ No newline at end of file diff --git a/src/main/java/pojlib/util/Constants.java b/src/main/java/pojlib/util/Constants.java index 3e4a6d00..45a4ad27 100644 --- a/src/main/java/pojlib/util/Constants.java +++ b/src/main/java/pojlib/util/Constants.java @@ -29,5 +29,4 @@ public class Constants { public static String MINOTAR_URL = "https://minotar.net"; public static String USER_HOME = new File(Environment.getExternalStorageDirectory(),"Android/data/com.qcxr.qcxr/files").getAbsolutePath(); - public static String CONFIG_PATH = USER_HOME + "/config.json"; } \ No newline at end of file diff --git a/src/main/java/pojlib/util/JREUtils.java b/src/main/java/pojlib/util/JREUtils.java index 30bad5f1..1843f2ad 100644 --- a/src/main/java/pojlib/util/JREUtils.java +++ b/src/main/java/pojlib/util/JREUtils.java @@ -181,10 +181,9 @@ public static int launchJavaVM(final Activity activity, final List JVMAr //Add automatically generated args - // TODO: Let user set Xmx AND Xms - if (ConfigUtil.config.setCustomRAM) { - userArgs.add("-Xms" + ConfigUtil.config.customRAMValue + "M"); - userArgs.add("-Xmx" + ConfigUtil.config.customRAMValue + "M"); + if (API.customRAMValue) { + userArgs.add("-Xms" + API.memoryValue + "M"); + userArgs.add("-Xmx" + API.memoryValue + "M"); } else { if (API.model.equals("Meta Quest Pro") || API.model.equals("Oculus Headset1")) { userArgs.add("-Xms" + 2048 + "M"); diff --git a/src/main/java/pojlib/util/json/MinecraftInstances.java b/src/main/java/pojlib/util/json/MinecraftInstances.java index 62533d31..5f1d2844 100644 --- a/src/main/java/pojlib/util/json/MinecraftInstances.java +++ b/src/main/java/pojlib/util/json/MinecraftInstances.java @@ -10,7 +10,6 @@ import pojlib.account.MinecraftAccount; import pojlib.API; import pojlib.InstanceHandler; -import pojlib.util.ConfigUtil; import pojlib.util.Constants; import pojlib.util.download.DownloadManager; import pojlib.util.download.DownloadUtils; @@ -78,7 +77,7 @@ private ModsJson parseModsJson(String jsonPath) { private ModsJson downloadCurrentModsJson(String userHome) throws Exception { File mods = new File(userHome + "/new_mods.json"); - if(ConfigUtil.config.setDevMods) { + if(API.developerMods) { DownloadUtils.downloadFile(InstanceHandler.DEV_MODS, mods, new DownloadManager(1)); } else { DownloadUtils.downloadFile(InstanceHandler.MODS, mods, new DownloadManager(1));