diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-04-22 18:51:04 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-22 18:51:04 +0200 |
commit | 8ace5fa91d7abaadc00758e1f6eeb692f424a8ab (patch) | |
tree | 7ac7adf409e941b85bd92c362667fbfcf9ab8b86 /api | |
parent | 30863a88abbbac05aff914326557882a2f09f4e4 (diff) | |
download | MultiMC-8ace5fa91d7abaadc00758e1f6eeb692f424a8ab.tar MultiMC-8ace5fa91d7abaadc00758e1f6eeb692f424a8ab.tar.gz MultiMC-8ace5fa91d7abaadc00758e1f6eeb692f424a8ab.tar.lz MultiMC-8ace5fa91d7abaadc00758e1f6eeb692f424a8ab.tar.xz MultiMC-8ace5fa91d7abaadc00758e1f6eeb692f424a8ab.zip |
NOISSUE Add flame.
Diffstat (limited to 'api')
-rw-r--r-- | api/logic/CMakeLists.txt | 10 | ||||
-rw-r--r-- | api/logic/InstanceImportTask.cpp | 57 | ||||
-rw-r--r-- | api/logic/InstanceImportTask.h | 6 | ||||
-rw-r--r-- | api/logic/minecraft/flame/FileResolvingTask.cpp (renamed from api/logic/minecraft/curse/FileResolvingTask.cpp) | 14 | ||||
-rw-r--r-- | api/logic/minecraft/flame/FileResolvingTask.h (renamed from api/logic/minecraft/curse/FileResolvingTask.h) | 8 | ||||
-rw-r--r-- | api/logic/minecraft/flame/PackManifest.cpp (renamed from api/logic/minecraft/curse/PackManifest.cpp) | 18 | ||||
-rw-r--r-- | api/logic/minecraft/flame/PackManifest.h (renamed from api/logic/minecraft/curse/PackManifest.h) | 10 |
7 files changed, 64 insertions, 59 deletions
diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index fa1a9f57..096af6b1 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -291,11 +291,11 @@ set(MINECRAFT_SOURCES minecraft/ftb/FTBPlugin.h minecraft/ftb/FTBPlugin.cpp - # Curse - minecraft/curse/PackManifest.h - minecraft/curse/PackManifest.cpp - minecraft/curse/FileResolvingTask.h - minecraft/curse/FileResolvingTask.cpp + # Flame + minecraft/flame/PackManifest.h + minecraft/flame/PackManifest.cpp + minecraft/flame/FileResolvingTask.h + minecraft/flame/FileResolvingTask.cpp # Assets minecraft/AssetsUtils.h diff --git a/api/logic/InstanceImportTask.cpp b/api/logic/InstanceImportTask.cpp index 2005b61f..f1b3d5aa 100644 --- a/api/logic/InstanceImportTask.cpp +++ b/api/logic/InstanceImportTask.cpp @@ -11,9 +11,9 @@ #include "icons/IIconList.h" #include <QtConcurrentRun> -// FIXME: this does not belong here, it's Minecraft/Curse specific -#include "minecraft/curse/FileResolvingTask.h" -#include "minecraft/curse/PackManifest.h" +// FIXME: this does not belong here, it's Minecraft/Flame specific +#include "minecraft/flame/FileResolvingTask.h" +#include "minecraft/flame/PackManifest.h" #include "Json.h" InstanceImportTask::InstanceImportTask(SettingsObjectPtr settings, const QUrl sourceUrl, BaseInstanceProvider * target, @@ -147,16 +147,16 @@ void InstanceImportTask::extractFinished() } const QFileInfo instanceCfgFile = findRecursive(extractDir.absolutePath(), "instance.cfg"); - const QFileInfo curseJson = findRecursive(extractDir.absolutePath(), "manifest.json"); + const QFileInfo flameJson = findRecursive(extractDir.absolutePath(), "manifest.json"); if (instanceCfgFile.isFile()) { qDebug() << "Pack appears to be exported from MultiMC."; processMultiMC(instanceCfgFile); } - else if (curseJson.isFile()) + else if (flameJson.isFile()) { - qDebug() << "Pack appears to be from Curse."; - processCurse(curseJson); + qDebug() << "Pack appears to be from 'Flame'."; + processFlame(flameJson); } else { @@ -173,7 +173,7 @@ void InstanceImportTask::extractAborted() return; } -void InstanceImportTask::processCurse(const QFileInfo & manifest) +void InstanceImportTask::processFlame(const QFileInfo & manifest) { const static QMap<QString,QString> forgemap = { {"1.2.5", "3.4.9.171"}, @@ -181,15 +181,15 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) {"1.4.7", "6.6.2.534"}, {"1.5.2", "7.8.1.737"} }; - Curse::Manifest pack; + Flame::Manifest pack; try { - Curse::loadManifest(pack, manifest.absoluteFilePath()); + Flame::loadManifest(pack, manifest.absoluteFilePath()); } catch (JSONValidationError & e) { m_target->destroyStagingPath(m_stagingPath); - emitFailed(tr("Could not understand curse manifest:\n") + e.cause()); + emitFailed(tr("Could not understand pack manifest:\n") + e.cause()); return; } m_packRoot = manifest.absolutePath(); @@ -200,7 +200,7 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) if (!QFile::rename(overridePath, mcPath)) { m_target->destroyStagingPath(m_stagingPath); - emitFailed(tr("Could not rename the curse overrides:\n") + pack.overrides); + emitFailed(tr("Could not rename the overrides folder:\n") + pack.overrides); return; } } @@ -215,7 +215,7 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) forgeVersion = id; continue; } - qWarning() << "Unknown mod loader in curse manifest:" << id; + qWarning() << "Unknown mod loader in manifest:" << id; } QString configPath = FS::PathCombine(m_packRoot, "instance.cfg"); @@ -224,11 +224,11 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) instanceSettings->set("InstanceType", "OneSix"); OneSixInstance instance(m_globalSettings, instanceSettings, m_packRoot); auto mcVersion = pack.minecraft.version; - // Hack to correct some 'special curse sauce'... + // Hack to correct some 'special sauce'... if(mcVersion.endsWith('.')) { mcVersion.remove(QRegExp("[.]+$")); - qWarning() << "Mysterious trailing dots removed from Minecraft version while importing Curse pack."; + qWarning() << "Mysterious trailing dots removed from Minecraft version while importing pack."; } instance.setComponentVersion("net.minecraft", mcVersion); if(!forgeVersion.isEmpty()) @@ -261,6 +261,11 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) { instance.setIconKey("ftb_logo"); } + else + { + // default to something other than the MultiMC default to distinguish these + instance.setIconKey("flame"); + } } instance.init(); QString jarmodsPath = FS::PathCombine(m_packRoot, "minecraft", "jarmods"); @@ -282,18 +287,18 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) FS::deletePath(jarmodsPath); } instance.setName(m_instName); - m_curseResolver.reset(new Curse::FileResolvingTask(pack)); - connect(m_curseResolver.get(), &Curse::FileResolvingTask::succeeded, [&]() + m_modIdResolver.reset(new Flame::FileResolvingTask(pack)); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::succeeded, [&]() { - auto results = m_curseResolver->getResults(); - m_filesNetJob.reset(new NetJob(tr("Curse mod download"))); + auto results = m_modIdResolver->getResults(); + m_filesNetJob.reset(new NetJob(tr("Mod download"))); for(auto result: results.files) { auto path = FS::PathCombine(m_packRoot, "minecraft/mods", result.fileName); auto dl = Net::Download::makeFile(result.url,path); m_filesNetJob->addNetAction(dl); } - m_curseResolver.reset(); + m_modIdResolver.reset(); connect(m_filesNetJob.get(), &NetJob::succeeded, this, [&]() { m_filesNetJob.reset(); @@ -320,21 +325,21 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest) m_filesNetJob->start(); } ); - connect(m_curseResolver.get(), &Curse::FileResolvingTask::failed, [&](QString reason) + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::failed, [&](QString reason) { m_target->destroyStagingPath(m_stagingPath); - m_curseResolver.reset(); - emitFailed(tr("Unable to resolve Curse mod IDs:\n") + reason); + m_modIdResolver.reset(); + emitFailed(tr("Unable to resolve mod IDs:\n") + reason); }); - connect(m_curseResolver.get(), &Curse::FileResolvingTask::progress, [&](qint64 current, qint64 total) + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::progress, [&](qint64 current, qint64 total) { setProgress(current, total); }); - connect(m_curseResolver.get(), &Curse::FileResolvingTask::status, [&](QString status) + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::status, [&](QString status) { setStatus(status); }); - m_curseResolver->start(); + m_modIdResolver->start(); } void InstanceImportTask::processMultiMC(const QFileInfo & config) diff --git a/api/logic/InstanceImportTask.h b/api/logic/InstanceImportTask.h index a1c1857d..d5192299 100644 --- a/api/logic/InstanceImportTask.h +++ b/api/logic/InstanceImportTask.h @@ -10,7 +10,7 @@ #include "QObjectPtr.h" class BaseInstanceProvider; -namespace Curse +namespace Flame { class FileResolvingTask; } @@ -29,7 +29,7 @@ protected: private: void extractAndTweak(); void processMultiMC(const QFileInfo &config); - void processCurse(const QFileInfo &manifest); + void processFlame(const QFileInfo &manifest); private slots: void downloadSucceeded(); @@ -41,7 +41,7 @@ private slots: private: /* data */ SettingsObjectPtr m_globalSettings; NetJobPtr m_filesNetJob; - shared_qobject_ptr<Curse::FileResolvingTask> m_curseResolver; + shared_qobject_ptr<Flame::FileResolvingTask> m_modIdResolver; QUrl m_sourceUrl; BaseInstanceProvider * m_target; QString m_archivePath; diff --git a/api/logic/minecraft/curse/FileResolvingTask.cpp b/api/logic/minecraft/flame/FileResolvingTask.cpp index aaac404b..582e4a07 100644 --- a/api/logic/minecraft/curse/FileResolvingTask.cpp +++ b/api/logic/minecraft/flame/FileResolvingTask.cpp @@ -3,16 +3,16 @@ const char * metabase = "https://cursemeta.dries007.net"; -Curse::FileResolvingTask::FileResolvingTask(Curse::Manifest& toProcess) +Flame::FileResolvingTask::FileResolvingTask(Flame::Manifest& toProcess) : m_toProcess(toProcess) { } -void Curse::FileResolvingTask::executeTask() +void Flame::FileResolvingTask::executeTask() { - setStatus(tr("Resolving curse mod IDs...")); + setStatus(tr("Resolving mod IDs...")); setProgress(0, m_toProcess.files.size()); - m_dljob.reset(new NetJob("Curse file resolver")); + m_dljob.reset(new NetJob("Mod id resolver")); results.resize(m_toProcess.files.size()); int index = 0; for(auto & file: m_toProcess.files) @@ -24,11 +24,11 @@ void Curse::FileResolvingTask::executeTask() m_dljob->addNetAction(dl); index ++; } - connect(m_dljob.get(), &NetJob::finished, this, &Curse::FileResolvingTask::netJobFinished); + connect(m_dljob.get(), &NetJob::finished, this, &Flame::FileResolvingTask::netJobFinished); m_dljob->start(); } -void Curse::FileResolvingTask::netJobFinished() +void Flame::FileResolvingTask::netJobFinished() { bool failed = false; int index = 0; @@ -61,6 +61,6 @@ void Curse::FileResolvingTask::netJobFinished() } else { - emitFailed(tr("Some curse ID resolving tasks failed.")); + emitFailed(tr("Some mod ID resolving tasks failed.")); } } diff --git a/api/logic/minecraft/curse/FileResolvingTask.h b/api/logic/minecraft/flame/FileResolvingTask.h index a9357bfb..00658452 100644 --- a/api/logic/minecraft/curse/FileResolvingTask.h +++ b/api/logic/minecraft/flame/FileResolvingTask.h @@ -6,14 +6,14 @@ #include "multimc_logic_export.h" -namespace Curse +namespace Flame { class MULTIMC_LOGIC_EXPORT FileResolvingTask : public Task { Q_OBJECT public: - explicit FileResolvingTask(Curse::Manifest &toProcess); - const Curse::Manifest &getResults() const + explicit FileResolvingTask(Flame::Manifest &toProcess); + const Flame::Manifest &getResults() const { return m_toProcess; } @@ -25,7 +25,7 @@ protected slots: void netJobFinished(); private: /* data */ - Curse::Manifest m_toProcess; + Flame::Manifest m_toProcess; QVector<QByteArray> results; NetJobPtr m_dljob; }; diff --git a/api/logic/minecraft/curse/PackManifest.cpp b/api/logic/minecraft/flame/PackManifest.cpp index 7d9c2f89..62921493 100644 --- a/api/logic/minecraft/curse/PackManifest.cpp +++ b/api/logic/minecraft/flame/PackManifest.cpp @@ -1,7 +1,7 @@ #include "PackManifest.h" #include "Json.h" -static void loadFileV1(Curse::File & f, QJsonObject & file) +static void loadFileV1(Flame::File & f, QJsonObject & file) { f.projectId = Json::requireInteger(file, "projectID"); f.fileId = Json::requireInteger(file, "fileID"); @@ -9,29 +9,29 @@ static void loadFileV1(Curse::File & f, QJsonObject & file) f.required = Json::ensureBoolean(file, QString("required"), true); } -static void loadModloaderV1(Curse::Modloader & m, QJsonObject & modLoader) +static void loadModloaderV1(Flame::Modloader & m, QJsonObject & modLoader) { m.id = Json::requireString(modLoader, "id"); m.primary = Json::ensureBoolean(modLoader, QString("primary"), false); } -static void loadMinecraftV1(Curse::Minecraft & m, QJsonObject & minecraft) +static void loadMinecraftV1(Flame::Minecraft & m, QJsonObject & minecraft) { m.version = Json::requireString(minecraft, "version"); // extra libraries... apparently only used for a custom Minecraft launcher in the 1.2.5 FTB retro pack - // intended use is likely hardcoded in the Curse client, the manifest says nothing + // intended use is likely hardcoded in the 'Flame' client, the manifest says nothing m.libraries = Json::ensureString(minecraft, QString("libraries"), QString()); auto arr = Json::ensureArray(minecraft, "modLoaders", QJsonArray()); for (const auto & item : arr) { auto obj = Json::requireObject(item); - Curse::Modloader loader; + Flame::Modloader loader; loadModloaderV1(loader, obj); m.modLoaders.append(loader); } } -static void loadManifestV1(Curse::Manifest & m, QJsonObject & manifest) +static void loadManifestV1(Flame::Manifest & m, QJsonObject & manifest) { auto mc = Json::requireObject(manifest, "minecraft"); loadMinecraftV1(m.minecraft, mc); @@ -42,21 +42,21 @@ static void loadManifestV1(Curse::Manifest & m, QJsonObject & manifest) for (const auto & item : arr) { auto obj = Json::requireObject(item); - Curse::File file; + Flame::File file; loadFileV1(file, obj); m.files.append(file); } m.overrides = Json::ensureString(manifest, "overrides", "overrides"); } -void Curse::loadManifest(Curse::Manifest & m, const QString &filepath) +void Flame::loadManifest(Flame::Manifest & m, const QString &filepath) { auto doc = Json::requireDocument(filepath); auto obj = Json::requireObject(doc); m.manifestType = Json::requireString(obj, "manifestType"); if(m.manifestType != "minecraftModpack") { - throw JSONValidationError("Not a Curse modpack manifest!"); + throw JSONValidationError("Not a modpack manifest!"); } m.manifestVersion = Json::requireInteger(obj, "manifestVersion"); if(m.manifestVersion != 1) diff --git a/api/logic/minecraft/curse/PackManifest.h b/api/logic/minecraft/flame/PackManifest.h index 36e05cc2..ae91bffb 100644 --- a/api/logic/minecraft/curse/PackManifest.h +++ b/api/logic/minecraft/flame/PackManifest.h @@ -3,7 +3,7 @@ #include <QString> #include <QVector> -namespace Curse +namespace Flame { struct File { @@ -27,20 +27,20 @@ struct Minecraft { QString version; QString libraries; - QVector<Curse::Modloader> modLoaders; + QVector<Flame::Modloader> modLoaders; }; struct Manifest { QString manifestType; int manifestVersion = 0; - Curse::Minecraft minecraft; + Flame::Minecraft minecraft; QString name; QString version; QString author; - QVector<Curse::File> files; + QVector<Flame::File> files; QString overrides; }; -void loadManifest(Curse::Manifest & m, const QString &filepath); +void loadManifest(Flame::Manifest & m, const QString &filepath); } |