This commit is contained in:
HolographicHat
2024-07-17 18:12:24 +08:00
parent f737122247
commit 793ad075fe
6 changed files with 18 additions and 32 deletions

View File

@@ -15,20 +15,12 @@ namespace Genshin {
using std::string;
void InitIL2CPP(void* &ppRecordUserData) {
void InitIL2CPP() {
TCHAR szFileName[MAX_PATH];
GetModuleFileName(nullptr, szFileName, MAX_PATH);
const auto isCN = strstr(szFileName, "YuanShen.exe");
const auto uBase = reinterpret_cast<uint64_t>(GetModuleHandle("UserAssembly.dll"));
const auto uBase = reinterpret_cast<uint64_t>(GetModuleHandle(isCN ? "YuanShen.exe" : "GenshinImpact.exe"));
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(uBase + (isCN ? ca : oa))
#include "il2cpp-functions.h"
#undef DO_APP_FUNC
auto sPtr = reinterpret_cast<uint8_t*>(RecordUserData);
for (int i = 0; i < 0x64; ++i) {
if ((*(uint32_t*) sPtr & 0xFFFFFF) == 0x25FF48) { // 48 FF 25 ??
ppRecordUserData = sPtr + 7 + *(int*) (sPtr + 3);
break;
}
sPtr += 1;
}
}