Perfare / Zygisk-Il2CppDumper

Using Zygisk to dump il2cpp data at runtime
MIT License
2.14k stars 5.29k forks source link

游戏没有libil2cpp.so #203

Open enenH opened 4 days ago

enenH commented 4 days ago

像使命召唤国服 发现是把il2cpp.so的内容融合进了libunity.so

enenH commented 4 days ago
void hack_start(const char* game_data_dir) {
    bool load = false;
    bool check_have_il2cpp = 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 {
            if (!check_have_il2cpp) {
                void* libunity = xdl_open("libunity.so", 0);
                if (libunity) {
                    xdl_info_t info;
                    xdl_info(libunity, XDL_DI_DLINFO, &info);
                    std::string lib_path = info.dli_fname;
                    lib_path = lib_path.substr(0, lib_path.find_last_of('/'));
                    lib_path += "/libil2cpp.so";
                    LOGI("libil2cpp.so path %s", lib_path.data());
                    if (access(lib_path.data(), F_OK) == -1) {
                        LOGI("game not have libil2cpp.so,use default libunity.so");
                        load = true;
                        il2cpp_api_init(libunity);
                        il2cpp_dump(game_data_dir);
                        xdl_close(libunity);
                        break;
                    }
                    check_have_il2cpp = true;
                    xdl_close(libunity);
                }
            }

            sleep(1);
        }
    }
    if (!load) {
        LOGI("libil2cpp.so not found in thread %d", gettid());
    }
}

使用此代码可以解决