aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-02 18:35:35 +0200
commit1d468ac35ad88d8c77cc83f25e3704d9bd7df01b (patch)
tree8644b1574c947a1a87c5c7b2567f746cfe17882f /launcher/modplatform
parentce2ca1381519a2e261d7f76dffa874d559d979c2 (diff)
downloadPrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.gz
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.tar.bz2
PrismLauncher-1d468ac35ad88d8c77cc83f25e3704d9bd7df01b.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/modplatform')
-rw-r--r--launcher/modplatform/CheckUpdateTask.h17
-rw-r--r--launcher/modplatform/EnsureMetadataTask.h5
-rw-r--r--launcher/modplatform/ModIndex.cpp30
-rw-r--r--launcher/modplatform/atlauncher/ATLPackIndex.cpp11
-rw-r--r--launcher/modplatform/atlauncher/ATLPackIndex.h15
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.cpp349
-rw-r--r--launcher/modplatform/atlauncher/ATLPackManifest.cpp114
-rw-r--r--launcher/modplatform/atlauncher/ATLPackManifest.h48
-rw-r--r--launcher/modplatform/atlauncher/ATLShareCode.cpp2
-rw-r--r--launcher/modplatform/atlauncher/ATLShareCode.h4
-rw-r--r--launcher/modplatform/flame/FlameCheckUpdate.h5
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.cpp9
-rw-r--r--launcher/modplatform/flame/PackManifest.cpp7
-rw-r--r--launcher/modplatform/flame/PackManifest.h34
-rw-r--r--launcher/modplatform/legacy_ftb/PackFetchTask.cpp2
-rw-r--r--launcher/modplatform/legacy_ftb/PackHelpers.h22
-rw-r--r--launcher/modplatform/legacy_ftb/PrivatePackManager.cpp19
-rw-r--r--launcher/modplatform/legacy_ftb/PrivatePackManager.h30
-rw-r--r--launcher/modplatform/modrinth/ModrinthCheckUpdate.h5
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp24
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.h5
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp25
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.h9
-rw-r--r--launcher/modplatform/packwiz/Packwiz.h54
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.cpp39
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.h16
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp36
-rw-r--r--launcher/modplatform/technic/SolderPackManifest.cpp2
-rw-r--r--launcher/modplatform/technic/SolderPackManifest.h4
-rw-r--r--launcher/modplatform/technic/TechnicPackProcessor.cpp102
-rw-r--r--launcher/modplatform/technic/TechnicPackProcessor.h29
31 files changed, 454 insertions, 619 deletions
diff --git a/launcher/modplatform/CheckUpdateTask.h b/launcher/modplatform/CheckUpdateTask.h
index f7582b8f..6d968ea4 100644
--- a/launcher/modplatform/CheckUpdateTask.h
+++ b/launcher/modplatform/CheckUpdateTask.h
@@ -1,8 +1,8 @@
#pragma once
#include "minecraft/mod/Mod.h"
-#include "modplatform/ResourceAPI.h"
#include "modplatform/ModIndex.h"
+#include "modplatform/ResourceAPI.h"
#include "tasks/Task.h"
class ResourceDownloadTask;
@@ -12,8 +12,11 @@ class CheckUpdateTask : public Task {
Q_OBJECT
public:
- CheckUpdateTask(QList<Mod*>& mods, std::list<Version>& mcVersions, std::optional<ResourceAPI::ModLoaderTypes> loaders, std::shared_ptr<ModFolderModel> mods_folder)
- : Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders(loaders), m_mods_folder(mods_folder) {};
+ CheckUpdateTask(QList<Mod*>& mods,
+ std::list<Version>& mcVersions,
+ std::optional<ResourceAPI::ModLoaderTypes> loaders,
+ std::shared_ptr<ModFolderModel> mods_folder)
+ : Task(nullptr), m_mods(mods), m_game_versions(mcVersions), m_loaders(loaders), m_mods_folder(mods_folder){};
struct UpdatableMod {
QString name;
@@ -25,7 +28,13 @@ class CheckUpdateTask : public Task {
shared_qobject_ptr<ResourceDownloadTask> download;
public:
- UpdatableMod(QString name, QString old_h, QString old_v, QString new_v, QString changelog, ModPlatform::ResourceProvider p, shared_qobject_ptr<ResourceDownloadTask> t)
+ UpdatableMod(QString name,
+ QString old_h,
+ QString old_v,
+ QString new_v,
+ QString changelog,
+ ModPlatform::ResourceProvider p,
+ shared_qobject_ptr<ResourceDownloadTask> t)
: name(name), old_hash(old_h), old_version(old_v), new_version(new_v), changelog(changelog), provider(p), download(t)
{}
};
diff --git a/launcher/modplatform/EnsureMetadataTask.h b/launcher/modplatform/EnsureMetadataTask.h
index 03cae4e4..2f276e5a 100644
--- a/launcher/modplatform/EnsureMetadataTask.h
+++ b/launcher/modplatform/EnsureMetadataTask.h
@@ -35,10 +35,7 @@ class EnsureMetadataTask : public Task {
auto flameProjectsTask() -> Task::Ptr;
// Helpers
- enum class RemoveFromList {
- Yes,
- No
- };
+ enum class RemoveFromList { Yes, No };
void emitReady(Mod*, QString key = {}, RemoveFromList = RemoveFromList::Yes);
void emitFail(Mod*, QString key = {}, RemoveFromList = RemoveFromList::Yes);
diff --git a/launcher/modplatform/ModIndex.cpp b/launcher/modplatform/ModIndex.cpp
index a1c4d891..ecea0d8c 100644
--- a/launcher/modplatform/ModIndex.cpp
+++ b/launcher/modplatform/ModIndex.cpp
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
+ * PolyMC - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
#include "modplatform/ModIndex.h"
diff --git a/launcher/modplatform/atlauncher/ATLPackIndex.cpp b/launcher/modplatform/atlauncher/ATLPackIndex.cpp
index e649c43a..3be16973 100644
--- a/launcher/modplatform/atlauncher/ATLPackIndex.cpp
+++ b/launcher/modplatform/atlauncher/ATLPackIndex.cpp
@@ -21,23 +21,20 @@
#include "Json.h"
-static void loadIndexedVersion(ATLauncher::IndexedVersion & v, QJsonObject & obj)
+static void loadIndexedVersion(ATLauncher::IndexedVersion& v, QJsonObject& obj)
{
v.version = Json::requireString(obj, "version");
v.minecraft = Json::requireString(obj, "minecraft");
}
-void ATLauncher::loadIndexedPack(ATLauncher::IndexedPack & m, QJsonObject & obj)
+void ATLauncher::loadIndexedPack(ATLauncher::IndexedPack& m, QJsonObject& obj)
{
m.id = Json::requireInteger(obj, "id");
m.position = Json::requireInteger(obj, "position");
m.name = Json::requireString(obj, "name");
- m.type = Json::requireString(obj, "type") == "private" ?
- ATLauncher::PackType::Private :
- ATLauncher::PackType::Public;
+ m.type = Json::requireString(obj, "type") == "private" ? ATLauncher::PackType::Private : ATLauncher::PackType::Public;
auto versionsArr = Json::requireArray(obj, "versions");
- for (const auto versionRaw : versionsArr)
- {
+ for (const auto versionRaw : versionsArr) {
auto versionObj = Json::requireObject(versionRaw);
ATLauncher::IndexedVersion version;
loadIndexedVersion(version, versionObj);
diff --git a/launcher/modplatform/atlauncher/ATLPackIndex.h b/launcher/modplatform/atlauncher/ATLPackIndex.h
index 337b80b8..8d18c671 100644
--- a/launcher/modplatform/atlauncher/ATLPackIndex.h
+++ b/launcher/modplatform/atlauncher/ATLPackIndex.h
@@ -18,21 +18,18 @@
#include "ATLPackManifest.h"
+#include <QMetaType>
#include <QString>
#include <QVector>
-#include <QMetaType>
-namespace ATLauncher
-{
+namespace ATLauncher {
-struct IndexedVersion
-{
+struct IndexedVersion {
QString version;
QString minecraft;
};
-struct IndexedPack
-{
+struct IndexedPack {
int id;
int position;
QString name;
@@ -44,7 +41,7 @@ struct IndexedPack
QString safeName;
};
-void loadIndexedPack(IndexedPack & m, QJsonObject & obj);
-}
+void loadIndexedPack(IndexedPack& m, QJsonObject& obj);
+} // namespace ATLauncher
Q_DECLARE_METATYPE(ATLauncher::IndexedPack)
diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
index 82a51c27..1ac527bc 100644
--- a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
+++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
@@ -40,27 +40,27 @@
#include <quazip/quazip.h>
-#include "MMCZip.h"
-#include "minecraft/OneSixVersionFormat.h"
-#include "Version.h"
-#include "net/ChecksumValidator.h"
#include "FileSystem.h"
#include "Json.h"
-#include "minecraft/MinecraftInstance.h"
-#include "minecraft/PackProfile.h"
-#include "settings/INISettingsObject.h"
+#include "MMCZip.h"
+#include "Version.h"
#include "meta/Index.h"
#include "meta/Version.h"
#include "meta/VersionList.h"
+#include "minecraft/MinecraftInstance.h"
+#include "minecraft/OneSixVersionFormat.h"
+#include "minecraft/PackProfile.h"
+#include "net/ChecksumValidator.h"
+#include "settings/INISettingsObject.h"
-#include "BuildConfig.h"
#include "Application.h"
+#include "BuildConfig.h"
namespace ATLauncher {
static Meta::Version::Ptr getComponentVersion(const QString& uid, const QString& version);
-PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString packName, QString version, InstallMode installMode)
+PackInstallTask::PackInstallTask(UserInteractionSupport* support, QString packName, QString version, InstallMode installMode)
{
m_support = support;
m_pack_name = packName;
@@ -71,8 +71,7 @@ PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString packNa
bool PackInstallTask::abort()
{
- if(abortable)
- {
+ if (abortable) {
return jobPtr->abort();
}
return false;
@@ -110,12 +109,9 @@ void PackInstallTask::onDownloadSucceeded()
auto obj = doc.object();
ATLauncher::PackVersion version;
- try
- {
+ try {
ATLauncher::loadVersion(version, obj);
- }
- catch (const JSONValidationError &e)
- {
+ } catch (const JSONValidationError& e) {
emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
return;
}
@@ -126,20 +122,20 @@ void PackInstallTask::onDownloadSucceeded()
bool resetDirectory;
switch (m_install_mode) {
- case InstallMode::Reinstall:
- case InstallMode::Update:
- message = m_version.messages.update;
- resetDirectory = true;
- break;
-
- case InstallMode::Install:
- message = m_version.messages.install;
- resetDirectory = false;
- break;
-
- default:
- emitFailed(tr("Unsupported installation mode"));
- return;
+ case InstallMode::Reinstall:
+ case InstallMode::Update:
+ message = m_version.messages.update;
+ resetDirectory = true;
+ break;
+
+ case InstallMode::Install:
+ message = m_version.messages.install;
+ resetDirectory = false;
+ break;
+
+ default:
+ emitFailed(tr("Unsupported installation mode"));
+ return;
}
// Display message if one exists
@@ -157,10 +153,9 @@ void PackInstallTask::onDownloadSucceeded()
deleteExistingFiles();
}
- if(m_version.noConfigs) {
+ if (m_version.noConfigs) {
downloadMods();
- }
- else {
+ } else {
installConfigs();
}
}
@@ -212,11 +207,9 @@ void PackInstallTask::deleteExistingFiles()
if (base == "root") {
return minecraftPath;
- }
- else if (base == "config") {
+ } else if (base == "config") {
return FS::PathCombine(minecraftPath, "config");
- }
- else {
+ } else {
qWarning() << "Unrecognised base path" << base;
return minecraftPath;
}
@@ -338,19 +331,18 @@ QString PackInstallTask::getDirForModType(ModType type, QString raw)
QString PackInstallTask::getVersionForLoader(QString uid)
{
- if(m_version.loader.recommended || m_version.loader.latest || m_version.loader.choose) {
+ if (m_version.loader.recommended || m_version.loader.latest || m_version.loader.choose) {
auto vlist = APPLICATION->metadataIndex()->get(uid);
- if(!vlist)
- {
+ if (!vlist) {
emitFailed(tr("Failed to get local metadata index for %1").arg(uid));
return Q_NULLPTR;
}
- if(!vlist->isLoaded()) {
+ if (!vlist->isLoaded()) {
vlist->load(Net::Mode::Online);
}
- if(m_version.loader.recommended || m_version.loader.latest) {
+ if (m_version.loader.recommended || m_version.loader.latest) {
for (int i = 0; i < vlist->versions().size(); i++) {
auto version = vlist->versions().at(i);
auto reqs = version->requiredSet();
@@ -359,16 +351,17 @@ QString PackInstallTask::getVersionForLoader(QString uid)
// not all mod loaders depend on a given Minecraft version, so we won't do this
// filtering for those loaders.
if (m_version.loader.type != "fabric") {
- auto iter = std::find_if(reqs.begin(), reqs.end(), [](const Meta::Require &req) {
- return req.uid == "net.minecraft";
- });
- if (iter == reqs.end()) continue;
- if (iter->equalsVersion != m_version.minecraft) continue;
+ auto iter = std::find_if(reqs.begin(), reqs.end(), [](const Meta::Require& req) { return req.uid == "net.minecraft"; });
+ if (iter == reqs.end())
+ continue;
+ if (iter->equalsVersion != m_version.minecraft)
+ continue;
}
if (m_version.loader.recommended) {
// first recommended build we find, we use.
- if (!version->isRecommended()) continue;
+ if (!version->isRecommended())
+ continue;
}
return version->descriptor();
@@ -376,8 +369,7 @@ QString PackInstallTask::getVersionForLoader(QString uid)
emitFailed(tr("Failed to find version for %1 loader").arg(m_version.loader.type));
return Q_NULLPTR;
- }
- else if(m_version.loader.choose) {
+ } else if (m_version.loader.choose) {
// Fabric Loader doesn't depend on a given Minecraft version.
if (m_version.loader.type == "fabric") {
return m_support->chooseVersion(vlist, Q_NULLPTR);
@@ -414,15 +406,14 @@ QString PackInstallTask::detectLibrary(VersionLibrary library)
return group + ":" + artefact + ":" + version;
}
- if(library.file.contains("-")) {
+ if (library.file.contains("-")) {
auto lastSlash = library.file.lastIndexOf("-");
auto name = library.file.mid(0, lastSlash);
auto version = library.file.mid(lastSlash + 1).remove(".jar");
- if(name == QString("guava")) {
+ if (name == QString("guava")) {
return "com.google.guava:guava:" + version;
- }
- else if(name == QString("commons-lang3")) {
+ } else if (name == QString("commons-lang3")) {
return "org.apache.commons:commons-lang3:" + version;
}
}
@@ -432,22 +423,22 @@ QString PackInstallTask::detectLibrary(VersionLibrary library)
bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared_ptr<PackProfile> profile)
{
- if(m_version.libraries.isEmpty()) {
+ if (m_version.libraries.isEmpty()) {
return true;
}
QList<GradleSpecifier> exempt;
- for(const auto & componentUid : componentsToInstall.keys()) {
+ for (const auto& componentUid : componentsToInstall.keys()) {
auto componentVersion = componentsToInstall.value(componentUid);
- for(const auto & library : componentVersion->data()->libraries) {
+ for (const auto& library : componentVersion->data()->libraries) {
GradleSpecifier lib(library->rawName());
exempt.append(lib);
}
}
{
- for(const auto & library : minecraftVersion->data()->libraries) {
+ for (const auto& library : minecraftVersion->data()->libraries) {
GradleSpecifier lib(library->rawName());
exempt.append(lib);
}
@@ -458,8 +449,7 @@ bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared
auto target_id = "org.multimc.atlauncher." + id;
auto patchDir = FS::PathCombine(instanceRoot, "patches");
- if(!FS::ensureFolderPathExists(patchDir))
- {
+ if (!FS::ensureFolderPathExists(patchDir)) {
return false;
}
auto patchFileName = FS::PathCombine(patchDir, target_id + ".json");
@@ -468,38 +458,24 @@ bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared
f->name = m_pack_name + " " + m_version_name + " (libraries)";
const static QMap<QString, QString> liteLoaderMap = {
- { "61179803bcd5fb7790789b790908663d", "1.12-SNAPSHOT" },
- { "1420785ecbfed5aff4a586c5c9dd97eb", "1.12.2-SNAPSHOT" },
- { "073f68e2fcb518b91fd0d99462441714", "1.6.2_03" },
- { "10a15b52fc59b1bfb9c05b56de1097d6", "1.6.2_02" },
- { "b52f90f08303edd3d4c374e268a5acf1", "1.6.2_04" },
- { "ea747e24e03e24b7cad5bc8a246e0319", "1.6.2_01" },
- { "55785ccc82c07ff0ba038fe24be63ea2", "1.7.10_01" },
- { "63ada46e033d0cb6782bada09ad5ca4e", "1.7.10_04" },
- { "7983e4b28217c9ae8569074388409c86", "1.7.10_03" },
- { "c09882458d74fe0697c7681b8993097e", "1.7.10_02" },
- { "db7235aefd407ac1fde09a7baba50839", "1.7.10_00" },
- { "6e9028816027f53957bd8fcdfabae064", "1.8" },
- { "5e732dc446f9fe2abe5f9decaec40cde", "1.10-SNAPSHOT" },
- { "3a98b5ed95810bf164e71c1a53be568d", "1.11.2-SNAPSHOT" },
- { "ba8e6285966d7d988a96496f48cbddaa", "1.8.9-SNAPSHOT" },
- { "8524af3ac3325a82444cc75ae6e9112f", "1.11-SNAPSHOT" },
- { "53639d52340479ccf206a04f5e16606f", "1.5.2_01" },
- { "1fcdcf66ce0a0806b7ad8686afdce3f7", "1.6.4_00" },
- { "531c116f71ae2b11033f9a11a0f8e668", "1.6.4_01" },
- { "4009eeb99c9068f608d3483a6439af88", "1.7.2_03" },
- { "66f343354b8417abce1a10d557d2c6e9", "1.7.2_04" },
- { "ab554c21f28fbc4ae9b098bcb5f4cceb", "1.7.2_05" },
- { "e1d76a05a3723920e2f80a5e66c45f16", "1.7.2_02" },
- { "00318cb0c787934d523f63cdfe8ddde4", "1.9-SNAPSHOT" },
- { "986fd1ee9525cb0dcab7609401cef754", "1.9.4-SNAPSHOT" },
- { "571ad5e6edd5ff40259570c9be588bb5", "1.9.4" },
- { "1cdd72f7232e45551f16cc8ffd27ccf3", "1.10.2-SNAPSHOT" },
- { "8a7c21f32d77ee08b393dd3921ced8eb", "1.10.2" },
- { "b9bef8abc8dc309069aeba6fbbe58980", "1.12.1-SNAPSHOT" }
+ { "61179803bcd5fb7790789b790908663d", "1.12-SNAPSHOT" }, { "1420785ecbfed5aff4a586c5c9dd97eb", "1.12.2-SNAPSHOT" },
+ { "073f68e2fcb518b91fd0d99462441714", "1.6.2_03" }, { "10a15b52fc59b1bfb9c05b56de1097d6", "1.6.2_02" },
+ { "b52f90f08303edd3d4c374e268a5acf1", "1.6.2_04" }, { "ea747e24e03e24b7cad5bc8a246e0319", "1.6.2_01" },
+ { "55785ccc82c07ff0ba038fe24be63ea2", "1.7.10_01" }, { "63ada46e033d0cb6782bada09ad5ca4e", "1.7.10_04" },
+ { "7983e4b28217c9ae8569074388409c86", "1.7.10_03" }, { "c09882458d74fe0697c7681b8993097e", "1.7.10_02" },
+ { "db7235aefd407ac1fde09a7baba50839", "1.7.10_00" }, { "6e9028816027f53957bd8fcdfabae064", "1.8" },
+ { "5e732dc446f9fe2abe5f9decaec40cde", "1.10-SNAPSHOT" }, { "3a98b5ed95810bf164e71c1a53be568d", "1.11.2-SNAPSHOT" },
+ { "ba8e6285966d7d988a96496f48cbddaa", "1.8.9-SNAPSHOT" }, { "8524af3ac3325a82444cc75ae6e9112f", "1.11-SNAPSHOT" },
+ { "53639d52340479ccf206a04f5e16606f", "1.5.2_01" }, { "1fcdcf66ce0a0806b7ad8686afdce3f7", "1.6.4_00" },
+ { "531c116f71ae2b11033f9a11a0f8e668", "1.6.4_01" }, { "4009eeb99c9068f608d3483a6439af88", "1.7.2_03" },
+ { "66f343354b8417abce1a10d557d2c6e9", "1.7.2_04" }, { "ab554c21f28fbc4ae9b098bcb5f4cceb", "1.7.2_05" },
+ { "e1d76a05a3723920e2f80a5e66c45f16", "1.7.2_02" }, { "00318cb0c787934d523f63cdfe8ddde4", "1.9-SNAPSHOT" },
+ { "986fd1ee9525cb0dcab7609401cef754", "1.9.4-SNAPSHOT" }, { "571ad5e6edd5ff40259570c9be588bb5", "1.9.4" },
+ { "1cdd72f7232e45551f16cc8ffd27ccf3", "1.10.2-SNAPSHOT" }, { "8a7c21f32d77ee08b393dd3921ced8eb", "1.10.2" },
+ { "b9bef8abc8dc309069aeba6fbbe58980", "1.12.1-SNAPSHOT" }
};
- for(const auto & lib : m_version.libraries) {
+ for (const auto& lib : m_version.libraries) {
// If the library is LiteLoader, we need to ignore it and handle it separately.
if (liteLoaderMap.contains(lib.md5)) {
auto ver = getComponentVersion("com.mumfrey.liteloader", liteLoaderMap.value(lib.md5));
@@ -513,18 +489,19 @@ bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared
GradleSpecifier libSpecifier(libName);
bool libExempt = false;
- for(const auto & existingLib : exempt) {
- if(libSpecifier.matchName(existingLib)) {
+ for (const auto& existingLib : exempt) {
+ if (libSpecifier.matchName(existingLib)) {
// If the pack specifies a newer version of the lib, use that!
libExempt = Version(libSpecifier.version()) >= Version(existingLib.version());
}
}
- if(libExempt) continue;
+ if (libExempt)
+ continue;
auto library = std::make_shared<Library>();
library->setRawName(libName);
- switch(lib.download) {
+ switch (lib.download) {
case DownloadType::Server:
library->setAbsoluteUrl(BuildConfig.ATL_DOWNLOAD_SERVER_URL + lib.url);
break;
@@ -540,15 +517,13 @@ bool PackInstallTask::createLibrariesComponent(QString instanceRoot, std::shared
f->libraries.append(library);
}
- if(f->libraries.isEmpty()) {
+ if (f->libraries.isEmpty()) {
return true;
}
QFile file(patchFileName);
- if (!file.open(QFile::WriteOnly))
- {
- qCritical() << "Error opening" << file.fileName()
- << "for reading:" << file.errorString();
+ if (!file.open(QFile::WriteOnly)) {
+ qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString();
return false;
}
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
@@ -593,18 +568,17 @@ bool PackInstallTask::createPackComponent(QString instanceRoot, std::shared_ptr<
auto target_id = "org.multimc.atlauncher." + id;
auto patchDir = FS::PathCombine(instanceRoot, "patches");
- if(!FS::ensureFolderPathExists(patchDir))
- {
+ if (!FS::ensureFolderPathExists(patchDir)) {
return false;
}
auto patchFileName = FS::PathCombine(patchDir, target_id + ".json");
QStringList mainClasses;
QStringList tweakers;
- for(const auto & componentUid : componentsToInstall.keys()) {
+ for (const auto& componentUid : componentsToInstall.keys()) {
auto componentVersion = componentsToInstall.value(componentUid);
- if(componentVersion->data()->mainClass != QString("")) {
+ if (componentVersion->data()->mainClass != QString("")) {
mainClasses.append(componentVersion->data()->mainClass);
}
tweakers.append(componentVersion->data()->addTweakers);
@@ -619,25 +593,24 @@ bool PackInstallTask::createPackComponent(QString instanceRoot, std::shared_ptr<
// Parse out tweakers
auto args = extraArguments.split(" ");
QString previous;
- for(auto arg : args) {
- if(arg.startsWith("--tweakClass=") || previous == "--tweakClass") {
+ for (auto arg : args) {
+ if (arg.startsWith("--tweakClass=") || previous == "--tweakClass") {
auto tweakClass = arg.remove("--tweakClass=");
- if(tweakers.contains(tweakClass)) continue;
+ if (tweakers.contains(tweakClass))
+ continue;
f->addTweakers.append(tweakClass);
}
previous = arg;
}
- if(f->mainClass == QString() && f->addTweakers.isEmpty()) {
+ if (f->mainClass == QString() && f->addTweakers.isEmpty()) {
return true;
}
QFile file(patchFileName);
- if (!file.open(QFile::WriteOnly))
- {
- qCritical() << "Error opening" << file.fileName()
- << "for reading:" << file.errorString();
+ if (!file.open(QFile::WriteOnly)) {
+ qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString();
return false;
}
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
@@ -654,8 +627,7 @@ void PackInstallTask::installConfigs()
jobPtr.reset(new NetJob(tr("Config download"), APPLICATION->network()));
auto path = QString("Configs/%1/%2.zip").arg(m_pack_safe_name).arg(m_version_name);
- auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip")
- .arg(m_pack_safe_name).arg(m_version_name);
+ auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip").arg(m_pack_safe_name).arg(m_version_name);
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path);
entry->setStale(true);
@@ -667,25 +639,22 @@ void PackInstallTask::installConfigs()
jobPtr->addNetAction(dl);
archivePath = entry->getFullPath();
- connect(jobPtr.get(), &NetJob::succeeded, this, [&]()
- {
+ connect(jobPtr.get(), &NetJob::succeeded, this, [&]() {
abortable = false;
jobPtr.reset();
extractConfigs();
});
- connect(jobPtr.get(), &NetJob::failed, [&](QString reason)
- {
+ connect(jobPtr.get(), &NetJob::failed, [&](QString reason) {
abortable = false;
jobPtr.reset();
emitFailed(reason);
});
- connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total)
- {
+ connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total) {
abortable = true;
setProgress(current, total);
});
connect(jobPtr.get(), &NetJob::stepProgress, this, &PackInstallTask::propagateStepProgress);
- connect(jobPtr.get(), &NetJob::aborted, [&]{
+ connect(jobPtr.get(), &NetJob::aborted, [&] {
abortable = false;
jobPtr.reset();
emitAborted();
@@ -702,25 +671,20 @@ void PackInstallTask::extractConfigs()
QDir extractDir(m_stagingPath);
QuaZip packZip(archivePath);
- if(!packZip.open(QuaZip::mdUnzip))
- {
+ if (!packZip.open(QuaZip::mdUnzip)) {
emitFailed(tr("Failed to open pack configs %1!").arg(archivePath));
return;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
- m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), QOverload<QString, QString>::of(MMCZip::extractDir), archivePath, extractDir.absolutePath() + "/minecraft");
+ m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), QOverload<QString, QString>::of(MMCZip::extractDir), archivePath,
+ extractDir.absolutePath() + "/minecraft");
#else
- m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), MMCZip::extractDir, archivePath, extractDir.absolutePath() + "/minecraft");
+ m_extractFuture =
+ QtConcurrent::run(QThreadPool::globalInstance(), MMCZip::extractDir, archivePath, extractDir.absolutePath() + "/minecraft");
#endif
- connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::finished, this, [&]()
- {
- downloadMods();
- });
- connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::canceled, this, [&]()
- {
- emitAborted();
- });
+ connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::finished, this, [&]() { downloadMods(); });
+ connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::canceled, this, [&]() { emitAborted(); });
m_extractFutureWatcher.setFuture(m_extractFuture);
}
@@ -751,15 +715,17 @@ void PackInstallTask::downloadMods()
jarmods.clear();
jobPtr.reset(new NetJob(tr("Mod download"), APPLICATION->network()));
- for(const auto& mod : m_version.mods) {
+ for (const auto& mod : m_version.mods) {
// skip non-client mods
- if(!mod.client) continue;
+ if (!mod.client)
+ continue;
// skip optional mods that were not selected
- if(mod.optional && !