From 9df0af313fe48f3b4ec3fc1328c2d126beda7624 Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Sun, 28 Jul 2024 20:10:37 +0200 Subject: [PATCH] Update dobby dependency Note that RS_SUCCESS = 0 is removed in the commit f4643b8d14d7cc94516b446ca77d952d0b986d50 of https://github.com/jmpews/Dobby The CMake option DOBBY_GENERATE_SHARED is removed, we use dobby_static explicitly. --- .gitmodules | 2 +- README.md | 2 +- core/src/main/jni/CMakeLists.txt | 2 +- core/src/main/jni/src/native_api.cpp | 2 +- external/CMakeLists.txt | 1 - external/dobby | 2 +- magisk-loader/src/main/jni/src/magisk_loader.cpp | 8 ++++---- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2709f9c3..c47499f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/JingMatrix/LSPlant.git [submodule "external/dobby"] path = external/dobby - url = https://github.com/LSPosed/Dobby.git + url = https://github.com/chiteroman/Dobby.git [submodule "external/fmt"] path = external/fmt url = https://github.com/fmtlib/fmt.git diff --git a/README.md b/README.md index 9440e8ec..1421f00f 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ You can contribute translation [here](https://crowdin.com/project/lsposed_jingma - [Magisk](https://github.com/topjohnwu/Magisk/): makes all these possible - [Riru](https://github.com/RikkaApps/Riru): provides a way to inject code into zygote process - [XposedBridge](https://github.com/rovo89/XposedBridge): the OG Xposed framework APIs -- [Dobby](https://github.com/jmpews/Dobby): used for inline hooking +- [Dobby](https://github.com/chiteroman/Dobby): used for inline hooking - [LSPlant](https://github.com/JingMatrix/LSPlant): the core ART hooking framework - [EdXposed](https://github.com/ElderDrivers/EdXposed): fork source - ~[SandHook](https://github.com/ganyao114/SandHook/): ART hooking framework for SandHook variant~ diff --git a/core/src/main/jni/CMakeLists.txt b/core/src/main/jni/CMakeLists.txt index 20fd25ca..03113fe5 100644 --- a/core/src/main/jni/CMakeLists.txt +++ b/core/src/main/jni/CMakeLists.txt @@ -12,5 +12,5 @@ add_library(${PROJECT_NAME} STATIC ${SRC_LIST}) target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PRIVATE src) -target_link_libraries(${PROJECT_NAME} PUBLIC dobby lsplant_static log fmt-header-only) +target_link_libraries(${PROJECT_NAME} PUBLIC dobby_static lsplant_static log fmt-header-only) target_link_libraries(${PROJECT_NAME} PRIVATE dex_builder_static) diff --git a/core/src/main/jni/src/native_api.cpp b/core/src/main/jni/src/native_api.cpp index 3650832b..01ffaaa9 100644 --- a/core/src/main/jni/src/native_api.cpp +++ b/core/src/main/jni/src/native_api.cpp @@ -73,7 +73,7 @@ namespace lspd { return InstallNativeAPI({ .inline_hooker = [](auto t, auto r) { void* bk = nullptr; - return HookFunction(t, r, &bk) == RS_SUCCESS ? bk : nullptr; + return HookFunction(t, r, &bk) == 0 ? bk : nullptr; }, }); }(); diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 57d729b2..dacff51f 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -4,7 +4,6 @@ macro(SET_OPTION option value) set(${option} ${value} CACHE INTERNAL "" FORCE) endmacro() -SET_OPTION(DOBBY_GENERATE_SHARED OFF) SET_OPTION(Plugin.SymbolResolver OFF) SET_OPTION(FMT_INSTALL OFF) diff --git a/external/dobby b/external/dobby index 6813ca76..7447fd92 160000 --- a/external/dobby +++ b/external/dobby @@ -1 +1 @@ -Subproject commit 6813ca76ddeafcaece525bf8c6cde7ff4c21d3ce +Subproject commit 7447fd9209bb43eba1e307f84df17613af5203dd diff --git a/magisk-loader/src/main/jni/src/magisk_loader.cpp b/magisk-loader/src/main/jni/src/magisk_loader.cpp index 184d1d94..5a38284f 100644 --- a/magisk-loader/src/main/jni/src/magisk_loader.cpp +++ b/magisk-loader/src/main/jni/src/magisk_loader.cpp @@ -118,10 +118,10 @@ namespace lspd { lsplant::InitInfo initInfo{ .inline_hooker = [](auto t, auto r) { void* bk = nullptr; - return HookFunction(t, r, &bk) == RS_SUCCESS ? bk : nullptr; + return HookFunction(t, r, &bk) == 0 ? bk : nullptr; }, .inline_unhooker = [](auto t) { - return UnhookFunction(t) == RT_SUCCESS ; + return UnhookFunction(t) == 0 ; }, .art_symbol_resolver = [](auto symbol) { return GetArt()->getSymbAddress(symbol); @@ -193,10 +193,10 @@ namespace lspd { lsplant::InitInfo initInfo{ .inline_hooker = [](auto t, auto r) { void* bk = nullptr; - return HookFunction(t, r, &bk) == RS_SUCCESS ? bk : nullptr; + return HookFunction(t, r, &bk) == 0 ? bk : nullptr; }, .inline_unhooker = [](auto t) { - return UnhookFunction(t) == RT_SUCCESS; + return UnhookFunction(t) == 0; }, .art_symbol_resolver = [](auto symbol){ return GetArt()->getSymbAddress(symbol);