diff options
Diffstat (limited to 'launcher')
58 files changed, 917 insertions, 1831 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp index ce40c4f3..84b5a0fe 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -192,27 +192,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) #endif startTime = QDateTime::currentDateTime(); -#ifdef Q_OS_LINUX - { - QFile osrelease("/proc/sys/kernel/osrelease"); - if (osrelease.open(QFile::ReadOnly | QFile::Text)) { - QTextStream in(&osrelease); - auto contents = in.readAll(); - if( - contents.contains("WSL", Qt::CaseInsensitive) || - contents.contains("Microsoft", Qt::CaseInsensitive) - ) { - showFatalErrorMessage( - "Unsupported system detected!", - "Linux-on-Windows distributions are not supported.\n\n" - "Please use the Windows binary when playing on Windows." - ); - return; - } - } - } -#endif - // Don't quit on hiding the last window this->setQuitOnLastWindowClosed(false); @@ -315,16 +294,20 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) } else { -#ifdef LAUNCHER_LINUX_DATADIR - QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); - if (xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); - dataPath = xdgDataHome + "/polymc"; - adjustedBy += "XDG standard " + dataPath; -#elif defined(Q_OS_MAC) +#if !defined(LAUNCHER_PORTABLE) || defined(Q_OS_MAC) QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); dataPath = foo.absolutePath(); - adjustedBy += "Fallback to special Mac location " + dataPath; + adjustedBy += dataPath; + +#ifdef Q_OS_LINUX + // TODO: this should be removed in a future version + // TODO: provide a migration path similar to macOS migration + QDir bar(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation), "polymc")); + if (bar.exists()) { + dataPath = bar.absolutePath(); + adjustedBy += "Legacy data path " + dataPath; + } +#endif #else dataPath = applicationDirPath(); adjustedBy += "Fallback to binary path " + dataPath; @@ -526,8 +509,10 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) #elif defined(Q_OS_WIN32) m_rootPath = binPath; #elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); + QDir foo(FS::PathCombine(binPath, "../..")); m_rootPath = foo.absolutePath(); + // on macOS, touch the root to force Finder to reload the .app metadata (and fix any icon change issues) + FS::updateTimestamp(m_rootPath); #endif #ifdef MULTIMC_JARS_LOCATION diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp index 374d4a29..1bff9e1d 100644 --- a/launcher/BaseInstance.cpp +++ b/launcher/BaseInstance.cpp @@ -39,6 +39,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s m_settings->registerSetting("lastLaunchTime", 0); m_settings->registerSetting("totalTimePlayed", 0); m_settings->registerSetting("lastTimePlayed", 0); + m_settings->registerSetting("InstanceType", "OneSix"); // Custom Commands auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false); diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 51a63722..751b354b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -279,13 +279,6 @@ set(MINECRAFT_SOURCES minecraft/launch/VerifyJavaInstall.cpp minecraft/launch/VerifyJavaInstall.h - minecraft/legacy/LegacyModList.h - minecraft/legacy/LegacyModList.cpp - minecraft/legacy/LegacyInstance.h - minecraft/legacy/LegacyInstance.cpp - minecraft/legacy/LegacyUpgradeTask.h - minecraft/legacy/LegacyUpgradeTask.cpp - minecraft/GradleSpecifier.h minecraft/MinecraftInstance.cpp minecraft/MinecraftInstance.h @@ -693,8 +686,6 @@ SET(LAUNCHER_SOURCES ui/pages/instance/OtherLogsPage.h ui/pages/instance/ServersPage.cpp ui/pages/instance/ServersPage.h - ui/pages/instance/LegacyUpgradePage.cpp - ui/pages/instance/LegacyUpgradePage.h ui/pages/instance/WorldListPage.cpp ui/pages/instance/WorldListPage.h @@ -796,6 +787,8 @@ SET(LAUNCHER_SOURCES ui/pagedialog/PageDialog.h ui/dialogs/ProgressDialog.cpp ui/dialogs/ProgressDialog.h + ui/dialogs/ReviewMessageBox.cpp + ui/dialogs/ReviewMessageBox.h ui/dialogs/UpdateDialog.cpp ui/dialogs/UpdateDialog.h ui/dialogs/VersionSelectDialog.cpp @@ -874,7 +867,6 @@ qt5_wrap_ui(LAUNCHER_UI ui/pages/instance/InstanceSettingsPage.ui ui/pages/instance/VersionPage.ui ui/pages/instance/WorldListPage.ui - ui/pages/instance/LegacyUpgradePage.ui ui/pages/instance/ScreenshotsPage.ui ui/pages/modplatform/atlauncher/AtlOptionalModDialog.ui ui/pages/modplatform/atlauncher/AtlPage.ui @@ -904,6 +896,7 @@ qt5_wrap_ui(LAUNCHER_UI ui/dialogs/AboutDialog.ui ui/dialogs/LoginDialog.ui ui/dialogs/EditAccountDialog.ui + ui/dialogs/ReviewMessageBox.ui ) qt5_add_resources(LAUNCHER_RESOURCES diff --git a/launcher/InstanceCopyTask.cpp b/launcher/InstanceCopyTask.cpp index 35adeaf9..c2bfe839 100644 --- a/launcher/InstanceCopyTask.cpp +++ b/launcher/InstanceCopyTask.cpp @@ -42,7 +42,6 @@ void InstanceCopyTask::copyFinished() } // FIXME: shouldn't this be able to report errors? auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg")); - instanceSettings->registerSetting("InstanceType", "Legacy"); InstancePtr inst(new NullInstance(m_globalSettings, instanceSettings, m_stagingPath)); inst->setName(m_instName); diff --git a/launcher/InstanceCreationTask.cpp b/launcher/InstanceCreationTask.cpp index eafc5126..4c37bd7f 100644 --- a/launcher/InstanceCreationTask.cpp +++ b/launcher/InstanceCreationTask.cpp @@ -17,8 +17,6 @@ void InstanceCreationTask::executeTask() { auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg")); instanceSettings->suspendSave(); - instanceSettings->registerSetting("InstanceType", "Legacy"); - instanceSettings->set("InstanceType", "OneSix"); MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath); auto components = inst.getPackProfile(); components->buildingFromScratch(); diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index ec378538..6dd615c7 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -261,8 +261,6 @@ void InstanceImportTask::processFlame() QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg"); auto instanceSettings = std::make_shared<INISettingsObject>(configPath); - instanceSettings->registerSetting("InstanceType", "Legacy"); - instanceSettings->set("InstanceType", "OneSix"); MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath); auto mcVersion = pack.minecraft.version; // Hack to correct some 'special sauce'... @@ -422,7 +420,6 @@ void InstanceImportTask::processMultiMC() { QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg"); auto instanceSettings = std::make_shared<INISettingsObject>(configPath); - instanceSettings->registerSetting("InstanceType", "Legacy"); NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath); diff --git a/launcher/InstanceList.cpp b/launcher/InstanceList.cpp index ad18740b..6e37e3d8 100644 --- a/launcher/InstanceList.cpp +++ b/launcher/InstanceList.cpp @@ -32,7 +32,6 @@ #include "BaseInstance.h" #include "InstanceTask.h" #include "settings/INISettingsObject.h" -#include "minecraft/legacy/LegacyInstance.h" #include "NullInstance.h" #include "minecraft/MinecraftInstance.h" #include "FileSystem.h" @@ -544,23 +543,8 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id) auto instanceRoot = FS::PathCombine(m_instDir, id); auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg")); InstancePtr inst; - - instanceSettings->registerSetting("InstanceType", "Legacy"); - - QString inst_type = instanceSettings->get("InstanceType").toString(); - - if (inst_type == "OneSix" || inst_type == "Nostalgia") - { - inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); - } - else if (inst_type == "Legacy") - { - inst.reset(new LegacyInstance(m_globalSettings, instanceSettings, instanceRoot)); - } - else - { - inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot)); - } + // TODO: Handle incompatible instances + inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); return inst; } diff --git a/launcher/InstancePageProvider.h b/launcher/InstancePageProvider.h index 97eeab8c..357157d0 100644 --- a/launcher/InstancePageProvider.h +++ b/launcher/InstancePageProvider.h @@ -1,6 +1,5 @@ #pragma once #include "minecraft/MinecraftInstance.h" -#include "minecraft/legacy/LegacyInstance.h" #include <FileSystem.h> #include "ui/pages/BasePage.h" #include "ui/pages/BasePageProvider.h" @@ -14,7 +13,6 @@ #include "ui/pages/instance/ScreenshotsPage.h" #include "ui/pages/instance/InstanceSettingsPage.h" #include "ui/pages/instance/OtherLogsPage.h" -#include "ui/pages/instance/LegacyUpgradePage.h" #include "ui/pages/instance/WorldListPage.h" #include "ui/pages/instance/ServersPage.h" #include "ui/pages/instance/GameOptionsPage.h" @@ -34,31 +32,20 @@ public: QList<BasePage *> values; values.append(new LogPage(inst)); std::shared_ptr<MinecraftInstance> onesix = std::dynamic_pointer_cast<MinecraftInstance>(inst); - if(onesix) - { - values.append(new VersionPage(onesix.get())); - auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Mods"), "Loader-mods"); - modsPage->setFilter("%1 (*.zip *.jar *.litemod)"); - values.append(modsPage); - values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods")); - values.append(new ResourcePackPage(onesix.get())); - values.append(new TexturePackPage(onesix.get())); - values.append(new ShaderPackPage(onesix.get())); - values.append(new NotesPage(onesix.get())); - values.append(new WorldListPage(onesix.get(), onesix->worldList())); - values.append(new ServersPage(onesix)); - // values.append(new GameOptionsPage(onesix.get())); - values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots"))); - values.append(new InstanceSettingsPage(onesix.get())); - } - std::shared_ptr<LegacyInstance> legacy = std::dynamic_pointer_cast<LegacyInstance>(inst); - if(legacy) - { - values.append(new LegacyUpgradePage(legacy)); - values.append(new NotesPage(legacy.get())); - values.append(new WorldListPage(legacy.get(), legacy->worldList())); - values.append(new ScreenshotsPage(FS::PathCombine(legacy->gameRoot(), "screenshots"))); - } + values.append(new VersionPage(onesix.get())); + auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Mods"), "Loader-mods"); + modsPage->setFilter("%1 (*.zip *.jar *.litemod)"); + values.append(modsPage); + values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods")); + values.append(new ResourcePackPage(onesix.get())); + values.append(new TexturePackPage(onesix.get())); + values.append(new ShaderPackPage(onesix.get())); + values.append(new NotesPage(onesix.get())); + values.append(new WorldListPage(onesix.get(), onesix->worldList())); + values.append(new ServersPage(onesix)); + // values.append(new GameOptionsPage(onesix.get())); + values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots"))); + values.append(new InstanceSettingsPage(onesix.get())); auto logMatcher = inst->getLogFileMatcher(); if(logMatcher) { diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 32fc99cb..4fd2eade 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -56,7 +56,7 @@ void LaunchController::decideAccount() m_parentWidget, tr("No Accounts"), tr("In order to play Minecraft, you must have at least one Mojang or Minecraft " - "account logged in." + "account logged in. " "Would you like to open the account manager to add an account now?"), QMessageBox::Information, QMessageBox::Yes | QMessageBox::No @@ -228,6 +228,18 @@ void LaunchController::login() { emitFailed(errorString); return; } + case AccountState::Disabled: { + auto errorString = tr("The launcher's client identification has changed. Please remove this account and add it again."); + QMessageBox::warning( + m_parentWidget, + tr("Client identification changed"), + errorString, + QMessageBox::StandardButton::Ok, + QMessageBox::StandardButton::Ok + ); + emitFailed(errorString); + return; + } case AccountState::Gone: { auto errorString = tr("The account no longer exists on the servers. It may have been migrated, in which case please add the new account you migrated this one to."); QMessageBox::warning( diff --git a/launcher/ModDownloadTask.h b/launcher/ModDownloadTask.h index 7e4f1b7d..ddada5a2 100644 --- a/launcher/ModDownloadTask.h +++ b/launcher/ModDownloadTask.h @@ -10,6 +10,7 @@ class ModDownloadTask : public Task { Q_OBJECT public: explicit ModDownloadTask(const QUrl sourceUrl, const QString filename, const std::shared_ptr<ModFolderModel> mods); + const QString& getFilename() const { return filename; } public slots: bool abort() override; diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 7327f9d5..6db12c42 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -124,18 +124,7 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO m_settings->registerSetting("JoinServerOnLaunch", false); m_settings->registerSetting("JoinServerOnLaunchAddress", ""); - // DEPRECATED: Read what versions the user configuration thinks should be used - m_settings->registerSetting({"IntendedVersion", "MinecraftVersion"}, ""); - m_settings->registerSetting("LWJGLVersion", ""); - m_settings->registerSetting("ForgeVersion", ""); - m_settings->registerSetting("LiteloaderVersion", ""); - m_components.reset(new PackProfile(this)); - m_components->setOldConfigVersion("net.minecraft", m_settings->get("IntendedVersion").toString()); - auto setting = m_settings->getSetting("LWJGLVersion"); - m_components->setOldConfigVersion("org.lwjgl", m_settings->get("LWJGLVersion").toString()); - m_components->setOldConfigVersion("net.minecraftforge", m_settings->get("ForgeVersion").toString()); - m_components->setOldConfigVersion("com.mumfrey.liteloader", m_settings->get("LiteloaderVersion").toString()); } void MinecraftInstance::saveNow() diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index 59a8f133..d516e555 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -272,18 +272,6 @@ void PackProfile::save_internal() bool PackProfile::load() { auto filename = componentsFilePath(); - QFile componentsFile(filename); - - // migrate old config to new one, if needed - if(!componentsFile.exists()) - { - if(!migratePreComponentConfig()) - { - // FIXME: the user should be notified... - qCritical() << "Failed to convert old pre-component config for instance" << d->m_instance->name(); - return false; - } - } // load the new component list and swap it with the current one... ComponentContainer newComponents; @@ -369,239 +357,6 @@ void PackProfile::updateFailed(const QString& error) invalidateLaunchProfile(); } -// NOTE this is really old stuff, and only needs to be used when loading the old hardcoded component-unaware format (loadPreComponentConfig). -static void upgradeDeprecatedFiles(QString root, QString instanceName) -{ - auto versionJsonPath = FS::PathCombine(root, "version.json"); - auto customJsonPath = FS::PathCombine(root, "custom.json"); - auto mcJson = FS::PathCombine(root, "patches" , "net.minecraft.json"); - - QString sourceFile; - QString renameFile; - - // convert old crap. - if(QFile::exists(customJsonPath)) - { - sourceFile = customJsonPath; - renameFile = versionJsonPath; - } - else if(QFile::exists(versionJsonPath)) - { - sourceFile = versionJsonPath; - } - if(!sourceFile.isEmpty() && !QFile::exists(mcJson)) - { - if(!FS::ensureFilePathExists(mcJson)) - { - qWarning() << "Couldn't create patches folder for" << instanceName; - return; - } - if(!renameFile.isEmpty() && QFile::exists(renameFile)) - { - if(!QFile::rename(renameFile, renameFile + ".old")) - { - qWarning() << "Couldn't rename" << renameFile << "to" << renameFile + ".old" << "in" << instanceName; - return; - } - } - auto file = ProfileUtils::parseJsonFile(QFileInfo(sourceFile), false); - ProfileUtils::removeLwjglFromPatch(file); - file->uid = "net.minecraft"; - file->version = file->minecraftVersion; - file->name = "Minecraft"; - - Meta::Require needsLwjgl; - needsLwjgl.uid = "org.lwjgl"; - file->requires.insert(needsLwjgl); - - if(!ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJ |
