This commit is contained in:
Oscar
2025-07-17 13:52:06 +03:00
commit 2f50c8a911
206 changed files with 246874 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
#include "CCSPlayerController.h"
CCSPlayerController::CCSPlayerController(uintptr_t address) : address(address) {}
uintptr_t CCSPlayerController::getAddress() const {
return address;
}
const char* CCSPlayerController::getName() const {
if (!address) return nullptr;
return reinterpret_cast<const char*>(address + 0x660);
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include <cstdint>
#pragma once
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "../../../templeware/utils/schema/schema.h"
#include "../C_CSWeaponBase/C_CSWeaponBase.h"
#include <cstdint>
class CCSPlayerController {
public:
CCSPlayerController(uintptr_t address);
const char* getName() const;
uintptr_t getAddress() const;
SCHEMA_ADD_OFFSET(bool, IsLocalPlayer, 0x6F0);
SCHEMA_ADD_OFFSET(CBaseHandle, m_hPawn, 0x62C);
SCHEMA_ADD_OFFSET(const char*, m_sSanitizedPlayerName, 0x778);
private:
uintptr_t address;
};

View File

@@ -0,0 +1,32 @@
#pragma once
#include <cstdint>
#include "..\C_EntityInstance\C_EntityInstance.h"
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "..\..\..\..\source\templeware\utils\schema\schema.h"
#include "..\..\..\..\source\templeware\utils\memory\vfunc\vfunc.h"
#include "..\handle.h"
class C_AggregateSceneObjectData
{
private:
char pad_0000[0x38];
public:
std::uint8_t r;
std::uint8_t g;
std::uint8_t b;
private:
char pad_0038[0x9];
};
class C_AggregateSceneObject
{
private:
char pad_0000[0x120];
public:
int m_nCount;
private:
char pad_0120[0x4];
public:
C_AggregateSceneObjectData* m_pData;
};

View File

@@ -0,0 +1,58 @@
#pragma once
#include <cstdint>
#include "../C_EntityInstance/C_EntityInstance.h"
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "../../../../source/templeware/utils/schema/schema.h"
#include "../../../../source/templeware/utils/memory/vfunc/vfunc.h"
#include "../handle.h"
class C_BaseEntity : public CEntityInstance
{
public:
schema(int, m_iMaxHealth, "C_BaseEntity->m_iMaxHealth");
SCHEMA_ADD_OFFSET(int, m_iHealth, 0x344);
SCHEMA_ADD_OFFSET(int, m_iTeamNum, 0x3E3);
bool IsBasePlayer()
{
SchemaClassInfoData_t* pClassInfo;
dump_class_info(&pClassInfo);
if (pClassInfo == nullptr)
return false;
return hash_32_fnv1a_const(pClassInfo->szName) == hash_32_fnv1a_const("C_CSPlayerPawn");
}
bool IsViewmodelAttachment()
{
SchemaClassInfoData_t* pClassInfo;
dump_class_info(&pClassInfo);
if (pClassInfo == nullptr)
return false;
return hash_32_fnv1a_const(pClassInfo->szName) == hash_32_fnv1a_const("C_ViewmodelAttachmentModel");
}
bool IsViewmodel()
{
SchemaClassInfoData_t* pClassInfo;
dump_class_info(&pClassInfo);
if (pClassInfo == nullptr)
return false;
return hash_32_fnv1a_const(pClassInfo->szName) == hash_32_fnv1a_const("C_CSGOViewModel");
}
bool IsPlayerController()
{
SchemaClassInfoData_t* _class = nullptr;
dump_class_info(&_class);
if (!_class)
return false;
const uint32_t hash = hash_32_fnv1a_const(_class->szName);
return (hash == hash_32_fnv1a_const("CCSPlayerController"));
}
};

View File

@@ -0,0 +1,50 @@
#include "C_CSPlayerPawn.h"
#include "../../../templeware/offsets/offsets.h"
#include "../../../templeware/interfaces/interfaces.h"
C_CSPlayerPawn::C_CSPlayerPawn(uintptr_t address) : address(address) {}
Vector_t C_CSPlayerPawn::getPosition() const {
return *(Vector_t*)(address + SchemaFinder::Get(hash_32_fnv1a_const("C_BasePlayerPawn->m_vOldOrigin")));
}
Vector_t C_CSPlayerPawn::getEyePosition() const {
return Vector_t();
}
C_CSWeaponBase* C_CSPlayerPawn::GetActiveWeapon() const {
if (!this)
return nullptr;
CCSPlayer_WeaponServices* weapon_services = this->GetWeaponServices();
if (weapon_services == nullptr)
return nullptr;
C_CSWeaponBase* active_weapon = I::GameEntity->Instance->Get<C_CSWeaponBase>(weapon_services->m_hActiveWeapon());
if (!active_weapon)
return nullptr;
return active_weapon;
}
CCSPlayer_WeaponServices* C_CSPlayerPawn::GetWeaponServices() const {
if (!address) return nullptr;
return reinterpret_cast<CCSPlayer_WeaponServices*>((uintptr_t)this + SchemaFinder::Get(hash_32_fnv1a_const("C_CSPlayerPawn->m_pWeaponServices")));
}
uintptr_t C_CSPlayerPawn::getAddress() const {
return address;
}
int C_CSPlayerPawn::getHealth() const {
return *reinterpret_cast<int*>((uintptr_t)this + SchemaFinder::Get(hash_32_fnv1a_const("C_BaseEntity->m_iHealth")));
}
uint8_t C_CSPlayerPawn::getTeam() const {
return *reinterpret_cast<uint8_t*>((uintptr_t)this + SchemaFinder::Get(hash_32_fnv1a_const("C_BaseEntity->m_iTeamNum")));
}
Vector_t C_CSPlayerPawn::getViewOffset() const {
return *reinterpret_cast<Vector_t*>((uintptr_t)this + SchemaFinder::Get(hash_32_fnv1a_const("C_BaseModelEntity->m_vecViewOffset")));
}

View File

@@ -0,0 +1,28 @@
#pragma once
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "../../../templeware/utils/schema/schema.h"
#include "../C_CSWeaponBase/C_CSWeaponBase.h"
#include "../C_BaseEntity/C_BaseEntity.h"
#include <cstdint>
class C_CSPlayerPawn : public C_BaseEntity {
public:
SCHEMA_ADD_OFFSET(Vector_t, m_vOldOrigin, 0x1324);
SCHEMA_ADD_OFFSET(Vector_t, m_vecViewOffset, 0xCB0);
SCHEMA_ADD_OFFSET(CCSPlayer_WeaponServices*, m_pWeaponServices, 0x11A8);
C_CSPlayerPawn(uintptr_t address);
C_CSWeaponBase* GetActiveWeapon()const;
CCSPlayer_WeaponServices* GetWeaponServices()const;
Vector_t getPosition() const;
Vector_t getEyePosition() const;
uintptr_t getAddress() const;
int getHealth() const;
uint8_t getTeam() const;
Vector_t getViewOffset() const;
private:
uintptr_t address;
};

View File

@@ -0,0 +1,7 @@
#include "C_CSWeaponBase.h"
#include "..\..\..\templeware\hooks\hooks.h"
CCSWeaponBaseVData* C_CSWeaponBase::Data()
{
// return pointer to weapon data
return *reinterpret_cast<CCSWeaponBaseVData**>((uintptr_t)this + H::oGetWeaponData);
}

View File

@@ -0,0 +1,34 @@
#pragma once
#include <cstdint>
#include "..\C_EntityInstance\C_EntityInstance.h"
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "..\..\..\..\source\templeware\utils\schema\schema.h"
#include "..\..\..\..\source\templeware\utils\memory\vfunc\vfunc.h"
#include "..\handle.h"
class CCSPlayer_WeaponServices
{
public:
schema(bool, m_bAllowSwitchToNoWeapon, "CPlayer_WeaponServices->m_bAllowSwitchToNoWeapon");
schema(CBaseHandle, m_hMyWeapons, "CPlayer_WeaponServices->m_hMyWeapons");
schema(CBaseHandle, m_hActiveWeapon, "CPlayer_WeaponServices->m_hActiveWeapon");
schema(CBaseHandle, m_hLastWeapon, "CPlayer_WeaponServices->m_hLastWeapon");
schema(int, m_iAmmo, "CPlayer_WeaponServices->m_iAmmo");
schema(float, m_flNextAttack, "CCSPlayer_WeaponServices->m_flNextAttack");
schema(bool, m_bIsLookingAtWeapon, "CCSPlayer_WeaponServices->m_bIsLookingAtWeapon");
schema(bool, m_bIsHoldingLookAtWeapon, "CCSPlayer_WeaponServices->m_bIsHoldingLookAtWeapon");
};
class CCSWeaponBaseVData
{
public:
SCHEMA_ADD_OFFSET(const char*, m_szName, 0xD20);
};
class C_CSWeaponBase
{
public:
// @todo: add few schemas here
CCSWeaponBaseVData* Data();
};

View File

@@ -0,0 +1,73 @@
#pragma once
#include "..\..\..\..\source\templeware\utils\schema\schema.h"
#include "..\..\..\..\source\templeware\utils\memory\vfunc\vfunc.h"
#include "..\handle.h"
class CEntityInstance;
class CEntityIdentity
{
public:
SCHEMA_ADD_OFFSET(std::uint32_t, index, 0x10);
schema(const char*, m_designerName, "CEntityIdentity->m_designerName");
schema( std::uint32_t, flags, "CEntityIdentity->m_flags");
std::string GetSchemaName() {
auto class_info = *(uintptr_t*)(std::uintptr_t(this) + 0x10);
auto name = *(const char*)(std::uintptr_t(this) + 0x20);
return std::to_string(name); // Return the string constructed from the char pointer
}
[[nodiscard]] bool valid()
{
return index() != INVALID_EHANDLE_INDEX;
}
[[nodiscard]] int get_index()
{
if (!valid())
return ENT_ENTRY_MASK;
return index() & ENT_ENTRY_MASK;
}
[[nodiscard]] int get_serial_number()
{
return index() >> NUM_SERIAL_NUM_SHIFT_BITS;
}
CEntityInstance* pInstance;
};
class CEntityInstance
{
public:
void dump_class_info(SchemaClassInfoData_t** pReturn)
{
return M::vfunc<void, 38U>(this, pReturn);
}
[[nodiscard]] std::uint32_t get_entity_by_handle()
{
CEntityIdentity* identity = m_pEntityIdentity();
if (identity == nullptr)
return 0;
return identity->get_index();
}
[[nodiscard]] CBaseHandle handle()
{
CEntityIdentity* identity = m_pEntityIdentity();
if (identity == nullptr)
return CBaseHandle();
return CBaseHandle(identity->get_index(), identity->get_serial_number() - (identity->flags() & 1));
}
schema(CEntityIdentity*, m_pEntityIdentity, "CEntityInstance->m_pEntity");
};

View File

@@ -0,0 +1,77 @@
#pragma once
#include <cstdint>
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../../../templeware/utils/math/vector/vector.h"
#include "../../../templeware/utils/schema/schema.h"
#include "../C_CSWeaponBase/C_CSWeaponBase.h"
#include <cstdint>
class CMaterial2
{
public:
virtual const char* GetName() = 0;
virtual const char* GetShareName() = 0;
};
struct MaterialKeyVar_t
{
std::uint64_t uKey;
const char* szName;
MaterialKeyVar_t(std::uint64_t uKey, const char* szName) :
uKey(uKey), szName(szName) { }
MaterialKeyVar_t(const char* szName, bool bShouldFindKey = false) :
szName(szName)
{
uKey = bShouldFindKey ? FindKey(szName) : 0x0;
}
std::uint64_t FindKey(const char* szName)
{
using fn = std::uint64_t(__fastcall*)(const char*, unsigned int, int);
static auto find = reinterpret_cast<fn>(M::patternScan("particles", ("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 33 C0 8B DA")));
return find(szName, 0x12, 0x31415926);
}
};
class CObjectInfo
{
MEM_PAD(0xB0);
int nId;
};
class CSceneAnimatableObject {
public:
CBaseHandle Owner() const {
if (!this)
return CBaseHandle();
return *(CBaseHandle*)((std::uintptr_t)this + 0xB8);
}
};
struct Color {
std::uint8_t r = 0U, g = 0U, b = 0U, a = 0U;
};
class CMeshData
{
public:
private:
MEM_PAD(0x18); // 0x0
public:
CSceneAnimatableObject* pSceneAnimatableObject; // 0x18
CMaterial2* pMaterial; // 0x20
CMaterial2* pMaterialCopy; // 0x20
private:
MEM_PAD(0x10); // 0x28
public:
CObjectInfo* pObjectInfo;
private:
MEM_PAD(0x8);
public:
Color color;
};

View File

@@ -0,0 +1,100 @@
#pragma once
#include <cstdint>
// @source: https://developer.valvesoftware.com/wiki/Entity_limit#Source_2_limits
#define INVALID_EHANDLE_INDEX 0xFFFFFFFF
#define ENT_ENTRY_MASK 0x7FFF
#define NUM_SERIAL_NUM_SHIFT_BITS 15
#define ENT_MAX_NETWORKED_ENTRY 16384
class CBaseEntity;
class CBaseHandle
{
public:
CBaseHandle() noexcept :
nIndex(INVALID_EHANDLE_INDEX) { }
CBaseHandle(const int nEntry, const int nSerial) noexcept
{
nIndex = nEntry | (nSerial << NUM_SERIAL_NUM_SHIFT_BITS);
}
bool operator!=(const CBaseHandle& other) const noexcept
{
return nIndex != other.nIndex;
}
bool operator==(const CBaseHandle& other) const noexcept
{
return nIndex == other.nIndex;
}
bool operator<(const CBaseHandle& other) const noexcept
{
return nIndex < other.nIndex;
}
[[nodiscard]] bool valid() const noexcept
{
return nIndex != INVALID_EHANDLE_INDEX;
}
[[nodiscard]] int index() const noexcept
{
return static_cast<int>(nIndex & ENT_ENTRY_MASK);
}
[[nodiscard]] int serial_number() const noexcept
{
return static_cast<int>(nIndex >> NUM_SERIAL_NUM_SHIFT_BITS);
}
private:
std::uint32_t nIndex;
};
class c_handle
{
public:
c_handle();
c_handle(const c_handle& other);
c_handle(unsigned long value);
c_handle(int iEntry, int iSerialNumber);
inline int get_index()
{
return handler & 0x7FFF;
}
inline unsigned long get_handle()
{
return handler;
}
inline bool is_valid()
{
if (handler <= 0 || handler == 0xffffffff)
return false;
return true;
}
protected:
std::uint32_t handler;
};
inline c_handle::c_handle()
{
handler = -1;
}
inline c_handle::c_handle(const c_handle& other)
{
handler = other.handler;
}
inline c_handle::c_handle(unsigned long value)
{
handler = value;
}