hacky temporary fix for mods with old gd key syntax

This commit is contained in:
matcool 2024-06-14 00:32:38 -03:00
parent 84a2c6bc42
commit c1fbc08381
3 changed files with 18 additions and 0 deletions

View file

@ -440,6 +440,18 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) {
};
{ // version checking
if (auto reason = node->getMetadata().m_impl->m_softInvalidReason) {
this->addProblem({
LoadProblem::Type::InvalidFile,
node,
reason.value()
});
log::error("{}", reason.value());
m_refreshingModCount -= 1;
log::popNest();
return;
}
auto res = node->getMetadata().checkGameVersion();
if (!res) {
this->addProblem({

View file

@ -138,6 +138,9 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
auto key = PlatformID::toShortString(GEODE_PLATFORM_TARGET, true);
if (rawJson["gd"].contains(key) && rawJson["gd"][key].is_string())
ver = rawJson["gd"][key].as_string();
} else if (rawJson["gd"].is_string()) {
impl->m_softInvalidReason = "mod.json uses old syntax";
goto dontCheckVersion;
} else {
return Err("[mod.json] has invalid target GD version");
}
@ -158,6 +161,7 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
} else {
return Err("[mod.json] is missing target GD version");
}
dontCheckVersion:
root.needs("id")
// todo: make this use validateID in full 2.0.0 release

View file

@ -23,6 +23,8 @@ namespace geode {
std::string m_id;
std::string m_name;
std::vector<std::string> m_developers;
// TODO: remove once #895 is fixed
std::optional<std::string> m_softInvalidReason;
std::string m_gdVersion;
VersionInfo m_geodeVersion;
std::optional<std::string> m_description;