This commit is contained in:
Oscar
2025-07-25 21:45:33 +03:00
parent 1edd51c46f
commit 50f4002acc
396 changed files with 243692 additions and 86 deletions

View File

@@ -0,0 +1,17 @@
#include "ccsgoinput.h"
#include "../datatypes/usercmd.h"
#include "../../utilities/memory.h"
CSubtickMoveStep* CBaseUserCmdPB::AddSubTickMove()
{
if (m_subtickMovesField && m_subtickMovesField.size() < m_subtickMovesField.max_size())
return m_subtickMovesField[m_subtickMovesField.size()++];
static auto sub_258D30 = MEM::FindPattern(CLIENT_DLL, CS_XOR("E8 ? ? ? ? 48 8B D0 48 8D 4B ? E8 ? ? ? ? 48 8B D0") + 0x1);
CSubtickMoveStep* subtick = reinterpret_cast<CSubtickMoveStep* (__fastcall*)(uint64_t)>(sub_258D30)(m_subtickMovesField.unk_field());
m_subtickMovesField.add(subtick);
return subtick;
}

View File

@@ -0,0 +1,78 @@
#pragma once
// used: mem_pad
#include "../../utilities/memory.h"
// used: cusercmd
#include "../datatypes/usercmd.h"
#define MULTIPLAYER_BACKUP 150
class CCSGOInput
{
public:
MEM_PAD(0x250); // Offset 0x0000, Padding
CUserCmd arrCommands[MULTIPLAYER_BACKUP]; // Offset 0x0250, Array of CUserCmd
MEM_PAD(0x1); // Offset 0x0A50, Padding
bool bInThirdPerson; // Offset 0x0A51, Boolean flag
MEM_PAD(0x22); // Offset 0x0A52, Padding
std::int32_t nSequenceNumber; // Offset 0x0A74, Integer
std::int32_t nOldSequenceNumber; // Offset 0x0A78, Integer
MEM_PAD(0x4); // Offset 0x0A7C, Padding
double dbUnknown; // Offset 0x0A80, Double
std::uint64_t nButtonState1; // Offset 0x0A88, Unsigned 64-bit integer
std::uint64_t nButtonState2; // Offset 0x0A90, Unsigned 64-bit integer
std::uint64_t nButtonState3; // Offset 0x0A98, Unsigned 64-bit integer
std::uint64_t nButtonState4; // Offset 0x0AA0, Unsigned 64-bit integer
MEM_PAD(0xC); // Offset 0x0AA8, Padding
std::int32_t nMouseDeltaX; // Offset 0x0AB4, Integer
std::int32_t nMouseDeltaY; // Offset 0x0AB8, Integer
MEM_PAD(0xC); // Offset 0x0ABC, Padding
std::int64_t nOldPressedButton; // Offset 0x0AC8, Integer
bool bIsButtonPressed; // Offset 0x0AD0, Boolean flag
MEM_PAD(0x10F); // Offset 0x0AD1, Padding
QAngle_t angViewAngles; // Offset 0x0BE0, QAngle_t struct
MEM_PAD(0x8C); // Offset 0x0C6C, Padding
bool bUnknownBool; // Offset 0x0CF8, Boolean flag
void InputCamera() {
using orig = void(CS_FASTCALL*)(void*);
static auto oInputcam = reinterpret_cast<orig>(MEM::FindPattern(CLIENT_DLL, CS_XOR("85 D2 0F 85 8A")));
CS_ASSERT(oInputcam != nullptr);
auto backup = *(Vector_t*)((uintptr_t)this + 0x539);
// store old camera angles
// call original
oInputcam(this);
}
CUserCmd* GetUserCmd()
{
return &arrCommands[nSequenceNumber % MULTIPLAYER_BACKUP];
}
QAngle_t GetViewAngle() // 4C 8B C1 85 D2 74 08
{
using fnGetViewAngle = std::int64_t(CS_FASTCALL*)(void*, std::int32_t);
static auto oGetViewAngle = reinterpret_cast<fnGetViewAngle>(MEM::FindPattern(CLIENT_DLL, CS_XOR("4C 8B C1 85 D2 74 08")));
#ifdef CS_PARANOID
CS_ASSERT(oGetViewAngle != nullptr);
#endif
QAngle_t* fn = reinterpret_cast<QAngle_t*>(oGetViewAngle(this, 0));
return *fn;
}
void SetViewAngle(QAngle_t& angView)
{
// @ida: this got called before GetMatricesForView
using fnSetViewAngle = std::int64_t(CS_FASTCALL*)(void*, std::int32_t, QAngle_t&);
static auto oSetViewAngle = reinterpret_cast<fnSetViewAngle>(MEM::FindPattern(CLIENT_DLL, CS_XOR("85 D2 75 3F 48"))); // \xF2\x41\x0F\x10?\x4C\x63\xCA
#ifdef CS_PARANOID
CS_ASSERT(oSetViewAngle != nullptr);
#endif
oSetViewAngle(this, 0, std::ref(angView));
}
};

View File

@@ -0,0 +1,80 @@
#pragma once
// used: schema field
#include "../../utilities/memory.h"
#include "../entity_handle.h"
#define MAX_ENTITIES_IN_LIST 512
#define MAX_ENTITY_LISTS 64 // 0x3F
#define MAX_TOTAL_ENTITIES MAX_ENTITIES_IN_LIST* MAX_ENTITY_LISTS
class C_BaseEntity;
class CGameEntitySystem
{
public:
/// GetClientEntity
template <typename T = C_BaseEntity>
T* Get(int nIndex)
{
return reinterpret_cast<T*>(this->GetEntityByIndex(nIndex));
}
/// GetClientEntityFromHandle
template <typename T = C_BaseEntity>
T* Get(const CBaseHandle hHandle)
{
if (!hHandle.IsValid())
return nullptr;
return reinterpret_cast<T*>(this->GetEntityByIndex(hHandle.GetEntryIndex()));
}
int GetHighestEntityIndex()
{
return *reinterpret_cast<int*>(reinterpret_cast<std::uintptr_t>(this) + 0x1510);
}
private:
void* GetEntityByIndex(int nIndex)
{
//@ida: #STR: "(missing),", "(missing)", "Ent %3d: %s class %s name %s\n" | or find "cl_showents" cvar -> look for callback
// do { pEntity = GetBaseEntityByIndex(g_pGameEntitySystem, nCurrentIndex); ... }
using fnGetBaseEntity = void*(CS_THISCALL*)(void*, int);
static auto GetBaseEntity = reinterpret_cast<fnGetBaseEntity>(MEM::FindPattern(CLIENT_DLL, CS_XOR("81 FA ? ? ? ? 77 ? 8B C2 C1 F8 ? 83 F8 ? 77 ? 48 98 48 8B 4C C1 ? 48 85 C9 74 ? 8B C2 25 ? ? ? ? 48 6B C0 ? 48 03 C8 74 ? 8B 41 ? 25 ? ? ? ? 3B C2 75 ? 48 8B 01")));
return GetBaseEntity(this, nIndex);
}
};
enum CSWeaponID {
GLOCK = 1,
USP_S = 2,
P2000 = 3,
DUAL_BERETTAS = 4,
P250 = 5,
TEC9 = 6,
FIVE_SEVEN = 7,
DESERT_EAGLE = 8,
MAC10 = 17,
MP9 = 18,
MP7 = 19,
UMP45 = 24,
P90 = 26,
GALIL_AR = 13,
FAMAS = 14,
AK47 = 10,
M4A4 = 16,
M4A1_S = 20,
AUG = 23,
SG553 = 27,
AWP = 9,
G3SG1 = 11,
SCAR20 = 38,
M249 = 28,
NEGEV = 35
};

