Skip to content

Commit

Permalink
Revert "Force to working history"
Browse files Browse the repository at this point in the history
This reverts commit 2762bc3.
  • Loading branch information
CADIndie committed Aug 29, 2024
1 parent 2762bc3 commit 5224eec
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
# These are Windows script files and should use crlf
*.bat text eol=crlf
*.so filter=lfs diff=lfs merge=lfs -text
*.so !text !filter !merge !diff
* !text !filter !merge !diff
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
ndkVersion = "26.1.10909125"
compileSdkVersion = "android-32"
defaultConfig {
minSdkVersion(32)
minSdkVersion(29)

ndk.stl = "c++_shared"
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pojlib/account/LoginHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import pojlib.API;
import pojlib.util.Constants;
import pojlib.util.Logger;
import pojlib.util.MSAException;

public class LoginHelper {
public static Thread loginThread;
Expand Down Expand Up @@ -104,7 +103,8 @@ public static void beginLogin(Activity activity) {
API.profileImage = MinecraftAccount.getSkinFaceUrl(API.currentAcc);
API.profileName = API.currentAcc.username;
} catch (ExecutionException | InterruptedException e) {
throw new MSAException("MicrosoftLogin | Something went wrong! Couldn't reach the Microsoft Auth servers.", e);
API.msaMessage = "Something went wrong! Couldn't reach the Microsoft Auth servers.\n"
+ e;
}
});

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/pojlib/account/MinecraftAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
import pojlib.util.Logger;

public class MinecraftAccount {

public String accessToken;
public String uuid;
public String username;
public long expiresIn;

public final String userType = "msa";


public static MinecraftAccount login(String gameDir, String[] response) throws IOException, JSONException {
String mcToken = Msa.acquireXBLToken(response[0]);
Msa instance = new Msa(false, mcToken);
MinecraftAccount account = instance.performLogin(mcToken);
MinecraftAccount account = instance.performLogin();
account.expiresIn = Long.parseLong(response[1]);

GsonUtils.objectToJsonFile(gameDir + "/account.json", account);
Expand Down
48 changes: 44 additions & 4 deletions src/main/java/pojlib/account/Msa.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ public Msa(boolean isRefresh, String authCode){
}

/** Performs a full login, calling back listeners appropriately */
public MinecraftAccount performLogin(String xblToken) {
public MinecraftAccount performLogin() {
try {
String[] xsts = acquireXsts(xblToken);
String accessToken = acquireAccessToken(mIsRefresh, mAuthCode);
String xboxLiveToken = acquireXBLToken(accessToken);
String[] xsts = acquireXsts(xboxLiveToken);
if(xsts == null) {
return null;
}
Expand All @@ -72,6 +74,8 @@ public MinecraftAccount performLogin(String xblToken) {
MinecraftAccount acc = MinecraftAccount.load(mcName, null, null);
if (acc == null) acc = new MinecraftAccount();
if (doesOwnGame) {
/*acc.xuid = xsts[0];*/
/*acc.clientToken = "0"; *//* FIXME */
acc.accessToken = mcToken;
acc.username = mcName;
acc.uuid = mcUuid;
Expand All @@ -83,8 +87,44 @@ public MinecraftAccount performLogin(String xblToken) {

return acc;
} catch (Exception e) {
Logger.getInstance().appendToLog("MicrosoftLogin | Exception thrown during authentication " + e);
throw new MSAException("MicrosoftLogin | Exception thrown during authentication ", e);
Logger.getInstance().appendToLog("MicrosoftLogin | Exception thrown during authentication" + e);
throw new MSAException("MicrosoftLogin | Exception thrown during authentication", e);
}
}

public String acquireAccessToken(boolean isRefresh, String authcode) throws IOException, JSONException {
URL url = new URL(Constants.OAUTH_TOKEN_URL);
// Logger.getInstance().appendToLog("MicrosoftLogin | isRefresh=" + isRefresh + ", authCode= "+authcode);

String formData = convertToFormData(
"client_id", "00000000402b5328",
isRefresh ? "refresh_token" : "code", authcode,
"grant_type", isRefresh ? "refresh_token" : "authorization_code",
"redirect_url", "https://login.live.com/oauth20_desktop.srf",
"scope", "service::user.auth.xboxlive.com::MBI_SSL"
);

// Logger.getInstance().appendToLog("MicroAuth | " + formData);

HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("charset", "utf-8");
conn.setRequestProperty("Content-Length", Integer.toString(formData.getBytes(StandardCharsets.UTF_8).length));
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.connect();
try(OutputStream wr = conn.getOutputStream()) {
wr.write(formData.getBytes(StandardCharsets.UTF_8));
}
if(conn.getResponseCode() >= 200 && conn.getResponseCode() < 300) {
JSONObject jo = new JSONObject(FileUtil.read(conn.getInputStream()));
msRefreshToken = jo.getString("refresh_token");
conn.disconnect();
return jo.getString("access_token");
}else{
throw getResponseThrowable(conn);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/pojlib/util/JREUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ public static int launchJavaVM(final Activity activity, final List<String> JVMAr
userArgs.add("-XX:+AllowUserSignalHandlers");
userArgs.add("-XX:+DisableExplicitGC");
userArgs.add("-XX:+UseCriticalJavaThreadPriority");
userArgs.add("-XX:+UnlockDiagnosticVMOptions");
userArgs.add("-XX:-ImplicitNullCheck");

userArgs.add("-Dorg.lwjgl.opengl.libname=" + graphicsLib);
userArgs.add("-Dorg.lwjgl.opengles.libname=" + "/system/lib64/libGLESv3.so");
Expand Down
Binary file modified src/main/jni/libopenxr_loader.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/libjnidispatch.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_nanovg.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_opengl.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_opengles.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_openvr.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_stb.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/liblwjgl_tinyfd.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/libopenal.so
Binary file not shown.
Binary file modified src/main/jniLibs/arm64-v8a/libopuscodec.so
Binary file not shown.

0 comments on commit 5224eec

Please sign in to comment.