Support watcher cache

This commit is contained in:
momo5502
2024-12-24 09:15:38 +01:00
parent 98265ce2a9
commit ebbc5e4e61

View File

@@ -2,6 +2,8 @@
#include "reflect_type_info.hpp"
//#define CACHE_OBJECT_ADDRESSES
template <typename T>
emulator_hook* watch_object(windows_emulator& emu, emulator_object<T> object)
{
@@ -20,6 +22,14 @@ emulator_hook* watch_object(windows_emulator& emu, emulator_object<T> object)
return;
}
#ifdef CACHE_OBJECT_ADDRESSES
static std::unordered_set<uint64_t> 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",