From b21ff6e23476559e1290d1342da6322d60360388 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:07:11 +0300 Subject: [PATCH] Fix geode checkbox and installed mods not showing restart --- loader/include/Geode/loader/Index.hpp | 2 ++ loader/src/loader/Index.cpp | 12 +++++++++++- loader/src/ui/internal/list/ModListCell.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/loader/include/Geode/loader/Index.hpp b/loader/include/Geode/loader/Index.hpp index fda97552..4e75565b 100644 --- a/loader/include/Geode/loader/Index.hpp +++ b/loader/include/Geode/loader/Index.hpp @@ -132,12 +132,14 @@ namespace geode { void setAvailablePlatforms(std::unordered_set const& value); void setIsFeatured(bool const& value); void setTags(std::unordered_set const& value); + void setIsInstalled(bool const& value); #endif IndexItem(); ~IndexItem(); friend class ModMetadata; + friend class Index; }; using IndexItemHandle = std::shared_ptr; diff --git a/loader/src/loader/Index.cpp b/loader/src/loader/Index.cpp index d4b0519f..80fe7212 100644 --- a/loader/src/loader/Index.cpp +++ b/loader/src/loader/Index.cpp @@ -53,7 +53,8 @@ private: std::string m_downloadURL; std::string m_downloadHash; std::unordered_set m_platforms; - bool m_isFeatured; + bool m_isFeatured = false; + bool m_isInstalled = false; std::unordered_set m_tags; friend class IndexItem; @@ -137,6 +138,10 @@ void IndexItem::setIsFeatured(bool const& value) { void IndexItem::setTags(std::unordered_set const& value) { m_impl->m_tags = value; } + +void IndexItem::setIsInstalled(bool const& value) { + m_impl->m_isInstalled = value; +} #endif Result IndexItem::Impl::create(ghc::filesystem::path const& rootDir, ghc::filesystem::path const& dir) { @@ -183,6 +188,9 @@ Result IndexItem::Impl::create(ghc::filesystem::path const& roo } bool IndexItem::Impl::isInstalled() const { + if (m_isInstalled) { + return true; + } if (!Loader::get()->isModInstalled(m_metadata.getID())) { return false; } @@ -751,6 +759,8 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) { )); } + item->setIsInstalled(true); + // Install next item in queue this->installNext(index + 1, list); }) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index c91df888..3c9c199d 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -314,7 +314,7 @@ bool ModCell::init( } } - if (m_mod->wasSuccessfullyLoaded()) { + if (m_mod->wasSuccessfullyLoaded() && m_mod->getMetadata().getID() != "geode.loader") { m_enableToggle = CCMenuItemToggler::createWithStandardSprites(this, menu_selector(ModCell::onEnable), .7f); m_enableToggle->setPosition(-45.f, 0.f);