aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/modplatform/ModIndex.h2
-rw-r--r--launcher/modplatform/flame/FileResolvingTask.cpp3
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp13
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp13
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp1
-rw-r--r--launcher/ui/pages/modplatform/ShaderPackPage.cpp3
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp3
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.cpp14
8 files changed, 32 insertions, 20 deletions
diff --git a/launcher/modplatform/ModIndex.h b/launcher/modplatform/ModIndex.h
index 2178422f..780f68b4 100644
--- a/launcher/modplatform/ModIndex.h
+++ b/launcher/modplatform/ModIndex.h
@@ -73,7 +73,7 @@ struct IndexedVersion {
QString downloadUrl;
QString date;
QString fileName;
- QStringList loaders = {};
+ ModLoaderTypes loaders = {};
QString hash_type;
QString hash;
bool is_preferred = true;
diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp
index 860d7340..07a3ae63 100644
--- a/launcher/modplatform/flame/FileResolvingTask.cpp
+++ b/launcher/modplatform/flame/FileResolvingTask.cpp
@@ -1,5 +1,6 @@
#include "FileResolvingTask.h"
+#include <bitset>
#include "Json.h"
#include "net/ApiDownload.h"
#include "net/ApiUpload.h"
@@ -153,7 +154,7 @@ void Flame::FileResolvingTask::modrinthCheckFinished()
// If there's more than one mod loader for this version, we can't know for sure
// which file is relative to each loader, so it's best to not use any one and
// let the user download it manually.
- if (file.loaders.size() <= 1) {
+ if (std::bitset<8>(file.loaders.toInt()).count() <= 1) {
out->url = file.downloadUrl;
qDebug() << "Found alternative on modrinth " << out->fileName;
} else {
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 19803cf6..8924913b 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -115,6 +115,19 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
if (str.contains('.'))
file.mcVersion.append(str);
+ auto loader = str.toLower();
+ if (loader == "neoforge")
+ file.loaders |= ModPlatform::NeoForge;
+ if (loader == "forge")
+ file.loaders |= ModPlatform::Forge;
+ if (loader == "cauldron")
+ file.loaders |= ModPlatform::Cauldron;
+ if (loader == "liteloader")
+ file.loaders |= ModPlatform::LiteLoader;
+ if (loader == "fabric")
+ file.loaders |= ModPlatform::Fabric;
+ if (loader == "quilt")
+ file.loaders |= ModPlatform::Quilt;
}
file.addonId = Json::requireInteger(obj, "modId");
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
index 85e66a91..1ff5a4b9 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
@@ -134,7 +134,18 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
}
auto loaders = Json::requireArray(obj, "loaders");
for (auto loader : loaders) {
- file.loaders.append(loader.toString());
+ if (loader == "neoforge")
+ file.loaders |= ModPlatform::NeoForge;
+ if (loader == "forge")
+ file.loaders |= ModPlatform::Forge;
+ if (loader == "cauldron")
+ file.loaders |= ModPlatform::Cauldron;
+ if (loader == "liteloader")
+ file.loaders |= ModPlatform::LiteLoader;
+ if (loader == "fabric")
+ file.loaders |= ModPlatform::Fabric;
+ if (loader == "quilt")
+ file.loaders |= ModPlatform::Quilt;
}
file.version = Json::requireString(obj, "name");
file.version_number = Json::requireString(obj, "version_number");
diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp
index 60a43128..c9270d39 100644
--- a/launcher/ui/pages/modplatform/ModPage.cpp
+++ b/launcher/ui/pages/modplatform/ModPage.cpp
@@ -124,7 +124,6 @@ void ModPage::updateVersionList()
auto version = current_pack->versions[i];
bool valid = false;
for (auto& mcVer : m_filter->versions) {
- // NOTE: Flame doesn't care about loader, so passing it changes nothing.
if (validateVersion(version, mcVer.toString(), packProfile->getModLoaders())) {
valid = true;
break;
diff --git a/launcher/ui/pages/modplatform/ShaderPackPage.cpp b/launcher/ui/pages/modplatform/ShaderPackPage.cpp
index fbf94e84..586dffc5 100644
--- a/launcher/ui/pages/modplatform/ShaderPackPage.cpp
+++ b/launcher/ui/pages/modplatform/ShaderPackPage.cpp
@@ -3,6 +3,7 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "ShaderPackPage.h"
+#include "modplatform/ModIndex.h"
#include "ui_ResourcePage.h"
#include "ShaderPackModel.h"
@@ -48,7 +49,7 @@ void ShaderPackResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pac
const std::shared_ptr<ResourceFolderModel> base_model)
{
QString custom_target_folder;
- if (version.loaders.contains(QStringLiteral("canvas")))
+ if (version.loaders & ModPlatform::Cauldron)
custom_target_folder = QStringLiteral("resourcepacks");
m_model->addPack(pack, version, base_model, false, custom_target_folder);
}
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
index 5650fb95..222ceedc 100644
--- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
@@ -70,8 +70,7 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver,
QString mineVer,
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
{
- Q_UNUSED(loaders);
- return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty();
+ return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty() && (!loaders.has_value() || loaders.value() & ver.loaders);
}
bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.cpp
index e944a2a9..bcd0a4cf 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthResourcePages.cpp
@@ -67,19 +67,7 @@ auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver,
QString mineVer,
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
{
- auto loaderCompatible = !loaders.has_value();
-
- if (!loaderCompatible) {
- auto loaderStrings = ModrinthAPI::getModLoaderStrings(loaders.value());
- for (auto remoteLoader : ver.loaders) {
- if (loaderStrings.contains(remoteLoader)) {
- loaderCompatible = true;
- break;
- }
- }
- }
-
- return ver.mcVersion.contains(mineVer) && loaderCompatible;
+ return ver.mcVersion.contains(mineVer) && (!loaders.has_value() || loaders.value() & ver.loaders);
}
ModrinthResourcePackPage::ModrinthResourcePackPage(ResourcePackDownloadDialog* dialog, BaseInstance& instance)