diff --git a/src/core/autotracker.h b/src/core/autotracker.h index 88e164e..02fba7e 100644 --- a/src/core/autotracker.h +++ b/src/core/autotracker.h @@ -168,6 +168,15 @@ class AutoTracker final : public LuaInterface{ return State::Unavailable; } + bool isAnyConnected() + { + for (int index = 0; index < (int)_state.size(); ++index) { + if (getState(index) >= State::ConsoleConnected) + return true; + } + return false; + } + const std::string& getName(int index) { if (_ap && _backendIndex[_ap] == index) return BACKEND_AP_NAME; diff --git a/src/core/scripthost.cpp b/src/core/scripthost.cpp index eafd954..9b8f703 100644 --- a/src/core/scripthost.cpp +++ b/src/core/scripthost.cpp @@ -559,6 +559,9 @@ void ScriptHost::resetWatches() void ScriptHost::runMemoryWatchCallbacks() { + if (!_autoTracker || !_autoTracker->isAnyConnected()) + return; + // we need to run callbacks because the autotracker changed some cache // but really we only need to run the ones that are marked dirty for (size_t i = 0; i < _memoryWatches.size(); i++) {