NOISSUE Remove Minecraft version list and versions.
This commit is contained in:
parent
8321187a20
commit
2980322c3b
@ -23,7 +23,6 @@
|
||||
#include "settings/Setting.h"
|
||||
#include "settings/OverrideSetting.h"
|
||||
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "FileSystem.h"
|
||||
#include "Commandline.h"
|
||||
|
||||
|
@ -252,10 +252,6 @@ set(MINECRAFT_SOURCES
|
||||
minecraft/JarMod.h
|
||||
minecraft/MinecraftInstance.cpp
|
||||
minecraft/MinecraftInstance.h
|
||||
minecraft/MinecraftVersion.cpp
|
||||
minecraft/MinecraftVersion.h
|
||||
minecraft/MinecraftVersionList.cpp
|
||||
minecraft/MinecraftVersionList.h
|
||||
minecraft/Rule.cpp
|
||||
minecraft/Rule.h
|
||||
minecraft/OpSys.cpp
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "FileSystem.h"
|
||||
|
||||
//FIXME: remove this
|
||||
#include "minecraft/MinecraftVersion.h"
|
||||
#include "minecraft/onesix/OneSixInstance.h"
|
||||
|
||||
InstanceCreationTask::InstanceCreationTask(SettingsObjectPtr settings, BaseInstanceProvider* target, BaseVersionPtr version,
|
||||
@ -21,12 +20,14 @@ InstanceCreationTask::InstanceCreationTask(SettingsObjectPtr settings, BaseInsta
|
||||
void InstanceCreationTask::executeTask()
|
||||
{
|
||||
setStatus(tr("Creating instance from version %1").arg(m_version->name()));
|
||||
/*
|
||||
auto minecraftVersion = std::dynamic_pointer_cast<MinecraftVersion>(m_version);
|
||||
if(!minecraftVersion)
|
||||
{
|
||||
emitFailed(tr("The supplied version is not a Minecraft version."));
|
||||
return ;
|
||||
}
|
||||
*/
|
||||
|
||||
QString stagingPath = m_target->getStagedInstancePath();
|
||||
QDir rootDir(stagingPath);
|
||||
@ -34,7 +35,6 @@ void InstanceCreationTask::executeTask()
|
||||
auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(stagingPath, "instance.cfg"));
|
||||
instanceSettings->registerSetting("InstanceType", "Legacy");
|
||||
|
||||
auto mcVer = std::dynamic_pointer_cast<MinecraftVersion>(m_version);
|
||||
instanceSettings->set("InstanceType", "OneSix");
|
||||
InstancePtr inst(new OneSixInstance(m_globalSettings, instanceSettings, stagingPath));
|
||||
inst->setIntendedVersionId(m_version->descriptor());
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <settings/Setting.h>
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "Env.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include <MMCStrings.h>
|
||||
#include <pathmatcher/RegexpMatcher.h>
|
||||
#include <pathmatcher/MultiMatcher.h>
|
||||
@ -24,6 +23,8 @@
|
||||
|
||||
#include <icons/IIconList.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#define IBUS "@im=ibus"
|
||||
|
||||
// all of this because keeping things compatible with deprecated old settings
|
||||
|
@ -1,230 +0,0 @@
|
||||
#include "MinecraftVersion.h"
|
||||
#include "MinecraftProfile.h"
|
||||
#include "VersionBuildError.h"
|
||||
#include "ProfileUtils.h"
|
||||
#include "settings/SettingsObject.h"
|
||||
|
||||
bool MinecraftVersion::usesLegacyLauncher()
|
||||
{
|
||||
return m_traits.contains("legacyLaunch") || m_traits.contains("aplhaLaunch");
|
||||
}
|
||||
|
||||
QString MinecraftVersion::descriptor()
|
||||
{
|
||||
return m_descriptor;
|
||||
}
|
||||
|
||||
QString MinecraftVersion::name()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString MinecraftVersion::typeString() const
|
||||
{
|
||||
if(m_type == "snapshot")
|
||||
{
|
||||
return QObject::tr("Snapshot");
|
||||
}
|
||||
else if (m_type == "release")
|
||||
{
|
||||
return QObject::tr("Regular release");
|
||||
}
|
||||
else if (m_type == "old_alpha")
|
||||
{
|
||||
return QObject::tr("Alpha");
|
||||
}
|
||||
else if (m_type == "old_beta")
|
||||
{
|
||||
return QObject::tr("Beta");
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
VersionSource MinecraftVersion::getVersionSource()
|
||||
{
|
||||
return m_versionSource;
|
||||
}
|
||||
|
||||
bool MinecraftVersion::hasJarMods()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MinecraftVersion::isMinecraftVersion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void MinecraftVersion::applyFileTo(MinecraftProfile *profile)
|
||||
{
|
||||
if(m_versionSource == VersionSource::Local && getVersionFile())
|
||||
{
|
||||
getVersionFile()->applyTo(profile);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VersionIncomplete(QObject::tr("Can't apply incomplete/builtin Minecraft version %1").arg(m_name));
|
||||
}
|
||||
}
|
||||
|
||||
QString MinecraftVersion::getUrl() const
|
||||
{
|
||||
// legacy fallback
|
||||
if(m_versionFileURL.isEmpty())
|
||||
{
|
||||
return QString("http://") + URLConstants::AWS_DOWNLOAD_VERSIONS + m_descriptor + "/" + m_descriptor + ".json";
|
||||
}
|
||||
// current
|
||||
return m_versionFileURL;
|
||||
}
|
||||
|
||||
VersionFilePtr MinecraftVersion::getVersionFile()
|
||||
{
|
||||
QFileInfo versionFile(QString("versions/%1/%1.dat").arg(m_descriptor));
|
||||
m_problems.clear();
|
||||
m_problemSeverity = PROBLEM_NONE;
|
||||
if(!versionFile.exists())
|
||||
{
|
||||
if(m_loadedVersionFile)
|
||||
{
|
||||
m_loadedVersionFile.reset();
|
||||
}
|
||||
addProblem(PROBLEM_WARNING, QObject::tr("The patch file doesn't exist locally. It's possible it just needs to be downloaded."));
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if(versionFile.lastModified() != m_loadedVersionFileTimestamp)
|
||||
{
|
||||
auto loadedVersionFile = ProfileUtils::parseBinaryJsonFile(versionFile);
|
||||
loadedVersionFile->name = "Minecraft";
|
||||
loadedVersionFile->setCustomizable(true);
|
||||
m_loadedVersionFileTimestamp = versionFile.lastModified();
|
||||
m_loadedVersionFile = loadedVersionFile;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
m_loadedVersionFile.reset();
|
||||
addProblem(PROBLEM_ERROR, QObject::tr("The patch file couldn't be read:\n%1").arg(e.cause()));
|
||||
}
|
||||
}
|
||||
return m_loadedVersionFile;
|
||||
}
|
||||
|
||||
bool MinecraftVersion::isCustomizable()
|
||||
{
|
||||
switch(m_versionSource)
|
||||
{
|
||||
case VersionSource::Local:
|
||||
case VersionSource::Remote:
|
||||
// locally cached file, or a remote file that we can acquire can be customized
|
||||
return true;
|
||||
case VersionSource::Builtin:
|
||||
// builtins do not follow the normal OneSix format. They are not customizable.
|
||||
default:
|
||||
// Everything else is undefined and therefore not customizable.
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const QList<PatchProblem> &MinecraftVersion::getProblems()
|
||||
{
|
||||
if(m_versionSource != VersionSource::Builtin && getVersionFile())
|
||||
{
|
||||
return getVersionFile()->getProblems();
|
||||
}
|
||||
return ProfilePatch::getProblems();
|
||||
}
|
||||
|
||||
ProblemSeverity MinecraftVersion::getProblemSeverity()
|
||||
{
|
||||
if(m_versionSource != VersionSource::Builtin && getVersionFile())
|
||||
{
|
||||
return getVersionFile()->getProblemSeverity();
|
||||
}
|
||||
return ProfilePatch::getProblemSeverity();
|
||||
}
|
||||
|
||||
void MinecraftVersion::applyTo(MinecraftProfile *profile)
|
||||
{
|
||||
// do we have this one cached?
|
||||
if (m_versionSource == VersionSource::Local)
|
||||
{
|
||||
applyFileTo(profile);
|
||||
return;
|
||||
}
|
||||
// if not builtin, do not proceed any further.
|
||||
if (m_versionSource != VersionSource::Builtin)
|
||||
{
|
||||
throw VersionIncomplete(QObject::tr(
|
||||
"Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor));
|
||||
}
|
||||
profile->applyMinecraftVersion(m_descriptor);
|
||||
profile->applyMainClass(m_mainClass);
|
||||
profile->applyAppletClass(m_appletClass);
|
||||
profile->applyMinecraftArguments(" ${auth_player_name} ${auth_session}"); // all builtin versions are legacy
|
||||
profile->applyMinecraftVersionType(m_type);
|
||||
profile->applyTraits(m_traits);
|
||||
profile->applyProblemSeverity(m_problemSeverity);
|
||||
}
|
||||
|
||||
int MinecraftVersion::getOrder()
|
||||
{
|
||||
return order;
|
||||
}
|
||||
|
||||
void MinecraftVersion::setOrder(int order)
|
||||
{
|
||||
this->order = order;
|
||||
}
|
||||
|
||||
QList<JarmodPtr> MinecraftVersion::getJarMods()
|
||||
{
|
||||
return QList<JarmodPtr>();
|
||||
}
|
||||
|
||||
QString MinecraftVersion::getName()
|
||||
{
|
||||
return "Minecraft";
|
||||
}
|
||||
QString MinecraftVersion::getVersion()
|
||||
{
|
||||
return m_descriptor;
|
||||
}
|
||||
QString MinecraftVersion::getID()
|
||||
{
|
||||
return "net.minecraft";
|
||||
}
|
||||
QString MinecraftVersion::getFilename()
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
QDateTime MinecraftVersion::getReleaseDateTime()
|
||||
{
|
||||
return m_releaseTime;
|
||||
}
|
||||
|
||||
|
||||
bool MinecraftVersion::needsUpdate()
|
||||
{
|
||||
return m_versionSource == VersionSource::Remote || hasUpdate();
|
||||
}
|
||||
|
||||
bool MinecraftVersion::hasUpdate()
|
||||
{
|
||||
return m_versionSource == VersionSource::Remote || (m_versionSource == VersionSource::Local && upstreamUpdate);
|
||||
}
|
||||
|
||||
bool MinecraftVersion::isCustom()
|
||||
{
|
||||
// if we add any other source types, this will evaluate to false for them.
|
||||
return m_versionSource != VersionSource::Builtin
|
||||
&& m_versionSource != VersionSource::Local
|
||||
&& m_versionSource != VersionSource::Remote;
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
/* Copyright 2013-2017 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QStringList>
|
||||
#include <QSet>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "BaseVersion.h"
|
||||
#include "ProfilePatch.h"
|
||||
#include "VersionFile.h"
|
||||
|
||||
#include "multimc_logic_export.h"
|
||||
|
||||
class MinecraftProfile;
|
||||
class MinecraftVersion;
|
||||
typedef std::shared_ptr<MinecraftVersion> MinecraftVersionPtr;
|
||||
|
||||
class MULTIMC_LOGIC_EXPORT MinecraftVersion : public BaseVersion, public ProfilePatch
|
||||
{
|
||||
friend class MinecraftVersionList;
|
||||
|
||||
public: /* methods */
|
||||
bool usesLegacyLauncher();
|
||||
virtual QString descriptor() override;
|
||||
virtual QString name() override;
|
||||
virtual QString typeString() const override;
|
||||
virtual bool hasJarMods() override;
|
||||
virtual bool isMinecraftVersion() override;
|
||||
virtual void applyTo(MinecraftProfile *profile) override;
|
||||
virtual int getOrder() override;
|
||||
virtual void setOrder(int order) override;
|
||||
virtual QList<JarmodPtr> getJarMods() override;
|
||||
virtual QString getID() override;
|
||||
virtual QString getVersion() override;
|
||||
virtual QString getName() override;
|
||||
virtual QString getFilename() override;
|
||||
QDateTime getReleaseDateTime() override;
|
||||
VersionSource getVersionSource() override;
|
||||
|
||||
bool needsUpdate();
|
||||
bool hasUpdate();
|
||||
virtual bool isCustom() override;
|
||||
virtual bool isMoveable() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isCustomizable() override;
|
||||
virtual bool isRemovable() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isRevertible() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isEditable() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isVersionChangeable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual VersionFilePtr getVersionFile() override;
|
||||
|
||||
// virtual QJsonDocument toJson(bool saveOrder) override;
|
||||
|
||||
QString getUrl() const;
|
||||
|
||||
virtual const QList<PatchProblem> &getProblems() override;
|
||||
virtual ProblemSeverity getProblemSeverity() override;
|
||||
|
||||
private: /* methods */
|
||||
void applyFileTo(MinecraftProfile *profile);
|
||||
|
||||
protected: /* data */
|
||||
VersionSource m_versionSource = VersionSource::Builtin;
|
||||
|
||||
/// The URL that this version will be downloaded from.
|
||||
QString m_versionFileURL;
|
||||
|
||||
/// the human readable version name
|
||||
QString m_name;
|
||||
|
||||
/// the version ID.
|
||||
QString m_descriptor;
|
||||
|
||||
/// version traits. added by MultiMC
|
||||
QSet<QString> m_traits;
|
||||
|
||||
/// The main class this version uses (if any, can be empty).
|
||||
QString m_mainClass;
|
||||
|
||||
/// The applet class this version uses (if any, can be empty).
|
||||
QString m_appletClass;
|
||||
|
||||
/// The type of this release
|
||||
QString m_type;
|
||||
|
||||
/// the time this version was actually released by Mojang
|
||||
QDateTime m_releaseTime;
|
||||
|
||||
/// the time this version was last updated by Mojang
|
||||
QDateTime m_updateTime;
|
||||
|
||||
/// MD5 hash of the minecraft jar
|
||||
QString m_jarChecksum;
|
||||
|
||||
/// order of this file... default = -2
|
||||
int order = -2;
|
||||
|
||||
/// an update available from Mojang
|
||||
MinecraftVersionPtr upstreamUpdate;
|
||||
|
||||
QDateTime m_loadedVersionFileTimestamp;
|
||||
mutable VersionFilePtr m_loadedVersionFile;
|
||||
};
|
@ -1,614 +0,0 @@
|
||||
/* Copyright 2013-2017 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <QtXml>
|
||||
#include "Json.h"
|
||||
#include <QtAlgorithms>
|
||||
#include <QtNetwork>
|
||||
|
||||
#include "Env.h"
|
||||
#include "Exception.h"
|
||||
|
||||
#include "MinecraftVersionList.h"
|
||||
#include "net/URLConstants.h"
|
||||
|
||||
#include "ParseUtils.h"
|
||||
#include "ProfileUtils.h"
|
||||
#include "onesix/OneSixVersionFormat.h"
|
||||
#include "MojangVersionFormat.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
static const char * localVersionCache = "versions/versions.dat";
|
||||
|
||||
class MCVListLoadTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MCVListLoadTask(MinecraftVersionList *vlist);
|
||||
virtual ~MCVListLoadTask() override{};
|
||||
|
||||
virtual void executeTask() override;
|
||||
|
||||
protected
|
||||
slots:
|
||||
void list_downloaded();
|
||||
|
||||
protected:
|
||||
QNetworkReply *vlistReply;
|
||||
MinecraftVersionList *m_list;
|
||||
MinecraftVersion *m_currentStable;
|
||||
};
|
||||
|
||||
class MCVListVersionUpdateTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MCVListVersionUpdateTask(MinecraftVersionList *vlist, std::shared_ptr<MinecraftVersion> updatedVersion);
|
||||
virtual ~MCVListVersionUpdateTask() override{};
|
||||
virtual void executeTask() override;
|
||||
bool canAbort() const override;
|
||||
|
||||
public slots:
|
||||
bool abort() override;
|
||||
|
||||
protected
|
||||
slots:
|
||||
void json_downloaded();
|
||||
|
||||
protected:
|
||||
NetJobPtr specificVersionDownloadJob;
|
||||
QByteArray versionIndexData;
|
||||
std::shared_ptr<MinecraftVersion> updatedVersion;
|
||||
MinecraftVersionList *m_list;
|
||||
bool m_aborted = false;
|
||||
};
|
||||
|
||||
class ListLoadError : public Exception
|
||||
{
|
||||
public:
|
||||
ListLoadError(QString cause) : Exception(cause) {};
|
||||
virtual ~ListLoadError() noexcept
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
MinecraftVersionList::MinecraftVersionList(QObject *parent) : BaseVersionList(parent)
|
||||
{
|
||||
loadCachedList();
|
||||
}
|
||||
|
||||
Task *MinecraftVersionList::getLoadTask()
|
||||
{
|
||||
return new MCVListLoadTask(this);
|
||||
}
|
||||
|
||||
bool MinecraftVersionList::isLoaded()
|
||||
{
|
||||
return m_loaded;
|
||||
}
|
||||
|
||||
const BaseVersionPtr MinecraftVersionList::at(int i) const
|
||||
{
|
||||
return m_vlist.at(i);
|
||||
}
|
||||
|
||||
int MinecraftVersionList::count() const
|
||||
{
|
||||
return m_vlist.count();
|
||||
}
|
||||
|
||||
static bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second)
|
||||
{
|
||||
auto left = std::dynamic_pointer_cast<MinecraftVersion>(first);
|
||||
auto right = std::dynamic_pointer_cast<MinecraftVersion>(second);
|
||||
return left->getReleaseDateTime() > right->getReleaseDateTime();
|
||||
}
|
||||
|
||||
void MinecraftVersionList::sortInternal()
|
||||
{
|
||||
qSort(m_vlist.begin(), m_vlist.end(), cmpVersions);
|
||||
}
|
||||
|
||||
void MinecraftVersionList::loadCachedList()
|
||||
{
|
||||
QFile localIndex(localVersionCache);
|
||||
if (!localIndex.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!localIndex.open(QIODevice::ReadOnly))
|
||||
{
|
||||
// FIXME: this is actually a very bad thing! How do we deal with this?
|
||||
qCritical() << "The minecraft version cache can't be read.";
|
||||
return;
|
||||
}
|
||||
auto data = localIndex.readAll();
|
||||
try
|
||||
{
|
||||
localIndex.close();
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromBinaryData(data);
|
||||
if (jsonDoc.isNull())
|
||||
{
|
||||
throw ListLoadError(tr("Error reading the version list."));
|
||||
}
|
||||
loadMojangList(jsonDoc, VersionSource::Local);
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
// the cache has gone bad for some reason... flush it.
|
||||
qCritical() << "The minecraft version cache is corrupted. Flushing cache.";
|
||||
localIndex.remove();
|
||||
return;
|
||||
}
|
||||
m_hasLocalIndex = true;
|
||||
}
|
||||
|
||||
void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source)
|
||||
{
|
||||
qDebug() << "Loading" << ((source == VersionSource::Remote) ? "remote" : "local") << "version list.";
|
||||
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
throw ListLoadError(tr("Error parsing version list JSON: jsonDoc is not an object"));
|
||||
}
|
||||
|
||||
QJsonObject root = jsonDoc.object();
|
||||
|
||||
try
|
||||
{
|
||||
QJsonObject latest = Json::requireObject(root.value("latest"));
|
||||
m_latestReleaseID = Json::requireString(latest.value("release"));
|
||||
m_latestSnapshotID = Json::requireString(latest.value("snapshot"));
|
||||
}
|
||||
catch (Exception &err)
|
||||
{
|
||||
qCritical()
|
||||
<< tr("Error parsing version list JSON: couldn't determine latest versions");
|
||||
}
|
||||
|
||||
// Now, get the array of versions.
|
||||
if (!root.value("versions").isArray())
|
||||
{
|
||||
throw ListLoadError(tr("Error parsing version list JSON: version list object is "
|
||||
"missing 'versions' array"));
|
||||
}
|
||||
QJsonArray versions = root.value("versions").toArray();
|
||||
|
||||
QList<BaseVersionPtr> tempList;
|
||||
for (auto version : versions)
|
||||
{
|
||||
// Load the version info.
|
||||
if (!version.isObject())
|
||||
{
|
||||
qCritical() << "Error while parsing version list : invalid JSON structure";
|
||||
continue;
|
||||
}
|
||||
|
||||
QJsonObject versionObj = version.toObject();
|
||||
QString versionID = versionObj.value("id").toString("");
|
||||
if (versionID.isEmpty())
|
||||
{
|
||||
qCritical() << "Error while parsing version : version ID is missing";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Now, we construct the version object and add it to the list.
|
||||
std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion());
|
||||
mcVersion->m_name = mcVersion->m_descriptor = versionID;
|
||||
|
||||
mcVersion->m_releaseTime = timeFromS3Time(versionObj.value("releaseTime").toString(""));
|
||||
mcVersion->m_updateTime = timeFromS3Time(versionObj.value("time").toString(""));
|
||||
|
||||
// depends on where we load the version from -- network request or local file?
|
||||
mcVersion->m_versionSource = source;
|
||||
mcVersion->m_versionFileURL = versionObj.value("url").toString("");
|
||||
QString versionTypeStr = versionObj.value("type").toString("");
|
||||
if (versionTypeStr.isEmpty())
|
||||
{
|
||||
qCritical() << "Ignoring" << versionID
|
||||
<< "because it doesn't have the version type set.";
|
||||
continue;
|
||||
}
|
||||
// OneSix or Legacy. use filter to determine type
|
||||
if (versionTypeStr == "release")
|
||||
{
|
||||
}
|
||||
else if (versionTypeStr == "snapshot") // It's a snapshot... yay
|
||||
{
|
||||
}
|
||||
else if (versionTypeStr == "old_alpha")
|
||||
{
|
||||
}
|
||||
else if (versionTypeStr == "old_beta")
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
qCritical() << "Ignoring" << versionID
|
||||
<< "because it has an invalid version type.";
|
||||
continue;
|
||||
}
|
||||
mcVersion->m_type = versionTypeStr;
|
||||
qDebug() << "Loaded version" << versionID << "from"
|
||||
<< ((source == VersionSource::Remote) ? "remote" : "local") << "version list.";
|
||||
tempList.append(mcVersion);
|
||||
}
|
||||
updateListData(tempList);
|
||||
if(source == VersionSource::Remote)
|
||||
{
|
||||
m_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MinecraftVersionList::sortVersions()
|
||||
{
|
||||
beginResetModel();
|
||||
sortInternal();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QVariant MinecraftVersionList::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (index.row() > count())
|
||||
return QVariant();
|
||||
|
||||
auto version = std::dynamic_pointer_cast<MinecraftVersion>(m_vlist[index.row()]);
|
||||
switch (role)
|
||||
{
|
||||
case VersionPointerRole:
|
||||
return qVariantFromValue(m_vlist[index.row()]);
|
||||
|
||||
case VersionRole:
|
||||
return version->name();
|
||||
|
||||
case VersionIdRole:
|
||||
return version->descriptor();
|
||||
|
||||
case RecommendedRole:
|
||||
return version->descriptor() == m_latestReleaseID;
|
||||
|
||||
case LatestRole:
|
||||
{
|
||||
if(version->descriptor() != m_latestSnapshotID)
|
||||
return false;
|
||||
MinecraftVersionPtr latestRelease = std::dynamic_pointer_cast<MinecraftVersion>(getLatestStable());
|
||||
/*
|
||||
if(latestRelease && latestRelease->m_releaseTime > version->m_releaseTime)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
case TypeRole:
|
||||
return version->typeString();
|
||||
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
BaseVersionList::RoleList MinecraftVersionList::providesRoles() const
|
||||
{
|
||||
return {VersionPointerRole, VersionRole, VersionIdRole, RecommendedRole, LatestRole, TypeRole};
|
||||
}
|
||||
|
||||
BaseVersionPtr MinecraftVersionList::getLatestStable() const
|
||||
{
|
||||
if(m_lookup.contains(m_latestReleaseID))
|
||||
return m_lookup[m_latestReleaseID];
|
||||
return BaseVersionPtr();
|
||||
}
|
||||
|
||||
BaseVersionPtr MinecraftVersionList::getRecommended() const
|
||||
{
|
||||
return getLatestStable();
|
||||
}
|
||||
|
||||
void MinecraftVersionList::updateListData(QList<BaseVersionPtr> versions)
|
||||
{
|
||||
beginResetModel();
|
||||
for (auto version : versions)
|
||||
{
|
||||
auto descr = version->descriptor();
|
||||
|
||||
if (!m_lookup.contains(descr))
|
||||
{
|
||||
m_lookup[version->descriptor()] = version;
|
||||
m_vlist.append(version);
|
||||
continue;
|
||||
}
|
||||
auto orig = std::dynamic_pointer_cast<MinecraftVersion>(m_lookup[descr]);
|
||||
auto added = std::dynamic_pointer_cast<MinecraftVersion>(version);
|
||||
// updateListData is called after Mojang list loads. those can be local or remote
|
||||
// remote comes always after local
|
||||
// any other options are ignored
|
||||
if (orig->m_versionSource != VersionSource::Local || added->m_versionSource != VersionSource::Remote)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// alright, it's an update. put it inside the original, for further processing.
|
||||
orig->upstreamUpdate = added;
|
||||
}
|
||||
sortInternal();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
MCVListLoadTask::MCVListLoadTask(MinecraftVersionList *vlist)
|
||||
{
|
||||
m_list = vlist;
|
||||
m_currentStable = NULL;
|
||||
vlistReply = nullptr;
|
||||
}
|
||||
|
||||
void MCVListLoadTask::executeTask()
|
||||
{
|
||||
setStatus(tr("Loading instance version list..."));
|
||||
vlistReply = ENV.qnam().get(QNetworkRequest(QUrl("https://launchermeta.mojang.com/mc/game/version_manifest.json")));
|
||||
connect(vlistReply, SIGNAL(finished()), this, SLOT(list_downloaded()));
|
||||
}
|
||||
|
||||
void MCVListLoadTask::list_downloaded()
|
||||
{
|
||||
if (vlistReply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
vlistReply->deleteLater();
|
||||
emitFailed("Failed to load Minecraft main version list" + vlistReply->errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
auto data = vlistReply->readAll();
|
||||
vlistReply->deleteLater();
|
||||
try
|
||||
{
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
|
||||
if (jsonError.error != QJsonParseError::NoError)
|
||||
{
|
||||
throw ListLoadError(
|
||||
tr("Error parsing version list JSON: %1").arg(jsonError.errorString()));
|
||||
}
|
||||
m_list->loadMojangList(jsonDoc, VersionSource::Remote);
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
emitFailed(e.cause());
|
||||
return;
|
||||
}
|
||||
|
||||
emitSucceeded();
|
||||
return;
|
||||
}
|
||||
|
||||
MCVListVersionUpdateTask::MCVListVersionUpdateTask(MinecraftVersionList *vlist, std::shared_ptr<MinecraftVersion> updatedVersion)
|
||||
: Task()
|
||||
{
|
||||
m_list = vlist;
|
||||
this->updatedVersion = updatedVersion;
|
||||
}
|
||||
|
||||
void MCVListVersionUpdateTask::executeTask()
|
||||
{
|
||||
if(m_aborted)
|
||||
{
|
||||
emitFailed(tr("Task aborted."));
|
||||
return;
|
||||
}
|
||||
auto job = new NetJob("Version index");
|
||||
job->addNetAction(Net::Download::makeByteArray(QUrl(updatedVersion->getUrl()), &versionIndexData));
|
||||
specificVersionDownloadJob.reset(job);
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(succeeded()), SLOT(json_downloaded()));
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(failed(QString)), SIGNAL(failed(QString)));
|
||||
connect(specificVersionDownloadJob.get(), SIGNAL(progress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
|
||||
specificVersionDownloadJob->start();
|
||||
}
|
||||
|
||||
bool MCVListVersionUpdateTask::canAbort() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MCVListVersionUpdateTask::abort()
|
||||
{
|
||||
m_aborted = true;
|
||||
if(specificVersionDownloadJob)
|
||||
{
|
||||
return specificVersionDownloadJob->abort();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MCVListVersionUpdateTask::json_downloaded()
|
||||
{
|
||||
specificVersionDownloadJob.reset();
|
||||
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(versionIndexData, &jsonError);
|
||||
versionIndexData.clear();
|
||||
|
||||
if (jsonError.error != QJsonParseError::NoError)
|
||||
{
|
||||
emitFailed(tr("The download version file is not valid."));
|
||||
return;
|
||||
}
|
||||
VersionFilePtr file;
|
||||
try
|
||||
{
|
||||
file = MojangVersionFormat::versionFileFromJson(jsonDoc, "net.minecraft.json");
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
emitFailed(tr("Couldn't process version file: %1").arg(e.cause()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Strip LWJGL from the version file. We use our own.
|
||||
ProfileUtils::removeLwjglFromPatch(file);
|
||||
|
||||
// TODO: recognize and add LWJGL versions here.
|
||||
|
||||
file->fileId = "net.minecraft";
|
||||
|
||||
// now dump the file to disk
|
||||
auto doc = OneSixVersionFormat::versionFileToJson(file, false);
|
||||
auto newdata = doc.toBinaryData();
|
||||
auto id = updatedVersion->descriptor();
|
||||
QString targetPath = "versions/" + id + "/" + id + ".dat";
|
||||
FS::ensureFilePathExists(targetPath);
|
||||
QSaveFile vfile1(targetPath);
|
||||
if (!vfile1.open(QIODevice::Truncate | QIODevice::WriteOnly))
|
||||
{
|
||||
emitFailed(tr("Can't open %1 for writing.").arg(targetPath));
|
||||
return;
|
||||
}
|
||||
qint64 actual = 0;
|
||||
if ((actual = vfile1.write(newdata)) != newdata.size())
|
||||
{
|
||||
emitFailed(tr("Failed to write into %1. Written %2 out of %3.")
|
||||
.arg(targetPath)
|
||||
.arg(actual)
|
||||
.arg(newdata.size()));
|
||||
return;
|
||||
}
|
||||
if (!vfile1.commit())
|
||||
{
|
||||
emitFailed(tr("Can't commit changes to %1").arg(targetPath));
|
||||
return;
|
||||
}
|
||||
|
||||
m_list->finalizeUpdate(id);
|
||||
emitSucceeded();
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> MinecraftVersionList::createUpdateTask(QString version)
|
||||
{
|
||||
auto iter = m_lookup.find(version);
|
||||
if(iter == m_lookup.end())
|
||||
return nullptr;
|
||||
|
||||
auto mcversion = std::dynamic_pointer_cast<MinecraftVersion>(*iter);
|
||||
if(!mcversion)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::shared_ptr<Task>(new MCVListVersionUpdateTask(this, mcversion));
|
||||
}
|
||||
|
||||
void MinecraftVersionList::saveCachedList()
|
||||
{
|
||||
// FIXME: throw.
|
||||
if (!FS::ensureFilePathExists(localVersionCache))
|
||||
return;
|
||||
QSaveFile tfile(localVersionCache);
|
||||
if (!tfile.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
return;
|
||||
QJsonObject toplevel;
|
||||
QJsonArray entriesArr;
|
||||
for (auto version : m_vlist)
|
||||
{
|
||||
auto mcversion = std::dynamic_pointer_cast<MinecraftVersion>(version);
|
||||
// do not save the remote versions.
|
||||
if (mcversion->m_versionSource != VersionSource::Local)
|
||||
continue;
|
||||
QJsonObject entryObj;
|
||||
|
||||
entryObj.insert("id", mcversion->descriptor());
|
||||
entryObj.insert("version", mcversion->descriptor());
|
||||
entryObj.insert("time", timeToS3Time(mcversion->m_updateTime));
|
||||
entryObj.insert("releaseTime", timeToS3Time(mcversion->m_releaseTime));
|
||||
entryObj.insert("url", mcversion->m_versionFileURL);
|
||||
entryObj.insert("type", mcversion->m_type);
|
||||
entriesArr.append(entryObj);
|
||||
}
|
||||
toplevel.insert("versions", entriesArr);
|
||||
|
||||
{
|
||||
bool someLatest = false;
|
||||
QJsonObject latestObj;
|
||||
if(!m_latestReleaseID.isNull())
|
||||
{
|
||||
latestObj.insert("release", m_latestReleaseID);
|
||||
someLatest = true;
|
||||
}
|
||||
if(!m_latestSnapshotID.isNull())
|
||||
{
|
||||
latestObj.insert("snapshot", m_latestSnapshotID);
|
||||
someLatest = true;
|
||||
}
|
||||
if(someLatest)
|
||||
{
|
||||
toplevel.insert("latest", latestObj);
|
||||
}
|
||||
}
|
||||
|
||||
QJsonDocument doc(toplevel);
|
||||
QByteArray jsonData = doc.toBinaryData();
|
||||
qint64 result = tfile.write(jsonData);
|
||||
if (result == -1)
|
||||
return;
|
||||
if (result != jsonData.size())
|
||||
return;
|
||||
tfile.commit();
|
||||
}
|
||||
|
||||
void MinecraftVersionList::finalizeUpdate(QString version)
|
||||
{
|
||||
int idx = -1;
|
||||
for (int i = 0; i < m_vlist.size(); i++)
|
||||
{
|
||||
if (version == m_vlist[i]->descriptor())
|
||||
{
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto updatedVersion = std::dynamic_pointer_cast<MinecraftVersion>(m_vlist[idx]);
|
||||
|
||||
// reject any updates to builtin versions.
|
||||
if (updatedVersion->m_versionSource == VersionSource::Builtin)
|
||||
return;
|
||||
|
||||
// if we have an update for the version, replace it, make the update local
|
||||
if (updatedVersion->upstreamUpdate)
|
||||
{
|
||||
auto updatedWith = updatedVersion->upstreamUpdate;
|
||||
updatedWith->m_versionSource = VersionSource::Local;
|
||||
m_vlist[idx] = updatedWith;
|
||||
m_lookup[version] = updatedWith;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, just set the version as local;
|
||||
updatedVersion->m_versionSource = VersionSource::Local;
|
||||
}
|
||||
|
||||
dataChanged(index(idx), index(idx));
|
||||
|
||||
saveCachedList();
|
||||
}
|
||||
|
||||
#include "MinecraftVersionList.moc"
|
@ -1,72 +0,0 @@
|
||||
/* Copyright 2013-2017 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
|
||||
#include "BaseVersionList.h"
|
||||
#include "tasks/Task.h"
|
||||
#include "minecraft/MinecraftVersion.h"
|
||||
#include <net/NetJob.h>
|
||||
|
||||
#include "multimc_logic_export.h"
|
||||
|
||||
class MCVListLoadTask;
|
||||
class MCVListVersionUpdateTask;
|
||||
|
||||
class MULTIMC_LOGIC_EXPORT MinecraftVersionList : public BaseVersionList
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
void sortInternal();
|
||||
void loadMojangList(QJsonDocument jsonDoc, VersionSource source);
|
||||
void loadCachedList();
|
||||
void saveCachedList();
|
||||
void finalizeUpdate(QString version);
|
||||
public:
|
||||
friend class MCVListLoadTask;
|
||||
friend class MCVListVersionUpdateTask;
|
||||
|
||||
explicit MinecraftVersionList(QObject *parent = 0);
|
||||
|
||||
std::shared_ptr<Task> createUpdateTask(QString version);
|
||||
|
||||
virtual Task *getLoadTask() override;
|
||||
virtual bool isLoaded() override;
|
||||
virtual const BaseVersionPtr at(int i) const override;
|
||||
virtual int count() const override;
|
||||
virtual void sortVersions() override;
|
||||
virtual QVariant data(const QModelIndex & index, int role) const override;
|
||||
virtual RoleList providesRoles() const override;
|
||||
|
||||
virtual BaseVersionPtr getLatestStable() const override;
|
||||
virtual BaseVersionPtr getRecommended() const override;
|
||||
|
||||
protected:
|
||||
QList<BaseVersionPtr> m_vlist;
|
||||
QMap<QString, BaseVersionPtr> m_lookup;
|
||||
|
||||
bool m_loaded = false;
|
||||
bool m_hasLocalIndex = false;
|
||||
QString m_latestReleaseID = "INVALID";
|
||||
QString m_latestSnapshotID = "INVALID";
|
||||
|
||||
protected
|
||||
slots:
|
||||
virtual void updateListData(QList<BaseVersionPtr> versions) override;
|
||||
};
|
@ -1,6 +1,5 @@
|
||||
#include "MojangVersionFormat.h"
|
||||
#include "onesix/OneSixVersionFormat.h"
|
||||
#include "MinecraftVersion.h"
|
||||
#include "VersionBuildError.h"
|
||||
#include "MojangDownloadInfo.h"
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "minecraft/onesix/OneSixInstance.h"
|
||||
#include <minecraft/onesix/OneSixVersionFormat.h>
|
||||
#include "minecraft/VersionFilterData.h"
|
||||
#include "minecraft/MinecraftVersion.h"
|
||||
#include "Env.h"
|
||||
#include "Exception.h"
|
||||
#include <FileSystem.h>
|
||||
@ -137,6 +136,9 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr
|
||||
|
||||
bool ForgeInstaller::add(OneSixInstance *to)
|
||||
{
|
||||
return false;
|
||||
// TODO: move to python code.
|
||||
/*
|
||||
if (!BaseInstaller::add(to))
|
||||
{
|
||||
return false;
|
||||
@ -286,10 +288,14 @@ bool ForgeInstaller::add(OneSixInstance *to)
|
||||
file.commit();
|
||||
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
bool ForgeInstaller::addLegacy(OneSixInstance *to)
|
||||
{
|
||||
return false;
|
||||
//FIXME: move to python code.
|
||||
/*
|
||||
if (!BaseInstaller::add(to))
|
||||
{
|
||||
return false;
|
||||
@ -339,6 +345,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to)
|
||||
file.write(QJsonDocument(obj).toJson());
|
||||
file.close();
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
class ForgeInstallTask : public Task
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <FileSystem.h>
|
||||
|
||||
#include "Env.h"
|
||||
#include "minecraft/MinecraftVersion.h"
|
||||
|
||||
#include "LegacyFTBInstance.h"
|
||||
#include "OneSixFTBInstance.h"
|
||||
@ -246,17 +245,8 @@ InstancePtr FTBInstanceProvider::createInstance(const FTBRecord & record) const
|
||||
m_settings->registerSetting("InstanceType", "Legacy");
|
||||
|
||||
// all legacy versions are built in. therefore we can do this even if we don't have ALL the versions Mojang has on their servers.
|
||||
auto mcVersion = std::dynamic_pointer_cast<MinecraftVersion>(ENV.getVersion("net.minecraft", record.mcVersion));
|
||||
if (mcVersion && mcVersion->usesLegacyLauncher())
|
||||
{
|
||||
m_settings->set("InstanceType", "LegacyFTB");
|
||||
inst.reset(new LegacyFTBInstance(m_globalSettings, m_settings, record.instanceDir));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings->set("InstanceType", "OneSixFTB");
|
||||
inst.reset(new OneSixFTBInstance(m_globalSettings, m_settings, record.instanceDir));
|
||||
}
|
||||
|
||||
// initialize
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
#include "FTBPlugin.h"
|
||||
#include <Env.h>
|
||||
#include "FTBVersion.h"
|
||||
#include "LegacyFTBInstance.h"
|
||||
#include "OneSixFTBInstance.h"
|
||||
#include <BaseInstance.h>
|
||||
#include <InstanceList.h>
|
||||
#include <minecraft/MinecraftVersionList.h>
|
||||
#include <settings/INISettingsObject.h>
|
||||
#include <FileSystem.h>
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "OneSixFTBInstance.h"
|
||||
|
||||
#include "minecraft/VersionBuildError.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
#include <QDir>
|
||||
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include <minecraft/MinecraftVersion.h>
|
||||
|
||||
class FTBVersion : public BaseVersion
|
||||
{
|
||||
public:
|
||||
FTBVersion(MinecraftVersionPtr parent) : m_version(parent){};
|
||||
|
||||
public:
|
||||
virtual QString descriptor() override
|
||||
{
|
||||
return m_version->descriptor();
|
||||
}
|
||||
|
||||
virtual QString name() override
|
||||
{
|
||||
return m_version->name();
|
||||
}
|
||||
|
||||
virtual QString typeString() const override
|
||||
{
|
||||
return m_version->typeString();
|
||||
}
|
||||
|
||||
MinecraftVersionPtr getMinecraftVersion()
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
private:
|
||||
MinecraftVersionPtr m_version;
|
||||
};
|
@ -27,7 +27,6 @@
|
||||
#include "LegacyModList.h"
|
||||
|
||||
#include "LwjglVersionList.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "LegacyInstance.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "OneSixVersionFormat.h"
|
||||
|
||||
#include "minecraft/VersionBuildError.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "Env.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
@ -11,6 +10,8 @@
|
||||
#include <QUuid>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QSaveFile>
|
||||
#include <QResource>
|
||||
|
||||
OneSixProfileStrategy::OneSixProfileStrategy(OneSixInstance* instance)
|
||||
{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QDataStream>
|
||||
|
||||
#include "BaseInstance.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "minecraft/MinecraftProfile.h"
|
||||
#include "minecraft/Library.h"
|
||||
#include "net/URLConstants.h"
|
||||
@ -44,6 +43,7 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
|
||||
|
||||
// add a version update task, if necessary
|
||||
{
|
||||
/*
|
||||
auto list = std::dynamic_pointer_cast<MinecraftVersionList>(ENV.getVersionList("net.minecraft"));
|
||||
auto version = std::dynamic_pointer_cast<MinecraftVersion>(list->findVersion(m_inst->intendedVersionId()));
|
||||
if (version == nullptr)
|
||||
@ -67,6 +67,7 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
|
||||
m_tasks.append(versionUpdateTask);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// libraries download
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "OneSixVersionFormat.h"
|
||||
#include <Json.h>
|
||||
#include "minecraft/ParseUtils.h"
|
||||
#include <minecraft/MinecraftVersion.h>
|
||||
#include <minecraft/VersionBuildError.h>
|
||||
#include <minecraft/MojangVersionFormat.h>
|
||||
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include <java/JavaUtils.h>
|
||||
#include <java/JavaInstallList.h>
|
||||
#include <launch/LaunchTask.h>
|
||||
#include <minecraft/MinecraftVersionList.h>
|
||||
#include <minecraft/legacy/LwjglVersionList.h>
|
||||
#include <minecraft/auth/MojangAccountList.h>
|
||||
#include <SkinUtils.h>
|
||||
@ -558,6 +557,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
||||
// run the things that load and download other things... FIXME: this is NOT the place
|
||||
// FIXME: invisible actions in the background = NOPE.
|
||||
{
|
||||
/*
|
||||
if (!MMC->minecraftlist()->isLoaded())
|
||||
{
|
||||
m_versionLoadTask = MMC->minecraftlist()->getLoadTask();
|
||||
@ -567,6 +567,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
||||
{
|
||||
MMC->lwjgllist()->loadList();
|
||||
}
|
||||
*/
|
||||
|
||||
m_newsChecker->reloadNews();
|
||||
updateNewsLabel();
|
||||
@ -1014,18 +1015,6 @@ void MainWindow::setCatBackground(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: eliminate, should not be needed
|
||||
void MainWindow::waitForMinecraftVersions()
|
||||
{
|
||||
if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask && m_versionLoadTask->isRunning())
|
||||
{
|
||||
QEventLoop waitLoop;
|
||||
waitLoop.connect(m_versionLoadTask, &Task::failed, &waitLoop, &QEventLoop::quit);
|
||||
waitLoop.connect(m_versionLoadTask, &Task::succeeded, &waitLoop, &QEventLoop::quit);
|
||||
waitLoop.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::runModalTask(Task *task)
|
||||
{
|
||||
connect(task, &Task::failed, [this](QString reason)
|
||||
@ -1117,8 +1106,6 @@ void MainWindow::on_actionAddInstance_triggered()
|
||||
groupName = map["group"].toString();
|
||||
} while(0);
|
||||
|
||||
waitForMinecraftVersions();
|
||||
|
||||
if(groupName.isEmpty())
|
||||
{
|
||||
groupName = MMC->settings()->get("LastUsedGroupForNewInstance").toString();
|
||||
|
@ -167,7 +167,6 @@ private:
|
||||
void updateInstanceToolIcon(QString new_icon);
|
||||
void setSelectedInstanceById(const QString &id);
|
||||
|
||||
void waitForMinecraftVersions();
|
||||
void runModalTask(Task *task);
|
||||
void instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version);
|
||||
void instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url);
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "icons/IconList.h"
|
||||
//FIXME: get rid of this
|
||||
#include "minecraft/legacy/LwjglVersionList.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "minecraft/liteloader/LiteLoaderVersionList.h"
|
||||
#include "minecraft/forge/ForgeVersionList.h"
|
||||
|
||||
@ -338,7 +337,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
initIcons();
|
||||
initThemes();
|
||||
// make sure we have at least some minecraft versions before we init instances
|
||||
minecraftlist();
|
||||
initInstances();
|
||||
initAccounts();
|
||||
initNetwork();
|
||||
@ -890,16 +888,6 @@ std::shared_ptr<LiteLoaderVersionList> MultiMC::liteloaderlist()
|
||||
return m_liteloaderlist;
|
||||
}
|
||||
|
||||
std::shared_ptr<MinecraftVersionList> MultiMC::minecraftlist()
|
||||
{
|
||||
if (!m_minecraftlist)
|
||||
{
|
||||
m_minecraftlist.reset(new MinecraftVersionList());
|
||||
ENV.registerVersionList("net.minecraft", m_minecraftlist);
|
||||
}
|
||||
return m_minecraftlist;
|
||||
}
|
||||
|
||||
std::shared_ptr<JavaInstallList> MultiMC::javalist()
|
||||
{
|
||||
if (!m_javalist)
|
||||
|
@ -18,7 +18,6 @@ class SetupWizard;
|
||||
class FolderInstanceProvider;
|
||||
class GenericPageProvider;
|
||||
class QFile;
|
||||
class MinecraftVersionList;
|
||||
class LWJGLVersionList;
|
||||
class HttpMetaCache;
|
||||
class SettingsObject;
|
||||
@ -96,7 +95,6 @@ public:
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslationsModel> translations();
|
||||
std::shared_ptr<MinecraftVersionList> minecraftlist();
|
||||
std::shared_ptr<LWJGLVersionList> lwjgllist();
|
||||
std::shared_ptr<ForgeVersionList> forgelist();
|
||||
std::shared_ptr<LiteLoaderVersionList> liteloaderlist();
|
||||
@ -204,7 +202,6 @@ private:
|
||||
std::shared_ptr<LWJGLVersionList> m_lwjgllist;
|
||||
std::shared_ptr<ForgeVersionList> m_forgelist;
|
||||
std::shared_ptr<LiteLoaderVersionList> m_liteloaderlist;
|
||||
std::shared_ptr<MinecraftVersionList> m_minecraftlist;
|
||||
std::shared_ptr<JavaInstallList> m_javalist;
|
||||
std::shared_ptr<TranslationsModel> m_translations;
|
||||
std::shared_ptr<GenericPageProvider> m_globalSettingsProvider;
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <BaseVersion.h>
|
||||
#include <icons/IconList.h>
|
||||
#include <minecraft/MinecraftVersionList.h>
|
||||
#include <tasks/Task.h>
|
||||
#include <InstanceList.h>
|
||||
|
||||
@ -62,7 +61,12 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, QWidget *pare
|
||||
resize(minimumSizeHint());
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
setSelectedVersion(MMC->minecraftlist()->getRecommended());
|
||||
// FIXME: bring this back...
|
||||
auto vlist = ENV.getVersionList("net.minecraft");
|
||||
if(vlist)
|
||||
{
|
||||
setSelectedVersion(vlist->getRecommended());
|
||||
}
|
||||
InstIconKey = "default";
|
||||
ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
|
||||
|
||||
@ -192,8 +196,7 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const
|
||||
|
||||
void NewInstanceDialog::on_btnChangeVersion_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(MMC->minecraftlist().get(), tr("Change Minecraft version"),
|
||||
this);
|
||||
VersionSelectDialog vselect(ENV.getVersionList("net.minecraft").get(), tr("Change Minecraft version"), this);
|
||||
vselect.exec();
|
||||
if (vselect.result() == QDialog::Accepted)
|
||||
{
|
||||
|
@ -42,8 +42,6 @@
|
||||
#include "minecraft/liteloader/LiteLoaderInstaller.h"
|
||||
#include "minecraft/auth/MojangAccountList.h"
|
||||
#include "minecraft/Mod.h"
|
||||
#include "minecraft/MinecraftVersion.h"
|
||||
#include "minecraft/MinecraftVersionList.h"
|
||||
#include "icons/IconList.h"
|
||||
#include "Exception.h"
|
||||
|
||||
@ -489,6 +487,8 @@ int VersionPage::currentRow()
|
||||
|
||||
void VersionPage::on_customizeBtn_clicked()
|
||||
{
|
||||
// TODO: implement
|
||||
/*
|
||||
auto version = currentRow();
|
||||
if(version == -1)
|
||||
{
|
||||
@ -510,6 +510,7 @@ void VersionPage::on_customizeBtn_clicked()
|
||||
}
|
||||
updateButtons();
|
||||
preselect(currentIdx);
|
||||
*/
|
||||
}
|
||||
|
||||
void VersionPage::on_editBtn_clicked()
|
||||
@ -530,6 +531,8 @@ void VersionPage::on_editBtn_clicked()
|
||||
|
||||
void VersionPage::on_revertBtn_clicked()
|
||||
{
|
||||
// TODO: implement
|
||||
/*
|
||||
auto version = currentRow();
|
||||
if(version == -1)
|
||||
{
|
||||
@ -551,6 +554,7 @@ void VersionPage::on_revertBtn_clicked()
|
||||
updateButtons();
|
||||
preselect(currentIdx);
|
||||
m_container->refreshContainer();
|
||||
*/
|
||||
}
|
||||
|
||||
#include "VersionPage.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user