aboutsummaryrefslogtreecommitdiff
path: root/logic/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'logic/minecraft')
-rw-r--r--logic/minecraft/AssetsUtils.cpp230
-rw-r--r--logic/minecraft/AssetsUtils.h48
-rw-r--r--logic/minecraft/GradleSpecifier.h129
-rw-r--r--logic/minecraft/JarMod.h12
-rw-r--r--logic/minecraft/Library.cpp239
-rw-r--r--logic/minecraft/Library.h184
-rw-r--r--logic/minecraft/MinecraftInstance.cpp369
-rw-r--r--logic/minecraft/MinecraftInstance.h69
-rw-r--r--logic/minecraft/MinecraftProfile.cpp610
-rw-r--r--logic/minecraft/MinecraftProfile.h200
-rw-r--r--logic/minecraft/MinecraftVersion.cpp215
-rw-r--r--logic/minecraft/MinecraftVersion.h119
-rw-r--r--logic/minecraft/MinecraftVersionList.cpp591
-rw-r--r--logic/minecraft/MinecraftVersionList.h72
-rw-r--r--logic/minecraft/Mod.cpp377
-rw-r--r--logic/minecraft/Mod.h134
-rw-r--r--logic/minecraft/ModList.cpp616
-rw-r--r--logic/minecraft/ModList.h160
-rw-r--r--logic/minecraft/MojangDownloadInfo.h71
-rw-r--r--logic/minecraft/MojangVersionFormat.cpp381
-rw-r--r--logic/minecraft/MojangVersionFormat.h25
-rw-r--r--logic/minecraft/OpSys.cpp42
-rw-r--r--logic/minecraft/OpSys.h37
-rw-r--r--logic/minecraft/ParseUtils.cpp34
-rw-r--r--logic/minecraft/ParseUtils.h11
-rw-r--r--logic/minecraft/ProfilePatch.h104
-rw-r--r--logic/minecraft/ProfileStrategy.h35
-rw-r--r--logic/minecraft/ProfileUtils.cpp191
-rw-r--r--logic/minecraft/ProfileUtils.h25
-rw-r--r--logic/minecraft/Rule.cpp93
-rw-r--r--logic/minecraft/Rule.h101
-rw-r--r--logic/minecraft/SkinUtils.cpp47
-rw-r--r--logic/minecraft/SkinUtils.h25
-rw-r--r--logic/minecraft/VersionBuildError.h58
-rw-r--r--logic/minecraft/VersionFile.cpp60
-rw-r--r--logic/minecraft/VersionFile.h195
-rw-r--r--logic/minecraft/VersionFilterData.cpp75
-rw-r--r--logic/minecraft/VersionFilterData.h32
-rw-r--r--logic/minecraft/World.cpp385
-rw-r--r--logic/minecraft/World.h83
-rw-r--r--logic/minecraft/WorldList.cpp355
-rw-r--r--logic/minecraft/WorldList.h125
-rw-r--r--logic/minecraft/auth/AuthSession.cpp30
-rw-r--r--logic/minecraft/auth/AuthSession.h51
-rw-r--r--logic/minecraft/auth/MojangAccount.cpp278
-rw-r--r--logic/minecraft/auth/MojangAccount.h173
-rw-r--r--logic/minecraft/auth/MojangAccountList.cpp427
-rw-r--r--logic/minecraft/auth/MojangAccountList.h201
-rw-r--r--logic/minecraft/auth/YggdrasilTask.cpp255
-rw-r--r--logic/minecraft/auth/YggdrasilTask.h150
-rw-r--r--logic/minecraft/auth/flows/AuthenticateTask.cpp202
-rw-r--r--logic/minecraft/auth/flows/AuthenticateTask.h46
-rw-r--r--logic/minecraft/auth/flows/RefreshTask.cpp144
-rw-r--r--logic/minecraft/auth/flows/RefreshTask.h44
-rw-r--r--logic/minecraft/auth/flows/ValidateTask.cpp61
-rw-r--r--logic/minecraft/auth/flows/ValidateTask.h47
-rw-r--r--logic/minecraft/forge/ForgeInstaller.cpp458
-rw-r--r--logic/minecraft/forge/ForgeInstaller.h52
-rw-r--r--logic/minecraft/forge/ForgeVersion.cpp55
-rw-r--r--logic/minecraft/forge/ForgeVersion.h42
-rw-r--r--logic/minecraft/forge/ForgeVersionList.cpp450
-rw-r--r--logic/minecraft/forge/ForgeVersionList.h90
-rw-r--r--logic/minecraft/forge/ForgeXzDownload.cpp358
-rw-r--r--logic/minecraft/forge/ForgeXzDownload.h59
-rw-r--r--logic/minecraft/forge/LegacyForge.cpp56
-rw-r--r--logic/minecraft/forge/LegacyForge.h25
-rw-r--r--logic/minecraft/ftb/FTBPlugin.cpp395
-rw-r--r--logic/minecraft/ftb/FTBPlugin.h13
-rw-r--r--logic/minecraft/ftb/FTBProfileStrategy.cpp128
-rw-r--r--logic/minecraft/ftb/FTBProfileStrategy.h21
-rw-r--r--logic/minecraft/ftb/FTBVersion.h32
-rw-r--r--logic/minecraft/ftb/LegacyFTBInstance.cpp27
-rw-r--r--logic/minecraft/ftb/LegacyFTBInstance.h17
-rw-r--r--logic/minecraft/ftb/OneSixFTBInstance.cpp138
-rw-r--r--logic/minecraft/ftb/OneSixFTBInstance.h30
-rw-r--r--logic/minecraft/legacy/LegacyInstance.cpp459
-rw-r--r--logic/minecraft/legacy/LegacyInstance.h142
-rw-r--r--logic/minecraft/legacy/LegacyUpdate.cpp393
-rw-r--r--logic/minecraft/legacy/LegacyUpdate.h70
-rw-r--r--logic/minecraft/legacy/LwjglVersionList.cpp189
-rw-r--r--logic/minecraft/legacy/LwjglVersionList.h156
-rw-r--r--logic/minecraft/liteloader/LiteLoaderInstaller.cpp142
-rw-r--r--logic/minecraft/liteloader/LiteLoaderInstaller.h39
-rw-r--r--logic/minecraft/liteloader/LiteLoaderVersionList.cpp276
-rw-r--r--logic/minecraft/liteloader/LiteLoaderVersionList.h119
-rw-r--r--logic/minecraft/onesix/OneSixInstance.cpp601
-rw-r--r--logic/minecraft/onesix/OneSixInstance.h117
-rw-r--r--logic/minecraft/onesix/OneSixProfileStrategy.cpp418
-rw-r--r--logic/minecraft/onesix/OneSixProfileStrategy.h26
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.cpp342
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.h67
-rw-r--r--logic/minecraft/onesix/OneSixVersionFormat.cpp225
-rw-r--r--logic/minecraft/onesix/OneSixVersionFormat.h22
93 files changed, 0 insertions, 15322 deletions
diff --git a/logic/minecraft/AssetsUtils.cpp b/logic/minecraft/AssetsUtils.cpp
deleted file mode 100644
index 7a525abe..00000000
--- a/logic/minecraft/AssetsUtils.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Copyright 2013-2015 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 <QFileInfo>
-#include <QDir>
-#include <QDirIterator>
-#include <QCryptographicHash>
-#include <QJsonParseError>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QVariant>
-#include <QDebug>
-
-#include "AssetsUtils.h"
-#include "FileSystem.h"
-#include "net/MD5EtagDownload.h"
-
-namespace AssetsUtils
-{
-
-/*
- * Returns true on success, with index populated
- * index is undefined otherwise
- */
-bool loadAssetsIndexJson(QString assetsId, QString path, AssetsIndex *index)
-{
- /*
- {
- "objects": {
- "icons/icon_16x16.png": {
- "hash": "bdf48ef6b5d0d23bbb02e17d04865216179f510a",
- "size": 3665
- },
- ...
- }
- }
- }
- */
-
- QFile file(path);
-
- // Try to open the file and fail if we can't.
- // TODO: We should probably report this error to the user.
- if (!file.open(QIODevice::ReadOnly))
- {
- qCritical() << "Failed to read assets index file" << path;
- return false;
- }
- index->id = assetsId;
-
- // Read the file and close it.
- QByteArray jsonData = file.readAll();
- file.close();
-
- QJsonParseError parseError;
- QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData, &parseError);
-
- // Fail if the JSON is invalid.
- if (parseError.error != QJsonParseError::NoError)
- {
- qCritical() << "Failed to parse assets index file:" << parseError.errorString()
- << "at offset " << QString::number(parseError.offset);
- return false;
- }
-
- // Make sure the root is an object.
- if (!jsonDoc.isObject())
- {
- qCritical() << "Invalid assets index JSON: Root should be an array.";
- return false;
- }
-
- QJsonObject root = jsonDoc.object();
-
- QJsonValue isVirtual = root.value("virtual");
- if (!isVirtual.isUndefined())
- {
- index->isVirtual = isVirtual.toBool(false);
- }
-
- QJsonValue objects = root.value("objects");
- QVariantMap map = objects.toVariant().toMap();
-
- for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
- {
- // qDebug() << iter.key();
-
- QVariant variant = iter.value();
- QVariantMap nested_objects = variant.toMap();
-
- AssetObject object;
-
- for (QVariantMap::const_iterator nested_iter = nested_objects.begin();
- nested_iter != nested_objects.end(); ++nested_iter)
- {
- // qDebug() << nested_iter.key() << nested_iter.value().toString();
- QString key = nested_iter.key();
- QVariant value = nested_iter.value();
-
- if (key == "hash")
- {
- object.hash = value.toString();
- }
- else if (key == "size")
- {
- object.size = value.toDouble();
- }
- }
-
- index->objects.insert(iter.key(), object);
- }
-
- return true;
-}
-
-QDir reconstructAssets(QString assetsId)
-{
- QDir assetsDir = QDir("assets/");
- QDir indexDir = QDir(FS::PathCombine(assetsDir.path(), "indexes"));
- QDir objectDir = QDir(FS::PathCombine(assetsDir.path(), "objects"));
- QDir virtualDir = QDir(FS::PathCombine(assetsDir.path(), "virtual"));
-
- QString indexPath = FS::PathCombine(indexDir.path(), assetsId + ".json");
- QFile indexFile(indexPath);
- QDir virtualRoot(FS::PathCombine(virtualDir.path(), assetsId));
-
- if (!indexFile.exists())
- {
- qCritical() << "No assets index file" << indexPath << "; can't reconstruct assets";
- return virtualRoot;
- }
-
- qDebug() << "reconstructAssets" << assetsDir.path() << indexDir.path()
- << objectDir.path() << virtualDir.path() << virtualRoot.path();
-
- AssetsIndex index;
- bool loadAssetsIndex = AssetsUtils::loadAssetsIndexJson(assetsId, indexPath, &index);
-
- if (loadAssetsIndex && index.isVirtual)
- {
- qDebug() << "Reconstructing virtual assets folder at" << virtualRoot.path();
-
- for (QString map : index.objects.keys())
- {
- AssetObject asset_object = index.objects.value(map);
- QString target_path = FS::PathCombine(virtualRoot.path(), map);
- QFile target(target_path);
-
- QString tlk = asset_object.hash.left(2);
-
- QString original_path = FS::PathCombine(objectDir.path(), tlk, asset_object.hash);
- QFile original(original_path);
- if (!original.exists())
- continue;
- if (!target.exists())
- {
- QFileInfo info(target_path);
- QDir target_dir = info.dir();
- // qDebug() << target_dir;
- if (!target_dir.exists())
- QDir("").mkpath(target_dir.path());
-
- bool couldCopy = original.copy(target_path);
- qDebug() << " Copying" << original_path << "to" << target_path
- << QString::number(couldCopy); // << original.errorString();
- }
- }
-
- // TODO: Write last used time to virtualRoot/.lastused
- }
-
- return virtualRoot;
-}
-
-}
-
-NetActionPtr AssetObject::getDownloadAction()
-{
- QFileInfo objectFile(getLocalPath());
- if ((!objectFile.isFile()) || (objectFile.size() != size))
- {
- auto objectDL = MD5EtagDownload::make(getUrl(), objectFile.filePath());
- objectDL->m_total_progress = size;
- return objectDL;
- }
- return nullptr;
-}
-
-QString AssetObject::getLocalPath()
-{
- return "assets/objects/" + getRelPath();
-}
-
-QUrl AssetObject::getUrl()
-{
- return QUrl("http://resources.download.minecraft.net/" + getRelPath());
-}
-
-QString AssetObject::getRelPath()
-{
- return hash.left(2) + "/" + hash;
-}
-
-NetJobPtr AssetsIndex::getDownloadJob()
-{
- auto job = new NetJob(QObject::tr("Assets for %1").arg(id));
- for (auto &object : objects.values())
- {
- auto dl = object.getDownloadAction();
- if(dl)
- {
- job->addNetAction(dl);
- }
- }
- if(job->size())
- return job;
- return nullptr;
-}
diff --git a/logic/minecraft/AssetsUtils.h b/logic/minecraft/AssetsUtils.h
deleted file mode 100644
index 90251c2d..00000000
--- a/logic/minecraft/AssetsUtils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2013-2015 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 <QString>
-#include <QMap>
-#include "net/NetAction.h"
-#include "net/NetJob.h"
-
-struct AssetObject
-{
- QString getRelPath();
- QUrl getUrl();
- QString getLocalPath();
- NetActionPtr getDownloadAction();
-
- QString hash;
- qint64 size;
-};
-
-struct AssetsIndex
-{
- NetJobPtr getDownloadJob();