fix: serialize metadata extensions

Prism has introduced a few extensions to the meta component version
format, which were not exported as JSON in the launcher. This caused the
`Customize` button on the version page to not write these new properties
to the custom component file.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-11-16 18:11:17 +01:00
parent 8aae652be1
commit 40970a1a87
No known key found for this signature in database
GPG Key ID: C10411294912A422
2 changed files with 23 additions and 0 deletions

View File

@ -306,6 +306,15 @@ void MojangVersionFormat::writeVersionProperties(const VersionFile* in, QJsonObj
}
out.insert("downloads", downloadsOut);
}
if(in->compatibleJavaMajors.size())
{
QJsonArray compatibleJavaMajorsOut;
for(auto compatibleJavaMajor : in->compatibleJavaMajors)
{
compatibleJavaMajorsOut.append(compatibleJavaMajor);
}
out.insert("compatibleJavaMajors", compatibleJavaMajorsOut);
}
}
QJsonDocument MojangVersionFormat::versionFileToJson(const VersionFilePtr &patch)

View File

@ -331,6 +331,20 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
writeString(root, "appletClass", patch->appletClass);
writeStringList(root, "+tweakers", patch->addTweakers);
writeStringList(root, "+traits", patch->traits.values());
writeStringList(root, "+jvmArgs", patch->addnJvmArguments);
if (!patch->agents.isEmpty())
{
QJsonArray array;
for (auto value: patch->agents)
{
QJsonObject agentOut = OneSixVersionFormat::libraryToJson(value->library().get());
if (!value->argument().isEmpty())
agentOut.insert("argument", value->argument());
array.append(agentOut);
}
root.insert("+agents", array);
}
if (!patch->libraries.isEmpty())
{
QJsonArray array;