Adapt to the restructure of lsplant
Update submodule JingMatrix/LSPlant
This commit is contained in:
parent
165ad94bf9
commit
b384321cb2
|
|
@ -80,6 +80,9 @@ jobs:
|
||||||
restore-keys: ${{ runner.os }}
|
restore-keys: ${{ runner.os }}
|
||||||
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||||
|
|
||||||
|
- name: Setup Android SDK
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
- name: Remove Android's cmake
|
- name: Remove Android's cmake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: rm -rf $ANDROID_HOME/cmake
|
run: rm -rf $ANDROID_HOME/cmake
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ val androidTargetSdkVersion by extra(35)
|
||||||
val androidMinSdkVersion by extra(27)
|
val androidMinSdkVersion by extra(27)
|
||||||
val androidBuildToolsVersion by extra("35.0.0")
|
val androidBuildToolsVersion by extra("35.0.0")
|
||||||
val androidCompileSdkVersion by extra(35)
|
val androidCompileSdkVersion by extra(35)
|
||||||
val androidCompileNdkVersion by extra("27.1.12297006")
|
val androidCompileNdkVersion by extra("29.0.13113456")
|
||||||
val androidSourceCompatibility by extra(JavaVersion.VERSION_21)
|
val androidSourceCompatibility by extra(JavaVersion.VERSION_21)
|
||||||
val androidTargetCompatibility by extra(JavaVersion.VERSION_21)
|
val androidTargetCompatibility by extra(JavaVersion.VERSION_21)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "utils/hook_helper.hpp"
|
#include "utils/hook_helper.hpp"
|
||||||
|
|
||||||
|
using lsplant::operator""_sym;
|
||||||
|
|
||||||
// @ApiSensitive(Level.MIDDLE)
|
// @ApiSensitive(Level.MIDDLE)
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
|
@ -142,11 +144,11 @@ namespace android {
|
||||||
|
|
||||||
using stringAtRet = expected<StringPiece16, NullOrIOError>;
|
using stringAtRet = expected<StringPiece16, NullOrIOError>;
|
||||||
|
|
||||||
inline static lsplant::MemberFunction<{"_ZNK7android13ResStringPool8stringAtEjPj",
|
inline static auto stringAtS_ = ("_ZNK7android13ResStringPool8stringAtEjPj"_sym |
|
||||||
"_ZNK7android13ResStringPool8stringAtEmPm"}, ResStringPool, stringAtRet (size_t)> stringAtS_;
|
"_ZNK7android13ResStringPool8stringAtEmPm"_sym).as<stringAtRet (ResStringPool::*)(size_t)>;
|
||||||
|
|
||||||
inline static lsplant::MemberFunction<{"_ZNK7android13ResStringPool8stringAtEj",
|
inline static auto stringAt_ = ("_ZNK7android13ResStringPool8stringAtEj"_sym |
|
||||||
"_ZNK7android13ResStringPool8stringAtEm"}, ResStringPool, const char16_t* (size_t, size_t *)> stringAt_;
|
"_ZNK7android13ResStringPool8stringAtEm"_sym).as<const char16_t* (ResStringPool::*)(size_t, size_t *)>;
|
||||||
|
|
||||||
StringPiece16 stringAt(size_t idx) const {
|
StringPiece16 stringAt(size_t idx) const {
|
||||||
if (stringAt_) {
|
if (stringAt_) {
|
||||||
|
|
@ -163,7 +165,7 @@ namespace android {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool setup(const lsplant::HookHandler &handler) {
|
static bool setup(const lsplant::HookHandler &handler) {
|
||||||
return handler.dlsym(stringAt_) || handler.dlsym(stringAtS_);
|
return handler(stringAt_) || handler(stringAtS_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ namespace lspd {
|
||||||
"_ZNK7android12ResXMLParser18getAttributeNameIDEm")))) {
|
"_ZNK7android12ResXMLParser18getAttributeNameIDEm")))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return android::ResStringPool::setup(lsplant::InitInfo {
|
return android::ResStringPool::setup(InitInfo {
|
||||||
.art_symbol_resolver = [&](auto s) {
|
.art_symbol_resolver = [&](auto s) {
|
||||||
return fw.template getSymbAddress(s);
|
return fw.template getSymbAddress<>(s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ namespace lspd {
|
||||||
|
|
||||||
// @ApiSensitive(Level.MIDDLE)
|
// @ApiSensitive(Level.MIDDLE)
|
||||||
LSP_DEF_NATIVE_METHOD(jboolean, ResourcesHook, makeInheritable, jclass target_class) {
|
LSP_DEF_NATIVE_METHOD(jboolean, ResourcesHook, makeInheritable, jclass target_class) {
|
||||||
if (lsplant::MakeClassInheritable(env, target_class)) {
|
if (MakeClassInheritable(env, target_class)) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@
|
||||||
* callback will not work.
|
* callback will not work.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using lsplant::operator""_sym;
|
||||||
|
|
||||||
namespace lspd {
|
namespace lspd {
|
||||||
|
|
||||||
std::list<NativeOnModuleLoaded> moduleLoadedCallbacks;
|
std::list<NativeOnModuleLoaded> moduleLoadedCallbacks;
|
||||||
|
|
@ -91,10 +93,10 @@ namespace lspd {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static lsplant::Hooker<"__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv",
|
inline static auto do_dlopen_ = "__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv"_sym.hook->*[]
|
||||||
void*(const char*, int, const void*, const void*)>
|
<lsplant::Backup auto backup>
|
||||||
do_dlopen = +[](const char* name, int flags, const void* extinfo, const void* caller_addr) {
|
(const char* name, int flags, const void* extinfo, const void* caller_addr) static -> void* {
|
||||||
auto *handle = do_dlopen(name, flags, extinfo, caller_addr);
|
auto *handle = backup(name, flags, extinfo, caller_addr);
|
||||||
std::string ns;
|
std::string ns;
|
||||||
if (name) {
|
if (name) {
|
||||||
ns = std::string(name);
|
ns = std::string(name);
|
||||||
|
|
@ -133,6 +135,6 @@ namespace lspd {
|
||||||
};
|
};
|
||||||
|
|
||||||
bool InstallNativeAPI(const lsplant::HookHandler & handler) {
|
bool InstallNativeAPI(const lsplant::HookHandler & handler) {
|
||||||
return handler.hook(do_dlopen);
|
return handler(do_dlopen_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,5 @@ OPTION(LSPLANT_BUILD_SHARED OFF)
|
||||||
add_subdirectory(dobby)
|
add_subdirectory(dobby)
|
||||||
add_subdirectory(fmt)
|
add_subdirectory(fmt)
|
||||||
add_subdirectory(lsplant/lsplant/src/main/jni)
|
add_subdirectory(lsplant/lsplant/src/main/jni)
|
||||||
|
target_compile_options(lsplant_static PUBLIC -Wno-gnu-anonymous-struct)
|
||||||
target_compile_definitions(fmt-header-only INTERFACE FMT_USE_LOCALE=0 FMT_USE_FLOAT=0 FMT_USE_DOUBLE=0 FMT_USE_LONG_DOUBLE=0 FMT_USE_BITINT=0)
|
target_compile_definitions(fmt-header-only INTERFACE FMT_USE_LOCALE=0 FMT_USE_FLOAT=0 FMT_USE_DOUBLE=0 FMT_USE_LONG_DOUBLE=0 FMT_USE_BITINT=0)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3f08bb72d87ad29501052217fcb78d7330c07ac5
|
Subproject commit 3d52ee31e450a027920fd0242d9748b39e6fb05f
|
||||||
Loading…
Reference in New Issue