lib update

This commit is contained in:
HolographicHat
2022-08-12 23:34:04 +08:00
parent 41863c32f7
commit 10dd03335f
8 changed files with 67 additions and 4 deletions

View File

@@ -12,6 +12,12 @@ namespace Genshin {
}
#undef DO_APP_FUNC
#define DO_UNI_FUNC(ca, oa, r, n, p) r (*n) p
namespace Genshin {
#include "il2cpp-unity-functions.h"
}
#undef DO_UNI_FUNC
using std::string;
UINT64 GetAddressByExports(HMODULE base, const char* name) {
@@ -22,13 +28,17 @@ UINT64 GetAddressByExports(HMODULE base, const char* name) {
void InitIL2CPP() {
TCHAR szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, MAX_PATH);
auto isCN = string(szFileName).contains("YuanShen.exe");
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_API(r, n, p) n = (r (*) p) GetAddressByExports(hBase, #n);
#include "il2cpp-api-functions.h"
#undef DO_API
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(bAddr + (isCN ? ca : oa))
#include "il2cpp-functions.h"
#undef DO_APP_FUNC
#define DO_UNI_FUNC(ca, oa, r, n, p) n = (r (*) p)(cAddr + (isCN ? ca : oa))
#include "il2cpp-unity-functions.h"
#undef DO_UNI_FUNC
}