[skip ci] VisualStudio: Add auto visualizer for some structures/classes

This commit is contained in:
s1lentq 2024-08-25 05:45:09 +07:00
parent 12f4e9bc79
commit dc16b12d79
4 changed files with 118 additions and 0 deletions

View File

@ -133,6 +133,7 @@ static entity_field_alias_t custom_entity_field_alias[] =
{ "animtime", 0 },
};
edict_t *g_pEdicts = nullptr;
bool g_bServerActive = false;
bool g_bItemCreatedByBuying = false;
PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS];
@ -3747,6 +3748,8 @@ void EXT_FUNC ServerDeactivate()
void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
g_pEdicts = pEdictList;
#ifdef REGAMEDLL_ADD
//
// Tells clients which version of player movement (pmove) the server is using

View File

@ -809,6 +809,9 @@
<ItemGroup>
<ResourceCompile Include="..\public\tier0\assert_dialog.rc" />
</ItemGroup>
<ItemGroup>
<Natvis Include="..\regamedll\types.natvis" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{70A2B904-B7DB-4C48-8DE0-AF567360D572}</ProjectGuid>
<RootNamespace>ReGameDLL</RootNamespace>

View File

@ -1070,4 +1070,9 @@
<Filter>public\tier0</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Natvis Include="..\regamedll\types.natvis">
<Filter>regamedll</Filter>
</Natvis>
</ItemGroup>
</Project>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Defining a visualizer for a CBasePlayer -->
<Type Name="CBasePlayer">
<DisplayString>{{ { pev->pContainingEntity - g_pEdicts }, { pev->classname }, { pev->health }, { m_iTeam }, { m_iModelName } }}</DisplayString>
</Type>
<!-- Defining a visualizer for a CCSPlayer -->
<Type Name="CCSPlayer">
<AlternativeType Name="CCSPlayerWeapon" />
<DisplayString>{ *m_pContainingEntity }</DisplayString>
</Type>
<!-- Defining a visualizer for a CBasePlayerItem -->
<Type Name="CBasePlayerItem">
<DisplayString>{{ { pev->pContainingEntity - g_pEdicts }, { pev->classname } }}</DisplayString>
<Expand>
<LinkedListItems>
<HeadPointer>m_pNext</HeadPointer>
<NextPointer>m_pNext</NextPointer>
<ValueNode>(*this)</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<!-- Defining a visualizer for a CBaseEntity -->
<Type Name="CBaseEntity">
<DisplayString>{{ { pev->pContainingEntity - g_pEdicts }, { pev->classname }, { pev->model } }}</DisplayString>
</Type>
<!-- Defining a visualizer for a edict_t -->
<Type Name="edict_s">
<DisplayString>{{ {this - g_pEdicts}, { v.classname }, { v.model } }}</DisplayString>
</Type>
<!-- Defining a visualizer for a entvars_t -->
<Type Name="entvars_s">
<DisplayString>{{ { pContainingEntity - g_pEdicts }, { classname }, { model } }}</DisplayString>
</Type>
<!-- Defining a visualizer for a QString -->
<Type Name="QString">
<DisplayString>{ &amp;gpGlobals->pStringBase[m_string],s }</DisplayString>
</Type>
<!-- Defining a visualizer for a CUtlMemory<T> -->
<Type Name="CUtlMemory&lt;*&gt;">
<DisplayString>allocator</DisplayString>
<Expand>
<Item Name="[data]" ExcludeView="simple">($T1 *)m_pMemory</Item>
<Item Name="[capacity]" ExcludeView="simple">m_nAllocationCount</Item>
<Item Name="[growsize]" ExcludeView="simple">m_nGrowSize</Item>
</Expand>
</Type>
<!-- Defining a visualizer for a CUtlVector<T> -->
<Type Name="CUtlVector&lt;*&gt;">
<DisplayString>{{ size = { m_Size } }}</DisplayString>
<Expand>
<ArrayItems>
<Size>m_Size</Size>
<ValuePointer>(ElemType_t *)m_Memory.m_pMemory</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<!-- Defining a visualizer for a linear indexing CUtlMap<K, T> -->
<Type Name="CUtlMap&lt;*, *&gt;">
<DisplayString>{{ size = { m_Tree.m_NumElements } }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">m_Tree.m_NumElements</Item>
<Item Name="[allocator]">m_Tree.m_Elements</Item>
<CustomListItems MaxItemsPerView="200" ExcludeView="Test">
<Variable Name="iMap" InitialValue="0" />
<Loop Condition="iMap &lt; m_Tree.m_NumElements">
<Item Name="[{((CTree::Node_t *)m_Tree.m_Elements.m_pMemory)[iMap].m_Data.key}]">((CTree::Node_t *)m_Tree.m_Elements.m_pMemory)[iMap].m_Data.elem</Item>
<Exec>iMap++</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<!-- Defining a visualizer for a CUtlArray<T, N> -->
<Type Name="CUtlArray&lt;*&gt;">
<DisplayString>{{ size = { $T2 } }}</DisplayString>
<Expand>
<ArrayItems>
<Size>$T2</Size>
<ValuePointer>($T1 *)&amp;m_Memory[0]</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<!-- Defining a visualizer for a linear indexing CUtlRBTree<T> -->
<Type Name="CUtlRBTree&lt;*&gt;">
<Expand>
<Item Name="[size]" ExcludeView="simple">m_NumElements</Item>
<Item Name="[allocator]">m_Elements</Item>
<IndexListItems>
<Size>m_NumElements</Size>
<ValueNode>((Node_t *)m_Elements.m_pMemory)[$i].m_Data</ValueNode>
</IndexListItems>
</Expand>
</Type>
</AutoVisualizer>