From 05d2c5e3eafd1010ab0d0138dc06c742cce6e3a9 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 20 Jan 2023 02:12:14 +0100 Subject: [PATCH] Add g_pEntityList to SDK --- r5dev/public/baseentity.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/r5dev/public/baseentity.h b/r5dev/public/baseentity.h index 498d056d..635059d2 100644 --- a/r5dev/public/baseentity.h +++ b/r5dev/public/baseentity.h @@ -14,6 +14,7 @@ #include "mathlib/vector.h" #include "game/server/networkproperty.h" #include "game/shared/collisionproperty.h" +#include "game/shared/entitylist_base.h" #include "iservernetworkable.h" #include "iserverentity.h" @@ -39,10 +40,10 @@ private: void* m_pfnMoveDone; void* m_pfnThink; CServerNetworkProperty m_Network; - __int64 m_ModelName; + const char* m_ModelName; int m_entIndex; char gap_74[8]; // Aligns properly in IDA and generated code after setting from 4 to 8. - __int64 m_iClassname; + const char* m_iClassname; float m_flAnimTime; float m_flSimulationTime; int m_creationTick; @@ -247,4 +248,35 @@ private: int m_realmsTransmitMaskCachedSerialNumber; }; +inline CMemory p_CBaseEntity__GetBaseEntity; +inline auto v_CBaseEntity__GetBaseEntity = p_CBaseEntity__GetBaseEntity.RCast(); + +inline CEntInfo* g_pEntityList = nullptr; + +/////////////////////////////////////////////////////////////////////////////// +class VBaseEntity : public IDetour +{ + virtual void GetAdr(void) const + { + spdlog::debug("| FUN: CBaseEntity::GetBaseEntity : {:#18x} |\n", p_CBaseEntity__GetBaseEntity.GetPtr()); + spdlog::debug("| VAR: g_pEntityList : {:#18x} |\n", reinterpret_cast(g_pEntityList)); + spdlog::debug("+----------------------------------------------------------------+\n"); + } + virtual void GetFun(void) const + { + p_CBaseEntity__GetBaseEntity = g_GameDll.FindPatternSIMD("8B 91 ?? ?? ?? ?? 83 FA FF 74 1F 0F B7 C2 48 8D 0D ?? ?? ?? ?? C1 EA 10 48 8D 04 40 48 03 C0 39 54 C1 08 75 05 48 8B 04 C1 C3 33 C0 C3 CC CC CC 48 8B 41 30"); + v_CBaseEntity__GetBaseEntity = p_CBaseEntity__GetBaseEntity.RCast(); + } + virtual void GetVar(void) const + { + g_pEntityList = p_CBaseEntity__GetBaseEntity.FindPattern("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast(); + } + virtual void GetCon(void) const { } + virtual void Attach(void) const { } + virtual void Detach(void) const { } +}; +/////////////////////////////////////////////////////////////////////////////// + +REGISTER(VBaseEntity); + #endif // BASEENTITY_H