diff options
Diffstat (limited to 'api/logic/minecraft/legacy/LegacyInstance.h')
-rw-r--r-- | api/logic/minecraft/legacy/LegacyInstance.h | 115 |
1 files changed, 50 insertions, 65 deletions
diff --git a/api/logic/minecraft/legacy/LegacyInstance.h b/api/logic/minecraft/legacy/LegacyInstance.h index 15d1383f..4a8bc436 100644 --- a/api/logic/minecraft/legacy/LegacyInstance.h +++ b/api/logic/minecraft/legacy/LegacyInstance.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2017 MultiMC Contributors +/* Copyright 2013-2018 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,22 +15,27 @@ #pragma once -#include "minecraft/MinecraftInstance.h" +#include "BaseInstance.h" +#include "minecraft/Mod.h" #include "multimc_logic_export.h" class ModList; class LegacyModList; +class WorldList; class Task; - -class MULTIMC_LOGIC_EXPORT LegacyInstance : public MinecraftInstance +/* + * WHY: Legacy instances - from MultiMC 3 and 4 - are here only to provide a way to upgrade them to the current format. + */ +class MULTIMC_LOGIC_EXPORT LegacyInstance : public BaseInstance { Q_OBJECT public: explicit LegacyInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir); - virtual void init() override {}; + virtual void init() override {} + virtual void saveNow() override {} /// Path to the instance's minecraft.jar QString runnableJar() const; @@ -38,20 +43,6 @@ public: //! Path to the instance's modlist file. QString modListFile() const; - /* - ////// Edit Instance Dialog stuff ////// - virtual QList<BasePage *> getPages(); - virtual QString dialogTitle(); - */ - - ////// Mod Lists ////// - std::shared_ptr<LegacyModList> jarModList() const ; - virtual QList< Mod > getJarMods() const override; - std::shared_ptr<ModList> coreModList() const; - std::shared_ptr<ModList> loaderModList() const; - std::shared_ptr<ModList> texturePackList() const override; - std::shared_ptr<WorldList> worldList() const override; - ////// Directories ////// QString libDir() const; QString savesDir() const; @@ -61,8 +52,10 @@ public: QString coreModsDir() const; QString resourceDir() const; virtual QString instanceConfigFolder() const override; + QString minecraftRoot() const; // Path to the instance's minecraft directory. + QString binRoot() const; // Path to the instance's minecraft bin directory. - /// Get the curent base jar of this instance. By default, it's the + /// Get the curent base jar of this instance. By default, it's the /// versions/$version/$version.jar QString baseJar() const; @@ -75,13 +68,15 @@ public: * Whether or not custom base jar is used */ bool shouldUseCustomBaseJar() const; - void setShouldUseCustomBaseJar(bool val); /*! * The value of the custom base jar */ QString customBaseJar() const; - void setCustomBaseJar(QString val); + + std::shared_ptr<LegacyModList> jarModList() const; + QList<Mod> getJarMods() const; + std::shared_ptr<WorldList> worldList() const; /*! * Whether or not the instance's minecraft.jar needs to be rebuilt. @@ -89,67 +84,57 @@ public: * re-added to a fresh minecraft.jar file. */ bool shouldRebuild() const; - void setShouldRebuild(bool val); - - virtual QString currentVersionId() const override; - - //! The version of LWJGL that this instance uses. - QString lwjglVersion() const; - //! Where the lwjgl versions foor this instance can be found... HACK HACK HACK - QString lwjglFolder() const; + QString currentVersionId() const; + QString intendedVersionId() const; - /// st the version of LWJGL libs this instance will use - void setLWJGLVersion(QString val); - - virtual QString intendedVersionId() const override; - virtual bool setIntendedVersionId(QString version) override; - - virtual QSet<QString> traits() override + QSet<QString> traits() const override { return {"legacy-instance", "texturepacks"}; }; - virtual bool shouldUpdate() const override; - virtual void setShouldUpdate(bool val) override; - virtual shared_qobject_ptr<Task> createUpdateTask() override; - virtual std::shared_ptr<Task> createJarModdingTask() override; - virtual QString createLaunchScript(AuthSessionPtr session) override; + virtual bool shouldUpdate() const; + virtual shared_qobject_ptr<Task> createUpdateTask(Net::Mode mode) override; virtual QString typeName() const override; - bool canExport() const override + bool canLaunch() const override + { + return false; + } + bool canEdit() const override { return true; } - - QStringList getClassPath() const override; - QString getMainClass() const override; - - QStringList getNativeJars() const override; - QString getNativePath() const override; - - QString getLocalLibraryPath() const override + bool canExport() const override + { + return false; + } + std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account) override + { + return nullptr; + } + IPathMatcher::Ptr getLogFileMatcher() override + { + return nullptr; + } + QString getLogFileRoot() override { - return QString(); + return minecraftRoot(); } - QStringList processMinecraftArgs(AuthSessionPtr account) const override; + QString getStatusbarDescription() override; QStringList verboseDescription(AuthSessionPtr session) override; -protected: - std::shared_ptr<LaunchStep> createMainLaunchStep(LaunchTask *parent, AuthSessionPtr session) override; - QStringList validLaunchMethods() override; - QString launchMethod() override; - + QProcessEnvironment createEnvironment() override + { + return QProcessEnvironment(); + } + QMap<QString, QString> getVariables() const override + { + return {}; + } protected: mutable std::shared_ptr<LegacyModList> jar_mod_list; - mutable std::shared_ptr<ModList> core_mod_list; - mutable std::shared_ptr<ModList> loader_mod_list; - mutable std::shared_ptr<ModList> texture_pack_list; mutable std::shared_ptr<WorldList> m_world_list; - std::shared_ptr<Setting> m_lwjglFolderSetting; -protected -slots: - virtual void jarModsChanged(); }; |