fix bad code

This commit is contained in:
chiteroman 2025-01-15 21:11:31 +01:00
parent eea2f6bd3f
commit 9b4249424b
No known key found for this signature in database
4 changed files with 26 additions and 15 deletions

View File

@ -25,8 +25,8 @@ android {
applicationId = "es.chiteroman.playintegrityfix" applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 18201 versionCode = 18300
versionName = "v18.2.1-EXPERIMENTAL" versionName = "v18.3"
multiDexEnabled = false multiDexEnabled = false
externalNativeBuild { externalNativeBuild {
@ -37,8 +37,19 @@ android {
) )
arguments( arguments(
"-DCMAKE_BUILD_TYPE=MinSizeRel", "-DCMAKE_BUILD_TYPE=Release",
"-DANDROID_STL=none" "-DANDROID_STL=none",
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
"-DANDROID_ALLOW_UNDEFINED_SYMBOLS=ON",
"-DCMAKE_CXX_STANDARD=23",
"-DCMAKE_C_STANDARD=23",
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON",
"-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON",
"-DCMAKE_CXX_VISIBILITY_PRESET=hidden",
"-DCMAKE_C_VISIBILITY_PRESET=hidden",
"-DCMAKE_ANDROID_EXCEPTIONS=OFF",
"-DCMAKE_ANDROID_RTTI=OFF",
"-DANDROID_CPP_FEATURES='no-rtti no-exceptions'"
) )
cFlags( cFlags(

View File

@ -241,7 +241,7 @@ void injectDex() {
extern "C" { extern "C" {
[[gnu::visibility("default"), maybe_unused]] [[gnu::visibility("default"), maybe_unused]]
void init(const char *dir, JavaVM *jvm) { void init(const char *dir, JavaVM *jvm, jint jni_version) {
if (dir) { if (dir) {
LOGD("[INJECT] GMS dir: %s", dir); LOGD("[INJECT] GMS dir: %s", dir);
@ -251,18 +251,18 @@ void init(const char *dir, JavaVM *jvm) {
} }
if (jvm) { if (jvm) {
auto result = jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6); auto result = jvm->GetEnv(reinterpret_cast<void **>(&env), jni_version);
LOGD("[INJECT] JVM: %d", result); if (result != JNI_OK) {
if (result == JNI_EDETACHED) { LOGE("[INJECT] GetEnv error: %d", result);
result = jvm->AttachCurrentThread(&env, nullptr); return;
LOGD("[INJECT] (JNI_EDETACHED) JVM: %d", result);
} }
} else { } else {
LOGE("[INJECT] jvm is null!"); LOGE("[INJECT] jvm is null!");
return;
} }
if (env) { if (env) {
LOGD("[INJECT] JNIEnv: %d", env->GetVersion()); LOGD("[INJECT] JNIEnv version: %x", env->GetVersion());
} else { } else {
LOGE("[INJECT] env is null!"); LOGE("[INJECT] env is null!");
return; return;

View File

@ -263,7 +263,7 @@ public:
dlerror(); dlerror();
typedef void (*init_t)(const char *, JavaVM *); typedef void (*init_t)(const char *, JavaVM *, jint);
auto init_func = reinterpret_cast<init_t>(dlsym(handle, "init")); auto init_func = reinterpret_cast<init_t>(dlsym(handle, "init"));
const char *error = dlerror(); const char *error = dlerror();
@ -281,7 +281,7 @@ public:
return; return;
} }
init_func(gmsDir.c_str(), jvm); init_func(gmsDir.c_str(), jvm, env->GetVersion());
} }
void preServerSpecialize(ServerSpecializeArgs *args) override { void preServerSpecialize(ServerSpecializeArgs *args) override {

View File

@ -1,7 +1,7 @@
id=playintegrityfix id=playintegrityfix
name=Play Integrity Fix name=Play Integrity Fix
version=v18.2.1-EXPERIMENTAL version=v18.3
versionCode=18201 versionCode=18300
author=chiteroman author=chiteroman
description=Universal modular fix for Play Integrity (and SafetyNet) on devices running Android 8-15 description=Universal modular fix for Play Integrity (and SafetyNet) on devices running Android 8-15
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json