Skip to content

Commit

Permalink
first changes for inject variant
Browse files Browse the repository at this point in the history
  • Loading branch information
chiteroman committed Jan 26, 2025
1 parent 4eeddec commit 847b031
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 442 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Android CI

on:
push:
branches: [ "main" ]
branches: [ "inject" ]
pull_request:
branches: [ "main" ]
branches: [ "inject" ]

jobs:
build:
Expand Down
13 changes: 9 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 = 18500
versionName = "v18.5"
versionCode = 1
versionName = "v1-inject"
multiDexEnabled = false

externalNativeBuild {
Expand Down Expand Up @@ -114,9 +114,14 @@ tasks.register("copyFiles") {

dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true)

soDir.walk().filter { it.isFile && it.extension == "so" }.forEach { soFile ->
soDir.walk().filter { it.isFile }.forEach { soFile ->
val abiFolder = soFile.parentFile.name
val destination = moduleFolder.resolve("zygisk/$abiFolder.so")
var destination = File("")
if (soFile.name == "libinject.so") {
destination = moduleFolder.resolve("inject/$abiFolder.so")
} else if (soFile.name == "libzygisk.so") {
destination = moduleFolder.resolve("zygisk/$abiFolder.so")
}
soFile.copyTo(destination, overwrite = true)
}
}
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.22.1)

project("playintegrityfix")

find_package(cxx REQUIRED CONFIG)
add_library(zygisk SHARED main.cpp)

add_library(inject SHARED inject.cpp)

link_libraries(cxx::cxx)
target_link_libraries(zygisk PRIVATE log stdc++)

add_library(${CMAKE_PROJECT_NAME} SHARED main.cpp)
find_package(cxx REQUIRED CONFIG)

add_subdirectory(Dobby)

target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE log dobby_static)
target_link_libraries(dobby cxx::cxx)
target_link_libraries(dobby_static cxx::cxx)

target_link_libraries(inject PRIVATE log dobby_static)
19 changes: 19 additions & 0 deletions app/src/main/cpp/inject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <android/log.h>
#include <jni.h>
#include "json.hpp"
#include "dobby.h"

#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF", __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "PIF", __VA_ARGS__)

static std::string dir;
static JNIEnv *env;

extern "C" [[gnu::visibility("default"), maybe_unused]]
void init(char *rawDir, JavaVM *jvm) {
dir = rawDir;
LOGD("[INJECT] GMS dir: %s", dir.c_str());
jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6);

LOGD("[INJECT] Done!");
}
Loading

0 comments on commit 847b031

Please sign in to comment.