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,13 @@
#include "utlhash.h"
int CUtlMemoryPool::Count() const {
return nBlocksAllocated;
}
int CUtlMemoryPool::PeakCount() const {
return nPeakAlloc;
}
int CUtlMemoryPool::BlockSize() const {
return nBlockSize;
}

View File

@@ -0,0 +1,163 @@
#pragma once
#include "../../../../templeware/utils/memory/memorycommon.h"
#include <cstddef>
#include <cstdint>
#include <limits>
#include <cstdint>
class CUtlMemoryPool {
public:
int Count() const;
int PeakCount() const;
int BlockSize() const;
protected:
class CBlob {
public:
CBlob* pPrev;
CBlob* pNext;
int nNumBytes;
char Data[1];
char Padding[3];
};
int nBlockSize;
int nBlocksPerBlob;
int nGrowMode;
int nBlocksAllocated;
int nPeakAlloc;
unsigned short nAlignment;
unsigned short nNumBlobs;
void* pHeadOfFreeList;
void* pAllocOwner;
CBlob BlobHead;
};
using UtlTSHashHandle_t = std::uintptr_t;
inline unsigned HashIntConventional(const int n) {
unsigned hash = 0xAAAAAAAA + (n & 0xFF);
hash = (hash << 5) + hash + ((n >> 8) & 0xFF);
hash = (hash << 5) + hash + ((n >> 16) & 0xFF);
hash = (hash << 5) + hash + ((n >> 24) & 0xFF);
return hash;
}
template <int nBucketCount, class tKey = std::uintptr_t>
class CUtlTSHashGenericHash {
public:
static int Hash(const tKey& Key, int nBucketMask) {
int nHash = HashIntConventional(std::uintptr_t(Key));
if (nBucketCount <= UINT16_MAX) {
nHash ^= (nHash >> 16);
}
if (nBucketCount <= UINT8_MAX) {
nHash ^= (nHash >> 8);
}
return (nHash & nBucketMask);
}
static bool Compare(const tKey& lhs, const tKey& rhs) {
return lhs == rhs;
}
};
template <class tElement, int nBucketCount, class tKey = std::uintptr_t, class tHashFuncs = CUtlTSHashGenericHash<nBucketCount, tKey>, int nAlignment = 0>
class CUtlTSHash {
static constexpr int nBucketMask = nBucketCount - 1;
public:
static constexpr UtlTSHashHandle_t InvalidHandle() {
return static_cast<UtlTSHashHandle_t>(0);
}
UtlTSHashHandle_t Find(tKey uiKey) {
int iBucket = tHashFuncs::Hash(uiKey, nBucketCount);
const HashBucket_t& hashBucket = aBuckets[iBucket];
const UtlTSHashHandle_t hHash = Find(uiKey, hashBucket.pFirst, nullptr);
return hHash ? hHash : Find(uiKey, hashBucket.pFirstUncommited, hashBucket.pFirst);
}
int Count() const {
return EntryMemory.Count();
}
int GetElements(int nFirstElement, int nCount, UtlTSHashHandle_t* pHandles) const {
int nIndex = 0;
for (int nBucketIndex = 0; nBucketIndex < nBucketCount; nBucketIndex++) {
const HashBucket_t& hashBucket = aBuckets[nBucketIndex];
HashFixedData_t* pElement = hashBucket.pFirstUncommited;
for (; pElement; pElement = pElement->pNext) {
if (--nFirstElement >= 0)
continue;
pHandles[nIndex++] = reinterpret_cast<UtlTSHashHandle_t>(pElement);
if (nIndex >= nCount)
return nIndex;
}
}
return nIndex;
}
tElement Element(UtlTSHashHandle_t hHash) {
return ((HashFixedData_t*)(hHash))->Data;
}
const tElement& Element(UtlTSHashHandle_t hHash) const {
return reinterpret_cast<HashFixedData_t*>(hHash)->Data;
}
tElement& operator[](UtlTSHashHandle_t hHash) {
return reinterpret_cast<HashFixedData_t*>(hHash)->Data;
}
const tElement& operator[](UtlTSHashHandle_t hHash) const {
return reinterpret_cast<HashFixedData_t*>(hHash)->Data;
}
tKey GetID(UtlTSHashHandle_t hHash) const {
return reinterpret_cast<HashFixedData_t*>(hHash)->uiKey;
}
private:
template <typename tData>
struct HashFixedDataInternal_t {
tKey uiKey;
HashFixedDataInternal_t<tData>* pNext;
tData Data;
};
using HashFixedData_t = HashFixedDataInternal_t<tElement>;
struct HashBucket_t {
private:
// Swap the MEM_PADs in case of crash here, not sure exactly what this is all about -bas
//[[maybe_unused]] std::byte pad0[0x18];
MEM_PAD(0x18);
public:
HashFixedData_t* pFirst;
HashFixedData_t* pFirstUncommited;
};
UtlTSHashHandle_t Find(tKey uiKey, HashFixedData_t* pFirstElement, HashFixedData_t* pLastElement) {
for (HashFixedData_t* pElement = pFirstElement; pElement != pLastElement; pElement = pElement->pNext) {
if (tHashFuncs::Compare(pElement->uiKey, uiKey))
return reinterpret_cast<UtlTSHashHandle_t>(pElement);
}
return InvalidHandle();
}
CUtlMemoryPool EntryMemory;
MEM_PAD(0x40);
HashBucket_t aBuckets[nBucketCount];
bool bNeedsCommit;
};

