Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions features/esp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include "esp.h"
#include "../globals/globals.h"
#include "../offsets/offsets.h"
#include <imgui.h>

namespace features {
void ESP::Run(const Memory& memory) noexcept {
if (!globals::ESPEnabled)
return;

const uintptr_t localPlayerController = memory.Read<uintptr_t>(globals::client + offsets::dwLocalPlayerController);
if (!localPlayerController)
return;

int localTeam = memory.Read<int>(localPlayerController + offsets::m_iTeamNum);

// Read view matrix for world to screen conversion
float viewMatrix[16];
memory.Read(globals::client + offsets::dwViewMatrix, &viewMatrix, sizeof(viewMatrix));

for (int i = 1; i < 64; i++) {
uintptr_t entityList = memory.Read<uintptr_t>(globals::client + offsets::dwEntityList);
if (!entityList)
continue;

uintptr_t listEntry = memory.Read<uintptr_t>(entityList + ((8 * (i & 0x7FFF)) >> 9) + 16);
if (!listEntry)
continue;

uintptr_t player = memory.Read<uintptr_t>(listEntry + 120 * (i & 0x1FF));
if (!player)
continue;

int playerTeam = memory.Read<int>(player + offsets::m_iTeamNum);
if (playerTeam == localTeam) // Skip teammates
continue;

uint32_t playerPawn = memory.Read<uint32_t>(player + offsets::m_hPlayerPawn);
if (!playerPawn)
continue;

uintptr_t listEntry2 = memory.Read<uintptr_t>(entityList + (0x8 * ((playerPawn & 0x7FFF) >> 9)) + 16);
if (!listEntry2)
continue;

uintptr_t playerCsPawn = memory.Read<uintptr_t>(listEntry2 + 120 * (playerPawn & 0x1FF));
if (!playerCsPawn)
continue;

int health = memory.Read<int>(playerCsPawn + offsets::m_iHealth);
if (health < 1)
continue;

// Read player position
float origin[3];
memory.Read(playerCsPawn + offsets::m_vOldOrigin, &origin, sizeof(origin));

// Calculate screen position
float w = viewMatrix[3] * origin[0] + viewMatrix[7] * origin[1] + viewMatrix[11] * origin[2] + viewMatrix[15];
if (w < 0.01f) // Behind camera
continue;

float x = viewMatrix[0] * origin[0] + viewMatrix[4] * origin[1] + viewMatrix[8] * origin[2] + viewMatrix[12];
float y = viewMatrix[1] * origin[0] + viewMatrix[5] * origin[1] + viewMatrix[9] * origin[2] + viewMatrix[13];

// Convert to screen coordinates
ImVec2 screen = ImGui::GetIO().DisplaySize;
float screenX = (screen.x / 2) * (1 + x / w);
float screenY = (screen.y / 2) * (1 - y / w);

// Draw ESP box (approximate player size)
const float playerHeight = 72.0f; // Approximate player height in game units
const float playerWidth = playerHeight * 0.4f;

// Scale based on distance
float scale = 100.0f / w;
float boxHeight = playerHeight * scale;
float boxWidth = playerWidth * scale;

ImGui::GetBackgroundDrawList()->AddRect(
ImVec2(screenX - boxWidth/2, screenY - boxHeight),
ImVec2(screenX + boxWidth/2, screenY),
IM_COL32(255, 0, 0, 255), // Red color
0.0f, // Rounding
0, // Flags
2.0f // Thickness
);
}
}
}
13 changes: 13 additions & 0 deletions features/esp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <cstddef>
#include <Windows.h>
#include "../external/imgui/imgui.h"
#include "../memory/memory.h"

namespace features {
class ESP {
public:
static void Run(const Memory& memory) noexcept;
};
}
46 changes: 46 additions & 0 deletions globals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#pragma once

#include <cstddef>
#include <locale>
#include <Windows.h>

#include "../external/imgui/imgui.h"

namespace globals {

// ESP
inline bool ESPEnabled = false; // ESP activation state

// TriggerBot
inline bool TriggerBot = false; // TriggerBot activation state
inline int TriggerBotKey = VK_LSHIFT; // Key to activate TriggerBot
inline char TriggerBotKeyName[64] = "L-Shift"; // Name of the key for display
inline int TriggerBotMode = 0; // TriggerBot mode (Hold/Toggle)
inline int TriggerBotDelay = 20; // TriggerBot delay in milliseconds
inline bool TriggerBotToggled = false; // Toggle state for TriggerBot
inline bool TriggerBotTeamCheck = true; // Whether to shoot teammates or not
inline bool TriggerBotIgnoreFlash = false; // Whether TriggerBot works while flashed

// Fov
inline int FOV = 90; // Field of View setting

// Glow
inline bool Glow = false; // Glow activation state
inline ImVec4 GlowColor = ImVec4(0.0f, 0.0f, 1.0f, 1.0f); // Glow color setting

// NoFlash
inline bool NoFlashEnabled = false; // No Flash activation state

// Application state
inline bool isRunning = true; // Whether the hack is running
inline std::uintptr_t client = 0; // Client base address

// Misc
inline bool BunnyHopEnabled = false; // Bhop activation state

// Menu
inline bool MenuVisible = true; // Menu visibility state
inline int ShowMenuKey = VK_END; // Key to toggle menu visibility
inline ImVec4 MenuAccentColor = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); // GUI color setting
inline bool Rainbow = false; // Rainbow color mode activation
}
41 changes: 41 additions & 0 deletions threads.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma once

#include "features/noflash.h"
#include "features/glow.h"
#include "features/esp.h"
#include "features/triggerbot.h"
#include "features/bhop.h"
#include "menu/menu.h"
#include "memory/memory.h"
#include "globals/globals.h"

#include <thread>
#include <chrono>

namespace threads {
void RunMiscThread(const Memory& memory) noexcept {
while (gui::isRunning) {
features::FOVManager::AdjustFOV(memory);
features::Bhop::Run(memory);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}

void RunVisualThread(const Memory& memory) noexcept {
while (gui::isRunning) {
features::NoFlash::Run(memory);
features::Glow::Run(memory);
features::ESP::Run(memory);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}

void RunAimThread(const Memory& memory) noexcept {
while (gui::isRunning) {
if (globals::TriggerBot) {
features::TriggerBot::Run(memory);
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
}
Loading