From d35ddc4070144ef763cf2d1571efcddd83521ad7 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:50:41 +0100 Subject: [PATCH] Fix memory watches triggering when non-memory AT-backend connects --- src/core/autotracker.h | 6 +++++- src/core/scripthost.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/autotracker.h b/src/core/autotracker.h index d0dfc8dc..972d5dad 100644 --- a/src/core/autotracker.h +++ b/src/core/autotracker.h @@ -178,9 +178,13 @@ class AutoTracker final : public LuaInterface{ return State::Unavailable; } - bool isAnyConnected() + bool isAnyMemoryConnected() { for (int index = 0; index < (int)_state.size(); ++index) { + if (_ap && _backendIndex[_ap] == index) + continue; // AP doesn't have memory + if (_uat && _backendIndex[_uat] == index) + continue; // UAT doesn't have memory if (getState(index) >= State::ConsoleConnected) return true; } diff --git a/src/core/scripthost.cpp b/src/core/scripthost.cpp index a2fb6d29..427406b0 100644 --- a/src/core/scripthost.cpp +++ b/src/core/scripthost.cpp @@ -561,7 +561,7 @@ void ScriptHost::resetWatches() void ScriptHost::runMemoryWatchCallbacks() { - if (!_autoTracker || !_autoTracker->isAnyConnected()) + if (!_autoTracker || !_autoTracker->isAnyMemoryConnected()) return; // we need to run callbacks because the autotracker changed some cache