View File

@@ -0,0 +1,20 @@
#include "..\..\..\templeware\hooks\hooks.h"
#include "..\..\..\templeware\interfaces\interfaces.h"
#include "cutlbuffer.h"
CUtlBuffer::CUtlBuffer(int a1, int size, int a3)
{
I::ConstructUtlBuffer(this, a1, size, a3);
}
void CUtlBuffer::ensure(int size)
{
I::EnsureCapacityBuffer(this, size);
}
void CUtlBuffer::PutString(const char* szString)
{
I::PutUtlString(this, szString);
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include <cstdint>
class CUtlBuffer
{
public:
char _pad[0x80];
CUtlBuffer(int a1 = 0, int size = 0, int a3 = 0);
void ensure(int size);
void PutString(const char* szString);
};

View File

@@ -0,0 +1,40 @@
#pragma once
#include <cstdint>
#include "../cutlbuffer/cutlbuffer.h"
#include "keyvalues.h"
#include "../../../templeware/utils/memory/vfunc/vfunc.h"
#include "../../../templeware/utils/memory/patternscan/patternscan.h"
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../cutl/utlhash/utlhash.h"
#include "..\..\..\templeware\utils\math\utlvector\utlvector.h"
#include "..\..\..\templeware\interfaces\interfaces.h"
void CKeyValues3::LoadFromBuffer(const char* szString)
{
CUtlBuffer buffer(0, (std::strlen(szString) + 10), 1);
buffer.PutString(szString);
this->LoadKV3(&buffer);
}
bool CKeyValues3::LoadKV3(CUtlBuffer* buffer)
{
using fnLoadKeyValues = bool(__fastcall*)(CKeyValues3*, void*, CUtlBuffer*, KV3ID_t*, void*, void*, void*, void*, const char*);
static const fnLoadKeyValues oLoadKeyValues = reinterpret_cast<fnLoadKeyValues>(M::abs(M::FindPattern("tier0.dll", "E8 ? ? ? ? EB 36 8B 43 10"), 0x1, 0x0));
const char* szName = ("");
KV3ID_t kv3ID = KV3ID_t(("generic"), 0x41B818518343427E, 0xB5F447C23C0CDF8C);
return oLoadKeyValues(this, nullptr, buffer, &kv3ID, nullptr, nullptr, nullptr, nullptr, (""));
}
CKeyValues3* CKeyValues3::create_material_from_resource()
{
using fnSetTypeKV3 = CKeyValues3 * (__fastcall*)(CKeyValues3*, unsigned int, unsigned int);
static const fnSetTypeKV3 oSetTypeKV3 = reinterpret_cast<fnSetTypeKV3>(M::FindPattern("tier0.dll", ("40 53 48 83 EC 30 48 8B D9 49")));
CKeyValues3* pKeyValue = new CKeyValues3[0x10];
return oSetTypeKV3(pKeyValue, 1U, 6U);
}

View File

@@ -0,0 +1,29 @@
#pragma once
#include <cstdint>
#include "../../../templeware/utils/memory/vfunc/vfunc.h"
#include "../../../templeware/utils/memory/patternscan/patternscan.h"
#include "../../../templeware/utils/memory/memorycommon.h"
#include "../cutl/utlhash/utlhash.h"
#include "..\..\..\templeware\utils\math\utlvector\utlvector.h"
#include "..\cutlbuffer\cutlbuffer.h"
struct KV3ID_t
{
const char* szName;
std::uint64_t unk0;
std::uint64_t unk1;
};
class CKeyValues3
{
public:
char _pad[0x100];
std::uint64_t uKey;
void* pValue;
char _pad1[0x8];
void LoadFromBuffer(const char* szString);
bool LoadKV3(CUtlBuffer* buffer);
void LoadFromFile(const char* szString);
CKeyValues3* create_material_from_resource();
};

View File

@@ -0,0 +1,55 @@
#include "ISchemaClass.h"
bool CSchemaType::GetSizes(int* pOutSize, uint8_t* unkPtr) {
return M::vfunc<bool, 3U>(this, pOutSize, unkPtr);
}
bool CSchemaType::GetSize(int* out_size) {
uint8_t smh = 0;
return GetSizes(out_size, &smh);
}
bool SchemaClassInfoData_t::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;
}
void CSchemaSystemTypeScope::FindDeclaredClass(SchemaClassInfoData_t** pReturnClass, const char* szClassName) {
return M::vfunc<void, 2U>(this, pReturnClass, szClassName);
}
CSchemaType* CSchemaSystemTypeScope::FindSchemaTypeByName(const char* szName, std::uintptr_t* pSchema) {
return M::vfunc<CSchemaType*, 4U>(this, szName, pSchema);
}
CSchemaType* CSchemaSystemTypeScope::FindTypeDeclaredClass(const char* szName) {
return M::vfunc<CSchemaType*, 5U>(this, szName);
}
CSchemaType* CSchemaSystemTypeScope::FindTypeDeclaredEnum(const char* szName) {
return M::vfunc<CSchemaType*, 6U>(this, szName);
}
CSchemaClassBinding* CSchemaSystemTypeScope::FindRawClassBinding(const char* szName) {
return M::vfunc<CSchemaClassBinding*, 7U>(this, szName);
}
void GetSchemaClassInfo(uintptr_t address, SchemaClassInfoData_t** pReturn) {
return M::vfunc<void, 38U>(reinterpret_cast<void*>(address), pReturn);
}
CSchemaSystemTypeScope* ISchemaSystem::FindTypeScopeForModule(const char* m_module_name)
{
return M::vfunc<CSchemaSystemTypeScope*, 13U>(this, m_module_name, nullptr);
}

