From c93e7a54fd2bccc47071beab135d092c3b191af8 Mon Sep 17 00:00:00 2001 From: SAMURAI Date: Fri, 2 Jan 2026 22:28:36 +0100 Subject: [PATCH] fix(LuaMgr): preserve lastChecked - Attempt to fix `FetchRepositories` from overwriting cached `lastChecked` keys - Attempt to prevent scanning memory too early by waiting for the social club module to load. --- src/core/github/gitmgr.cpp | 15 ++++++++++----- src/core/github/repository.hpp | 5 ++++- src/core/memory/procmon.cpp | 7 +++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/core/github/gitmgr.cpp b/src/core/github/gitmgr.cpp index f4baa95..a5ab229 100644 --- a/src/core/github/gitmgr.cpp +++ b/src/core/github/gitmgr.cpp @@ -101,8 +101,7 @@ namespace YLP script.isDisabled = false; script.isInstalled = false; script.currentPath = ""; - script.lastChecked = std::chrono::system_clock::time_point{}; - + script.lastChecked = {}; should_update_cache = true; } @@ -224,6 +223,8 @@ namespace YLP m_RepoETag = response.eTag; std::map newRepos; + std::map oldRepos = m_Repos; + for (auto& repo : j) { std::string name = repo["name"]; @@ -245,12 +246,16 @@ namespace YLP std::filesystem::path enabledPath = m_ScriptsPath / name; std::filesystem::path disabledPath = m_ScriptsPath / "disabled" / name; script.isDisabled = IO::Exists(disabledPath) && IO::HasLuaFiles(disabledPath) && !IO::Exists(enabledPath); + + if (auto it = oldRepos.find(name); it != oldRepos.end()) + script.lastChecked = it->second.lastChecked; + + script.isPendingUpdate = script.is_outdated(); script.currentPath = ""; if (script.isInstalled) { script.currentPath = script.isDisabled ? disabledPath : enabledPath; - script.lastChecked = m_Repos[name].lastChecked; } newRepos[name] = script; @@ -279,7 +284,6 @@ namespace YLP try { FetchRepositories(); - SaveCache(); m_State = eLoadState::READY; } catch (const std::exception& e) @@ -456,8 +460,9 @@ namespace YLP repo.downloadProgress = 0.f; repo.isDownloading = false; repo.isInstalled = true; - repo.lastChecked = std::chrono::system_clock::now(); repo.currentPath = m_ScriptsPath / name; + repo.lastChecked = std::chrono::system_clock::now(); + repo.isPendingUpdate = repo.is_outdated(); } SaveCache(); diff --git a/src/core/github/repository.hpp b/src/core/github/repository.hpp index e1abe00..a1e153d 100644 --- a/src/core/github/repository.hpp +++ b/src/core/github/repository.hpp @@ -1,4 +1,4 @@ -// YLP Project - GPL-3.0 +// YLP Project - GPL-3.0 // See LICENSE file or for details. @@ -27,6 +27,9 @@ namespace YLP bool is_outdated() const { + if (!isInstalled) + return false; + if (lastChecked.time_since_epoch().count() == 0) return false; diff --git a/src/core/memory/procmon.cpp b/src/core/memory/procmon.cpp index 5949ef7..6654fa4 100644 --- a/src/core/memory/procmon.cpp +++ b/src/core/memory/procmon.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2025 SAMURAI (xesdoog) & Contributors +// Copyright (C) 2025 SAMURAI (xesdoog) & Contributors // This file is part of YLP. // // YLP is free software: you can redistribute it and/or modify @@ -104,6 +104,9 @@ namespace YLP if (!IsWindow(hwnd)) return false; + if (!m_Scanner->IsModuleLoaded("socialclub.dll")) + return false; + std::this_thread::sleep_for(2s); return true; }, @@ -298,7 +301,7 @@ namespace YLP auto& pointers = (m_MonitorMode == MonitorLegacy) ? g_Pointers.Legacy : g_Pointers.Enhanced; pointers.Reset(); - std::this_thread::sleep_for(5s); + std::this_thread::sleep_for(20s); } } }