From 004ee7673b821daeae5955acf3c8cabc6ef1f1f7 Mon Sep 17 00:00:00 2001 From: Darien Johnson <84008186+CADIndie@users.noreply.github.com> Date: Wed, 10 Apr 2024 00:22:21 -0400 Subject: [PATCH 1/2] Fix Meta Skill Issue | Update Parser --- src/main/java/pojlib/account/MinecraftAccount.java | 6 ++++-- src/main/java/pojlib/api/API_V1.java | 8 +++++--- src/main/java/pojlib/instance/MinecraftInstance.java | 12 ++++++------ src/main/java/pojlib/util/CoreMods.java | 2 -- src/main/java/pojlib/util/CustomMods.java | 2 +- src/main/java/pojlib/util/JREUtils.java | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/pojlib/account/MinecraftAccount.java b/src/main/java/pojlib/account/MinecraftAccount.java index e428d689..3b5287b8 100644 --- a/src/main/java/pojlib/account/MinecraftAccount.java +++ b/src/main/java/pojlib/account/MinecraftAccount.java @@ -2,6 +2,8 @@ import static pojlib.account.Msa.checkMcProfile; +import android.app.Activity; + import com.google.gson.Gson; import org.json.JSONException; @@ -33,8 +35,8 @@ public static MinecraftAccount login(String gameDir, String[] response) throws I return account; } - public static boolean logout(String path) { - File accountFile = new File(path + "/account.json"); + public static boolean logout(Activity activity) { + File accountFile = new File(activity.getFilesDir() + "/account.json"); return accountFile.delete(); } diff --git a/src/main/java/pojlib/api/API_V1.java b/src/main/java/pojlib/api/API_V1.java index b68cbfb5..1a453c71 100644 --- a/src/main/java/pojlib/api/API_V1.java +++ b/src/main/java/pojlib/api/API_V1.java @@ -54,6 +54,7 @@ public class API_V1 { public static String memoryValue = "1800"; public static boolean developerMods; public static MinecraftAccount currentAcc; + public static boolean advancedDebugger; @@ -126,11 +127,11 @@ public static void launchInstance(Activity activity, MinecraftAccount account, M /** * Logs the user out * - * @param home The base directory where minecraft should be setup + * @param activity The base directory where minecraft should be setup * @return True if logout was successful */ - public static boolean logout(String home) { - return MinecraftAccount.logout(home); + public static boolean logout(Activity activity) { + return MinecraftAccount.logout(activity); } public static void login(Activity activity) @@ -159,6 +160,7 @@ public static void login(Activity activity) API_V1.profileName = API_V1.currentAcc.username; } } + LoginHelper.beginLogin(activity); } } diff --git a/src/main/java/pojlib/instance/MinecraftInstance.java b/src/main/java/pojlib/instance/MinecraftInstance.java index d420eb65..a4142056 100644 --- a/src/main/java/pojlib/instance/MinecraftInstance.java +++ b/src/main/java/pojlib/instance/MinecraftInstance.java @@ -191,7 +191,7 @@ public void updateOrDownloadMods() { if(customMods.exists()) { assert customModsObj != null; for(CustomMods.InstanceMods instMods : customModsObj.instances) { - if(!instMods.version.equals(this.versionName)) { + if(!instMods.name.equals(this.versionName)) { continue; } for(CustomMods.ModInfo info : instMods.mods) { @@ -249,7 +249,7 @@ public void addCustomMod(String name, String version, String url) { CustomMods mods = new CustomMods(); mods.instances = new CustomMods.InstanceMods[1]; mods.instances[0] = new CustomMods.InstanceMods(); - mods.instances[0].version = this.versionName; + mods.instances[0].name = this.versionName; mods.instances[0].mods = new CustomMods.ModInfo[1]; mods.instances[0].mods[0] = new CustomMods.ModInfo(); mods.instances[0].mods[0].name = name; @@ -262,7 +262,7 @@ public void addCustomMod(String name, String version, String url) { CustomMods mods = GsonUtils.jsonFileToObject(customMods.getPath(), CustomMods.class); for(CustomMods.InstanceMods instance : mods.instances) { - if(instance.version.equals(this.versionName)) { + if(instance.name.equals(this.versionName)) { ArrayList modInfoArray = new ArrayList<>(Arrays.asList(instance.mods)); CustomMods.ModInfo info = new CustomMods.ModInfo(); info.name = name; @@ -282,7 +282,7 @@ public void addCustomMod(String name, String version, String url) { // If instance does not exist in file, create it ArrayList instanceInfo = new ArrayList<>(Arrays.asList(mods.instances)); CustomMods.InstanceMods instMods = new CustomMods.InstanceMods(); - instMods.version = this.versionName; + instMods.name = this.versionName; instMods.mods = new CustomMods.ModInfo[1]; instMods.mods[0] = new CustomMods.ModInfo(); instMods.mods[0].name = name; @@ -304,7 +304,7 @@ public boolean hasCustomMod(String name) throws IOException { CustomMods mods = GsonUtils.jsonFileToObject(customMods.getPath(), CustomMods.class); assert mods != null; for(CustomMods.InstanceMods instance : mods.instances) { - if(instance.version.equals(this.versionName)) { + if(instance.name.equals(this.versionName)) { for (CustomMods.ModInfo info : instance.mods) { // Check if core mod is already included File modsOld = new File(Constants.USER_HOME + "/mods.json"); @@ -355,7 +355,7 @@ public boolean removeMod(String name) { CustomMods mods = GsonUtils.jsonFileToObject(customMods.getAbsolutePath(), CustomMods.class); assert mods != null; for(CustomMods.InstanceMods instance : mods.instances) { - if(instance.version.equals(this.versionName)) { + if(instance.name.equals(this.versionName)) { for (CustomMods.ModInfo info : instance.mods) { if(info.name.equals(name)) { ArrayList modInfoArray = new ArrayList<>(Arrays.asList(instance.mods)); diff --git a/src/main/java/pojlib/util/CoreMods.java b/src/main/java/pojlib/util/CoreMods.java index 87e98494..a4c6f2b4 100644 --- a/src/main/java/pojlib/util/CoreMods.java +++ b/src/main/java/pojlib/util/CoreMods.java @@ -1,7 +1,5 @@ package pojlib.util; -import java.util.List; - public class CoreMods { public Version[] versions; diff --git a/src/main/java/pojlib/util/CustomMods.java b/src/main/java/pojlib/util/CustomMods.java index e53275ec..6d35787a 100644 --- a/src/main/java/pojlib/util/CustomMods.java +++ b/src/main/java/pojlib/util/CustomMods.java @@ -4,7 +4,7 @@ public class CustomMods { public InstanceMods[] instances; public static class InstanceMods { - public String version; + public String name; public ModInfo[] mods; } diff --git a/src/main/java/pojlib/util/JREUtils.java b/src/main/java/pojlib/util/JREUtils.java index ac2ae201..ee620464 100644 --- a/src/main/java/pojlib/util/JREUtils.java +++ b/src/main/java/pojlib/util/JREUtils.java @@ -184,7 +184,7 @@ public static int launchJavaVM(final Activity activity, final List JVMAr userArgs.add("-Xms" + API_V1.memoryValue + "M"); userArgs.add("-Xmx" + API_V1.memoryValue + "M"); } else { - if (API_V1.model.equals("Meta Quest Pro")) { + if (API_V1.model.equals("Meta Quest Pro") || API_V1.model.equals("Oculus Headset1")) { userArgs.add("-Xms" + 4096 + "M"); userArgs.add("-Xmx" + 4096 + "M"); } else { From 0522ead1f7190eb19c72455983aaa26d42e0698e Mon Sep 17 00:00:00 2001 From: Darien Johnson <84008186+CADIndie@users.noreply.github.com> Date: Wed, 10 Apr 2024 02:53:43 -0400 Subject: [PATCH 2/2] Correct Account.json Path --- src/main/java/pojlib/account/MinecraftAccount.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pojlib/account/MinecraftAccount.java b/src/main/java/pojlib/account/MinecraftAccount.java index 3b5287b8..14ecd45a 100644 --- a/src/main/java/pojlib/account/MinecraftAccount.java +++ b/src/main/java/pojlib/account/MinecraftAccount.java @@ -36,7 +36,7 @@ public static MinecraftAccount login(String gameDir, String[] response) throws I } public static boolean logout(Activity activity) { - File accountFile = new File(activity.getFilesDir() + "/account.json"); + File accountFile = new File(activity.getFilesDir() + "/accounts/account.json"); return accountFile.delete(); }