View File

@@ -0,0 +1,158 @@
#pragma once
#include <cstdint>
#include "../../../../templeware/utils/memory/vfunc/vfunc.h"
#include "../../../../templeware/utils/memory/patternscan/patternscan.h"
#include "../../../../templeware/utils/memory/memorycommon.h"
#include "../../cutl/utlhash/utlhash.h"
#include "..\..\..\..\templeware\utils\math\utlvector\utlvector.h"
#define SCHEMASYSTEM_TYPE_SCOPES_OFFSET 0x188
#define SCHEMASYSTEMTYPESCOPE_OFF1 0x3F8
#define SCHEMASYSTEMTYPESCOPE_OFF2 0x8
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);
public:
bool GetSize(int* out_size);
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);
};
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);
CSchemaType* FindSchemaTypeByName(const char* szName, std::uintptr_t* pSchema);
CSchemaType* FindTypeDeclaredClass(const char* szName);
CSchemaType* FindTypeDeclaredEnum(const char* szName);
CSchemaClassBinding* FindRawClassBinding(const char* 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
};
void GetSchemaClassInfo(uintptr_t address, SchemaClassInfoData_t** pReturn);
class ISchemaSystem
{
public:
CSchemaSystemTypeScope* FindTypeScopeForModule(const char* m_module_name);
private:
MEM_PAD(SCHEMASYSTEM_TYPE_SCOPES_OFFSET); // 0x0000
public:
CUtlVector<CSchemaSystemTypeScope*> vecTypeScopes; // SCHEMASYSTEM_TYPE_SCOPES_OFFSET
};

View File

@@ -0,0 +1,8 @@
#pragma once
struct viewmatrix_t {
float* operator[ ](int index) {
return matrix[index];
}
float matrix[4][4];
};

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;
}