From cc4a2536a0d09569a572c15177f706c967884f62 Mon Sep 17 00:00:00 2001
From: chiteroman <98092901+chiteroman@users.noreply.github.com>
Date: Fri, 24 Nov 2023 20:34:31 +0100
Subject: [PATCH] New code!
---
.idea/vcs.xml | 1 -
app/build.gradle.kts | 32 +-
app/src/main/cpp/Android.mk | 33 -
app/src/main/cpp/Application.mk | 3 -
app/src/main/cpp/CMakeLists.txt | 17 +
app/src/main/cpp/Dobby | 1 +
app/src/main/cpp/json.hpp | 24596 ++++++++++++++++
app/src/main/cpp/libcxx | 1 -
app/src/main/cpp/main.cpp | 132 +-
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 | 46 +-
70 files changed, 24768 insertions(+), 16228 deletions(-)
delete mode 100644 app/src/main/cpp/Android.mk
delete mode 100644 app/src/main/cpp/Application.mk
create mode 100644 app/src/main/cpp/CMakeLists.txt
create mode 160000 app/src/main/cpp/Dobby
create mode 100644 app/src/main/cpp/json.hpp
delete mode 160000 app/src/main/cpp/libcxx
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_a32.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_a32.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_inst.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_inst.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t16.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t16.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t32.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_t32.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_txx.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm/sh_txx.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_a64.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_a64.h
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_inst.c
delete mode 100644 app/src/main/cpp/shadowhook/arch/arm64/sh_inst.h
delete mode 100644 app/src/main/cpp/shadowhook/common/bytesig.c
delete mode 100644 app/src/main/cpp/shadowhook/common/bytesig.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_config.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_errno.c
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_errno.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_log.c
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_log.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_sig.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_trampo.c
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_trampo.h
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_util.c
delete mode 100644 app/src/main/cpp/shadowhook/common/sh_util.h
delete mode 100644 app/src/main/cpp/shadowhook/include/shadowhook.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_enter.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_enter.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_exit.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_exit.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_hub.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_hub.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_jni.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_linker.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_linker.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_recorder.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_recorder.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_safe.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_safe.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_switch.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_switch.h
delete mode 100644 app/src/main/cpp/shadowhook/sh_task.c
delete mode 100644 app/src/main/cpp/shadowhook/sh_task.h
delete mode 100644 app/src/main/cpp/shadowhook/shadowhook.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/bsd/queue.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/bsd/tree.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/lss/LICENSE
delete mode 100644 app/src/main/cpp/shadowhook/third_party/lss/linux_syscall_support.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/LICENSE
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_iterate.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_iterate.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_linker.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_linker.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_lzma.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_lzma.h
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_util.c
delete mode 100644 app/src/main/cpp/shadowhook/third_party/xdl/xdl_util.h
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 25dfc0f..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,5 @@
-
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index c6a5fc3..7d39699 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -8,6 +8,16 @@ android {
ndkVersion = "26.1.10909125"
buildToolsVersion = "34.0.0"
+ packaging {
+ jniLibs {
+ excludes += "**/libdobby.so"
+ }
+ }
+
+ buildFeatures {
+ prefab = true
+ }
+
defaultConfig {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
@@ -16,10 +26,15 @@ android {
versionName = "1.0"
externalNativeBuild {
- ndk {
- jobs = Runtime.getRuntime().availableProcessors()
- abiFilters += "armeabi-v7a"
- abiFilters += "arm64-v8a"
+ cmake {
+ arguments += "-DANDROID_STL=none"
+ arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel"
+
+ cppFlags += "-std=c++20"
+ cppFlags += "-fno-exceptions"
+ cppFlags += "-fno-rtti"
+ cppFlags += "-fvisibility=hidden"
+ cppFlags += "-fvisibility-inlines-hidden"
}
}
}
@@ -38,8 +53,13 @@ android {
}
externalNativeBuild {
- ndkBuild {
- path = file("src/main/cpp/Android.mk")
+ cmake {
+ path = file("src/main/cpp/CMakeLists.txt")
+ version = "3.22.1"
}
}
+}
+
+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
deleted file mode 100644
index 9632627..0000000
--- a/app/src/main/cpp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-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
deleted file mode 100644
index f3a9a1e..0000000
--- a/app/src/main/cpp/Application.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_STL := none
-APP_CFLAGS := -Oz -fvisibility=hidden -fvisibility-inlines-hidden
-APP_CPPFLAGS := -std=c++20 -fno-exceptions -fno-rtti
\ No newline at end of file
diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000..fd7fcab
--- /dev/null
+++ b/app/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.22.1)
+
+project("playintegrityfix")
+
+add_library(${CMAKE_PROJECT_NAME} SHARED main.cpp)
+
+add_subdirectory(Dobby)
+
+SET_OPTION(Plugin.Android.BionicLinkerUtil ON)
+
+find_package(cxx REQUIRED CONFIG)
+
+target_link_libraries(dobby cxx::cxx)
+
+target_link_libraries(dobby_static cxx::cxx)
+
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE cxx::cxx log dobby_static)
\ No newline at end of file
diff --git a/app/src/main/cpp/Dobby b/app/src/main/cpp/Dobby
new file mode 160000
index 0000000..b0176de
--- /dev/null
+++ b/app/src/main/cpp/Dobby
@@ -0,0 +1 @@
+Subproject commit b0176de574104726bb68dff3b77ee666300fc338
diff --git a/app/src/main/cpp/json.hpp b/app/src/main/cpp/json.hpp
new file mode 100644
index 0000000..4d1a37a
--- /dev/null
+++ b/app/src/main/cpp/json.hpp
@@ -0,0 +1,24596 @@
+// __ _____ _____ _____
+// __| | __| | | | JSON for Modern C++
+// | | |__ | | | | | | version 3.11.2
+// |_____|_____|_____|_|___| https://github.com/nlohmann/json
+//
+// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann
+// SPDX-License-Identifier: MIT
+
+/****************************************************************************\
+ * Note on documentation: The source files contain links to the online *
+ * documentation of the public API at https://json.nlohmann.me. This URL *
+ * contains the most recent documentation and should also be applicable to *
+ * previous versions; documentation for deprecated functions is not *
+ * removed, but marked deprecated. See "Generate documentation" section in *
+ * file docs/README.md. *
+\****************************************************************************/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#include // all_of, find, for_each
+#include // nullptr_t, ptrdiff_t, size_t
+#include // hash, less
+#include // initializer_list
+#ifndef JSON_NO_IO
+ #include // istream, ostream
+#endif // JSON_NO_IO
+#include // random_access_iterator_tag
+#include // unique_ptr
+#include // accumulate
+#include // string, stoi, to_string
+#include // declval, forward, move, pair, swap
+#include // vector
+
+// #include
+// __ _____ _____ _____
+// __| | __| | | | JSON for Modern C++
+// | | |__ | | | | | | version 3.11.2
+// |_____|_____|_____|_|___| https://github.com/nlohmann/json
+//
+// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann
+// SPDX-License-Identifier: MIT
+
+
+
+#include
+
+// #include
+// __ _____ _____ _____
+// __| | __| | | | JSON for Modern C++
+// | | |__ | | | | | | version 3.11.2
+// |_____|_____|_____|_|___| https://github.com/nlohmann/json
+//
+// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann
+// SPDX-License-Identifier: MIT
+
+
+
+// This file contains all macro definitions affecting or depending on the ABI
+
+#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
+ #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
+ #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2
+ #warning "Already included a different version of the library!"
+ #endif
+ #endif
+#endif
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum)
+#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum)
+#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum)
+
+#ifndef JSON_DIAGNOSTICS
+ #define JSON_DIAGNOSTICS 0
+#endif
+
+#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
+ #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
+#endif
+
+#if JSON_DIAGNOSTICS
+ #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
+#else
+ #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
+#endif
+
+#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
+ #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
+#else
+ #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
+#endif
+
+#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
+ #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
+#endif
+
+// Construct the namespace ABI tags component
+#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
+#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
+ NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
+
+#define NLOHMANN_JSON_ABI_TAGS \
+ NLOHMANN_JSON_ABI_TAGS_CONCAT( \
+ NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
+ NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
+
+// Construct the namespace version component
+#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
+ _v ## major ## _ ## minor ## _ ## patch
+#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
+ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
+
+#if NLOHMANN_JSON_NAMESPACE_NO_VERSION
+#define NLOHMANN_JSON_NAMESPACE_VERSION
+#else
+#define NLOHMANN_JSON_NAMESPACE_VERSION \
+ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
+ NLOHMANN_JSON_VERSION_MINOR, \
+ NLOHMANN_JSON_VERSION_PATCH)
+#endif
+
+// Combine namespace components
+#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
+#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
+ NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
+
+#ifndef NLOHMANN_JSON_NAMESPACE
+#define NLOHMANN_JSON_NAMESPACE \
+ nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
+ NLOHMANN_JSON_ABI_TAGS, \
+ NLOHMANN_JSON_NAMESPACE_VERSION)
+#endif
+
+#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
+#define NLOHMANN_JSON_NAMESPACE_BEGIN \
+ namespace nlohmann \
+ { \
+ inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
+ NLOHMANN_JSON_ABI_TAGS, \
+ NLOHMANN_JSON_NAMESPACE_VERSION) \
+ {
+#endif
+
+#ifndef NLOHMANN_JSON_NAMESPACE_END
+#define NLOHMANN_JSON_NAMESPACE_END \
+ } /* namespace (inline namespace) NOLINT(readability/namespace) */ \
+ } // namespace nlohmann
+#endif
+
+// #include
+// __ _____ _____ _____
+// __| | __| | | | JSON for Modern C++
+// | | |__ | | | | | | version 3.11.2
+// |_____|_____|_____|_|___| https://github.com/nlohmann/json
+//
+// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann
+// SPDX-License-Identifier: MIT
+
+
+
+#include // transform
+#include // array
+#include // forward_list
+#include // inserter, front_inserter, end
+#include