summaryrefslogtreecommitdiffstats
path: root/libmultimc/src
diff options
context:
space:
mode:
Diffstat (limited to 'libmultimc/src')
-rw-r--r--libmultimc/src/gameupdatetask.cpp3
-rw-r--r--libmultimc/src/instversion.cpp6
-rw-r--r--libmultimc/src/minecraftversion.cpp73
-rw-r--r--libmultimc/src/minecraftversionlist.cpp14
4 files changed, 25 insertions, 71 deletions
diff --git a/libmultimc/src/gameupdatetask.cpp b/libmultimc/src/gameupdatetask.cpp
index 114f4ede..c718ce71 100644
--- a/libmultimc/src/gameupdatetask.cpp
+++ b/libmultimc/src/gameupdatetask.cpp
@@ -73,7 +73,8 @@ void GameUpdateTask::executeTask()
// we're downloading from.
QString jarFilename = "minecraft";
- if (targetVersion->isForNewLauncher())
+ // FIXME: this is NOT enough
+ if (targetVersion->launcherVersion() == MinecraftVersion::Launcher16)
jarFilename = targetVersion->descriptor();
QUrl mcJarURL = targetVersion->downloadURL() + jarFilename + ".jar";
diff --git a/libmultimc/src/instversion.cpp b/libmultimc/src/instversion.cpp
index ebd76c7a..4e42c364 100644
--- a/libmultimc/src/instversion.cpp
+++ b/libmultimc/src/instversion.cpp
@@ -51,12 +51,6 @@ bool InstVersion::isGreaterThan(const InstVersion &other) const
return timestamp() > other.timestamp();
}
-bool InstVersion::isMeta() const
-{
- return false;
-}
-
-
QString InstVersion::descriptor() const
{
return m_descriptor;
diff --git a/libmultimc/src/minecraftversion.cpp b/libmultimc/src/minecraftversion.cpp
index 7dee802f..36ba87f8 100644
--- a/libmultimc/src/minecraftversion.cpp
+++ b/libmultimc/src/minecraftversion.cpp
@@ -23,29 +23,9 @@ MinecraftVersion::MinecraftVersion(QString descriptor,
InstVersionList *parent) :
InstVersion(descriptor, name, timestamp, parent), m_dlUrl(dlUrl), m_etag(etag)
{
- m_linkedVersion = NULL;
m_isNewLauncherVersion = false;
}
-MinecraftVersion::MinecraftVersion(const MinecraftVersion *linkedVersion) :
- InstVersion(linkedVersion->descriptor(), linkedVersion->name(), linkedVersion->timestamp(),
- linkedVersion->versionList())
-{
- m_linkedVersion = (MinecraftVersion *)linkedVersion;
-}
-
-MinecraftVersion::MinecraftVersion(const MinecraftVersion &other, QObject *parent) :
- InstVersion(other, parent)
-{
- if (other.m_linkedVersion)
- m_linkedVersion = other.m_linkedVersion;
- else
- {
- m_dlUrl = other.downloadURL();
- m_etag = other.etag();
- }
-}
-
QString MinecraftVersion::descriptor() const
{
return m_descriptor;
@@ -58,9 +38,6 @@ QString MinecraftVersion::name() const
QString MinecraftVersion::typeName() const
{
- if (m_linkedVersion)
- return m_linkedVersion->typeName();
-
switch (versionType())
{
case OldSnapshot:
@@ -78,17 +55,6 @@ QString MinecraftVersion::typeName() const
case MCNostalgia:
return "MCNostalgia";
- case MetaCustom:
- // Not really sure what this does, but it was in the code for v4,
- // so it must be important... Right?
- return "Custom Meta Version";
-
- case MetaLatestSnapshot:
- return "Latest Snapshot";
-
- case MetaLatestStable:
- return "Latest Stable";
-
default:
return QString("Unknown Type %1").arg(versionType());
}
@@ -99,16 +65,6 @@ qint64 MinecraftVersion::timestamp() const
return m_timestamp;
}
-bool MinecraftVersion::isForNewLauncher() const
-{
- return m_isNewLauncherVersion;
-}
-
-void MinecraftVersion::setIsForNewLauncher(bool val)
-{
- m_isNewLauncherVersion = val;
-}
-
MinecraftVersion::VersionType MinecraftVersion::versionType() const
{
return m_type;
@@ -129,26 +85,21 @@ QString MinecraftVersion::etag() const
return m_etag;
}
-bool MinecraftVersion::isMeta() const
+MinecraftVersion::LauncherVersion MinecraftVersion::launcherVersion() const
{
- return versionType() == MetaCustom ||
- versionType() == MetaLatestSnapshot ||
- versionType() == MetaLatestStable;
+ return m_launcherVersion;
+};
+
+void MinecraftVersion::setLauncherVersion(LauncherVersion launcherVersion)
+{
+ m_launcherVersion = launcherVersion;
}
InstVersion *MinecraftVersion::copyVersion(InstVersionList *newParent) const
{
- if (isMeta())
- {
- MinecraftVersion *version = new MinecraftVersion((MinecraftVersion *)m_linkedVersion);
- return version;
- }
- else
- {
- MinecraftVersion *version = new MinecraftVersion(
- descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
- version->setVersionType(versionType());
- version->setIsForNewLauncher(isForNewLauncher());
- return version;
- }
+ MinecraftVersion *version = new MinecraftVersion(
+ descriptor(), name(), timestamp(), downloadURL(), etag(), newParent);
+ version->setVersionType(versionType());
+ version->setLauncherVersion(launcherVersion());
+ return version;
}
diff --git a/libmultimc/src/minecraftversionlist.cpp b/libmultimc/src/minecraftversionlist.cpp
index 71deb471..17737b1e 100644
--- a/libmultimc/src/minecraftversionlist.cpp
+++ b/libmultimc/src/minecraftversionlist.cpp
@@ -200,6 +200,7 @@ void MCVListLoadTask::setSubStatus(const QString msg)
setStatus("Loading instance version list: " + msg);
}
+// FIXME: we should have a local cache of the version list and a local cache of version data
bool MCVListLoadTask::loadFromVList()
{
QNetworkReply *vlistReply = netMgr->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) +
@@ -276,10 +277,15 @@ bool MCVListLoadTask::loadFromVList()
else
versionType = MinecraftVersion::Stable;
}
- else
+ else if(versionTypeStr == "snapshot")
{
versionType = MinecraftVersion::Snapshot;
}
+ else
+ {
+ // we don't know what to do with this...
+ continue;
+ }
// Get the download URL.
QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/";
@@ -289,7 +295,7 @@ bool MCVListLoadTask::loadFromVList()
MinecraftVersion *mcVersion = new MinecraftVersion(
versionID, versionID, versionTime.toMSecsSinceEpoch(),
dlUrl, "");
- mcVersion->setIsForNewLauncher(true);
+ mcVersion->setLauncherVersion(MinecraftVersion::Launcher16);
mcVersion->setVersionType(versionType);
tempList.append(mcVersion);
}
@@ -340,7 +346,7 @@ bool MCVListLoadTask::loadFromAssets()
QDomNodeList contents = doc.elementsByTagName("Contents");
QRegExp mcRegex("/minecraft.jar$");
- QRegExp snapshotRegex("[0-9][0-9]w[0-9][0-9][a-z]|pre|rc");
+ QRegExp snapshotRegex("[0-9][0-9]w[0-9][0-9][a-z]?|pre|rc");
for (int i = 0; i < contents.length(); i++)
{
@@ -443,6 +449,8 @@ bool MCVListLoadTask::loadMCNostalgia()
{
QNetworkReply *mcnReply = netMgr->get(QNetworkRequest(QUrl(QString(MCN_URLBASE) + "?pversion=1&list=True")));
NetUtils::waitForNetRequest(mcnReply);
+ processedMCNReply = true;
+ updateStuff();
return true;
}