2014-03-02 03:36:47 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <memory>
|
2014-05-09 00:50:10 +05:30
|
|
|
#include "logic/minecraft/OpSys.h"
|
|
|
|
#include "logic/minecraft/OneSixRule.h"
|
2014-03-02 23:42:04 +05:30
|
|
|
#include "MMCError.h"
|
|
|
|
|
2014-03-02 03:36:47 +05:30
|
|
|
class VersionFinal;
|
|
|
|
|
2014-03-02 23:42:04 +05:30
|
|
|
class VersionBuildError : public MMCError
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VersionBuildError(QString cause) : MMCError(cause) {};
|
2014-03-10 23:25:54 +05:30
|
|
|
virtual ~VersionBuildError() noexcept {}
|
2014-03-02 23:42:04 +05:30
|
|
|
};
|
|
|
|
|
2014-03-10 04:12:25 +05:30
|
|
|
/**
|
|
|
|
* the base version file was meant for a newer version of the vanilla launcher than we support
|
|
|
|
*/
|
|
|
|
class LauncherVersionError : public VersionBuildError
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LauncherVersionError(int actual, int supported)
|
|
|
|
: VersionBuildError(QObject::tr(
|
|
|
|
"The base version file of this instance was meant for a newer (%1) "
|
|
|
|
"version of the vanilla launcher than this version of MultiMC supports (%2).")
|
|
|
|
.arg(actual)
|
|
|
|
.arg(supported)) {};
|
2014-03-10 23:25:54 +05:30
|
|
|
virtual ~LauncherVersionError() noexcept {}
|
2014-03-10 04:12:25 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* some patch was intended for a different version of minecraft
|
|
|
|
*/
|
|
|
|
class MinecraftVersionMismatch : public VersionBuildError
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MinecraftVersionMismatch(QString fileId, QString mcVersion, QString parentMcVersion)
|
|
|
|
: VersionBuildError(QObject::tr("The patch %1 is for a different version of Minecraft "
|
|
|
|
"(%2) than that of the instance (%3).")
|
|
|
|
.arg(fileId)
|
|
|
|
.arg(mcVersion)
|
|
|
|
.arg(parentMcVersion)) {};
|
2014-03-10 23:25:54 +05:30
|
|
|
virtual ~MinecraftVersionMismatch() noexcept {}
|
2014-03-10 04:12:25 +05:30
|
|
|
};
|
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
struct RawLibrary;
|
|
|
|
typedef std::shared_ptr<RawLibrary> RawLibraryPtr;
|
2014-03-03 05:53:10 +05:30
|
|
|
struct RawLibrary
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
QString url;
|
|
|
|
QString hint;
|
|
|
|
QString absoluteUrl;
|
|
|
|
bool applyExcludes = false;
|
|
|
|
QStringList excludes;
|
|
|
|
bool applyNatives = false;
|
|
|
|
QList<QPair<OpSys, QString>> natives;
|
|
|
|
bool applyRules = false;
|
|
|
|
QList<std::shared_ptr<Rule>> rules;
|
|
|
|
|
|
|
|
// user for '+' libraries
|
|
|
|
enum InsertType
|
|
|
|
{
|
|
|
|
Apply,
|
|
|
|
Append,
|
|
|
|
Prepend,
|
|
|
|
Replace
|
|
|
|
};
|
|
|
|
InsertType insertType = Append;
|
|
|
|
QString insertData;
|
|
|
|
enum DependType
|
|
|
|
{
|
|
|
|
Soft,
|
|
|
|
Hard
|
|
|
|
};
|
|
|
|
DependType dependType = Soft;
|
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename);
|
2014-03-03 05:53:10 +05:30
|
|
|
};
|
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
struct Jarmod;
|
|
|
|
typedef std::shared_ptr<Jarmod> JarmodPtr;
|
|
|
|
struct Jarmod
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
QString baseurl;
|
|
|
|
QString hint;
|
|
|
|
QString absoluteUrl;
|
|
|
|
|
|
|
|
static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename);
|
|
|
|
};
|
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
struct VersionFile;
|
|
|
|
typedef std::shared_ptr<VersionFile> VersionFilePtr;
|
2014-03-02 03:36:47 +05:30
|
|
|
struct VersionFile
|
|
|
|
{
|
2014-03-03 05:53:10 +05:30
|
|
|
public: /* methods */
|
2014-03-05 06:20:05 +05:30
|
|
|
static VersionFilePtr fromJson(const QJsonDocument &doc, const QString &filename,
|
2014-03-10 04:12:25 +05:30
|
|
|
const bool requireOrder, const bool isFTB = false);
|
2014-03-03 05:53:10 +05:30
|
|
|
|
2014-03-05 06:20:05 +05:30
|
|
|
static OneSixLibraryPtr createLibrary(RawLibraryPtr lib);
|
|
|
|
int findLibrary(QList<OneSixLibraryPtr> haystack, const QString &needle);
|
2014-03-03 05:53:10 +05:30
|
|
|
void applyTo(VersionFinal *version);
|
2014-04-23 05:57:40 +05:30
|
|
|
bool isVanilla();
|
|
|
|
bool hasJarMods();
|
2014-03-03 05:53:10 +05:30
|
|
|
public: /* data */
|
2014-03-03 13:38:32 +05:30
|
|
|
int order = 0;
|
2014-03-02 03:36:47 +05:30
|
|
|
QString name;
|
|
|
|
QString fileId;
|
|
|
|
QString version;
|
|
|
|
// TODO use the mcVersion to determine if a version file should be removed on update
|
|
|
|
QString mcVersion;
|
|
|
|
QString filename;
|
|
|
|
// TODO requirements
|
|
|
|
// QMap<QString, QString> requirements;
|
|
|
|
QString id;
|
|
|
|
QString mainClass;
|
2014-05-08 22:35:07 +05:30
|
|
|
QString appletClass;
|
2014-03-02 03:36:47 +05:30
|
|
|
QString overwriteMinecraftArguments;
|
|
|
|
QString addMinecraftArguments;
|
|
|
|
QString removeMinecraftArguments;
|
|
|
|
QString processArguments;
|
|
|
|
QString type;
|
2014-05-08 22:35:07 +05:30
|
|
|
QString versionReleaseTime;
|
|
|
|
QString versionFileUpdateTime;
|
2014-03-02 03:36:47 +05:30
|
|
|
QString assets;
|
|
|
|
int minimumLauncherVersion = -1;
|
|
|
|
|
|
|
|
bool shouldOverwriteTweakers = false;
|
|
|
|
QStringList overwriteTweakers;
|
|
|
|
QStringList addTweakers;
|
|
|
|
QStringList removeTweakers;
|
|
|
|
|
|
|
|
bool shouldOverwriteLibs = false;
|
2014-03-05 06:20:05 +05:30
|
|
|
QList<RawLibraryPtr> overwriteLibs;
|
|
|
|
QList<RawLibraryPtr> addLibs;
|
2014-03-02 03:36:47 +05:30
|
|
|
QList<QString> removeLibs;
|
2014-04-23 05:57:40 +05:30
|
|
|
|
|
|
|
QSet<QString> traits;
|
|
|
|
|
|
|
|
QList<JarmodPtr> jarMods;
|
2014-03-10 23:25:54 +05:30
|
|
|
};
|