DebugOverlay improvements

Use rebuild 'DestroyOverlay()'
Use 'size_t' type for MemAlloc_Internal alloc size.
This commit is contained in:
Kawe Mazidjatari 2022-06-15 01:35:48 +02:00
parent e70e4d1a8c
commit e711c54bf9
4 changed files with 17 additions and 17 deletions

View File

@ -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

View File

@ -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();

View File

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

View File

@ -2,10 +2,10 @@
#define TSLIST_H
inline CMemory p_MemAlloc_Internal;
inline auto v_MemAlloc_Internal = p_MemAlloc_Internal.RCast<void* (*)(void* pPool, int64_t nSize)>();
inline auto v_MemAlloc_Internal = p_MemAlloc_Internal.RCast<void* (*)(void* pPool, size_t nSize)>();
inline CMemory p_MemAlloc_Wrapper;
inline auto v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast<void* (*)(size_t)>();
inline auto v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast<void* (*)(size_t nSize)>();
inline CMemory p_CTSListBase_Wrapper;
inline auto CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast<void* (*)(void)>();
@ -37,9 +37,9 @@ class VTSListBase : public IDetour
#endif
p_CTSListBase_Wrapper = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x83\xEC\x20\xBB\x00\x00\x00\x00\x33\xC0"), "xxxxxxx????xx");
CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast<void* (*)(void)>(); /*40 53 48 83 EC 20 BB ?? ?? ?? ?? 33 C0*/
v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast<void* (*)(size_t)>(); /*40 53 48 83 EC 20 48 8B 05 6B 83 25 0D 48 8B D9*/
v_MemAlloc_Internal = p_MemAlloc_Internal.RCast<void* (*)(void*, int64_t)>(); /*E9 ?? ?? ?? ?? CC CC CC 40 53 48 83 EC 20 48 8D 05 ?? ?? ?? ??*/
CTSListBase_Wrapper = p_CTSListBase_Wrapper.RCast<void* (*)(void)>(); /*40 53 48 83 EC 20 BB ?? ?? ?? ?? 33 C0*/
v_MemAlloc_Wrapper = p_MemAlloc_Wrapper.RCast<void* (*)(size_t)>(); /*40 53 48 83 EC 20 48 8B 05 6B 83 25 0D 48 8B D9*/
v_MemAlloc_Internal = p_MemAlloc_Internal.RCast<void* (*)(void*, size_t)>(); /*E9 ?? ?? ?? ?? CC CC CC 40 53 48 83 EC 20 48 8D 05 ?? ?? ?? ??*/
}
virtual void GetVar(void) const
{