View File

@@ -0,0 +1,40 @@
#include "events.h"
std::int64_t IGameEvent::get_int(const std::string_view event_name) noexcept {
// client.dll; 48 89 5C 24 08 48 89 74 24 10 48 89 7C 24 18 41 56 48 83 EC 30 48 8B 01 41 8B F0 4C 8B F1 41 B0 01 48 8D 4C 24 20 48 8B DA 48 8B 78
using function_t = std::int64_t(__fastcall*)(void*, const char*);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 08 48 89 74 24 10 48 89 7C 24 18 41 56 48 83 EC 30 48 8B 01 41 8B F0 4C 8B F1 41 B0 01 48 8D 4C 24 20 48 8B DA 48 8B 78"));
CS_ASSERT(fn != nullptr);
return fn(this, event_name.data());
}
void* IGameEvent::get_player_pawn_from_id(const std::string_view event_name) noexcept {
// client.dll; 48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 30 48 8B 01 48 8B F1 41 B0 01 48 8D 4C 24 20 48 8B FA 48 8B 98
using function_t = void*(__fastcall*)(void*, const char*, std::int64_t);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 30 48 8B 01 48 8B F1 41 B0 01 48 8D 4C 24 20 48 8B FA 48 8B 98"));
CS_ASSERT(fn != nullptr);
return fn(this, event_name.data(), 0);
}
void* IGameEvent::get_pointer_from_id(const std::string_view event_name) noexcept {
// used: "userid", "attackerid"
std::int64_t id{ };
{
// client.dll; 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 30 48 8B 01 49
using function_t = std::int64_t(__fastcall*)(void*, std::int64_t*, const char*);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 30 48 8B 01 48 8B F1 41 B0 01 48 8D 4C 24 20 48 8B FA 48 8B 98"));
CS_ASSERT(fn != nullptr);
fn(this, &id, event_name.data());
}
if (id == -1)
return { };
// xref: "player_disconnect"
// client.dll; E8 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 48 8B D8 48 85 C9
using function_t2 = void*(__fastcall*)(std::int64_t);
static function_t2 fn = reinterpret_cast<function_t2>(MEM::FindPattern(CLIENT_DLL, "E8 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 48 8B D8 48 85 C9"));
CS_ASSERT(fn != nullptr);
return fn(id);
}

View File

@@ -0,0 +1,216 @@
#pragma once
// used: cutllinkedlist
#include "../datatypes/utllinkedlist.h"
// used: fnv1a hashing
#include "../../utilities/fnv1a.h"
// used: sdk datatypes
#include "../datatypes/color.h"
#include "../datatypes/vector.h"
#include "../datatypes/qangle.h"
// used: call virtual function
#include "../../utilities/memory.h"
// used: color_t
#include "../datatypes/color.h"
// used: cbasehandle
#include "../entity.h"
#include "../datatypes/utlstringtoken.h"
using namespace MEM;
class IGameEvent
{
public:
virtual ~IGameEvent() { }
[[nodiscard]] const char* GetName() const
{
// @ida: client.dll -> U8["48 8B CE FF 50 ? 48 8D 0D" + 0x5] @XREF: "show_freeze_panel"
return CallVFunc<const char*, 1U>(this);
}
[[nodiscard]] bool GetBool(const CUtlStringToken& keyToken, bool bDefault = false) const
{
return CallVFunc<bool, 6U>(this, &keyToken, bDefault);
}
[[nodiscard]] int GetInt(const CUtlStringToken& keyToken, int iDefault = 0) const
{
// @ida CGameEvent::GetInt(const char*, int): client.dll -> ABS["E8 ? ? ? ? 0F B6 4D 77" + 0x1]
// @ida: client.dll -> U8["E8 ? ? ? ? 45 33 C0 48 89 74 24 ? 48 8D 54 24 ? 49 8B CF FF D3 85 C0 8B 44 24 48" - 0x1] / sizeof(std::uintptr_t) @XREF: "headshot"
return CallVFunc<int, 7U>(this, &keyToken, iDefault);
}
[[nodiscard]] std::uint64_t GetUint64(const CUtlStringToken& keyToken, std::uint64_t ullDefault = 0ULL) const
{
return CallVFunc<std::uint64_t, 8U>(this, &keyToken, ullDefault);
}
[[nodiscard]] float GetFloat(const CUtlStringToken& keyToken, const float flDefault = 0.0f) const
{
// @ida CGameEvent::GetFloat(const char*, float): client.dll -> ABS["E8 ? ? ? ? 0F 28 D8 89 5C 24 20" + 0x1]
// @ida: client.dll -> U8["4C 8B 60 ? 4D 8B C6" + 0x3] / sizeof(std::uintptr_t) @XREF: "theta"
return CallVFunc<float, 9U>(this, &keyToken, flDefault);
}
[[nodiscard]] const char* GetString(const CUtlStringToken& keyToken, const char* szDefault = "") const
{
// @ida: client.dll -> U8["48 8B 78 ? 48 8D 4D 80" + 0x3] / sizeof(std::uintptr_t) @XREF: "weapon"
return CallVFunc<const char*, 10U>(this, &keyToken, szDefault);
}
[[nodiscard]] const wchar_t* GetWString(const CUtlStringToken& keyToken, const wchar_t* wszDefault = L"") const
{
return CallVFunc<const wchar_t*, 11U>(this, &keyToken, wszDefault);
}
[[nodiscard]] const void* GetPtr(const CUtlStringToken& keyToken) const
{
return CallVFunc<const void*, 12U>(this, &keyToken);
}
int GetPlayerIndex(const CUtlStringToken& keyToken)
{
// @ida: client.dll -> U8["4C 8B 70 ? 4C 89 7C 24" + 0x3] / sizeof(std::uintptr_t) @XREF: "attacker", "assister", "userid"
int nOutIndex;
CallVFunc<void, 15U>(this, &nOutIndex, &keyToken);
return nOutIndex;
}
// xref: client.dll & 4C 8B A8 80 00 00 00 ("killer")
inline CBasePlayerController* get_player_controller(const std::string_view token_name) noexcept {
CUtlStringToken token(token_name.data());
return CallVFunc<CBasePlayerController*, 16U>(this, &token);
}
C_CSPlayerPawn* GetPlayerPawn(const CUtlStringToken& keyToken)
{
// @XREF: "_pawn"
// @ida CGameEvent::GetPlayerPawn(const char*): server.dll -> ABS["E8 ? ? ? ? 48 85 C0 74 0B 48 8B C8 E8 ? ? ? ? 4C 8B F0 41 8B 46 08" + 0x1] @XREF: "userid"
return CallVFunc<C_CSPlayerPawn*, 17U>(this, &keyToken);
}
void SetBool(const CUtlStringToken& keyToken, const bool bValue)
{
// @ida CGameEvent::SetBool(const char*, bool): server.dll -> ABS["E8 ? ? ? ? 48 8B 0D ? ? ? ? 45 33 C0 48 8B D3 48 8B 01 FF 50 38 48 8B 46 10" + 0x1] @XREF: "canbuy"
CallVFunc<void, 20U>(this, &keyToken, bValue);
}
void SetInt(const CUtlStringToken& keyToken, const int nValue)
{
// @ida: server.dll -> ["48 8D 4D A7 4C 8B B0 ? ? ? ? FF" + 0x7] / sizeof(std::uintptr_t)
CallVFunc<void, 21U>(this, &keyToken, nValue);
}
void SetUint64(const CUtlStringToken& keyToken, const std::uint64_t ullValue)
{
CallVFunc<void, 22U>(this, &keyToken, ullValue);
}
void SetFloat(const CUtlStringToken& keyToken, const float flValue)
{
// @ida: server.dll -> ["48 8B B0 ? ? ? ? 33 D2 44 89 6C 24" + 0x3] / sizeof(std::uintptr_t) @XREF: "inferno_expire"
CallVFunc<void, 23U>(this, &keyToken, flValue);
}
void SetString(const CUtlStringToken& keyToken, const char* szValue)
{
// @ida: server.dll -> ["48 8D 4D A7 48 8B B8 ? ? ? ? 33" + 0x7] / sizeof(std::uintptr_t) @XREF: "weapon"
CallVFunc<void, 24U>(this, &keyToken, szValue);
}
void SetWString(const CUtlStringToken& keyToken, const wchar_t* wszValue)
{
CallVFunc<void, 25U>(this, &keyToken, wszValue);
}
void SetPtr(const CUtlStringToken& keyToken, const void* pValue)
{
CallVFunc<void, 26U>(this, &keyToken, pValue);
}
void SetPlayerIndex(const CUtlStringToken& keyToken, const int nIndex)
{
// @ida: server.dll -> ["48 8B B8 ? ? ? ? E8 ? ? ? ? 48 8D 05 ? ? ? ? 44 8B C3 48 8D 55 97 48 89 45 9F 48 8B CE FF D7 48 8D 15" + 0x3] / sizeof(std::uintptr_t) @XREF: "attacker_pawn"
CallVFunc<void, 27U>(this, &keyToken, nIndex);
}
void SetPlayerController(const CUtlStringToken& keyToken, CBasePlayerController* pPlayerController)
{
CallVFunc<void, 28U>(this, &keyToken, pPlayerController);
}
void SetPlayerPawn(const CUtlStringToken& keyToken, C_CSPlayerPawn* pPlayerPawn)
{
// @XREF: "_pawn"
CallVFunc<void, 29U>(this, &keyToken, pPlayerPawn);
}
public:
std::byte pad0[0x60]; // 0x08
void FireEvent(IGameEvent* event);
bool initialize();
bool release();
void* get_player_pawn_from_id(std::string_view event_name) noexcept;
/* output (name | int):
team: 2
dmg_health: 21
entityid: 316
defindex: 49
radius: 1100
*/
std::int64_t get_int(std::string_view event_name) noexcept;
void* get_pointer_from_id(const std::string_view event_name) noexcept;
};
static_assert(sizeof(IGameEvent) == 0x68);
// todo: you can use this instead of hooking like you did it in csgo (input ur listeners), but that's a task for the reader.
// client.dll; 48 89 05 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8D 8B E0 00 00 00
struct event_manager_t {
void init_event( /*C_CSPlayerPawnBase*/ void* player_pawn_base,
const std::string_view event_name, void* unk = nullptr) noexcept {
// (*(*g_pGameEventManager + 24i64))(g_pGameEventManager, a1 + 4680, "round_end", 0i64);
return MEM::CallVFunc< void, 6U>(this, player_pawn_base, event_name.data(), unk);
}
};
class IGameEventManager2
{
public:
enum
{
SERVERSIDE = 0, // this is a server side listener, event logger etc
CLIENTSIDE, // this is a client side listenet, HUD element etc
CLIENTSTUB, // this is a serverside stub for a remote client listener (used by engine only)
SERVERSIDE_OLD, // legacy support for old server event listeners
CLIENTSIDE_OLD // legacy support for old client event listeners
};
virtual ~IGameEventManager2() { }
/// load game event descriptions from a file e.g. "resource\gameevents.res"
/// @Returns: count of loaded game events
int LoadEventsFromFile(const char* szFileName)
{
return CallVFunc<int, 1U>(this, szFileName);
}
// remove all and anything
void Reset()
{
CallVFunc<void, 2U>(this);
}
};

