add: directx11 hook (menu), imgui/minhook and the settings

This commit is contained in:
2024-04-13 12:37:16 +02:00
parent 9e8909a97f
commit 636f3e0e1e
43 changed files with 53583 additions and 1 deletions

442
user/features/menu.cpp Normal file
View File

@@ -0,0 +1,442 @@
#include "pch-il2cpp.h"
#include "Menu.hpp"
#include "../main.h"
#include "../settings/settings.hpp"
#include <string>
#include <vector>
void InitStyle()
{
ImGui::StyleColorsDark();
auto& Style = ImGui::GetStyle();
Style.WindowRounding = 8.000f;
Style.FrameRounding = 4.000f;
Style.Colors[ImGuiCol_WindowBg] = ImColor(0, 0, 0, 240);
Style.Colors[ImGuiCol_TitleBg] = ImColor(1, 1, 1, 240);
Style.Colors[ImGuiCol_TitleBgActive] = ImColor(1, 1, 1, 240);
Style.Colors[ImGuiCol_TitleBgCollapsed] = ImColor(0, 0, 0, 240);
Style.Colors[ImGuiCol_Button] = ImColor(46, 53, 62, 20);
Style.Colors[ImGuiCol_ButtonHovered] = ImColor(46, 53, 62, 255);
Style.Colors[ImGuiCol_ButtonActive] = ImColor(46, 53, 62, 255);
Style.Colors[ImGuiCol_CheckMark] = ImColor(183, 185, 189, 255);
Style.Colors[ImGuiCol_FrameBg] = ImColor(60, 66, 76, 138);
Style.Colors[ImGuiCol_FrameBgActive] = ImColor(60, 66, 76, 171);
Style.Colors[ImGuiCol_FrameBgHovered] = ImColor(60, 66, 76, 102);
Style.Alpha = 0.8f;
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\tahoma.ttf", 13.000f);
}
void DrawVisualsTab() {
ImGui::Checkbox("Big flashlight", &settings::big_flashlight);
bool open_flcolor_popup = ImGui::ColorButton("flashlightcolor", ImVec4(settings::flashlight_color[0], settings::flashlight_color[1], settings::flashlight_color[2], settings::flashlight_color[3]));
if (open_flcolor_popup)
{
ImGui::OpenPopup("flashlightcolorpicker");
}
if (ImGui::BeginPopup("flashlightcolorpicker")) {
ImGui::ColorPicker4("Flashlight color", (float*)&settings::flashlight_color);
ImGui::EndPopup();
}
ImGui::SameLine();
ImGui::Text("Flashlight color");
ImGui::Checkbox("Unlimited UV", &settings::unlimited_uv);
ImGui::Checkbox("Fullbright", &settings::fullbright);
ImGui::Checkbox("Player ESP", &settings::player_esp);
ImGui::SameLine();
bool open_pelcolor_popup = ImGui::ColorButton("playerespcolor", ImVec4(settings::player_esp_color[0], settings::player_esp_color[1], settings::player_esp_color[2], settings::player_esp_color[3]));
if (open_pelcolor_popup)
{
ImGui::OpenPopup("playeresppop");
}
if (ImGui::BeginPopup("playeresppop")) {
ImGui::ColorPicker4("Player ESP color", (float*)&settings::player_esp_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Player snaplines", &settings::player_snaplines);
ImGui::SameLine();
bool open_pslcolor_popup = ImGui::ColorButton("playersncolor", ImVec4(settings::player_snaplines_color[0], settings::player_snaplines_color[1], settings::player_snaplines_color[2], settings::player_snaplines_color[3]));
if (open_pslcolor_popup)
{
ImGui::OpenPopup("playersnpop");
}
if (ImGui::BeginPopup("playersnpop")) {
ImGui::ColorPicker4("Player snaplines color", (float*)&settings::flashlight_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Azazel ESP", &settings::azazel_esp);
ImGui::SameLine();
bool open_azacolor_popup = ImGui::ColorButton("azaespcolor", ImVec4(settings::azazel_esp_color[0], settings::azazel_esp_color[1], settings::azazel_esp_color[2], settings::azazel_esp_color[3]));
if (open_azacolor_popup)
{
ImGui::OpenPopup("azaesppop");
}
if (ImGui::BeginPopup("azaesppop")) {
ImGui::ColorPicker4("Azazel ESP color", (float*)&settings::azazel_esp_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Azazel snaplines", &settings::azazel_snaplines);
ImGui::SameLine();
bool open_azascolor_popup = ImGui::ColorButton("azasncolor", ImVec4(settings::azazel_snaplines_color[0], settings::azazel_snaplines_color[1], settings::azazel_snaplines_color[2], settings::azazel_snaplines_color[3]));
if (open_azascolor_popup)
{
ImGui::OpenPopup("azasnpop");
}
if (ImGui::BeginPopup("azasnpop")) {
ImGui::ColorPicker4("Azazel snaplines color", (float*)&settings::azazel_snaplines_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Item ESP", &settings::item_esp);
ImGui::SameLine();
bool open_icolor_popup = ImGui::ColorButton("iespcolor", ImVec4(settings::item_esp_color[0], settings::item_esp_color[1], settings::item_esp_color[2], settings::item_esp_color[3]));
if (open_icolor_popup)
{
ImGui::OpenPopup("iesppop");
}
if (ImGui::BeginPopup("iesppop")) {
ImGui::ColorPicker4("Item ESP color", (float*)&settings::item_esp_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Demon ESP", &settings::demon_esp);
ImGui::SameLine();
bool open_dcolor_popup = ImGui::ColorButton("despcolor", ImVec4(settings::demon_esp_color[0], settings::demon_esp_color[1], settings::demon_esp_color[2], settings::demon_esp_color[3]));
if (open_dcolor_popup)
{
ImGui::OpenPopup("desppop");
}
if (ImGui::BeginPopup("desppop")) {
ImGui::ColorPicker4("Demon ESP color", (float*)&settings::demon_esp_color);
ImGui::EndPopup();
}
ImGui::Checkbox("Goat/Rat ESP", &settings::goat_esp);
ImGui::SameLine();
bool open_gcolor_popup = ImGui::ColorButton("gespcolor", ImVec4(settings::goat_esp_color[0], settings::goat_esp_color[1], settings::goat_esp_color[2], settings::goat_esp_color[3]));
if (open_gcolor_popup)
{
ImGui::OpenPopup("gesppop");
}
if (ImGui::BeginPopup("gesppop")) {
ImGui::ColorPicker4("Goat ESP color", (float*)&settings::goat_esp_color);
ImGui::EndPopup();
}
}
void DrawEntitiesTab() {
if (ImGui::Button("TP items to you")) {
//call tp items
}
if (ImGui::Button("Freeze Azazel")) {
//Misc::FreezeAzazel();
}
ImGui::Spacing();
ImGui::Text("Azazel & Demons");
const char* azazel_demons_items[] = { "Sam", "Molly", "Anna", "Zara", "Ghost", "Inmate", "Demon"};
static int entity_current = 0;
ImGui::Combo("##a", &entity_current, azazel_demons_items, IM_ARRAYSIZE(azazel_demons_items));
if (ImGui::Button("Spawn##a")) {
//call spawn function
}
ImGui::Spacing();
ImGui::Text("Items");
const char* items_items[] = { "Hay", "First aid", "Battery", "Gasoline", "Fuse", "Food", "Bleach", "Ritual Book (inactive)", "Ritual Book (active)", "Matchbox", "Egg-1", "Egg-2", "Egg-3", "Egg-4", "Egg-5", "Egg-6", "Egg-7", "Egg-8", "Egg-9", "Egg-10"};
static int item_current = 0;
ImGui::Combo("##i", &item_current, items_items, IM_ARRAYSIZE(items_items));
if (ImGui::Button("Spawn##i")) {
//print("--> %s\n",items_items[item_current]);
//Misc::CarryItem(items_items[item_current]);
}
ImGui::Spacing();
ImGui::Text("Animals");
const char* animals_items[] = { "Rat", "Goat", "Spider"};
static int animal_current = 0;
ImGui::Combo("##an", &animal_current, animals_items, IM_ARRAYSIZE(animals_items));
if (ImGui::Button("Spawn##an")) {
//Misc::SpawnAnimal(animals_items[animal_current]);
}
}
void DrawMapSpecificTab() {
if (ImGui::Button("Instant win")) {
//call instant win
}
if (ImGui::Button("Burn a ritual object")) {
//Misc::BurnRitualObj(false);
}
if (ImGui::Button("Burn all ritual objects")) {
//Misc::BurnRitualObj(true);
}
if (ImGui::Button("Force start game")) {
//Misc::ForceStart();
}
if (ImGui::Button("Knock out everyone")) {
//Misc::KnockoutPlayers(false);
}
if (ImGui::Button("knock yourself out")) {
//Misc::KnockoutPlayers(true);
}
if (ImGui::Button("Shoot Everyone (Town)")) {
//Misc::ShootEveryone(true, true);
}
if (ImGui::Button("Shoot Yourself (Town)")) {
//Misc::ShootEveryone(false, true);
}
if (ImGui::Button("Jumpscare Everyone")) {
//Misc::Jumpscare(true);
}
if (ImGui::Button("Skip long interact")) {
//Misc::SkipLongInteract();
}
}
bool inspector = false;
void DrawInspector() {
ImGui::SetNextWindowSize(ImVec2(600.000f, 600.000f), ImGuiCond_Once);
if (!ImGui::Begin("Inspector", &inspector, 2)) {
ImGui::End();
return;
}
static std::vector<std::string> components;
static std::vector<std::string> classes;
static std::vector<std::string> methods;
static std::string current_comp = "";
ImGui::Text("Components");
if (ImGui::Button("Update##comp")) {
//components = Dumper::DumpComponentsString();
}
ImGui::SetNextItemWidth(150.000f);
static int component_current_idx = 0; // Here we store our selection data as an index.
static ImGuiTextFilter c_filter;
c_filter.Draw("Search##compfilter");
if (ImGui::BeginListBox("##Components", ImVec2(-FLT_MIN, 5 * ImGui::GetTextLineHeightWithSpacing())))
{
for (size_t n = 0; n < components.size(); n++)
{
if (!c_filter.PassFilter(components[n].c_str())) {
continue;
}
const bool comp_is_selected = (component_current_idx == (int)n);
if (ImGui::Selectable(components[n].c_str(), comp_is_selected))
component_current_idx = (int)n;
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (comp_is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndListBox();
}
ImGui::Spacing();
ImGui::Text("Classes");
if (ImGui::Button("Update##class")) {
//classes = Dumper::DumpClassesString(components[component_current_idx]);
current_comp = components[component_current_idx];
}
ImGui::SetNextItemWidth(150.000f);
static int class_current_idx = 0; // Here we store our selection data as an index.
static ImGuiTextFilter cl_filter;
cl_filter.Draw("Search##classfilter");
if (ImGui::BeginListBox("##Class", ImVec2(-FLT_MIN, 5 * ImGui::GetTextLineHeightWithSpacing())))
{
for (size_t n = 0; n < classes.size(); n++)
{
if (!cl_filter.PassFilter(classes[n].c_str())) {
continue;
}
const bool class_is_selected = (class_current_idx == (int)n);
if (ImGui::Selectable(classes[n].c_str(), class_is_selected)) {
class_current_idx = (int)n;
}
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (class_is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndListBox();
}
ImGui::Spacing();
ImGui::Text("Methods");
if (ImGui::Button("Update##Methods")) {
//methods = Dumper::DumpMethodsString(current_comp, classes[class_current_idx]);
}
ImGui::SetNextItemWidth(150.000f);
static int method_current_idx = 0; // Here we store our selection data as an index.
static ImGuiTextFilter me_filter;
me_filter.Draw("Search##methodfilter");
if (ImGui::BeginListBox("##Methods", ImVec2(-FLT_MIN, -1)))
{
for (size_t n = 0; n < methods.size(); n++)
{
if (!me_filter.PassFilter(methods[n].c_str())) {
continue;
}
const bool meth_is_selected = (method_current_idx == (int)n);
if (ImGui::Selectable(methods[n].c_str(), meth_is_selected))
method_current_idx = (int)n;
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (meth_is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndListBox();
}
ImGui::End();
}
void DrawMiscTab() {
ImGui::Checkbox("Chat spam", &settings::chat_spam);
ImGui::InputText("Message", &settings::message);
if (ImGui::Button("Unlock Achievements")) {
//Unlock Achievements
}
if (ImGui::Button("Unlock Doors")) {
//Misc::UnlockDoors();
}
if (ImGui::Button("Revive Yourself")) {
//Misc::Revive(false);
}
if (ImGui::Button("Revive Everyone")) {
//Misc::Revive(true);
}
if (ImGui::Button("TP Keys")) {
//Misc::TPKeys();
}
ImGui::Checkbox("Unlock all", &settings::unlock_all);
ImGui::Checkbox("Spoof level", &settings::spoof_level);
ImGui::InputInt("New level", &settings::new_level);
//normalize level
if (settings::new_level > 666) {
settings::new_level = 666;
}
else if (settings::new_level < 0) {
settings::new_level = 0;
}
ImGui::Checkbox("Change Steam name", &settings::steam_name_spoof);
ImGui::InputText("New name##steam", &settings::new_name);
ImGui::Checkbox("Change server name", &settings::server_name_spoof);
ImGui::InputText("New name##server", &settings::server_name);
ImGui::Checkbox("Fly", &settings::fly);
if (ImGui::Button("Make random noise")) {
//Misc::PlayRandomSound();
}
ImGui::Checkbox("EXP modifier", &settings::exp_modifier);
ImGui::SliderInt("Amount", &settings::new_exp, 0, 5000);
ImGui::Checkbox("Walk in lobby", &settings::walk_in_lobby);
ImGui::Checkbox("Auto respawn", &settings::auto_respawn);
ImGui::Checkbox("Change player speed", &settings::change_player_speed);
ImGui::SliderInt("Multiplier", &settings::new_speed, 0, 10);
#if _DEBUG
ImGui::Spacing();
if (ImGui::Button("Inspector")) {
inspector = !inspector;
}
#endif
ImGui::Spacing();
if (ImGui::Button("Unhook")) {
should_unhook = true;
return;
}
}
tabs current_tab = tabs::VISUALS;
void DrawMenu(bool open_menu) {
ImGui::SetNextWindowSize(ImVec2(240.000f, 300.000f), ImGuiCond_Once);
ImGui::Begin("Devour Client", NULL, 2);
#if _DEBUG
if (inspector) {
DrawInspector();
}
#endif
ImGui::SameLine();
if (ImGui::Button("Visuals")) {//, ImVec2(0.000f, 0.000f))) {
current_tab = tabs::VISUALS;
}
ImGui::SameLine();
if (ImGui::Button("Entities", ImVec2(0.000f, 0.000f))) {
current_tab = tabs::ENTITIES;
}
ImGui::SameLine();
if (ImGui::Button("Map specific", ImVec2(0.000f, 0.000f))) {
current_tab = tabs::MAP_SPECIFIC;
}
ImGui::SameLine();
if (ImGui::Button("Misc", ImVec2(0.000f, 0.000f))) {
current_tab = tabs::MISC;
}
ImGui::Separator();
switch (current_tab) {
case tabs::VISUALS:
DrawVisualsTab();
break;
case tabs::ENTITIES:
DrawEntitiesTab();
break;
case tabs::MAP_SPECIFIC:
DrawMapSpecificTab();
break;
case tabs::MISC:
DrawMiscTab();
break;
default:
break;
}
ImGui::End();
}

18
user/features/menu.hpp Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
#include <Windows.h>
#pragma warning(push, 0)
#include "imgui/imgui.h"
#include "imgui/imgui_impl_win32.h"
#include "imgui/imgui_impl_dx11.h"
#include "imgui/imgui_stdlib.h"
#pragma warning(pop)
enum class tabs {
VISUALS,
ENTITIES,
MAP_SPECIFIC,
MISC
};
void InitStyle();
void DrawMenu(bool open_menu);

249
user/hooks/hooks.cpp Normal file
View File

@@ -0,0 +1,249 @@
#include "pch-il2cpp.h"
#include "Hooks.hpp"
#include "../features/menu.hpp"
#include "../main.h"
#pragma warning(push, 0) //important cuz dx11 throws so much warnings
#include <d3d11.h>
#pragma warning(pop)
#pragma comment (lib, "d3d11.lib" )
/*
//Code about hooking stuff
//Exemple of hooked function :
typedef int (__stdcall* TEST)(); //We define the function, must be the EXACT same definition as the original one
TEST test_org = NULL;
int __stdcall test_hook() //MUST BE the original calling convention
{
std::cout << "called" << std::endl;
return test_org(); //if we want to call the original one, we can just return 1 otherwise
}
//Exemple :
MH_STATUS status_test = MH_CreateHook((LPVOID*)test_sig, &test_hook, reinterpret_cast<LPVOID*>(&test_org));
//We say that for every call to the test_sig address we want to redirect it to the address of the function named test_hook (& gives the pointer to it)
//We can store the original pointer to the original function into test_org if we want to call the org later --> trampoline hook
//original_sum can be NULL if we don't want to trampoline hook
if (status_test != MH_OK) { //If it failed
print(MH_StatusToString(status)); //If we are in debug mode, we print the fail status into the console
return 0; //We exit
}
*/
void CreateHooks() {
/*
//Exemple :
MH_STATUS SceneLoadLocalDoneStatus = MH_CreateHook((LPVOID*)test_sig, &hkSceneLoadLocalDone, reinterpret_cast<LPVOID*>(&oSceneLoadLocalDone));
//We say that for every call to the test_sig address we want to redirect it to the address of the function named test_hook (& gives the pointer to it)
//We can store the original pointer to the original function into test_org if we want to call the org later --> trampoline hook
//original_sum can be NULL if we don't want to trampoline hook
*/
}
typedef HRESULT(__stdcall* D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
D3D11PresentHook phookD3D11Present = NULL;
ID3D11Device* pDevice = NULL;
ID3D11DeviceContext* pContext = NULL;
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND window = NULL;
WNDPROC oWndProc;
bool open_menu = false;
LRESULT __stdcall WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (open_menu && ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam)) {
return true;
}
ImGuiIO& io = ImGui::GetIO();
if (io.WantCaptureMouse && open_menu) {
return true;
}
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
}
static bool pressed = false;
bool initonce = false;
static bool cursor_switch = false;
ID3D11RenderTargetView* mainRenderTargetViewD3D11 = NULL;
HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags) {
if (!initonce)
{
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&pDevice)))
{
pDevice->GetImmediateContext(&pContext);
DXGI_SWAP_CHAIN_DESC sd;
pSwapChain->GetDesc(&sd);
window = sd.OutputWindow;
ID3D11Texture2D* pBackBuffer;
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetViewD3D11);
pBackBuffer->Release();
oWndProc = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)WndProc);
auto context = ImGui::CreateContext();
ImGui::SetCurrentContext(context);
InitStyle();
ImGui_ImplWin32_Init(window);
ImGui_ImplDX11_Init(pDevice, pContext);
initonce = true;
}
else
return phookD3D11Present(pSwapChain, SyncInterval, Flags);
}
if (GetKeyState(VK_INSERT) & 0x8000) {
pressed = true;
}
else if (!(GetKeyState(VK_INSERT) & 0x8000) && pressed) {
open_menu = !open_menu;
pressed = false;
}
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
/*
seems that there are issues with opening the menu in the pause menu
the cursor will still be visible but locked in the middle of the screen
//TOFIX
*/
if (open_menu) {
/*Unity::CGameObject* UIHelpers = Unity::GameObject::Find("UIHelpers");
if (UIHelpers) {
Unity::CComponent* UI = UIHelpers->GetComponent("UIHelpers");
if (UI) {
UI->CallMethodSafe<void*>("ShowMouseCursor");
cursor_switch = true;
}
}*/
DrawMenu(open_menu);
}
/*if (!open_menu && cursor_switch) {
Unity::CGameObject* UIHelpers = Unity::GameObject::Find("UIHelpers");
if (UIHelpers) {
Unity::CComponent* UI = UIHelpers->GetComponent("UIHelpers");
if (UI) {
UI->CallMethodSafe<void*>("HideMouseCursor");
cursor_switch = false;
}
}
}*/
ImGui::GetIO().MouseDrawCursor = open_menu;
ImGui::EndFrame();
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
return phookD3D11Present(pSwapChain, SyncInterval, Flags);
}
DWORD_PTR* pSwapChainVtable = NULL;
DWORD_PTR* pContextVTable = NULL;
DWORD_PTR* pDeviceVTable = NULL;
IDXGISwapChain* pSwapChain;
bool HookDX11() {
HMODULE hDXGIDLL = GetModuleHandle(L"dxgi.dll");
while (!hDXGIDLL) {
hDXGIDLL = GetModuleHandle(L"dxgi.dll");
Sleep(100);
}
oWndProc = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)WndProc);
D3D_FEATURE_LEVEL requestedLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1 };
D3D_FEATURE_LEVEL obtainedLevel;
ID3D11Device* d3dDevice = nullptr;
ID3D11DeviceContext* d3dContext = nullptr;
DXGI_SWAP_CHAIN_DESC scd;
ZeroMemory(&scd, sizeof(scd));
scd.BufferCount = 1;
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
scd.OutputWindow = GetForegroundWindow();
scd.SampleDesc.Count = 1;
scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
scd.Windowed = true;
// LibOVR 0.4.3 requires that the width and height for the backbuffer is set even if
// you use windowed mode, despite being optional according to the D3D11 documentation.
scd.BufferDesc.Width = 1;
scd.BufferDesc.Height = 1;
scd.BufferDesc.RefreshRate.Numerator = 0;
scd.BufferDesc.RefreshRate.Denominator = 1;
UINT createFlags = 0;
#ifdef _DEBUG
// This flag gives you some quite wonderful debug text. Not wonderful for performance, though!
createFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
IDXGISwapChain* d3dSwapChain = 0;
if (FAILED(D3D11CreateDeviceAndSwapChain(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
createFlags,
requestedLevels,
sizeof(requestedLevels) / sizeof(D3D_FEATURE_LEVEL),
D3D11_SDK_VERSION,
&scd,
&pSwapChain,
&pDevice,
&obtainedLevel,
&pContext)))
{
return false;
}
pSwapChainVtable = (DWORD_PTR*)pSwapChain;
pSwapChainVtable = (DWORD_PTR*)pSwapChainVtable[0];
pContextVTable = (DWORD_PTR*)pContext;
pContextVTable = (DWORD_PTR*)pContextVTable[0];
pDeviceVTable = (DWORD_PTR*)pDevice;
pDeviceVTable = (DWORD_PTR*)pDeviceVTable[0];
if (MH_CreateHook((DWORD_PTR*)pSwapChainVtable[8], hookD3D11Present, reinterpret_cast<void**>(&phookD3D11Present)) != MH_OK) { return false; }
if (MH_EnableHook((DWORD_PTR*)pSwapChainVtable[8]) != MH_OK) { return false; }
DWORD dwOld;
VirtualProtect(phookD3D11Present, 2, PAGE_EXECUTE_READWRITE, &dwOld);
return true;
}
bool InitializeHooks() {
return MH_Initialize() == MH_OK;
}
void DisableHooks() {
SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)(oWndProc));
if (pSwapChain) { pSwapChain->Release(); }
if (mainRenderTargetViewD3D11) { mainRenderTargetViewD3D11->Release(); mainRenderTargetViewD3D11 = NULL; }
if (pContext) { pContext->Release(); pContext = NULL; }
if (pDevice) { pDevice->Release(); pDevice = NULL; }
MH_DisableHook(MH_ALL_HOOKS);
MH_Uninitialize();
ImGui_ImplDX11_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
}

15
user/hooks/hooks.hpp Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include <Windows.h>
#include <MinHook.h>
#pragma warning(push, 0)
#include "imgui/imgui.h"
#include "imgui/imgui_impl_win32.h"
#include "imgui/imgui_impl_dx11.h"
#pragma warning(pop)
bool HookDX11();
void CreateHooks();
bool InitializeHooks();
void DisableHooks();

View File

@@ -15,13 +15,17 @@
#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
}
@@ -37,6 +41,23 @@ void Run()
// 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) {
@@ -45,8 +66,9 @@ void Run()
}
if (GetAsyncKeyState(VK_END) & 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);

View File

@@ -4,6 +4,8 @@
#pragma once
extern HMODULE myhModule;
extern bool should_unhook;
DWORD __stdcall EjectThread(LPVOID lpParameter);
// Custom injected code entry point
void Run();

View File

@@ -0,0 +1,46 @@
#include "pch-il2cpp.h"
#include "settings.hpp"
namespace settings {
int height = 1080;
int width = 1920;
bool big_flashlight = false;
float flashlight_color[4] = { 255.f, 255.f, 255.f, 255.f };
bool unlimited_uv = false;
bool unlimited_uv_reset = true;
bool fullbright = false;
bool player_esp = false;
float player_esp_color[4] = { 0, 255.f, 0, 255.f };
bool player_snaplines = false;
float player_snaplines_color[4] = { 0, 255.f, 0, 255.f };
bool azazel_esp = false;
float azazel_esp_color[4] = { 255.f, 0, 0, 255.f };
bool azazel_snaplines = false;
float azazel_snaplines_color[4] = { 255.f, 0, 0, 255.f };
bool item_esp = false;
float item_esp_color[4] = { 255.f, 255.f, 255.f, 255.f };
bool demon_esp = false;
float demon_esp_color[4] = { 255.f, 0, 0, 255.f };
bool goat_esp = false;
float goat_esp_color[4] = { 0, 255.f, 0, 255.f };
bool chat_spam = false;
std::string message = "deez nuts";
bool spoof_level = false;
int new_level = 0;
bool steam_name_spoof = false;
std::string new_name = "patate";
bool server_name_spoof = false;
std::string server_name = "Jadis";
bool fly = false;
bool unlock_all = true;
bool exp_modifier = false;
int new_exp = 2000;
bool walk_in_lobby = false;
bool auto_respawn = false;
bool change_player_speed = false;
int new_speed = 1;
}

View File

@@ -0,0 +1,51 @@
#ifndef SETTINGS_HPP
#define SETTINGS_HPP
#include <imgui/imgui.h>
#include <string>
namespace settings {
extern int height;
extern int width;
extern bool big_flashlight;
extern float flashlight_color[4];
extern bool unlimited_uv;
extern bool unlimited_uv_reset;
extern bool fullbright;
extern bool player_esp;
extern float player_esp_color[4];
extern bool player_snaplines;
extern float player_snaplines_color[4];
extern bool azazel_esp;
extern float azazel_esp_color[4];
extern bool azazel_snaplines;
extern float azazel_snaplines_color[4];
extern bool item_esp;
extern float item_esp_color[4];
extern bool demon_esp;
extern float demon_esp_color[4];
extern bool goat_esp;
extern float goat_esp_color[4];
extern bool chat_spam;
extern std::string message;
extern bool spoof_level;
extern int new_level;
extern bool steam_name_spoof;
extern std::string new_name;
extern bool server_name_spoof;
extern std::string server_name;
extern bool fly;
extern bool unlock_all;
extern bool exp_modifier;
extern int new_exp;
extern bool walk_in_lobby;
extern bool auto_respawn;
extern bool change_player_speed;
extern int new_speed;
}
#endif