From ebbc5e4e61197a962d14590bbe6a36a0b252b7f0 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Tue, 24 Dec 2024 09:15:38 +0100 Subject: [PATCH] Support watcher cache --- src/analyzer/object_watching.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/analyzer/object_watching.hpp b/src/analyzer/object_watching.hpp index 19ff3a61..e241ab88 100644 --- a/src/analyzer/object_watching.hpp +++ b/src/analyzer/object_watching.hpp @@ -2,6 +2,8 @@ #include "reflect_type_info.hpp" +//#define CACHE_OBJECT_ADDRESSES + template emulator_hook* watch_object(windows_emulator& emu, emulator_object object) { @@ -20,6 +22,14 @@ emulator_hook* watch_object(windows_emulator& emu, emulator_object object) return; } +#ifdef CACHE_OBJECT_ADDRESSES + static std::unordered_set logged_addresses{}; + if (is_main_access && !logged_addresses.insert(address).second) + { + return; + } +#endif + const auto offset = address - object.value(); emu.logger.print(is_main_access ? color::green : color::dark_gray, "Object access: %s - 0x%llX (%s) at 0x%llX (%s)\n",