View File

@@ -0,0 +1,15 @@
#pragma once
// used: find pattern, call virtual function
#include "../../utilities/memory.h"
// used: vertor_t
#include "../datatypes/vector.h"
// used: color_t
#include "../datatypes/color.h"
class IDebugOverlayGameSystem
{
public:
// @todo: reverse this
};

View File

@@ -0,0 +1,165 @@
#pragma once
// used: callvfunc
#include "../../utilities/memory.h"
class CEconItemDefinition;
inline constexpr uint64_t Helper_GetAlternateIconKeyForWeaponPaintWearItem(
uint16_t nDefIdx, uint32_t nPaintId, uint32_t nWear) {
return (nDefIdx << 16) + (nPaintId << 2) + nWear;
}
struct AlternateIconData_t {
const char* sSimpleName;
const char* sLargeSimpleName;
private:
char pad0[0x8]; // no idea
char pad1[0x8]; // no idea
};
class CPaintKit {
public:
char pad_0x0000[0xE0]; //0x0000
int64_t PaintKitId() {
return *reinterpret_cast<int64_t*>((uintptr_t)(this));
}
const char* PaintKitName() {
return *reinterpret_cast<const char**>((uintptr_t)(this) + 0x8);
}
const char* PaintKitDescriptionString() {
return *reinterpret_cast<const char**>((uintptr_t)(this) + 0x10);
}
const char* PaintKitDescriptionTag() {
return *reinterpret_cast<const char**>((uintptr_t)(this) + 0x18);
}
int32_t PaintKitRarity() {
return *reinterpret_cast<int32_t*>((uintptr_t)(this) + 0x44);
}
bool UsesOldModel() {
return *reinterpret_cast<bool*>((uintptr_t)(this) + 0xB2);
}
};
#include "../cstrike/sdk/datatypes/utlmap.h"
class CEconItemSchema {
public:
auto GetAttributeDefinitionInterface(int iAttribIndex) {
return MEM::CallVFunc<void*, 27U> (this, iAttribIndex);
}
auto& GetSortedItemDefinitionMap() {
return *reinterpret_cast<CUtlMap<int, CEconItemDefinition*>*>(
(uintptr_t)(this) + 0x128);
}
auto& GetAlternateIconsMap() {
return *reinterpret_cast<CUtlMap<uint64_t, AlternateIconData_t>*>(
(uintptr_t)(this) + 0x278);
}
auto& GetPaintKits() {
return *reinterpret_cast<CUtlMap<int, CPaintKit*>*>((uintptr_t)(this) +
0x2F0);
}
};
class CEconItemSystem {
public:
auto GetEconItemSchema() {
return *reinterpret_cast<CEconItemSchema**>((uintptr_t)(this) + 0x8);
}
};
enum EClientFrameStage : int
{
FRAME_UNDEFINED = -1,
FRAME_START,
// a network packet is being received
FRAME_NET_UPDATE_START,
// data has been received and we are going to start calling postdataupdate
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
// data has been received and called postdataupdate on all data recipients
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
// received all packets, we can now do interpolation, prediction, etc
FRAME_NET_UPDATE_END,
// start rendering the scene
FRAME_RENDER_START = 9,
// finished rendering the scene
FRAME_RENDER_END,
FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE
};
enum flow : int {
FLOW_OUTGOING = 0,
FLOW_INCOMING = 1,
};
class INetChannelInfo {
public:
float get_latency(flow flow)
{
return MEM::CallVFunc<int, 10U>(this, flow);
}
};
class ISource2Client {
public:
auto GetEconItemSystem() {
return MEM::CallVFunc<CEconItemSystem*, 114U>(this);
}
};
class IEngineClient
{
public:
int GetMaxClients()
{
return MEM::CallVFunc<int, 31U>(this);
}
bool IsInGame()
{
return MEM::CallVFunc<bool, 32U>(this);
}
bool IsConnected()
{
return MEM::CallVFunc<bool, 33U>(this);
}
//gusta
INetChannelInfo* GetNetChannelInfo(int split_screen_slot) {
return MEM::CallVFunc<INetChannelInfo*, 34U>(this, split_screen_slot);
}
// return CBaseHandle index
int GetLocalPlayer()
{
int nIndex = -1;
MEM::CallVFunc<void, 44U>(this, std::ref(nIndex), 0);
return nIndex + 1;
}
[[nodiscard]] const char* GetLevelName()
{
return MEM::CallVFunc<const char*, 53U>(this);
}
[[nodiscard]] const char* GetLevelNameShort()
{
return MEM::CallVFunc<const char*, 54U>(this);
}
[[nodiscard]] const char* GetProductVersionString()
{
return MEM::CallVFunc<const char*, 77U>(this);
}
};

