Skip to content

Commit

Permalink
Update 1.2.43 (Fix #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox2Code committed Apr 7, 2024
1 parent b20d628 commit 7e8570b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 37 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 6 additions & 23 deletions dev/src/main/groovy/com/fox2code/foxloader/dev/GradlePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -425,27 +425,6 @@ class GradlePlugin implements Plugin<Project> {
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 {
Expand All @@ -470,10 +449,14 @@ class GradlePlugin implements Plugin<Project> {
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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -239,7 +239,7 @@ private boolean checkInstaller() {
}

public void installMineCraft() {
if (this.checkInstaller()) {
if (this.checkInstaller(false)) {
return;
}
if (this.installerPlatform.specialLauncher) {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -370,7 +370,7 @@ public void installBetaCraftEx(File betaCraft) {
}

public void extractMMCInstance() {
if (this.checkInstaller()) {
if (this.checkInstaller(true)) {
return;
}

Expand Down Expand Up @@ -407,7 +407,7 @@ public void extractMMCInstance() {
}

public void extractServer() {
if (this.checkInstaller()) {
if (this.checkInstaller(true)) {
return;
}

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 7e8570b

Please sign in to comment.