Updated offsets and fixed overlay issues due to the memory class not been able to get the hwnd correctly when starting the game
This commit is contained in:
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
Simple external esp using gdi overlay to render esp boxes on top of cs2 highlighting your enemies and teammates including their health, name and health number. If you want to check out discord overlay rendering check [discord-overlay-esp](https://github.com/IMXNOOBX/cs2-external-esp/tree/discord-overlay)
|
Simple external esp using gdi overlay to render esp boxes on top of cs2 highlighting your enemies and teammates including their health, name and health number. If you want to check out discord overlay rendering check [discord-overlay-esp](https://github.com/IMXNOOBX/cs2-external-esp/tree/discord-overlay)
|
||||||
|
|
||||||
## ❗️Notice
|
|
||||||
|
|
||||||
cs2 just updated and the offsets are no longer working, you can update them manually and create a pull request or wait until its updated
|
|
||||||
|
|
||||||
## Video Showcase
|
## Video Showcase
|
||||||
|
|
||||||
[](https://youtu.be/SV_lddIxQ5w)
|
[](https://youtu.be/SV_lddIxQ5w)
|
||||||
|
|||||||
@@ -4,4 +4,6 @@
|
|||||||
namespace g {
|
namespace g {
|
||||||
inline HDC hdcBuffer = NULL;
|
inline HDC hdcBuffer = NULL;
|
||||||
inline HBITMAP hbmBuffer = NULL;
|
inline HBITMAP hbmBuffer = NULL;
|
||||||
|
|
||||||
|
RECT gameBounds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
int screen_x = GetSystemMetrics(SM_CXSCREEN);
|
#include "globals.hpp"
|
||||||
int screen_y = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
|
|
||||||
struct view_matrix_t {
|
struct view_matrix_t {
|
||||||
float* operator[ ](int index) {
|
float* operator[ ](int index) {
|
||||||
@@ -91,11 +90,11 @@ struct Vector3
|
|||||||
_x *= inv_w;
|
_x *= inv_w;
|
||||||
_y *= inv_w;
|
_y *= inv_w;
|
||||||
|
|
||||||
float x = screen_x * .5f;
|
float x = g::gameBounds.right * .5f;
|
||||||
float y = screen_y * .5f;
|
float y = g::gameBounds.bottom * .5f;
|
||||||
|
|
||||||
x += 0.5f * _x * screen_x + 0.5f;
|
x += 0.5f * _x * g::gameBounds.right + 0.5f;
|
||||||
y -= 0.5f * _y * screen_y + 0.5f;
|
y -= 0.5f * _y * g::gameBounds.bottom + 0.5f;
|
||||||
|
|
||||||
return { x, y, w };
|
return { x, y, w };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@
|
|||||||
#include "classes/globals.hpp"
|
#include "classes/globals.hpp"
|
||||||
#include "../classes/render.hpp"
|
#include "../classes/render.hpp"
|
||||||
|
|
||||||
#define dwLocalPlayer 0x1713348
|
// last offset update 9/5/2023
|
||||||
#define dwEntityList 0x1679C38
|
#define dwLocalPlayer 0x1675770
|
||||||
|
#define dwEntityList 0x167ABA8
|
||||||
|
#define dwViewMatrix 0x1714C70
|
||||||
|
|
||||||
#define dwPawnHealth 0x808
|
#define dwPawnHealth 0x808
|
||||||
#define dwPlayerPawn 0x5dc
|
#define dwPlayerPawn 0x5dc
|
||||||
#define dwViewMatrix 0x1713CF0
|
|
||||||
#define dwSanitizedName 0x720
|
#define dwSanitizedName 0x720
|
||||||
#define m_iTeamNum 0x3bf
|
#define m_iTeamNum 0x3bf
|
||||||
#define m_vecOrigin 0x12AC
|
#define m_vecOrigin 0x12AC
|
||||||
|
|
||||||
namespace hack {
|
namespace hack {
|
||||||
std::shared_ptr<pProcess> process;
|
std::shared_ptr<pProcess> process;
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
#include "classes/vector.hpp"
|
#include "classes/vector.hpp"
|
||||||
#include "hacks/hack.hpp"
|
#include "hacks/hack.hpp"
|
||||||
#include "classes/globals.hpp"
|
#include "classes/globals.hpp"
|
||||||
|
#include "classes/render.hpp"
|
||||||
// https://www.unknowncheats.me/forum/3846642-post734.html
|
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
@@ -17,7 +16,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
g::hdcBuffer = CreateCompatibleDC(NULL);
|
g::hdcBuffer = CreateCompatibleDC(NULL);
|
||||||
g::hbmBuffer = CreateCompatibleBitmap(GetDC(hWnd), screen_x, screen_y);
|
g::hbmBuffer = CreateCompatibleBitmap(GetDC(hWnd), g::gameBounds.right, g::gameBounds.bottom);
|
||||||
SelectObject(g::hdcBuffer, g::hbmBuffer);
|
SelectObject(g::hdcBuffer, g::hbmBuffer);
|
||||||
|
|
||||||
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
|
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||||
@@ -39,10 +38,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
|
|
||||||
if (GetForegroundWindow() == hack::process->hwnd_) {
|
if (GetForegroundWindow() == hack::process->hwnd_) {
|
||||||
|
//render::RenderText(g::hdcBuffer, 10, 10, "cs2 | ESP", RGB(75, 175, 175), 15);
|
||||||
hack::loop();
|
hack::loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
BitBlt(hdc, 0, 0, screen_x, screen_y, g::hdcBuffer, 0, 0, SRCCOPY);
|
BitBlt(hdc, 0, 0, g::gameBounds.right, g::gameBounds.bottom, g::hdcBuffer, 0, 0, SRCCOPY);
|
||||||
|
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
InvalidateRect(hWnd, NULL, TRUE);
|
InvalidateRect(hWnd, NULL, TRUE);
|
||||||
@@ -76,10 +76,16 @@ int main() {
|
|||||||
hack::base_module = hack::process->GetModule("client.dll");
|
hack::base_module = hack::process->GetModule("client.dll");
|
||||||
if (hack::base_module.base == 0) {
|
if (hack::base_module.base == 0) {
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
std::cout << "[cs2] Failed to find module client.dll" << std::endl;
|
std::cout << "[cs2] Failed to find module client.dll, waiting for the game to load it..." << std::endl;
|
||||||
}
|
}
|
||||||
} while (hack::base_module.base == 0);
|
} while (hack::base_module.base == 0);
|
||||||
|
|
||||||
|
std::cout << "[overlay] Waiting to focus game to create the overlay..." << std::endl;
|
||||||
|
while (GetForegroundWindow() != hack::process->hwnd_) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
hack::process->UpdateHWND();
|
||||||
|
ShowWindow(hack::process->hwnd_, TRUE);
|
||||||
|
}
|
||||||
std::cout << "[overlay] Creating window overlay..." << std::endl;
|
std::cout << "[overlay] Creating window overlay..." << std::endl;
|
||||||
|
|
||||||
WNDCLASSEXA wc = { 0 };
|
WNDCLASSEXA wc = { 0 };
|
||||||
@@ -93,20 +99,19 @@ int main() {
|
|||||||
|
|
||||||
RegisterClassExA(&wc);
|
RegisterClassExA(&wc);
|
||||||
|
|
||||||
RECT gameBounds;
|
GetClientRect(hack::process->hwnd_, &g::gameBounds);
|
||||||
GetClientRect(hack::process->hwnd_, &gameBounds);
|
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
HINSTANCE hInstance = NULL;
|
HINSTANCE hInstance = NULL;
|
||||||
HWND hWnd = CreateWindowExA(WS_EX_TRANSPARENT | WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TOOLWINDOW, " ", "cs2-external-esp", WS_POPUP,
|
HWND hWnd = CreateWindowExA(WS_EX_TRANSPARENT | WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TOOLWINDOW, " ", "cs2-external-esp", WS_POPUP,
|
||||||
gameBounds.left, gameBounds.top, gameBounds.right - gameBounds.left, gameBounds.bottom + gameBounds.left, NULL, NULL, hInstance, NULL); // NULL, NULL);
|
g::gameBounds.left, g::gameBounds.top, g::gameBounds.right - g::gameBounds.left, g::gameBounds.bottom + g::gameBounds.left, NULL, NULL, hInstance, NULL); // NULL, NULL);
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
ShowWindow(hWnd, TRUE);
|
ShowWindow(hWnd, TRUE);
|
||||||
SetActiveWindow(hack::process->hwnd_);
|
//SetActiveWindow(hack::process->hwnd_);
|
||||||
|
|
||||||
// Message loop
|
// Message loop
|
||||||
MSG msg;
|
MSG msg;
|
||||||
@@ -120,6 +125,8 @@ int main() {
|
|||||||
DeleteDC(g::hdcBuffer);
|
DeleteDC(g::hdcBuffer);
|
||||||
DeleteObject(g::hbmBuffer);
|
DeleteObject(g::hbmBuffer);
|
||||||
|
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
|
||||||
std::cout << "[cs2] Deataching from process" << std::endl;
|
std::cout << "[cs2] Deataching from process" << std::endl;
|
||||||
hack::process->Close();
|
hack::process->Close();
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,12 @@ bool pProcess::AttachWindow(const char* WindowName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pProcess::UpdateHWND()
|
||||||
|
{
|
||||||
|
hwnd_ = this->GetWindowHandleFromProcessId(pid_);
|
||||||
|
return hwnd_ == nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
ProcessModule pProcess::GetModule(const char* lModule)
|
ProcessModule pProcess::GetModule(const char* lModule)
|
||||||
{
|
{
|
||||||
std::wstring wideModule;
|
std::wstring wideModule;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
bool AttachProcess(const char* process_name);
|
bool AttachProcess(const char* process_name);
|
||||||
bool AttachWindow(const char* window_name);
|
bool AttachWindow(const char* window_name);
|
||||||
|
bool UpdateHWND();
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user