mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Game directory migration
Prepare for JRE Sandbox. Move /sdcard/games/.minecraft to /sdcard/games/PojavLauncher/.minecraft
This commit is contained in:
parent
bff2a44325
commit
4ab38ca2c2
@ -119,7 +119,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
// FIXME: is it safe fot multi thread?
|
// FIXME: is it safe fot multi thread?
|
||||||
GLOBAL_CLIPBOARD = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
GLOBAL_CLIPBOARD = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
|
||||||
logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
logFile = new File(Tools.DIR_GAME_NEW, "latestlog.txt");
|
||||||
logFile.delete();
|
logFile.delete();
|
||||||
logFile.createNewFile();
|
logFile.createNewFile();
|
||||||
logStream = new PrintStream(logFile.getAbsolutePath());
|
logStream = new PrintStream(logFile.getAbsolutePath());
|
||||||
@ -881,7 +881,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkLWJGL3Installed() {
|
private void checkLWJGL3Installed() {
|
||||||
File lwjgl3dir = new File(Tools.MAIN_PATH, "lwjgl3");
|
File lwjgl3dir = new File(Tools.DIR_GAME_NEW, "lwjgl3");
|
||||||
if (!lwjgl3dir.exists() || lwjgl3dir.isFile() || lwjgl3dir.list().length == 0) {
|
if (!lwjgl3dir.exists() || lwjgl3dir.isFile() || lwjgl3dir.list().length == 0) {
|
||||||
appendlnToLog("Error: LWJGL3 was not installed!");
|
appendlnToLog("Error: LWJGL3 was not installed!");
|
||||||
throw new RuntimeException(getString(R.string.mcn_check_fail_lwjgl));
|
throw new RuntimeException(getString(R.string.mcn_check_fail_lwjgl));
|
||||||
@ -961,7 +961,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
|
|
||||||
public String getMinecraftOption(String key) {
|
public String getMinecraftOption(String key) {
|
||||||
try {
|
try {
|
||||||
String[] options = Tools.read(Tools.MAIN_PATH + "/options.txt").split("\n");
|
String[] options = Tools.read(Tools.DIR_GAME_NEW + "/options.txt").split("\n");
|
||||||
for (String option : options) {
|
for (String option : options) {
|
||||||
String[] optionKeyValue = option.split(":");
|
String[] optionKeyValue = option.split(":");
|
||||||
if (optionKeyValue[0].equals(key)) {
|
if (optionKeyValue[0].equals(key)) {
|
||||||
|
@ -33,7 +33,7 @@ public class JavaGUILauncherActivity extends LoggableActivity {
|
|||||||
setContentView(R.layout.install_mod);
|
setContentView(R.layout.install_mod);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
logFile = new File(Tools.DIR_GAME_NEW, "latestlog.txt");
|
||||||
logFile.delete();
|
logFile.delete();
|
||||||
logFile.createNewFile();
|
logFile.createNewFile();
|
||||||
logStream = new PrintStream(logFile.getAbsolutePath());
|
logStream = new PrintStream(logFile.getAbsolutePath());
|
||||||
@ -185,7 +185,7 @@ public class JavaGUILauncherActivity extends LoggableActivity {
|
|||||||
try {
|
try {
|
||||||
List<String> javaArgList = new ArrayList<String>();
|
List<String> javaArgList = new ArrayList<String>();
|
||||||
|
|
||||||
File cacioAwtLibPath = new File(Tools.MAIN_PATH, "cacioawtlib");
|
File cacioAwtLibPath = new File(Tools.DIR_GAME_NEW, "cacioawtlib");
|
||||||
if (cacioAwtLibPath.exists()) {
|
if (cacioAwtLibPath.exists()) {
|
||||||
StringBuilder libStr = new StringBuilder();
|
StringBuilder libStr = new StringBuilder();
|
||||||
for (File file: cacioAwtLibPath.listFiles()) {
|
for (File file: cacioAwtLibPath.listFiles()) {
|
||||||
|
@ -24,9 +24,10 @@ public class PojavApplication extends Application
|
|||||||
@Override
|
@Override
|
||||||
public void uncaughtException(Thread thread, Throwable th) {
|
public void uncaughtException(Thread thread, Throwable th) {
|
||||||
boolean storagePermAllowed = Build.VERSION.SDK_INT < 23 || ActivityCompat.checkSelfPermission(PojavApplication.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
boolean storagePermAllowed = Build.VERSION.SDK_INT < 23 || ActivityCompat.checkSelfPermission(PojavApplication.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
||||||
File crashFile = new File(storagePermAllowed ? Tools.MAIN_PATH : Tools.DIR_DATA, "latestcrash.txt");
|
File crashFile = new File(storagePermAllowed ? Tools.DIR_GAME_NEW : Tools.DIR_DATA, "latestcrash.txt");
|
||||||
try {
|
try {
|
||||||
// Write to file, since some devices may not able to show error
|
// Write to file, since some devices may not able to show error
|
||||||
|
crashFile.getParentFile().mkdirs();
|
||||||
crashFile.createNewFile();
|
crashFile.createNewFile();
|
||||||
PrintStream crashStream = new PrintStream(crashFile);
|
PrintStream crashStream = new PrintStream(crashFile);
|
||||||
crashStream.append("PojavLauncher crash report\n");
|
crashStream.append("PojavLauncher crash report\n");
|
||||||
|
@ -142,7 +142,12 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
} catch (InterruptedException e) {}
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
initMain();
|
try {
|
||||||
|
initMain();
|
||||||
|
} catch (Throwable th) {
|
||||||
|
Tools.showError(PojavLoginActivity.this, th, true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -168,30 +173,6 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
progressLog.setText(getResources().getString(R.string.error_checklog, "\n\n" + progressLog.getText()));
|
progressLog.setText(getResources().getString(R.string.error_checklog, "\n\n" + progressLog.getText()));
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private void appendlnToLog(String txt) {
|
|
||||||
publishProgress("", txt + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void execCmd(String cmd) throws Exception {
|
|
||||||
appendlnToLog("> " + cmd);
|
|
||||||
ShellProcessOperation mainProcess = new ShellProcessOperation(new ShellProcessOperation.OnPrintListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPrintLine(String text)
|
|
||||||
{
|
|
||||||
publishProgress(text);
|
|
||||||
}
|
|
||||||
}, cmd);
|
|
||||||
mainProcess.initInputStream(MCLoginActivity.this);
|
|
||||||
String msgExit = cmd.split(" ")[0] + " has exited with code " + mainProcess.waitFor();
|
|
||||||
if (mainProcess.exitCode() != 0) {
|
|
||||||
throw new Error("(ERROR) " + msgExit);
|
|
||||||
} else {
|
|
||||||
appendlnToLog("(SUCCESS) " + msgExit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiInit() {
|
private void uiInit() {
|
||||||
@ -315,27 +296,20 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
return prefValue;
|
return prefValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setPref(String prefName, boolean value) {
|
private void initMain() throws Throwable {
|
||||||
return firstLaunchPrefs.edit().putBoolean(prefName, value).commit();
|
|
||||||
}
|
|
||||||
private boolean setPref(String prefName, String value) {
|
|
||||||
return firstLaunchPrefs.edit().putString(prefName, value).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initMain()
|
|
||||||
{
|
|
||||||
mkdirs(Tools.DIR_HOME_VERSION);
|
mkdirs(Tools.DIR_HOME_VERSION);
|
||||||
mkdirs(Tools.DIR_HOME_LIBRARY);
|
mkdirs(Tools.DIR_HOME_LIBRARY);
|
||||||
|
|
||||||
mkdirs(Tools.MAIN_PATH);
|
mkdirs(Tools.DIR_GAME_NEW);
|
||||||
mkdirs(Tools.MAIN_PATH + "/config");
|
mkdirs(Tools.DIR_GAME_NEW + "/config");
|
||||||
mkdirs(Tools.MAIN_PATH + "/lwjgl3");
|
mkdirs(Tools.DIR_GAME_NEW + "/lwjgl3");
|
||||||
mkdirs(Tools.MAIN_PATH + "/mods");
|
mkdirs(Tools.DIR_GAME_NEW + "/mods");
|
||||||
|
|
||||||
PojavMigrator.migrateAccountData(this);
|
PojavMigrator.migrateAccountData(this);
|
||||||
|
PojavMigrator.migrateGameDir();
|
||||||
|
|
||||||
File forgeSplashFile = new File(Tools.MAIN_PATH, "config/splash.properties");
|
File forgeSplashFile = new File(Tools.DIR_GAME_NEW, "config/splash.properties");
|
||||||
String forgeSplashContent = "enabled=true";
|
String forgeSplashContent = "enabled=true";
|
||||||
try {
|
try {
|
||||||
if (forgeSplashFile.exists()) {
|
if (forgeSplashFile.exists()) {
|
||||||
@ -354,25 +328,23 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
try {
|
try {
|
||||||
new CustomControls(this).save(Tools.CTRLDEF_FILE);
|
new CustomControls(this).save(Tools.CTRLDEF_FILE);
|
||||||
|
|
||||||
Tools.copyAssetFile(this, "components/ForgeInstallerHeadless/forge-installer-headless-1.0.1.jar", Tools.MAIN_PATH + "/config", "forge-installer-headless.jar", true);
|
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, "options.txt", Tools.DIR_GAME_NEW, false);
|
||||||
Tools.copyAssetFile(this, "options.txt", Tools.MAIN_PATH, false);
|
Tools.copyAssetFile(this, "java_sandbox.policy", Tools.DIR_GAME_NEW, true);
|
||||||
|
|
||||||
// Extract launcher_profiles.json
|
|
||||||
// TODO: Remove after implement.
|
// TODO: Remove after implement.
|
||||||
Tools.copyAssetFile(this, "launcher_profiles.json", Tools.MAIN_PATH, false);
|
Tools.copyAssetFile(this, "launcher_profiles.json", Tools.DIR_GAME_NEW, false);
|
||||||
|
|
||||||
AssetManager am = this.getAssets();
|
AssetManager am = this.getAssets();
|
||||||
|
|
||||||
InputStream is = am.open("components/lwjgl3/version");
|
InputStream is = am.open("components/lwjgl3/version");
|
||||||
if(!new File(Tools.MAIN_PATH + "/lwjgl3/version").exists()) {
|
if(!new File(Tools.DIR_GAME_NEW + "/lwjgl3/version").exists()) {
|
||||||
Log.i("LWJGL3Prep","Pack was installed manually, or does not exist, unpacking new...");
|
Log.i("LWJGL3Prep","Pack was installed manually, or does not exist, unpacking new...");
|
||||||
String[] lwjglFileList = am.list("components/lwjgl3");
|
String[] lwjglFileList = am.list("components/lwjgl3");
|
||||||
FileOutputStream fos;
|
FileOutputStream fos;
|
||||||
InputStream iis;
|
InputStream iis;
|
||||||
for(String s : lwjglFileList) {
|
for(String s : lwjglFileList) {
|
||||||
iis = am.open("components/lwjgl3/"+s);
|
iis = am.open("components/lwjgl3/"+s);
|
||||||
fos = new FileOutputStream(new File(Tools.MAIN_PATH+"/lwjgl3/"+s));
|
fos = new FileOutputStream(new File(Tools.DIR_GAME_NEW+"/lwjgl3/"+s));
|
||||||
/*
|
/*
|
||||||
int i; byte[] buf = new byte[1024];
|
int i; byte[] buf = new byte[1024];
|
||||||
while((i = iis.read(buf)) != -1) {
|
while((i = iis.read(buf)) != -1) {
|
||||||
@ -384,13 +356,13 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
iis.close();
|
iis.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FileInputStream fis = new FileInputStream(new File(Tools.MAIN_PATH + "/lwjgl3/version"));
|
FileInputStream fis = new FileInputStream(new File(Tools.DIR_GAME_NEW + "/lwjgl3/version"));
|
||||||
String release1 = Tools.read(is);
|
String release1 = Tools.read(is);
|
||||||
String release2 = Tools.read(fis);
|
String release2 = Tools.read(fis);
|
||||||
if (!release1.equals(release2)) {
|
if (!release1.equals(release2)) {
|
||||||
String[] lwjglFileList = am.list("components/lwjgl3");
|
String[] lwjglFileList = am.list("components/lwjgl3");
|
||||||
for (String s : lwjglFileList) {
|
for (String s : lwjglFileList) {
|
||||||
Tools.copyAssetFile(this, "components/lwjgl3/" + s, Tools.MAIN_PATH+"/lwjgl3/",s, true);
|
Tools.copyAssetFile(this, "components/lwjgl3/" + s, Tools.DIR_GAME_NEW+"/lwjgl3/",s, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i("LWJGL3Prep","Pack is up-to-date with the launcher, continuing...");
|
Log.i("LWJGL3Prep","Pack is up-to-date with the launcher, continuing...");
|
||||||
@ -401,7 +373,7 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
File jreTarFile = selectJreTarFile();
|
File jreTarFile = selectJreTarFile();
|
||||||
uncompressTarXZ(jreTarFile, new File(Tools.DIR_HOME_JRE));
|
uncompressTarXZ(jreTarFile, new File(Tools.DIR_HOME_JRE));
|
||||||
}
|
}
|
||||||
setPref(PREF_IS_INSTALLED_JAVARUNTIME, true);
|
firstLaunchPrefs.edit().putBoolean(PREF_IS_INSTALLED_JAVARUNTIME, true).commit();
|
||||||
Tools.copyAssetFile(this, "components/jre/version", Tools.DIR_HOME_JRE + "/","version", true);
|
Tools.copyAssetFile(this, "components/jre/version", Tools.DIR_HOME_JRE + "/","version", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,6 +575,7 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
private boolean mkdirs(String path)
|
private boolean mkdirs(String path)
|
||||||
{
|
{
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
|
// check necessary???
|
||||||
if(file.getParentFile().exists())
|
if(file.getParentFile().exists())
|
||||||
return file.mkdir();
|
return file.mkdir();
|
||||||
else return file.mkdirs();
|
else return file.mkdirs();
|
||||||
|
@ -31,4 +31,17 @@ public class PojavMigrator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void migrateGameDir() throws IOException, InterruptedException {
|
||||||
|
File oldGameDir = new File(Tools.DIR_GAME_OLD);
|
||||||
|
if (oldGameDir.exists() && oldGameDir.isDirectory()) {
|
||||||
|
Process p = Runtime.getRuntime().exec(
|
||||||
|
new String[]{"mv", Tools.DIR_GAME_OLD, Tools.DIR_GAME_NEW});
|
||||||
|
int exitCode = p.waitFor();
|
||||||
|
if (exitCode != 0) {
|
||||||
|
throw new IOException("Could not move game dir! Exit code " + exitCode +
|
||||||
|
", message:\n" + Tools.read(p.getErrorStream()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,7 @@ public final class Tools
|
|||||||
public static final boolean ENABLE_DEV_FEATURES = BuildConfig.DEBUG;
|
public static final boolean ENABLE_DEV_FEATURES = BuildConfig.DEBUG;
|
||||||
|
|
||||||
public static String APP_NAME = "null";
|
public static String APP_NAME = "null";
|
||||||
public static final String MAIN_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
|
|
||||||
public static final String ASSETS_PATH = MAIN_PATH + "/assets";
|
|
||||||
public static final String CTRLMAP_PATH = MAIN_PATH + "/controlmap";
|
|
||||||
public static final String CTRLDEF_FILE = MAIN_PATH + "/controlmap/default.json";
|
|
||||||
|
|
||||||
public static final Gson GLOBAL_GSON = new GsonBuilder().setPrettyPrinting().create();
|
public static final Gson GLOBAL_GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
|
||||||
public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher";
|
public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher";
|
||||||
@ -41,17 +37,23 @@ public final class Tools
|
|||||||
// New since 3.3.1
|
// New since 3.3.1
|
||||||
public static String DIR_ACCOUNT_OLD;
|
public static String DIR_ACCOUNT_OLD;
|
||||||
public static String DIR_ACCOUNT_NEW;
|
public static String DIR_ACCOUNT_NEW;
|
||||||
|
public static final String DIR_GAME_NEW = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher/.minecraft";
|
||||||
|
public static final String DIR_GAME_OLD = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
|
||||||
|
|
||||||
// New since 3.0.0
|
// New since 3.0.0
|
||||||
public static String DIR_HOME_JRE;
|
public static String DIR_HOME_JRE;
|
||||||
public static String DIRNAME_HOME_JRE = "lib";
|
public static String DIRNAME_HOME_JRE = "lib";
|
||||||
|
|
||||||
// New since 2.4.2
|
// New since 2.4.2
|
||||||
public static final String DIR_HOME_VERSION = MAIN_PATH + "/versions";
|
public static final String DIR_HOME_VERSION = DIR_GAME_NEW + "/versions";
|
||||||
public static final String DIR_HOME_LIBRARY = MAIN_PATH + "/libraries";
|
public static final String DIR_HOME_LIBRARY = DIR_GAME_NEW + "/libraries";
|
||||||
|
|
||||||
public static final String DIR_HOME_CRASH = MAIN_PATH + "/crash-reports";
|
public static final String DIR_HOME_CRASH = DIR_GAME_NEW + "/crash-reports";
|
||||||
|
|
||||||
|
public static final String ASSETS_PATH = DIR_GAME_NEW + "/assets";
|
||||||
|
public static final String CTRLMAP_PATH = DIR_GAME_NEW + "/controlmap";
|
||||||
|
public static final String CTRLDEF_FILE = DIR_GAME_NEW + "/controlmap/default.json";
|
||||||
|
|
||||||
public static final String LIBNAME_OPTIFINE = "optifine:OptiFine";
|
public static final String LIBNAME_OPTIFINE = "optifine:OptiFine";
|
||||||
|
|
||||||
public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, JMinecraftVersionList.Version versionInfo) throws Throwable {
|
public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, JMinecraftVersionList.Version versionInfo) throws Throwable {
|
||||||
@ -78,7 +80,7 @@ public final class Tools
|
|||||||
overrideableArgList.add("-Djava.home=" + Tools.DIR_HOME_JRE);
|
overrideableArgList.add("-Djava.home=" + Tools.DIR_HOME_JRE);
|
||||||
overrideableArgList.add("-Djava.io.tmpdir=" + ctx.getCacheDir().getAbsolutePath());
|
overrideableArgList.add("-Djava.io.tmpdir=" + ctx.getCacheDir().getAbsolutePath());
|
||||||
// overrideableArgList.add("-Djava.library.path=" + JREUtils.LD_LIBRARY_PATH);
|
// overrideableArgList.add("-Djava.library.path=" + JREUtils.LD_LIBRARY_PATH);
|
||||||
overrideableArgList.add("-Duser.home=" + new File(Tools.MAIN_PATH).getParent());
|
overrideableArgList.add("-Duser.home=" + new File(Tools.DIR_GAME_NEW).getParent());
|
||||||
overrideableArgList.add("-Duser.language=" + System.getProperty("user.language"));
|
overrideableArgList.add("-Duser.language=" + System.getProperty("user.language"));
|
||||||
// overrideableArgList.add("-Duser.timezone=GMT");
|
// overrideableArgList.add("-Duser.timezone=GMT");
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ public final class Tools
|
|||||||
|
|
||||||
String userType = "mojang";
|
String userType = "mojang";
|
||||||
|
|
||||||
File gameDir = new File(Tools.MAIN_PATH);
|
File gameDir = new File(Tools.DIR_GAME_NEW);
|
||||||
gameDir.mkdirs();
|
gameDir.mkdirs();
|
||||||
|
|
||||||
Map<String, String> varArgMap = new ArrayMap<String, String>();
|
Map<String, String> varArgMap = new ArrayMap<String, String>();
|
||||||
@ -217,7 +219,7 @@ public final class Tools
|
|||||||
|
|
||||||
private static String getLWJGL3ClassPath() {
|
private static String getLWJGL3ClassPath() {
|
||||||
StringBuilder libStr = new StringBuilder();
|
StringBuilder libStr = new StringBuilder();
|
||||||
File lwjgl3Folder = new File(Tools.MAIN_PATH, "lwjgl3");
|
File lwjgl3Folder = new File(Tools.DIR_GAME_NEW, "lwjgl3");
|
||||||
if (/* info.arguments != null && */ lwjgl3Folder.exists()) {
|
if (/* info.arguments != null && */ lwjgl3Folder.exists()) {
|
||||||
for (File file: lwjgl3Folder.listFiles()) {
|
for (File file: lwjgl3Folder.listFiles()) {
|
||||||
if (file.getName().endsWith(".jar")) {
|
if (file.getName().endsWith(".jar")) {
|
||||||
|
@ -173,7 +173,7 @@ public class Msa {
|
|||||||
String uhs = jo.getJSONObject("DisplayClaims").getJSONArray("xui").getJSONObject(0).getString("uhs");
|
String uhs = jo.getJSONObject("DisplayClaims").getJSONArray("xui").getJSONObject(0).getString("uhs");
|
||||||
Log.i("MicroAuth","Xbl Xsts = "+jo.getString("Token")+"; Uhs = " + uhs);
|
Log.i("MicroAuth","Xbl Xsts = "+jo.getString("Token")+"; Uhs = " + uhs);
|
||||||
acquireMinecraftToken(uhs,jo.getString("Token"));
|
acquireMinecraftToken(uhs,jo.getString("Token"));
|
||||||
}else{;
|
}else{
|
||||||
throwResponseError(conn);
|
throwResponseError(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ public class Msa {
|
|||||||
checkMcProfile(jo.getString("access_token"));
|
checkMcProfile(jo.getString("access_token"));
|
||||||
checkMcStore(jo.getString("access_token"));
|
checkMcStore(jo.getString("access_token"));
|
||||||
|
|
||||||
}else{;
|
}else{
|
||||||
throwResponseError(conn);
|
throwResponseError(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ public class NewForgeInstaller extends BaseInstaller
|
|||||||
|
|
||||||
ctx.appendlnToLog("Launching JVM");
|
ctx.appendlnToLog("Launching JVM");
|
||||||
return ctx.launchJavaRuntime(null,
|
return ctx.launchJavaRuntime(null,
|
||||||
"-cp " + Tools.MAIN_PATH + "/config/forge-installer-headless.jar:" + mFile.getAbsolutePath() + " me.xfl03.HeadlessInstaller --installClient .");
|
"-cp " + Tools.DIR_GAME_NEW + "/config/forge-installer-headless.jar:" + mFile.getAbsolutePath() + " me.xfl03.HeadlessInstaller --installClient .");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ public class JREUtils
|
|||||||
public static void setJavaEnvironment(LoggableActivity ctx, @Nullable ShellProcessOperation shell) throws Throwable {
|
public static void setJavaEnvironment(LoggableActivity ctx, @Nullable ShellProcessOperation shell) throws Throwable {
|
||||||
Map<String, String> envMap = new ArrayMap<>();
|
Map<String, String> envMap = new ArrayMap<>();
|
||||||
envMap.put("JAVA_HOME", Tools.DIR_HOME_JRE);
|
envMap.put("JAVA_HOME", Tools.DIR_HOME_JRE);
|
||||||
envMap.put("HOME", Tools.MAIN_PATH);
|
envMap.put("HOME", Tools.DIR_GAME_NEW);
|
||||||
envMap.put("TMPDIR", ctx.getCacheDir().getAbsolutePath());
|
envMap.put("TMPDIR", ctx.getCacheDir().getAbsolutePath());
|
||||||
envMap.put("LIBGL_MIPMAP", "3");
|
envMap.put("LIBGL_MIPMAP", "3");
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ public class JREUtils
|
|||||||
envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth));
|
envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth));
|
||||||
envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight));
|
envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight));
|
||||||
|
|
||||||
File customEnvFile = new File(Tools.MAIN_PATH, "custom_env.txt");
|
File customEnvFile = new File(Tools.DIR_GAME_NEW, "custom_env.txt");
|
||||||
if (customEnvFile.exists() && customEnvFile.isFile()) {
|
if (customEnvFile.exists() && customEnvFile.isFile()) {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(customEnvFile));
|
BufferedReader reader = new BufferedReader(new FileReader(customEnvFile));
|
||||||
String line;
|
String line;
|
||||||
@ -260,7 +260,7 @@ public class JREUtils
|
|||||||
*/
|
*/
|
||||||
JREUtils.setJavaEnvironment(ctx, null);
|
JREUtils.setJavaEnvironment(ctx, null);
|
||||||
JREUtils.initJavaRuntime();
|
JREUtils.initJavaRuntime();
|
||||||
JREUtils.chdir(Tools.MAIN_PATH);
|
JREUtils.chdir(Tools.DIR_GAME_NEW);
|
||||||
|
|
||||||
final int exitCode = VMLauncher.launchJVM(javaArgList.toArray(new String[0]));
|
final int exitCode = VMLauncher.launchJVM(javaArgList.toArray(new String[0]));
|
||||||
ctx.appendlnToLog("Java Exit code: " + exitCode);
|
ctx.appendlnToLog("Java Exit code: " + exitCode);
|
||||||
|
@ -17,7 +17,7 @@ public class MCOptionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(Tools.MAIN_PATH + "/options.txt"));
|
BufferedReader reader = new BufferedReader(new FileReader(Tools.DIR_GAME_NEW + "/options.txt"));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
mLineList.add(line);
|
mLineList.add(line);
|
||||||
@ -50,7 +50,7 @@ public class MCOptionUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Tools.write(Tools.MAIN_PATH + "/options.txt", result.toString());
|
Tools.write(Tools.DIR_GAME_NEW + "/options.txt", result.toString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(Tools.APP_NAME, "Could not save options.txt", e);
|
Log.w(Tools.APP_NAME, "Could not save options.txt", e);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import java.io.*;
|
|||||||
public class LauncherProfiles
|
public class LauncherProfiles
|
||||||
{
|
{
|
||||||
public static MinecraftLauncherProfiles mainProfileJson;
|
public static MinecraftLauncherProfiles mainProfileJson;
|
||||||
public static File launcherProfilesFile = new File(Tools.MAIN_PATH + "/launcher_profiles.json");
|
public static File launcherProfilesFile = new File(Tools.DIR_GAME_NEW + "/launcher_profiles.json");
|
||||||
public static MinecraftLauncherProfiles update() {
|
public static MinecraftLauncherProfiles update() {
|
||||||
try {
|
try {
|
||||||
if (mainProfileJson == null) {
|
if (mainProfileJson == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user