feat: 成功加载了so 并且调用了riru hide等逻辑

准备增加自定义linker
This commit is contained in:
jiqiu2021
2025-06-25 21:21:07 +08:00
parent f557d71874
commit 1076c1e711
8 changed files with 246 additions and 63 deletions

View File

@@ -6,6 +6,9 @@
#include <sys/types.h>
#include <unistd.h>
#include <cinttypes>
#include <dirent.h>
#include <errno.h>
#include <time.h>
#include "hack.h"
#include "zygisk.hpp"
#include "game.h"
@@ -21,6 +24,7 @@ public:
void onLoad(Api *api, JNIEnv *env) override {
this->api = api;
this->env = env;
enable_hack = false;
}
void preAppSpecialize(AppSpecializeArgs *args) override {
@@ -38,7 +42,8 @@ public:
void postAppSpecialize(const AppSpecializeArgs *) override {
if (enable_hack) {
std::thread hack_thread(hack_prepare, _data_dir, data, length);
// Then start hack thread
std::thread hack_thread(hack_prepare, _data_dir, _package_name, data, length);
hack_thread.detach();
}
}
@@ -48,9 +53,10 @@ private:
JNIEnv *env;
bool enable_hack;
char *_data_dir;
char *_package_name;
void *data;
size_t length;
void preSpecialize(const char *package_name, const char *app_data_dir) {
// Read configuration
Config::readConfig();
@@ -61,6 +67,11 @@ private:
enable_hack = true;
_data_dir = new char[strlen(app_data_dir) + 1];
strcpy(_data_dir, app_data_dir);
_package_name = new char[strlen(package_name) + 1];
strcpy(_package_name, package_name);
// ConfigApp is responsible for copying SO files
// We just need to load them
#if defined(__i386__)
auto path = "zygisk/armeabi-v7a.so";