summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/MinecraftVersionList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/minecraft/MinecraftVersionList.cpp')
-rw-r--r--logic/minecraft/MinecraftVersionList.cpp70
1 files changed, 4 insertions, 66 deletions
diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp
index bd679c73..eab55c9a 100644
--- a/logic/minecraft/MinecraftVersionList.cpp
+++ b/logic/minecraft/MinecraftVersionList.cpp
@@ -83,7 +83,6 @@ public:
MinecraftVersionList::MinecraftVersionList(QObject *parent) : BaseVersionList(parent)
{
- loadBuiltinList();
loadCachedList();
}
@@ -141,7 +140,7 @@ void MinecraftVersionList::loadCachedList()
{
throw ListLoadError(tr("Error reading the version list."));
}
- loadMojangList(jsonDoc, Local);
+ loadList(jsonDoc, Local);
}
catch (Exception &e)
{
@@ -153,57 +152,7 @@ void MinecraftVersionList::loadCachedList()
m_hasLocalIndex = true;
}
-void MinecraftVersionList::loadBuiltinList()
-{
- qDebug() << "Loading builtin version list.";
- // grab the version list data from internal resources.
- const QJsonDocument doc =
- Json::requireDocument(QString(":/versions/minecraft.json"), "builtin version list");
- const QJsonObject root = doc.object();
-
- // parse all the versions
- for (const auto version : Json::requireArray(root.value("versions")))
- {
- QJsonObject versionObj = version.toObject();
- QString versionID = versionObj.value("id").toString("");
- QString versionTypeStr = versionObj.value("type").toString("");
- if (versionID.isEmpty() || versionTypeStr.isEmpty())
- {
- qCritical() << "Parsed version is missing ID or type";
- continue;
- }
-
- if (g_VersionFilterData.legacyBlacklist.contains(versionID))
- {
- qWarning() << "Blacklisted legacy version ignored: " << versionID;
- 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;
-
- // Parse the timestamp.
- mcVersion->m_releaseTime = timeFromS3Time(versionObj.value("releaseTime").toString(""));
- mcVersion->m_versionFileURL = QString();
- mcVersion->m_versionSource = Builtin;
- mcVersion->m_type = versionTypeStr;
- mcVersion->m_appletClass = versionObj.value("appletClass").toString("");
- mcVersion->m_mainClass = versionObj.value("mainClass").toString("");
- mcVersion->m_jarChecksum = versionObj.value("checksum").toString("");
- if (versionObj.contains("+traits"))
- {
- for (auto traitVal : Json::requireArray(versionObj.value("+traits")))
- {
- mcVersion->m_traits.insert(Json::requireString(traitVal));
- }
- }
- m_lookup[versionID] = mcVersion;
- m_vlist.append(mcVersion);
- }
-}
-
-void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source)
+void MinecraftVersionList::loadList(QJsonDocument jsonDoc, VersionSource source)
{
qDebug() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list.";
@@ -260,16 +209,11 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s
// 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_version = versionID;
mcVersion->m_releaseTime = timeFromS3Time(versionObj.value("releaseTime").toString(""));
mcVersion->m_updateTime = timeFromS3Time(versionObj.value("time").toString(""));
- if (mcVersion->m_releaseTime < g_VersionFilterData.legacyCutoffDate)
- {
- continue;
- }
-
// depends on where we load the version from -- network request or local file?
mcVersion->m_versionSource = source;
mcVersion->m_versionFileURL = versionObj.value("url").toString("");
@@ -444,7 +388,7 @@ void MCVListLoadTask::list_downloaded()
throw ListLoadError(
tr("Error parsing version list JSON: %1").arg(jsonError.errorString()));
}
- m_list->loadMojangList(jsonDoc, Remote);
+ m_list->loadList(jsonDoc, Remote);
}
catch (Exception &e)
{
@@ -502,8 +446,6 @@ void MCVListVersionUpdateTask::json_downloaded()
// 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
@@ -627,10 +569,6 @@ void MinecraftVersionList::finalizeUpdate(QString version)
auto updatedVersion = std::dynamic_pointer_cast<MinecraftVersion>(m_vlist[idx]);
- // reject any updates to builtin versions.
- if (updatedVersion->m_versionSource == Builtin)
- return;
-
// if we have an update for the version, replace it, make the update local
if (updatedVersion->upstreamUpdate)
{