NOISSUE Add flame.

This commit is contained in:
Petr Mrázek 2017-04-22 18:51:04 +02:00
parent 30863a88ab
commit 8ace5fa91d
11 changed files with 118 additions and 59 deletions

View File

@ -291,11 +291,11 @@ set(MINECRAFT_SOURCES
minecraft/ftb/FTBPlugin.h minecraft/ftb/FTBPlugin.h
minecraft/ftb/FTBPlugin.cpp minecraft/ftb/FTBPlugin.cpp
# Curse # Flame
minecraft/curse/PackManifest.h minecraft/flame/PackManifest.h
minecraft/curse/PackManifest.cpp minecraft/flame/PackManifest.cpp
minecraft/curse/FileResolvingTask.h minecraft/flame/FileResolvingTask.h
minecraft/curse/FileResolvingTask.cpp minecraft/flame/FileResolvingTask.cpp
# Assets # Assets
minecraft/AssetsUtils.h minecraft/AssetsUtils.h

View File

@ -11,9 +11,9 @@
#include "icons/IIconList.h" #include "icons/IIconList.h"
#include <QtConcurrentRun> #include <QtConcurrentRun>
// FIXME: this does not belong here, it's Minecraft/Curse specific // FIXME: this does not belong here, it's Minecraft/Flame specific
#include "minecraft/curse/FileResolvingTask.h" #include "minecraft/flame/FileResolvingTask.h"
#include "minecraft/curse/PackManifest.h" #include "minecraft/flame/PackManifest.h"
#include "Json.h" #include "Json.h"
InstanceImportTask::InstanceImportTask(SettingsObjectPtr settings, const QUrl sourceUrl, BaseInstanceProvider * target, 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 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()) if (instanceCfgFile.isFile())
{ {
qDebug() << "Pack appears to be exported from MultiMC."; qDebug() << "Pack appears to be exported from MultiMC.";
processMultiMC(instanceCfgFile); processMultiMC(instanceCfgFile);
} }
else if (curseJson.isFile()) else if (flameJson.isFile())
{ {
qDebug() << "Pack appears to be from Curse."; qDebug() << "Pack appears to be from 'Flame'.";
processCurse(curseJson); processFlame(flameJson);
} }
else else
{ {
@ -173,7 +173,7 @@ void InstanceImportTask::extractAborted()
return; return;
} }
void InstanceImportTask::processCurse(const QFileInfo & manifest) void InstanceImportTask::processFlame(const QFileInfo & manifest)
{ {
const static QMap<QString,QString> forgemap = { const static QMap<QString,QString> forgemap = {
{"1.2.5", "3.4.9.171"}, {"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.4.7", "6.6.2.534"},
{"1.5.2", "7.8.1.737"} {"1.5.2", "7.8.1.737"}
}; };
Curse::Manifest pack; Flame::Manifest pack;
try try
{ {
Curse::loadManifest(pack, manifest.absoluteFilePath()); Flame::loadManifest(pack, manifest.absoluteFilePath());
} }
catch (JSONValidationError & e) catch (JSONValidationError & e)
{ {
m_target->destroyStagingPath(m_stagingPath); 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; return;
} }
m_packRoot = manifest.absolutePath(); m_packRoot = manifest.absolutePath();
@ -200,7 +200,7 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
if (!QFile::rename(overridePath, mcPath)) if (!QFile::rename(overridePath, mcPath))
{ {
m_target->destroyStagingPath(m_stagingPath); 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; return;
} }
} }
@ -215,7 +215,7 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
forgeVersion = id; forgeVersion = id;
continue; continue;
} }
qWarning() << "Unknown mod loader in curse manifest:" << id; qWarning() << "Unknown mod loader in manifest:" << id;
} }
QString configPath = FS::PathCombine(m_packRoot, "instance.cfg"); QString configPath = FS::PathCombine(m_packRoot, "instance.cfg");
@ -224,11 +224,11 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
instanceSettings->set("InstanceType", "OneSix"); instanceSettings->set("InstanceType", "OneSix");
OneSixInstance instance(m_globalSettings, instanceSettings, m_packRoot); OneSixInstance instance(m_globalSettings, instanceSettings, m_packRoot);
auto mcVersion = pack.minecraft.version; auto mcVersion = pack.minecraft.version;
// Hack to correct some 'special curse sauce'... // Hack to correct some 'special sauce'...
if(mcVersion.endsWith('.')) if(mcVersion.endsWith('.'))
{ {
mcVersion.remove(QRegExp("[.]+$")); 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); instance.setComponentVersion("net.minecraft", mcVersion);
if(!forgeVersion.isEmpty()) if(!forgeVersion.isEmpty())
@ -261,6 +261,11 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
{ {
instance.setIconKey("ftb_logo"); instance.setIconKey("ftb_logo");
} }
else
{
// default to something other than the MultiMC default to distinguish these
instance.setIconKey("flame");
}
} }
instance.init(); instance.init();
QString jarmodsPath = FS::PathCombine(m_packRoot, "minecraft", "jarmods"); QString jarmodsPath = FS::PathCombine(m_packRoot, "minecraft", "jarmods");
@ -282,18 +287,18 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
FS::deletePath(jarmodsPath); FS::deletePath(jarmodsPath);
} }
instance.setName(m_instName); instance.setName(m_instName);
m_curseResolver.reset(new Curse::FileResolvingTask(pack)); m_modIdResolver.reset(new Flame::FileResolvingTask(pack));
connect(m_curseResolver.get(), &Curse::FileResolvingTask::succeeded, [&]() connect(m_modIdResolver.get(), &Flame::FileResolvingTask::succeeded, [&]()
{ {
auto results = m_curseResolver->getResults(); auto results = m_modIdResolver->getResults();
m_filesNetJob.reset(new NetJob(tr("Curse mod download"))); m_filesNetJob.reset(new NetJob(tr("Mod download")));
for(auto result: results.files) for(auto result: results.files)
{ {
auto path = FS::PathCombine(m_packRoot, "minecraft/mods", result.fileName); auto path = FS::PathCombine(m_packRoot, "minecraft/mods", result.fileName);
auto dl = Net::Download::makeFile(result.url,path); auto dl = Net::Download::makeFile(result.url,path);
m_filesNetJob->addNetAction(dl); m_filesNetJob->addNetAction(dl);
} }
m_curseResolver.reset(); m_modIdResolver.reset();
connect(m_filesNetJob.get(), &NetJob::succeeded, this, [&]() connect(m_filesNetJob.get(), &NetJob::succeeded, this, [&]()
{ {
m_filesNetJob.reset(); m_filesNetJob.reset();
@ -320,21 +325,21 @@ void InstanceImportTask::processCurse(const QFileInfo & manifest)
m_filesNetJob->start(); 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_target->destroyStagingPath(m_stagingPath);
m_curseResolver.reset(); m_modIdResolver.reset();
emitFailed(tr("Unable to resolve Curse mod IDs:\n") + reason); 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); setProgress(current, total);
}); });
connect(m_curseResolver.get(), &Curse::FileResolvingTask::status, [&](QString status) connect(m_modIdResolver.get(), &Flame::FileResolvingTask::status, [&](QString status)
{ {
setStatus(status); setStatus(status);
}); });
m_curseResolver->start(); m_modIdResolver->start();
} }
void InstanceImportTask::processMultiMC(const QFileInfo & config) void InstanceImportTask::processMultiMC(const QFileInfo & config)

View File

@ -10,7 +10,7 @@
#include "QObjectPtr.h" #include "QObjectPtr.h"
class BaseInstanceProvider; class BaseInstanceProvider;
namespace Curse namespace Flame
{ {
class FileResolvingTask; class FileResolvingTask;
} }
@ -29,7 +29,7 @@ protected:
private: private:
void extractAndTweak(); void extractAndTweak();
void processMultiMC(const QFileInfo &config); void processMultiMC(const QFileInfo &config);
void processCurse(const QFileInfo &manifest); void processFlame(const QFileInfo &manifest);
private slots: private slots:
void downloadSucceeded(); void downloadSucceeded();
@ -41,7 +41,7 @@ private slots:
private: /* data */ private: /* data */
SettingsObjectPtr m_globalSettings; SettingsObjectPtr m_globalSettings;
NetJobPtr m_filesNetJob; NetJobPtr m_filesNetJob;
shared_qobject_ptr<Curse::FileResolvingTask> m_curseResolver; shared_qobject_ptr<Flame::FileResolvingTask> m_modIdResolver;
QUrl m_sourceUrl; QUrl m_sourceUrl;
BaseInstanceProvider * m_target; BaseInstanceProvider * m_target;
QString m_archivePath; QString m_archivePath;

View File

@ -3,16 +3,16 @@
const char * metabase = "https://cursemeta.dries007.net"; const char * metabase = "https://cursemeta.dries007.net";
Curse::FileResolvingTask::FileResolvingTask(Curse::Manifest& toProcess) Flame::FileResolvingTask::FileResolvingTask(Flame::Manifest& toProcess)
: m_toProcess(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()); 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()); results.resize(m_toProcess.files.size());
int index = 0; int index = 0;
for(auto & file: m_toProcess.files) for(auto & file: m_toProcess.files)
@ -24,11 +24,11 @@ void Curse::FileResolvingTask::executeTask()
m_dljob->addNetAction(dl); m_dljob->addNetAction(dl);
index ++; index ++;
} }
connect(m_dljob.get(), &NetJob::finished, this, &Curse::FileResolvingTask::netJobFinished); connect(m_dljob.get(), &NetJob::finished, this, &Flame::FileResolvingTask::netJobFinished);
m_dljob->start(); m_dljob->start();
} }
void Curse::FileResolvingTask::netJobFinished() void Flame::FileResolvingTask::netJobFinished()
{ {
bool failed = false; bool failed = false;
int index = 0; int index = 0;
@ -61,6 +61,6 @@ void Curse::FileResolvingTask::netJobFinished()
} }
else else
{ {
emitFailed(tr("Some curse ID resolving tasks failed.")); emitFailed(tr("Some mod ID resolving tasks failed."));
} }
} }

