Merge branch 'ifBars-main'
This commit is contained in:
@@ -184,17 +184,20 @@ namespace updater {
|
||||
if (data.empty())
|
||||
return false;
|
||||
|
||||
if (data["build_number"].is_number())
|
||||
build_number = data["build_number"];
|
||||
|
||||
if (data["dwLocalPlayer"].is_number())
|
||||
offsets::dwLocalPlayer = data["dwLocalPlayer"];
|
||||
if (data["dwEntityList"].is_number())
|
||||
offsets::dwEntityList = data["dwEntityList"];
|
||||
if (data["dwViewMatrix"].is_number())
|
||||
offsets::dwViewMatrix = data["dwViewMatrix"];
|
||||
if (data["dwBuildNumber"].is_number())
|
||||
offsets::dwBuildNumber = data["dwBuildNumber"];
|
||||
|
||||
if (data["m_iPawnArmor"].is_number())
|
||||
offsets::m_iPawnArmor = data["m_iPawnArmor"];
|
||||
if (data["dwPawnHealth"].is_number())
|
||||
offsets::dwPawnHealth = data["dwPawnHealth"];
|
||||
if (data["m_iHealth"].is_number())
|
||||
offsets::m_iHealth = data["m_iHealth"];
|
||||
if (data["dwPlayerPawn"].is_number())
|
||||
offsets::dwPlayerPawn = data["dwPlayerPawn"];
|
||||
if (data["dwSanitizedName"].is_number())
|
||||
@@ -210,12 +213,14 @@ namespace updater {
|
||||
void save() {
|
||||
json data;
|
||||
|
||||
data["build_number"] = build_number;
|
||||
|
||||
data["dwLocalPlayer"] = offsets::dwLocalPlayer;
|
||||
data["dwEntityList"] = offsets::dwEntityList;
|
||||
data["dwViewMatrix"] = offsets::dwViewMatrix;
|
||||
data["dwBuildNumber"] = offsets::dwBuildNumber;
|
||||
|
||||
data["m_iPawnArmor"] = offsets::m_iPawnArmor;
|
||||
data["dwPawnHealth"] = offsets::dwPawnHealth;
|
||||
data["m_iHealth"] = offsets::m_iHealth;
|
||||
data["dwPlayerPawn"] = offsets::dwPlayerPawn;
|
||||
data["dwSanitizedName"] = offsets::dwSanitizedName;
|
||||
data["m_iTeamNum"] = offsets::m_iTeamNum;
|
||||
|
||||
@@ -30,14 +30,16 @@ namespace updater {
|
||||
const inline std::string github_repo_api = "https://api.github.com/repos/IMXNOOBX/cs2-external-esp/commits";
|
||||
const inline std::string raw_updated_offets = "https://github.com/IMXNOOBX/cs2-external-esp/raw/main/offsets/offsets.json";
|
||||
|
||||
namespace offsets {
|
||||
inline std::ptrdiff_t dwLocalPlayer = 0x1877CF8;
|
||||
inline std::ptrdiff_t dwEntityList = 0x178A808;
|
||||
inline std::ptrdiff_t dwViewMatrix = 0x18787E0;
|
||||
inline int build_number = 13962;
|
||||
|
||||
inline std::ptrdiff_t m_iPawnArmor = 0x80c;
|
||||
inline std::ptrdiff_t dwPawnHealth = 0x808;
|
||||
inline std::ptrdiff_t dwPlayerPawn = 0x7FC;
|
||||
namespace offsets {
|
||||
inline std::ptrdiff_t dwLocalPlayer = 0x17DE508;
|
||||
inline std::ptrdiff_t dwEntityList = 0x178FC88;
|
||||
inline std::ptrdiff_t dwViewMatrix = 0x187DAB0;
|
||||
inline std::ptrdiff_t dwBuildNumber = 0x487514;
|
||||
|
||||
inline std::ptrdiff_t m_iHealth = 0x32C;
|
||||
inline std::ptrdiff_t dwPlayerPawn = 0x7BC;
|
||||
inline std::ptrdiff_t dwSanitizedName = 0x720;
|
||||
inline std::ptrdiff_t m_iTeamNum = 0x3BF;
|
||||
inline std::ptrdiff_t m_vecOrigin = 0x1214;
|
||||
|
||||
@@ -29,12 +29,6 @@ namespace config {
|
||||
inline int flag_render_distance = 200;
|
||||
inline bool show_extra_flags = false;
|
||||
|
||||
//inline bool show_distance = false;
|
||||
//inline bool show_armor = false;
|
||||
//inline bool head_tracker = false;
|
||||
//inline bool rainbow = false;
|
||||
//inline float rainbow_speed = 0.001f;
|
||||
|
||||
inline RGB esp_box_color_team = { 75, 175, 75 };
|
||||
inline RGB esp_box_color_enemy = { 175, 75, 75 };
|
||||
inline RGB esp_name_color = { 75, 75, 175 };
|
||||
|
||||
@@ -5,23 +5,20 @@
|
||||
#include "../classes/render.hpp"
|
||||
#include "../classes/config.hpp"
|
||||
|
||||
|
||||
|
||||
namespace hack {
|
||||
std::shared_ptr<pProcess> process;
|
||||
ProcessModule base_module;
|
||||
|
||||
//const float pi = 3.14159265358979323846f;
|
||||
ProcessModule base_client;
|
||||
ProcessModule base_engine;
|
||||
|
||||
void loop() {
|
||||
const uintptr_t localPlayer = process->read<uintptr_t>(base_module.base + updater::offsets::dwLocalPlayer);
|
||||
const uintptr_t localPlayer = process->read<uintptr_t>(base_client.base + updater::offsets::dwLocalPlayer);
|
||||
if (!localPlayer)
|
||||
return;
|
||||
|
||||
const int localTeam = process->read<int>(localPlayer + updater::offsets::m_iTeamNum);
|
||||
const view_matrix_t view_matrix = process->read<view_matrix_t>(base_module.base + updater::offsets::dwViewMatrix);
|
||||
const view_matrix_t view_matrix = process->read<view_matrix_t>(base_client.base + updater::offsets::dwViewMatrix);
|
||||
const Vector3 localOrigin = process->read<Vector3>(localPlayer + updater::offsets::m_vecOrigin);
|
||||
const uintptr_t entity_list = process->read<uintptr_t>(base_module.base + updater::offsets::dwEntityList);
|
||||
const uintptr_t entity_list = process->read<uintptr_t>(base_client.base + updater::offsets::dwEntityList);
|
||||
|
||||
int playerIndex = 0;
|
||||
uintptr_t list_entry;
|
||||
@@ -41,13 +38,6 @@ namespace hack {
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
||||
const int playerHealth = process->read<int>(player + updater::offsets::dwPawnHealth);
|
||||
const int playerArmor = process->read<int>(player + updater::offsets::m_iPawnArmor);
|
||||
if (playerHealth <= 0 || playerHealth > 100)
|
||||
continue;
|
||||
|
||||
|
||||
/**
|
||||
* Skip rendering your own character and teammates
|
||||
*
|
||||
@@ -65,14 +55,16 @@ namespace hack {
|
||||
if (!list_entry2)
|
||||
continue;
|
||||
|
||||
|
||||
const uintptr_t pCSPlayerPawn = process->read<uintptr_t>(list_entry2 + 120 * (playerPawn & 0x1FF));
|
||||
if (!pCSPlayerPawn)
|
||||
continue;
|
||||
|
||||
if (config::team_esp && (pCSPlayerPawn == localPlayer))
|
||||
const int playerHealth = process->read<int>(pCSPlayerPawn + updater::offsets::m_iHealth);
|
||||
if (playerHealth <= 0 || playerHealth > 100)
|
||||
continue;
|
||||
|
||||
if (config::team_esp && (pCSPlayerPawn == localPlayer))
|
||||
continue;
|
||||
|
||||
std::string playerName = "Invalid Name";
|
||||
const DWORD64 playerNameAddress = process->read<DWORD64>(player + updater::offsets::dwSanitizedName);
|
||||
@@ -86,16 +78,13 @@ namespace hack {
|
||||
const Vector3 origin = process->read<Vector3>(pCSPlayerPawn + updater::offsets::m_vecOrigin);
|
||||
const Vector3 head = { origin.x, origin.y, origin.z + 75.f };
|
||||
const Vector3 head2 = { origin.x + 10, origin.y + 10, origin.z + 75.f };
|
||||
const Vector3 localOrigin = process->read<Vector3>(localPlayer + updater::offsets::m_vecOrigin);
|
||||
|
||||
if (config::render_distance != -1 && (localOrigin - origin).length2d() > config::render_distance)
|
||||
continue;
|
||||
|
||||
|
||||
if ((localOrigin - origin).length2d() < 5)
|
||||
if ((localOrigin - origin).length2d() < 10)
|
||||
continue;
|
||||
|
||||
|
||||
const Vector3 screenPos = origin.world_to_screen(view_matrix);
|
||||
const Vector3 screenHead = head.world_to_screen(view_matrix);
|
||||
|
||||
@@ -107,7 +96,7 @@ namespace hack {
|
||||
|
||||
if (screenPos.z >= 0.01f) {
|
||||
float distance = localOrigin.calculate_distance(origin);
|
||||
int roundedDistance = std::round(distance / 10);
|
||||
int roundedDistance = std::round(distance / 10.f);
|
||||
|
||||
render::DrawBorderBox(
|
||||
g::hdcBuffer,
|
||||
@@ -164,20 +153,7 @@ namespace hack {
|
||||
render::RenderText(
|
||||
g::hdcBuffer,
|
||||
screenHead.x + (width / 2 + 5),
|
||||
screenHead.y + 21,
|
||||
(std::to_string(playerArmor) + "armor").c_str(),
|
||||
RGB(
|
||||
(255 - playerArmor),
|
||||
(55 + playerArmor * 2),
|
||||
75
|
||||
),
|
||||
10
|
||||
);
|
||||
|
||||
render::RenderText(
|
||||
g::hdcBuffer,
|
||||
screenHead.x + (width / 2 + 5),
|
||||
screenHead.y + 32,
|
||||
screenHead.y + 20,
|
||||
(std::to_string(roundedDistance) + "m away").c_str(),
|
||||
config::esp_distance_color,
|
||||
10
|
||||
|
||||
@@ -92,15 +92,25 @@ int main() {
|
||||
else
|
||||
std::cout << "[updater] Error reading offsets file, reseting to the default state\n" << std::endl;
|
||||
|
||||
std::cout << "[warn] If the esp doesnt work, consider updating offsets manually in the file offsets.json" << std::endl;
|
||||
|
||||
do {
|
||||
hack::base_module = hack::process->GetModule("client.dll");
|
||||
if (hack::base_module.base == 0) {
|
||||
hack::base_client = hack::process->GetModule("client.dll");
|
||||
hack::base_engine = hack::process->GetModule("engine2.dll");
|
||||
if (hack::base_client.base == 0 || hack::base_engine.base == 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
std::cout << "[cs2] Failed to find module client.dll, waiting for the game to load it..." << std::endl;
|
||||
std::cout << "[cs2] Failed to find module client.dll/engine2.dll, waiting for the game to load it..." << std::endl;
|
||||
}
|
||||
} while (hack::base_module.base == 0);
|
||||
} while (hack::base_client.base == 0 || hack::base_engine.base == 0);
|
||||
|
||||
const uintptr_t buildNumber = hack::process->read<uintptr_t>(hack::base_engine.base + updater::offsets::dwBuildNumber);
|
||||
if (buildNumber != updater::build_number) {
|
||||
std::cout << "[cs2] Build number doesnt match, the game has been updated and this esp most likely wont work." << std::endl;
|
||||
std::cout << "[warn] If the esp doesnt work, consider updating offsets manually in the file offsets.json" << std::endl;
|
||||
std::cout << "[cs2] Press any key to continue" << std::endl;
|
||||
std::cin.get();
|
||||
}
|
||||
else {
|
||||
std::cout << "[cs2] Offsets seem to be up to date! have fun!" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "[overlay] Waiting to focus game to create the overlay..." << std::endl;
|
||||
std::cout << "[overlay] Make sure your game is in \"Full Screen Windowed\"" << std::endl;
|
||||
|
||||
@@ -71,10 +71,10 @@ bool pProcess::AttachProcess(const char* ProcessName)
|
||||
handle_ = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid_);
|
||||
|
||||
EnumProcessModulesEx(this->handle_, modules, sizeof(modules), &_, LIST_MODULES_64BIT);
|
||||
base_module_.base = (uintptr_t)modules[0];
|
||||
base_client_.base = (uintptr_t)modules[0];
|
||||
|
||||
GetModuleInformation(this->handle_, modules[0], &module_info, sizeof(module_info));
|
||||
base_module_.size = module_info.SizeOfImage;
|
||||
base_client_.size = module_info.SizeOfImage;
|
||||
|
||||
hwnd_ = this->GetWindowHandleFromProcessId(pid_);
|
||||
|
||||
@@ -105,10 +105,10 @@ bool pProcess::AttachProcessHj(const char* ProcessName)
|
||||
}
|
||||
|
||||
EnumProcessModulesEx(this->handle_, modules, sizeof(modules), &_, LIST_MODULES_64BIT);
|
||||
base_module_.base = (uintptr_t)modules[0];
|
||||
base_client_.base = (uintptr_t)modules[0];
|
||||
|
||||
GetModuleInformation(this->handle_, modules[0], &module_info, sizeof(module_info));
|
||||
base_module_.size = module_info.SizeOfImage;
|
||||
base_client_.size = module_info.SizeOfImage;
|
||||
|
||||
hwnd_ = this->GetWindowHandleFromProcessId(pid_);
|
||||
|
||||
@@ -132,10 +132,10 @@ bool pProcess::AttachWindow(const char* WindowName)
|
||||
handle_ = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid_);
|
||||
|
||||
EnumProcessModulesEx(this->handle_, modules, sizeof(modules), &_, LIST_MODULES_64BIT);
|
||||
base_module_.base = (uintptr_t)modules[0];
|
||||
base_client_.base = (uintptr_t)modules[0];
|
||||
|
||||
GetModuleInformation(this->handle_, modules[0], &module_info, sizeof(module_info));
|
||||
base_module_.size = module_info.SizeOfImage;
|
||||
base_client_.size = module_info.SizeOfImage;
|
||||
|
||||
hwnd_ = this->GetWindowHandleFromProcessId(pid_);
|
||||
|
||||
@@ -185,13 +185,13 @@ LPVOID pProcess::Allocate(size_t size_in_bytes)
|
||||
uintptr_t pProcess::FindSignature(std::vector<uint8_t> signature)
|
||||
{
|
||||
std::unique_ptr<uint8_t[]> data;
|
||||
data = std::make_unique<uint8_t[]>(this->base_module_.size);
|
||||
data = std::make_unique<uint8_t[]>(this->base_client_.size);
|
||||
|
||||
if (!ReadProcessMemory(this->handle_, (void*)(this->base_module_.base), data.get(), this->base_module_.size, NULL)) {
|
||||
if (!ReadProcessMemory(this->handle_, (void*)(this->base_client_.base), data.get(), this->base_client_.size, NULL)) {
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
for (uintptr_t i = 0; i < this->base_module_.size; i++)
|
||||
for (uintptr_t i = 0; i < this->base_client_.size; i++)
|
||||
{
|
||||
for (uintptr_t j = 0; j < signature.size(); j++)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ uintptr_t pProcess::FindSignature(std::vector<uint8_t> signature)
|
||||
if (*reinterpret_cast<uint8_t*>(reinterpret_cast<uintptr_t>(&data[i + j])) == signature.at(j))
|
||||
{
|
||||
if (j == signature.size() - 1)
|
||||
return this->base_module_.base + i;
|
||||
return this->base_client_.base + i;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -229,7 +229,7 @@ uintptr_t pProcess::FindSignature(ProcessModule target_module, std::vector<uint8
|
||||
if (*reinterpret_cast<uint8_t*>(reinterpret_cast<uintptr_t>(&data[i + j])) == signature.at(j))
|
||||
{
|
||||
if (j == signature.size() - 1)
|
||||
return this->base_module_.base + i;
|
||||
return this->base_client_.base + i;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
DWORD pid_; // process id
|
||||
HANDLE handle_; // handle to process
|
||||
HWND hwnd_; // window handle
|
||||
ProcessModule base_module_;
|
||||
ProcessModule base_client_;
|
||||
|
||||
public:
|
||||
bool AttachProcess(const char* process_name);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"dwEntityList": 24684552,
|
||||
"dwLocalPlayer": 25656568,
|
||||
"dwPawnHealth": 2056,
|
||||
"dwPlayerPawn": 2044,
|
||||
"dwEntityList": 24706184,
|
||||
"dwLocalPlayer": 25027848,
|
||||
"m_iPawnArmor": 808,
|
||||
"m_iHealth": 812,
|
||||
"dwPlayerPawn": 1980,
|
||||
"dwSanitizedName": 1824,
|
||||
"dwViewMatrix": 25659360,
|
||||
"dwViewMatrix": 25680560,
|
||||
"m_iTeamNum": 959,
|
||||
"m_vecOrigin": 4628
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user