diff --git a/loader/include/Geode/loader/Loader.hpp b/loader/include/Geode/loader/Loader.hpp index 2ec88781..fa2a6743 100644 --- a/loader/include/Geode/loader/Loader.hpp +++ b/loader/include/Geode/loader/Loader.hpp @@ -38,6 +38,9 @@ namespace geode { UnzipFailed, UnsupportedVersion, UnsupportedGeodeVersion, + NeedsNewerGeodeVersion, + DisabledDependency, + OutdatedDependency, }; Type type; std::variant cause; diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 8add5818..1601595e 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -443,7 +443,7 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { node, res.unwrapErr() }); - log::error("Unsupported game version: {}", res.unwrapErr()); + log::error("Geometry Dash version {} is required to run this mod", res.unwrapErr()); m_refreshingModCount -= 1; log::popNest(); return; @@ -451,10 +451,10 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { if (!this->isModVersionSupported(node->getMetadata().getGeodeVersion())) { this->addProblem({ - LoadProblem::Type::UnsupportedGeodeVersion, + node->getMetadata().getGeodeVersion() > this->getVersion() ? LoadProblem::Type::NeedsNewerGeodeVersion : LoadProblem::Type::UnsupportedGeodeVersion, node, fmt::format( - "Geode version {} is not supported (current: {})", + "Geode version {}\nis required to run this mod\n(installed: {})", node->getMetadata().getGeodeVersion().toString(), this->getVersion().toString() ) @@ -539,13 +539,46 @@ void Loader::Impl::findProblems() { log::warn("{} recommends {} {}", id, dep.id, dep.version); break; case ModMetadata::Dependency::Importance::Required: - this->addProblem({ - LoadProblem::Type::MissingDependency, - mod, - fmt::format("{} {}", dep.id, dep.version.toString()) - }); - log::error("{} requires {} {}", id, dep.id, dep.version); - break; + if(m_mods.find(dep.id) == m_mods.end()) { + this->addProblem({ + LoadProblem::Type::MissingDependency, + mod, + fmt::format("{}", dep.id) + }); + log::error("{} requires {} {}", id, dep.id, dep.version); + break; + } else { + auto installedDependency = m_mods.at(dep.id); + + if(!installedDependency->isEnabled()) { + this->addProblem({ + LoadProblem::Type::DisabledDependency, + mod, + fmt::format("{}", dep.id) + }); + log::error("{} requires {} {}", id, dep.id, dep.version); + break; + } else if(!dep.version.compare(installedDependency->getVersion())) { + // TODO: this also fires on major version mismatch + this->addProblem({ + LoadProblem::Type::OutdatedDependency, + mod, + fmt::format("{}", dep.id) + }); + log::error("{} requires {} {}", id, dep.id, dep.version); + break; + } else { + // this should never happen i think? + // (major mismatch should eventually fall through here though once that's fixed) + this->addProblem({ + LoadProblem::Type::MissingDependency, + mod, + fmt::format("{}", dep.id) + }); + log::error("{} requires {} {}", id, dep.id, dep.version); + break; + } + } } } diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index f409b8c8..b494d99a 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -84,7 +84,15 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize break; case LoadProblem::Type::MissingDependency: icon = "info-alert.png"_spr; - message = fmt::format("{} depends on {}", cause, problem.message); + message = fmt::format("Install {} to use {}", problem.message, cause); + break; + case LoadProblem::Type::DisabledDependency: + icon = "info-alert.png"_spr; + message = fmt::format("Enable {} to use {}", problem.message, cause); + break; + case LoadProblem::Type::OutdatedDependency: + icon = "info-alert.png"_spr; + message = fmt::format("Update {} to use {}", problem.message, cause); break; case LoadProblem::Type::PresentIncompatibility: icon = "info-alert.png"_spr; @@ -105,6 +113,11 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize message = fmt::format("{} is incompatible with this version of Geode", cause); m_longMessage = problem.message; break; + case LoadProblem::Type::NeedsNewerGeodeVersion: + icon = "info-alert.png"_spr; + message = fmt::format("Update Geode to use {}", cause); + m_longMessage = problem.message; + break; } m_problem = std::move(problem);