From 27807482a316102afff094b53058c5d8a73cbf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= Date: Fri, 25 May 2018 11:30:42 +0200 Subject: [PATCH] Add Natvis support for interop data. (#165) --- src/openloco/NatvisFile.natvis | 19 +++++++++++++++++++ src/openloco/interop/interop.hpp | 22 ++++++++++++++++++++++ src/openloco/openloco.vcxproj | 3 +++ 3 files changed, 44 insertions(+) create mode 100644 src/openloco/NatvisFile.natvis diff --git a/src/openloco/NatvisFile.natvis b/src/openloco/NatvisFile.natvis new file mode 100644 index 00000000..1f8bc59c --- /dev/null +++ b/src/openloco/NatvisFile.natvis @@ -0,0 +1,19 @@ + + + + {{size = {_Mylast - _Myfirst}}} + + _Mylast - _Myfirst + + _Mylast - _Myfirst + _Myfirst + + + + + {*_Myptr} + + _Myptr + + + \ No newline at end of file diff --git a/src/openloco/interop/interop.hpp b/src/openloco/interop/interop.hpp index 48bc2caf..dfe777d1 100644 --- a/src/openloco/interop/interop.hpp +++ b/src/openloco/interop/interop.hpp @@ -134,11 +134,21 @@ namespace openloco::interop template 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()); + } + operator reference() { return addr(); @@ -268,12 +278,24 @@ namespace openloco::interop template struct loco_global { + public: typedef T type; typedef type* pointer; typedef type& reference; typedef const type& const_reference; typedef loco_global_iterator iterator; + private: + pointer _Myfirst; + pointer _Mylast; + + public: + loco_global() + { + _Myfirst = get(); + _Mylast = _Myfirst + TCount; + } + operator pointer() { return get(); diff --git a/src/openloco/openloco.vcxproj b/src/openloco/openloco.vcxproj index 8a05ef19..a9908d71 100644 --- a/src/openloco/openloco.vcxproj +++ b/src/openloco/openloco.vcxproj @@ -126,6 +126,9 @@ + + + {42A6B551-4EC5-4B66-A130-628622CD98C4} openloco