mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
TMP_COMMIT
This commit is contained in:
parent
ad8d115b82
commit
ac40da2c4e
@ -31,6 +31,7 @@ import net.kdt.pojavlaunch.profiles.ProfileAdapter;
|
|||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import net.kdt.pojavlaunch.value.*;
|
import net.kdt.pojavlaunch.value.*;
|
||||||
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||||
|
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ public class BaseMainActivity extends BaseActivity {
|
|||||||
private static Touchpad touchpad;
|
private static Touchpad touchpad;
|
||||||
private LoggerView loggerView;
|
private LoggerView loggerView;
|
||||||
|
|
||||||
private MinecraftAccount mProfile;
|
MinecraftAccount mProfile;
|
||||||
|
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
private NavigationView navDrawer;
|
private NavigationView navDrawer;
|
||||||
@ -58,7 +59,7 @@ public class BaseMainActivity extends BaseActivity {
|
|||||||
|
|
||||||
protected volatile JMinecraftVersionList.Version mVersionInfo;
|
protected volatile JMinecraftVersionList.Version mVersionInfo;
|
||||||
|
|
||||||
private PerVersionConfig.VersionConfig config;
|
//private PerVersionConfig.VersionConfig config;
|
||||||
|
|
||||||
protected void initLayout(int resId) {
|
protected void initLayout(int resId) {
|
||||||
setContentView(resId);
|
setContentView(resId);
|
||||||
@ -70,18 +71,11 @@ public class BaseMainActivity extends BaseActivity {
|
|||||||
loggerView = findViewById(R.id.mainLoggerView);
|
loggerView = findViewById(R.id.mainLoggerView);
|
||||||
|
|
||||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||||
|
String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME;
|
||||||
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
mVersionInfo = Tools.getVersionInfo(null, mProfile.selectedVersion);
|
mVersionInfo = Tools.getVersionInfo(null, mProfile.selectedVersion);
|
||||||
}else{
|
|
||||||
LauncherProfiles.update();
|
|
||||||
mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId(
|
|
||||||
LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile).lastVersionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
setTitle("Minecraft " + mProfile.selectedVersion);
|
|
||||||
PerVersionConfig.update();
|
PerVersionConfig.update();
|
||||||
config = PerVersionConfig.configMap.get(mProfile.selectedVersion);
|
PerVersionConfig.VersionConfig config = PerVersionConfig.configMap.get(mProfile.selectedVersion);
|
||||||
String runtime = LauncherPreferences.PREF_DEFAULT_RUNTIME;
|
|
||||||
if(config != null) {
|
if(config != null) {
|
||||||
if(config.selectedRuntime != null) {
|
if(config.selectedRuntime != null) {
|
||||||
if(MultiRTUtils.forceReread(config.selectedRuntime).versionString != null) {
|
if(MultiRTUtils.forceReread(config.selectedRuntime).versionString != null) {
|
||||||
@ -92,6 +86,29 @@ public class BaseMainActivity extends BaseActivity {
|
|||||||
Tools.LOCAL_RENDERER = config.renderer;
|
Tools.LOCAL_RENDERER = config.renderer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
LauncherProfiles.update();
|
||||||
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mProfile.selectedProfile);
|
||||||
|
if(prof == null) {
|
||||||
|
Toast.makeText(this,"Attempted to launch nonexistent profile",Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mVersionInfo = Tools.getVersionInfo(null, BaseLauncherActivity.getVersionId(
|
||||||
|
prof.lastVersionId));
|
||||||
|
if(prof.javaDir != null && prof.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
|
||||||
|
String runtimeName = prof.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
|
||||||
|
if(MultiRTUtils.forceReread(runtimeName).versionString != null) {
|
||||||
|
runtime = runtimeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(prof.__P_renderer_name != null) {
|
||||||
|
Tools.LOCAL_RENDERER = prof.__P_renderer_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTitle("Minecraft " + mProfile.selectedVersion);
|
||||||
|
|
||||||
MultiRTUtils.setRuntimeNamed(this,runtime);
|
MultiRTUtils.setRuntimeNamed(this,runtime);
|
||||||
// Minecraft 1.13+
|
// Minecraft 1.13+
|
||||||
isInputStackCall = mVersionInfo.arguments != null;
|
isInputStackCall = mVersionInfo.arguments != null;
|
||||||
|
@ -23,6 +23,7 @@ import net.kdt.pojavlaunch.prefs.*;
|
|||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import net.kdt.pojavlaunch.value.*;
|
import net.kdt.pojavlaunch.value.*;
|
||||||
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
@ -50,6 +51,7 @@ public final class Tools {
|
|||||||
public static String MULTIRT_HOME;
|
public static String MULTIRT_HOME;
|
||||||
public static String LOCAL_RENDERER = null;
|
public static String LOCAL_RENDERER = null;
|
||||||
public static int DEVICE_ARCHITECTURE;
|
public static int DEVICE_ARCHITECTURE;
|
||||||
|
public static String LAUNCHERPROFILES_RTPREFIX = "pojav://";
|
||||||
|
|
||||||
// New since 3.3.1
|
// New since 3.3.1
|
||||||
public static String DIR_ACCOUNT_NEW;
|
public static String DIR_ACCOUNT_NEW;
|
||||||
@ -117,13 +119,25 @@ public final class Tools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JMinecraftVersionList.Version versionInfo = Tools.getVersionInfo(null,versionName);
|
JMinecraftVersionList.Version versionInfo = Tools.getVersionInfo(null,versionName);
|
||||||
|
String gamedirPath = Tools.DIR_GAME_NEW;
|
||||||
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
PerVersionConfig.update();
|
PerVersionConfig.update();
|
||||||
PerVersionConfig.VersionConfig pvcConfig = PerVersionConfig.configMap.get(versionName);
|
PerVersionConfig.VersionConfig pvcConfig = PerVersionConfig.configMap.get(versionName);
|
||||||
|
if (pvcConfig != null && pvcConfig.gamePath != null && !pvcConfig.gamePath.isEmpty())
|
||||||
String gamedirPath;
|
gamedirPath = pvcConfig.gamePath;
|
||||||
if(pvcConfig != null && pvcConfig.gamePath != null && !pvcConfig.gamePath.isEmpty()) gamedirPath = pvcConfig.gamePath;
|
if (pvcConfig != null && pvcConfig.jvmArgs != null && !pvcConfig.jvmArgs.isEmpty())
|
||||||
else gamedirPath = Tools.DIR_GAME_NEW;
|
LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = pvcConfig.jvmArgs;
|
||||||
if(pvcConfig != null && pvcConfig.jvmArgs != null && !pvcConfig.jvmArgs.isEmpty()) LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = pvcConfig.jvmArgs;
|
}else{
|
||||||
|
if(activity instanceof BaseMainActivity) {
|
||||||
|
LauncherProfiles.update();
|
||||||
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseMainActivity)activity).mProfile.selectedProfile);
|
||||||
|
if(prof == null) throw new Exception("Launching empty Profile");
|
||||||
|
if(prof.gameDir != null && !prof.gameDir.isEmpty())
|
||||||
|
gamedirPath = prof.gameDir;
|
||||||
|
if(prof.javaArgs != null && !prof.javaArgs.isEmpty())
|
||||||
|
LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = prof.javaArgs;
|
||||||
|
}
|
||||||
|
}
|
||||||
PojavLoginActivity.disableSplash(gamedirPath);
|
PojavLoginActivity.disableSplash(gamedirPath);
|
||||||
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);
|
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import net.kdt.pojavlaunch.prefs.*;
|
|||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import net.kdt.pojavlaunch.value.*;
|
import net.kdt.pojavlaunch.value.*;
|
||||||
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||||
|
|
||||||
import org.apache.commons.io.*;
|
import org.apache.commons.io.*;
|
||||||
|
|
||||||
@ -91,18 +92,40 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
|
|||||||
|
|
||||||
//Now we have the reliable information to check if our runtime settings are good enough
|
//Now we have the reliable information to check if our runtime settings are good enough
|
||||||
if(verInfo.javaVersion != null) { //1.17+
|
if(verInfo.javaVersion != null) { //1.17+
|
||||||
|
String selectedRuntime = null;
|
||||||
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
PerVersionConfig.update();
|
PerVersionConfig.update();
|
||||||
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(p1[0]);
|
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(p1[0]);
|
||||||
if (cfg == null) {
|
if (cfg == null) {
|
||||||
cfg = new PerVersionConfig.VersionConfig();
|
cfg = new PerVersionConfig.VersionConfig();
|
||||||
PerVersionConfig.configMap.put(p1[0], cfg);
|
PerVersionConfig.configMap.put(p1[0], cfg);
|
||||||
}
|
}
|
||||||
MultiRTUtils.Runtime r = cfg.selectedRuntime != null?MultiRTUtils.read(cfg.selectedRuntime):MultiRTUtils.read(LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
}else{
|
||||||
|
LauncherProfiles.update();
|
||||||
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mActivity.mProfile.selectedProfile);
|
||||||
|
if(prof == null) throw new SilentException();
|
||||||
|
if(prof.javaDir != null && prof.javaDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
|
||||||
|
selectedRuntime = prof.javaDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MultiRTUtils.Runtime r = selectedRuntime != null?MultiRTUtils.read(selectedRuntime):MultiRTUtils.read(LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
||||||
if(r.javaVersion < verInfo.javaVersion.majorVersion) {
|
if(r.javaVersion < verInfo.javaVersion.majorVersion) {
|
||||||
String appropriateRuntime = MultiRTUtils.getNearestJREName(verInfo.javaVersion.majorVersion);
|
String appropriateRuntime = MultiRTUtils.getNearestJREName(verInfo.javaVersion.majorVersion);
|
||||||
if(appropriateRuntime != null) {
|
if(appropriateRuntime != null) {
|
||||||
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
|
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(p1[0]);
|
||||||
|
if (cfg == null) {
|
||||||
|
cfg = new PerVersionConfig.VersionConfig();
|
||||||
|
PerVersionConfig.configMap.put(p1[0], cfg);
|
||||||
|
}
|
||||||
cfg.selectedRuntime = appropriateRuntime;
|
cfg.selectedRuntime = appropriateRuntime;
|
||||||
PerVersionConfig.update();
|
PerVersionConfig.update();
|
||||||
|
}else{
|
||||||
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(mActivity.mProfile.selectedProfile);
|
||||||
|
if(prof == null) throw new SilentException();
|
||||||
|
prof.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+appropriateRuntime;
|
||||||
|
LauncherProfiles.update();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
mActivity.runOnUiThread(()->{
|
mActivity.runOnUiThread(()->{
|
||||||
AlertDialog.Builder bldr = new AlertDialog.Builder(mActivity);
|
AlertDialog.Builder bldr = new AlertDialog.Builder(mActivity);
|
||||||
|
@ -7,11 +7,14 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import net.kdt.pojavlaunch.BaseLauncherActivity;
|
||||||
import net.kdt.pojavlaunch.R;
|
import net.kdt.pojavlaunch.R;
|
||||||
import net.kdt.pojavlaunch.Tools;
|
import net.kdt.pojavlaunch.Tools;
|
||||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||||
import net.kdt.pojavlaunch.tasks.MinecraftDownloaderTask;
|
import net.kdt.pojavlaunch.tasks.MinecraftDownloaderTask;
|
||||||
import net.kdt.pojavlaunch.value.PerVersionConfig;
|
import net.kdt.pojavlaunch.value.PerVersionConfig;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
|
||||||
|
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
@ -103,11 +106,25 @@ public class V117CompatUtil {
|
|||||||
}
|
}
|
||||||
public static void runCheck(String version, Activity ctx) throws Exception{
|
public static void runCheck(String version, Activity ctx) throws Exception{
|
||||||
|
|
||||||
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
|
|
||||||
MCOptionUtils.load();
|
MCOptionUtils.load();
|
||||||
|
|
||||||
List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks"));
|
List<String> packList =getTexturePackList(MCOptionUtils.get("resourcePacks"));
|
||||||
String renderer = cfg != null && cfg.renderer != null?cfg.renderer:LauncherPreferences.PREF_RENDERER;
|
String renderer;
|
||||||
|
String gamePath;
|
||||||
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
|
PerVersionConfig.update();
|
||||||
|
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
|
||||||
|
renderer = cfg != null && cfg.renderer != null?cfg.renderer:LauncherPreferences.PREF_RENDERER;
|
||||||
|
gamePath = cfg != null && cfg.gamePath != null?cfg.gamePath:Tools.DIR_GAME_NEW;
|
||||||
|
}else{
|
||||||
|
LauncherProfiles.update();
|
||||||
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
|
||||||
|
if(prof == null) throw new MinecraftDownloaderTask.SilentException();
|
||||||
|
renderer = prof.__P_renderer_name != null?prof.__P_renderer_name:LauncherPreferences.PREF_RENDERER;
|
||||||
|
gamePath = prof.gameDir != null?prof.gameDir:Tools.DIR_GAME_NEW;
|
||||||
|
}
|
||||||
|
//String
|
||||||
|
|
||||||
if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users;
|
if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users;
|
||||||
if(packList.contains("\"assets-v0.zip\"") && renderer.equals("opengles3")) return;
|
if(packList.contains("\"assets-v0.zip\"") && renderer.equals("opengles3")) return;
|
||||||
@ -141,14 +158,21 @@ public class V117CompatUtil {
|
|||||||
}
|
}
|
||||||
switch(proceed.get()) {
|
switch(proceed.get()) {
|
||||||
case 1:
|
case 1:
|
||||||
|
if(!LauncherPreferences.PREF_ENABLE_PROFILES) {
|
||||||
|
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
|
||||||
if (cfg == null) {
|
if (cfg == null) {
|
||||||
cfg = new PerVersionConfig.VersionConfig();
|
cfg = new PerVersionConfig.VersionConfig();
|
||||||
PerVersionConfig.configMap.put(version, cfg);
|
PerVersionConfig.configMap.put(version, cfg);
|
||||||
}
|
}
|
||||||
cfg.renderer = "opengles3";
|
cfg.renderer = "opengles3";
|
||||||
String path = Tools.DIR_GAME_NEW;
|
PerVersionConfig.update();
|
||||||
if(cfg.gamePath != null && !cfg.gamePath.isEmpty()) path = cfg.gamePath;
|
}else{
|
||||||
copyResourcePack(path,ctx.getAssets());
|
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
|
||||||
|
if(prof == null) throw new MinecraftDownloaderTask.SilentException();
|
||||||
|
prof.__P_renderer_name = "opengles3";
|
||||||
|
LauncherProfiles.update();
|
||||||
|
}
|
||||||
|
copyResourcePack(gamePath,ctx.getAssets());
|
||||||
if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\"");
|
if(!packList.contains("\"assets-v0.zip\"")) packList.add(0,"\"assets-v0.zip\"");
|
||||||
MCOptionUtils.set("resourcePacks",regenPackList(packList));
|
MCOptionUtils.set("resourcePacks",regenPackList(packList));
|
||||||
MCOptionUtils.save();
|
MCOptionUtils.save();
|
||||||
|
@ -13,5 +13,6 @@ public class MinecraftProfile
|
|||||||
public String javaArgs;
|
public String javaArgs;
|
||||||
public String logConfig;
|
public String logConfig;
|
||||||
public boolean logConfigIsXML;
|
public boolean logConfigIsXML;
|
||||||
|
public String __P_renderer_name;
|
||||||
public MinecraftResolution[] resolution;
|
public MinecraftResolution[] resolution;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user