diff --git a/lib/src/dllmain.cpp b/lib/src/dllmain.cpp index fafec24..52e1348 100644 --- a/lib/src/dllmain.cpp +++ b/lib/src/dllmain.cpp @@ -64,7 +64,16 @@ namespace Hook { ByteArray* UnityEngine_RecordUserData(INT type) { return new ByteArray {}; } - // 不再使用checksum(? + + VOID SetChecksum(LPVOID obj, Il2CppString* value) { + CALL_ORIGIN(SetChecksum, obj, il2cpp_string_new(checksum.c_str())); + } + + VOID RequestLogin(LPVOID obj, LPVOID token, UINT32 uid) { + HookManager::install(Genshin::SetChecksum, SetChecksum); + CALL_ORIGIN(RequestLogin, obj, token, uid); + HookManager::detach(SetChecksum); + } } void Run(HMODULE* phModule) { @@ -76,8 +85,13 @@ void Run(HMODULE* phModule) { Sleep(5000); DisableVMProtect(); InitIL2CPP(); + for (int i = 0; i < 3; i++) { + const auto result = Genshin::RecordUserData(i); + checksum += string(reinterpret_cast(&result->vector[0]), result->max_length); + } HookManager::install(Genshin::KcpRecv, Hook::KcpRecv); HookManager::install(Genshin::SetVersion, Hook::SetVersion); + HookManager::install(Genshin::RequestLogin, Hook::RequestLogin); HookManager::install(Genshin::UnityEngine_RecordUserData, Hook::UnityEngine_RecordUserData); hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (hPipe == INVALID_HANDLE_VALUE) { diff --git a/lib/src/il2cpp-functions.h b/lib/src/il2cpp-functions.h index e049a69..2196a0b 100644 --- a/lib/src/il2cpp-functions.h +++ b/lib/src/il2cpp-functions.h @@ -4,10 +4,16 @@ using namespace Genshin; DO_APP_FUNC(0x258fd40, 0x2548e50, void, SetVersion, (void* obj, Il2CppString* value, void* method)); +DO_APP_FUNC(0x7c6d0d0, 0x7bde850, ByteArray*, RecordUserData, (int32_t nType)); + DO_APP_FUNC(0x3220f00, 0x31c1650, void, XorEncrypt, (ByteArray** data, int length, void* method)); DO_APP_FUNC(0x12f5df0, 0x12ddd80, bool, KcpRecv, (void* client, ClientKcpEvent* evt, void* method)); +DO_APP_FUNC(0x19b6f30, 0x198d6c0, VOID, RequestLogin, (LPVOID obj, LPVOID token, UINT uid)); + +DO_APP_FUNC(0x29b18f0, 0x2960ec0, VOID, SetChecksum, (LPVOID obj, Il2CppString* value)); + DO_APP_FUNC(0x264ee90, 0x2606720, VOID, ForceQuit, (LPVOID obj)); DO_APP_FUNC(0x624d630, 0x61bd630, LPVOID, GetSingletonManager, ());