Fix geode checkbox and installed mods not showing restart

This commit is contained in:
altalk23 2023-09-08 15:07:11 +03:00
parent e557a551d8
commit b21ff6e234
3 changed files with 14 additions and 2 deletions

View file

@ -132,12 +132,14 @@ namespace geode {
void setAvailablePlatforms(std::unordered_set<PlatformID> const& value); void setAvailablePlatforms(std::unordered_set<PlatformID> const& value);
void setIsFeatured(bool const& value); void setIsFeatured(bool const& value);
void setTags(std::unordered_set<std::string> const& value); void setTags(std::unordered_set<std::string> const& value);
void setIsInstalled(bool const& value);
#endif #endif
IndexItem(); IndexItem();
~IndexItem(); ~IndexItem();
friend class ModMetadata; friend class ModMetadata;
friend class Index;
}; };
using IndexItemHandle = std::shared_ptr<IndexItem>; using IndexItemHandle = std::shared_ptr<IndexItem>;

View file

@ -53,7 +53,8 @@ private:
std::string m_downloadURL; std::string m_downloadURL;
std::string m_downloadHash; std::string m_downloadHash;
std::unordered_set<PlatformID> m_platforms; std::unordered_set<PlatformID> m_platforms;
bool m_isFeatured; bool m_isFeatured = false;
bool m_isInstalled = false;
std::unordered_set<std::string> m_tags; std::unordered_set<std::string> m_tags;
friend class IndexItem; friend class IndexItem;
@ -137,6 +138,10 @@ void IndexItem::setIsFeatured(bool const& value) {
void IndexItem::setTags(std::unordered_set<std::string> const& value) { void IndexItem::setTags(std::unordered_set<std::string> const& value) {
m_impl->m_tags = value; m_impl->m_tags = value;
} }
void IndexItem::setIsInstalled(bool const& value) {
m_impl->m_isInstalled = value;
}
#endif #endif
Result<IndexItemHandle> IndexItem::Impl::create(ghc::filesystem::path const& rootDir, ghc::filesystem::path const& dir) { Result<IndexItemHandle> IndexItem::Impl::create(ghc::filesystem::path const& rootDir, ghc::filesystem::path const& dir) {
@ -183,6 +188,9 @@ Result<IndexItemHandle> IndexItem::Impl::create(ghc::filesystem::path const& roo
} }
bool IndexItem::Impl::isInstalled() const { bool IndexItem::Impl::isInstalled() const {
if (m_isInstalled) {
return true;
}
if (!Loader::get()->isModInstalled(m_metadata.getID())) { if (!Loader::get()->isModInstalled(m_metadata.getID())) {
return false; return false;
} }
@ -751,6 +759,8 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
)); ));
} }
item->setIsInstalled(true);
// Install next item in queue // Install next item in queue
this->installNext(index + 1, list); this->installNext(index + 1, list);
}) })

View file

@ -314,7 +314,7 @@ bool ModCell::init(
} }
} }
if (m_mod->wasSuccessfullyLoaded()) { if (m_mod->wasSuccessfullyLoaded() && m_mod->getMetadata().getID() != "geode.loader") {
m_enableToggle = m_enableToggle =
CCMenuItemToggler::createWithStandardSprites(this, menu_selector(ModCell::onEnable), .7f); CCMenuItemToggler::createWithStandardSprites(this, menu_selector(ModCell::onEnable), .7f);
m_enableToggle->setPosition(-45.f, 0.f); m_enableToggle->setPosition(-45.f, 0.f);