This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
163 lines (126 loc) · 3.86 KB
/
main.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#include "includes.h"
#include "xorstr.hpp"
#include <comdef.h>
#include <structs.h>
#include <D3DX11tex.h>
#pragma comment(lib, "D3DX11.lib")
#include <mathn.h>
#include <ImGuiUtils.h>
#include <global.h>
#include "RoomHelper.h"
#include "AimbotHelper.h"
#include "RoleHelper.h"
#include "memory.h"
#include "MenuFonts.h"
#include "MenuControls.h"
#include "hooks.h"
#include "Menu.h"
#include "Renderer.h"
#include <conio.h>
#include "rainbow.h"
#include <string>
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
Present oPresent;
HWND window = NULL;
WNDPROC oWndProc;
ID3D11Device* pDevice = NULL;
ID3D11DeviceContext* pContext = NULL;
ID3D11RenderTargetView* mainRenderTargetView;
void InitImGui()
{
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = NULL;
io.WantSaveIniSettings = false;
io.ConfigFlags = ImGuiConfigFlags_NoMouseCursorChange;
Renderer::myMenuFont = io.Fonts->AddFontFromMemoryCompressedTTF(&menuFontRaw_compressed_data, menuFontRaw_compressed_size, 14.f);
Renderer::myMenuFontScaled = io.Fonts->AddFontFromMemoryCompressedTTF(&menuFontRaw_compressed_data, menuFontRaw_compressed_size, 28.f);
Renderer::men = io.Fonts->AddFontFromMemoryCompressedTTF(&menuFontRaw_compressed_data, menuFontRaw_compressed_size, 18.f);
ImGui_ImplWin32_Init(window);
ImGui_ImplDX11_Init(pDevice, pContext);
Menu::Style();
}
LRESULT __stdcall WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (true && ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam))
return true;
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
}
bool init = false;
HRESULT __stdcall hkPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
if (!init)
{
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, &mainRenderTargetView);
pBackBuffer->Release();
oWndProc = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)WndProc);
InitImGui();
Hooks::Initialize();
init = true;
}
else
return oPresent(pSwapChain, SyncInterval, Flags);
}
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = NULL;
io.WantSaveIniSettings = false;
static bool d_init = false;
if (!d_init)
{
cvar::DefaultSettings();
d_init = true;
}
rainbow::do_rainbow();
if (cvar::menu::show) {
ImGui::PushFont(Renderer::men);
Menu::DrawMenu();
ImGui::PopFont();
}
#pragma region OVERLAY_WINDOW
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(io.DisplaySize);
ImGui::Begin(xorstr_("###OverlayWindow"), nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse);
#pragma endregion
Renderer::Draw(io);
ImGui::End();
ImGui::Render();
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
return oPresent(pSwapChain, SyncInterval, Flags);
}
void MainThread()
{
bool init_hook = false;
do
{
if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
{
kiero::bind(8, (void**)&oPresent, hkPresent);
init_hook = true;
}
} while (!init_hook);
}
BOOL WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
MainThread();
//CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MainThread, NULL, NULL, NULL);
break;
case DLL_PROCESS_DETACH:
kiero::shutdown();
break;
}
return TRUE;
}