GH-1016 print list of mods, coremods and jarmods
Includes a change to jar mods, where they gain an 'originalName' attribute used only for display
This commit is contained in:
parent
9920062003
commit
6fd18a5cce
@ -2,7 +2,7 @@
|
|||||||
#include "MMCJson.h"
|
#include "MMCJson.h"
|
||||||
using namespace MMCJson;
|
using namespace MMCJson;
|
||||||
|
|
||||||
JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
|
JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName)
|
||||||
{
|
{
|
||||||
JarmodPtr out(new Jarmod());
|
JarmodPtr out(new Jarmod());
|
||||||
if (!libObj.contains("name"))
|
if (!libObj.contains("name"))
|
||||||
@ -11,6 +11,7 @@ JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
|
|||||||
"contains a jarmod that doesn't have a 'name' field");
|
"contains a jarmod that doesn't have a 'name' field");
|
||||||
}
|
}
|
||||||
out->name = libObj.value("name").toString();
|
out->name = libObj.value("name").toString();
|
||||||
|
out->originalName = libObj.value("originalName").toString();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,5 +19,9 @@ QJsonObject Jarmod::toJson()
|
|||||||
{
|
{
|
||||||
QJsonObject out;
|
QJsonObject out;
|
||||||
writeString(out, "name", name);
|
writeString(out, "name", name);
|
||||||
|
if(!originalName.isEmpty())
|
||||||
|
{
|
||||||
|
writeString(out, "originalName", originalName);
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,10 @@ typedef std::shared_ptr<Jarmod> JarmodPtr;
|
|||||||
class Jarmod
|
class Jarmod
|
||||||
{
|
{
|
||||||
public: /* methods */
|
public: /* methods */
|
||||||
static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename);
|
static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename,
|
||||||
|
const QString &originalName);
|
||||||
QJsonObject toJson();
|
QJsonObject toJson();
|
||||||
public: /* data */
|
public: /* data */
|
||||||
QString name;
|
QString name;
|
||||||
|
QString originalName;
|
||||||
};
|
};
|
||||||
|
@ -136,17 +136,29 @@ BaseProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session)
|
|||||||
|
|
||||||
for(auto & mod: loaderModList()->allMods())
|
for(auto & mod: loaderModList()->allMods())
|
||||||
{
|
{
|
||||||
launchScript += "mod " + mod.filename().absoluteFilePath() + "\n";;
|
if(!mod.enabled())
|
||||||
|
continue;
|
||||||
|
if(mod.type() == Mod::MOD_FOLDER)
|
||||||
|
continue;
|
||||||
|
// TODO: proper implementation would need to descend into folders.
|
||||||
|
|
||||||
|
launchScript += "mod " + mod.filename().completeBaseName() + "\n";;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto & coremod: coreModList()->allMods())
|
for(auto & coremod: coreModList()->allMods())
|
||||||
{
|
{
|
||||||
launchScript += "coremod " + coremod.filename().absoluteFilePath() + "\n";;
|
if(!coremod.enabled())
|
||||||
|
continue;
|
||||||
|
if(coremod.type() == Mod::MOD_FOLDER)
|
||||||
|
continue;
|
||||||
|
// TODO: proper implementation would need to descend into folders.
|
||||||
|
|
||||||
|
launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto & jarmod: m_version->jarMods)
|
for(auto & jarmod: m_version->jarMods)
|
||||||
{
|
{
|
||||||
launchScript += "jarmod " + jarmod->name + "\n";;
|
launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// libraries and class path.
|
// libraries and class path.
|
||||||
|
@ -368,6 +368,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
|
|||||||
auto f = std::make_shared<VersionFile>();
|
auto f = std::make_shared<VersionFile>();
|
||||||
auto jarMod = std::make_shared<Jarmod>();
|
auto jarMod = std::make_shared<Jarmod>();
|
||||||
jarMod->name = target_filename;
|
jarMod->name = target_filename;
|
||||||
|
jarMod->originalName = sourceInfo.completeBaseName();
|
||||||
f->jarMods.append(jarMod);
|
f->jarMods.append(jarMod);
|
||||||
f->name = target_name;
|
f->name = target_name;
|
||||||
f->fileId = target_id;
|
f->fileId = target_id;
|
||||||
|
@ -155,7 +155,13 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
|
|||||||
{
|
{
|
||||||
QJsonObject libObj = ensureObject(libVal);
|
QJsonObject libObj = ensureObject(libVal);
|
||||||
// parse the jarmod
|
// parse the jarmod
|
||||||
auto lib = Jarmod::fromJson(libObj, filename);
|
auto lib = Jarmod::fromJson(libObj, filename, out->name);
|
||||||
|
if(lib->originalName.isEmpty())
|
||||||
|
{
|
||||||
|
auto fixed = out->name;
|
||||||
|
fixed.remove(" (jar mod)");
|
||||||
|
lib->originalName = out->name;
|
||||||
|
}
|
||||||
// and add to jar mods
|
// and add to jar mods
|
||||||
out->jarMods.append(lib);
|
out->jarMods.append(lib);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user