View File

@@ -0,0 +1,150 @@
#pragma once
// used: cutllinkedlist
#include "../datatypes/utllinkedlist.h"
// used: fnv1a hashing
#include "../../utilities/fnv1a.h"
// used: sdk datatypes
#include "../datatypes/color.h"
#include "../datatypes/vector.h"
#include "../datatypes/qangle.h"
#pragma region convar_enumerations
// command to convars and concommands
enum EConVarFlag : int
{
// convar systems
FCVAR_NONE = 0,
FCVAR_UNREGISTERED = (1 << 0), // if this is set, don't add to linked list, etc
FCVAR_DEVELOPMENTONLY = (1 << 1), // hidden in released products. flag is removed automatically if allow_development_cvars is defined
FCVAR_GAMEDLL = (1 << 2), // defined by the game dll
FCVAR_CLIENTDLL = (1 << 3), // defined by the client dll
FCVAR_HIDDEN = (1 << 4), // hidden. doesn't appear in find or autocomplete. like developmentonly, but can't be compiled out
// convar only
FCVAR_PROTECTED = (1 << 5), // it's a server cvar, but we don't send the data since it's a password, etc. sends 1 if it's not bland/zero, 0 otherwise as value
FCVAR_SPONLY = (1 << 6), // this cvar cannot be changed by clients connected to a multiplayer server
FCVAR_ARCHIVE = (1 << 7), // set to cause it to be saved to vars.rc
FCVAR_NOTIFY = (1 << 8), // notifies players when changed
FCVAR_USERINFO = (1 << 9), // changes the client's info string
FCVAR_CHEAT = (1 << 14), // only useable in singleplayer/debug/multiplayer & sv_cheats
FCVAR_PRINTABLEONLY = (1 << 10), // this cvar's string cannot contain unprintable characters (e.g., used for player name etc)
FCVAR_UNLOGGED = (1 << 11), // if this is a fcvar_server, don't log changes to the log file / console if we are creating a log
FCVAR_NEVER_AS_STRING = (1 << 12), // never try to print that cvar
// it's a convar that's shared between the client and the server.
// at signon, the values of all such convars are sent from the server to the client (skipped for local client, ofc)
// if a change is requested it must come from the console (i.e., no remote client changes)
// if a value is changed while a server is active, it's replicated to all connected clients
FCVAR_REPLICATED = (1 << 13), // server setting enforced on clients, replicated
// @todo: (1 << 14) used by the game, probably used as modification detection
FCVAR_DEMO = (1 << 16), // record this cvar when starting a demo file
FCVAR_DONTRECORD = (1 << 17), // don't record these command in demofiles
FCVAR_RELOAD_MATERIALS = (1 << 20), // if this cvar changes, it forces a material reload
FCVAR_RELOAD_TEXTURES = (1 << 21), // if this cvar changes, if forces a texture reload
FCVAR_NOT_CONNECTED = (1 << 22), // cvar cannot be changed by a client that is connected to a server
FCVAR_MATERIAL_SYSTEM_THREAD = (1 << 23), // indicates this cvar is read from the material system thread
FCVAR_ARCHIVE_XBOX = (1 << 24), // cvar written to config.cfg on the xbox
FCVAR_ACCESSIBLE_FROM_THREADS = (1 << 25), // used as a debugging tool necessary to check material system thread convars
FCVAR_SERVER_CAN_EXECUTE = (1 << 28), // the server is allowed to execute this command on clients via clientcommand/net_stringcmd/cbaseclientstate::processstringcmd
FCVAR_SERVER_CANNOT_QUERY = (1 << 29), // if this is set, then the server is not allowed to query this cvar's value (via iserverpluginhelpers::startquerycvarvalue)
FCVAR_CLIENTCMD_CAN_EXECUTE = (1 << 30), // ivengineclient::clientcmd is allowed to execute this command
FCVAR_MATERIAL_THREAD_MASK = (FCVAR_RELOAD_MATERIALS | FCVAR_RELOAD_TEXTURES | FCVAR_MATERIAL_SYSTEM_THREAD)
};
enum EConVarType : short
{
EConVarType_Invalid = -1,
EConVarType_Bool,
EConVarType_Int16,
EConVarType_UInt16,
EConVarType_Int32,
EConVarType_UInt32,
EConVarType_Int64,
EConVarType_UInt64,
EConVarType_Float32,
EConVarType_Float64,
EConVarType_String,
EConVarType_Color,
EConVarType_Vector2,
EConVarType_Vector3,
EConVarType_Vector4,
EConVarType_Qangle,
EConVarType_MAX
};
#pragma endregion
union CVValue_t
{
bool i1;
short i16;
uint16_t u16;
int i32;
uint32_t u32;
int64_t i64;
uint64_t u64;
float fl;
double db;
const char* sz;
Color_t clr;
Vector2D_t vec2;
Vector_t vec3;
Vector4D_t vec4;
QAngle_t ang;
};
class CConVar
{
public:
const char* szName; // 0x0000
CConVar* m_pNext; // 0x0008
MEM_PAD(0x10); // 0x0010
const char* szDescription; // 0x0020
uint32_t nType; // 0x28
uint32_t nRegistered; // 0x2C
uint32_t nFlags; // 0x30
MEM_PAD(0x8); // 0x34
// @note: read-only, mofify with caution
CVValue_t value; // 0x40
};
class IEngineCVar
{
public:
MEM_PAD(0x40);
CUtlLinkedList<CConVar*> listConvars;
CConVar* Find(FNV1A_t uHashedName)
{
for (int i = I::Cvar->listConvars.Head(); i != I::Cvar->listConvars.InvalidIndex(); i = I::Cvar->listConvars.Next(i))
{
CConVar* pConVar = I::Cvar->listConvars.Element(i);
if (pConVar == nullptr)
continue;
if (FNV1A::Hash(pConVar->szName) == uHashedName)
return pConVar;
}
CS_ASSERT(false); // invalid convar name
return nullptr;
}
void UnlockHiddenCVars()
{
for (int i = I::Cvar->listConvars.Head(); i != I::Cvar->listConvars.InvalidIndex(); i = I::Cvar->listConvars.Next(i))
{
CConVar* pConVar = I::Cvar->listConvars.Element(i);
if (pConVar == nullptr)
continue;
if (pConVar->nFlags & FCVAR_HIDDEN)
pConVar->nFlags &= ~FCVAR_HIDDEN;
if (pConVar->nFlags & FCVAR_DEVELOPMENTONLY)
pConVar->nFlags &= ~FCVAR_DEVELOPMENTONLY;
}
}
};

