diff --git a/README.md b/README.md index 5681f54..3d9bd95 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ Either by double-clicking on it, or running `java -jar FoxLoader.jar` To run FoxLoader as a server just run `java -jar FoxLoader.jar --server` +Note: For PojavLauncher, click on "Install .jar" and the rest should be automatic, +only the Android version of PojavLauncher is supported. + ## Documentation For mixins usage check here: https://github.com/2xsaiko/mixin-cheatsheet diff --git a/dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy b/dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy index 5c5453a..7f5ec76 100644 --- a/dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy +++ b/dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy @@ -425,27 +425,6 @@ class GradlePlugin implements Plugin { try { System.out.println("Decompiling patched ReIndev " + logSideName) decompilerHelper.decompile(unpickedJarFox, sourcesJarFox, client) - } catch (OutOfMemoryError oom) { - boolean deleteFailed = false - try { - closeJarFileSystem(unpickedJarFox) - closeJarFileSystem(sourcesJarFox) - } finally { - if (!sourcesJarFox.delete()) { - sourcesJarFox.deleteOnExit() - deleteFailed = true - } - } - Throwable root = oom - while (root.getCause() != null) - root = root.getCause() - - root.initCause(deleteFailed ? // If delete failed, restart - UserMessage.UNRECOVERABLE_STATE_DECOMPILE : - client ? UserMessage.FAIL_DECOMPILE_CLIENT : - UserMessage.FAIL_DECOMPILE_SERVER) - if (deleteFailed) throw oom // If delete failed, we can't recover - oom.printStackTrace() } catch (Throwable throwable) { boolean deleteFailed = false try { @@ -470,10 +449,14 @@ class GradlePlugin implements Plugin { UserMessage.FAIL_DECOMPILE_SERVER) if (deleteFailed) { terminateProcess() + throw throwable } - throw throwable + if (throwable instanceof OutOfMemoryError || + throwable instanceof RuntimeException) { + throwable.printStackTrace() + } else throw throwable } - // Close not critical there, as if close fails, it's still not a big issue + // Close not critical there, as if close fails here, it's still not a big issue closeJarFileSystem(unpickedJarFox, false) closeJarFileSystem(sourcesJarFox, false) } diff --git a/dev11/src/main/java/com/fox2code/foxloader/dev11/FoxLoaderDecompiler.java b/dev11/src/main/java/com/fox2code/foxloader/dev11/FoxLoaderDecompiler.java index 5e9c9ce..9daf852 100644 --- a/dev11/src/main/java/com/fox2code/foxloader/dev11/FoxLoaderDecompiler.java +++ b/dev11/src/main/java/com/fox2code/foxloader/dev11/FoxLoaderDecompiler.java @@ -18,8 +18,12 @@ public class FoxLoaderDecompiler extends SingleFileSaver implements IResultSaver options.put("asc", "1"); options.put("bsm", "1"); options.put("sef", "1"); - if (System.getProperty("java.version").startsWith("1.8.")) { - options.put("jrt", System.getProperty("java.home")); + String javaHome = System.getProperty("java.home"); + if (System.getProperty("java.version").startsWith("1.8.") && javaHome != null) { + if (javaHome.endsWith("\\jre") || javaHome.endsWith("/jre")) { + javaHome = javaHome.substring(0, javaHome.length() - 4); + } + options.put("jrt", javaHome); } else { options.put("jrt", "current"); } diff --git a/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java b/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java index 4b02ff4..411c0ce 100644 --- a/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java +++ b/final/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java @@ -211,7 +211,7 @@ public void show() { } } - private boolean checkInstaller() { + private boolean checkInstaller(boolean checkExtStrict) { if (this.reIndevSource != null && !this.reIndevSource.exists()) { if (this.jFrame == null) return true; @@ -226,7 +226,7 @@ private boolean checkInstaller() { showMessage(TranslateEngine.getTranslation("installer.error.run-from-ide"), true); return true; } - if (!Main.currentInstallerFile.getName() + if (checkExtStrict && !Main.currentInstallerFile.getName() .toLowerCase(Locale.ROOT).endsWith(".jar") && !this.installerPlatform.specialLauncher) { if (this.jFrame == null) return true; @@ -239,7 +239,7 @@ private boolean checkInstaller() { } public void installMineCraft() { - if (this.checkInstaller()) { + if (this.checkInstaller(false)) { return; } if (this.installerPlatform.specialLauncher) { @@ -296,7 +296,7 @@ public void installBetaCraft() { } public void installBetaCraftEx(File betaCraft) { - if (this.checkInstaller()) { + if (this.checkInstaller(false)) { return; } File versions = new File(betaCraft, "versions"); @@ -370,7 +370,7 @@ public void installBetaCraftEx(File betaCraft) { } public void extractMMCInstance() { - if (this.checkInstaller()) { + if (this.checkInstaller(true)) { return; } @@ -407,7 +407,7 @@ public void extractMMCInstance() { } public void extractServer() { - if (this.checkInstaller()) { + if (this.checkInstaller(true)) { return; } @@ -445,7 +445,7 @@ public void extractServer() { } public void doSilentInstall(String arg) throws IOException { - if (this.checkInstaller()) { + if (this.checkInstaller(false)) { return; } switch (this.launcherType) { diff --git a/final/src/main/java/com/fox2code/foxloader/installer/Main.java b/final/src/main/java/com/fox2code/foxloader/installer/Main.java index b096946..08d15d3 100644 --- a/final/src/main/java/com/fox2code/foxloader/installer/Main.java +++ b/final/src/main/java/com/fox2code/foxloader/installer/Main.java @@ -110,9 +110,10 @@ public static void main(String[] args) throws ReflectiveOperationException, Malf } public static boolean isPojavLauncherHome(String userHome) { - int index; - return (userHome.startsWith("/storage/emulated/") && (index = userHome.indexOf('/', 18)) != -1 && - userHome.substring(index).startsWith("/Android/data/") || userHome.startsWith("/sdcard/Android/data/")); + int index; String ext; + return ((userHome.startsWith("/storage/emulated/") && (index = userHome.indexOf('/', 18)) != -1 && + ((ext = userHome.substring(index)).startsWith("/Android/data/") || ext.startsWith("/games/"))) || + userHome.startsWith("/sdcard/Android/data/") || userHome.startsWith("/sdcard/games/")); } static { diff --git a/gradle.properties b/gradle.properties index 5fa20fe..2c7eafb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.parallel=true org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8 # FoxLoader properties -foxloader.version=1.2.42 +foxloader.version=1.2.43 foxloader.lastReIndevTransformerChanges=1.2.39 # https://www.jitpack.io/#com.fox2code/FoxLoader @@ -22,4 +22,4 @@ spark.dependency=maven.modrinth:spark:1.10.58-fabric spark.version=1.10.58 #VineFlower properties -vineflower.dependency=org.vineflower:vineflower:1.9.3 +vineflower.dependency=org.vineflower:vineflower:1.10.0