Skip to content

Commit

Permalink
fix bad code
Browse files Browse the repository at this point in the history
  • Loading branch information
chiteroman committed Jan 15, 2025
1 parent eea2f6b commit 9b42494
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
19 changes: 15 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
targetSdk = 35
versionCode = 18201
versionName = "v18.2.1-EXPERIMENTAL"
versionCode = 18300
versionName = "v18.3"
multiDexEnabled = false

externalNativeBuild {
Expand All @@ -37,8 +37,19 @@ android {
)

arguments(
"-DCMAKE_BUILD_TYPE=MinSizeRel",
"-DANDROID_STL=none"
"-DCMAKE_BUILD_TYPE=Release",
"-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(
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/cpp/inject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void injectDex() {

extern "C" {
[[gnu::visibility("default"), maybe_unused]]
void init(const char *dir, JavaVM *jvm) {
void init(const char *dir, JavaVM *jvm, jint jni_version) {

if (dir) {
LOGD("[INJECT] GMS dir: %s", dir);
Expand All @@ -251,18 +251,18 @@ void init(const char *dir, JavaVM *jvm) {
}

if (jvm) {
auto result = jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6);
LOGD("[INJECT] JVM: %d", result);
if (result == JNI_EDETACHED) {
result = jvm->AttachCurrentThread(&env, nullptr);
LOGD("[INJECT] (JNI_EDETACHED) JVM: %d", result);
auto result = jvm->GetEnv(reinterpret_cast<void **>(&env), jni_version);
if (result != JNI_OK) {
LOGE("[INJECT] GetEnv error: %d", result);
return;
}
} else {
LOGE("[INJECT] jvm is null!");
return;
}

if (env) {
LOGD("[INJECT] JNIEnv: %d", env->GetVersion());
LOGD("[INJECT] JNIEnv version: %x", env->GetVersion());
} else {
LOGE("[INJECT] env is null!");
return;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class PlayIntegrityFix : public ModuleBase {

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"));
const char *error = dlerror();
Expand All @@ -281,7 +281,7 @@ class PlayIntegrityFix : public ModuleBase {
return;
}

init_func(gmsDir.c_str(), jvm);
init_func(gmsDir.c_str(), jvm, env->GetVersion());
}

void preServerSpecialize(ServerSpecializeArgs *args) override {
Expand Down
4 changes: 2 additions & 2 deletions module/module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=playintegrityfix
name=Play Integrity Fix
version=v18.2.1-EXPERIMENTAL
versionCode=18201
version=v18.3
versionCode=18300
author=chiteroman
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

0 comments on commit 9b42494

Please sign in to comment.