fix conflicts with develop

This commit is contained in:
flow
2022-05-17 18:25:08 -03:00
51 changed files with 1899 additions and 2826 deletions

View File

@ -162,6 +162,11 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO
m_settings->registerSetting("JoinServerOnLaunch", false);
m_settings->registerSetting("JoinServerOnLaunchAddress", "");
// Miscellaneous
auto miscellaneousOverride = m_settings->registerSetting("OverrideMiscellaneous", false);
m_settings->registerOverride(globalSettings->getSetting("CloseAfterLaunch"), miscellaneousOverride);
m_settings->registerOverride(globalSettings->getSetting("QuitAfterGameStop"), miscellaneousOverride);
m_components.reset(new PackProfile(this));
}
@ -984,7 +989,7 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
{
process->setCensorFilter(createCensorFilterFromSession(session));
}
if(APPLICATION->settings()->get("QuitAfterGameStop").toBool())
if(m_settings->get("QuitAfterGameStop").toBool())
{
auto step = new QuitAfterGameStop(pptr);
process->appendStep(step);

View File

@ -25,7 +25,8 @@
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
{
if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
auto instance = parent->instance();
if (instance->settings()->get("CloseAfterLaunch").toBool())
{
std::shared_ptr<QMetaObject::Connection> connection{new QMetaObject::Connection};
*connection = connect(&m_process, &LoggedProcess::log, this, [=](QStringList lines, MessageLevel::Enum level) {
@ -168,7 +169,8 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state)
}
case LoggedProcess::Finished:
{
if (APPLICATION->settings()->get("CloseAfterLaunch").toBool())
auto instance = m_parent->instance();
if (instance->settings()->get("CloseAfterLaunch").toBool())
APPLICATION->showMainWindow();
m_parent->setPid(-1);

View File

@ -8,6 +8,7 @@
#include <quazip/quazipfile.h>
#include <toml.h>
#include "Json.h"
#include "settings/INIFile.h"
#include "FileSystem.h"
@ -262,6 +263,44 @@ std::shared_ptr<ModDetails> ReadFabricModInfo(QByteArray contents)
return details;
}
// https://github.com/QuiltMC/rfcs/blob/master/specification/0002-quilt.mod.json.md
std::shared_ptr<ModDetails> ReadQuiltModInfo(QByteArray contents)
{
QJsonParseError jsonError;
QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError);
auto object = Json::requireObject(jsonDoc, "quilt.mod.json");
auto schemaVersion = Json::ensureInteger(object.value("schema_version"), 0, "Quilt schema_version");
std::shared_ptr<ModDetails> details = std::make_shared<ModDetails>();
// https://github.com/QuiltMC/rfcs/blob/be6ba280d785395fefa90a43db48e5bfc1d15eb4/specification/0002-quilt.mod.json.md
if (schemaVersion == 1)
{
auto modInfo = Json::requireObject(object.value("quilt_loader"), "Quilt mod info");
details->mod_id = Json::requireString(modInfo.value("id"), "Mod ID");
details->version = Json::requireString(modInfo.value("version"), "Mod version");
auto modMetadata = Json::ensureObject(modInfo.value("metadata"));
details->name = Json::ensureString(modMetadata.value("name"), details->mod_id);
details->description = Json::ensureString(modMetadata.value("description"));
auto modContributors = Json::ensureObject(modMetadata.value("contributors"));
// We don't really care about the role of a contributor here
details->authors += modContributors.keys();
auto modContact = Json::ensureObject(modMetadata.value("contact"));
if (modContact.contains("homepage"))
{
details->homeurl = Json::requireString(modContact.value("homepage"));
}
}
return details;
}
std::shared_ptr<ModDetails> ReadForgeInfo(QByteArray contents)
{
std::shared_ptr<ModDetails> details = std::make_shared<ModDetails>();
@ -391,7 +430,7 @@ void LocalModParseTask::processAsZip()
zip.close();
return;
}
else if (zip.setCurrentFile("fabric.mod.json")) // TODO: Support quilt.mod.json
else if (zip.setCurrentFile("fabric.mod.json"))
{
if (!file.open(QIODevice::ReadOnly))
{
@ -404,6 +443,19 @@ void LocalModParseTask::processAsZip()
zip.close();
return;
}
else if (zip.setCurrentFile("quilt.mod.json"))
{
if (!file.open(QIODevice::ReadOnly))
{
zip.close();
return;
}
m_result->details = ReadQuiltModInfo(file.readAll());
file.close();
zip.close();
return;
}
else if (zip.setCurrentFile("forgeversion.properties"))
{
if (!file.open(QIODevice::ReadOnly))