forked from Liverus/SCPSL-Internal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdllmain.cpp
80 lines (55 loc) · 1.85 KB
/
dllmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "include.h"
// SL-AC.dll Bypass
#include "bypass.hpp"
decltype(GetModuleHandle)* GetModuleHandle_Copy;
decltype(GetProcAddress)* GetProcAddress_Copy;
decltype(GetAsyncKeyState)* GetAsyncKeyState_Copy;
il2cpp_init_t il2cpp_init_og;
void il2cpp_init_hk(const char* name) {
il2cpp_init_og(name);
void* game_assembly = GetModuleHandle_Copy("GameAssembly.dll");
IL2CPP::Initialize(game_assembly);
IL2CPP::Attach();
Cheat::Initialize();
}
int main(HMODULE mod)
{
FILE* f;
AllocConsole();
freopen_s(&f, "CONOUT$", "w", stdout);
// Initialize Memeory
Memory::Initialize();
// Initialize Bypass
Bypass::Initialize();
GetModuleHandle_Copy = Memory::CopyFunction<decltype(GetModuleHandle)*>(GetModuleHandle);
GetProcAddress_Copy = Memory::CopyFunction<decltype(GetProcAddress)*>(GetProcAddress);
// GetAsyncKeyState_Copy = Memory::CopyFunction<decltype(GetAsyncKeyState)*>(GetAsyncKeyState);
LOG("Waiting for GameAssembly.dll...")
while (!GetModuleHandle_Copy("GameAssembly.dll"));
LOG("Game Assembly Found! Hooking il2cpp_init...")
Memory::Hook("GameAssembly.dll", "il2cpp_init", il2cpp_init_hk, &il2cpp_init_og);
LOG("Waiting for Window and IL2CPP Init...")
while (!(FindWindowA(0, "SCPSL") && Cheat::Initialized)) {};
LOG("Found Window! Menu init...");
Menu::Initialize();
while (true) {};
Cheat::Shutdown();
Menu::Shutdown();
return 0;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)main, hModule, NULL, nullptr);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}