|
|
@ -1,9 +1,14 @@
|
|
|
|
package moe.tqlwsl.aicemu;
|
|
|
|
package moe.tqlwsl.aicemu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
|
|
|
import android.app.ActivityManager;
|
|
|
|
import android.app.Application;
|
|
|
|
import android.app.Application;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -11,6 +16,7 @@ import java.util.List;
|
|
|
|
import de.robv.android.xposed.IXposedHookLoadPackage;
|
|
|
|
import de.robv.android.xposed.IXposedHookLoadPackage;
|
|
|
|
import de.robv.android.xposed.XC_MethodHook;
|
|
|
|
import de.robv.android.xposed.XC_MethodHook;
|
|
|
|
import de.robv.android.xposed.XC_MethodReplacement;
|
|
|
|
import de.robv.android.xposed.XC_MethodReplacement;
|
|
|
|
|
|
|
|
import de.robv.android.xposed.XSharedPreferences;
|
|
|
|
import de.robv.android.xposed.XposedBridge;
|
|
|
|
import de.robv.android.xposed.XposedBridge;
|
|
|
|
import de.robv.android.xposed.XposedHelpers;
|
|
|
|
import de.robv.android.xposed.XposedHelpers;
|
|
|
|
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
|
|
|
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
|
|
@ -24,7 +30,6 @@ public class xp implements IXposedHookLoadPackage {
|
|
|
|
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
|
|
|
|
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
|
|
|
|
|
|
|
|
|
|
|
|
XposedBridge.log("In " + lpparam.packageName);
|
|
|
|
XposedBridge.log("In " + lpparam.packageName);
|
|
|
|
|
|
|
|
|
|
|
|
if (lpparam.packageName.equals("com.android.nfc")) {
|
|
|
|
if (lpparam.packageName.equals("com.android.nfc")) {
|
|
|
|
|
|
|
|
|
|
|
|
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
|
|
|
|
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
|
|
|
@ -36,45 +41,47 @@ public class xp implements IXposedHookLoadPackage {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
|
|
|
|
XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
|
|
|
|
// lpparam.classLoader, "onCreate", new XC_MethodHook() {
|
|
|
|
lpparam.classLoader, "onCreate", new XC_MethodHook() {
|
|
|
|
// @Override
|
|
|
|
@Override
|
|
|
|
// protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
|
|
|
|
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
|
|
|
|
// XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
|
|
|
|
XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
|
|
|
|
// super.beforeHookedMethod(param);
|
|
|
|
super.beforeHookedMethod(param);
|
|
|
|
// Application application = (Application) param.thisObject;
|
|
|
|
Application application = (Application) param.thisObject;
|
|
|
|
// mcontext = application.getApplicationContext();
|
|
|
|
mcontext = application.getApplicationContext();
|
|
|
|
// XposedBridge.log("Got context");
|
|
|
|
XposedBridge.log("Got context");
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation",
|
|
|
|
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation",
|
|
|
|
lpparam.classLoader, "isValidSystemCode", String.class, new XC_MethodHook() {
|
|
|
|
lpparam.classLoader, "isValidSystemCode", String.class, new XC_MethodHook() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
|
|
|
|
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
|
|
|
|
super.afterHookedMethod(param);
|
|
|
|
|
|
|
|
XposedBridge.log("Inside android.nfc.cardemulation.NfcFCardEmulation#isValidSystemCode");
|
|
|
|
XposedBridge.log("Inside android.nfc.cardemulation.NfcFCardEmulation#isValidSystemCode");
|
|
|
|
|
|
|
|
|
|
|
|
// mclassloader = mcontext.getClassLoader();
|
|
|
|
mclassloader = mcontext.getClassLoader();
|
|
|
|
// XposedBridge.log("Got classloader");
|
|
|
|
XposedBridge.log("Got classloader");
|
|
|
|
// String path = getSoPath();
|
|
|
|
String path = getSoPath();
|
|
|
|
// XposedBridge.log("So path = " + path);
|
|
|
|
XposedBridge.log("So path = " + path);
|
|
|
|
// int version = android.os.Build.VERSION.SDK_INT;
|
|
|
|
try {
|
|
|
|
// try {
|
|
|
|
Boolean needLoadPmmtool = false;
|
|
|
|
// if (!path.equals("")) {
|
|
|
|
XSharedPreferences pref = getPref();
|
|
|
|
// XposedBridge.log("Start injecting libpmm.so");
|
|
|
|
if (pref != null) {
|
|
|
|
// if (version >= 28) {
|
|
|
|
needLoadPmmtool = pref.getBoolean("loadPmmtool", false);
|
|
|
|
// XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
|
|
|
|
} else {
|
|
|
|
// } else {
|
|
|
|
XposedBridge.log("Cannot load pref for AICEmu properly");
|
|
|
|
// XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
XposedBridge.log("loadPmmtool: " + needLoadPmmtool.toString());
|
|
|
|
// XposedBridge.log("Injected libpmm.so");
|
|
|
|
if (needLoadPmmtool && !path.equals("")) {
|
|
|
|
// }
|
|
|
|
XposedBridge.log("Start injecting libpmm.so");
|
|
|
|
// } catch (Exception e) {
|
|
|
|
XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
|
|
|
|
// XposedBridge.log(e);
|
|
|
|
XposedBridge.log("Injected libpmm.so");
|
|
|
|
// e.printStackTrace();
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
XposedBridge.log(e);
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Unlocker
|
|
|
|
// Unlocker
|
|
|
|
param.setResult(true);
|
|
|
|
param.setResult(true);
|
|
|
@ -84,7 +91,10 @@ public class xp implements IXposedHookLoadPackage {
|
|
|
|
XposedBridge.log("Hook succeeded!!!");
|
|
|
|
XposedBridge.log("Hook succeeded!!!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static XSharedPreferences getPref() {
|
|
|
|
|
|
|
|
XSharedPreferences pref = new XSharedPreferences("moe.tqlwsl.aicemu", "AICEmu");
|
|
|
|
|
|
|
|
return pref.getFile().canRead() ? pref : null;
|
|
|
|
|
|
|
|
}
|
|
|
|
private String getSoPath() {
|
|
|
|
private String getSoPath() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String text = "";
|
|
|
|
String text = "";
|
|
|
|