Skip to content

Commit

Permalink
updated offsets and visible check
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr0go1 committed Oct 19, 2023
1 parent 984ff34 commit 6e66afc
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 47 deletions.
8 changes: 6 additions & 2 deletions CS2_External/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ void Cheats::Run()
for (int i = 0; i < 64; i++)
{
CEntity Entity;
static int LocalPlayerControllerIndex = 1;
DWORD64 EntityAddress = 0;
if (!ProcessMgr.ReadMemory<DWORD64>(gGame.GetEntityListEntry() + (i + 1) * 0x78, EntityAddress))
continue;
Expand Down Expand Up @@ -397,7 +398,10 @@ void Cheats::Run()
if (DistanceToSight < MaxAimDistance)
{
MaxAimDistance = DistanceToSight;
if (MenuConfig::VisibleCheck && Entity.Pawn.bSpottedByMask > 0 || !MenuConfig::VisibleCheck)
// From: https://github.com/redbg/CS2-Internal/blob/fc8e64430176a62f8800b7467884806708a865bb/src/include/Cheats.hpp#L129
if (!MenuConfig::VisibleCheck ||
Entity.Pawn.bSpottedByMask & (DWORD64(1) << (LocalPlayerControllerIndex)) ||
LocalEntity.Pawn.bSpottedByMask & (DWORD64(1) << (i)))
{
AimPos = Entity.GetBone().BonePosList[MenuConfig::AimPositionIndex].Pos;
if (MenuConfig::AimPositionIndex == BONEINDEX::head)
Expand Down Expand Up @@ -477,7 +481,7 @@ void Cheats::Run()

//visible esp
if (MenuConfig::VisibleEsp) {
if (abs(Entity.Pawn.bSpottedByMask) > 0) {
if ((Entity.Pawn.bSpottedByMask) > 0) {
MenuConfig::BoneColorESP = MenuConfig::BoneVisColor;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion CS2_External/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool PlayerPawn::GetCameraPos()

bool PlayerPawn::GetSpotted()
{
return GetDataAddressWithOffset<int>(Address, Offset::Pawn.bSpottedByMask, this->bSpottedByMask);
return GetDataAddressWithOffset<DWORD64>(Address, Offset::Pawn.bSpottedByMask, this->bSpottedByMask);
}

bool PlayerPawn::GetWeaponName()
Expand Down
2 changes: 1 addition & 1 deletion CS2_External/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PlayerPawn
int Health;
int TeamID;
int Fov;
int bSpottedByMask;
DWORD64 bSpottedByMask;
int fFlags;
public:
bool GetPos();
Expand Down
1 change: 0 additions & 1 deletion CS2_External/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ bool CGame::InitAddress()
this->Address.LocalPawn = GetClientDLLAddress() + Offset::LocalPlayerPawn;
this->Address.ForceJump = GetClientDLLAddress() + Offset::ForceJump;
this->Address.GlobalVars = GetClientDLLAddress() + Offset::GlobalVars;
this->Address.PlantedC4 = GetClientDLLAddress() + Offset::PlantedC4;

return this->Address.ClientDLL != 0;
}
Expand Down
6 changes: 0 additions & 6 deletions CS2_External/Offsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ bool Offset::UpdateOffsets()

Offset::GlobalVars = TempAddress - ClientDLL;

TempAddress = SearchOffsets(Offset::Signatures::PlantedC4, ClientDLL);
if (TempAddress == 0)
return false;

Offset::PlantedC4 = TempAddress - ClientDLL;


TempAddress = SearchOffsets(Offset::Signatures::ViewAngles, ClientDLL);
if (TempAddress == 0)
Expand Down
61 changes: 25 additions & 36 deletions CS2_External/Offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <Windows.h>
#include "Utils/ProcessManager.hpp"

// https://www.unknowncheats.me/forum/counter-strike-2-a/576077-counter-strike-2-reversal-structs-offsets-89.html
namespace Offset
{
inline DWORD EntityList;
Expand All @@ -11,7 +12,6 @@ namespace Offset
inline DWORD LocalPlayerPawn;
inline DWORD ForceJump;
inline DWORD GlobalVars;
inline DWORD PlantedC4;

struct
{
Expand All @@ -29,57 +29,46 @@ namespace Offset
DWORD CurrentHealth = 0x32C;
DWORD GameSceneNode = 0x310;
DWORD BoneArray = 0x1E0;
DWORD angEyeAngles = 0x1500;
DWORD angEyeAngles = 0x14F8;
DWORD vecLastClipCameraPos = 0x1274;
DWORD pClippingWeapon = 0x1290;
DWORD iShotsFired = 0x1404;
DWORD aimPunchAngle = 0x1704;
DWORD aimPunchCache = 0x1728;
DWORD iIDEntIndex = 0x152C;
DWORD iShotsFired = 0x1400;
DWORD flFlashDuration = 0x1450;
DWORD aimPunchAngle = 0x16FC;
DWORD aimPunchCache = 0x1720;
DWORD iIDEntIndex = 0x1524;
DWORD iTeamNum = 0x3BF;
DWORD CameraServices = 0x10E0;
DWORD iFovStart = 0x214;
DWORD fFlags = 0x3C8;
DWORD bSpottedByMask = 0x1620 + 0xC; // entitySpottedState + bSpottedByMask
DWORD bSpottedByMask = 0x1618 + 0xC; // entitySpottedState + bSpottedByMask
}Pawn;

struct
{
DWORD real_time = 0x00;
DWORD frame_count = 0x04;
DWORD max_clients = 0x10;
DWORD interval_per_tick = 0x14;
DWORD current_time = 0x2C;
DWORD current_time2 = 0x30;
DWORD tick_count = 0x40;
DWORD interval_per_tick2 = 0x44;
DWORD current_netchan = 0x0048;
DWORD current_map = 0x0180;
DWORD current_map_name = 0x0188;
}GlobalVar;

struct {
DWORD m_nBombSite = 0xE84;
DWORD m_bBombTicking = 0xE80;
DWORD m_hBombDefuser = 0xEDC;
DWORD m_flC4Blow = 0xEB0;
DWORD m_flDefuseCountDown = 0xED4;
} CPlantedC4;

// https://github.com/a2x/cs2-dumper/blob/main/config.json

DWORD RealTime = 0x00;
DWORD FrameCount = 0x04;
DWORD MaxClients = 0x10;
DWORD IntervalPerTick = 0x14;
DWORD CurrentTime = 0x2C;
DWORD CurrentTime2 = 0x30;
DWORD TickCount = 0x40;
DWORD IntervalPerTick2 = 0x44;
DWORD CurrentNetchan = 0x0048;
DWORD CurrentMap = 0x0180;
DWORD CurrentMapName = 0x0188;
} GlobalVar;

namespace Signatures
{
const std::string GlobalVars = "48 89 0D ?? ?? ?? ?? 48 89 41";
const std::string ViewMatrix = "48 8D 0D ?? ?? ?? ?? 48 C1 E0 06";
const std::string ViewAngles = "48 8B 0D ?? ?? ?? ?? 48 8B 01 48 FF 60 30";
const std::string EntityList = "48 8B 0D ?? ?? ?? ?? 48 89 7C 24 ?? 8B FA C1";
const std::string LocalPlayerController = "48 8B 05 ?? ?? ?? ?? 48 85 C0 74 4F";
const std::string ViewAngles = "48 8B 0D ?? ?? ?? ?? 48 8B 01 48 FF 60 30";
const std::string ViewMatrix = "48 8D 0D ?? ?? ?? ?? 48 C1 E0 06";
const std::string LocalPlayerPawn = "48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 83 EC ?? 8B 0D";
const std::string ForceJump = "48 8B 05 ?? ?? ?? ?? 48 8D 1D ?? ?? ?? ?? 48 89 45";
const std::string GlobalVars = "48 89 0D ?? ?? ?? ?? 48 89 41";
const std::string PlantedC4 = "48 89 05 ?? ?? ?? ?? 8B 05 ?? ?? ?? ?? A9 ?? ?? ?? ?? 74 ?? 25 ?? ?? ?? ?? 89 05 ?? ?? ?? ?? 8B 0D";
const std::string LocalPlayerPawn = "48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 83 EC ?? 8B 0D";
}

bool UpdateOffsets();
}
}

0 comments on commit 6e66afc

Please sign in to comment.