Move UnityPlayer loading into the game payload DLL

This commit is contained in:
mkrsym1 2023-06-08 15:27:51 +03:00
parent 30b79c1cb3
commit 88568b374d
2 changed files with 5 additions and 2 deletions

View File

@ -29,5 +29,8 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
// ...magic
tp6_setup_patcher(&game, instance, baseModule);
// Load the UnityPlayer module
HMODULE unityModule = LoadLibraryA("UnityPlayer.dll");
return TRUE;
}

View File

@ -18,7 +18,6 @@ main: ; Replacement entry point
lea rdx, [rel s_LoadLibraryA]
mov rax, [rbp - 10h] ; *GetProcAddress
call rax ; rax = *LoadLibraryA
mov [rbp - 18h], rax
lea rcx, [rel dllPath]
call rax ; LoadLibraryA(dllPath)
@ -28,6 +27,7 @@ main: ; Replacement entry point
lea rdx, [rel s_GetModuleHandleA]
mov rax, [rbp - 10h] ; *GetProcAddress
call rax ; rax = *GetModuleHandle
mov [rbp - 18h], rax
mov rcx, 0
call rax ; rax = .exe base address
@ -43,7 +43,7 @@ main: ; Replacement entry point
lea rcx, [rel s_UnityPlayer.dll]
mov rax, [rbp - 18h] ; *LoadLibraryA
mov rax, [rbp - 18h] ; *GetModuleHandleA
call rax ; rax = UnityPlayer.dll
mov rcx, rax