Optifine Installer added

This commit is contained in:
artdeell 2020-12-30 14:51:10 +03:00
parent 5cda342d21
commit aabc278f05
5 changed files with 16 additions and 3 deletions

View file

@ -172,6 +172,9 @@ public class JavaGUILauncherActivity extends LoggableActivity {
} else if (InstallerDetector.isFabric(installer)) {
appendlnToLog("Detected Fabric Installer!");
return new FabricInstaller(installer).install(this);
}else if (InstallerDetector.isOptiFine(installer)) {
appendlnToLog("Detected OptiFine Installer!");
return new LegacyOptifineInstaller(installer).install(this);
} else {
appendlnToLog("No mod detected. Starting JVM");
isLogAllow = false;

View file

@ -332,6 +332,8 @@ public class PojavLoginActivity extends BaseActivity
Tools.copyAssetFile(this, "components/ForgeInstallerHeadless/forge-installer-headless-1.0.1.jar",
Tools.DIR_GAME_NEW + "/config", "forge-installer-headless.jar", true);
Tools.copyAssetFile(this, "components/OptiInst.jar",
Tools.DIR_GAME_NEW + "/config", "OptiInst.jar", true);
Tools.copyAssetFile(this, "components/security/pro-grade.jar", Tools.DIR_DATA, true);
Tools.copyAssetFile(this, "components/security/java_sandbox.policy", Tools.DIR_DATA, true);
Tools.copyAssetFile(this, "options.txt", Tools.DIR_GAME_NEW, false);

View file

@ -1,6 +1,9 @@
package net.kdt.pojavlaunch.installers;
import java.io.*;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import com.google.gson.*;
import net.kdt.pojavlaunch.value.*;
@ -9,7 +12,10 @@ public class InstallerDetector
public static boolean isFabric(BaseInstaller installer) {
return installer.mJarFile.getEntry("net/fabricmc/installer/Main.class") != null;
}
public static boolean isOptiFine(BaseInstaller installer) {
Enumeration e = installer.mJarFile.entries();
return installer.mJarFile.getEntry("optifine/Installer.class") != null;
}
// Forge Legacy: for 1.12.1 and below
public static boolean isForgeLegacy(BaseInstaller installer) throws IOException, JsonSyntaxException {
ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer);

View file

@ -17,7 +17,9 @@ public class LegacyOptifineInstaller extends BaseInstaller {
@Override
public int install(JavaGUILauncherActivity ctx) throws IOException {
return 0;
mJarFile.close();
ctx.appendlnToLog("Launching JVM");
return ctx.launchJavaRuntime(null,
"-jar "+Tools.DIR_GAME_NEW+"/config/OptiInst.jar " + mFile.getAbsolutePath() +" .");
}
}