aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp56
-rw-r--r--launcher/CMakeLists.txt15
-rw-r--r--launcher/InstanceCreationTask.cpp11
-rw-r--r--launcher/InstanceCreationTask.h4
-rw-r--r--launcher/InstanceImportTask.cpp9
-rw-r--r--launcher/InstanceImportTask.h3
-rw-r--r--launcher/JavaCommon.cpp11
-rw-r--r--launcher/LaunchController.cpp11
-rwxr-xr-xlauncher/Launcher.in2
-rw-r--r--launcher/java/JavaChecker.cpp2
-rw-r--r--launcher/java/JavaInstallList.cpp2
-rw-r--r--launcher/launch/steps/CheckJava.cpp6
-rw-r--r--launcher/minecraft/Agent.h36
-rw-r--r--launcher/minecraft/ComponentUpdateTask.cpp2
-rw-r--r--launcher/minecraft/LaunchProfile.cpp33
-rw-r--r--launcher/minecraft/LaunchProfile.h14
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp15
-rw-r--r--launcher/minecraft/OneSixVersionFormat.cpp24
-rw-r--r--launcher/minecraft/PackProfile.cpp17
-rw-r--r--launcher/minecraft/PackProfile.h3
-rw-r--r--launcher/minecraft/VersionFile.cpp5
-rw-r--r--launcher/minecraft/VersionFile.h7
-rw-r--r--launcher/minecraft/auth/steps/XboxAuthorizationStep.cpp2
-rw-r--r--launcher/minecraft/mod/LocalModParseTask.cpp2
-rw-r--r--launcher/minecraft/update/LibrariesTask.cpp4
-rw-r--r--launcher/modplatform/ModAPI.h37
-rw-r--r--launcher/modplatform/flame/FlameAPI.h17
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp7
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h35
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp8
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp137
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.h47
-rw-r--r--launcher/modplatform/technic/SolderPackManifest.cpp58
-rw-r--r--launcher/modplatform/technic/SolderPackManifest.h49
-rw-r--r--launcher/resources/multimc/scalable/discord.svg117
-rw-r--r--launcher/tasks/SequentialTask.cpp50
-rw-r--r--launcher/tasks/SequentialTask.h28
-rw-r--r--launcher/tasks/Task.h68
-rw-r--r--launcher/tasks/Task_test.cpp68
-rw-r--r--launcher/ui/dialogs/AboutDialog.ui2
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.cpp6
-rw-r--r--launcher/ui/dialogs/ProgressDialog.cpp22
-rw-r--r--launcher/ui/dialogs/ProgressDialog.h5
-rw-r--r--launcher/ui/dialogs/ProgressDialog.ui45
-rw-r--r--launcher/ui/dialogs/UpdateDialog.ui2
-rw-r--r--launcher/ui/pages/global/MinecraftPage.ui8
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp1
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp44
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp32
-rw-r--r--launcher/ui/pages/instance/VersionPage.h1
-rw-r--r--launcher/ui/pages/instance/VersionPage.ui9
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp40
-rw-r--r--launcher/ui/pages/modplatform/ModModel.h7
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp65
-rw-r--r--launcher/ui/pages/modplatform/ModPage.h9
-rw-r--r--launcher/ui/pages/modplatform/ModPage.ui24
-rw-r--r--launcher/ui/pages/modplatform/VanillaPage.cpp90
-rw-r--r--launcher/ui/pages/modplatform/VanillaPage.h7
-rw-r--r--launcher/ui/pages/modplatform/VanillaPage.ui307
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.h2
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.h2
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicData.h46
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicModel.cpp130
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicModel.h44
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.cpp143
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.h11
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.ui132
-rw-r--r--launcher/ui/widgets/CustomCommands.ui2
-rw-r--r--launcher/ui/widgets/ModFilterWidget.cpp109
-rw-r--r--launcher/ui/widgets/ModFilterWidget.h69
-rw-r--r--launcher/ui/widgets/ModFilterWidget.ui54
-rw-r--r--launcher/ui/widgets/VersionSelectWidget.cpp6
-rw-r--r--launcher/ui/widgets/VersionSelectWidget.h2
73 files changed, 1863 insertions, 637 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 01b62971..8bd434f0 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -317,6 +317,26 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QString origcwdPath = QDir::currentPath();
QString binPath = applicationDirPath();
+
+ {
+ // Root path is used for updates and portable data
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+ QDir foo(FS::PathCombine(binPath, "..")); // typically portable-root or /usr
+ m_rootPath = foo.absolutePath();
+#elif defined(Q_OS_WIN32)
+ m_rootPath = binPath;
+#elif defined(Q_OS_MAC)
+ 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 LAUNCHER_JARS_LOCATION
+ m_jarsPath = TOSTRING(LAUNCHER_JARS_LOCATION);
+#endif
+ }
+
QString adjustedBy;
QString dataPath;
// change folder
@@ -325,15 +345,14 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
{
// the dir param. it makes multimc data path point to whatever the user specified
// on command line
- adjustedBy += "Command line " + dirParam;
+ adjustedBy = "Command line";
dataPath = dirParam;
}
else
{
-#if !defined(LAUNCHER_PORTABLE) || defined(Q_OS_MAC)
QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), ".."));
dataPath = foo.absolutePath();
- adjustedBy += dataPath;
+ adjustedBy = "Persistent data path";
#ifdef Q_OS_LINUX
// TODO: this should be removed in a future version
@@ -341,12 +360,15 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
QDir bar(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation), "polymc"));
if (bar.exists()) {
dataPath = bar.absolutePath();
- adjustedBy += "Legacy data path " + dataPath;
+ adjustedBy = "Legacy data path";
}
#endif
-#else
- dataPath = applicationDirPath();
- adjustedBy += "Fallback to binary path " + dataPath;
+
+#ifndef Q_OS_MACOS
+ if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
+ dataPath = m_rootPath;
+ adjustedBy = "Portable data path";
+ }
#endif
}
@@ -536,24 +558,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
qDebug() << "<> Log initialized.";
}
- // Set up paths
{
- // Root path is used for updates.
-#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- QDir foo(FS::PathCombine(binPath, ".."));
- m_rootPath = foo.absolutePath();
-#elif defined(Q_OS_WIN32)
- m_rootPath = binPath;
-#elif defined(Q_OS_MAC)
- 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 LAUNCHER_JARS_LOCATION
- m_jarsPath = TOSTRING(LAUNCHER_JARS_LOCATION);
-#endif
qDebug() << BuildConfig.LAUNCHER_DISPLAYNAME << ", (c) 2013-2021 " << BuildConfig.LAUNCHER_COPYRIGHT;
qDebug() << "Version : " << BuildConfig.printableVersionString();
@@ -699,6 +704,9 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Minecraft launch method
m_settings->registerSetting("MCLaunchMethod", "LauncherPart");
+ // Minecraft offline player name
+ m_settings->registerSetting("LastOfflinePlayerName", "");
+
// Wrapper command for launch
m_settings->registerSetting("WrapperCommand", "");
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 692aebe5..6ed86726 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -348,7 +348,7 @@ set(MINECRAFT_SOURCES
mojang/PackageManifest.h
mojang/PackageManifest.cpp
- )
+ minecraft/Agent.h)
add_unit_test(GradleSpecifier
SOURCES minecraft/GradleSpecifier_test.cpp
@@ -413,6 +413,11 @@ set(TASKS_SOURCES
tasks/SequentialTask.cpp
)
+add_unit_test(Task
+ SOURCES tasks/Task_test.cpp
+ LIBS Launcher_logic
+ )
+
set(SETTINGS_SOURCES
# Settings
settings/INIFile.cpp
@@ -539,6 +544,8 @@ set(TECHNIC_SOURCES
modplatform/technic/SingleZipPackInstallTask.cpp
modplatform/technic/SolderPackInstallTask.h
modplatform/technic/SolderPackInstallTask.cpp
+ modplatform/technic/SolderPackManifest.h
+ modplatform/technic/SolderPackManifest.cpp
modplatform/technic/TechnicPackProcessor.h
modplatform/technic/TechnicPackProcessor.cpp
)
@@ -818,7 +825,6 @@ SET(LAUNCHER_SOURCES
ui/dialogs/ModDownloadDialog.cpp
ui/dialogs/ModDownloadDialog.h
-
# GUI - widgets
ui/widgets/Common.cpp
ui/widgets/Common.h
@@ -842,6 +848,8 @@ SET(LAUNCHER_SOURCES
ui/widgets/LogView.h
ui/widgets/MCModInfoFrame.cpp
ui/widgets/MCModInfoFrame.h
+ ui/widgets/ModFilterWidget.cpp
+ ui/widgets/ModFilterWidget.h
ui/widgets/ModListView.cpp
ui/widgets/ModListView.h
ui/widgets/PageContainer.cpp
@@ -900,6 +908,7 @@ qt5_wrap_ui(LAUNCHER_UI
ui/widgets/InstanceCardWidget.ui
ui/widgets/CustomCommands.ui
ui/widgets/MCModInfoFrame.ui
+ ui/widgets/ModFilterWidget.ui
ui/dialogs/CopyInstanceDialog.ui
ui/dialogs/ProfileSetupDialog.ui
ui/dialogs/ProgressDialog.ui
@@ -982,7 +991,7 @@ if(DEFINED Launcher_APP_BINARY_DEFS)
endif()
install(TARGETS ${Launcher_Name}
- BUNDLE DESTINATION ${BUNDLE_DEST_DIR} COMPONENT Runtime
+ BUNDLE DESTINATION "." COMPONENT Runtime
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime
)
diff --git a/launcher/InstanceCreationTask.cpp b/launcher/InstanceCreationTask.cpp
index 4c37bd7f..24bc5f46 100644
--- a/launcher/InstanceCreationTask.cpp
+++ b/launcher/InstanceCreationTask.cpp
@@ -9,6 +9,15 @@
InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version)
{
m_version = version;
+ m_usingLoader = false;
+}
+
+InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version, QString loader, BaseVersionPtr loaderVersion)
+{
+ m_version = version;
+ m_usingLoader = true;
+ m_loader = loader;
+ m_loaderVersion = loaderVersion;
}
void InstanceCreationTask::executeTask()
@@ -21,6 +30,8 @@ void InstanceCreationTask::executeTask()
auto components = inst.getPackProfile();
components->buildingFromScratch();
components->setComponentVersion("net.minecraft", m_version->descriptor(), true);
+ if(m_usingLoader)
+ components->setComponentVersion(m_loader, m_loaderVersion->descriptor(), true);
inst.setName(m_instName);
inst.setIconKey(m_instIcon);
instanceSettings->resumeSave();
diff --git a/launcher/InstanceCreationTask.h b/launcher/InstanceCreationTask.h
index 54997116..23367c3f 100644
--- a/launcher/InstanceCreationTask.h
+++ b/launcher/InstanceCreationTask.h
@@ -12,6 +12,7 @@ class InstanceCreationTask : public InstanceTask
Q_OBJECT
public:
explicit InstanceCreationTask(BaseVersionPtr version);
+ explicit InstanceCreationTask(BaseVersionPtr version, QString loader, BaseVersionPtr loaderVersion);
protected:
//! Entry point for tasks.
@@ -19,4 +20,7 @@ protected:
private: /* data */
BaseVersionPtr m_version;
+ bool m_usingLoader;
+ QString m_loader;
+ BaseVersionPtr m_loaderVersion;
};
diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp
index a825e8d4..1a13c997 100644
--- a/launcher/InstanceImportTask.cpp
+++ b/launcher/InstanceImportTask.cpp
@@ -40,6 +40,14 @@ InstanceImportTask::InstanceImportTask(const QUrl sourceUrl)
m_sourceUrl = sourceUrl;
}
+bool InstanceImportTask::abort()
+{
+ m_filesNetJob->abort();
+ m_extractFuture.cancel();
+
+ return false;
+}
+
void InstanceImportTask::executeTask()
{
if (m_sourceUrl.isLocalFile())
@@ -241,6 +249,7 @@ void InstanceImportTask::processFlame()
QString forgeVersion;
QString fabricVersion;
+ // TODO: is Quilt relevant here?
for(auto &loader: pack.minecraft.modLoaders)
{
auto id = loader.id;
diff --git a/launcher/InstanceImportTask.h b/launcher/InstanceImportTask.h
index a1990647..365c3dc4 100644
--- a/launcher/InstanceImportTask.h
+++ b/launcher/InstanceImportTask.h
@@ -37,6 +37,9 @@ class InstanceImportTask : public InstanceTask
public:
explicit InstanceImportTask(const QUrl sourceUrl);
+ bool canAbort() const override { return true; }
+ bool abort() override;
+
protected:
//! Entry point for tasks.
virtual void executeTask() override;
diff --git a/launcher/JavaCommon.cpp b/launcher/JavaCommon.cpp
index a6542fa7..17278d86 100644
--- a/launcher/JavaCommon.cpp
+++ b/launcher/JavaCommon.cpp
@@ -17,6 +17,17 @@ bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent)
QMessageBox::Warning)->exec();
return false;
}
+ // block lunacy with passing required version to the JVM
+ if (jvmargs.contains(QRegExp("-version:.*"))) {
+ auto warnStr = QObject::tr(
+ "You tried to pass required Java version argument to the JVM (using \"-version:xxx\"). This is not safe and will not be allowed.\n"
+ "This message will be displayed until you remove this from the JVM arguments.");
+ CustomMessageBox::selectable(
+ parent, QObject::tr("JVM arguments warning"),
+ warnStr,
+ QMessageBox::Warning)->exec();
+ return false;
+ }
return true;
}
diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp
index 792d8381..4cb62e69 100644
--- a/launcher/LaunchController.cpp
+++ b/launcher/LaunchController.cpp
@@ -71,7 +71,10 @@ void LaunchController::executeTask()
return;
}
- JavaCommon::checkJVMArgs(m_instance->settings()->get("JvmArgs").toString(), m_parentWidget);
+ if(!JavaCommon::checkJVMArgs(m_instance->settings()->get("JvmArgs").toString(), m_parentWidget)) {
+ emitFailed(tr("Invalid Java arguments specified. Please fix this first."));
+ return;
+ }
login();
}
@@ -166,13 +169,14 @@ void LaunchController::login() {
if(!m_session->wants_online) {
// we ask the user for a player name
bool ok = false;
- QString usedname = m_session->player_name;
+ QString lastOfflinePlayerName = APPLICATION->settings()->get("LastOfflinePlayerName").toString();
+ QString usedname = lastOfflinePlayerName.isEmpty() ? m_session->player_name : lastOfflinePlayerName;
QString name = QInputDialog::getText(
m_parentWidget,
tr("Player name"),
tr("Choose your offline mode player name."),
QLineEdit::Normal,
- m_session->player_name,
+ usedname,
&ok
);
if (!ok)
@@ -183,6 +187,7 @@ void LaunchController::login() {
if (name.length())
{
usedname = name;
+ APPLICATION->settings()->set("LastOfflinePlayerName", usedname);
}
m_session->MakeOffline(usedname);
// offline flavored game from here :3
diff --git a/launcher/Launcher.in b/launcher/Launcher.in
index 5e5e2c2b..528e360e 100755
--- a/launcher/Launcher.in
+++ b/launcher/Launcher.in
@@ -21,7 +21,7 @@ echo "Launcher Dir: ${LAUNCHER_DIR}"
# Set up env - filter out input LD_ variables but pass them in under different names
export GAME_LIBRARY_PATH=${GAME_LIBRARY_PATH-${LD_LIBRARY_PATH}}
export GAME_PRELOAD=${GAME_PRELOAD-${LD_PRELOAD}}
-export LD_LIBRARY_PATH="${LAUNCHER_DIR}/bin":$LAUNCHER_LIBRARY_PATH
+export LD_LIBRARY_PATH="${LAUNCHER_DIR}/lib@LIB_SUFFIX@":$LAUNCHER_LIBRARY_PATH
export LD_PRELOAD=$LAUNCHER_PRELOAD
export QT_PLUGIN_PATH="${LAUNCHER_DIR}/plugins"
export QT_FONTPATH="${LAUNCHER_DIR}/fonts"
diff --git a/launcher/java/JavaChecker.cpp b/launcher/java/JavaChecker.cpp
index 35ddc35c..946599c5 100644
--- a/launcher/java/JavaChecker.cpp
+++ b/launcher/java/JavaChecker.cpp
@@ -129,7 +129,7 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status)
auto os_arch = results["os.arch"];
auto java_version = results["java.version"];
auto java_vendor = results["java.vendor"];
- bool is_64 = os_arch == "x86_64" || os_arch == "amd64";
+ bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64";
result.validity = JavaCheckResult::Validity::Valid;
diff --git a/launcher/java/JavaInstallList.cpp b/launcher/java/JavaInstallList.cpp
index a0a60871..9b745095 100644
--- a/launcher/java/JavaInstallList.cpp
+++ b/launcher/java/JavaInstallList.cpp
@@ -183,7 +183,7 @@ void JavaListLoadTask::javaCheckerFinished()
JavaInstallPtr javaVersion(new JavaInstall());