add pmmtool work status check

master
wlt233 1 year ago
parent 2186a78aba
commit 5442c328be

@ -4,15 +4,17 @@ import android.annotation.SuppressLint
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.graphics.Color import android.graphics.Color
import android.os.Build import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import org.lsposed.hiddenapibypass.HiddenApiBypass import org.lsposed.hiddenapibypass.HiddenApiBypass
import java.lang.reflect.Method
class SettingActivity : AppCompatActivity() { class SettingActivity : AppCompatActivity() {
private var isHCEFSupported: Boolean = false private var isHCEFSupported: Boolean = false
private var isHCEFUnlocked: Boolean = false private var isHCEFUnlocked: Boolean = false
private var pmmtoolStatus: String? = ""
val TAG: String = "AICEmu" val TAG: String = "AICEmu"
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -49,6 +51,22 @@ class SettingActivity : AppCompatActivity() {
e.printStackTrace() e.printStackTrace()
textUnlocker.setText(R.string.Unlocker_work_error) textUnlocker.setText(R.string.Unlocker_work_error)
} }
val textPmmtool = findViewById<TextView>(R.id.pmmtool_work_text)
pmmtoolStatus = getProperty("tmp.AICEmu.pmmtool");
if (pmmtoolStatus == "") {
textPmmtool.setText(R.string.Pmmtool_work_false)
textPmmtool.setTextColor(Color.RED)
}
else if (pmmtoolStatus == "0") {
textPmmtool.setText(R.string.Pmmtool_work_hook_failed)
textPmmtool.setTextColor(Color.RED)
}
else if (pmmtoolStatus == "1") {
textPmmtool.setText(R.string.Pmmtool_work_true)
textPmmtool.setTextColor(Color.GREEN)
}
} }
} }
@ -63,5 +81,18 @@ class SettingActivity : AppCompatActivity() {
HiddenApiBypass.invoke(clazz, null, "isValidSystemCode", systemCode) as Boolean HiddenApiBypass.invoke(clazz, null, "isValidSystemCode", systemCode) as Boolean
} }
} }
@SuppressLint("PrivateApi")
fun getProperty(key: String?): String? {
try {
val c = Class.forName("android.os.SystemProperties")
val set: Method = c.getMethod("get", String::class.java)
return set.invoke(c, key)?.toString()
} catch (e: java.lang.Exception) {
Log.d("AICEmu", "getProperty exception")
e.printStackTrace()
return ""
}
}
} }
} }

@ -38,6 +38,7 @@ void *new_func(u_int8_t a1, u_int8_t *a2, int a3) {
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j)
sprintf(pmm_str + j * 3, "%02x ", *(char *)(a2 + i + 2 + j)); sprintf(pmm_str + j * 3, "%02x ", *(char *)(a2 + i + 2 + j));
__android_log_print(6, "AICEmu-pmmtool", "[1] new PMm: %s", pmm_str); __android_log_print(6, "AICEmu-pmmtool", "[1] new PMm: %s", pmm_str);
__system_property_set("tmp.AICEmu.pmmtool", "1");
} }
} }
@ -59,6 +60,7 @@ void *new_func(u_int8_t a1, u_int8_t *a2, int a3) {
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j)
sprintf(pmm_str + j * 3, "%02x ", *(char *)(a2 + i + j)); sprintf(pmm_str + j * 3, "%02x ", *(char *)(a2 + i + j));
__android_log_print(6, "AICEmu-pmmtool", "[2] new PMm: %s", pmm_str); __android_log_print(6, "AICEmu-pmmtool", "[2] new PMm: %s", pmm_str);
__system_property_set("tmp.AICEmu.pmmtool", "1");
} }
} }
//} //}
@ -70,6 +72,7 @@ void *new_func(u_int8_t a1, u_int8_t *a2, int a3) {
jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
__android_log_print(6, "AICEmu-pmmtool", "Inside JNI_OnLoad"); __android_log_print(6, "AICEmu-pmmtool", "Inside JNI_OnLoad");
__system_property_set("tmp.AICEmu.pmmtool", "0");
JNIEnv *env = nullptr; JNIEnv *env = nullptr;
if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) == JNI_OK) { if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) == JNI_OK) {
//void *func_addr = DobbySymbolResolver("libnfc-nci.so", "_Z23nfa_dm_check_set_confighPhb"); //void *func_addr = DobbySymbolResolver("libnfc-nci.so", "_Z23nfa_dm_check_set_confighPhb");

@ -13,6 +13,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h> #include <unistd.h>
#include <sys/system_properties.h>
void *(*old_func)(u_int8_t, u_int8_t *, int) = nullptr; void *(*old_func)(u_int8_t, u_int8_t *, int) = nullptr;
#endif //MAIN_H #endif //MAIN_H

@ -28,5 +28,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/hcef_support_text" /> app:layout_constraintTop_toBottomOf="@+id/hcef_support_text" />
<TextView
android:id="@+id/pmmtool_work_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textSize="32sp"
android:text="@string/Pmmtool_work_false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/unlocker_work_text" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -15,6 +15,9 @@
<string name="HCEF_support_false">设备不支持 HCE-F...</string> <string name="HCEF_support_false">设备不支持 HCE-F...</string>
<string name="HCEF_support_true">设备支持 HCE-F</string> <string name="HCEF_support_true">设备支持 HCE-F</string>
<string name="Unlocker_work_true">Unlocker 运行中!</string> <string name="Unlocker_work_true">Unlocker 运行中!</string>
<string name="Unlocker_work_false">Unlocker 没在工作...</string> <string name="Unlocker_work_false">Unlocker 炸了...</string>
<string name="Unlocker_work_error">Unlocker 出错了!</string> <string name="Unlocker_work_error">Unlocker 出现了错误!</string>
<string name="Pmmtool_work_true">Pmmtool 运行中!</string>
<string name="Pmmtool_work_false">Pmmtool 炸了...</string>
<string name="Pmmtool_work_hook_failed">Hook 失败了...</string>
</resources> </resources>

@ -23,4 +23,7 @@
<string name="Unlocker_work_true">Unlocker is working!</string> <string name="Unlocker_work_true">Unlocker is working!</string>
<string name="Unlocker_work_false">Unlocker not working...</string> <string name="Unlocker_work_false">Unlocker not working...</string>
<string name="Unlocker_work_error">Unlocker Error!</string> <string name="Unlocker_work_error">Unlocker Error!</string>
<string name="Pmmtool_work_true">Pmmtool is working!</string>
<string name="Pmmtool_work_false">Pmmtool not working...</string>
<string name="Pmmtool_work_hook_failed">Hook failed...</string>
</resources> </resources>
Loading…
Cancel
Save