Skip to content

Commit

Permalink
hook more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lvyitian committed Aug 20, 2023
1 parent 011ec54 commit 0f98c24
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 946 deletions.
2 changes: 1 addition & 1 deletion module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ ext {
moduleName = "YuanShenRedirect"
moduleAuthor = "Perfare"
moduleDescription = "Redirect file access of YuanShen"
moduleVersion = "v1.0.0"
moduleVersion = "v1.1.0"
moduleVersionCode = 1
}
2 changes: 1 addition & 1 deletion module/src/main/cpp/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#ifndef ZYGISK_IL2CPPDUMPER_GAME_H
#define ZYGISK_IL2CPPDUMPER_GAME_H

#define GamePackageName "com.miHoYo.Yuanshen"
//#define GamePackageName "com.miHoYo.Yuanshen"

#endif //ZYGISK_IL2CPPDUMPER_GAME_H
24 changes: 5 additions & 19 deletions module/src/main/cpp/hack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,8 @@
#include <array>

void hack_start(const char *game_data_dir) {
bool load = false;
for (int i = 0; i < 10; i++) {
void *handle = xdl_open("libil2cpp.so", 0);
if (handle) {
load = true;
il2cpp_api_init(handle);
il2cpp_dump(game_data_dir);
break;
} else {
sleep(1);
}
}
if (!load) {
LOGI("libil2cpp.so not found in thread %d", gettid());
}
il2cpp_api_init(0);
il2cpp_dump(game_data_dir);
}

std::string GetLibDir(JavaVM *vms) {
Expand Down Expand Up @@ -112,8 +99,8 @@ struct NativeBridgeCallbacks {
};

bool NativeBridgeLoad(const char *game_data_dir, int api_level, void *data, size_t length) {
//TODO 等待houdini初始化
sleep(5);
/*//TODO 等待houdini初始化
sleep(5);*/

auto libart = dlopen("libart.so", RTLD_NOW);
auto JNI_GetCreatedJavaVMs = (jint (*)(JavaVM **, jsize, jsize *)) dlsym(libart,
Expand Down Expand Up @@ -204,8 +191,7 @@ void hack_prepare(const char *game_data_dir, void *data, size_t length) {

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
auto game_data_dir = (const char *) reserved;
std::thread hack_thread(hack_start, game_data_dir);
hack_thread.detach();
hack_start(game_data_dir);
return JNI_VERSION_1_6;
}

Expand Down
312 changes: 0 additions & 312 deletions module/src/main/cpp/il2cpp-api-functions.h

This file was deleted.

143 changes: 0 additions & 143 deletions module/src/main/cpp/il2cpp-class.h

This file was deleted.

152 changes: 0 additions & 152 deletions module/src/main/cpp/il2cpp-tabledefs.h

This file was deleted.

Loading

0 comments on commit 0f98c24

Please sign in to comment.