Add Natvis support for interop data. (#165)

This commit is contained in:
ζeh Matt 2018-05-25 11:30:42 +02:00 committed by Duncan
parent f767cecb3a
commit 27807482a3
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="openloco::interop::loco_global&lt;*&gt;">
<DisplayString>{{size = {_Mylast - _Myfirst}}}</DisplayString>
<Expand>
<Item Name="[size]">_Mylast - _Myfirst</Item>
<ArrayItems>
<Size>_Mylast - _Myfirst</Size>
<ValuePointer>_Myfirst</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="openloco::interop::loco_global&lt;*&gt;">
<DisplayString>{*_Myptr}</DisplayString>
<Expand>
<Item Name="[ptr]">_Myptr</Item>
</Expand>
</Type>
</AutoVisualizer>

View File

@ -134,11 +134,21 @@ namespace openloco::interop
template<typename T, uintptr_t TAddress>
struct loco_global
{
public:
typedef T type;
typedef type* pointer;
typedef type& reference;
typedef const type& const_reference;
private:
pointer _Myptr;
public:
loco_global()
{
_Myptr = &(addr<TAddress, T>());
}
operator reference()
{
return addr<TAddress, T>();
@ -268,12 +278,24 @@ namespace openloco::interop
template<typename T, size_t TCount, uintptr_t TAddress>
struct loco_global<T[TCount], TAddress>
{
public:
typedef T type;
typedef type* pointer;
typedef type& reference;
typedef const type& const_reference;
typedef loco_global_iterator<T> iterator;
private:
pointer _Myfirst;
pointer _Mylast;
public:
loco_global()
{
_Myfirst = get();
_Mylast = _Myfirst + TCount;
}
operator pointer()
{
return get();

View File

@ -126,6 +126,9 @@
<ClInclude Include="interop\interop.hpp" />
<ClInclude Include="station.h" />
</ItemGroup>
<ItemGroup>
<Natvis Include="NatvisFile.natvis" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42A6B551-4EC5-4B66-A130-628622CD98C4}</ProjectGuid>
<RootNamespace>openloco</RootNamespace>