mirror of
https://github.com/HolographicHat/Yae.git
synced 2026-03-23 12:59:44 +08:00
@@ -1,38 +1,34 @@
|
||||
// ReSharper disable CppCStyleCast
|
||||
// ReSharper disable CppInconsistentNaming
|
||||
// ReSharper disable CppClangTidyBugproneMacroParentheses
|
||||
// ReSharper disable CppClangTidyClangDiagnosticCastAlign
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "il2cpp-init.h"
|
||||
|
||||
#define DO_APP_FUNC(ca, oa, r, n, p) r (*n) p
|
||||
#define DO_UNI_FUNC(ca, oa, r, n, p) r (*n) p
|
||||
namespace Genshin {
|
||||
#include "il2cpp-functions.h"
|
||||
}
|
||||
#undef DO_UNI_FUNC
|
||||
#undef DO_APP_FUNC
|
||||
|
||||
#define DO_TYPEDEF(ca, oa, n) n##__Class **n##__TypeInfo
|
||||
namespace Genshin {
|
||||
#include "il2cpp-types-ptr.h"
|
||||
}
|
||||
#undef DO_TYPEDEF
|
||||
|
||||
using std::string;
|
||||
|
||||
void InitIL2CPP() {
|
||||
void InitIL2CPP(void* &ppRecordUserData) {
|
||||
TCHAR szFileName[MAX_PATH];
|
||||
GetModuleFileName(NULL, szFileName, MAX_PATH);
|
||||
auto isCN = strstr(szFileName, "YuanShen.exe");//string(szFileName).contains();
|
||||
auto hBase = GetModuleHandle("UserAssembly.dll");
|
||||
auto bAddr = (UINT64)hBase;
|
||||
auto cAddr = (UINT64)GetModuleHandle("UnityPlayer.dll");
|
||||
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(bAddr + (isCN ? ca : oa))
|
||||
#define DO_UNI_FUNC(ca, oa, r, n, p) n = (r (*) p)(cAddr + (isCN ? ca : oa))
|
||||
GetModuleFileName(nullptr, szFileName, MAX_PATH);
|
||||
const auto isCN = strstr(szFileName, "YuanShen.exe");
|
||||
const auto uBase = reinterpret_cast<uint64_t>(GetModuleHandle("UserAssembly.dll"));
|
||||
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(uBase + (isCN ? ca : oa))
|
||||
#include "il2cpp-functions.h"
|
||||
#undef DO_UNI_FUNC
|
||||
#undef DO_APP_FUNC
|
||||
#define DO_TYPEDEF(ca, oa, n) n##__TypeInfo = (n##__Class **)(bAddr + (isCN ? ca : oa))
|
||||
#include "il2cpp-types-ptr.h"
|
||||
#undef DO_TYPEDEF
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user