Files
DevourClient/user/main.cpp

75 lines
1.8 KiB
C++

// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// Custom injected code entry point
#include "pch-il2cpp.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <iostream>
#include "il2cpp-appdata.h"
#include "helpers.h"
#include <chrono>
#include <thread>
#include "wrapper.h"
#include "object.h"
#include "hooks/hooks.hpp"
// Set the name of your log file here
extern const LPCWSTR LOG_FILE = L"DevourClient.txt";
HMODULE myhModule = NULL;
bool should_unhook = 0;
DWORD __stdcall EjectThread(LPVOID lpParameter) {
Sleep(100);
il2cpp_close_console();
DisableHooks();
FreeLibraryAndExitThread(myhModule, 0); //Freeing the module, that's why we needed the myhModule variable
}
// Custom injected code entry point
void Run()
{
// Initialize thread data - DO NOT REMOVE
il2cpp_thread_attach(il2cpp_domain_get());
// If you would like to write to a log file, specify the name above and use il2cppi_log_write()
il2cppi_log_write("Initializg..");
// If you would like to output to a new console window, use il2cppi_new_console() to open one and redirect stdout
il2cppi_new_console();
if (InitializeHooks()) {
il2cppi_log_write("Hooks initialized");
}
else {
il2cppi_log_write("MH_Initialize failed, quitting...");
CreateThread(0, 0, EjectThread, 0, 0, 0); //Unhooking
return;
}
if (HookDX11()) {
il2cppi_log_write("DirectX11 hooked");
}
else {
il2cppi_log_write("DirectX11 hook failed, quitting...");
CreateThread(0, 0, EjectThread, 0, 0, 0); //Unhooking
return;
}
Wrapper* wrapper = new Wrapper();
while (true) {
if (GetAsyncKeyState(VK_F1) & 0x8000) {
}
if (GetAsyncKeyState(VK_END) & 0x8000 || should_unhook)
break;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
CreateThread(0, 0, EjectThread, 0, 0, 0);
}