60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
#include "ModuleManager.h"
|
|
#include "UI.h"
|
|
#include "helpers.h"
|
|
|
|
namespace {
|
|
|
|
DWORD WINAPI LoaderThreadProc(LPVOID) {
|
|
ToggleConsole(true);
|
|
Log("Initializing..");
|
|
|
|
g_Runtime.running.store(true, std::memory_order_relaxed);
|
|
InitializeI18N();
|
|
Log("Waiting for GameAssembly.dll ...");
|
|
if (!WaitForGameAssembly(120000, 200)) {
|
|
Log("IL2CPP Domain Not Found!");
|
|
g_Runtime.running.store(false, std::memory_order_relaxed);
|
|
return 0;
|
|
}
|
|
ResolveGABypassSlots();
|
|
g_Runtime.il2cpp_thread_attached.store(false, std::memory_order_relaxed);
|
|
g_Runtime.game_thread_id.store(0, std::memory_order_relaxed);
|
|
Log("IL2CPP thread attach deferred to game-thread dispatcher");
|
|
|
|
if (ScanLoadedModulesForInjectionMarkers()) {
|
|
Log("Module path scanner matched testyip/gatmp.tmp/EF-Cheeto.dll");
|
|
}
|
|
|
|
RegisterDefaultModules();
|
|
GetModuleManager().Init();
|
|
|
|
RunOverlayLoop();
|
|
ShutdownOverlayWindow();
|
|
DetachIl2CppThreadIfAttached();
|
|
|
|
g_Runtime.running.store(false, std::memory_order_relaxed);
|
|
Log("Shutdown complete");
|
|
return 0;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID) {
|
|
switch (reason) {
|
|
case DLL_PROCESS_ATTACH: {
|
|
DisableThreadLibraryCalls(module);
|
|
HANDLE thread = CreateThread(nullptr, 0, LoaderThreadProc, nullptr, 0, nullptr);
|
|
if (thread) {
|
|
CloseHandle(thread);
|
|
}
|
|
break;
|
|
}
|
|
case DLL_PROCESS_DETACH:
|
|
g_Runtime.running.store(false, std::memory_order_relaxed);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|