View File

@@ -0,0 +1,13 @@
#pragma once
// used: mem_pad
#include "../../utilities/memory.h"
class CGameEntitySystem;
class IGameResourceService
{
public:
MEM_PAD(0x58);
CGameEntitySystem* pGameEntitySystem;
};

View File

@@ -0,0 +1,31 @@
#pragma once
// used: mem_pad
#include "../../utilities/memory.h"
class IGlobalVars
{
public:
float flRealTime; //0x0000
__int32 nFrameCount; //0x0004
float flFrameTime; //0x0008
float flFrameTime2; //0x000C
__int32 mMaxclients; //0x0010
float flIntervalPerTick; //0x0014
__int32 N0000007F; //0x0018
__int32 N0000008B; //0x001C
void* unkfunc; //0x0020
float N00000081; //0x0028
float flCurtime; //0x002C
float flCurtime2; //0x0030
MEM_PAD(0xC); //0x0034
__int32 nTickCount; //0x0040
float flIntervalPerTick2; //0x0044
void* pCurrentNetChannel; //0x0048
MEM_PAD(0x130); //0x0050
char* szCurrentMap; //0x0180
char* szCurrentMapName; //0x0188
}; //Size=0x0190
static_assert(sizeof(IGlobalVars) == 0x190);

View File

@@ -0,0 +1,20 @@
#pragma once
// used: getexportaddress
#include "../../utilities/memory.h"
class IInputSystem
{
public:
bool IsRelativeMouseMode()
{
// @ida: 'IInputSystem::SetRelativeMouseMode'.
return *reinterpret_cast<bool*>(reinterpret_cast<std::uintptr_t>(this) + 0x4F);
}
void* GetSDLWindow()
{
// @ida: IInputSystem::DebugSpew -> #STR: "Current coordinate bias %s: %g,%g scale %g,%g\n"
return *reinterpret_cast<void**>(reinterpret_cast<std::uintptr_t>(this) + 0x2678);
}
};

View File

@@ -0,0 +1,118 @@
#pragma once
// used: call virtual function
#include "../../utilities/memory.h"
// used: color_t
#include "../datatypes/color.h"
// used: cbasehandle
#include "../entity_handle.h"
// material2
class material2_t {
public:
virtual const char* get_name() = 0;
virtual const char* get_shader_name() = 0;
};
// material key var
struct material_key_var_t {
std::uint64_t m_key;
const char* m_name;
material_key_var_t(std::uint64_t m_key, const char* m_name) :
m_key(m_key), m_name(m_name) { }
material_key_var_t(const char* m_name, bool m_should_find_key = false) :
m_name(m_name) {
m_key = m_should_find_key ? find_key(m_name) : 0x0;
}
// find key
std::uint64_t find_key(const char* m_name) {
// helper ida: CBodyGameSystem::NotifyResourcePreReload
using function_find_key = std::uint64_t(__fastcall*)
(const char*, unsigned int, int);
static auto find_key_var = reinterpret_cast<function_find_key>(
MEM::FindPattern(L"particles.dll", CS_XOR("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 33 C0 8B DA")));
#ifdef CS_PARANOID
CS_ASSERT(find_key_var != nullptr);
#endif
return find_key_var(m_name, 0x12, 0x31415926);
}
};
// object info.
class object_info_t {
MEM_PAD(0xB0);
int m_id;
};
class scene_animable_object_t {
MEM_PAD(0xB0);
CBaseHandle m_owner;
};
class material_data_t {
public:
void set_shader_type(const char* m_shader_name) {
// E8 ? ? ? ? 48 8D B7 ? ? ? ?
// spritecard.vfx
using function_set_material_shader_type = void(__fastcall*)(void*, material_key_var_t, const char*, int);
static auto set_material_shader = reinterpret_cast<function_set_material_shader_type>(MEM::FindPattern(L"particles.dll",
CS_XOR("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC ? 0F B6 01 45 0F B6 F9 8B 2A 4D 8B E0 4C 8B 72 ? 48 8B F9 C0 E8 ? 24 ? 3C ? 74 ? 41 B0 ? B2 ? E8 ? ? ? ? 0F B6 07 33 DB C0 E8 ? 24 ? 3C ? 75 ? 48 8B 77 ? EB ? 48 8B F3 4C 8D 44 24 ? C7 44 24 ? ? ? ? ? 48 8D 54 24 ? 89 6C 24 ? 48 8B CE 4C 89 74 24 ? E8 ? ? ? ? 8B D0 83 F8 ? 75 ? 45 33 C9 89 6C 24 ? 4C 8D 44 24 ? 4C 89 74 24 ? 48 8B D7 48 8B CE E8 ? ? ? ? 8B D0 0F B6 0F C0 E9 ? 80 E1 ? 80 F9 ? 75 ? 48 8B 4F ? EB ? 48 8B CB 8B 41 ? 85 C0 74 ? 48 8D 59 ? 83 F8 ? 76 ? 48 8B 1B 48 63 C2 4D 85 E4")));
#ifdef CS_PARANOID
CS_ASSERT(set_material_shader != nullptr);
#endif
material_key_var_t shader_vcar(0x162C1777, CS_XOR("shader"));
set_material_shader(this, shader_vcar, m_shader_name, 0x18); // ida: 0x19
}
void set_material_function(const char* function_name, int m_value) {
using function_set_material = void(__fastcall*)(void*, material_key_var_t, int, int);
static auto set_material = reinterpret_cast<function_set_material>(MEM::FindPattern(L"particles.dll",
CS_XOR("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC ? 0F B6 01 45 0F B6 F9 8B 2A 48 8B F9")));
#ifdef CS_PARANOID
CS_ASSERT(set_material != nullptr);
#endif
material_key_var_t func_var(function_name, true);
set_material(this, func_var, m_value, 0x18);
}
MEM_PAD(0x18);
scene_animable_object_t* m_scene_animable;
material2_t* m_material;
MEM_PAD(0x20);
Color_t m_color;
MEM_PAD(0x4);
object_info_t* m_object_info;
};
class material_system_t {
public:
material2_t*** find_or_create_from_resource(material2_t*** m_out_material, const char* m_material_name) {
return MEM::CallVFunc<material2_t***, 14>(this, m_out_material, m_material_name);
}
material2_t*** create_material(material2_t*** m_out_material, const char* m_material_name, material_data_t* m_data) {
return MEM::CallVFunc<material2_t***, 29>(this, m_out_material, m_material_name, m_data, 0, 0, 0, 0, 0, 1);
}
void set_create_data_by_material(const void* m_data, material2_t*** const m_in_material) {
return MEM::CallVFunc< void, 37 >(this, m_in_material, m_data);
}
static void set_color(void* m_data, Color_t m_color) {
*(byte*)((uintptr_t)m_data + 0x40) = m_color.r;
*(byte*)((uintptr_t)m_data + 0x41) = m_color.g;
*(byte*)((uintptr_t)m_data + 0x42) = m_color.b;
*(byte*)((uintptr_t)m_data + 0x43) = m_color.a;
}
};

View File

@@ -0,0 +1,31 @@
#pragma once
// used: mem::CallVFunc
#include "../../utilities/memory.h"
#pragma warning(push)
#pragma warning(disable : 4191)
class IMemAlloc
{
public:
void* Alloc(std::size_t nSize)
{
return MEM::CallVFunc<void*, 1>(this, nSize);
}
void* ReAlloc(const void* pMemory, std::size_t nSize)
{
return MEM::CallVFunc<void*, 2>(this, pMemory, nSize);
}
void Free(const void* pMemory)
{
return MEM::CallVFunc<void, 3>(this, pMemory);
}
std::size_t GetSize(const void* pMemory)
{
return MEM::CallVFunc<std::size_t, 21>(this, pMemory);
}
};
#pragma warning(pop)

