mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 06:05:10 -04:00
Merge branch 'gl4es' of https://github.com/khanhduytran0/PojavLauncher.git into gl4es
This commit is contained in:
commit
5af41ff0b8
@ -1029,11 +1029,11 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
||||
|
||||
Cipher rsaPkcs1Cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
Cipher rsaCipher = Cipher.getInstance("RSA");
|
||||
|
||||
/*
|
||||
for (Provider.Service ser : rsaPkcs1Cipher.getProvider().getServices()) {
|
||||
System.out.println(" - " + ser.getType() + ", " + ser.getAlgorithm());
|
||||
}
|
||||
|
||||
*/
|
||||
Provider.Service servicePkcs1 = rsaPkcs1Cipher.getProvider().getService("Cipher", "RSA/ECB/PKCS1Padding");
|
||||
Provider rsaProvider = rsaCipher.getProvider();
|
||||
|
||||
@ -1066,11 +1066,28 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
||||
*/
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
|
||||
final File rsaFixFile = new File(Tools.MAIN_PATH, "rsapadding_error.txt");
|
||||
|
||||
// Debug information
|
||||
PrintStream rsaFixStream = new PrintStream(rsaFixFile);
|
||||
rsaFixStream.println("--- RSA PADDING ERROR ---");
|
||||
rsaFixStream.println("• Error stack trace");
|
||||
th.printStackTrace(rsaFixStream);
|
||||
rsaFixStream.println();
|
||||
rsaFixStream.println("• RSAPadding info");
|
||||
rsaFixStream.println(" - Patch method: " + (Build.VERSION.SDK_INT < 24 ? "Direct (no" : "Reflection Bypass (with") + " security check)");
|
||||
rsaFixStream.println(" - getDeclaredMethods() return");
|
||||
debug_printMethodInfo(rsaFixStream, Provider.class.getDeclaredMethods());
|
||||
rsaFixStream.println(" - getMethods() return");
|
||||
debug_printMethodInfo(rsaFixStream, Provider.class.getMethods());
|
||||
rsaFixStream.println("• System info");
|
||||
rsaFixStream.println(" - Android version " + Build.VERSION.RELEASE + " (API " + Integer.toString(Build.VERSION.SDK_INT) + ")");
|
||||
|
||||
runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(MainActivity.this, "Unable to fix RSAPadding. Premium features is limited!", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(MainActivity.this, "Unable to fix RSAPadding. Premium features is limited! Send the file at " + rsaFixFile.getAbsolutePath() + " to the developer", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1087,6 +1104,50 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
||||
System.out.println("After: " + provider.getService("KeyService", "RSA"));
|
||||
*/
|
||||
}
|
||||
|
||||
private void debug_printMethodInfo(PrintStream stream, Method[] methods) {
|
||||
StringBuilder methodInfo = new StringBuilder();
|
||||
for (Method method : methods) {
|
||||
methodInfo.setLength(0);
|
||||
if (Modifier.isPublic(method.getModifiers())) {
|
||||
methodInfo.append("public ");
|
||||
} else if (Modifier.isPrivate(method.getModifiers())) {
|
||||
methodInfo.append("private ");
|
||||
} else if (Modifier.isProtected(method.getModifiers())) {
|
||||
methodInfo.append("protected ");
|
||||
}
|
||||
|
||||
if (Modifier.isSynchronized(method.getModifiers())) {
|
||||
methodInfo.append("synchronized ");
|
||||
}
|
||||
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
methodInfo.append("static ");
|
||||
}
|
||||
|
||||
if (Modifier.isAbstract(method.getModifiers())) {
|
||||
methodInfo.append("abstract ");
|
||||
}
|
||||
|
||||
if (Modifier.isFinal(method.getModifiers())) {
|
||||
methodInfo.append("final ");
|
||||
}
|
||||
|
||||
methodInfo.append(method.getName() + "(");
|
||||
int paramLength = method.getParameterTypes().length;
|
||||
for (int i = 0; i < paramLength; i++) {
|
||||
Class params = method.getParameterTypes()[i];
|
||||
|
||||
methodInfo.append(params.getName());
|
||||
if (i + 1 < paramLength) {
|
||||
methodInfo.append(", ");
|
||||
}
|
||||
}
|
||||
methodInfo.append(")");
|
||||
|
||||
stream.println(methodInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public void printStream(InputStream stream) {
|
||||
try {
|
||||
|
@ -380,15 +380,15 @@ public final class Tools
|
||||
}
|
||||
|
||||
// Prevent NullPointerException
|
||||
private static void insertSafety(JMinecraftVersionList.Version inheritsVer, JMinecraftVersionList.Version theVer, String... keyArr) {
|
||||
private static void insertSafety(JMinecraftVersionList.Version targetVer, JMinecraftVersionList.Version fromVer, String... keyArr) {
|
||||
for (String key : keyArr) {
|
||||
Object value = null;
|
||||
try {
|
||||
Field fieldA = theVer.getClass().getDeclaredField(key);
|
||||
value = fieldA.get(theVer);
|
||||
Field fieldA = fromVer.getClass().getDeclaredField(key);
|
||||
value = fieldA.get(fromVer);
|
||||
if (value != null || ((value instanceof String) && !((String) value).isEmpty())) {
|
||||
Field fieldB = inheritsVer.getClass().getDeclaredField(key);
|
||||
fieldB.set(inheritsVer, value);
|
||||
Field fieldB = targetVer.getClass().getDeclaredField(key);
|
||||
fieldB.set(targetVer, value);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
System.err.println("Unable to insert " + key + "=" + value);
|
||||
|
@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<string-array name="mcl_options">
|
||||
<item>@string/mcl_option_modmgr</item>
|
||||
<!-- <item>@string/mcl_option_forgeinstall</item> -->
|
||||
<item>@string/mcl_option_optifineinstall</item>
|
||||
<item>@string/mcl_option_customcontrol</item>
|
||||
<item>@string/mcl_option_settings</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user