mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
IClientEntityList and CUtlDict.
* IClientEntityList is the full virtual function table. * CUtlDict "implementation" is temporary.
This commit is contained in:
parent
a23c0b1ba9
commit
096ecdd333
@ -13,6 +13,7 @@
|
||||
#include "engine/sys_utils.h"
|
||||
#include "rtech/rtech_utils.h"
|
||||
#include "public/include/studio.h"
|
||||
#include "tier1/utldict.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -31,6 +32,11 @@ studiohdr_t* CMDLCache::FindMDL(CMDLCache* pMDLCache, MDLHandle_t handle, void*
|
||||
|
||||
v4 = handle;
|
||||
EnterCriticalSection(reinterpret_cast<LPCRITICAL_SECTION>(&*m_MDLMutex));
|
||||
|
||||
// Example usage.
|
||||
// auto mdlDict = CUtlDict<__int64, MDLHandle_t>(m_MDLDict.Deref().GetPtr()); // __int64 is studiodata_t*
|
||||
// v6 = mdlDict.Find(v4);
|
||||
|
||||
v6 = *(_QWORD*)(m_MDLDict.Deref().GetPtr() + 24 * v4 + 16);
|
||||
LeaveCriticalSection(reinterpret_cast<LPCRITICAL_SECTION>(&*m_MDLMutex));
|
||||
|
||||
|
21
r5dev/public/include/icliententitylist.h
Normal file
21
r5dev/public/include/icliententitylist.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
using CBaseHandle = unsigned long;
|
||||
class IClientNetworkable;
|
||||
class IClientEntity;
|
||||
|
||||
class IClientEntityList // Fully reversed beside index 0 which is probably a destructor.
|
||||
{
|
||||
public:
|
||||
virtual int sub_1405C5E70() = 0;
|
||||
virtual IClientNetworkable* GetClientNetworkable() = 0;
|
||||
virtual IClientNetworkable* GetClientNetworkableFromHandle(CBaseHandle handle) = 0;
|
||||
virtual void* GetClientUnknownFromHandle(CBaseHandle handle) = 0;
|
||||
virtual IClientEntity* GetClientEntity(int entNum) = 0;
|
||||
virtual IClientEntity* GetClientEntityFromHandle(CBaseHandle handle) = 0; // behaves weird on r5 and doesn't really wanna work.
|
||||
virtual int NumberOfEntities(bool includeNonNetworkable = false) = 0;
|
||||
virtual int GetNumClientNonNetworkable() = 0;
|
||||
virtual int GetHighestEntityIndex() = 0;
|
||||
virtual void SetMaxEntities(int maxEnts) = 0;
|
||||
virtual int GetMaxEntities() = 0;
|
||||
};
|
26
r5dev/tier1/utldict.h
Normal file
26
r5dev/tier1/utldict.h
Normal file
@ -0,0 +1,26 @@
|
||||
//============ Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: A dictionary mapping from symbol to structure
|
||||
//
|
||||
// $Header: $
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#pragma once
|
||||
|
||||
template <class T, class I>
|
||||
class CUtlDict
|
||||
{
|
||||
public:
|
||||
CUtlDict<T, I>(uintptr_t ptr) : m_Elements(ptr) {};
|
||||
T Find(__int64 entry);
|
||||
|
||||
private:
|
||||
uintptr_t m_Elements;
|
||||
};
|
||||
|
||||
template <class T, class I>
|
||||
T CUtlDict<T, I>::Find(__int64 entry)
|
||||
{
|
||||
return *(T*)(m_Elements + 24 * entry + 16);
|
||||
}
|
@ -6,9 +6,7 @@
|
||||
//
|
||||
// A growable memory class.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef UTLMEMORY_H
|
||||
#define UTLMEMORY_H
|
||||
#pragma once
|
||||
|
||||
struct __declspec(align(8)) CUtlMemory
|
||||
{
|
||||
@ -17,4 +15,3 @@ struct __declspec(align(8)) CUtlMemory
|
||||
int64_t m_nGrowSize;
|
||||
};
|
||||
|
||||
#endif // UTLMEMORY_H
|
||||
|
@ -7,9 +7,7 @@
|
||||
// A growable array class that maintains a free list and keeps elements
|
||||
// in the same location
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef UTLVECTOR_H
|
||||
#define UTLVECTOR_H
|
||||
#pragma once
|
||||
|
||||
#include "tier1/utlmemory.h"
|
||||
|
||||
@ -20,4 +18,4 @@ struct __declspec(align(4)) CUtlVector
|
||||
int m_Size;
|
||||
};
|
||||
|
||||
#endif // CCVECTOR_H
|
||||
|
||||
|
@ -366,6 +366,7 @@
|
||||
<ClInclude Include="..\tier1\cvar.h" />
|
||||
<ClInclude Include="..\tier1\IConVar.h" />
|
||||
<ClInclude Include="..\tier1\NetAdr2.h" />
|
||||
<ClInclude Include="..\tier1\utldict.h" />
|
||||
<ClInclude Include="..\tier1\utlmemory.h" />
|
||||
<ClInclude Include="..\tier1\utlvector.h" />
|
||||
<ClInclude Include="..\tier2\socketcreator.h" />
|
||||
|
@ -1277,6 +1277,9 @@
|
||||
<ClInclude Include="..\game\shared\animation.h">
|
||||
<Filter>sdk\game\shared</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier1\utldict.h">
|
||||
<Filter>sdk\tier1</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -358,6 +358,7 @@
|
||||
<ClInclude Include="..\tier1\cvar.h" />
|
||||
<ClInclude Include="..\tier1\IConVar.h" />
|
||||
<ClInclude Include="..\tier1\NetAdr2.h" />
|
||||
<ClInclude Include="..\tier1\utldict.h" />
|
||||
<ClInclude Include="..\tier1\utlmemory.h" />
|
||||
<ClInclude Include="..\tier1\utlvector.h" />
|
||||
<ClInclude Include="..\tier2\socketcreator.h" />
|
||||
|
@ -906,6 +906,9 @@
|
||||
<ClInclude Include="..\game\shared\animation.h">
|
||||
<Filter>sdk\game\shared</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier1\utldict.h">
|
||||
<Filter>sdk\tier1</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common\opcodes.cpp">
|
||||
|
@ -209,6 +209,7 @@
|
||||
<ClInclude Include="..\public\include\const.h" />
|
||||
<ClInclude Include="..\public\include\edict.h" />
|
||||
<ClInclude Include="..\public\include\globalvars_base.h" />
|
||||
<ClInclude Include="..\public\include\icliententitylist.h" />
|
||||
<ClInclude Include="..\public\include\inetchannel.h" />
|
||||
<ClInclude Include="..\public\include\ivrenderview.h" />
|
||||
<ClInclude Include="..\public\include\memaddr.h" />
|
||||
@ -384,6 +385,7 @@
|
||||
<ClInclude Include="..\tier1\cvar.h" />
|
||||
<ClInclude Include="..\tier1\IConVar.h" />
|
||||
<ClInclude Include="..\tier1\NetAdr2.h" />
|
||||
<ClInclude Include="..\tier1\utldict.h" />
|
||||
<ClInclude Include="..\tier1\utlmemory.h" />
|
||||
<ClInclude Include="..\tier1\utlvector.h" />
|
||||
<ClInclude Include="..\tier2\socketcreator.h" />
|
||||
|
@ -1337,6 +1337,12 @@
|
||||
<ClInclude Include="..\game\shared\animation.h">
|
||||
<Filter>sdk\game\shared</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\include\icliententitylist.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier1\utldict.h">
|
||||
<Filter>sdk\tier1</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user