From e711c54bf9a1d023886cb1f5361e851ff611e35e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 15 Jun 2022 01:35:48 +0200 Subject: [PATCH] DebugOverlay improvements Use rebuild 'DestroyOverlay()' Use 'size_t' type for MemAlloc_Internal alloc size. --- r5dev/engine/debugoverlay.cpp | 20 ++++++++++---------- r5dev/engine/debugoverlay.h | 2 +- r5dev/tier0/tslist.cpp | 2 +- r5dev/tier0/tslist.h | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/r5dev/engine/debugoverlay.cpp b/r5dev/engine/debugoverlay.cpp index 9d92899c..78fe3997 100644 --- a/r5dev/engine/debugoverlay.cpp +++ b/r5dev/engine/debugoverlay.cpp @@ -58,24 +58,24 @@ bool OverlayBase_t::IsDead() const //------------------------------------------------------------------------------ // Purpose: destroys the overlay //------------------------------------------------------------------------------ -void HDestroyOverlay(OverlayBase_t* pOverlay) +void DestroyOverlay(OverlayBase_t* pOverlay) { - std::int64_t pOverlayType; + size_t pOverlaySize; EnterCriticalSection(&*s_OverlayMutex); switch (pOverlay->m_Type) { case OverlayType_t::OVERLAY_BOX: - pOverlayType = 128i64; + pOverlaySize = 128i64; goto LABEL_MALLOC; case OverlayType_t::OVERLAY_SPHERE: - pOverlayType = 72i64; + pOverlaySize = 72i64; goto LABEL_MALLOC; case OverlayType_t::OVERLAY_LINE: - pOverlayType = 80i64; + pOverlaySize = 80i64; goto LABEL_MALLOC; case OverlayType_t::OVERLAY_TRIANGLE: - pOverlayType = 6200i64; + pOverlaySize = 6200i64; goto LABEL_MALLOC; case OverlayType_t::OVERLAY_SWEPT_BOX: pOverlay->m_Type = OverlayType_t::OVERLAY_UNK1; @@ -84,14 +84,14 @@ void HDestroyOverlay(OverlayBase_t* pOverlay) case OverlayType_t::OVERLAY_BOX2: break; case OverlayType_t::OVERLAY_CAPSULE: - pOverlayType = 112i64; + pOverlaySize = 112i64; break; case OverlayType_t::OVERLAY_UNK0: - pOverlayType = 88i64; + pOverlaySize = 88i64; goto LABEL_MALLOC; LABEL_MALLOC: pOverlay->m_Type = OverlayType_t::OVERLAY_UNK1; - v_MemAlloc_Internal(pOverlay, pOverlayType); + v_MemAlloc_Internal(pOverlay, pOverlaySize); break; default: break; @@ -205,7 +205,7 @@ void DrawAllOverlays(char pOverlay) } pNextOverlay = pCurrOverlay->m_pNextOverlay; - v_DestroyOverlay(pCurrOverlay); + DestroyOverlay(pCurrOverlay); pCurrOverlay = pNextOverlay; } else diff --git a/r5dev/engine/debugoverlay.h b/r5dev/engine/debugoverlay.h index 51092220..45a98d0a 100644 --- a/r5dev/engine/debugoverlay.h +++ b/r5dev/engine/debugoverlay.h @@ -98,7 +98,7 @@ struct OverlaySphere_t : public OverlayBase_t int a{}; }; -void HDestroyOverlay(OverlayBase_t* pOverlay); +void DestroyOverlay(OverlayBase_t* pOverlay); void DrawOverlay(OverlayBase_t* pOverlay); void DebugOverlays_Attach(); void DebugOverlays_Detach(); diff --git a/r5dev/tier0/tslist.cpp b/r5dev/tier0/tslist.cpp index 42b7b0c4..fbbb4aec 100644 --- a/r5dev/tier0/tslist.cpp +++ b/r5dev/tier0/tslist.cpp @@ -1,7 +1,7 @@ #include "core/stdafx.h" #include "tier0/tslist.h" -void* MemAlloc_Internal(void* pPool, int64_t nSize) +void* MemAlloc_Internal(void* pPool, size_t nSize) { return v_MemAlloc_Internal(pPool, nSize); } diff --git a/r5dev/tier0/tslist.h b/r5dev/tier0/tslist.h index 6c1771db..92192bd7 100644 --- a/r5dev/tier0/tslist.h +++ b/r5dev/tier0/tslist.h @@ -2,10 +2,10 @@ #define TSLIST_H inline CMemory p_MemAlloc_Internal; -inline auto v_MemAlloc_Internal = p_MemAlloc_Internal.RCast(); +inline auto v_MemAlloc_Internal = p_MemAlloc_Internal.RCast(); inline CMemory p_MemAlloc_Wrapper; -inline auto v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast(); +inline auto v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast(); inline CMemory p_CTSListBase_Wrapper; inline auto CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast(); @@ -37,9 +37,9 @@ class VTSListBase : public IDetour #endif p_CTSListBase_Wrapper = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x40\x53\x48\x83\xEC\x20\xBB\x00\x00\x00\x00\x33\xC0"), "xxxxxxx????xx"); - CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast(); /*40 53 48 83 EC 20 BB ?? ?? ?? ?? 33 C0*/ - v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast(); /*40 53 48 83 EC 20 48 8B 05 6B 83 25 0D 48 8B D9*/ - v_MemAlloc_Internal = p_MemAlloc_Internal.RCast(); /*E9 ?? ?? ?? ?? CC CC CC 40 53 48 83 EC 20 48 8D 05 ?? ?? ?? ??*/ + CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast(); /*40 53 48 83 EC 20 BB ?? ?? ?? ?? 33 C0*/ + v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast(); /*40 53 48 83 EC 20 48 8B 05 6B 83 25 0D 48 8B D9*/ + v_MemAlloc_Internal = p_MemAlloc_Internal.RCast(); /*E9 ?? ?? ?? ?? CC CC CC 40 53 48 83 EC 20 48 8D 05 ?? ?? ?? ??*/ } virtual void GetVar(void) const {