NOISSUE stuff and things happened. Maybe.
This commit is contained in:
@ -20,6 +20,8 @@
|
||||
#include "minecraft/launch/ModMinecraftJar.h"
|
||||
#include "minecraft/launch/ClaimAccount.h"
|
||||
#include "java/launch/CheckJava.h"
|
||||
#include <meta/Index.h>
|
||||
#include <meta/VersionList.h>
|
||||
|
||||
#include <icons/IIconList.h>
|
||||
|
||||
@ -105,7 +107,7 @@ QString MinecraftInstance::binRoot() const
|
||||
|
||||
std::shared_ptr< BaseVersionList > MinecraftInstance::versionList() const
|
||||
{
|
||||
return ENV.getVersionList("net.minecraft");
|
||||
return ENV.metadataIndex()->get("net.minecraft");
|
||||
}
|
||||
|
||||
QStringList MinecraftInstance::javaArguments() const
|
||||
|
@ -210,7 +210,7 @@ VersionFilePtr MojangVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
||||
readVersionProperties(root, out.get());
|
||||
|
||||
out->name = "Minecraft";
|
||||
out->fileId = "net.minecraft";
|
||||
out->uid = "net.minecraft";
|
||||
out->version = out->minecraftVersion;
|
||||
out->filename = filename;
|
||||
|
||||
|
@ -51,8 +51,6 @@ public:
|
||||
virtual void applyTo(MinecraftProfile *profile) = 0;
|
||||
|
||||
virtual bool isMinecraftVersion() = 0;
|
||||
virtual bool hasJarMods() = 0;
|
||||
virtual QList<JarmodPtr> getJarMods() = 0;
|
||||
|
||||
virtual bool isMoveable() = 0;
|
||||
virtual bool isCustomizable() = 0;
|
||||
|
@ -102,7 +102,7 @@ bool readOverrideOrders(QString path, PatchOrder &order)
|
||||
static VersionFilePtr createErrorVersionFile(QString fileId, QString filepath, QString error)
|
||||
{
|
||||
auto outError = std::make_shared<VersionFile>();
|
||||
outError->fileId = outError->name = fileId;
|
||||
outError->uid = outError->name = fileId;
|
||||
outError->filename = filepath;
|
||||
outError->addProblem(PROBLEM_ERROR, error);
|
||||
return outError;
|
||||
|
@ -14,12 +14,7 @@
|
||||
|
||||
bool VersionFile::isMinecraftVersion()
|
||||
{
|
||||
return fileId == "net.minecraft";
|
||||
}
|
||||
|
||||
bool VersionFile::hasJarMods()
|
||||
{
|
||||
return !jarMods.isEmpty();
|
||||
return uid == "net.minecraft";
|
||||
}
|
||||
|
||||
void VersionFile::applyTo(MinecraftProfile *profile)
|
||||
@ -29,7 +24,7 @@ void VersionFile::applyTo(MinecraftProfile *profile)
|
||||
{
|
||||
if (QRegExp(dependsOnMinecraftVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1)
|
||||
{
|
||||
throw MinecraftVersionMismatch(fileId, dependsOnMinecraftVersion, theirVersion);
|
||||
throw MinecraftVersionMismatch(uid, dependsOnMinecraftVersion, theirVersion);
|
||||
}
|
||||
}
|
||||
profile->applyMinecraftVersion(minecraftVersion);
|
||||
|
@ -25,7 +25,6 @@ class VersionFile : public ProfilePatch
|
||||
public: /* methods */
|
||||
virtual void applyTo(MinecraftProfile *profile) override;
|
||||
virtual bool isMinecraftVersion() override;
|
||||
virtual bool hasJarMods() override;
|
||||
virtual int getOrder() override
|
||||
{
|
||||
return order;
|
||||
@ -34,13 +33,9 @@ public: /* methods */
|
||||
{
|
||||
this->order = order;
|
||||
}
|
||||
virtual QList<JarmodPtr> getJarMods() override
|
||||
{
|
||||
return jarMods;
|
||||
}
|
||||
virtual QString getID() override
|
||||
{
|
||||
return fileId;
|
||||
return uid;
|
||||
}
|
||||
virtual QString getName() override
|
||||
{
|
||||
@ -120,9 +115,6 @@ public: /* methods */
|
||||
|
||||
|
||||
public: /* data */
|
||||
/// MultiMC: order hint for this version file if no explicit order is set
|
||||
int order = 0;
|
||||
|
||||
// Flags for UI and version file manipulation in general
|
||||
bool m_isVanilla = false;
|
||||
bool m_isRemovable = false;
|
||||
@ -130,6 +122,9 @@ public: /* data */
|
||||
bool m_isCustomizable = false;
|
||||
bool m_isMovable = false;
|
||||
|
||||
/// MultiMC: order hint for this version file if no explicit order is set
|
||||
int order = 0;
|
||||
|
||||
/// MultiMC: filename of the file this was loaded from
|
||||
QString filename;
|
||||
|
||||
@ -137,7 +132,7 @@ public: /* data */
|
||||
QString name;
|
||||
|
||||
/// MultiMC: package ID of this package
|
||||
QString fileId;
|
||||
QString uid;
|
||||
|
||||
/// MultiMC: version of this package
|
||||
QString version;
|
||||
@ -191,5 +186,3 @@ public:
|
||||
// Mojang: extended asset index download information
|
||||
std::shared_ptr<MojangAssetIndexInfo> mojangAssetIndex;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ void FTBProfileStrategy::loadDefaultBuiltinPatches()
|
||||
if(QFile::exists(mcJson))
|
||||
{
|
||||
auto file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
|
||||
file->fileId = "net.minecraft";
|
||||
file->uid = "net.minecraft";
|
||||
file->name = QObject::tr("Minecraft (tracked)");
|
||||
file->setVanilla(true);
|
||||
if(file->version.isEmpty())
|
||||
@ -64,7 +64,7 @@ void FTBProfileStrategy::loadDefaultBuiltinPatches()
|
||||
addLib->setHint("local");
|
||||
addLib->setStoragePrefix(nativeInstance->librariesPath().absolutePath());
|
||||
}
|
||||
file->fileId = "org.multimc.ftb.pack";
|
||||
file->uid = "org.multimc.ftb.pack";
|
||||
file->setVanilla(true);
|
||||
file->name = QObject::tr("%1 (FTB pack)").arg(m_instance->name());
|
||||
if(file->version.isEmpty())
|
||||
|
@ -99,6 +99,7 @@ inline QDomElement getDomElementByTagName(QDomElement parent, QString tagname)
|
||||
|
||||
void LWJGLVersionList::rssFailed(const QString& reason)
|
||||
{
|
||||
m_rssDLJob.reset();
|
||||
m_loading = false;
|
||||
qWarning() << "Failed to load LWJGL list. Network error: " + reason;
|
||||
}
|
||||
@ -116,8 +117,9 @@ void LWJGLVersionList::rssSucceeded()
|
||||
if (!doc.setContent(m_rssData, false, &xmlErrorMsg, &errorLine))
|
||||
{
|
||||
qWarning() << "Failed to load LWJGL list. XML error: " + xmlErrorMsg + " at line " + QString::number(errorLine);
|
||||
m_loading = false;
|
||||
m_rssDLJob.reset();
|
||||
m_rssData.clear();
|
||||
m_loading = false;
|
||||
return;
|
||||
}
|
||||
m_rssData.clear();
|
||||
@ -162,5 +164,6 @@ void LWJGLVersionList::rssSucceeded()
|
||||
endResetModel();
|
||||
|
||||
qDebug() << "Loaded LWJGL list.";
|
||||
m_rssDLJob.reset();
|
||||
m_loading = false;
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ public:
|
||||
return m_vlist[i];
|
||||
}
|
||||
|
||||
virtual Task* getLoadTask() override
|
||||
virtual shared_qobject_ptr<Task> getLoadTask() override
|
||||
{
|
||||
return nullptr;
|
||||
return m_rssDLJob;
|
||||
}
|
||||
|
||||
virtual void sortVersions() override {};
|
||||
|
@ -56,7 +56,7 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
|
||||
}
|
||||
auto file = ProfileUtils::parseJsonFile(QFileInfo(sourceFile), false);
|
||||
ProfileUtils::removeLwjglFromPatch(file);
|
||||
file->fileId = "net.minecraft";
|
||||
file->uid = "net.minecraft";
|
||||
file->version = file->minecraftVersion;
|
||||
file->name = "Minecraft";
|
||||
auto data = OneSixVersionFormat::versionFileToJson(file, false).toJson();
|
||||
@ -81,6 +81,107 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
|
||||
}
|
||||
}
|
||||
|
||||
class MetaPatchProvider : public ProfilePatch
|
||||
{
|
||||
public: /* con/des */
|
||||
MetaPatchProvider(std::shared_ptr<Meta::Version> data)
|
||||
:m_version(data)
|
||||
{
|
||||
}
|
||||
public:
|
||||
QString getFilename() override
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
QString getID() override
|
||||
{
|
||||
return m_version->uid();
|
||||
}
|
||||
QString getName() override
|
||||
{
|
||||
auto vfile = getFile();
|
||||
if(vfile)
|
||||
{
|
||||
return vfile->getName();
|
||||
}
|
||||
return m_version->name();
|
||||
}
|
||||
QDateTime getReleaseDateTime() override
|
||||
{
|
||||
return m_version->time();
|
||||
}
|
||||
QString getVersion() override
|
||||
{
|
||||
return m_version->version();
|
||||
}
|
||||
std::shared_ptr<class VersionFile> getVersionFile() override
|
||||
{
|
||||
return m_version->data();
|
||||
}
|
||||
void setOrder(int) override
|
||||
{
|
||||
}
|
||||
int getOrder() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
VersionSource getVersionSource() override
|
||||
{
|
||||
return VersionSource::Local;
|
||||
}
|
||||
bool isVersionChangeable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool isRevertible() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool isRemovable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool isCustom() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool isCustomizable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool isMoveable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool isEditable() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool isMinecraftVersion() override
|
||||
{
|
||||
return getID() == "net.minecraft";
|
||||
}
|
||||
void applyTo(MinecraftProfile * profile) override
|
||||
{
|
||||
auto vfile = getFile();
|
||||
if(vfile)
|
||||
{
|
||||
vfile->applyTo(profile);
|
||||
}
|
||||
}
|
||||
private:
|
||||
VersionFilePtr getFile()
|
||||
{
|
||||
if(!m_version->isLoaded())
|
||||
{
|
||||
m_version->load();
|
||||
}
|
||||
return m_version->data();
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<Meta::Version> m_version;
|
||||
};
|
||||
|
||||
void OneSixProfileStrategy::loadDefaultBuiltinPatches()
|
||||
{
|
||||
{
|
||||
@ -101,7 +202,7 @@ void OneSixProfileStrategy::loadDefaultBuiltinPatches()
|
||||
else
|
||||
{
|
||||
auto mcversion = ENV.metadataIndex()->get("net.minecraft", m_instance->intendedVersionId());
|
||||
minecraftPatch = std::dynamic_pointer_cast<ProfilePatch>(mcversion);
|
||||
minecraftPatch = std::make_shared<MetaPatchProvider>(mcversion);
|
||||
}
|
||||
if (!minecraftPatch)
|
||||
{
|
||||
@ -124,7 +225,7 @@ void OneSixProfileStrategy::loadDefaultBuiltinPatches()
|
||||
else
|
||||
{
|
||||
auto lwjglversion = ENV.metadataIndex()->get("org.lwjgl", "2.9.1");
|
||||
lwjglPatch = std::dynamic_pointer_cast<ProfilePatch>(lwjglversion);
|
||||
lwjglPatch = std::make_shared<MetaPatchProvider>(lwjglversion);
|
||||
}
|
||||
if (!lwjglPatch)
|
||||
{
|
||||
@ -162,10 +263,10 @@ void OneSixProfileStrategy::loadUserPatches()
|
||||
qDebug() << "Reading" << filename << "by user order";
|
||||
VersionFilePtr file = ProfileUtils::parseJsonFile(finfo, false);
|
||||
// sanity check. prevent tampering with files.
|
||||
if (file->fileId != id)
|
||||
if (file->uid != id)
|
||||
{
|
||||
file->addProblem(PROBLEM_WARNING, QObject::tr("load id %1 does not match internal id %2").arg(id, file->fileId));
|
||||
seen_extra.insert(file->fileId);
|
||||
file->addProblem(PROBLEM_WARNING, QObject::tr("load id %1 does not match internal id %2").arg(id, file->uid));
|
||||
seen_extra.insert(file->uid);
|
||||
}
|
||||
file->setRemovable(true);
|
||||
file->setMovable(true);
|
||||
@ -185,15 +286,15 @@ void OneSixProfileStrategy::loadUserPatches()
|
||||
qDebug() << "Reading" << info.fileName();
|
||||
auto file = ProfileUtils::parseJsonFile(info, true);
|
||||
// ignore builtins
|
||||
if (file->fileId == "net.minecraft")
|
||||
if (file->uid == "net.minecraft")
|
||||
continue;
|
||||
if (file->fileId == "org.lwjgl")
|
||||
if (file->uid == "org.lwjgl")
|
||||
continue;
|
||||
// do not load versions with broken IDs twice
|
||||
if(seen_extra.contains(file->fileId))
|
||||
if(seen_extra.contains(file->uid))
|
||||
continue;
|
||||
// do not load what we already loaded in the first pass
|
||||
if (userOrder.contains(file->fileId))
|
||||
if (userOrder.contains(file->uid))
|
||||
continue;
|
||||
file->setRemovable(true);
|
||||
file->setMovable(true);
|
||||
@ -203,7 +304,7 @@ void OneSixProfileStrategy::loadUserPatches()
|
||||
file->assets = QString();
|
||||
file->mojangAssetIndex.reset();
|
||||
// HACK
|
||||
files.insert(file->order, file);
|
||||
files.insert(file->getOrder(), file);
|
||||
}
|
||||
QSet<int> seen;
|
||||
for (auto order : files.keys())
|
||||
@ -284,7 +385,8 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
|
||||
return true;
|
||||
};
|
||||
|
||||
for(auto &jarmod: patch->getJarMods())
|
||||
auto &jarMods = patch->getVersionFile()->jarMods;
|
||||
for(auto &jarmod: jarMods)
|
||||
{
|
||||
ok &= preRemoveJarMod(jarmod);
|
||||
}
|
||||
@ -404,8 +506,8 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
|
||||
jarMod->originalName = sourceInfo.completeBaseName();
|
||||
f->jarMods.append(jarMod);
|
||||
f->name = target_name;
|
||||
f->fileId = target_id;
|
||||
f->order = profile->getFreeOrderNumber();
|
||||
f->uid = target_id;
|
||||
f->setOrder(profile->getFreeOrderNumber());
|
||||
QString patchFileName = FS::PathCombine(patchDir, target_id + ".json");
|
||||
f->filename = patchFileName;
|
||||
f->setMovable(true);
|
||||
|
@ -51,7 +51,7 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
||||
{
|
||||
if (root.contains("order"))
|
||||
{
|
||||
out->order = requireInteger(root.value("order"));
|
||||
out->setOrder(requireInteger(root.value("order")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -61,7 +61,16 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
||||
}
|
||||
|
||||
out->name = root.value("name").toString();
|
||||
out->fileId = root.value("fileId").toString();
|
||||
|
||||
if(root.contains("uid"))
|
||||
{
|
||||
out->uid = root.value("uid").toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
out->uid = root.value("fileId").toString();
|
||||
}
|
||||
|
||||
out->version = root.value("version").toString();
|
||||
out->dependsOnMinecraftVersion = root.value("mcVersion").toString();
|
||||
out->filename = filename;
|
||||
@ -161,10 +170,13 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
|
||||
QJsonObject root;
|
||||
if (saveOrder)
|
||||
{
|
||||
root.insert("order", patch->order);
|
||||
root.insert("order", patch->getOrder());
|
||||
}
|
||||
writeString(root, "name", patch->name);
|
||||
writeString(root, "fileId", patch->fileId);
|
||||
|
||||
writeString(root, "uid", patch->uid);
|
||||
writeString(root, "fileId", patch->uid);
|
||||
|
||||
writeString(root, "version", patch->version);
|
||||
writeString(root, "mcVersion", patch->dependsOnMinecraftVersion);
|
||||
|
||||
|
Reference in New Issue
Block a user