From 9774d68b3b8fd1b48525808beefb68a47903e11d Mon Sep 17 00:00:00 2001
From: chiteroman <98092901+chiteroman@users.noreply.github.com>
Date: Thu, 23 Nov 2023 20:14:58 +0100
Subject: [PATCH] v13.5-beta
---
.idea/vcs.xml | 1 +
app/build.gradle.kts | 26 +-
app/src/main/cpp/Android.mk | 33 +
app/src/main/cpp/Application.mk | 6 +
app/src/main/cpp/CMakeLists.txt | 15 -
app/src/main/cpp/Dobby | 1 -
app/src/main/cpp/libcxx | 1 +
app/src/main/cpp/main.cpp | 168 +-
app/src/main/cpp/shadowhook/arch/arm/sh_a32.c | 446 ++
app/src/main/cpp/shadowhook/arch/arm/sh_a32.h | 41 +
.../main/cpp/shadowhook/arch/arm/sh_inst.c | 523 ++
.../main/cpp/shadowhook/arch/arm/sh_inst.h | 41 +
app/src/main/cpp/shadowhook/arch/arm/sh_t16.c | 284 +
app/src/main/cpp/shadowhook/arch/arm/sh_t16.h | 46 +
app/src/main/cpp/shadowhook/arch/arm/sh_t32.c | 408 ++
app/src/main/cpp/shadowhook/arch/arm/sh_t32.h | 36 +
app/src/main/cpp/shadowhook/arch/arm/sh_txx.c | 60 +
app/src/main/cpp/shadowhook/arch/arm/sh_txx.h | 39 +
.../main/cpp/shadowhook/arch/arm64/sh_a64.c | 310 ++
.../main/cpp/shadowhook/arch/arm64/sh_a64.h | 44 +
.../main/cpp/shadowhook/arch/arm64/sh_inst.c | 203 +
.../main/cpp/shadowhook/arch/arm64/sh_inst.h | 42 +
app/src/main/cpp/shadowhook/common/bytesig.c | 291 +
app/src/main/cpp/shadowhook/common/bytesig.h | 157 +
.../main/cpp/shadowhook/common/sh_config.h | 55 +
app/src/main/cpp/shadowhook/common/sh_errno.c | 107 +
app/src/main/cpp/shadowhook/common/sh_errno.h | 40 +
app/src/main/cpp/shadowhook/common/sh_log.c | 53 +
app/src/main/cpp/shadowhook/common/sh_log.h | 70 +
app/src/main/cpp/shadowhook/common/sh_sig.h | 49 +
.../main/cpp/shadowhook/common/sh_trampo.c | 172 +
.../main/cpp/shadowhook/common/sh_trampo.h | 52 +
app/src/main/cpp/shadowhook/common/sh_util.c | 538 ++
app/src/main/cpp/shadowhook/common/sh_util.h | 96 +
.../main/cpp/shadowhook/include/shadowhook.h | 191 +
app/src/main/cpp/shadowhook/sh_enter.c | 47 +
app/src/main/cpp/shadowhook/sh_enter.h | 30 +
app/src/main/cpp/shadowhook/sh_exit.c | 420 ++
app/src/main/cpp/shadowhook/sh_exit.h | 34 +
app/src/main/cpp/shadowhook/sh_hub.c | 538 ++
app/src/main/cpp/shadowhook/sh_hub.h | 45 +
app/src/main/cpp/shadowhook/sh_jni.c | 139 +
app/src/main/cpp/shadowhook/sh_linker.c | 409 ++
app/src/main/cpp/shadowhook/sh_linker.h | 41 +
app/src/main/cpp/shadowhook/sh_recorder.c | 517 ++
app/src/main/cpp/shadowhook/sh_recorder.h | 37 +
app/src/main/cpp/shadowhook/sh_safe.c | 133 +
app/src/main/cpp/shadowhook/sh_safe.h | 37 +
app/src/main/cpp/shadowhook/sh_switch.c | 343 ++
app/src/main/cpp/shadowhook/sh_switch.h | 34 +
app/src/main/cpp/shadowhook/sh_task.c | 333 ++
app/src/main/cpp/shadowhook/sh_task.h | 40 +
app/src/main/cpp/shadowhook/shadowhook.c | 328 ++
.../cpp/shadowhook/third_party/bsd/queue.h | 551 ++
.../cpp/shadowhook/third_party/bsd/tree.h | 759 +++
.../cpp/shadowhook/third_party/lss/LICENSE | 28 +
.../third_party/lss/linux_syscall_support.h | 4867 +++++++++++++++++
.../cpp/shadowhook/third_party/xdl/LICENSE | 21 +
.../main/cpp/shadowhook/third_party/xdl/xdl.c | 910 +++
.../main/cpp/shadowhook/third_party/xdl/xdl.h | 92 +
.../shadowhook/third_party/xdl/xdl_iterate.c | 297 +
.../shadowhook/third_party/xdl/xdl_iterate.h | 43 +
.../shadowhook/third_party/xdl/xdl_linker.c | 234 +
.../shadowhook/third_party/xdl/xdl_linker.h | 40 +
.../cpp/shadowhook/third_party/xdl/xdl_lzma.c | 187 +
.../cpp/shadowhook/third_party/xdl/xdl_lzma.h | 40 +
.../cpp/shadowhook/third_party/xdl/xdl_util.c | 95 +
.../cpp/shadowhook/third_party/xdl/xdl_util.h | 71 +
.../playintegrityfix/EntryPoint.java | 14 +-
69 files changed, 16266 insertions(+), 133 deletions(-)
create mode 100644 app/src/main/cpp/Android.mk
create mode 100644 app/src/main/cpp/Application.mk
delete mode 100644 app/src/main/cpp/CMakeLists.txt
delete mode 160000 app/src/main/cpp/Dobby
create mode 160000 app/src/main/cpp/libcxx
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_a32.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_a32.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_inst.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_inst.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t16.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t16.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t32.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t32.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_txx.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_txx.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_a64.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_a64.h
create mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_inst.c
create mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_inst.h
create mode 100644 app/src/main/cpp/shadowhook/common/bytesig.c
create mode 100644 app/src/main/cpp/shadowhook/common/bytesig.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_config.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_errno.c
create mode 100644 app/src/main/cpp/shadowhook/common/sh_errno.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_log.c
create mode 100644 app/src/main/cpp/shadowhook/common/sh_log.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_sig.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_trampo.c
create mode 100644 app/src/main/cpp/shadowhook/common/sh_trampo.h
create mode 100644 app/src/main/cpp/shadowhook/common/sh_util.c
create mode 100644 app/src/main/cpp/shadowhook/common/sh_util.h
create mode 100644 app/src/main/cpp/shadowhook/include/shadowhook.h
create mode 100644 app/src/main/cpp/shadowhook/sh_enter.c
create mode 100644 app/src/main/cpp/shadowhook/sh_enter.h
create mode 100644 app/src/main/cpp/shadowhook/sh_exit.c
create mode 100644 app/src/main/cpp/shadowhook/sh_exit.h
create mode 100644 app/src/main/cpp/shadowhook/sh_hub.c
create mode 100644 app/src/main/cpp/shadowhook/sh_hub.h
create mode 100644 app/src/main/cpp/shadowhook/sh_jni.c
create mode 100644 app/src/main/cpp/shadowhook/sh_linker.c
create mode 100644 app/src/main/cpp/shadowhook/sh_linker.h
create mode 100644 app/src/main/cpp/shadowhook/sh_recorder.c
create mode 100644 app/src/main/cpp/shadowhook/sh_recorder.h
create mode 100644 app/src/main/cpp/shadowhook/sh_safe.c
create mode 100644 app/src/main/cpp/shadowhook/sh_safe.h
create mode 100644 app/src/main/cpp/shadowhook/sh_switch.c
create mode 100644 app/src/main/cpp/shadowhook/sh_switch.h
create mode 100644 app/src/main/cpp/shadowhook/sh_task.c
create mode 100644 app/src/main/cpp/shadowhook/sh_task.h
create mode 100644 app/src/main/cpp/shadowhook/shadowhook.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/bsd/queue.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/bsd/tree.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/lss/LICENSE
create mode 100644 app/src/main/cpp/shadowhook/third_party/lss/linux_syscall_support.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/LICENSE
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_iterate.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_iterate.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_linker.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_linker.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_lzma.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_lzma.h
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_util.c
create mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_util.h
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..25dfc0f 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 4bdc43e..c6a5fc3 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -15,20 +15,11 @@ android {
versionCode = 1
versionName = "1.0"
- packaging {
- jniLibs {
- excludes += "**/libdobby.so"
- }
- }
-
- buildFeatures {
- prefab = true
- }
-
externalNativeBuild {
- cmake {
- arguments += setOf("-DANDROID_STL=none", "-DCMAKE_BUILD_TYPE=MinSizeRel")
- cppFlags += setOf("-std=c++20", "-fno-exceptions", "-fno-rtti", "-fvisibility=hidden", "-fvisibility-inlines-hidden")
+ ndk {
+ jobs = Runtime.getRuntime().availableProcessors()
+ abiFilters += "armeabi-v7a"
+ abiFilters += "arm64-v8a"
}
}
}
@@ -47,13 +38,8 @@ android {
}
externalNativeBuild {
- cmake {
- path = file("src/main/cpp/CMakeLists.txt")
- version = "3.22.1"
+ ndkBuild {
+ path = file("src/main/cpp/Android.mk")
}
}
-}
-
-dependencies {
- implementation("dev.rikka.ndk.thirdparty:cxx:1.2.0")
}
\ No newline at end of file
diff --git a/app/src/main/cpp/Android.mk b/app/src/main/cpp/Android.mk
new file mode 100644
index 0000000..9632627
--- /dev/null
+++ b/app/src/main/cpp/Android.mk
@@ -0,0 +1,33 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := zygisk
+LOCAL_SRC_FILES := main.cpp
+LOCAL_C_INCLUDES := $(LOCAL_PATH)
+
+LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/shadowhook/*.c)
+LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/shadowhook/common/*.c)
+LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/shadowhook/third_party/xdl/*.c)
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/common
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/third_party/bsd
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/third_party/lss
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/third_party/xdl
+
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/shadowhook/arch/arm/*.c)
+ LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/arch/arm
+endif
+
+ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
+ LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/shadowhook/arch/arm64/*.c)
+ LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/arch/arm64
+endif
+
+LOCAL_STATIC_LIBRARIES := libcxx
+LOCAL_LDLIBS := -llog
+include $(BUILD_SHARED_LIBRARY)
+
+include $(LOCAL_PATH)/libcxx/Android.mk
\ No newline at end of file
diff --git a/app/src/main/cpp/Application.mk b/app/src/main/cpp/Application.mk
new file mode 100644
index 0000000..c6cdbe7
--- /dev/null
+++ b/app/src/main/cpp/Application.mk
@@ -0,0 +1,6 @@
+FLAGS := -DNDEBUG -g0 -Oz -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -flto=full -Wl,--icf=all -Wl,--exclude-libs,ALL -Wl,--gc-sections
+
+APP_STL := none
+APP_CPPFLAGS := -std=c++20
+APP_CFLAGS := $(FLAGS)
+APP_LDFLAGS := $(FLAGS)
\ No newline at end of file
diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt
deleted file mode 100644
index 2071d71..0000000
--- a/app/src/main/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-cmake_minimum_required(VERSION 3.22.1)
-
-project("playintegrityfix")
-
-find_package(cxx REQUIRED CONFIG)
-
-link_libraries(cxx::cxx)
-
-add_library(${CMAKE_PROJECT_NAME} SHARED main.cpp)
-
-add_subdirectory(Dobby)
-
-SET_OPTION(Plugin.Android.BionicLinkerUtil ON)
-
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE log dobby_static)
\ No newline at end of file
diff --git a/app/src/main/cpp/Dobby b/app/src/main/cpp/Dobby
deleted file mode 160000
index b0176de..0000000
--- a/app/src/main/cpp/Dobby
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b0176de574104726bb68dff3b77ee666300fc338
diff --git a/app/src/main/cpp/libcxx b/app/src/main/cpp/libcxx
new file mode 160000
index 0000000..12c8f4e
--- /dev/null
+++ b/app/src/main/cpp/libcxx
@@ -0,0 +1 @@
+Subproject commit 12c8f4e93f196a700137e983dcceeac43cf807f2
diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp
index c987095..b206c60 100644
--- a/app/src/main/cpp/main.cpp
+++ b/app/src/main/cpp/main.cpp
@@ -4,27 +4,27 @@
#include
#include
#include