View File

@@ -0,0 +1,41 @@
#pragma once
#include "../../utilities/memory.h"
class CNetworkGameClient
{
public:
bool IsConnected()
{
return MEM::CallVFunc<bool, 13U>(this);
}
// force game to clear cache and reset delta tick
void FullUpdate()
{
// @ida: #STR: "Requesting full game update (%s)...\n"
MEM::CallVFunc<void, 31U>(this, CS_XOR("initial update"));
}
void Update()
{
int* deltaTickPtr = reinterpret_cast<int*>(reinterpret_cast<std::uintptr_t>(this) + 0x258);
*deltaTickPtr = -1;
}
int GetDeltaTick()
{
// @ida: offset in FullUpdate();
// (nDeltaTick = -1) == FullUpdate() called
return *reinterpret_cast<int*>(reinterpret_cast<std::uintptr_t>(this) + 0x258);
}
};
class INetworkClientService
{
public:
int deltatick() {
return *reinterpret_cast<int*>(reinterpret_cast<std::uintptr_t>(this) + 0x258);
}
CNetworkGameClient* GetNetworkClient() {
return MEM::CallVFunc<CNetworkGameClient*, 23>(this);
}
};

View File

@@ -0,0 +1,208 @@
#pragma once
// used: utlthash
#include "../datatypes/utlthash.h"
// used: utlvector
#include "../datatypes/utlvector.h"
// used: callvfunc
#include "../../utilities/memory.h"
#define SCHEMASYSTEM_TYPE_SCOPES_OFFSET 0x190
#define SCHEMASYSTEMTYPESCOPE_OFF1 0x4B0
#define SCHEMASYSTEMTYPESCOPE_OFF2 0x2808
using SchemaString_t = const char*;
struct SchemaMetadataEntryData_t;
class CSchemaSystemTypeScope;
class CSchemaType;
struct CSchemaClassBinding
{
CSchemaClassBinding* pParent;
const char* szBinaryName; // ex: C_World
const char* szModuleName; // ex: libclient.so
const char* szClassName; // ex: client
void* pClassInfoOldSynthesized;
void* pClassInfo;
void* pThisModuleBindingPointer;
CSchemaType* pSchemaType;
};
class CSchemaType
{
public:
bool GetSizes(int* pOutSize, uint8_t* unkPtr)
{
return MEM::CallVFunc<bool, 3U>(this, pOutSize, unkPtr);
}
public:
bool GetSize(int* out_size)
{
uint8_t smh = 0;
return GetSizes(out_size, &smh);
}
public:
void* pVtable; // 0x0000
const char* szName; // 0x0008
CSchemaSystemTypeScope* pSystemTypeScope; // 0x0010
uint8_t nTypeCategory; // ETypeCategory 0x0018
uint8_t nAatomicCategory; // EAtomicCategory 0x0019
};
struct SchemaClassFieldData_t
{
SchemaString_t szName; // 0x0000
CSchemaType* pSchemaType; // 0x0008
std::uint32_t nSingleInheritanceOffset; // 0x0010
std::int32_t nMetadataSize; // 0x0014
SchemaMetadataEntryData_t* pMetaData; // 0x0018
};
struct SchemaClassInfoData_t;
struct SchemaBaseClassInfoData_t
{
int32_t nOffset;
SchemaClassInfoData_t* pClass;
};
struct SchemaClassInfoData_t
{
private:
void* pVtable; // 0x0000
public:
const char* szName; // 0x0008
char* szDescription; // 0x0010
int m_nSize; // 0x0018
std::int16_t nFieldSize; // 0x001C
std::int16_t nStaticSize; // 0x001E
std::int16_t nMetadataSize; // 0x0020
std::uint8_t nAlignOf; // 0x0022
std::uint8_t nBaseClassesCount; // 0x0023
char pad2[0x4]; // 0x0024
SchemaClassFieldData_t* pFields; // 0x0028
char pad3[0x8]; // 0x0030
SchemaBaseClassInfoData_t* pBaseClasses; // 0x0038
char pad4[0x28]; // 0x0040
//public:
//SchemaClassFieldData_t* pFields; // 0x0028
bool InheritsFrom(SchemaClassInfoData_t* pClassInfo)
{
if (pClassInfo == this && pClassInfo != nullptr)
return true;
else if (pBaseClasses == nullptr || pClassInfo == nullptr)
return false;
for (int i = 0; i < nBaseClassesCount; i++)
{
auto& baseClass = pBaseClasses[i];
if (baseClass.pClass->InheritsFrom(pClassInfo))
return true;
}
return false;
}
};
struct SchemaEnumeratorInfoData_t
{
SchemaString_t szName;
union
{
unsigned char value_char;
unsigned short value_short;
unsigned int value_int;
unsigned long long value;
};
MEM_PAD(0x10); // 0x0010
};
class CSchemaEnumInfo
{
public:
SchemaEnumeratorInfoData_t enumInfoData;
};
class CSchemaEnumBinding
{
public:
virtual const char* GetBindingName() = 0;
virtual CSchemaClassBinding* AsClassBinding() = 0;
virtual CSchemaEnumBinding* AsEnumBinding() = 0;
virtual const char* GetBinaryName() = 0;
virtual const char* GetProjectName() = 0;
public:
char* szBindingName_; // 0x0008
char* szDllName_; // 0x0010
std::int8_t nAlign_; // 0x0018
MEM_PAD(0x3); // 0x0019
std::int16_t nSize_; // 0x001C
std::int16_t nFlags_; // 0x001E
SchemaEnumeratorInfoData_t* pEnumInfo_;
MEM_PAD(0x8); // 0x0028
CSchemaSystemTypeScope* pTypeScope_; // 0x0030
MEM_PAD(0x8); // 0x0038
std::int32_t unk1_; // 0x0040
};
class CSchemaSystemTypeScope
{
public:
void FindDeclaredClass(SchemaClassInfoData_t** pReturnClass, const char* szClassName)
{
return MEM::CallVFunc<void, 2U>(this, pReturnClass, szClassName);
}
CSchemaType* FindSchemaTypeByName(const char* szName, std::uintptr_t* pSchema)
{
return MEM::CallVFunc<CSchemaType*, 4U>(this, szName, pSchema);
}
CSchemaType* FindTypeDeclaredClass(const char* szName)
{
return MEM::CallVFunc<CSchemaType*, 5U>(this, szName);
}
CSchemaType* FindTypeDeclaredEnum(const char* szName)
{
return MEM::CallVFunc<CSchemaType*, 6U>(this, szName);
}
CSchemaClassBinding* FindRawClassBinding(const char* szName)
{
return MEM::CallVFunc<CSchemaClassBinding*, 7U>(this, szName);
}
void* pVtable; // 0x0000
char szName[256U]; // 0x0008
MEM_PAD(SCHEMASYSTEMTYPESCOPE_OFF1); // 0x0108
CUtlTSHash<CSchemaClassBinding*, 256, unsigned int> hashClasses; // 0x0588
MEM_PAD(SCHEMASYSTEMTYPESCOPE_OFF2); // 0x05C8
CUtlTSHash<CSchemaEnumBinding*, 256, unsigned int> hashEnumes; // 0x2DD0
};
class ISchemaSystem
{
public:
CSchemaSystemTypeScope* FindTypeScopeForModule(const char* m_module_name)
{
return MEM::CallVFunc<CSchemaSystemTypeScope*, 13U>(this, m_module_name, nullptr);
}
private:
MEM_PAD(SCHEMASYSTEM_TYPE_SCOPES_OFFSET); // 0x0000
public:
// table of type scopes
CUtlVector<CSchemaSystemTypeScope*> vecTypeScopes; // SCHEMASYSTEM_TYPE_SCOPES_OFFSET
};

