aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/winget.yml3
-rw-r--r--.gitmodules5
-rw-r--r--CMakeLists.txt12
-rw-r--r--COPYING.md30
-rw-r--r--flake.lock19
-rw-r--r--flake.nix7
-rw-r--r--launcher/Application.cpp110
-rw-r--r--launcher/BaseInstance.cpp46
-rw-r--r--launcher/BaseInstance.h13
-rw-r--r--launcher/CMakeLists.txt10
-rw-r--r--launcher/Commandline.cpp408
-rw-r--r--launcher/Commandline.h213
-rw-r--r--launcher/InstanceCopyTask.cpp2
-rw-r--r--launcher/InstanceCreationTask.cpp78
-rw-r--r--launcher/InstanceCreationTask.h58
-rw-r--r--launcher/InstanceImportTask.cpp571
-rw-r--r--launcher/InstanceImportTask.h2
-rw-r--r--launcher/InstanceList.cpp103
-rw-r--r--launcher/InstanceList.h11
-rw-r--r--launcher/InstanceTask.cpp47
-rw-r--r--launcher/InstanceTask.h89
-rw-r--r--launcher/minecraft/VanillaInstanceCreationTask.cpp34
-rw-r--r--launcher/minecraft/VanillaInstanceCreationTask.h22
-rw-r--r--launcher/minecraft/mod/tasks/LocalModParseTask.cpp263
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.cpp20
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.h1
-rw-r--r--launcher/modplatform/flame/FlameAPI.cpp23
-rw-r--r--launcher/modplatform/flame/FlameAPI.h1
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.cpp457
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.h44
-rw-r--r--launcher/modplatform/flame/PackManifest.cpp28
-rw-r--r--launcher/modplatform/flame/PackManifest.h10
-rw-r--r--launcher/modplatform/helpers/OverrideUtils.cpp59
-rw-r--r--launcher/modplatform/helpers/OverrideUtils.h20
-rw-r--r--launcher/modplatform/legacy_ftb/PackFetchTask.cpp14
-rw-r--r--launcher/modplatform/legacy_ftb/PackFetchTask.h2
-rw-r--r--launcher/modplatform/legacy_ftb/PackInstallTask.cpp8
-rw-r--r--launcher/modplatform/legacy_ftb/PackInstallTask.h1
-rw-r--r--launcher/modplatform/modpacksch/FTBPackInstallTask.cpp5
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp407
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.h44
-rw-r--r--launcher/modplatform/packwiz/Packwiz.cpp156
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.cpp2
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp10
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.h1
-rw-r--r--launcher/tasks/Task.h12
-rw-r--r--launcher/translations/TranslationsModel.cpp6
-rw-r--r--launcher/ui/MainWindow.cpp4
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.cpp28
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.h6
-rw-r--r--launcher/ui/dialogs/ProgressDialog.cpp6
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp1
-rw-r--r--launcher/ui/pages/modplatform/VanillaPage.cpp10
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.cpp10
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.cpp4
-rw-r--r--launcher/ui/themes/BrightTheme.cpp2
-rw-r--r--launcher/ui/themes/DarkTheme.cpp2
-rw-r--r--launcher/ui/widgets/InfoFrame.cpp63
-rw-r--r--libraries/README.md16
-rw-r--r--libraries/tomlc99/CMakeLists.txt10
-rw-r--r--libraries/tomlc99/LICENSE22
-rw-r--r--libraries/tomlc99/README.md197
-rw-r--r--libraries/tomlc99/include/toml.h175
-rw-r--r--libraries/tomlc99/src/toml.c2300
m---------libraries/tomlplusplus0
-rw-r--r--nix/default.nix6
70 files changed, 1929 insertions, 4427 deletions
diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml
index 98981e80..d3f787b6 100644
--- a/.github/workflows/winget.yml
+++ b/.github/workflows/winget.yml
@@ -7,8 +7,9 @@ jobs:
publish:
runs-on: windows-latest
steps:
- - uses: vedantmgoyal2009/winget-releaser@latest
+ - uses: vedantmgoyal2009/winget-releaser@v1
with:
identifier: PolyMC.PolyMC
+ version: ${{ github.event.release.tag_name }}
installers-regex: 'PolyMC-Windows-Setup-.+\.exe$'
token: ${{ secrets.WINGET_TOKEN }}
diff --git a/.gitmodules b/.gitmodules
index 08b94c96..534ffd37 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,9 @@
[submodule "depends/libnbtplusplus"]
path = libraries/libnbtplusplus
url = https://github.com/PolyMC/libnbtplusplus.git
- pushurl = git@github.com:PolyMC/libnbtplusplus.git
-
[submodule "libraries/quazip"]
path = libraries/quazip
url = https://github.com/stachenov/quazip.git
+[submodule "libraries/tomlplusplus"]
+ path = libraries/tomlplusplus
+ url = https://github.com/marzer/tomlplusplus.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7100ab1b..46192414 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,6 +192,11 @@ if (Qt5_POSITION_INDEPENDENT_CODE)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
+# Find toml++
+if(NOT Launcher_FORCE_BUNDLED_LIBS)
+ find_package(tomlplusplus 3.2.0 QUIET)
+endif()
+
####################################### Program Info #######################################
set(Launcher_APP_BINARY_NAME "polymc" CACHE STRING "Name of the Launcher binary")
@@ -312,7 +317,12 @@ endif()
add_subdirectory(libraries/rainbow) # Qt extension for colors
add_subdirectory(libraries/LocalPeer) # fork of a library from Qt solutions
add_subdirectory(libraries/classparser) # class parser library
-add_subdirectory(libraries/tomlc99) # toml parser
+if(NOT tomlplusplus_FOUND)
+ message(STATUS "Using bundled tomlplusplus")
+ add_subdirectory(libraries/tomlplusplus) # toml parser
+else()
+ message(STATUS "Using system tomlplusplus")
+endif()
add_subdirectory(libraries/katabasis) # An OAuth2 library that tried to do too much
add_subdirectory(libraries/gamemode)
add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API
diff --git a/COPYING.md b/COPYING.md
index c94c51c3..11c1fc3a 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -315,30 +315,24 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-## tomlc99
+## tomlplusplus
MIT License
- Copyright (c) 2017 CK Tan
- https://github.com/cktan/tomlc99
+ Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+ Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## O2 (Katabasis fork)
diff --git a/flake.lock b/flake.lock
index bfc9ac6d..a72286bb 100644
--- a/flake.lock
+++ b/flake.lock
@@ -52,7 +52,24 @@
"inputs": {
"flake-compat": "flake-compat",
"libnbtplusplus": "libnbtplusplus",
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "tomlplusplus": "tomlplusplus"
+ }
+ },
+ "tomlplusplus": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1664034574,
+ "narHash": "sha256-EFMAl6tsTvkgK0DWC/pZfOIq06b2e5SnxJa1ngGRIQA=",
+ "owner": "marzer",
+ "repo": "tomlplusplus",
+ "rev": "8aa5c8b2a4ff2c440d4630addf64fa4f62146170",
+ "type": "github"
+ },
+ "original": {
+ "owner": "marzer",
+ "repo": "tomlplusplus",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 51bc1fda..93192725 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,9 +5,10 @@
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
libnbtplusplus = { url = "github:PolyMC/libnbtplusplus"; flake = false; };
+ tomlplusplus = { url = "github:marzer/tomlplusplus"; flake = false; };
};
- outputs = { self, nixpkgs, libnbtplusplus, ... }:
+ outputs = { self, nixpkgs, libnbtplusplus, tomlplusplus, ... }:
let
# User-friendly version number.
version = builtins.substring 0 8 self.lastModifiedDate;
@@ -22,8 +23,8 @@
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
packagesFn = pkgs: rec {
- polymc = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; };
- polymc-qt6 = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus; };
+ polymc = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; };
+ polymc-qt6 = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; };
};
in
{
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 0d1db11c..e08ea7f4 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -78,6 +78,7 @@
#include <iostream>
#include <QAccessible>
+#include <QCommandLineParser>
#include <QDir>
#include <QFileInfo>
#include <QNetworkAccessManager>
@@ -110,7 +111,6 @@
#include "translations/TranslationsModel.h"
#include "meta/Index.h"
-#include <Commandline.h>
#include <FileSystem.h>
#include <DesktopServices.h>
#include <LocalPeer.h>
@@ -136,12 +136,6 @@
static const QLatin1String liveCheckFile("live.check");
-using namespace Commandline;
-
-#define MACOS_HINT "If you are on macOS Sierra, you might have to move the app to your /Applications or ~/Applications folder. "\
- "This usually fixes the problem and you can move the application elsewhere afterwards.\n"\
- "\n"
-
namespace {
void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
@@ -242,80 +236,27 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
this->setQuitOnLastWindowClosed(false);
// Commandline parsing
- QHash<QString, QVariant> args;
- {
- Parser parser(FlagStyle::GNU, ArgumentStyle::SpaceAndEquals);
-
- // --help
- parser.addSwitch("help");
- parser.addShortOpt("help", 'h');
- parser.addDocumentation("help", "Display this help and exit.");
- // --version
- parser.addSwitch("version");
- parser.addShortOpt("version", 'V');
- parser.addDocumentation("version", "Display program version and exit.");
- // --dir
- parser.addOption("dir");
- parser.addShortOpt("dir", 'd');
- parser.addDocumentation("dir", "Use the supplied folder as application root instead of the binary location (use '.' for current)");
- // --launch
- parser.addOption("launch");
- parser.addShortOpt("launch", 'l');
- parser.addDocumentation("launch", "Launch the specified instance (by instance ID)");
- // --server
- parser.addOption("server");
- parser.addShortOpt("server", 's');
- parser.addDocumentation("server", "Join the specified server on launch (only valid in combination with --launch)");
- // --profile
- parser.addOption("profile");
- parser.addShortOpt("profile", 'a');
- parser.addDocumentation("profile", "Use the account specified by its profile name (only valid in combination with --launch)");
- // --alive
- parser.addSwitch("alive");
- parser.addDocumentation("alive", "Write a small '" + liveCheckFile + "' file after the launcher starts");
- // --import
- parser.addOption("import");
- parser.addShortOpt("import", 'I');
- parser.addDocumentation("import", "Import instance from specified zip (local path or URL)");
-
- // parse the arguments
- try
- {
- args = parser.parse(arguments());
- }
- catch (const ParsingError &e)
- {
- std::cerr << "CommandLineError: " << e.what() << std::endl;
- if(argc > 0)
- std::cerr << "Try '" << argv[0] << " -h' to get help on command line parameters."
- << std::endl;
- m_status = Application::Failed;
- return;
- }
-
- // display help and exit
- if (args["help"].toBool())
- {
- std::cout << qPrintable(parser.compileHelp(arguments()[0]));
- m_status = Application::Succeeded;
- return;
- }
+ QCommandLineParser parser;
+ parser.setApplicationDescription(BuildConfig.LAUNCHER_NAME);
+
+ parser.addOptions({
+ {{"d", "dir"}, "Use a custom path as application root (use '.' for current directory)", "directory"},
+ {{"l", "launch"}, "Launch the specified instance (by instance ID)", "instance"},
+ {{"s", "server"}, "Join the specified server on launch (only valid in combination with --launch)", "address"},
+ {{"a", "profile"}, "Use the account specified by its profile name (only valid in combination with --launch)", "profile"},
+ {"alive", "Write a small '" + liveCheckFile + "' file after the launcher starts"},
+ {{"I", "import"}, "Import instance from specified zip (local path or URL)", "file"}
+ });
+ parser.addHelpOption();
+ parser.addVersionOption();
- // display version and exit
- if (args["version"].toBool())
- {
- std::cout << "Version " << BuildConfig.printableVersionString().toStdString() << std::endl;
- std::cout << "Git " << BuildConfig.GIT_COMMIT.toStdString() << std::endl;
- m_status = Application::Succeeded;
- return;
- }
- }
+ parser.process(arguments());
- m_instanceIdToLaunch = args["launch"].toString();
- m_serverToJoin = args["server"].toString();
- m_profileToUse = args["profile"].toString();
- m_liveCheck = args["alive"].toBool();
- m_zipToImport = args["import"].toUrl();
+ m_instanceIdToLaunch = parser.value("launch");
+ m_serverToJoin = parser.value("server");
+ m_profileToUse = parser.value("profile");
+ m_liveCheck = parser.isSet("alive");
+ m_zipToImport = parser.value("import");
// error if --launch is missing with --server or --profile
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
@@ -346,7 +287,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QString adjustedBy;
QString dataPath;
// change folder
- QString dirParam = args["dir"].toString();
+ QString dirParam = parser.value("dir");
if (!dirParam.isEmpty())
{
// the dir param. it makes multimc data path point to whatever the user specified
@@ -385,9 +326,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QString(
"The launcher data folder could not be created.\n"
"\n"
-#if defined(Q_OS_MAC)
- MACOS_HINT
-#endif
"Make sure you have the right permissions to the launcher data folder and any folder needed to access it.\n"
"(%1)\n"
"\n"
@@ -403,9 +341,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QString(
"The launcher data folder could not be opened.\n"
"\n"
-#if defined(Q_OS_MAC)
- MACOS_HINT
-#endif
"Make sure you have the right permissions to the launcher data folder.\n"
"(%1)\n"
"\n"
@@ -486,9 +421,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QString(
"The launcher couldn't create a log file - the data folder is not writable.\n"
"\n"
- #if defined(Q_OS_MAC)
- MACOS_HINT
- #endif
"Make sure you have write permissions to the data folder.\n"
"(%1)\n"
"\n"
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index e6d4d8e3..2995df6f 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -114,44 +114,54 @@ QString BaseInstance::getPostExitCommand()
return settings()->get("PostExitCommand").toString();
}
-bool BaseInstance::isManagedPack()
+bool BaseInstance::isManagedPack() const
{
- return settings()->get("ManagedPack").toBool();
+ return m_settings->get("ManagedPack").toBool();
}
-QString BaseInstance::getManagedPackType()
+QString BaseInstance::getManagedPackType() const
{
- return settings()->get("ManagedPackType").toString();
+ return m_settings->get("ManagedPackType").toString();
}
-QString BaseInstance::getManagedPackID()
+QString BaseInstance::getManagedPackID() const
{
- return settings()->get("ManagedPackID").toString();
+ return m_settings->get("ManagedPackID").toString();
}
-QString BaseInstance::getManagedPackName()
+QString BaseInstance::getManagedPackName() const
{
- return settings()->get("ManagedPackName").toString();
+ return m_settings->get("ManagedPackName").toString();
}
-QString BaseInstance::getManagedPackVersionID()
+QString BaseInstance::getManagedPackVersionID() const
{
- return settings()->get("ManagedPackVersionID").toString();
+ return m_settings->get("ManagedPackVersionID").toString();
}
-QString BaseInstance::getManagedPackVersionName()
+QString BaseInstance::getManagedPackVersionName() const
{
- return settings()->get("ManagedPackVersionName").toString();
+ return m_settings->get("ManagedPackVersionName").toString();
}
void BaseInstance::setManagedPack(const QString& type, const QString& id, const QString& name, const QString& versionId, const QString&