remove dobby inject (ver 1.0-beta3)

master 1.0
wlt233 2 years ago
parent 6c4cbf12c2
commit 7089b8eb5d

@ -11,8 +11,8 @@ android {
applicationId "moe.tqlwsl.aicemu"
minSdk 24
targetSdk 33
versionCode 2
versionName "1.0-Beta"
versionCode 4
versionName "1.0-Beta3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

@ -20,7 +20,6 @@ public class xp implements IXposedHookLoadPackage {
ClassLoader mclassloader = null;
Context mcontext = null;
// from https://github.com/OLIET2357/HCEFUnlocker
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
@ -28,72 +27,26 @@ public class xp implements IXposedHookLoadPackage {
if (lpparam.packageName.equals("com.android.nfc")) {
// XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
// "isValidSystemCode", String.class, new XC_MethodReplacement() {
// @Override
// protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
// String systemCode = (String) param.args[0];
// if (systemCode == null) {
// return false;
// }
//
// if (systemCode.length() != 4) {
// Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// return false;
// }
// // check if the value is between "4000" and "4FFF" (excluding "4*FF")
// if (!systemCode.startsWith("4") || systemCode.toUpperCase().endsWith("FF")) {
// // Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// // return false;
// }
// try {
// Integer.parseInt(systemCode, 16);
// } catch (NumberFormatException e) {
// Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// return false;
// }
// return true;
// }
// });
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
"isValidNfcid2", String.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
String nfcid2 = (String) param.args[0];
if (nfcid2 == null) {
return false;
}
if (nfcid2.length() != 16) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
// check if the the value starts with "02FE"
if (!nfcid2.toUpperCase().startsWith("02FE")) {
// Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
// return false;
}
try {
Long.parseLong(nfcid2, 16);
} catch (NumberFormatException e) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
return true;
}
});
XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
lpparam.classLoader, "onCreate", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
super.beforeHookedMethod(param);
Application application = (Application) param.thisObject;
mcontext = application.getApplicationContext();
XposedBridge.log("Got context");
}
});
// XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
// lpparam.classLoader, "onCreate", new XC_MethodHook() {
// @Override
// protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
// XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
// super.beforeHookedMethod(param);
// Application application = (Application) param.thisObject;
// mcontext = application.getApplicationContext();
// XposedBridge.log("Got context");
// }
// });
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation",
@ -102,24 +55,26 @@ public class xp implements IXposedHookLoadPackage {
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
XposedBridge.log("Inside android.nfc.cardemulation.NfcFCardEmulation#isValidSystemCode");
XposedBridge.log("Got classloader");
String path = getSoPath();
XposedBridge.log("So path = " + path);
int version = android.os.Build.VERSION.SDK_INT;
try {
if (!path.equals("")) {
XposedBridge.log("Start injecting libpmm.so");
if (version >= 28) {
XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
} else {
XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader);
}
XposedBridge.log("Injected libpmm.so");
}
} catch (Exception e) {
XposedBridge.log(e);
e.printStackTrace();
}
// mclassloader = mcontext.getClassLoader();
// XposedBridge.log("Got classloader");
// String path = getSoPath();
// XposedBridge.log("So path = " + path);
// int version = android.os.Build.VERSION.SDK_INT;
// try {
// if (!path.equals("")) {
// XposedBridge.log("Start injecting libpmm.so");
// if (version >= 28) {
// XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
// } else {
// XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader);
// }
// XposedBridge.log("Injected libpmm.so");
// }
// } catch (Exception e) {
// XposedBridge.log(e);
// e.printStackTrace();
// }
// Unlocker
param.setResult(true);

Loading…
Cancel
Save