WIP Demo mode stuff
Sign in with a Microsoft account that doesn't own the game, demo_user will be made. This is very much WIP as my iPhone 7 doesn't feel like launching PojavLauncher.
This commit is contained in:
1 parent
7d527942a2
commit
0b643476f4
6 files changed
+49
-8
No files matched your search
@@ -107,6 +107,23 @@ public final class Tools
|
||||
|
||||
javaArgList.add(versionInfo.mainClass);
|
||||
javaArgList.addAll(Arrays.asList(launchArgs));
|
||||
if(profile.username.equals("demo_user")) {
|
||||
File demoHome = new File(DIR_GAME_HOME + "/demo");
|
||||
if(demoHome.exists()) {
|
||||
for (File demoStuff : demoHome.listFiles()) { demoStuff.delete(); }
|
||||
} else {
|
||||
demoHome.mkdirs();
|
||||
}
|
||||
javaArgList.add("-Duser.home=" + DIR_GAME_HOME + "/demo");
|
||||
File demoDir = new File(DIR_GAME_NEW + "/demo");
|
||||
if(demoDir.exists()) {
|
||||
for (File demoStuff : demoDir.listFiles()) { demoStuff.delete(); }
|
||||
} else {
|
||||
demoDir.mkdirs();
|
||||
}
|
||||
javaArgList.add("-Duser.dir=" + DIR_GAME_NEW + "/demo");
|
||||
javaArgList.add("--demo");
|
||||
}
|
||||
|
||||
// Debug
|
||||
/*
|
||||
|
||||
+7
@@ -46,6 +46,13 @@ public class MicrosoftAuthTask {
|
||||
acc.profileId = msa.mcUuid;
|
||||
acc.isMicrosoft = true;
|
||||
acc.msaRefreshToken = msa.msRefreshToken;
|
||||
} else if(msa.doesDemo) {
|
||||
acc.clientToken = "0"; /* FIXME */
|
||||
acc.accessToken = "-1"; // Differentiate from local accounts
|
||||
acc.username = "demo_user";
|
||||
acc.profileId = "25e00594-cf57-3f87-b3af-3f06591be252";
|
||||
acc.isMicrosoft = false;
|
||||
acc.msaRefreshToken = "0";
|
||||
}
|
||||
acc.save();
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ public class Msa {
|
||||
public String mcToken;
|
||||
public String mcUuid;
|
||||
public boolean doesOwnGame;
|
||||
public boolean doesDemo;
|
||||
|
||||
public Msa(MicrosoftAuthTask task, boolean isRefresh, String authCode) throws IOException, JSONException {
|
||||
this.task = task;
|
||||
@@ -270,10 +271,16 @@ public class Msa {
|
||||
// Log.i("MicroAuth","Uuid Minecraft = " + uuidDashes);
|
||||
mcName=name;
|
||||
mcUuid=uuidDashes;
|
||||
}else{
|
||||
} else if(conn.getResponseCode() == 404) {
|
||||
// Demo mode stuff
|
||||
doesOwnGame = false;
|
||||
doesDemo = true;
|
||||
} else {
|
||||
// Log.i("MicroAuth","It seems that this Microsoft Account does not own the game.");
|
||||
doesOwnGame = false;
|
||||
doesDemo = false;
|
||||
throwResponseError(conn);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user