View File

@@ -0,0 +1,13 @@
#pragma once
// used: call virtual function
#include "../../utilities/memory.h"
// forward declarations
struct IDXGISwapChain;
class ISwapChainDx11
{
MEM_PAD(0x170);
IDXGISwapChain* pDXGISwapChain;
};

View File

@@ -0,0 +1,4 @@
#include "itrace.h"
#include "../cstrike/sdk/interfaces/iengineclient.h"
#include "../cstrike/sdk/interfaces/cgameentitysystem.h"
#include "../cstrike/sdk/interfaces/igameresourceservice.h"

View File

@@ -0,0 +1,294 @@
#pragma once
// used: call virtual function
#include "../../utilities/memory.h"
// used: color_t
#include "../datatypes/color.h"
// used: cbasehandle
#include "../entity_handle.h"
#include "..\cstrike\core\sdk.h"
#include "..\cstrike\sdk\entity.h"
#define CLIP_TRACE_TO_PLAYERS "48 8B C4 55 56 48 8D A8 58 FF FF FF 48 81 EC 98 01 00 00 48"
#define TRACE_SHAPE "48 89 54 24 ? 48 89 4C 24 ? 55 53 56 57 41 55 41 56 48 8D AC 24"
#define COMBINE(x, y) x##y
#define COMBINE2(x, y) COMBINE(x, y)
#include <array>
#include <cstddef>
#define PAD_CLASS_DEBUG(sz) int COMBINE2(pad_, __COUNTER__)[sz];
#define CS2_PAD( number, size ) \
private: \
[[maybe_unused]] std::array< std::byte, size > m_unknown_##number{ }; \
public:
enum Contents_t {
CONTENTS_EMPTY = 0,
CONTENTS_SOLID = 0x1,
CONTENTS_WINDOW = 0x2,
CONTENTS_AUX = 0x4,
CONTENTS_GRATE = 0x8,
CONTENTS_SLIME = 0x10,
CONTENTS_WATER = 0x20,
CONTENTS_BLOCKLOS = 0x40,
CONTENTS_OPAQUE = 0x80,
CONTENTS_TESTFOGVOLUME = 0x100,
CONTENTS_UNUSED = 0x200,
CONTENTS_BLOCKLIGHT = 0x400,
CONTENTS_TEAM1 = 0x800,
CONTENTS_TEAM2 = 0x1000,
CONTENTS_IGNORE_NODRAW_OPAQUE = 0x2000,
CONTENTS_MOVEABLE = 0x4000,
CONTENTS_AREAPORTAL = 0x8000,
CONTENTS_PLAYERCLIP = 0x10000,
CONTENTS_MONSTERCLIP = 0x20000,
CONTENTS_CURRENT_0 = 0x40000,
CONTENTS_CURRENT_90 = 0x80000,
CONTENTS_CURRENT_180 = 0x100000,
CONTENTS_CURRENT_270 = 0x200000,
CONTENTS_CURRENT_UP = 0x400000,
CONTENTS_CURRENT_DOWN = 0x800000,
CONTENTS_ORIGIN = 0x1000000,
CONTENTS_MONSTER = 0x2000000,
CONTENTS_DEBRIS = 0x4000000,
CONTENTS_DETAIL = 0x8000000,
CONTENTS_TRANSLUCENT = 0x10000000,
CONTENTS_LADDER = 0x20000000,
CONTENTS_HITBOX = 0x40000000,
};
enum Masks_t {
MASK_ALL = 0xFFFFFFFF,
MASK_SOLID = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE,
MASK_PLAYERSOLID = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE,
MASK_NPCSOLID = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE,
MASK_NPCFLUID = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER | CONTENTS_GRATE,
MASK_WATER = CONTENTS_WATER | CONTENTS_MOVEABLE | CONTENTS_SLIME,
MASK_OPAQUE = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_OPAQUE,
MASK_OPAQUE_AND_NPCS = MASK_OPAQUE | CONTENTS_MONSTER,
MASK_BLOCKLOS = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_BLOCKLOS,
MASK_BLOCKLOS_AND_NPCS = MASK_BLOCKLOS | CONTENTS_MONSTER,
MASK_VISIBLE = MASK_OPAQUE | CONTENTS_IGNORE_NODRAW_OPAQUE,
MASK_VISIBLE_AND_NPCS = MASK_OPAQUE_AND_NPCS | CONTENTS_IGNORE_NODRAW_OPAQUE,
MASK_SHOT = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_WINDOW | CONTENTS_DEBRIS | CONTENTS_GRATE | CONTENTS_HITBOX,
MASK_SHOT_BRUSHONLY = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_DEBRIS,
MASK_SHOT_HULL = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_WINDOW | CONTENTS_DEBRIS | CONTENTS_GRATE,
MASK_SHOT_PORTAL = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTER,
MASK_SOLID_BRUSHONLY = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_GRATE,
MASK_PLAYERSOLID_BRUSHONLY = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_PLAYERCLIP | CONTENTS_GRATE,
MASK_NPCSOLID_BRUSHONLY = CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP | CONTENTS_GRATE,
MASK_NPCWORLDSTATIC = CONTENTS_SOLID | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP | CONTENTS_GRATE,
MASK_NPCWORLDSTATIC_FLUID = CONTENTS_SOLID | CONTENTS_WINDOW | CONTENTS_MONSTERCLIP,
MASK_SPLITAREPORTAL = CONTENTS_WATER | CONTENTS_SLIME,
MASK_CURRENT = CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | CONTENTS_CURRENT_UP | CONTENTS_CURRENT_DOWN,
MASK_DEADSOLID = CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW | CONTENTS_GRATE,
};
enum {
SURF_LIGHT = 0x0001,
SURF_SKY2D = 0x0002,
SURF_SKY = 0x0004,
SURF_WARP = 0x0008,
SURF_TRANS = 0x0010,
SURF_NOPORTAL = 0x0020,
SURF_TRIGGER = 0x0040,
SURF_NODRAW = 0x0080,
SURF_HINT = 0x0100,
SURF_SKIP = 0x0200,
SURF_NOLIGHT = 0x0400,
SURF_BUMPLIGHT = 0x0800,
SURF_NOSHADOWS = 0x1000,
SURF_NODECALS = 0x2000,
SURF_NOPAINT = SURF_NODECALS,
SURF_NOCHOP = 0x4000,
SURF_HITBOX = 0x8000
};
struct ray_t
{
Vector_t Start = Vector_t(0, 0, 0);
Vector_t End = Vector_t(0, 0, 0);
Vector_t Mins = Vector_t(0, 0, 0);
Vector_t Maxs = Vector_t(0, 0, 0);
char __pad0000[0x4];
std::uint8_t UnkownType = 0x0;
};
static_assert(sizeof(ray_t) == 0x38);
class trace_filter_t
{
public:
char __pad0000[0x8];
std::uint64_t trace_mask ;
std::uint64_t null_it[2] ;
std::uint32_t SkipHandles[4];
std::uint16_t Collisions[2] ;
std::uint16_t N0000011C;
std::uint8_t layer;
std::uint8_t N00000104 ;
std::uint8_t null_it3 ;
// manua initialization
/*virtual ~trace_filter_t() {}
virtual bool function() { return true; }
trace_filter_t(C_CSPlayerPawn* skip, uint64_t mask, uint8_t layer, uint16_t idk)
{
//initfilter_19A770((__int64)filter, a2, 536577i64, 4, 7);
using function_t = trace_filter_t * (__fastcall*)(trace_filter_t&, void*, uint64_t, uint8_t, uint16_t);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 0F B6 41 37 33")));
// way better sig
if (fn == nullptr) {
L_PRINT(LOG_WARNING) << CS_XOR("trace_filter_t Invalid signature!");
}
CS_ASSERT(fn != nullptr);
fn(*this, skip, mask, layer, idk);
}*/
};
struct C_TraceHitboxData {
CS2_PAD(0, 0x38)
int m_hitgroup{ };
};
class game_trace_t {
public:
void* Surface;
C_BaseEntity* HitEntity;
C_TraceHitboxData* HitboxData;
CS2_PAD(0, 0x38)
std::uint32_t Contents;
CS2_PAD(1, 0x24)
Vector_t m_start_pos, m_end_pos, m_normal, m_pos;
MEM_PAD(0x4);
float Fraction;
MEM_PAD(0x6);
bool m_all_solid;
CS2_PAD(4, 0x4D)
};
struct UpdateValueT {
float previousLenght{ };
float currentLenght{ };
CS2_PAD(0, 0x8)
std::int16_t handleIdx{ };
CS2_PAD(1, 0x6)
};
struct trace_arr_element_t {
CS2_PAD(0, 0x30)
};
struct trace_data_t {
std::int32_t m_uk1{ };
float m_uk2{ 52.0f };
void* m_arr_pointer{ };
std::int32_t m_uk3{ 128 };
std::int32_t m_uk4{ static_cast<std::int32_t>(0x80000000) };
std::array< trace_arr_element_t, 0x80 > m_arr = { };
CS2_PAD(0, 0x8)
std::int64_t m_num_update{ };
void* m_pointer_update_value{ };
CS2_PAD(1, 0xC8)
Vector_t m_start{ }, m_end{ };
CS2_PAD(2, 0x50)
};
class i_trace
{
public: // cHoca
void InitializeTraceInfo(game_trace_t* const hit )
{
using function_t = void(__fastcall*)(game_trace_t*);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 08 57 48 83 EC 20 48 8B D9 33 FF 48 8B 0D"));
CS_ASSERT(fn != nullptr);
fn(hit);
}
void InitializeTrace(game_trace_t& trace)
{
using function_t = void(__fastcall*)(game_trace_t&);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 08 57 48 83 EC 20 48 8B D9 33 FF 48 8B 0D"));
CS_ASSERT(fn != nullptr);
fn(trace);
}
// cHoca
void Init(trace_filter_t& filter, C_CSPlayerPawn* skip, uint64_t mask, uint8_t layer, uint16_t idk)
{
//initfilter_19A770((__int64)filter, a2, 536577i64, 4, 7);
using function_t = trace_filter_t*(__fastcall*)(trace_filter_t&, void*, uint64_t, uint8_t, uint16_t);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 0F B6 41 37 33")));
// way better sig
if (fn == nullptr) {
L_PRINT(LOG_WARNING) << CS_XOR("trace_filter_t Invalid signature!");
}
CS_ASSERT(fn != nullptr);
fn(filter, skip, mask, layer, idk);
}
// __int64 __fastcall sub_695330(__int64 a1, __int64 a2, __int64 a3, __int64 a4, float a5, int a6, float a7)
// #STR: "particles/impact_fx/impact_wallbang_heavy.vpcf", "particles/impact_fx/impact_wallbang_light.vpcf", "particles/impact_fx/impact_wallbang_light_silent.vpcf", "gunshotsplash"
// local variable allocation has failed, the output may be wrong!
//abaixo da funcao
void ClipTraceToPlayers(Vector_t& start, Vector_t& end, trace_filter_t* filter, game_trace_t* trace, float min, int length, float max)
{ // cHoca
using function_t = void(__fastcall*)(Vector_t&, Vector_t&, trace_filter_t*, game_trace_t*, float, int, float);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CLIP_TRACE_TO_PLAYERS));
// way better sig
if (fn == nullptr) {
L_PRINT(LOG_WARNING) << CS_XOR("ClipTraceToPlayers creating new signature!");
fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 8B C4 55 56 48 8D A8 58"));
}
CS_ASSERT(fn != nullptr);
fn(start, end, filter, trace, min, max, length);
}
// cHoca
// client.dll; 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 56 48 83 EC 40 F2
// client.dll; 48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 60 48 8B E9 0F
static void get_trace_info(trace_data_t* trace, game_trace_t* hit,
const float unknown_float, void* unknown) {
using function_t = void(__fastcall*)(trace_data_t*, game_trace_t*, float, void*);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 60 48 8B E9 0F")));
return fn(trace, hit, unknown_float, unknown);
}
// william: there is no need to rebuild this function.
// client.dll; 48 8B C4 44 89 48 20 55 57 41 55
static bool handle_bullet_penetration(trace_data_t* const trace, void* stats,
UpdateValueT* const mod_value,
const bool draw_showimpacts = false) {
using function_t = bool(__fastcall*)(trace_data_t*, void*, UpdateValueT*, void*, void*, void*, void*, void*, bool);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 8B C4 44 89 48 20 55 57 41 55")));
return fn(trace, stats, mod_value, nullptr, nullptr, nullptr, nullptr, nullptr, draw_showimpacts);
}
static void CreateTrace(trace_data_t* const trace, const Vector_t start,
const Vector_t end, const trace_filter_t& filler,
const int penetration_count) {
using function_t = void(__fastcall*)(trace_data_t*, Vector_t, Vector_t,
trace_filter_t, int);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 83 EC 40 F2")));
CS_ASSERT(fn != nullptr);
return fn(trace, start, end, filler, penetration_count);
}
// #STR: "Physics/TraceShape (Client)" then xref
void TraceShape(ray_t& ray, Vector_t* start, Vector_t* end, trace_filter_t filter, game_trace_t& trace)
{
using function_t = bool(__fastcall*)(void*, ray_t&, Vector_t*, Vector_t*, trace_filter_t, game_trace_t&);
static function_t fn = reinterpret_cast<function_t>(MEM::FindPattern(CLIENT_DLL, "48 89 5C 24 10 48 89 74 24 18 48 89 7C 24 20 48 89 4C 24 08 55 41 54 41 55 41 56 41 57 48 8D"));
CS_ASSERT(fn != nullptr);
fn(this, ray, start, end, filter, trace);
}
};

View File

@@ -0,0 +1,26 @@
#pragma once
#include "../datatypes/qangle.h"
#include "../datatypes/matrix.h"
#include "../../core/memaddon.hpp"
class IViewRender
{
public:
Vector_t vecOrigin; // 0x0000
QAngle_t vecAngles; // 0x000C
float flFov; // 0x0018
char pad_0x001C[0x14]; // 0x001C
ViewMatrix_t matUNK1; // 0x0030
char pad_0x0070[0x30]; // 0x0070
ViewMatrix_t matUNK2; // 0x00A0
char pad_0x00E0[0xC8]; // 0x00E0
ViewMatrix_t matUNK3; // 0x01A8
char pad_0x01E8[0x28]; // 0x01E8
};
#ifndef CS2_CHEAT_CRENDERGAMESYSTEM_HPP
#define CS2_CHEAT_CRENDERGAMESYSTEM_HPP
#endif // CS2_CHEAT_CRENDERGAMESYSTEM_HPP