View File

@ -6,14 +6,14 @@
#include "multimc_logic_export.h" #include "multimc_logic_export.h"
namespace Curse namespace Flame
{ {
class MULTIMC_LOGIC_EXPORT FileResolvingTask : public Task class MULTIMC_LOGIC_EXPORT FileResolvingTask : public Task
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FileResolvingTask(Curse::Manifest &toProcess); explicit FileResolvingTask(Flame::Manifest &toProcess);
const Curse::Manifest &getResults() const const Flame::Manifest &getResults() const
{ {
return m_toProcess; return m_toProcess;
} }
@ -25,7 +25,7 @@ protected slots:
void netJobFinished(); void netJobFinished();
private: /* data */ private: /* data */
Curse::Manifest m_toProcess; Flame::Manifest m_toProcess;
QVector<QByteArray> results; QVector<QByteArray> results;
NetJobPtr m_dljob; NetJobPtr m_dljob;
}; };

View File

@ -1,7 +1,7 @@
#include "PackManifest.h" #include "PackManifest.h"
#include "Json.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.projectId = Json::requireInteger(file, "projectID");
f.fileId = Json::requireInteger(file, "fileID"); 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); 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.id = Json::requireString(modLoader, "id");
m.primary = Json::ensureBoolean(modLoader, QString("primary"), false); 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"); m.version = Json::requireString(minecraft, "version");
// extra libraries... apparently only used for a custom Minecraft launcher in the 1.2.5 FTB retro pack // 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()); m.libraries = Json::ensureString(minecraft, QString("libraries"), QString());
auto arr = Json::ensureArray(minecraft, "modLoaders", QJsonArray()); auto arr = Json::ensureArray(minecraft, "modLoaders", QJsonArray());
for (const auto & item : arr) for (const auto & item : arr)
{ {
auto obj = Json::requireObject(item); auto obj = Json::requireObject(item);
Curse::Modloader loader; Flame::Modloader loader;
loadModloaderV1(loader, obj); loadModloaderV1(loader, obj);
m.modLoaders.append(loader); 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"); auto mc = Json::requireObject(manifest, "minecraft");
loadMinecraftV1(m.minecraft, mc); loadMinecraftV1(m.minecraft, mc);
@ -42,21 +42,21 @@ static void loadManifestV1(Curse::Manifest & m, QJsonObject & manifest)
for (const auto & item : arr) for (const auto & item : arr)
{ {
auto obj = Json::requireObject(item); auto obj = Json::requireObject(item);
Curse::File file; Flame::File file;
loadFileV1(file, obj); loadFileV1(file, obj);
m.files.append(file); m.files.append(file);
} }
m.overrides = Json::ensureString(manifest, "overrides", "overrides"); 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 doc = Json::requireDocument(filepath);
auto obj = Json::requireObject(doc); auto obj = Json::requireObject(doc);
m.manifestType = Json::requireString(obj, "manifestType"); m.manifestType = Json::requireString(obj, "manifestType");
if(m.manifestType != "minecraftModpack") if(m.manifestType != "minecraftModpack")
{ {
throw JSONValidationError("Not a Curse modpack manifest!"); throw JSONValidationError("Not a modpack manifest!");
} }
m.manifestVersion = Json::requireInteger(obj, "manifestVersion"); m.manifestVersion = Json::requireInteger(obj, "manifestVersion");
if(m.manifestVersion != 1) if(m.manifestVersion != 1)

View File

@ -3,7 +3,7 @@
#include <QString> #include <QString>
#include <QVector> #include <QVector>
namespace Curse namespace Flame
{ {
struct File struct File
{ {
@ -27,20 +27,20 @@ struct Minecraft
{ {
QString version; QString version;
QString libraries; QString libraries;
QVector<Curse::Modloader> modLoaders; QVector<Flame::Modloader> modLoaders;
}; };
struct Manifest struct Manifest
{ {
QString manifestType; QString manifestType;
int manifestVersion = 0; int manifestVersion = 0;
Curse::Minecraft minecraft; Flame::Minecraft minecraft;
QString name; QString name;
QString version; QString version;
QString author; QString author;
QVector<Curse::File> files; QVector<Flame::File> files;
QString overrides; QString overrides;
}; };
void loadManifest(Curse::Manifest & m, const QString &filepath); void loadManifest(Flame::Manifest & m, const QString &filepath);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View File

@ -249,6 +249,9 @@
<file>32x32/instances/ftb_logo.png</file> <file>32x32/instances/ftb_logo.png</file>
<file>128x128/instances/ftb_logo.png</file> <file>128x128/instances/ftb_logo.png</file>
<file>32x32/instances/flame.png</file>
<file>128x128/instances/flame.png</file>
<file>32x32/instances/gear.png</file> <file>32x32/instances/gear.png</file>
<file>128x128/instances/gear.png</file> <file>128x128/instances/gear.png</file>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 127.99999 128"
height="128"
width="128"
id="svg2"
version="1.1">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<path
id="path4509"
d="m 93.706631,98.374916 c 2e-6,12.224574 -12.676714,22.134544 -28.314236,22.134544 -15.637522,0 -28.314238,-9.90997 -28.314236,-22.134544 10e-7,-12.224569 11.178608,-36.815994 26.816128,-36.815994 15.637521,0 29.812343,24.591425 29.812344,36.815994 z"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke-width:1.17175078;marker:none;enable-background:accumulate" />
<g
transform="matrix(0.22142825,0,0,0.22142825,33.524659,-1.9444021)"
id="g4505">
<path
style="fill:#ff7500;fill-opacity:1;fill-rule:evenodd"
d="m 285.26215,237.39406 c -4.43799,0.93416 -40.69637,2.61517 -41.21184,41.12844 -0.51547,38.51328 52.00568,64.86852 53.07625,129.21055 1.02262,61.46009 -43.4082,133.87308 -118.22034,141.52542 51.89013,-43.65773 59.51106,-100.48068 13.98305,-151.27119 -23.73802,-26.48184 -56.20743,-44.93245 -54.2373,-96.18644 1.97013,-51.25399 80.13525,-121.18396 146.61018,-64.40678 z"
id="path4491" />
<path
id="path4493"
d="m 49.139955,83.857637 c 5.14236,1.40482 47.15538,3.93282 47.75267,61.850853 0.59728,57.91808 -115.98924,109.53719 -117.22972,206.29773 -1.18493,92.42657 41.90823,185.7443 128.593975,197.25225 C 48.131155,483.60392 47.690095,413.73124 100.44395,337.35009 127.9495,297.52546 221.3018,257.7937 219.01898,180.71555 216.73616,103.63741 126.16528,-1.5265416 49.139955,83.857637 Z"
style="fill:#ff7500;fill-opacity:1;fill-rule:evenodd;stroke-width:1.32004774" />
<path
id="path4497"
d="m 244.91289,277.23386 c -3.04702,-0.0596 -26.88302,-4.71504 -34.06545,22.18053 -7.18245,26.89556 22.22556,53.80661 11.48022,99.05033 -10.26404,43.2172 -51.9816,86.79466 -101.90647,80.11983 41.44697,-22.23442 56.49745,-60.81281 35.97375,-103.71573 -10.70094,-22.3693 -28.49783,-40.51738 -18.10576,-76.10378 10.3921,-35.5864 73.56677,-71.99754 106.62371,-21.53118 z"
style="fill:#ff7500;fill-opacity:1;fill-rule:evenodd;stroke-width:0.69522083" />
<path
style="fill:#ff7500;fill-opacity:1;fill-rule:evenodd;stroke-width:0.5843063"
d="m 54.097869,231.55891 c 2.12507,0.34666 19.5376,-1.05581 19.45707,26.31399 -0.0805,27.36978 -25.54842,49.88894 -26.61138,95.75261 -1.01537,43.80938 19.72217,92.1553 55.613891,92.23888 C 77.989639,418.51587 74.811129,378.62585 97.126179,339.21931 108.76111,318.67301 124.52413,303.21607 124.01412,266.88402 123.50408,230.55198 86.531659,186.39085 54.097869,231.55891 Z"
id="path4499" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB