Загрузка данных
#include <windows.h>
#include <winnt.h>
#include <d3d11.h>
#include <dxgi.h>
#include <cstdlib>
#include <string>
#include <vector>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cfloat>
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#include "imgui/imgui.h"
#include "imgui/backends/imgui_impl_dx11.h"
#include "imgui/backends/imgui_impl_win32.h"
#include "minhook/include/MinHook.h"
// ============================================================
// math & structs
// ============================================================
struct Vec2 { float x, y; };
struct Vec3 {
float x, y, z;
Vec3 operator+(const Vec3& o) const { return { x + o.x, y + o.y, z + o.z }; }
Vec3 operator-(const Vec3& o) const { return { x - o.x, y - o.y, z - o.z }; }
Vec3 operator*(float s) const { return { x * s, y * s, z * s }; }
float Dot(const Vec3& o) const { return x * o.x + y * o.y + z * o.z; }
float Length() const { return std::sqrt(x * x + y * y + z * z); }
Vec3 Normalized() const { float l = Length(); return l > 1e-4f ? Vec3{ x / l, y / l, z / l } : Vec3{ 0,0,0 }; }
};
struct Matrix4x4 { float m[4][4]; };
static float Deg2Rad(float d) { return d * 3.14159265f / 180.f; }
static float Rad2Deg(float r) { return r * 180.f / 3.14159265f; }
static bool WorldToScreen(const Vec3& w, Vec2& out, const Matrix4x4& vm, int sw, int sh) {
float ww = vm.m[3][0] * w.x + vm.m[3][1] * w.y + vm.m[3][2] * w.z + vm.m[3][3];
if (ww < 0.01f) return false;
float xx = vm.m[0][0] * w.x + vm.m[0][1] * w.y + vm.m[0][2] * w.z + vm.m[0][3];
float yy = vm.m[1][0] * w.x + vm.m[1][1] * w.y + vm.m[1][2] * w.z + vm.m[1][3];
out.x = (sw * 0.5f) + (xx / ww) * (sw * 0.5f);
out.y = (sh * 0.5f) - (yy / ww) * (sh * 0.5f);
return true;
}
// ============================================================
// memory utils
// ============================================================
namespace mem {
inline uintptr_t Base(const char* n) { return (uintptr_t)GetModuleHandleA(n); }
inline size_t Size(const char* n) {
auto b = Base(n); if (!b) return 0;
auto dos = (IMAGE_DOS_HEADER*)b;
auto nt = (IMAGE_NT_HEADERS*)(b + dos->e_lfanew);
return nt->OptionalHeader.SizeOfImage;
}
inline uintptr_t Pattern(const char* mod, const char* pat) {
auto base = Base(mod), sz = Size(mod);
if (!base || !sz) return 0;
std::vector<int> bytes;
for (const char* p = pat; *p; ) {
if (*p == ' ') { ++p; continue; }
if (*p == '?') { bytes.push_back(-1); ++p; if (*p == '?')++p; }
else { bytes.push_back((int)strtol(std::string(p, 2).c_str(), nullptr, 16)); p += 2; }
}
auto d = (uint8_t*)base;
for (size_t i = 0; i + bytes.size() <= sz; ++i) {
bool f = true;
for (size_t j = 0; j < bytes.size(); ++j)
if (bytes[j] != -1 && d[i + j] != (uint8_t)bytes[j]) { f = false; break; }
if (f) return base + i;
}
return 0;
}
inline uintptr_t Rel(uintptr_t a, int pos, int len) {
if (!a) return 0;
__try {
int32_t r = *(int32_t*)(a + pos);
return a + len + r;
} __except (EXCEPTION_EXECUTE_HANDLER) { return 0; }
}
template<typename T> inline T Read(uintptr_t a) {
if (!a) return T{};
__try { return *(T*)a; }
__except (EXCEPTION_EXECUTE_HANDLER) { return T{}; }
}
template<typename T> inline void Write(uintptr_t a, T v) {
if (!a) return;
__try { *(T*)a = v; }
__except (EXCEPTION_EXECUTE_HANDLER) {}
}
}
// ============================================================
// offsets
// ============================================================
namespace offs {
inline uintptr_t dwEntityList = 0;
inline uintptr_t dwLocalController = 0;
inline uintptr_t dwLocalPawn = 0;
inline uintptr_t dwViewMatrix = 0;
inline uintptr_t dwCSGOInput = 0;
inline uintptr_t dwViewAngles = 0;
inline uintptr_t fnCreateMove = 0;
inline void Init() {
auto c = mem::Base("client.dll");
if (!c) return;
auto p1 = mem::Pattern("client.dll", "48 8B 0D ? ? ? ? 48 89 7C 24");
if (p1) dwEntityList = mem::Rel(p1, 3, 7);
if (!dwEntityList) dwEntityList = c + 0x2717828;
auto p2 = mem::Pattern("client.dll", "48 8B 05 ? ? ? ? 41 89 BE");
if (p2) dwLocalController = mem::Rel(p2, 3, 7);
if (!dwLocalController) dwLocalController = c + 0x253A068;
auto p3 = mem::Pattern("client.dll", "48 8D 0D ? ? ? ? 48 C1 E0 06");
if (p3) dwViewMatrix = mem::Rel(p3, 3, 7);
if (!dwViewMatrix) dwViewMatrix = c + 0x2567FA0;
auto p4 = mem::Pattern("client.dll", "48 89 05 ? ? ? ? 48 8B 0D ? ? ? ? 48 85 C9");
if (p4) dwCSGOInput = mem::Rel(p4, 3, 7);
if (!dwCSGOInput) dwCSGOInput = c + 0x2578160;
dwViewAngles = c + 0x25787E8;
dwLocalPawn = c + 0x2562808;
auto p5 = mem::Pattern("client.dll", "85 D2 0F 85 ? ?");
if (p5) fnCreateMove = p5;
}
}
// ============================================================
// entity & handle resolve
// ============================================================
static uintptr_t GetEntityFromHandle(uint32_t handle) {
if (!handle || handle == 0xFFFFFFFF) return 0;
uint32_t index = handle & 0x7FFF;
if (index == 0) return 0;
uintptr_t entityList = mem::Read<uintptr_t>(offs::dwEntityList);
if (!entityList) return 0;
uintptr_t chunk = mem::Read<uintptr_t>(entityList + 0x10 + 8 * (index >> 9));
if (!chunk) chunk = mem::Read<uintptr_t>(entityList + 0x8 + 8 * (index >> 9));
if (!chunk) return 0;
return mem::Read<uintptr_t>(chunk + 8 * (index & 0x1FF));
}
struct Pawn {
uintptr_t ptr = 0;
bool ok() const { return ptr != 0; }
int hp() const { return mem::Read<int>(ptr + 0x344); }
int team() const { return mem::Read<int>(ptr + 0x3E3); }
int flags() const { return mem::Read<int>(ptr + 0x3F4); }
int shotsFired() const { return mem::Read<int>(ptr + 0x1EB4); }
bool alive() const { return hp() > 0 && hp() <= 100; }
uintptr_t sceneNode() const { return mem::Read<uintptr_t>(ptr + 0x330); }
Vec3 origin() const {
uintptr_t sn = sceneNode();
return mem::Read<Vec3>(sn + 0xC8);
}
Vec3 eye() const {
Vec3 o = origin();
float e = mem::Read<float>(ptr + 0xE78);
return Vec3(o.x, o.y, o.z + e);
}
uintptr_t bones() const {
uintptr_t sn = sceneNode();
return mem::Read<uintptr_t>(sn + 0x1E0);
}
Vec3 bone(int i) const {
uintptr_t b = bones();
if (!b) return Vec3(0, 0, 0);
struct B { float x, y, z, w; };
B v = mem::Read<B>(b + i * 32);
return Vec3(v.x, v.y, v.z);
}
bool spotted() const { return mem::Read<bool>(ptr + 0x1E88); }
int crosshairId() const { return mem::Read<int>(ptr + 0x1E88); }
Vec3 aimPunch() const { return mem::Read<Vec3>(ptr + 0x1454); }
};
struct Controller {
uintptr_t ptr = 0;
bool ok() const { return ptr != 0; }
uint32_t pawnHandle() const {
static const uintptr_t candidates[] = { 0x7D8, 0x7C0, 0x6E0, 0x824 };
for (auto off : candidates) {
uint32_t h = mem::Read<uint32_t>(ptr + off);
if (h && h != 0xFFFFFFFF && h < 0xFFFF) {
if (GetEntityFromHandle(h)) return h;
}
}
return 0;
}
Pawn pawn() const {
uint32_t h = pawnHandle();
if (!h) return Pawn{ 0 };
return Pawn{ GetEntityFromHandle(h) };
}
const char* name() const {
const char* n = (const char*)(ptr + 0x6F4);
__try {
if (n && n[0]) {
for (int i = 0; i < 64; ++i) if (n[i] == 0) return n;
}
} __except (EXCEPTION_EXECUTE_HANDLER) {}
return "?";
}
int team() const { return mem::Read<int>(ptr + 0x3E3); }
};
static Pawn GetLocalPawn() {
uintptr_t ctrl = mem::Read<uintptr_t>(offs::dwLocalController);
if (ctrl) {
Controller c{ ctrl };
Pawn p = c.pawn();
if (p.ok()) return p;
}
uintptr_t direct = mem::Read<uintptr_t>(offs::dwLocalPawn);
if (direct) return Pawn{ direct };
return Pawn{ 0 };
}
static Controller GetPlayer(int i) {
return Controller{ GetEntityFromHandle(i) };
}
// ============================================================
// config
// ============================================================
struct Config {
bool espEn = true, box = true, skel = true, hp = true, name = true, dist = true, visOnly = false;
float col[4] = { 0.15f, 0.85f, 1.f, 1.f };
float thick = 1.5f;
bool aimEn = false, aimOnKey = true;
int aimKey = VK_XBUTTON2;
float aimFov = 12.f, aimSmooth = 4.f;
int aimBone = 6;
bool aimVisOnly = true;
bool bhopEn = false;
bool triggerEn = false;
bool rcsEn = false;
float rcsAmount = 1.0f;
bool wallbang = false;
bool spinEn = false;
float spinSpeed = 15.f;
bool menu = false;
int activeTab = 0;
} cfg;
// ============================================================
// esp
// ============================================================
static ImU32 Col(const float c[4]) { return ImGui::GetColorU32(ImVec4(c[0], c[1], c[2], c[3])); }
static void DrawESP() {
if (!cfg.espEn) return;
Matrix4x4 vm = mem::Read<Matrix4x4>(offs::dwViewMatrix);
ImGuiIO& io = ImGui::GetIO();
int sw = (int)io.DisplaySize.x;
int sh = (int)io.DisplaySize.y;
ImDrawList* dl = ImGui::GetBackgroundDrawList();
Pawn me = GetLocalPawn();
if (!me.ok()) return;
int myTeam = me.team();
for (int i = 1; i <= 64; ++i) {
Controller ctrl = GetPlayer(i);
if (!ctrl.ok()) continue;
Pawn p = ctrl.pawn();
if (!p.ok() || !p.alive()) continue;
if (p.team() == myTeam) continue;
if (cfg.visOnly && !p.spotted()) continue;
Vec3 o = p.origin();
Vec3 h = p.bone(6);
if (h.x == 0 && h.y == 0 && h.z == 0) continue;
Vec2 so, shh;
if (!WorldToScreen(o, so, vm, sw, sh)) continue;
if (!WorldToScreen(h, shh, vm, sw, sh)) continue;
float bh = so.y - shh.y;
float bw = bh * 0.5f;
float bx = shh.x - bw * 0.5f;
float by = shh.y;
ImU32 c = Col(cfg.col);
if (cfg.box) dl->AddRect(ImVec2(bx, by), ImVec2(bx + bw, by + bh), c, 0, 0, cfg.thick);
if (cfg.hp) {
float f = p.hp() / 100.f;
dl->AddRectFilled(ImVec2(bx - 6, by + bh * (1 - f)), ImVec2(bx - 2, by + bh),
ImGui::GetColorU32(ImVec4(1 - f, f, 0.1f, 1)));
}
if (cfg.name) dl->AddText(ImVec2(bx, by - 16), c, ctrl.name());
if (cfg.skel) {
static const int b[][2] = { {6,5},{5,4},{4,3},{5,7},{7,8},{8,9},
{5,11},{11,12},{12,13},{4,14},{14,15},{15,16},
{4,17},{17,18},{18,19} };
for (int j = 0; j < 15; ++j) {
Vec2 a, c2;
if (WorldToScreen(p.bone(b[j][0]), a, vm, sw, sh) &&
WorldToScreen(p.bone(b[j][1]), c2, vm, sw, sh)) {
dl->AddLine(ImVec2(a.x, a.y), ImVec2(c2.x, c2.y), c, cfg.thick);
}
}
}
if (cfg.dist) {
float d = (o - me.origin()).Length() / 100.f;
char buf[32];
snprintf(buf, sizeof buf, "[%.0fm]", d);
dl->AddText(ImVec2(bx, by + bh + 2), c, buf);
}
}
}
// ============================================================
// aimbot & trigger & rcs
// ============================================================
static Vec3 CalcAngle(const Vec3& f, const Vec3& t) {
Vec3 d = t - f;
float hyp = std::sqrt(d.x * d.x + d.y * d.y);
return { Rad2Deg(std::atan2(-d.z, hyp)), Rad2Deg(std::atan2(d.y, d.x)), 0.f };
}
static float Norm(float a) { while (a > 180)a -= 360; while (a < -180)a += 360; return a; }
static uintptr_t ViewAnglesAddr() {
uintptr_t in = mem::Read<uintptr_t>(offs::dwCSGOInput);
if (in) return in + 0x2CC;
return offs::dwViewAngles;
}
static void RunAimbot(void* input) {
Pawn me = GetLocalPawn();
if (!me.ok() || !me.alive()) return;
Vec3 eye = me.eye();
int myTeam = me.team();
uintptr_t va = ViewAnglesAddr();
if (!va) return;
Vec3 cur = mem::Read<Vec3>(va);
if (cfg.rcsEn && me.shotsFired() > 1) {
Vec3 punch = me.aimPunch();
cur.x -= punch.x * 2.0f * cfg.rcsAmount;
cur.y -= punch.y * 2.0f * cfg.rcsAmount;
mem::Write<Vec3>(va, cur);
}
if (cfg.aimEn) {
if (!cfg.aimOnKey || (GetAsyncKeyState(cfg.aimKey) & 0x8000)) {
float best = cfg.aimFov;
Vec3 bestAng;
bool has = false;
for (int i = 1; i <= 64; ++i) {
Controller ctrl = GetPlayer(i);
if (!ctrl.ok()) continue;
Pawn p = ctrl.pawn();
if (!p.ok() || !p.alive()) continue;
if (p.team() == myTeam) continue;
Vec3 bone = p.bone(cfg.aimBone);
if (bone.x == 0 && bone.y == 0 && bone.z == 0) continue;
if (!cfg.wallbang && cfg.aimVisOnly && !p.spotted()) continue;
Vec3 a = CalcAngle(eye, bone);
float dp = Norm(a.x - cur.x);
float dy = Norm(a.y - cur.y);
float f = std::sqrt(dp * dp + dy * dy);
if (f < best) { best = f; bestAng = a; has = true; }
}
if (has) {
float step = cfg.aimSmooth > 0.01f ? 1.f / cfg.aimSmooth : 1.f;
Vec3 out;
out.x = cur.x + Norm(bestAng.x - cur.x) * step;
out.y = cur.y + Norm(bestAng.y - cur.y) * step;
out.z = 0;
mem::Write<Vec3>(va, out);
}
}
}
if (cfg.triggerEn) {
int crossId = me.crosshairId();
if (crossId > 0 && crossId <= 64) {
Controller target = GetPlayer(crossId);
if (target.ok()) {
Pawn p = target.pawn();
if (p.ok() && p.alive() && p.team() != myTeam) {
INPUT in{};
in.type = INPUT_MOUSE;
in.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &in, sizeof(INPUT));
Sleep(40 + rand() % 30);
in.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &in, sizeof(INPUT));
}
}
}
}
}
// ============================================================
// misc
// ============================================================
static void RunMisc(void* cmd) {
Pawn me = GetLocalPawn();
if (!me.ok() || !me.alive()) return;
uint32_t buttons = mem::Read<uint32_t>((uintptr_t)cmd + 0x38);
if (cfg.bhopEn) {
if (GetAsyncKeyState(VK_SPACE) & 0x8000) {
if (me.flags() & 1) {
mem::Write<uint32_t>((uintptr_t)cmd + 0x38, buttons | 2);
}
}
}
if (cfg.spinEn) {
static float g_spin = 0;
g_spin += cfg.spinSpeed;
if (g_spin > 360) g_spin -= 360;
uintptr_t va = ViewAnglesAddr();
if (va) {
Vec3 cur = mem::Read<Vec3>(va);
mem::Write<Vec3>(va, Vec3(cur.x, g_spin, 0));
}
}
}
// ============================================================
// menu
// ============================================================
static void DrawMenu() {
if (!cfg.menu) return;
ImGui::SetNextWindowSize({ 620, 480 }, ImGuiCond_FirstUseEver);
ImGui::Begin("worm shadow", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize);
ImGui::BeginChild("Sidebar", ImVec2(160, 0), true);
{
ImGui::Spacing();
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "WORM SHADOW");
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), " :: CS2");
ImGui::Separator();
ImGui::Spacing(); ImGui::Spacing();
auto TabButton = [](const char* label, int id, int* active) {
bool isActive = (*active == id);
if (isActive) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.2f, 1.0f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 1));
} else {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.1f, 0.12f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.6f, 0.6f, 0.6f, 1.0f));
}
if (ImGui::Button(label, ImVec2(140, 40))) *active = id;
ImGui::PopStyleColor(2);
ImGui::Spacing();
};
TabButton("Visuals", 0, &cfg.activeTab);
TabButton("Aimbot", 1, &cfg.activeTab);
TabButton("Misc", 2, &cfg.activeTab);
TabButton("Debug", 3, &cfg.activeTab);
ImGui::SetCursorPosY(ImGui::GetWindowHeight() - 50);
if (ImGui::Button("Close Menu", ImVec2(140, 35))) cfg.menu = false;
}
ImGui::EndChild();
ImGui::SameLine();
ImGui::BeginChild("Content", ImVec2(0, 0), true);
{
ImGui::Spacing();
if (cfg.activeTab == 0) {
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "ESP & VISUALS");
ImGui::Separator();
ImGui::Spacing();
ImGui::Checkbox("Master Switch", &cfg.espEn);
ImGui::Checkbox("Bounding Box", &cfg.box);
ImGui::Checkbox("Skeleton", &cfg.skel);
ImGui::Checkbox("Health Bar", &cfg.hp);
ImGui::Checkbox("Player Name", &cfg.name);
ImGui::Checkbox("Distance", &cfg.dist);
ImGui::Spacing();
ImGui::Checkbox("Visible Only", &cfg.visOnly);
ImGui::SliderFloat("Thickness", &cfg.thick, 0.5f, 4.f, "%.1f px");
ImGui::ColorEdit4("ESP Color", cfg.col);
}
else if (cfg.activeTab == 1) {
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "AIMBOT & TRIGGER");
ImGui::Separator();
ImGui::Spacing();
ImGui::Checkbox("Aimbot", &cfg.aimEn);
ImGui::Checkbox("On Key (Mouse5)", &cfg.aimOnKey);
ImGui::SliderFloat("FOV", &cfg.aimFov, 1, 90, "%.0f deg");
ImGui::SliderFloat("Smooth", &cfg.aimSmooth, 0.5f, 20);
ImGui::Checkbox("Wallbang (Ignore Walls)", &cfg.wallbang);
const char* bn[] = { "Pelvis","Chest","Neck","Head" };
int bi = cfg.aimBone <= 3 ? 0 : cfg.aimBone == 4 ? 1 : cfg.aimBone == 5 ? 2 : 3;
if (ImGui::Combo("Target Bone", &bi, bn, 4)) {
static const int map[] = { 0,4,5,6 };
cfg.aimBone = map[bi];
}
ImGui::Checkbox("Triggerbot (Auto-Fire)", &cfg.triggerEn);
}
else if (cfg.activeTab == 2) {
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "MISCELLANEOUS");
ImGui::Separator();
ImGui::Spacing();
ImGui::Checkbox("Auto Bhop", &cfg.bhopEn);
ImGui::Spacing();
ImGui::Checkbox("RCS (No Recoil)", &cfg.rcsEn);
ImGui::SliderFloat("RCS Strength", &cfg.rcsAmount, 0.1f, 2.0f);
ImGui::Spacing();
ImGui::Checkbox("Spinbot", &cfg.spinEn);
ImGui::SliderFloat("Spin Speed", &cfg.spinSpeed, 1, 60);
}
else if (cfg.activeTab == 3) {
ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), "OFFSETS STATUS");
ImGui::Separator();
ImGui::Spacing();
ImGui::Text("EntityList: 0x%llX", (unsigned long long)offs::dwEntityList);
ImGui::Text("Controller: 0x%llX", (unsigned long long)offs::dwLocalController);
ImGui::Text("ViewMatrix: 0x%llX", (unsigned long long)offs::dwViewMatrix);
ImGui::Text("CSGOInput: 0x%llX", (unsigned long long)offs::dwCSGOInput);
ImGui::Text("LocalPawn: 0x%llX", (unsigned long long)offs::dwLocalPawn);
ImGui::Text("CreateMove: 0x%llX", (unsigned long long)offs::fnCreateMove);
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
uintptr_t ctrl = mem::Read<uintptr_t>(offs::dwLocalController);
ImGui::Text("Ctrl Ptr: 0x%llX", (unsigned long long)ctrl);
if (ctrl) {
Controller c{ ctrl };
uint32_t h = c.pawnHandle();
ImGui::Text("Pawn Handle: 0x%X", h);
uintptr_t list = mem::Read<uintptr_t>(offs::dwEntityList);
ImGui::Text("List Ptr: 0x%llX", (unsigned long long)list);
if (list) {
ImGui::Text("Chunk (0x10): 0x%llX", (unsigned long long)mem::Read<uintptr_t>(list + 0x10));
ImGui::Text("Chunk (0x08): 0x%llX", (unsigned long long)mem::Read<uintptr_t>(list + 0x08));
}
if (h && list) {
uintptr_t ent = GetEntityFromHandle(h);
ImGui::Text("Entry Ptr: 0x%llX", (unsigned long long)ent);
}
}
Pawn lp = GetLocalPawn();
ImGui::Text("Resolved Pawn: 0x%llX", (unsigned long long)lp.ptr);
if (lp.ok()) {
ImGui::Text("HP: %d", lp.hp());
ImGui::Text("Team: %d", lp.team());
Vec3 pos = lp.origin();
ImGui::Text("Pos: %.0f, %.0f, %.0f", pos.x, pos.y, pos.z);
} else {
ImGui::TextColored(ImVec4(1,0,0,1), "Pawn unresolved");
}
}
}
ImGui::EndChild();
ImGui::End();
}
// ============================================================
// hooks
// ============================================================
using PresentFn = HRESULT(__stdcall*)(IDXGISwapChain*, UINT, UINT);
using CreateMoveFn = void(__fastcall*)(void*, void*, void*);
static PresentFn oPresent = nullptr;
static CreateMoveFn oCreateMove = nullptr;
static ID3D11Device* g_dev = nullptr;
static ID3D11DeviceContext* g_ctx = nullptr;
static ID3D11RenderTargetView* g_rtv = nullptr;
static HWND g_hwnd = nullptr;
static WNDPROC g_wnd = nullptr;
static void MakeRTV(IDXGISwapChain* sc) {
ID3D11Texture2D* bb = nullptr;
sc->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&bb);
if (bb) { g_dev->CreateRenderTargetView(bb, nullptr, &g_rtv); bb->Release(); }
}
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (m == WM_KEYDOWN && w == VK_INSERT) {
cfg.menu = !cfg.menu;
}
if (m == WM_KEYDOWN && w == VK_F11) {
MH_DisableHook(MH_ALL_HOOKS);
MH_Uninitialize();
ImGui_ImplDX11_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
if (g_rtv) { g_rtv->Release(); g_rtv = nullptr; }
if (g_ctx) { g_ctx->Release(); g_ctx = nullptr; }
if (g_dev) { g_dev->Release(); g_dev = nullptr; }
if (g_wnd) SetWindowLongPtr(g_hwnd, GWLP_WNDPROC, (LONG_PTR)g_wnd);
FreeLibraryAndExitThread(GetModuleHandleA(nullptr), 0);
return 0;
}
if (cfg.menu) {
ImGui_ImplWin32_WndProcHandler(h, m, w, l);
if (m == WM_INPUT) return true;
if ((m >= WM_MOUSEFIRST && m <= WM_MOUSELAST) || (m >= WM_KEYFIRST && m <= WM_KEYLAST))
return true;
}
return CallWindowProc(g_wnd, h, m, w, l);
}
static HRESULT __stdcall Present(IDXGISwapChain* sc, UINT s, UINT f) {
if (!g_dev) {
sc->GetDevice(__uuidof(ID3D11Device), (void**)&g_dev);
g_dev->GetImmediateContext(&g_ctx);
DXGI_SWAP_CHAIN_DESC d; sc->GetDesc(&d);
g_hwnd = d.OutputWindow;
MakeRTV(sc);
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
if (!io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 18.0f))
io.Fonts->AddFontDefault();
ImGuiStyle& style = ImGui::GetStyle();
ImGui::StyleColorsDark();
style.WindowRounding = 8.f;
style.FrameRounding = 4.f;
style.FramePadding = ImVec2(10, 6);
style.ItemSpacing = ImVec2(10, 10);
ImVec4* c = style.Colors;
c[ImGuiCol_WindowBg] = ImVec4(0.04f, 0.04f, 0.05f, 0.96f);
c[ImGuiCol_ChildBg] = ImVec4(0.06f, 0.06f, 0.08f, 0.50f);
c[ImGuiCol_Border] = ImVec4(0.25f, 0.10f, 0.40f, 0.80f);
c[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.10f, 0.12f, 1.00f);
c[ImGuiCol_CheckMark]= ImVec4(0.60f, 0.20f, 1.00f, 1.00f);
c[ImGuiCol_SliderGrab]=ImVec4(0.60f, 0.20f, 1.00f, 1.00f);
c[ImGuiCol_Button] = ImVec4(0.10f, 0.10f, 0.12f, 1.00f);
c[ImGuiCol_ButtonHovered]=ImVec4(0.60f, 0.20f, 1.0f, 0.60f);
c[ImGuiCol_ButtonActive] =ImVec4(0.60f, 0.20f, 1.0f, 1.00f);
c[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.95f, 1.00f);
c[ImGuiCol_Separator]= ImVec4(0.20f, 0.10f, 0.30f, 0.80f);
io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
ImGui_ImplWin32_Init(g_hwnd);
ImGui_ImplDX11_Init(g_dev, g_ctx);
g_wnd = (WNDPROC)SetWindowLongPtr(g_hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
}
RECT rect; GetClientRect(g_hwnd, &rect);
ImGui::GetIO().DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top));
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
if (cfg.menu) {
ClipCursor(NULL);
POINT p; GetCursorPos(&p); ScreenToClient(g_hwnd, &p);
ImGui::GetIO().MousePos = ImVec2((float)p.x, (float)p.y);
} else {
ImGui::GetIO().MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
}
ImGui::NewFrame();
DrawESP();
DrawMenu();
ImGui::Render();
g_ctx->OMSetRenderTargets(1, &g_rtv, nullptr);
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
return oPresent(sc, s, f);
}
static void __fastcall CreateMove(void* in, void* cmd, void* mover) {
oCreateMove(in, cmd, mover);
RunMisc(cmd);
RunAimbot(cmd);
}
// ============================================================
// init
// ============================================================
static DWORD WINAPI Main(LPVOID) {
while (!GetModuleHandleA("client.dll")) Sleep(100);
Sleep(1500);
offs::Init();
MH_Initialize();
WNDCLASSEXA wc{ sizeof wc };
wc.lpfnWndProc = DefWindowProcA;
wc.hInstance = GetModuleHandleA(nullptr);
wc.lpszClassName = "wsc";
RegisterClassExA(&wc);
HWND dummy = CreateWindowA("wsc", "", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, nullptr, nullptr, wc.hInstance, nullptr);
DXGI_SWAP_CHAIN_DESC sd{};
sd.BufferCount = 1;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = dummy;
sd.SampleDesc.Count = 1;
sd.Windowed = TRUE;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
IDXGISwapChain* sc = nullptr; ID3D11Device* dv = nullptr; ID3D11DeviceContext* cx = nullptr;
D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, nullptr, 0,
D3D11_SDK_VERSION, &sd, &sc, &dv, nullptr, &cx);
if (!sc) return 0;
void** vt = *(void***)sc;
MH_CreateHook(vt[8], &Present, (void**)&oPresent);
MH_EnableHook(vt[8]);
sc->Release(); dv->Release(); cx->Release();
DestroyWindow(dummy); UnregisterClassA("wsc", wc.hInstance);
if (offs::fnCreateMove) {
MH_CreateHook((void*)offs::fnCreateMove, &CreateMove, (void**)&oCreateMove);
MH_EnableHook((void*)offs::fnCreateMove);
}
return 0;
}
BOOL APIENTRY DllMain(HMODULE, DWORD r, LPVOID) {
if (r == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(GetModuleHandleA(nullptr));
CreateThread(nullptr, 0, Main, nullptr, 0, nullptr);
}
return TRUE;
}