From e118b1f9901d8d006dbe268b4b4047de27e4531d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 19 May 2014 02:22:09 +0200 Subject: Implement adding jar mods, break saving library order. --- logic/OneSixFTBInstance.cpp | 2 +- logic/OneSixInstance.cpp | 22 +- logic/OneSixInstance.h | 6 +- logic/OneSixInstance_p.h | 4 +- logic/OneSixUpdate.cpp | 12 +- logic/forge/ForgeInstaller.cpp | 6 +- logic/forge/ForgeInstaller.h | 4 +- logic/liteloader/LiteLoaderInstaller.cpp | 2 +- logic/minecraft/InstanceVersion.cpp | 493 +++++++++++++++++++++++++++++++ logic/minecraft/InstanceVersion.h | 181 ++++++++++++ logic/minecraft/MinecraftVersion.cpp | 6 +- logic/minecraft/MinecraftVersion.h | 6 +- logic/minecraft/VersionBuilder.cpp | 11 +- logic/minecraft/VersionBuilder.h | 8 +- logic/minecraft/VersionFile.cpp | 4 +- logic/minecraft/VersionFile.h | 4 +- logic/minecraft/VersionFinal.cpp | 432 --------------------------- logic/minecraft/VersionFinal.h | 179 ----------- logic/minecraft/VersionPatch.h | 4 +- logic/net/NetJob.h | 1 - 20 files changed, 720 insertions(+), 667 deletions(-) create mode 100644 logic/minecraft/InstanceVersion.cpp create mode 100644 logic/minecraft/InstanceVersion.h delete mode 100644 logic/minecraft/VersionFinal.cpp delete mode 100644 logic/minecraft/VersionFinal.h (limited to 'logic') diff --git a/logic/OneSixFTBInstance.cpp b/logic/OneSixFTBInstance.cpp index eb0e4ba4..ef9cb889 100644 --- a/logic/OneSixFTBInstance.cpp +++ b/logic/OneSixFTBInstance.cpp @@ -1,6 +1,6 @@ #include "OneSixFTBInstance.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/OneSixLibrary.h" #include "logic/minecraft/VersionBuilder.h" #include "tasks/SequentialTask.h" diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index fc53bd39..e2d5ef0a 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -23,7 +23,7 @@ #include "logic/OneSixInstance_p.h" #include "logic/OneSixUpdate.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "minecraft/VersionBuildError.h" #include "logic/assets/AssetsUtils.h" @@ -37,8 +37,7 @@ OneSixInstance::OneSixInstance(const QString &rootDir, SettingsObject *settings, { I_D(OneSixInstance); d->m_settings->registerSetting("IntendedVersion", ""); - d->m_settings->registerSetting("ShouldUpdate", false); - d->version.reset(new VersionFinal(this, this)); + d->version.reset(new InstanceVersion(this, this)); } void OneSixInstance::init() @@ -82,7 +81,7 @@ QString replaceTokensIn(QString text, QMap with) return result; } -QDir OneSixInstance::reconstructAssets(std::shared_ptr version) +QDir OneSixInstance::reconstructAssets(std::shared_ptr version) { QDir assetsDir = QDir("assets/"); QDir indexDir = QDir(PathCombine(assetsDir.path(), "indexes")); @@ -183,7 +182,7 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) return parts; } -bool OneSixInstance::prepareForLaunch(AuthSessionPtr account, QString &launchScript) +bool OneSixInstance::prepareForLaunch(AuthSessionPtr session, QString &launchScript) { I_D(OneSixInstance); @@ -227,7 +226,7 @@ bool OneSixInstance::prepareForLaunch(AuthSessionPtr account, QString &launchScr } // generic minecraft params - for (auto param : processMinecraftArgs(account)) + for (auto param : processMinecraftArgs(session)) { launchScript += "param " + param + "\n"; } @@ -319,7 +318,6 @@ QDialog *OneSixInstance::createModEditDialog(QWidget *parent) bool OneSixInstance::setIntendedVersionId(QString version) { settings().set("IntendedVersion", version); - setShouldUpdate(true); QFile::remove(PathCombine(instanceRoot(), "version.json")); clearVersion(); return true; @@ -330,18 +328,12 @@ QString OneSixInstance::intendedVersionId() const return settings().get("IntendedVersion").toString(); } -void OneSixInstance::setShouldUpdate(bool val) +void OneSixInstance::setShouldUpdate(bool) { - settings().set("ShouldUpdate", val); } bool OneSixInstance::shouldUpdate() const { - QVariant var = settings().get("ShouldUpdate"); - if (!var.isValid() || var.toBool() == false) - { - return intendedVersionId() != currentVersionId(); - } return true; } @@ -403,7 +395,7 @@ void OneSixInstance::clearVersion() emit versionReloaded(); } -std::shared_ptr OneSixInstance::getFullVersion() const +std::shared_ptr OneSixInstance::getFullVersion() const { I_D(const OneSixInstance); return d->version; diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h index 00653def..98ce1ce8 100644 --- a/logic/OneSixInstance.h +++ b/logic/OneSixInstance.h @@ -17,7 +17,7 @@ #include "BaseInstance.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/ModList.h" class OneSixInstance : public BaseInstance @@ -69,7 +69,7 @@ public: void clearVersion(); /// get the current full version info - std::shared_ptr getFullVersion() const; + std::shared_ptr getFullVersion() const; /// is the current version original, or custom? virtual bool versionIsCustom() override; @@ -97,5 +97,5 @@ signals: private: QStringList processMinecraftArgs(AuthSessionPtr account); - QDir reconstructAssets(std::shared_ptr version); + QDir reconstructAssets(std::shared_ptr version); }; diff --git a/logic/OneSixInstance_p.h b/logic/OneSixInstance_p.h index 90802c24..2797cc45 100644 --- a/logic/OneSixInstance_p.h +++ b/logic/OneSixInstance_p.h @@ -18,13 +18,13 @@ #include "logic/BaseInstance_p.h" class ModList; -class VersionFinal; +class InstanceVersion; class OneSixInstancePrivate : public BaseInstancePrivate { public: virtual ~OneSixInstancePrivate() {}; - std::shared_ptr version; + std::shared_ptr version; std::shared_ptr jar_mod_list; std::shared_ptr loader_mod_list; std::shared_ptr core_mod_list; diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index 4b37f9aa..abc5f9c1 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -27,7 +27,7 @@ #include "logic/BaseInstance.h" #include "logic/minecraft/MinecraftVersionList.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/OneSixLibrary.h" #include "logic/OneSixInstance.h" #include "logic/forge/ForgeMirrors.h" @@ -85,7 +85,7 @@ void OneSixUpdate::assetIndexStart() { setStatus(tr("Updating assets index...")); OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr version = inst->getFullVersion(); + std::shared_ptr version = inst->getFullVersion(); QString assetName = version->assets; QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json"; QString localPath = assetName + ".json"; @@ -109,7 +109,7 @@ void OneSixUpdate::assetIndexFinished() AssetsIndex index; OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr version = inst->getFullVersion(); + std::shared_ptr version = inst->getFullVersion(); QString assetName = version->assets; QString asset_fname = "assets/indexes/" + assetName + ".json"; @@ -185,7 +185,7 @@ void OneSixUpdate::jarlibStart() } // Build a list of URLs that will need to be downloaded. - std::shared_ptr version = inst->getFullVersion(); + std::shared_ptr version = inst->getFullVersion(); // minecraft.jar for this version { QString version_id = version->id; @@ -283,7 +283,7 @@ void OneSixUpdate::jarlibStart() void OneSixUpdate::jarlibFinished() { OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr version = inst->getFullVersion(); + std::shared_ptr version = inst->getFullVersion(); // create stripped jar, if needed if (version->hasJarMods()) @@ -407,7 +407,7 @@ void OneSixUpdate::fmllibsStart() { // Get the mod list OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr fullversion = inst->getFullVersion(); + std::shared_ptr fullversion = inst->getFullVersion(); bool forge_present = false; QString version = inst->intendedVersionId(); diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp index 0e7b26f7..7f952408 100644 --- a/logic/forge/ForgeInstaller.cpp +++ b/logic/forge/ForgeInstaller.cpp @@ -14,7 +14,7 @@ */ #include "ForgeInstaller.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/OneSixLibrary.h" #include "logic/net/HttpMetaCache.h" #include "logic/tasks/Task.h" @@ -40,7 +40,7 @@ ForgeInstaller::ForgeInstaller() : BaseInstaller() } void ForgeInstaller::prepare(const QString &filename, const QString &universalUrl) { - std::shared_ptr newVersion; + std::shared_ptr newVersion; m_universal_url = universalUrl; QuaZip zip(filename); @@ -73,7 +73,7 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr // read the forge version info { - newVersion = VersionFinal::fromJson(versionInfoVal.toObject()); + newVersion = InstanceVersion::fromJson(versionInfoVal.toObject()); if (!newVersion) return; } diff --git a/logic/forge/ForgeInstaller.h b/logic/forge/ForgeInstaller.h index dafa6305..14aeeb51 100644 --- a/logic/forge/ForgeInstaller.h +++ b/logic/forge/ForgeInstaller.h @@ -20,7 +20,7 @@ #include #include -class VersionFinal; +class InstanceVersion; class ForgeInstallTask; class ForgeVersion; @@ -40,7 +40,7 @@ protected: private: // the parsed version json, read from the installer - std::shared_ptr m_forge_json; + std::shared_ptr m_forge_json; // the actual forge version std::shared_ptr m_forge_version; QString internalPath; diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp index 0a16ac6d..ea1a4396 100644 --- a/logic/liteloader/LiteLoaderInstaller.cpp +++ b/logic/liteloader/LiteLoaderInstaller.cpp @@ -20,7 +20,7 @@ #include "logger/QsLog.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/OneSixLibrary.h" #include "logic/OneSixInstance.h" #include "MultiMC.h" diff --git a/logic/minecraft/InstanceVersion.cpp b/logic/minecraft/InstanceVersion.cpp new file mode 100644 index 00000000..eb1eeae2 --- /dev/null +++ b/logic/minecraft/InstanceVersion.cpp @@ -0,0 +1,493 @@ +/* Copyright 2013 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 +#include +#include +#include +#include +#include +#include + +#include "logic/minecraft/InstanceVersion.h" +#include "logic/minecraft/VersionBuilder.h" +#include "logic/OneSixInstance.h" + +InstanceVersion::InstanceVersion(OneSixInstance *instance, QObject *parent) + : QAbstractListModel(parent), m_instance(instance) +{ + clear(); +} + +void InstanceVersion::reload(const QStringList &external) +{ + beginResetModel(); + VersionBuilder::build(this, m_instance, external); + reapply(true); + endResetModel(); +} + +void InstanceVersion::clear() +{ + id.clear(); + m_updateTimeString.clear(); + m_updateTime = QDateTime(); + m_releaseTimeString.clear(); + m_releaseTime = QDateTime(); + type.clear(); + assets.clear(); + processArguments.clear(); + minecraftArguments.clear(); + minimumLauncherVersion = 0xDEADBEAF; + mainClass.clear(); + appletClass.clear(); + libraries.clear(); + tweakers.clear(); + jarMods.clear(); + traits.clear(); +} + +bool InstanceVersion::canRemove(const int index) const +{ + return VersionPatches.at(index)->isMoveable(); +} + +bool InstanceVersion::preremove(VersionPatchPtr patch) +{ + bool ok = true; + for(auto & jarmod: patch->getJarMods()) + { + QString fullpath =PathCombine(m_instance->jarModsDir(), jarmod->name); + QFileInfo finfo (fullpath); + if(finfo.exists()) + ok &= QFile::remove(fullpath); + } + return ok; +} + +bool InstanceVersion::remove(const int index) +{ + if (!canRemove(index)) + return false; + if(!preremove(VersionPatches[index])) + { + return false; + } + if(!QFile::remove(VersionPatches.at(index)->getPatchFilename())) + return false; + beginResetModel(); + VersionPatches.removeAt(index); + reapply(true); + endResetModel(); + return true; +} + +bool InstanceVersion::remove(const QString id) +{ + int i = 0; + for (auto patch : VersionPatches) + { + if (patch->getPatchID() == id) + { + return remove(i); + } + i++; + } + return false; +} + +QString InstanceVersion::versionFileId(const int index) const +{ + if (index < 0 || index >= VersionPatches.size()) + { + return QString(); + } + return VersionPatches.at(index)->getPatchID(); +} + +VersionPatchPtr InstanceVersion::versionPatch(const QString &id) +{ + for (auto file : VersionPatches) + { + if (file->getPatchID() == id) + { + return file; + } + } + return 0; +} + +VersionPatchPtr InstanceVersion::versionPatch(int index) +{ + if(index < 0 || index >= VersionPatches.size()) + return 0; + return VersionPatches[index]; +} + + +bool InstanceVersion::hasJarMods() +{ + return !jarMods.isEmpty(); +} + +bool InstanceVersion::hasFtbPack() +{ + return versionPatch("org.multimc.ftb.pack.json") != nullptr; +} + +bool InstanceVersion::removeFtbPack() +{ + return remove("org.multimc.ftb.pack.json"); +} + +bool InstanceVersion::isVanilla() +{ + QDir patches(PathCombine(m_instance->instanceRoot(), "patches/")); + if(VersionPatches.size() > 1) + return false; + if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json"))) + return false; + return true; +} + +bool InstanceVersion::revertToVanilla() +{ + beginResetModel(); + auto it = VersionPatches.begin(); + while (it != VersionPatches.end()) + { + if ((*it)->isMoveable()) + { + if(!preremove(*it)) + { + endResetModel(); + return false; + } + if(!QFile::remove((*it)->getPatchFilename())) + { + endResetModel(); + return false; + } + it = VersionPatches.erase(it); + } + else + it++; + } + reapply(true); + endResetModel(); + return true; +} + +bool InstanceVersion::usesLegacyCustomJson() +{ + return QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")); +} + +QList > InstanceVersion::getActiveNormalLibs() +{ + QList > output; + for (auto lib : libraries) + { + if (lib->isActive() && !lib->isNative()) + { + output.append(lib); + } + } + return output; +} +QList > InstanceVersion::getActiveNativeLibs() +{ + QList > output; + for (auto lib : libraries) + { + if (lib->isActive() && lib->isNative()) + { + output.append(lib); + } + } + return output; +} + +std::shared_ptr InstanceVersion::fromJson(const QJsonObject &obj) +{ + std::shared_ptr version(new InstanceVersion(0)); + try + { + VersionBuilder::readJsonAndApplyToVersion(version.get(), obj); + } + catch(MMCError & err) + { + return 0; + } + return version; +} + +QVariant InstanceVersion::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + int row = index.row(); + int column = index.column(); + + if (row < 0 || row >= VersionPatches.size()) + return QVariant(); + + if (role == Qt::DisplayRole) + { + switch (column) + { + case 0: + return VersionPatches.at(row)->getPatchName(); + case 1: + return VersionPatches.at(row)->getPatchVersion(); + default: + return QVariant(); + } + } + return QVariant(); +} +QVariant InstanceVersion::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal) + { + if (role == Qt::DisplayRole) + { + switch (section) + { + case 0: + return tr("Name"); + case 1: + return tr("Version"); + default: + return QVariant(); + } + } + } + return QVariant(); +} +Qt::ItemFlags InstanceVersion::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return Qt::NoItemFlags; + return Qt::ItemIsSelectable | Qt::ItemIsEnabled; +} + +int InstanceVersion::rowCount(const QModelIndex &parent) const +{ + return VersionPatches.size(); +} + +int InstanceVersion::columnCount(const QModelIndex &parent) const +{ + return 2; +} + +QMap InstanceVersion::getExistingOrder() const +{ + QMap order; + int index = 0; + // overriden + { + QMap overridenOrder = VersionBuilder::readOverrideOrders(m_instance); + for (auto id : order.keys()) + { + if (overridenOrder.contains(id)) + { + order[id] = overridenOrder[id]; + } + } + } + for(auto item: VersionPatches) + { + // things with fixed (negative) order. + if(!item->isMoveable()) + continue; + // the other things. + auto id = item->getPatchID(); + order[id] = index; + index++; + } + return order; +} + +void InstanceVersion::move(const int index, const MoveDirection direction) +{ + int theirIndex; + if (direction == MoveUp) + { + theirIndex = index - 1; + } + else + { + theirIndex = index + 1; + } + + if (index < 0 || index >= VersionPatches.size()) + return; + if (theirIndex >= rowCount()) + theirIndex = rowCount() - 1; + if (theirIndex == -1) + theirIndex = rowCount() - 1; + if (index == theirIndex) + return; + int togap = theirIndex > index ? theirIndex + 1 : theirIndex; + + auto from = versionPatch(index); + auto to = versionPatch(theirIndex); + + if (!from || !to || !to->isMoveable() || !from->isMoveable()) + { + return; + } + + beginMoveRows(QModelIndex(), index, index, QModelIndex(), togap); + VersionPatches.swap(index, theirIndex); + endMoveRows(); + reapply(); +} +void InstanceVersion::resetOrder() +{ + QDir(m_instance->instanceRoot()).remove("order.json"); + reapply(); +} + +void InstanceVersion::reapply(const bool alreadyReseting) +{ + clear(); + for(auto file: VersionPatches) + { + file->applyTo(this); + } + finalize(); +} + +void InstanceVersion::finalize() +{ + // HACK: deny april fools. my head hurts enough already. + QDate now = QDate::currentDate(); + bool isAprilFools = now.month() == 4 && now.day() == 1; + if (assets.endsWith("_af") && !isAprilFools) + { + assets = assets.left(assets.length() - 3); + } + if (assets.isEmpty()) + { + assets = "legacy"; + } + auto finalizeArguments = [&]( QString & minecraftArguments, const QString & processArguments ) -> void + { + if (!minecraftArguments.isEmpty()) + return; + QString toCompare = processArguments.toLower(); + if (toCompare == "legacy") + { + minecraftArguments = " ${auth_player_name} ${auth_session}"; + } + else if (toCompare == "username_session") + { + minecraftArguments = "--username ${auth_player_name} --session ${auth_session}"; + } + else if (toCompare == "username_session_version") + { + minecraftArguments = "--username ${auth_player_name} " + "--session ${auth_session} " + "--version ${profile_name}"; + } + }; + finalizeArguments(vanillaMinecraftArguments, vanillaProcessArguments); + finalizeArguments(minecraftArguments, processArguments); +} + +void InstanceVersion::installJarMods(QStringList selectedFiles) +{ + for(auto filename: selectedFiles) + { + installJarModByFilename(filename); + } +} + +void InstanceVersion::installJarModByFilename(QString filepath) +{ + QString patchDir = PathCombine(m_instance->instanceRoot(), "patches"); + if(!ensureFolderPathExists(patchDir)) + { + // THROW... + return; + } + + if (!ensureFolderPathExists(m_instance->jarModsDir())) + { + // THROW... + return; + } + + QFileInfo sourceInfo(filepath); + auto uuid = QUuid::createUuid(); + QString id = uuid.toString().remove('{').remove('}'); + QString target_filename = id + ".jar"; + QString target_id = "org.multimc.jarmod." + id; + QString target_name = sourceInfo.completeBaseName() + " (jar mod)"; + QString finalPath = PathCombine(m_instance->jarModsDir(), target_filename); + + QFileInfo targetInfo(finalPath); + if(targetInfo.exists()) + { + // THROW + return; + } + + if (!QFile::copy(sourceInfo.absoluteFilePath(),QFileInfo(finalPath).absoluteFilePath())) + { + // THROW + return; + } + + auto f = std::make_shared(); + auto jarMod = std::make_shared(); + jarMod->name = target_filename; + f->jarMods.append(jarMod); + f->name = target_name; + f->fileId = target_id; + f->order = getFreeOrderNumber(); + + QFile file(PathCombine(patchDir, target_id + ".json")); + if (!file.open(QFile::WriteOnly)) + { + QLOG_ERROR() << "Error opening" << file.fileName() + << "for reading:" << file.errorString(); + return; + // THROW + } + file.write(f->toJson(true).toJson()); + file.close(); + int index = VersionPatches.size(); + beginInsertRows(QModelIndex(), index, index); + VersionPatches.append(f); + endInsertRows(); +} + +int InstanceVersion::getFreeOrderNumber() +{ + int largest = 100; + // yes, I do realize this is dumb. The order thing itself is dumb. and to be removed next. + for(auto thing: VersionPatches) + { + int order = thing->getOrder(); + if(order > largest) + largest = order; + } + return largest + 1; +} diff --git a/logic/minecraft/InstanceVersion.h b/logic/minecraft/InstanceVersion.h new file mode 100644 index 00000000..00fbf8bb --- /dev/null +++ b/logic/minecraft/InstanceVersion.h @@ -0,0 +1,181 @@ +/* Copyright 2013 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 + +#include +#include +#include + +#include "OneSixLibrary.h" +#include "VersionFile.h" +#include "JarMod.h" + +class OneSixInstance; + +class InstanceVersion : public QAbstractListModel +{ + Q_OBJECT +public: + explicit InstanceVersion(OneSixInstance *instance, QObject *parent = 0); + + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + + void reload(const QStringList &external = QStringList()); + void clear(); + + bool canRemove(const int index) const; + + QString versionFileId(const int index) const; + + // is this version unmodded vanilla minecraft? + bool isVanilla(); + // remove any customizations on top of vanilla + bool revertToVanilla(); + + // does this version have an FTB pack patch file? + bool hasFtbPack(); + // remove FTB pack + bool removeFtbPack(); + + // does this version have any jar mods? + bool hasJarMods(); + void installJarMods(QStringList selectedFiles); + void installJarModByFilename(QString filepath); + + // does this version still use a legacy custom.json file? + bool usesLegacyCustomJson(); + + enum MoveDirection { MoveUp, MoveDown }; + void move(const int index, const MoveDirection direction); + void resetOrder(); + + // clears and reapplies all version files + void reapply(const bool alreadyReseting = false); + void finalize(); + +public +slots: + bool remove(const int index); + bool remove(const QString id); + +public: + QList> getActiveNormalLibs(); + QList> getActiveNativeLibs(); + + static std::shared_ptr fromJson(const QJsonObject &obj); + +private: + bool preremove(VersionPatchPtr patch); + + // data members +public: + /// the ID - determines which jar to use! ACTUALLY IMPORTANT! + QString id; + + /// the time this version was actually released by Mojang, as string and as QDateTime + QString m_releaseTimeString; + QDateTime m_releaseTime; + + /// the time this version was last updated by Mojang, as string and as QDateTime + QString m_updateTimeString; + QDateTime m_updateTime; + + /// Release type - "release" or "snapshot" + QString type; + /// Assets type - "legacy" or a version ID + QString assets; + /** + * DEPRECATED: Old versions of the new vanilla launcher used this + * ex: "username_session_version" + */ + QString processArguments; + /// Same as above, but only for vanilla + QString vanillaProcessArguments; + /** + * arguments that should be used for launching minecraft + * + * ex: "--username ${auth_player_name} --session ${auth_session} + * --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}" + */ + QString minecraftArguments; + /// Same as above, but only for vanilla + QString vanillaMinecraftArguments; + /** + * the minimum launcher version required by this version ... current is 4 (at point of + * writing) + */ + int minimumLauncherVersion = 0xDEADBEEF; + /** + * A list of all tweaker classes + */ + QStringList tweakers; + /** + * The main class to load first + */ + QString mainClass; + /** + * The applet class, for some very old minecraft releases + */ + QString appletClass; + + /// the list of libs - both active and inactive, native and java + QList> libraries; + + /// same, but only vanilla. + QList> vanillaLibraries; + + /// traits, collected from all the version files (version files can only add) + QSet traits; + + /// A list of jar mods. version files can add those. + QList jarMods; + + /* + FIXME: add support for those rules here? Looks like a pile of quick hacks to me though. + + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx", + "version": "^10\\.5\\.\\d$" + } + } + ], + "incompatibilityReason": "There is a bug in LWJGL which makes it incompatible with OSX + 10.5.8. Please go to New Profile and use 1.5.2 for now. Sorry!" + } + */ + // QList rules; + + QList VersionPatches; + VersionPatchPtr versionPatch(const QString &id); + VersionPatchPtr versionPatch(int index); + +private: + OneSixInstance *m_instance; + QMap getExistingOrder() const; + int getFreeOrderNumber(); +}; diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp index 21cdbacc..488a180a 100644 --- a/logic/minecraft/MinecraftVersion.cpp +++ b/logic/minecraft/MinecraftVersion.cpp @@ -1,5 +1,5 @@ #include "MinecraftVersion.h" -#include "VersionFinal.h" +#include "InstanceVersion.h" #include "VersionBuildError.h" #include "VersionBuilder.h" @@ -54,7 +54,7 @@ bool MinecraftVersion::isMinecraftVersion() // 1. assume the local file is good. load, check. If it's good, apply. // 2. if discrepancies are found, fall out and fail (impossible to apply incomplete version). -void MinecraftVersion::applyFileTo(VersionFinal *version) +void MinecraftVersion::applyFileTo(InstanceVersion *version) { QFileInfo versionFile(QString("versions/%1/%1.dat").arg(m_descriptor)); @@ -62,7 +62,7 @@ void MinecraftVersion::applyFileTo(VersionFinal *version) versionObj->applyTo(version); } -void MinecraftVersion::applyTo(VersionFinal *version) +void MinecraftVersion::applyTo(InstanceVersion *version) { // do we have this one cached? if (m_versionSource == Local) diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h index 43ac68e1..82073a97 100644 --- a/logic/minecraft/MinecraftVersion.h +++ b/logic/minecraft/MinecraftVersion.h @@ -24,7 +24,7 @@ #include "VersionFile.h" #include "VersionSource.h" -class VersionFinal; +class InstanceVersion; class MinecraftVersion; typedef std::shared_ptr MinecraftVersionPtr; @@ -37,7 +37,7 @@ public: /* methods */ virtual QString typeString() const override; virtual bool hasJarMods() override; virtual bool isMinecraftVersion() override; - virtual void applyTo(VersionFinal *version) override; + virtual void applyTo(InstanceVersion *version) override; virtual int getOrder(); virtual void setOrder(int order); virtual QList getJarMods() override; @@ -55,7 +55,7 @@ public: /* methods */ } private: /* methods */ - void applyFileTo(VersionFinal *version); + void applyFileTo(InstanceVersion *version); public: /* data */ /// The URL that this version will be downloaded from. maybe. diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp index cff70821..86c1da9e 100644 --- a/logic/minecraft/VersionBuilder.cpp +++ b/logic/minecraft/VersionBuilder.cpp @@ -28,7 +28,7 @@ #include "MultiMC.h" #include "logic/minecraft/VersionBuilder.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/OneSixRule.h" #include "logic/minecraft/VersionPatch.h" #include "logic/minecraft/VersionFile.h" @@ -44,7 +44,7 @@ VersionBuilder::VersionBuilder() { } -void VersionBuilder::build(VersionFinal *version, OneSixInstance *instance, +void VersionBuilder::build(InstanceVersion *version, OneSixInstance *instance, const QStringList &external) { VersionBuilder builder; @@ -54,7 +54,7 @@ void VersionBuilder::build(VersionFinal *version, OneSixInstance *instance, builder.buildInternal(); } -void VersionBuilder::readJsonAndApplyToVersion(VersionFinal *version, const QJsonObject &obj) +void VersionBuilder::readJsonAndApplyToVersion(InstanceVersion *version, const QJsonObject &obj) { VersionBuilder builder; builder.m_version = version; @@ -312,10 +312,9 @@ bool VersionBuilder::writeOverrideOrders(const QMap &order, QJsonObject obj; for (auto it = order.cbegin(); it != order.cend(); ++it) { - if (it.key().startsWith("org.multimc.")) - { + int order = it.value(); + if(order < 0) continue; - } obj.insert(it.key(), it.value()); } QFile orderFile(instance->instanceRoot() + "/order.json"); diff --git a/logic/minecraft/VersionBuilder.h b/logic/minecraft/VersionBuilder.h index 6097840b..77746199 100644 --- a/logic/minecraft/VersionBuilder.h +++ b/logic/minecraft/VersionBuilder.h @@ -19,7 +19,7 @@ #include #include "VersionFile.h" -class VersionFinal; +class InstanceVersion; class OneSixInstance; class QJsonObject; class QFileInfo; @@ -28,8 +28,8 @@ class VersionBuilder { VersionBuilder(); public: - static void build(VersionFinal *version, OneSixInstance *instance, const QStringList &external); - static void readJsonAndApplyToVersion(VersionFinal *version, const QJsonObject &obj); + static void build(InstanceVersion *version, OneSixInstance *instance, const QStringList &external); + static void readJsonAndApplyToVersion(InstanceVersion *version, const QJsonObject &obj); static VersionFilePtr parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder, bool isFTB = false); static VersionFilePtr parseBinaryJsonFile(const QFileInfo &fileInfo); @@ -37,7 +37,7 @@ public: static bool writeOverrideOrders(const QMap &order, OneSixInstance *instance); private: - VersionFinal *m_version; + InstanceVersion *m_version; OneSixInstance *m_instance; QStringList external_patches; QDir instance_root; diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index 74e7ba98..93f57116 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -6,7 +6,7 @@ #include "logic/minecraft/VersionFile.h" #include "logic/minecraft/OneSixLibrary.h" -#include "logic/minecraft/VersionFinal.h" +#include "logic/minecraft/InstanceVersion.h" #include "logic/minecraft/JarMod.h" #include "ParseUtils.h" @@ -266,7 +266,7 @@ bool VersionFile::hasJarMods() return !jarMods.isEmpty(); } -void VersionFile::applyTo(VersionFinal *version) +void VersionFile::applyTo(InstanceVersion *version) { if (minimumLauncherVersion != -1) { diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h index 2d3781cb..186f4335 100644 --- a/logic/minecraft/VersionFile.h +++ b/logic/minecraft/VersionFile.h @@ -11,7 +11,7 @@ #include "OneSixLibrary.h" #include "JarMod.h" -class VersionFinal; +class InstanceVersion; struct VersionFile; typedef std::shared_ptr VersionFilePtr; @@ -22,7 +22,7 @@ public: /* methods */ const bool requireOrder, const bool isFTB = false); QJsonDocument toJson(bool saveOrder); - virtual void applyTo(VersionFinal *version) override; + virtual void applyTo(InstanceVersion *version) override; virtual bool isMinecraftVersion() override; virtual bool hasJarMods() override; virtual int getOrder() override diff --git a/logic/minecraft/VersionFinal.cpp b/logic/minecraft/VersionFinal.cpp deleted file mode 100644 index c834bebc..00000000 --- a/logic/minecraft/VersionFinal.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* Copyright 2013 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 -#include -#include -#include - -#include "logic/minecraft/VersionFinal.h" -#include "logic/minecraft/VersionBuilder.h" -#include "logic/OneSixInstance.h" - -VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent) - : QAbstractListModel(parent), m_instance(instance) -{ - clear(); -} - -void VersionFinal::reload(const QStringList &external) -{ - beginResetModel(); - VersionBuilder::build(this, m_instance, external); - reapply(true); - endResetModel(); -} - -void VersionFinal::clear() -{ - id.clear(); - m_updateTimeString.clear(); - m_updateTime = QDateTime(); - m_releaseTimeString.clear(); - m_releaseTime = QDateTime(); - type.clear(); - assets.clear(); - processArguments.clear(); - minecraftArguments.clear(); - minimumLauncherVersion = 0xDEADBEAF; - mainClass.clear(); - appletClass.clear(); - libraries.clear(); - tweakers.clear(); - jarMods.clear(); - traits.clear(); -} - -bool VersionFinal::canRemove(const int index) const -{ - return VersionPatches.at(index)->isMoveable(); -} - -bool VersionFinal::preremove(VersionPatchPtr patch) -{ - bool ok = true; - for(auto & jarmod: patch->getJarMods()) - { - QString fullpath =PathCombine(m_instance->jarModsDir(), jarmod->name); - QFileInfo finfo (fullpath); - if(finfo.exists()) - ok &= QFile::remove(fullpath); - } - return ok; -} - -bool VersionFinal::remove(const int index) -{ - if (!canRemove(index)) - return false; - if(!preremove(VersionPatches[index])) - { - return false; - } - if(!QFile::remove(VersionPatches.at(index)->getPatchFilename())) - return false; - beginResetModel(); - VersionPatches.removeAt(index); - reapply(true); - endResetModel(); - return true; -} - -bool VersionFinal::remove(const QString id) -{ - int i = 0; - for (auto patch : VersionPatches) - { - if (patch->getPatchID() == id) - { - return remove(i); - } - i++; - } - return false; -} - -QString VersionFinal::versionFileId(const int index) const -{ - if (index < 0 || index >= VersionPatches.size()) - { - return QString(); - } - return VersionPatches.at(index)->getPatchID(); -} - -VersionPatchPtr VersionFinal::versionPatch(const QString &id) -{ - for (auto file : VersionPatches) - { - if (file->getPatchID() == id) - { - return file; - } - } - return 0; -} - -VersionPatchPtr VersionFinal::versionPatch(int index) -{ - if(index < 0 || index >= VersionPatches.size()) - return 0; - return VersionPatches[index]; -} - - -bool VersionFinal::hasJarMods() -{ - return !jarMods.isEmpty(); -} - -bool VersionFinal::hasFtbPack() -{ - return versionPatch("org.multimc.ftb.pack.json") != nullptr; -} - -bool VersionFinal::removeFtbPack() -{ - return remove("org.multimc.ftb.pack.json"); -} - -bool VersionFinal::isVanilla() -{ - QDir patches(PathCombine(m_instance->instanceRoot(), "patches/")); - if(VersionPatches.size() > 1) - return false; - if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json"))) - return false; - return true; -} - -bool VersionFinal::revertToVanilla() -{ - beginResetModel(); - auto it = VersionPatches.begin(); - while (it != VersionPatches.end()) - { - if ((*it)->isMoveable()) - { - if(!preremove(*it)) - { - endResetModel(); - return false; - } - if(!QFile::remove((*it)->getPatchFilename())) - { - endResetModel(); - return false; - } - it = VersionPatches.erase(it); - } - else - it++; - } - reapply(true); - endResetModel(); - return true; -} - -bool VersionFinal::usesLegacyCustomJson() -{ - return QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")); -} - -QList > VersionFinal::getActiveNormalLibs() -{ - QList > output; - for (auto lib : libraries) - { - if (lib->isActive() && !lib->isNative()) - { - output.append(lib); - } - } - return output; -} -QList > VersionFinal::getActiveNativeLibs() -{ - QList > output; - for (auto lib : libraries) - { - if (lib->isActive() && lib->isNative()) - { - output.append(lib); - } - } - return output; -} - -std::shared_ptr VersionFinal::fromJson(const QJsonObject &obj) -{ - std::shared_ptr version(new VersionFinal(0)); - try - { - VersionBuilder::readJsonAndApplyToVersion(version.get(), obj); - } - catch(MMCError & err) - { - return 0; - } - return version; -} - -QVariant VersionFinal::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - int row = index.row(); - int column = index.column(); - - if (row < 0 || row >= VersionPatches.size()) - return QVariant(); - - if (role == Qt::DisplayRole) - { - switch (column) - { - case 0: - return VersionPatches.at(row)->getPatchName(); - case 1: - return VersionPatches.at(row)->getPatchVersion(); - default: - return QVariant(); - } - } - return QVariant(); -} -QVariant VersionFinal::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Horizontal) - { - if (role == Qt::DisplayRole) - { - switch (section) - { - case 0: - return tr("Name"); - case 1: - return tr("Version"); - default: - return QVariant(); - } - } - } - return QVariant(); -} -Qt::ItemFlags VersionFinal::flags(const QModelIndex &index) const -{ - if (!index.isValid()) - return Qt::NoItemFlags; - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; -} - -int VersionFinal::rowCount(const QModelIndex &parent) const -{ - return VersionPatches.size(); -} - -int VersionFinal::columnCount(const QModelIndex &parent) const -{ - return 2; -} - -QMap VersionFinal::getExistingOrder() const -{ - QMap order; - // default - { - for (auto file : VersionPatches) - { - order.insert(file->getPatchID(), file->getOrder()); - } - } - // overriden - { - QMap overridenOrder = VersionBuilder::readOverrideOrders(m_instance); - for (auto id : order.keys()) - { - if (overridenOrder.contains(id)) - { - order[id] = overridenOrder[id]; - } - } - } - return order; -} - -void VersionFinal::move(const int index, const MoveDirection direction) -{ - int theirIndex; - int theirIndex_qt; - if (direction == MoveUp) - { - theirIndex_qt = theirIndex = index - 1; - } - else - { - theirIndex = index + 1; - theirIndex_qt = index + 2; - } - auto from = versionPatch(index); - auto to = versionPatch(theirIndex); - - if (!from || !to || !from->isMoveable() || !from->isMoveable()) - { - return; - } - if(direction == MoveDown) - { - beginMoveRows(QModelIndex(), index, index, QModelIndex(), theirIndex_qt); - } - else - { - beginMoveRows(QModelIndex(), index, index, QModelIndex(), theirIndex_qt); - } - VersionPatches.swap(index, theirIndex); - endMoveRows(); - - auto order = getExistingOrder(); - order[from->getPatchID()] = theirIndex; - order[to->getPatchID()] = index; - - if (!VersionBuilder::writeOverrideOrders(order, m_instance)) - { - throw MMCError(tr("Couldn't save the new order")); - } - else - { - reapply(); - } -} -void VersionFinal::resetOrder() -{ - QDir(m_instance->instanceRoot()).remove("order.json"); - reapply(); -} - -void VersionFinal::reapply(const bool alreadyReseting) -{ - if (!alreadyReseting) - { - beginResetModel(); - } - - clear(); - - auto existingOrders = getExistingOrder(); - QList orders = existingOrders.values(); - std::sort(orders.begin(), orders.end()); - QList newVersionFiles; - for (auto order : orders) - { - auto file = versionPatch(existingOrders.key(order)); - newVersionFiles.append(file); - file->applyTo(this); - } - VersionPatches.swap(newVersionFiles); - finalize(); - if (!alreadyReseting) - { - endResetModel(); - } -} - -void VersionFinal::finalize() -{ - // HACK: deny april fools. my head hurts enough already. - QDate now = QDate::currentDate(); - bool isAprilFools = now.month() == 4 && now.day() == 1; - if (assets.endsWith("_af") && !isAprilFools) - { - assets = assets.left(assets.length() - 3); - } - if (assets.isEmpty()) - { - assets = "legacy"; - } - auto finalizeArguments = [&]( QString & minecraftArguments, const QString & processArguments ) -> void - { - if (!minecraftArguments.isEmpty()) - return; - QString toCompare = processArguments.toLower(); - if (toCompare == "legacy") - { - minecraftArguments = " ${auth_player_name} ${auth_session}"; - } - else if (toCompare == "username_session") - { - minecraftArguments = "--username ${auth_player_name} --session ${auth_session}"; - } - else if (toCompare == "username_session_version") - { - minecraftArguments = "--username ${auth_player_name} " - "--session ${auth_session} " - "--version ${profile_name}"; - } - }; - finalizeArguments(vanillaMinecraftArguments, vanillaProcessArguments); - finalizeArguments(minecraftArguments, processArguments); -} - diff --git a/logic/minecraft/VersionFinal.h b/logic/minecraft/VersionFinal.h deleted file mode 100644 index 83a88263..00000000 --- a/logic/minecraft/VersionFinal.h +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright 2013 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 - -#include -#include -#include - -#include "OneSixLibrary.h" -#include "VersionFile.h" -#include "JarMod.h" - -class OneSixInstance; - -class VersionFinal : public QAbstractListModel -{ - Q_OBJECT -public: - explicit VersionFinal(OneSixInstance *instance, QObject *parent = 0); - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - - void reload(const QStringList &external = QStringList()); - void clear(); - - bool canRemove(const int index) const; - - QString versionFileId(const int index) const; - - // is this version unmodded vanilla minecraft? - bool isVanilla(); - // remove any customizations on top of vanilla - bool revertToVanilla(); - - // does this version have an FTB pack patch file? - bool hasFtbPack(); - // remove FTB pack - bool removeFtbPack(); - - // does this version have any jar mods? - bool hasJarMods(); - - // does this version still use a legacy custom.json file? - bool usesLegacyCustomJson(); - - - enum MoveDirection { MoveUp, MoveDown }; - void move(const int index, const MoveDirection direction); - void resetOrder(); - - // clears and reapplies all version files - void reapply(const bool alreadyReseting = false); - void finalize(); - -public -slots: - bool remove(const int index); - bool remove(const QString id); - -public: - QList> getActiveNormalLibs(); - QList> getActiveNativeLibs(); - - static std::shared_ptr fromJson(const QJsonObject &obj); - -private: - bool preremove(VersionPatchPtr patch); - - // data members -public: - /// the ID - determines which jar to use! ACTUALLY IMPORTANT! - QString id; - - /// the time this version was actually released by Mojang, as string and as QDateTime - QString m_releaseTimeString; - QDateTime m_releaseTime; - - /// the time this version was last updated by Mojang, as string and as QDateTime - QString m_updateTimeString; - QDateTime m_updateTime; - - /// Release type - "release" or "snapshot" - QString type; - /// Assets type - "legacy" or a version ID - QString assets; - /** - * DEPRECATED: Old versions of the new vanilla launcher used this - * ex: "username_session_version" - */ - QString processArguments; - /// Same as above, but only for vanilla - QString vanillaProcessArguments; - /** - * arguments that should be used for launching minecraft - * - * ex: "--username ${auth_player_name} --session ${auth_session} - * --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}" - */ - QString minecraftArguments; - /// Same as above, but only for vanilla - QString vanillaMinecraftArguments; - /** - * the minimum launcher version required by this version ... current is 4 (at point of - * writing) - */ - int minimumLauncherVersion = 0xDEADBEEF; - /** - * A list of all tweaker classes - */ - QStringList tweakers; - /** - * The main class to load first - */ - QString mainClass; - /** - * The applet class, for some very old minecraft releases - */ - QString appletClass; - - /// the list of libs - both active and inactive, native and java - QList> libraries; - - /// same, but only vanilla. - QList> vanillaLibraries; - - /// traits, collected from all the version files (version files can only add) - QSet traits; - - /// A list of jar mods. version files can add those. - QList jarMods; - - /* - FIXME: add support for those rules here? Looks like a pile of quick hacks to me though. - - "rules": [ - { - "action": "allow" - }, - { - "action": "disallow", - "os": { - "name": "osx", - "version": "^10\\.5\\.\\d$" - } - } - ], - "incompatibilityReason": "There is a bug in LWJGL which makes it incompatible with OSX - 10.5.8. Please go to New Profile and use 1.5.2 for now. Sorry!" - } - */ - // QList rules; - - QList VersionPatches; - VersionPatchPtr versionPatch(const QString &id); - VersionPatchPtr versionPatch(int index); - -private: - OneSixInstance *m_instance; - QMap getExistingOrder() const; -}; diff --git a/logic/minecraft/VersionPatch.h b/logic/minecraft/VersionPatch.h index ef082b37..1dd30e79 100644 --- a/logic/minecraft/VersionPatch.h +++ b/logic/minecraft/VersionPatch.h @@ -4,12 +4,12 @@ #include #include "JarMod.h" -class VersionFinal; +class InstanceVersion; class VersionPatch { public: virtual ~VersionPatch(){}; - virtual void applyTo(VersionFinal *version) = 0; + virtual void applyTo(InstanceVersion *version) = 0; virtual bool isMinecraftVersion() = 0; virtual bool hasJarMods() = 0; diff --git a/logic/net/NetJob.h b/logic/net/NetJob.h index 66bf7fb6..d05e7b6f 100644 --- a/logic/net/NetJob.h +++ b/logic/net/NetJob.h @@ -21,7 +21,6 @@ #include "MD5EtagDownload.h" #include "CacheDownload.h" #include "HttpMetaCache.h" -//#include "logic/forge/ForgeXzDownload.h" #include "logic/tasks/ProgressProvider.h" class NetJob; -- cgit v1.2.3