diff --git a/app/src/main/java/com/kdt/mojangauth/yggdrasil/YggdrasilAuthenticator.java b/app/src/main/java/com/kdt/mojangauth/yggdrasil/YggdrasilAuthenticator.java index 477d79bfc..b05927be8 100644 --- a/app/src/main/java/com/kdt/mojangauth/yggdrasil/YggdrasilAuthenticator.java +++ b/app/src/main/java/com/kdt/mojangauth/yggdrasil/YggdrasilAuthenticator.java @@ -51,7 +51,7 @@ public class YggdrasilAuthenticator { } String outString = new String(bos.toByteArray(), Charset.forName("UTF-8")); if (statusCode == 200){ - Log.i("Result", "Login successful"); + Log.i("Result", "Task " + endpoint + " successful"); return this.gson.fromJson(outString, responseClass); } @@ -85,6 +85,11 @@ public class YggdrasilAuthenticator { public RefreshResponse refresh(String authToken, UUID clientId) throws IOException, Throwable { return (RefreshResponse) makeRequest("refresh", new RefreshRequest(authToken, clientId), RefreshResponse.class); } + + public int validate(String authToken) throws Throwable { + return (Integer) makeRequest("validate", new RefreshRequest(authToken, null), null); + } + private void pipe(InputStream is, OutputStream out, byte[] buf) throws IOException { while (true) { int amt = is.read(buf); diff --git a/app/src/main/java/net/kdt/pojavlaunch/AndroidLWJGLKeycode.java b/app/src/main/java/net/kdt/pojavlaunch/AndroidLWJGLKeycode.java index 81c6934f3..76a3b6331 100644 --- a/app/src/main/java/net/kdt/pojavlaunch/AndroidLWJGLKeycode.java +++ b/app/src/main/java/net/kdt/pojavlaunch/AndroidLWJGLKeycode.java @@ -177,26 +177,32 @@ public class AndroidLWJGLKeycode { } } + // todo replace to mods param + int mods = 0; if (keyEvent.isAltPressed()) { - mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_ALT, keyEvent.getModifiers(), isDown); - } if (keyEvent.isCtrlPressed()) { - mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_CONTROL, keyEvent.getModifiers(), isDown); + mods &= LWJGLGLFWKeycode.GLFW_MOD_ALT; + } if (keyEvent.isCapsLockOn()) { + mods &= LWJGLGLFWKeycode.GLFW_MOD_CAPS_LOCK; + } if (keyEvent.isCtrlPressed()) { + mods &= LWJGLGLFWKeycode.GLFW_MOD_CONTROL; } if (keyEvent.isFunctionPressed()) { - // mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_FUNCTION, keyEvent.getModifiers(), isDown); - } if (keyEvent.isShiftPressed()) { - mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, keyEvent.getModifiers(), isDown); + // mods &= LWJGLGLFWKeycode.GLFW_MOD_FUC + } if (keyEvent.isNumLockOn()) { + mods &= LWJGLGLFWKeycode.GLFW_MOD_NUM_LOCK; + } if (keyEvent.isShiftPressed()) { + mods &= LWJGLGLFWKeycode.GLFW_MOD_SHIFT; } try { if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing()) { - mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), keyEvent.getModifiers(), isDown); + mainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(), mods, isDown); } } catch (Throwable th) { th.printStackTrace(); } if (isBackspaceAfterChar && (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing() && i != KeyEvent.KEYCODE_DEL) { - mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, keyEvent.getModifiers(), isDown); + mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, 0, isDown); } } diff --git a/app/src/main/java/net/kdt/pojavlaunch/MCProfile.java b/app/src/main/java/net/kdt/pojavlaunch/MCProfile.java index 5f16c29c1..de17198ab 100644 --- a/app/src/main/java/net/kdt/pojavlaunch/MCProfile.java +++ b/app/src/main/java/net/kdt/pojavlaunch/MCProfile.java @@ -9,172 +9,168 @@ import java.io.*; public class MCProfile { - private static String[] emptyBuilder = new String[]{ - "1.9", //Version - "ProfileIDEmpty", - "AccessToken", - "AccessTokenEmpty", - "Steve" - }; - - public static void launch(Activity ctx, Object o) - { - PojavProfile.setCurrentProfile(ctx, o); - - Intent intent = new Intent(ctx, PojavV2ActivityManager.getLauncherRemakeVer(ctx)); //MCLauncherActivity.class); - ctx.startActivity(intent); - } - - public static void updateTokens(final Activity ctx, final String pofFilePath, RefreshListener listen) throws Exception - { - new RefreshTokenTask(ctx, listen).execute(pofFilePath); - } - - public static String build(MCProfile.Builder builder) - { - //System.out.println("build THE VER = " + builder.getVersion()); - - try { - byte[] bFull = toString(builder).getBytes("UTF-8"); - Tools.write(Tools.mpProfiles + "/" + builder.getUsername(), bFull); - } catch (Exception e) { - e.printStackTrace(); - } - - return Tools.mpProfiles + "/" + builder.getUsername(); - } - - public static MCProfile.Builder load(String pofFilePath) - { - try { - //String th = new String(new byte[]{-128}); - String pofContent = Tools.read(pofFilePath); - return parse(pofContent); - } catch (Exception e) { - throw new RuntimeException("Unable to load Profile " + pofFilePath, e); - } - } - - public static MCProfile.Builder parse(String content) { - MCProfile.Builder builder = new MCProfile.Builder(); + private static String[] emptyBuilder = new String[]{ + "1.9", //Version + "ProfileIDEmpty", + "AccessToken", + "AccessTokenEmpty", + "Steve" + }; + + public static void launch(Activity ctx, Object o) { + PojavProfile.setCurrentProfile(ctx, o); + + Intent intent = new Intent(ctx, PojavV2ActivityManager.getLauncherRemakeVer(ctx)); //MCLauncherActivity.class); + ctx.startActivity(intent); + } + + public static void updateTokens(final Activity ctx, final String pofFilePath, RefreshListener listen) throws Exception { + new RefreshTokenTask(ctx, listen).execute(pofFilePath); + } + + public static String build(MCProfile.Builder builder) { + //System.out.println("build THE VER = " + builder.getVersion()); + + try { + byte[] bFull = toString(builder).getBytes("UTF-8"); + Tools.write(Tools.mpProfiles + "/" + builder.getUsername(), bFull); + } catch (Exception e) { + e.printStackTrace(); + } + + return Tools.mpProfiles + "/" + builder.getUsername(); + } + + public static MCProfile.Builder load(String pofFilePath) { + try { + //String th = new String(new byte[]{-128}); + String pofContent = Tools.read(pofFilePath); + return parse(pofContent); + } catch (Exception e) { + throw new RuntimeException("Unable to load Profile " + pofFilePath, e); + } + } + + public static MCProfile.Builder parse(String content) { + MCProfile.Builder builder = new MCProfile.Builder(); - String[] profileInfos = content.split(":"); + String[] profileInfos = content.split(":"); - String cltk = profileInfos[0]; - String prtk = profileInfos[1]; - String acct = profileInfos[2]; - String name = profileInfos[3]; - String vers = profileInfos[4]; - String isAc = profileInfos[5]; - - //System.out.println("parse THE VER = " + vers); + String cltk = profileInfos[0]; + String prtk = profileInfos[1]; + String acct = profileInfos[2]; + String name = profileInfos[3]; + String vers = profileInfos[4]; + String isAc = profileInfos[5]; + + //System.out.println("parse THE VER = " + vers); - builder.setClientID(cltk); - builder.setProfileID(prtk); - builder.setAccessToken(acct); - builder.setUsername(name); - builder.setVersion(vers); - builder.setIsMojangAccount(Boolean.parseBoolean(isAc)); + builder.setClientID(cltk); + builder.setProfileID(prtk); + builder.setAccessToken(acct); + builder.setUsername(name); + builder.setVersion(vers); + builder.setIsMojangAccount(Boolean.parseBoolean(isAc)); - return builder; - } - - public static MCProfile.Builder loadSafety(String pofFilePath) { - try { - return load(pofFilePath); - } catch (Exception e) { - e.printStackTrace(); - - // return new MCProfile.Builder(); - return null; - } - } + return builder; + } + + public static MCProfile.Builder loadSafety(String pofFilePath) { + try { + return load(pofFilePath); + } catch (Exception e) { + e.printStackTrace(); + + // return new MCProfile.Builder(); + return null; + } + } - public static String toString(String pofFilePath) { - return toString(load(pofFilePath)); - } - - public static String toString(MCProfile.Builder builder) { - return - builder.getClientID() + ":" + - builder.getProfileID() + ":" + - builder.getAccessToken() + ":" + - builder.getUsername() + ":" + - builder.getVersion() + ":" + - Boolean.toString(builder.isMojangAccount()); - } - - public static class Builder implements Serializable - { - private String[] fullArgs = new String[6]; - private boolean isMojangAccount = true; - - public Builder() - { - fullArgs = emptyBuilder; - setClientID("0"); - setProfileID("00000000-0000-0000-0000-000000000000"); - setAccessToken("0"); - } - - public boolean isMojangAccount() - { - return isMojangAccount; - } - - public String getVersion() - { - return fullArgs[0]; - } - - public String getClientID() - { - return fullArgs[1]; - } - - public String getProfileID() - { - return fullArgs[2]; - } - - public String getAccessToken() - { - return fullArgs[3]; - } - - public String getUsername() - { - return fullArgs[4]; - } - - public void setIsMojangAccount(boolean value) - { - isMojangAccount = value; - } - - public void setVersion(String value) - { - fullArgs[0] = value; - } - - public void setClientID(String value) - { - fullArgs[1] = value; - } - - public void setProfileID(String value) - { - fullArgs[2] = value; - } - - public void setAccessToken(String value) - { - fullArgs[3] = value; - } - - public void setUsername(String value) - { - fullArgs[4] = value; - } - } + public static String toString(String pofFilePath) { + return toString(load(pofFilePath)); + } + + public static String toString(MCProfile.Builder builder) { + return + builder.getClientID() + ":" + + builder.getProfileID() + ":" + + builder.getAccessToken() + ":" + + builder.getUsername() + ":" + + builder.getVersion() + ":" + + Boolean.toString(builder.isMojangAccount()); + } + + public static class Builder implements Serializable + { + private String[] fullArgs = new String[6]; + private boolean isMojangAccount = true; + + public Builder() + { + fullArgs = emptyBuilder; + setClientID("0"); + setProfileID("00000000-0000-0000-0000-000000000000"); + setAccessToken("0"); + } + + public boolean isMojangAccount() + { + return isMojangAccount; + } + + public String getVersion() + { + return fullArgs[0]; + } + + public String getClientID() + { + return fullArgs[1]; + } + + public String getProfileID() + { + return fullArgs[2]; + } + + public String getAccessToken() + { + return fullArgs[3]; + } + + public String getUsername() + { + return fullArgs[4]; + } + + public void setIsMojangAccount(boolean value) + { + isMojangAccount = value; + } + + public void setVersion(String value) + { + fullArgs[0] = value; + } + + public void setClientID(String value) + { + fullArgs[1] = value; + } + + public void setProfileID(String value) + { + fullArgs[2] = value; + } + + public void setAccessToken(String value) + { + fullArgs[3] = value; + } + + public void setUsername(String value) + { + fullArgs[4] = value; + } + } } diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk index 3436255c6..62b9abbda 100644 --- a/app/src/main/jni/Android.mk +++ b/app/src/main/jni/Android.mk @@ -1,9 +1,9 @@ LOCAL_PATH := $(call my-dir) HERE_PATH := $(LOCAL_PATH) -include $(HERE_PATH)/crash_dump/libbase/Android.mk -include $(HERE_PATH)/crash_dump/libbacktrace/Android.mk -include $(HERE_PATH)/crash_dump/debuggerd/Android.mk +# include $(HERE_PATH)/crash_dump/libbase/Android.mk +# include $(HERE_PATH)/crash_dump/libbacktrace/Android.mk +# include $(HERE_PATH)/crash_dump/debuggerd/Android.mk LOCAL_PATH := $(HERE_PATH) include $(CLEAR_VARS) diff --git a/app/src/main/jni/crash_dump/debuggerd/Android.mk b/app/src/main/jni/crash_dump/debuggerd/Android.mk index e140f339c..bb5544b2f 100644 --- a/app/src/main/jni/crash_dump/debuggerd/Android.mk +++ b/app/src/main/jni/crash_dump/debuggerd/Android.mk @@ -42,10 +42,10 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_CLANG := true -LOCAL_MODULE := debuggerd +LOCAL_MODULE := crashdump LOCAL_MULTILIB := both -include $(BUILD_EXECUTABLE) +include $(BUILD_SHARED_LIBRARY)