mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
add more user friendly dependency messages
This commit is contained in:
parent
264f773e80
commit
f1ddc568e0
3 changed files with 60 additions and 11 deletions
|
@ -38,6 +38,9 @@ namespace geode {
|
||||||
UnzipFailed,
|
UnzipFailed,
|
||||||
UnsupportedVersion,
|
UnsupportedVersion,
|
||||||
UnsupportedGeodeVersion,
|
UnsupportedGeodeVersion,
|
||||||
|
NeedsNewerGeodeVersion,
|
||||||
|
DisabledDependency,
|
||||||
|
OutdatedDependency,
|
||||||
};
|
};
|
||||||
Type type;
|
Type type;
|
||||||
std::variant<ghc::filesystem::path, ModMetadata, Mod*> cause;
|
std::variant<ghc::filesystem::path, ModMetadata, Mod*> cause;
|
||||||
|
|
|
@ -443,7 +443,7 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) {
|
||||||
node,
|
node,
|
||||||
res.unwrapErr()
|
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;
|
m_refreshingModCount -= 1;
|
||||||
log::popNest();
|
log::popNest();
|
||||||
return;
|
return;
|
||||||
|
@ -451,10 +451,10 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) {
|
||||||
|
|
||||||
if (!this->isModVersionSupported(node->getMetadata().getGeodeVersion())) {
|
if (!this->isModVersionSupported(node->getMetadata().getGeodeVersion())) {
|
||||||
this->addProblem({
|
this->addProblem({
|
||||||
LoadProblem::Type::UnsupportedGeodeVersion,
|
node->getMetadata().getGeodeVersion() > this->getVersion() ? LoadProblem::Type::NeedsNewerGeodeVersion : LoadProblem::Type::UnsupportedGeodeVersion,
|
||||||
node,
|
node,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Geode version {} is not supported (current: {})",
|
"Geode version {}\nis required to run this mod\n(installed: {})",
|
||||||
node->getMetadata().getGeodeVersion().toString(),
|
node->getMetadata().getGeodeVersion().toString(),
|
||||||
this->getVersion().toString()
|
this->getVersion().toString()
|
||||||
)
|
)
|
||||||
|
@ -539,13 +539,46 @@ void Loader::Impl::findProblems() {
|
||||||
log::warn("{} recommends {} {}", id, dep.id, dep.version);
|
log::warn("{} recommends {} {}", id, dep.id, dep.version);
|
||||||
break;
|
break;
|
||||||
case ModMetadata::Dependency::Importance::Required:
|
case ModMetadata::Dependency::Importance::Required:
|
||||||
|
if(m_mods.find(dep.id) == m_mods.end()) {
|
||||||
this->addProblem({
|
this->addProblem({
|
||||||
LoadProblem::Type::MissingDependency,
|
LoadProblem::Type::MissingDependency,
|
||||||
mod,
|
mod,
|
||||||
fmt::format("{} {}", dep.id, dep.version.toString())
|
fmt::format("{}", dep.id)
|
||||||
});
|
});
|
||||||
log::error("{} requires {} {}", id, dep.id, dep.version);
|
log::error("{} requires {} {}", id, dep.id, dep.version);
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,15 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize
|
||||||
break;
|
break;
|
||||||
case LoadProblem::Type::MissingDependency:
|
case LoadProblem::Type::MissingDependency:
|
||||||
icon = "info-alert.png"_spr;
|
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;
|
break;
|
||||||
case LoadProblem::Type::PresentIncompatibility:
|
case LoadProblem::Type::PresentIncompatibility:
|
||||||
icon = "info-alert.png"_spr;
|
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);
|
message = fmt::format("{} is incompatible with this version of Geode", cause);
|
||||||
m_longMessage = problem.message;
|
m_longMessage = problem.message;
|
||||||
break;
|
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);
|
m_problem = std::move(problem);
|
||||||
|
|
Loading…
Reference in a new issue