From a739db8bdb9a17b5f4da708b65c72715e413c90e Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 31 Dec 2024 13:44:22 +0200 Subject: [PATCH 01/83] propagate load component error Signed-off-by: Trial97 (cherry picked from commit 6ebfcb91cf954048061ff39719629e7f581f1997) --- launcher/minecraft/MinecraftLoadAndCheck.cpp | 5 +- launcher/minecraft/PackProfile.cpp | 88 +++++++++++--------- launcher/minecraft/PackProfile.h | 17 +++- launcher/ui/pages/instance/VersionPage.cpp | 7 +- 4 files changed, 71 insertions(+), 46 deletions(-) diff --git a/launcher/minecraft/MinecraftLoadAndCheck.cpp b/launcher/minecraft/MinecraftLoadAndCheck.cpp index b9fb7eb0c..c0a82e61e 100644 --- a/launcher/minecraft/MinecraftLoadAndCheck.cpp +++ b/launcher/minecraft/MinecraftLoadAndCheck.cpp @@ -8,7 +8,10 @@ void MinecraftLoadAndCheck::executeTask() { // add offline metadata load task auto components = m_inst->getPackProfile(); - components->reload(m_netmode); + if (auto result = components->reload(m_netmode); !result) { + emitFailed(result.error); + return; + } m_task = components->getCurrentTask(); if (!m_task) { diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index f1d2473c2..92242d452 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -173,29 +173,32 @@ static bool savePackProfile(const QString& filename, const ComponentContainer& c } // Read the given file into component containers -static bool loadPackProfile(PackProfile* parent, - const QString& filename, - const QString& componentJsonPattern, - ComponentContainer& container) +static PackProfile::Result loadPackProfile(PackProfile* parent, + const QString& filename, + const QString& componentJsonPattern, + ComponentContainer& container) { QFile componentsFile(filename); if (!componentsFile.exists()) { - qCWarning(instanceProfileC) << "Components file" << filename << "doesn't exist. This should never happen."; - return false; + auto message = QObject::tr("Components file %1 doesn't exist. This should never happen.").arg(filename); + qCWarning(instanceProfileC) << message; + return PackProfile::Result::Error(message); } if (!componentsFile.open(QFile::ReadOnly)) { - qCCritical(instanceProfileC) << "Couldn't open" << componentsFile.fileName() << " for reading:" << componentsFile.errorString(); + auto message = QObject::tr("Couldn't open %1 for reading: %2").arg(componentsFile.fileName(), componentsFile.errorString()); + qCCritical(instanceProfileC) << message; qCWarning(instanceProfileC) << "Ignoring overridden order"; - return false; + return PackProfile::Result::Error(message); } // and it's valid JSON QJsonParseError error; QJsonDocument doc = QJsonDocument::fromJson(componentsFile.readAll(), &error); if (error.error != QJsonParseError::NoError) { - qCCritical(instanceProfileC) << "Couldn't parse" << componentsFile.fileName() << ":" << error.errorString(); + auto message = QObject::tr("Couldn't parse %1 as json: %2").arg(componentsFile.fileName(), error.errorString()); + qCCritical(instanceProfileC) << message; qCWarning(instanceProfileC) << "Ignoring overridden order"; - return false; + return PackProfile::Result::Error(message); } // and then read it and process it if all above is true. @@ -212,11 +215,13 @@ static bool loadPackProfile(PackProfile* parent, container.append(componentFromJsonV1(parent, componentJsonPattern, comp_obj)); } } catch ([[maybe_unused]] const JSONValidationError& err) { - qCCritical(instanceProfileC) << "Couldn't parse" << componentsFile.fileName() << ": bad file format"; + auto message = QObject::tr("Couldn't parse %1 : bad file format").arg(componentsFile.fileName()); + qCCritical(instanceProfileC) << message; + qCWarning(instanceProfileC) << "error:" << err.what(); container.clear(); - return false; + return PackProfile::Result::Error(message); } - return true; + return PackProfile::Result::Success(); } // END: component file format @@ -283,44 +288,43 @@ void PackProfile::save_internal() d->dirty = false; } -bool PackProfile::load() +PackProfile::Result PackProfile::load() { auto filename = componentsFilePath(); // load the new component list and swap it with the current one... ComponentContainer newComponents; - if (!loadPackProfile(this, filename, patchesPattern(), newComponents)) { + if (auto result = loadPackProfile(this, filename, patchesPattern(), newComponents); !result) { qCritical() << d->m_instance->name() << "|" << "Failed to load the component config"; - return false; - } else { - // FIXME: actually use fine-grained updates, not this... - beginResetModel(); - // disconnect all the old components - for (auto component : d->components) { - disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); - } - d->components.clear(); - d->componentIndex.clear(); - for (auto component : newComponents) { - if (d->componentIndex.contains(component->m_uid)) { - qWarning() << d->m_instance->name() << "|" << "Ignoring duplicate component entry" << component->m_uid; - continue; - } - connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); - d->components.append(component); - d->componentIndex[component->m_uid] = component; - } - endResetModel(); - d->loaded = true; - return true; + return result; } + // FIXME: actually use fine-grained updates, not this... + beginResetModel(); + // disconnect all the old components + for (auto component : d->components) { + disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); + } + d->components.clear(); + d->componentIndex.clear(); + for (auto component : newComponents) { + if (d->componentIndex.contains(component->m_uid)) { + qWarning() << d->m_instance->name() << "|" << "Ignoring duplicate component entry" << component->m_uid; + continue; + } + connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); + d->components.append(component); + d->componentIndex[component->m_uid] = component; + } + endResetModel(); + d->loaded = true; + return Result::Success(); } -void PackProfile::reload(Net::Mode netmode) +PackProfile::Result PackProfile::reload(Net::Mode netmode) { // Do not reload when the update/resolve task is running. It is in control. if (d->m_updateTask) { - return; + return Result::Success(); } // flush any scheduled saves to not lose state @@ -329,9 +333,11 @@ void PackProfile::reload(Net::Mode netmode) // FIXME: differentiate when a reapply is required by propagating state from components invalidateLaunchProfile(); - if (load()) { - resolve(netmode); + if (auto result = load(); !result) { + return result; } + resolve(netmode); + return Result::Success(); } Task::Ptr PackProfile::getCurrentTask() diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h index b2de26ea0..d812dfa48 100644 --- a/launcher/minecraft/PackProfile.h +++ b/launcher/minecraft/PackProfile.h @@ -62,6 +62,19 @@ class PackProfile : public QAbstractListModel { public: enum Columns { NameColumn = 0, VersionColumn, NUM_COLUMNS }; + struct Result { + bool success; + QString error; + + // Implicit conversion to bool + operator bool() const { return success; } + + // Factory methods for convenience + static Result Success() { return { true, "" }; } + + static Result Error(const QString& errorMessage) { return { false, errorMessage }; } + }; + explicit PackProfile(MinecraftInstance* instance); virtual ~PackProfile(); @@ -102,7 +115,7 @@ class PackProfile : public QAbstractListModel { bool revertToBase(int index); /// reload the list, reload all components, resolve dependencies - void reload(Net::Mode netmode); + Result reload(Net::Mode netmode); // reload all components, resolve dependencies void resolve(Net::Mode netmode); @@ -169,7 +182,7 @@ class PackProfile : public QAbstractListModel { void disableInteraction(bool disable); private: - bool load(); + Result load(); bool installJarMods_internal(QStringList filepaths); bool installCustomJar_internal(QString filepath); bool installAgents_internal(QStringList filepaths); diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp index ab1c48ed4..975c44de2 100644 --- a/launcher/ui/pages/instance/VersionPage.cpp +++ b/launcher/ui/pages/instance/VersionPage.cpp @@ -252,8 +252,11 @@ void VersionPage::updateButtons(int row) bool VersionPage::reloadPackProfile() { try { - m_profile->reload(Net::Mode::Online); - return true; + auto result = m_profile->reload(Net::Mode::Online); + if (!result) { + QMessageBox::critical(this, tr("Error"), result.error); + } + return result; } catch (const Exception& e) { QMessageBox::critical(this, tr("Error"), e.cause()); return false; From 62ed3f8406a039f48da2d8a4d486fd7c366e3026 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 13 Jan 2025 08:16:12 +0200 Subject: [PATCH 02/83] fix modrinth link Signed-off-by: Trial97 (cherry picked from commit 3ee73916ca31666abc48f45e8b0bfcf8d678e6cf) --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 9c713aa79..05c256bb2 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -207,7 +207,7 @@ - <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/#section/Authentication">documentation</a> for more information.</p></body></html> + <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api/#authentication">documentation</a> for more information.</p></body></html> true From 759db0c90f84e55c48415098d0ddfc11cd4cf234 Mon Sep 17 00:00:00 2001 From: sshcrack <34072808+sshcrack@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:17:04 +0100 Subject: [PATCH 03/83] change order of steps Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com> (cherry picked from commit dedb7a2343f7d433492dee5930802ed47294b722) Signed-off-by: seth --- launcher/minecraft/MinecraftInstance.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index d6d45af6b..80ec34d29 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1083,6 +1083,12 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } + // check java + { + process->appendStep(makeShared(pptr)); + process->appendStep(makeShared(pptr)); + } + // run pre-launch command if that's needed if (getPreLaunchCommand().size()) { auto step = makeShared(pptr); @@ -1096,12 +1102,6 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(makeShared(pptr, makeShared(this, mode))); } - // check java - { - process->appendStep(makeShared(pptr)); - process->appendStep(makeShared(pptr)); - } - // if we aren't in offline mode,. if (session->status != AuthSession::PlayableOffline) { if (!session->demo) { From feb275a580c26663eeba7db8b806bb5fc5b3df6a Mon Sep 17 00:00:00 2001 From: sshcrack <34072808+sshcrack@users.noreply.github.com> Date: Sun, 8 Dec 2024 18:27:57 +0100 Subject: [PATCH 04/83] load meta first Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com> (cherry picked from commit cf2dcbd431b0c4bb03ff527465f972d72f713b0c) Signed-off-by: seth --- launcher/minecraft/MinecraftInstance.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 80ec34d29..c7f639a61 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1083,6 +1083,12 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } + // load meta + { + auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline; + process->appendStep(makeShared(pptr, makeShared(this, mode))); + } + // check java { process->appendStep(makeShared(pptr)); @@ -1096,12 +1102,6 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } - // load meta - { - auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline; - process->appendStep(makeShared(pptr, makeShared(this, mode))); - } - // if we aren't in offline mode,. if (session->status != AuthSession::PlayableOffline) { if (!session->demo) { From 43834e2148335ef3623fb4ed0d2dc83b1e64745b Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 21 Aug 2023 19:47:47 +0300 Subject: [PATCH 05/83] correctly expand env vars Signed-off-by: Trial97 (cherry picked from commit c12beb43a0f3dad6e66fd42192dbbf1f78fb6c53) --- launcher/launch/LaunchTask.cpp | 62 +++++++++++++++++---- launcher/launch/LaunchTask.h | 3 +- launcher/launch/steps/PostLaunchCommand.cpp | 12 ++-- launcher/launch/steps/PreLaunchCommand.cpp | 13 ++--- 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/launcher/launch/LaunchTask.cpp b/launcher/launch/LaunchTask.cpp index 0251b302d..976221471 100644 --- a/launcher/launch/LaunchTask.cpp +++ b/launcher/launch/LaunchTask.cpp @@ -254,20 +254,60 @@ void LaunchTask::emitFailed(QString reason) Task::emitFailed(reason); } -void LaunchTask::substituteVariables(QStringList& args) const +QString expandVariables(const QString& input, QProcessEnvironment dict) { - auto env = m_instance->createEnvironment(); + QString result = input; - for (auto key : env.keys()) { - args.replaceInStrings("$" + key, env.value(key)); + enum { base, maybeBrace, variable, brace } state = base; + int startIdx = -1; + for (int i = 0; i < result.length();) { + QChar c = result.at(i++); + switch (state) { + case base: + if (c == '$') + state = maybeBrace; + break; + case maybeBrace: + if (c == '{') { + state = brace; + startIdx = i; + } else if (c.isLetterOrNumber() || c == '_') { + state = variable; + startIdx = i - 1; + } else { + state = base; + } + break; + case brace: + if (c == '}') { + const auto res = dict.value(result.mid(startIdx, i - 1 - startIdx), ""); + if (!res.isEmpty()) { + result.replace(startIdx - 2, i - startIdx + 2, res); + i = startIdx - 2 + res.length(); + } + state = base; + } + break; + case variable: + if (!c.isLetterOrNumber() && c != '_') { + const auto res = dict.value(result.mid(startIdx, i - startIdx - 1), ""); + if (!res.isEmpty()) { + result.replace(startIdx - 1, i - startIdx, res); + i = startIdx - 1 + res.length(); + } + state = base; + } + break; + } } + if (state == variable) { + if (const auto res = dict.value(result.mid(startIdx), ""); !res.isEmpty()) + result.replace(startIdx - 1, result.length() - startIdx + 1, res); + } + return result; } -void LaunchTask::substituteVariables(QString& cmd) const +QString LaunchTask::substituteVariables(QString& cmd) const { - auto env = m_instance->createEnvironment(); - - for (auto key : env.keys()) { - cmd.replace("$" + key, env.value(key)); - } -} + return expandVariables(cmd, m_instance->createEnvironment()); +} \ No newline at end of file diff --git a/launcher/launch/LaunchTask.h b/launcher/launch/LaunchTask.h index 56065af5b..1f1b5222b 100644 --- a/launcher/launch/LaunchTask.h +++ b/launcher/launch/LaunchTask.h @@ -87,8 +87,7 @@ class LaunchTask : public Task { shared_qobject_ptr getLogModel(); public: - void substituteVariables(QStringList& args) const; - void substituteVariables(QString& cmd) const; + QString substituteVariables(QString& cmd) const; QString censorPrivateInfo(QString in); protected: /* methods */ diff --git a/launcher/launch/steps/PostLaunchCommand.cpp b/launcher/launch/steps/PostLaunchCommand.cpp index 725101224..946560c10 100644 --- a/launcher/launch/steps/PostLaunchCommand.cpp +++ b/launcher/launch/steps/PostLaunchCommand.cpp @@ -47,19 +47,15 @@ PostLaunchCommand::PostLaunchCommand(LaunchTask* parent) : LaunchStep(parent) void PostLaunchCommand::executeTask() { - // FIXME: where to put this? + auto cmd = m_parent->substituteVariables(m_command); + emit logLine(tr("Running Post-Launch command: %1").arg(cmd), MessageLevel::Launcher); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - auto args = QProcess::splitCommand(m_command); - m_parent->substituteVariables(args); + auto args = QProcess::splitCommand(cmd); - emit logLine(tr("Running Post-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher); const QString program = args.takeFirst(); m_process.start(program, args); #else - m_parent->substituteVariables(m_command); - - emit logLine(tr("Running Post-Launch command: %1").arg(m_command), MessageLevel::Launcher); - m_process.start(m_command); + m_process.start(cmd); #endif } diff --git a/launcher/launch/steps/PreLaunchCommand.cpp b/launcher/launch/steps/PreLaunchCommand.cpp index 6d071a66e..3505febf7 100644 --- a/launcher/launch/steps/PreLaunchCommand.cpp +++ b/launcher/launch/steps/PreLaunchCommand.cpp @@ -47,19 +47,14 @@ PreLaunchCommand::PreLaunchCommand(LaunchTask* parent) : LaunchStep(parent) void PreLaunchCommand::executeTask() { - // FIXME: where to put this? + auto cmd = m_parent->substituteVariables(m_command); + emit logLine(tr("Running Pre-Launch command: %1").arg(cmd), MessageLevel::Launcher); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - auto args = QProcess::splitCommand(m_command); - m_parent->substituteVariables(args); - - emit logLine(tr("Running Pre-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher); + auto args = QProcess::splitCommand(cmd); const QString program = args.takeFirst(); m_process.start(program, args); #else - m_parent->substituteVariables(m_command); - - emit logLine(tr("Running Pre-Launch command: %1").arg(m_command), MessageLevel::Launcher); - m_process.start(m_command); + m_process.start(cmd); #endif } From b7b5630588e73a8a86100878452dbd14e6f1f80e Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 18 Nov 2023 11:18:50 +0200 Subject: [PATCH 06/83] expand env from wrapped cmd Signed-off-by: Trial97 (cherry picked from commit 09a118e85e3646ded9d7b2704d2f95a589ca19b9) --- launcher/launch/LaunchTask.cpp | 6 +++--- launcher/launch/LaunchTask.h | 2 +- launcher/minecraft/launch/LauncherPartLaunch.cpp | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/launcher/launch/LaunchTask.cpp b/launcher/launch/LaunchTask.cpp index 976221471..4b93d2077 100644 --- a/launcher/launch/LaunchTask.cpp +++ b/launcher/launch/LaunchTask.cpp @@ -307,7 +307,7 @@ QString expandVariables(const QString& input, QProcessEnvironment dict) return result; } -QString LaunchTask::substituteVariables(QString& cmd) const +QString LaunchTask::substituteVariables(QString& cmd, bool isLaunch) const { - return expandVariables(cmd, m_instance->createEnvironment()); -} \ No newline at end of file + return expandVariables(cmd, isLaunch ? m_instance->createLaunchEnvironment() : m_instance->createEnvironment()); +} diff --git a/launcher/launch/LaunchTask.h b/launcher/launch/LaunchTask.h index 1f1b5222b..2e87ece95 100644 --- a/launcher/launch/LaunchTask.h +++ b/launcher/launch/LaunchTask.h @@ -87,7 +87,7 @@ class LaunchTask : public Task { shared_qobject_ptr getLogModel(); public: - QString substituteVariables(QString& cmd) const; + QString substituteVariables(QString& cmd, bool isLaunch = false) const; QString censorPrivateInfo(QString in); protected: /* methods */ diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index d9a2b9b6b..2e842632a 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -131,6 +131,7 @@ void LauncherPartLaunch::executeTask() QString wrapperCommandStr = instance->getWrapperCommand().trimmed(); if (!wrapperCommandStr.isEmpty()) { + wrapperCommandStr = m_parent->substituteVariables(wrapperCommandStr); auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr); auto wrapperCommand = wrapperArgs.takeFirst(); auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand); From 15887c2d923d11268fb2a8ede877dbc4f4f39c38 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:53:05 +0300 Subject: [PATCH 07/83] truncate logs for mclo.gs upload to fit 25k line limit Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit 014fc142915ec4a0f96b3082f76d4d32ce7596aa) --- launcher/net/PasteUpload.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index c67d3b23c..5e8c5a8cd 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -49,6 +49,27 @@ #include "net/Logging.h" +constexpr int MaxMclogsLines = 25000; +constexpr int InitialMclogsLines = 10000; +constexpr int FinalMclogsLines = 14900; + +QString truncateLogForMclogs(const QString &logContent) { + QStringList lines = logContent.split("\n"); + if (lines.size() > MaxMclogsLines) { + QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); + truncatedLog += "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + return truncatedLog; + } + return logContent; +} + std::array PasteUpload::PasteTypes = { { { "0x0.st", "https://0x0.st", "" }, { "hastebin", "https://hst.sh", "/documents" }, { "paste.gg", "https://paste.gg", "/api/v1/pastes" }, @@ -98,6 +119,7 @@ void PasteUpload::executeTask() } case Mclogs: { QUrlQuery postData; + m_text = truncateLogForMclogs(m_text).toUtf8(); postData.addQueryItem("content", m_text); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); rep = APPLICATION->network()->post(request, postData.toString().toUtf8()); From cf8a82e78a8578bd04b50893eb5b921ddaf166f3 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:14:40 +0300 Subject: [PATCH 08/83] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit e6f30c0ebe0ddd43b493f27156d6c0765105ded5) --- launcher/net/PasteUpload.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 5e8c5a8cd..92a44d5ed 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -53,17 +53,19 @@ constexpr int MaxMclogsLines = 25000; constexpr int InitialMclogsLines = 10000; constexpr int FinalMclogsLines = 14900; -QString truncateLogForMclogs(const QString &logContent) { +QString truncateLogForMclogs(const QString &logContent) +{ QStringList lines = logContent.split("\n"); if (lines.size() > MaxMclogsLines) { QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); - truncatedLog += "\n\n\n\n\n\n\n\n\n\n" - "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" - "----- Middle portion omitted to fit mclo.gs size limits ----\n" - "------------------------------------------------------------\n" - "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += + "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); return truncatedLog; } From db35f471057f7bd48a96453bc8352f88d50d4a64 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:16:40 +0300 Subject: [PATCH 09/83] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit 858f6aa9b8adcb5d2ac9eadd2702a21a88f9e4c4) --- launcher/net/PasteUpload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 92a44d5ed..953a0d722 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -53,7 +53,7 @@ constexpr int MaxMclogsLines = 25000; constexpr int InitialMclogsLines = 10000; constexpr int FinalMclogsLines = 14900; -QString truncateLogForMclogs(const QString &logContent) +QString truncateLogForMclogs(const QString& logContent) { QStringList lines = logContent.split("\n"); if (lines.size() > MaxMclogsLines) { From 0cb5ac7a060f07beb324fe396a676b382f8ac128 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:59:51 +0300 Subject: [PATCH 10/83] add a warning about the log being too large Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit cf914526bf5330600f3cadb9f4baddb5144af21f) --- launcher/net/PasteUpload.cpp | 24 ----------------- launcher/ui/GuiUtil.cpp | 51 +++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 953a0d722..c67d3b23c 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -49,29 +49,6 @@ #include "net/Logging.h" -constexpr int MaxMclogsLines = 25000; -constexpr int InitialMclogsLines = 10000; -constexpr int FinalMclogsLines = 14900; - -QString truncateLogForMclogs(const QString& logContent) -{ - QStringList lines = logContent.split("\n"); - if (lines.size() > MaxMclogsLines) { - QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); - truncatedLog += - "\n\n\n\n\n\n\n\n\n\n" - "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" - "----- Middle portion omitted to fit mclo.gs size limits ----\n" - "------------------------------------------------------------\n" - "\n\n\n\n\n\n\n\n\n\n"; - truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); - return truncatedLog; - } - return logContent; -} - std::array PasteUpload::PasteTypes = { { { "0x0.st", "https://0x0.st", "" }, { "hastebin", "https://hst.sh", "/documents" }, { "paste.gg", "https://paste.gg", "/api/v1/pastes" }, @@ -121,7 +98,6 @@ void PasteUpload::executeTask() } case Mclogs: { QUrlQuery postData; - m_text = truncateLogForMclogs(m_text).toUtf8(); postData.addQueryItem("content", m_text); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); rep = APPLICATION->network()->post(request, postData.toString().toUtf8()); diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 584a34710..3b0eccd02 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -51,11 +51,35 @@ #include #include "Application.h" +constexpr int MaxMclogsLines = 25000; +constexpr int InitialMclogsLines = 10000; +constexpr int FinalMclogsLines = 14900; + +QString truncateLogForMclogs(const QString& logContent) +{ + QStringList lines = logContent.split("\n"); + if (lines.size() > MaxMclogsLines) { + QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); + truncatedLog += + "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + return truncatedLog; + } + return logContent; +} + std::optional GuiUtil::uploadPaste(const QString& name, const QString& text, QWidget* parentWidget) { ProgressDialog dialog(parentWidget); auto pasteTypeSetting = static_cast(APPLICATION->settings()->get("PastebinType").toInt()); auto pasteCustomAPIBaseSetting = APPLICATION->settings()->get("PastebinCustomAPIBase").toString(); + bool shouldTruncate = false; { QUrl baseUrl; @@ -75,10 +99,35 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (response != QMessageBox::Yes) return {}; + + if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { + auto truncateResponse = + CustomMessageBox::selectable(parentWidget, QObject::tr("Confirm Truncate"), + QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" + "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " + "potentially useful info like crashes at the end.\n\n" + "Proceed with Prism's truncation?") + .arg(text.count("\n")) + .arg(MaxMclogsLines) + .arg(InitialMclogsLines) + .arg(FinalMclogsLines), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (truncateResponse == QMessageBox::Yes) + shouldTruncate = true; + } } } - std::unique_ptr paste(new PasteUpload(parentWidget, text, pasteCustomAPIBaseSetting, pasteTypeSetting)); + QString textToUpload; + if (shouldTruncate) + textToUpload = truncateLogForMclogs(text); + else + textToUpload = text; + + std::unique_ptr paste(new PasteUpload(parentWidget, textToUpload, pasteCustomAPIBaseSetting, pasteTypeSetting)); dialog.execWithTask(paste.get()); if (!paste->wasSuccessful()) { From 589ee73bfd78818f46de505501c09b8e2db65994 Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:42:35 +0300 Subject: [PATCH 11/83] Apply suggestions from code review Co-authored-by: Alexandru Ionut Tripon Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> (cherry picked from commit 99bd4a89373416cea641f1421d1082ff823eba2e) --- launcher/ui/GuiUtil.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 3b0eccd02..de72a7d5d 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -115,17 +115,15 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ->exec(); - if (truncateResponse == QMessageBox::Yes) - shouldTruncate = true; + shouldTruncate = truncateResponse == QMessageBox::Yes; } } } - QString textToUpload; - if (shouldTruncate) + QString textToUpload = text; + if (shouldTruncate) { textToUpload = truncateLogForMclogs(text); - else - textToUpload = text; + } std::unique_ptr paste(new PasteUpload(parentWidget, textToUpload, pasteCustomAPIBaseSetting, pasteTypeSetting)); From e234c6681844bff8fedc2dbeff15c33391ec0c23 Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:14:11 +0300 Subject: [PATCH 12/83] add a `Cancel` option Co-authored-by: Rachel Powers <508861+Ryex@users.noreply.github.com> Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> (cherry picked from commit 65f852615247f6c1ba3cd81cf9e51ebc0220341b) --- launcher/ui/GuiUtil.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index de72a7d5d..cfc1715fc 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -112,9 +112,10 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& .arg(MaxMclogsLines) .arg(InitialMclogsLines) .arg(FinalMclogsLines), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) ->exec(); + if (truncateResponse == QMessageBox::Cancel) { return {} ; } shouldTruncate = truncateResponse == QMessageBox::Yes; } } From 417bb2fce689fdb80173fafdb2ca0a2f95551b57 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:39:27 +0300 Subject: [PATCH 13/83] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit 6d017b5f0b9fd878d387bf33585221ea079e305b) --- launcher/ui/GuiUtil.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index cfc1715fc..5cdd30e17 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -101,21 +101,23 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& return {}; if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { - auto truncateResponse = - CustomMessageBox::selectable(parentWidget, QObject::tr("Confirm Truncate"), - QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" - "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" - "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " - "potentially useful info like crashes at the end.\n\n" - "Proceed with Prism's truncation?") - .arg(text.count("\n")) - .arg(MaxMclogsLines) - .arg(InitialMclogsLines) - .arg(FinalMclogsLines), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) - ->exec(); + auto truncateResponse = CustomMessageBox::selectable( + parentWidget, QObject::tr("Confirm Truncate"), + QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" + "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " + "potentially useful info like crashes at the end.\n\n" + "Proceed with Prism's truncation?") + .arg(text.count("\n")) + .arg(MaxMclogsLines) + .arg(InitialMclogsLines) + .arg(FinalMclogsLines), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) + ->exec(); - if (truncateResponse == QMessageBox::Cancel) { return {} ; } + if (truncateResponse == QMessageBox::Cancel) { + return {}; + } shouldTruncate = truncateResponse == QMessageBox::Yes; } } From 3048e4390027b4d05db1ff9ef14794c7e4ddd497 Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:42:05 +0300 Subject: [PATCH 14/83] apply suggestion from code review Co-authored-by: TheKodeToad Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> (cherry picked from commit a910337e9d148937fc6a7339a7bcdd9a2db1ec03) --- launcher/ui/GuiUtil.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 5cdd30e17..4d2e64af4 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -103,11 +103,11 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { auto truncateResponse = CustomMessageBox::selectable( parentWidget, QObject::tr("Confirm Truncate"), - QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" - "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + QObject::tr("The log has %1 lines, exceeding mclo.gs' limit of %2.\n" + "The launcher can keep the first %3 and last %4 lines, trimming the middle.\n\n" "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " "potentially useful info like crashes at the end.\n\n" - "Proceed with Prism's truncation?") + "Proceed with truncation?") .arg(text.count("\n")) .arg(MaxMclogsLines) .arg(InitialMclogsLines) From 01397896eb06fbe13a892fde913152c565b5e029 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:44:53 +0300 Subject: [PATCH 15/83] don't mention prism in the middle of the log Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit 762d24bd02ae6a0c0f241626c9c06deeaae86574) --- launcher/ui/GuiUtil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 4d2e64af4..77d4a98e2 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -63,8 +63,8 @@ QString truncateLogForMclogs(const QString& logContent) truncatedLog += "\n\n\n\n\n\n\n\n\n\n" "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" + "----------------------- Log truncated ----------------------\n" + "------------------------------------------------------------\n" "----- Middle portion omitted to fit mclo.gs size limits ----\n" "------------------------------------------------------------\n" "\n\n\n\n\n\n\n\n\n\n"; From cffa9a2da0000b0b2a5dbb87bd5885d161c98e2a Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 25 Aug 2024 13:05:08 +0100 Subject: [PATCH 16/83] Confirm Truncate -> Truncation Signed-off-by: TheKodeToad (cherry picked from commit 43fc9ba932ec65d274b60bafb4d3c3f1d5bf55f0) --- launcher/ui/GuiUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 77d4a98e2..ccb4e48b5 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -102,7 +102,7 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { auto truncateResponse = CustomMessageBox::selectable( - parentWidget, QObject::tr("Confirm Truncate"), + parentWidget, QObject::tr("Confirm Truncation"), QObject::tr("The log has %1 lines, exceeding mclo.gs' limit of %2.\n" "The launcher can keep the first %3 and last %4 lines, trimming the middle.\n\n" "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " From c8c3370d36aa1df3e7262ef7eaf4b2e624b36d4e Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:02:32 +0300 Subject: [PATCH 17/83] fix off by one error Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> (cherry picked from commit 6a12c43c787db4a64748d6c3d03b34981948d7ce) --- launcher/ui/GuiUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index ccb4e48b5..94dd01169 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -68,7 +68,7 @@ QString truncateLogForMclogs(const QString& logContent) "----- Middle portion omitted to fit mclo.gs size limits ----\n" "------------------------------------------------------------\n" "\n\n\n\n\n\n\n\n\n\n"; - truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + truncatedLog += lines.mid(lines.size() - FinalMclogsLines - 1).join("\n"); return truncatedLog; } return logContent; From 820b9e3fd06193646a749c4a4d6b58ecc1ceba46 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 31 Dec 2024 11:13:01 +0200 Subject: [PATCH 18/83] remove EditAccountDialog Signed-off-by: Trial97 (cherry picked from commit e01df73debc8cb578e3e1b1e557388a8d0a7a052) --- launcher/CMakeLists.txt | 3 - launcher/ui/dialogs/EditAccountDialog.cpp | 64 --------------- launcher/ui/dialogs/EditAccountDialog.h | 52 ------------- launcher/ui/dialogs/EditAccountDialog.ui | 94 ----------------------- 4 files changed, 213 deletions(-) delete mode 100644 launcher/ui/dialogs/EditAccountDialog.cpp delete mode 100644 launcher/ui/dialogs/EditAccountDialog.h delete mode 100644 launcher/ui/dialogs/EditAccountDialog.ui diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 0f0949a3a..982ff7b6b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1031,8 +1031,6 @@ SET(LAUNCHER_SOURCES ui/dialogs/CopyInstanceDialog.h ui/dialogs/CustomMessageBox.cpp ui/dialogs/CustomMessageBox.h - ui/dialogs/EditAccountDialog.cpp - ui/dialogs/EditAccountDialog.h ui/dialogs/ExportInstanceDialog.cpp ui/dialogs/ExportInstanceDialog.h ui/dialogs/ExportPackDialog.cpp @@ -1218,7 +1216,6 @@ qt_wrap_ui(LAUNCHER_UI ui/dialogs/MSALoginDialog.ui ui/dialogs/OfflineLoginDialog.ui ui/dialogs/AboutDialog.ui - ui/dialogs/EditAccountDialog.ui ui/dialogs/ReviewMessageBox.ui ui/dialogs/ScrollMessageBox.ui ui/dialogs/BlockedModsDialog.ui diff --git a/launcher/ui/dialogs/EditAccountDialog.cpp b/launcher/ui/dialogs/EditAccountDialog.cpp deleted file mode 100644 index 9d0175bbc..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2013-2021 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 "EditAccountDialog.h" -#include -#include -#include -#include "ui_EditAccountDialog.h" - -EditAccountDialog::EditAccountDialog(const QString& text, QWidget* parent, int flags) : QDialog(parent), ui(new Ui::EditAccountDialog) -{ - ui->setupUi(this); - - ui->label->setText(text); - ui->label->setVisible(!text.isEmpty()); - - ui->userTextBox->setEnabled(flags & UsernameField); - ui->passTextBox->setEnabled(flags & PasswordField); - - ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); - ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); -} - -EditAccountDialog::~EditAccountDialog() -{ - delete ui; -} - -void EditAccountDialog::on_label_linkActivated(const QString& link) -{ - DesktopServices::openUrl(QUrl(link)); -} - -void EditAccountDialog::setUsername(const QString& user) const -{ - ui->userTextBox->setText(user); -} - -QString EditAccountDialog::username() const -{ - return ui->userTextBox->text(); -} - -void EditAccountDialog::setPassword(const QString& pass) const -{ - ui->passTextBox->setText(pass); -} - -QString EditAccountDialog::password() const -{ - return ui->passTextBox->text(); -} diff --git a/launcher/ui/dialogs/EditAccountDialog.h b/launcher/ui/dialogs/EditAccountDialog.h deleted file mode 100644 index 7a9ccba79..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2013-2021 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 - -namespace Ui { -class EditAccountDialog; -} - -class EditAccountDialog : public QDialog { - Q_OBJECT - - public: - explicit EditAccountDialog(const QString& text = "", QWidget* parent = 0, int flags = UsernameField | PasswordField); - ~EditAccountDialog(); - - void setUsername(const QString& user) const; - void setPassword(const QString& pass) const; - - QString username() const; - QString password() const; - - enum Flags { - NoFlags = 0, - - //! Specifies that the dialog should have a username field. - UsernameField, - - //! Specifies that the dialog should have a password field. - PasswordField, - }; - - private slots: - void on_label_linkActivated(const QString& link); - - private: - Ui::EditAccountDialog* ui; -}; diff --git a/launcher/ui/dialogs/EditAccountDialog.ui b/launcher/ui/dialogs/EditAccountDialog.ui deleted file mode 100644 index e87509bcb..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.ui +++ /dev/null @@ -1,94 +0,0 @@ - - - EditAccountDialog - - - - 0 - 0 - 400 - 148 - - - - Login - - - - - - Message label placeholder. - - - Qt::RichText - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Email - - - - - - - QLineEdit::Password - - - Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - EditAccountDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - EditAccountDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - From 81318d49535b6fe1f1415cbca8c9ab014f8d0ca1 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 17 Jan 2025 09:17:49 +0200 Subject: [PATCH 19/83] bump to 9.3 Signed-off-by: Trial97 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e7f14ac6..5c6d90af5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,7 +181,7 @@ set(Launcher_FMLLIBS_BASE_URL "https://files.prismlauncher.org/fmllibs/" CACHE S ######## Set version numbers ######## set(Launcher_VERSION_MAJOR 9) -set(Launcher_VERSION_MINOR 2) +set(Launcher_VERSION_MINOR 3) set(Launcher_VERSION_NAME "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}") set(Launcher_VERSION_NAME4 "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}.0.0") From beac093d62e3a84957fb29e278c5234d65fc64c1 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 6 Oct 2023 09:17:03 +0300 Subject: [PATCH 20/83] Added mouse interactions for labels in ProgressDialog Signed-off-by: Trial97 (cherry picked from commit 08f5148a9a4e574dd3ef4e7dc1e46a05ffd9dd5e) --- launcher/ui/dialogs/ProfileSetupDialog.ui | 3 +++ launcher/ui/widgets/SubTaskProgressBar.ui | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/launcher/ui/dialogs/ProfileSetupDialog.ui b/launcher/ui/dialogs/ProfileSetupDialog.ui index 9dbabb4b3..947110da7 100644 --- a/launcher/ui/dialogs/ProfileSetupDialog.ui +++ b/launcher/ui/dialogs/ProfileSetupDialog.ui @@ -30,6 +30,9 @@ Choose your name carefully: true + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + nameEdit diff --git a/launcher/ui/widgets/SubTaskProgressBar.ui b/launcher/ui/widgets/SubTaskProgressBar.ui index 5431eab60..aabb68329 100644 --- a/launcher/ui/widgets/SubTaskProgressBar.ui +++ b/launcher/ui/widgets/SubTaskProgressBar.ui @@ -47,6 +47,9 @@ true + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -68,6 +71,9 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + From 9f199a470c45fd0adf443316cac9aed7345a372a Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 18 Jan 2025 16:55:25 -0500 Subject: [PATCH 21/83] ci: build nix packages for aarch64-linux Signed-off-by: seth (cherry picked from commit 8e8538b506b5f3ae2b2424599078966600bb764c) Signed-off-by: seth --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 991ddcd8c..b52a7ffa7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -663,6 +663,9 @@ jobs: - os: ubuntu-22.04 system: x86_64-linux + - os: ubuntu-22.04-arm + system: aarch64-linux + - os: macos-13 system: x86_64-darwin From ed2b5d4b0e42d40bcdc66d9e7299693206a8a3b4 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 18 Jan 2025 17:05:17 -0500 Subject: [PATCH 22/83] ci: build flatpaks for arm Signed-off-by: seth (cherry picked from commit 66f0397087d9b88c93e69c5e26a138d235344546) Signed-off-by: seth --- .github/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b52a7ffa7..d3b48f500 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -631,10 +631,24 @@ jobs: ccache -s flatpak: - runs-on: ubuntu-latest + name: Flatpak (${{ matrix.arch }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + arch: x86_64 + + - os: ubuntu-22.04-arm + arch: aarch64 + + runs-on: ${{ matrix.os }} + container: image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 options: --privileged + steps: - name: Checkout uses: actions/checkout@v4 @@ -652,6 +666,7 @@ jobs: with: bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + arch: ${{ matrix.arch }} nix: name: Nix (${{ matrix.system }}) From d7756d29dc239b2c85f14cb85767cab9bd68e2ec Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 03:45:35 +0300 Subject: [PATCH 23/83] chore: update Qt to 6.8.0 Signed-off-by: Edgars Cirulis (cherry picked from commit 5b6d551650e4590567321647ce68ae2043a8180c) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3b48f500..1cf41691a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -95,7 +95,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "win64_msvc2019_arm64" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -106,7 +106,7 @@ jobs: qt_ver: 6 qt_host: mac qt_arch: "" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 From bd7371dbf15a4ca453f53cec23e79601a09fda19 Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 03:47:11 +0300 Subject: [PATCH 24/83] ci: fix qt-6.8 workflow Signed-off-by: Edgars Cirulis (cherry picked from commit b39098dbc5b371e31ce585f7534ffdb00096c2b5) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cf41691a..33b2119a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,8 +80,8 @@ jobs: architecture: "x64" vcvars_arch: "amd64" qt_ver: 6 - qt_host: windows - qt_arch: "" + qt_host: "windows" + qt_arch: "win64_msvc2022_64" qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" @@ -93,8 +93,8 @@ jobs: architecture: "arm64" vcvars_arch: "amd64_arm64" qt_ver: 6 - qt_host: windows - qt_arch: "win64_msvc2019_arm64" + qt_host: "windows" + qt_arch: "win64_msvc2022_arm64_cross_compiled" qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" @@ -223,7 +223,7 @@ jobs: version: ${{ matrix.qt_version }} host: "windows" target: "desktop" - arch: "" + arch: ${{ matrix.qt_arch }} modules: ${{ matrix.qt_modules }} cache: ${{ inputs.is_qt_cached }} cache-key-prefix: host-qt-arm64-windows @@ -264,7 +264,7 @@ jobs: - name: Add QT_HOST_PATH var (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' run: | - echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2019_64" >> $env:GITHUB_ENV + echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2022_64" >> $env:GITHUB_ENV - name: Setup java (macOS) if: runner.os == 'macOS' From a0c4cc59ac884d6dc6afec030decf3977fa2f0ad Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 15:23:48 +0300 Subject: [PATCH 25/83] ci: uprev qt install action to v4 Signed-off-by: Edgars Cirulis (cherry picked from commit 0beaa94311a00cdc02ef5ff7d182849fce419aa9) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33b2119a6..0f8f90984 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,7 +216,7 @@ jobs: - name: Install host Qt (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: aqtversion: "==3.1.*" py7zrversion: ">=0.20.2" @@ -232,7 +232,7 @@ jobs: - name: Install Qt (macOS, Linux & Windows MSVC) if: matrix.msystem == '' - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: aqtversion: "==3.1.*" py7zrversion: ">=0.20.2" From 0d06fae7ae97775efb4acd4dc60f4e7efe014477 Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Mon, 9 Dec 2024 00:40:05 +0200 Subject: [PATCH 26/83] chore: update Qt to 6.8.1 Signed-off-by: Edgars Cirulis (cherry picked from commit eb8c375ec5023bbc7c02e45d63da866058e56b26) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f8f90984..4ea687707 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: qt_ver: 6 qt_host: "windows" qt_arch: "win64_msvc2022_64" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -95,7 +95,7 @@ jobs: qt_ver: 6 qt_host: "windows" qt_arch: "win64_msvc2022_arm64_cross_compiled" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -106,7 +106,7 @@ jobs: qt_ver: 6 qt_host: mac qt_arch: "" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 From e77ac36c3f2b6758f6452b0c142907a1957830db Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 16 Jan 2025 12:10:19 +0200 Subject: [PATCH 27/83] fix appimage Signed-off-by: Trial97 (cherry picked from commit bca517b8d3cd685540beebf69fbc1f80fe0a6ce4) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3b48f500..b545becc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: qt_version: "5.15.2" qt_modules: "qtnetworkauth" - - os: ubuntu-20.04 + - os: ubuntu-22.04 qt_ver: 6 qt_host: linux qt_arch: "" @@ -259,7 +259,7 @@ jobs: wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage" - sudo apt install libopengl0 + sudo apt install libopengl0 libfuse2 - name: Add QT_HOST_PATH var (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' @@ -519,8 +519,8 @@ jobs: cp -r ${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ - cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ cp /usr/lib/x86_64-linux-gnu/libOpenGL.so.0* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib" @@ -545,8 +545,27 @@ jobs: mv "PrismLauncher-Linux-x86_64.AppImage" "PrismLauncher-Linux-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage" - - name: Package (Linux, portable) - if: runner.os == 'Linux' + - name: Package (Linux, qt6, portable) + if: runner.os == 'Linux' && matrix.qt_ver != 5 + run: | + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja + cmake --install ${{ env.BUILD_DIR }} + cmake --install ${{ env.BUILD_DIR }} --component portable + + mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.8 ${{ env.INSTALL_PORTABLE_DIR }}/lib + mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib + + for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt + cd ${{ env.INSTALL_PORTABLE_DIR }} + tar -czf ../PrismLauncher-portable.tar.gz * + + - name: Package (Linux, qt5, portable) + if: runner.os == 'Linux' && matrix.qt_ver == 5 run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja cmake --install ${{ env.BUILD_DIR }} From fdab044c043e969e63668903863c79ed1b349c95 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 19 Jan 2025 01:05:06 +0200 Subject: [PATCH 28/83] remove specific step for qt6 Signed-off-by: Trial97 (cherry picked from commit be3eca8c97fdbb8daede84cab20fbd7695334242) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b545becc8..392c8164c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -545,8 +545,8 @@ jobs: mv "PrismLauncher-Linux-x86_64.AppImage" "PrismLauncher-Linux-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage" - - name: Package (Linux, qt6, portable) - if: runner.os == 'Linux' && matrix.qt_ver != 5 + - name: Package (Linux, portable) + if: runner.os == 'Linux' run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja cmake --install ${{ env.BUILD_DIR }} @@ -555,28 +555,9 @@ jobs: mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.8 ${{ env.INSTALL_PORTABLE_DIR }}/lib - mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib - - for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt - cd ${{ env.INSTALL_PORTABLE_DIR }} - tar -czf ../PrismLauncher-portable.tar.gz * - - - name: Package (Linux, qt5, portable) - if: runner.os == 'Linux' && matrix.qt_ver == 5 - run: | - cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja - cmake --install ${{ env.BUILD_DIR }} - cmake --install ${{ env.BUILD_DIR }} --component portable - - mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.7 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt From 02e198877976510aabd0a6b2fc764d14d64d9f63 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Sun, 19 Jan 2025 02:03:21 +0200 Subject: [PATCH 29/83] Update .github/workflows/build.yml Co-authored-by: seth Signed-off-by: Alexandru Ionut Tripon (cherry picked from commit 1b5d3c2bf903bbcade7b38c22c0b103a0c6999f8) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 392c8164c..a24bfc281 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -519,8 +519,8 @@ jobs: cp -r ${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ - cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ cp /usr/lib/x86_64-linux-gnu/libOpenGL.so.0* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib" From ea0d710aaff40729adc7f3f6cced0c103d4af4db Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 21 Jan 2025 01:38:13 +0200 Subject: [PATCH 30/83] Update .github/workflows/build.yml Co-authored-by: Seth Flynn Signed-off-by: Alexandru Ionut Tripon (cherry picked from commit db766574a42a4b7db6b320b6d469b233ce5f3100) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a24bfc281..b20a6769b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -557,7 +557,7 @@ jobs: cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.*.* ${{ env.INSTALL_PORTABLE_DIR }}/lib mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt From bbde47842b6cadfad2680dedb86ff267337632fc Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 20 Jan 2025 20:35:37 -0500 Subject: [PATCH 31/83] feat: use better compile flags for mingw Signed-off-by: Seth Flynn (cherry picked from commit e66f447ce5bca996b0a12fac02216b2b6ab8ccb6) --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c6d90af5..7a0ac672b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,13 @@ else() # ATL's pack list needs more than the default 1 Mib stack on windows if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}") + + # -ffunction-sections and -fdata-sections help reduce binary size + # -mguard=cf enables Control Flow Guard + # TODO: Look into -gc-sections to further reduce binary size + foreach(lang C CXX) + set("CMAKE_${lang}_FLAGS_RELEASE" "-ffunction-sections -fdata-sections -mguard=cf") + endforeach() endif() endif() From 855e49bda0d83194f832c58e1cfe70886ba60c36 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 13 Jan 2025 13:56:55 +0200 Subject: [PATCH 32/83] fix curseforge with empty loader as newest version Signed-off-by: Trial97 (cherry picked from commit e4ad4051c8b87bd5102a76a860408de2b447d74d) --- launcher/modplatform/flame/FlameAPI.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/launcher/modplatform/flame/FlameAPI.cpp b/launcher/modplatform/flame/FlameAPI.cpp index 53eadcf02..699eb792a 100644 --- a/launcher/modplatform/flame/FlameAPI.cpp +++ b/launcher/modplatform/flame/FlameAPI.cpp @@ -270,6 +270,7 @@ std::optional FlameAPI::getLatestVersion(QList instanceLoaders, ModPlatform::ModLoaderTypes modLoaders) { + static const auto noLoader = ModPlatform::ModLoaderType(0); QHash bestMatch; auto checkVersion = [&bestMatch](const ModPlatform::IndexedVersion& version, const ModPlatform::ModLoaderType& loader) { if (bestMatch.contains(loader)) { @@ -284,7 +285,7 @@ std::optional FlameAPI::getLatestVersion(QList FlameAPI::getLatestVersion(QList fabric version will be prioritizated on update auto currentLoaders = instanceLoaders + ModPlatform::modLoaderTypesToList(modLoaders); - currentLoaders.append(ModPlatform::ModLoaderType(0)); // add a fallback in case the versions do not define a loader + currentLoaders.append(noLoader); // add a fallback in case the versions do not define a loader for (auto loader : currentLoaders) { if (bestMatch.contains(loader)) { - return bestMatch.value(loader); + auto bestForLoader = bestMatch.value(loader); + // awkward case where the mod has only two loaders and one of them is not specified + if (loader != noLoader && bestMatch.contains(noLoader) && bestMatch.size() == 2) { + auto bestForNoLoader = bestMatch.value(noLoader); + if (bestForNoLoader.date > bestForLoader.date) { + return bestForNoLoader; + } + } + return bestForLoader; } } return {}; From 8e8efc304f97354745642c4ed53e7170a583512f Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 08:24:42 -0500 Subject: [PATCH 33/83] ci: separate nix job Signed-off-by: Seth Flynn (cherry picked from commit 417688089d756da23ca3f482a32871963d289211) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 56 ------------------- .github/workflows/nix.yml | 80 +++++++++++++++++++++++++++ .github/workflows/trigger_builds.yml | 1 - .github/workflows/trigger_release.yml | 1 - 4 files changed, 80 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/nix.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff2d346d4..93d33e2d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,6 @@ on: APPLE_NOTARIZE_PASSWORD: description: Password used for notarizing macOS builds required: false - CACHIX_AUTH_TOKEN: - description: Private token for authenticating against Cachix cache - required: false GPG_PRIVATE_KEY: description: Private key for AppImage signing required: false @@ -667,56 +664,3 @@ jobs: bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml arch: ${{ matrix.arch }} - - nix: - name: Nix (${{ matrix.system }}) - - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - system: x86_64-linux - - - os: ubuntu-22.04-arm - system: aarch64-linux - - - os: macos-13 - system: x86_64-darwin - - - os: macos-14 - system: aarch64-darwin - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@v30 - - # For PRs - - name: Setup Nix Magic Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - - # For in-tree builds - - name: Setup Cachix - uses: cachix/cachix-action@v15 - with: - name: prismlauncher - authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - name: Run flake checks - run: | - nix flake check --print-build-logs --show-trace - - - name: Build debug package - if: ${{ inputs.build_type == 'Debug' }} - run: | - nix build --print-build-logs .#prismlauncher-debug - - - name: Build release package - if: ${{ inputs.build_type != 'Debug' }} - run: | - nix build --print-build-logs .#prismlauncher diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 000000000..f167440cd --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,80 @@ +name: Nix + +on: + push: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "flatpak/**" + tags: + - "*" + pull_request: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "flatpak/**" + workflow_dispatch: + +permissions: + contents: read + +env: + DEBUG: ${{ github.ref_type != 'tag' }} + +jobs: + build: + name: Build (${{ matrix.system }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + system: x86_64-linux + + - os: ubuntu-22.04-arm + system: aarch64-linux + + - os: macos-13 + system: x86_64-darwin + + - os: macos-14 + system: aarch64-darwin + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + # For PRs + - name: Setup Nix Magic Cache + uses: DeterminateSystems/magic-nix-cache-action@v9 + + # For in-tree builds + - name: Setup Cachix + uses: cachix/cachix-action@v15 + with: + name: prismlauncher + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - name: Run Flake checks + run: | + nix flake check --print-build-logs --show-trace + + - name: Build debug package + if: ${{ env.DEBUG }} + run: | + nix build --print-build-logs .#prismlauncher-debug + + - name: Build release package + if: ${{ !env.DEBUG }} + run: | + nix build --print-build-logs .#prismlauncher diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 0b8386d69..9efafc8cc 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -38,6 +38,5 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml index e800653e3..134281b2c 100644 --- a/.github/workflows/trigger_release.yml +++ b/.github/workflows/trigger_release.yml @@ -22,7 +22,6 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} From 702db71f61651d271bab920acccaf8d92ef46d1c Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 08:28:05 -0500 Subject: [PATCH 34/83] ci: separate flatpak job Signed-off-by: Seth Flynn (cherry picked from commit 49d734f3142328a71506b28c8c1cdcb99788c34d) Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 38 --------------------- .github/workflows/flatpak.yml | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/flatpak.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93d33e2d3..3361dbd2d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -626,41 +626,3 @@ jobs: shell: msys2 {0} run: | ccache -s - - flatpak: - name: Flatpak (${{ matrix.arch }}) - - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - arch: x86_64 - - - os: ubuntu-22.04-arm - arch: aarch64 - - runs-on: ${{ matrix.os }} - - container: - image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 - options: --privileged - - steps: - - name: Checkout - uses: actions/checkout@v4 - if: inputs.build_type == 'Debug' - with: - submodules: true - - - name: Set short version - shell: bash - run: echo "VERSION=${GITHUB_SHA::7}" >> $GITHUB_ENV - - - name: Build Flatpak (Linux) - if: inputs.build_type == 'Debug' - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 - with: - bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak - manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml - arch: ${{ matrix.arch }} diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml new file mode 100644 index 000000000..41cc2a51d --- /dev/null +++ b/.github/workflows/flatpak.yml @@ -0,0 +1,62 @@ +name: Flatpak + +on: + push: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "nix/**" + # We don't do anything with these artifacts on releases. They go to Flathub + tags-ignore: + - "*" + pull_request: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "nix/**" + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build (${{ matrix.arch }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + arch: x86_64 + + - os: ubuntu-22.04-arm + arch: aarch64 + + runs-on: ${{ matrix.os }} + + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 + options: --privileged + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set short version + shell: bash + run: | + echo "VERSION=${GITHUB_SHA::7}" >> "$GITHUB_ENV" + + - name: Build Flatpak + uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak + manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + arch: ${{ matrix.arch }} From 55578bf949c476a189cacd7dcd7bd6919eed63c3 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 16:17:01 -0500 Subject: [PATCH 35/83] ci: use flakehub cache Signed-off-by: Seth Flynn (cherry picked from commit 8816be166821d5ce1a4cd8edfbe7b91727b6eb34) --- .github/workflows/nix.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index f167440cd..642f9e670 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -24,6 +24,7 @@ permissions: env: DEBUG: ${{ github.ref_type != 'tag' }} + USE_DETERMINATE: ${{ github.event_name == 'pull_request' }} jobs: build: @@ -47,19 +48,26 @@ jobs: runs-on: ${{ matrix.os }} + permissions: + id-token: write + steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@v30 + uses: DeterminateSystems/nix-installer-action@v16 + with: + determinate: ${{ env.USE_DETERMINATE }} # For PRs - name: Setup Nix Magic Cache - uses: DeterminateSystems/magic-nix-cache-action@v9 + if: ${{ env.USE_DETERMINATE }} + uses: DeterminateSystems/flakehub-cache-action@v1 # For in-tree builds - name: Setup Cachix + if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} uses: cachix/cachix-action@v15 with: name: prismlauncher From 7b502fe8c9701374d915b251db619eda0e41c44a Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 16:22:44 -0500 Subject: [PATCH 36/83] ci: run nix workflow on pull_request_target Signed-off-by: Seth Flynn (cherry picked from commit 169f5728b1019582db150f3b1618515eb1438517) --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 642f9e670..0792b172c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -10,7 +10,7 @@ on: - "flatpak/**" tags: - "*" - pull_request: + pull_request_target: paths-ignore: - "**.md" - "**/LICENSE" From 71eced3e61fa364a954caffa704f4439405e3844 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 18 Jan 2025 13:27:18 +0200 Subject: [PATCH 37/83] update submodules Signed-off-by: Trial97 (cherry picked from commit dc00c47f2e2b79705c32f438298d968aaa4fdf26) --- flatpak/shared-modules | 2 +- libraries/cmark | 2 +- libraries/extra-cmake-modules | 2 +- libraries/filesystem | 2 +- libraries/quazip | 2 +- libraries/tomlplusplus | 2 +- libraries/zlib | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flatpak/shared-modules b/flatpak/shared-modules index f2b0c16a2..f5d368a31 160000 --- a/flatpak/shared-modules +++ b/flatpak/shared-modules @@ -1 +1 @@ -Subproject commit f2b0c16a2a217a1822ce5a6538ba8f755ed1dd32 +Subproject commit f5d368a31d6ef046eb2955c74ec6f54f32ed5c4e diff --git a/libraries/cmark b/libraries/cmark index 8fbf02968..3460cd809 160000 --- a/libraries/cmark +++ b/libraries/cmark @@ -1 +1 @@ -Subproject commit 8fbf029685482827828b5858444157052f1b0a5f +Subproject commit 3460cd809b6dd311b58e92733ece2fc956224fd2 diff --git a/libraries/extra-cmake-modules b/libraries/extra-cmake-modules index bbcbaff78..a3d9394ab 160000 --- a/libraries/extra-cmake-modules +++ b/libraries/extra-cmake-modules @@ -1 +1 @@ -Subproject commit bbcbaff78283270c2beee69afd8d5b91da854af8 +Subproject commit a3d9394aba4b35789293378e04fb7473d65edf97 diff --git a/libraries/filesystem b/libraries/filesystem index 2fc4b4637..076592ce6 160000 --- a/libraries/filesystem +++ b/libraries/filesystem @@ -1 +1 @@ -Subproject commit 2fc4b463759e043476fc0036da094e5877e3dd50 +Subproject commit 076592ce6e64568521b88a11881aa36b3d3f7048 diff --git a/libraries/quazip b/libraries/quazip index 9d3aa3ee9..8aeb3f7d8 160000 --- a/libraries/quazip +++ b/libraries/quazip @@ -1 +1 @@ -Subproject commit 9d3aa3ee948c1cde5a9f873ecbc3bb229c1182ee +Subproject commit 8aeb3f7d8254f4bf1f7c6cf2a8f59c2ca141a552 diff --git a/libraries/tomlplusplus b/libraries/tomlplusplus index 7eb2ffcc0..c4369ae1d 160000 --- a/libraries/tomlplusplus +++ b/libraries/tomlplusplus @@ -1 +1 @@ -Subproject commit 7eb2ffcc09f8e9890dc0b77ff8ab00fc53b1f2b8 +Subproject commit c4369ae1d8955cae20c4ab40b9813ef4b60e48be diff --git a/libraries/zlib b/libraries/zlib index 04f42ceca..51b7f2abd 160000 --- a/libraries/zlib +++ b/libraries/zlib @@ -1 +1 @@ -Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc +Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf From dd90049b30782c15a206b4d2011dcd6a486e1eb8 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 07:50:36 -0500 Subject: [PATCH 38/83] ci: use generic workflow for publishing Signed-off-by: Seth Flynn (cherry picked from commit 61d7f088838e25ddb0a7089a6fa3f7d232331c24) --- .github/workflows/{winget.yml => publish.yml} | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) rename .github/workflows/{winget.yml => publish.yml} (63%) diff --git a/.github/workflows/winget.yml b/.github/workflows/publish.yml similarity index 63% rename from .github/workflows/winget.yml rename to .github/workflows/publish.yml index eacf23099..8a7da812e 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,21 @@ -name: Publish to WinGet +name: Publish + on: release: - types: [released] + types: [ released ] + +permissions: + contents: read jobs: - publish: + winget: + name: Winget + runs-on: windows-latest + steps: - - uses: vedantmgoyal2009/winget-releaser@v2 + - name: Publish on Winget + uses: vedantmgoyal2009/winget-releaser@v2 with: identifier: PrismLauncher.PrismLauncher version: ${{ github.event.release.tag_name }} From 4371933a844b50aa7816efc21e6df1627b744bbb Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 07:50:52 -0500 Subject: [PATCH 39/83] feat: publish on flakehub Signed-off-by: Seth Flynn (cherry picked from commit 86cc6d3c5ee7157d5f9978580e94b94360a119f1) --- .github/workflows/publish.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8a7da812e..d49eb4b8d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,28 @@ permissions: contents: read jobs: + flakehub: + name: FlakeHub + + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Publish on FlakeHub + uses: determinatesystems/flakehub-push@v5 + with: + visibility: "public" + winget: name: Winget From f8dc58665b8711be991638e1c35b9ed1786e3fee Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 1 Jan 2025 01:36:17 +0200 Subject: [PATCH 40/83] map modrinth snapshots Signed-off-by: Trial97 (cherry picked from commit 1d8bf1d5a788e689d26e0afa8f5cfca0e3859e5d) --- launcher/modplatform/modrinth/ModrinthAPI.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 070f59dad..43fa956e6 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -168,9 +168,16 @@ class ModrinthAPI : public NetworkResourceAPI { QString getGameVersionsArray(std::list mcVersions) const { + static const QString preString = " Pre-Release "; QString s; for (auto& ver : mcVersions) { - s += QString("\"versions:%1\",").arg(ver.toString()); + auto verStr = ver.toString(); + + if (verStr.contains(preString)) { + verStr.replace(preString, "-pre"); + } + verStr.replace(" ", "-"); + s += QString("\"versions:%1\",").arg(verStr); } s.remove(s.length() - 1, 1); // remove last comma return s.isEmpty() ? QString() : s; From ae3e1a262e63f433c4ff97e8816b3a95687a9e7b Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 17 Jan 2025 10:35:13 +0200 Subject: [PATCH 41/83] ensure that the snapshot mapping is on all apis Signed-off-by: Trial97 (cherry picked from commit 8e5a7c6e333969b5412efd1349f9430ced5654c8) --- launcher/modplatform/ResourceAPI.h | 18 ++++++++++--- launcher/modplatform/modrinth/ModrinthAPI.cpp | 4 +-- launcher/modplatform/modrinth/ModrinthAPI.h | 26 ++++++++++++------- .../modrinth/ModrinthPackIndex.cpp | 12 ++++----- .../modrinth/ModrinthPackManifest.cpp | 4 +-- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/launcher/modplatform/ResourceAPI.h b/launcher/modplatform/ResourceAPI.h index b7364d9ab..17274722d 100644 --- a/launcher/modplatform/ResourceAPI.h +++ b/launcher/modplatform/ResourceAPI.h @@ -73,7 +73,7 @@ class ResourceAPI { std::optional search; std::optional sorting; std::optional loaders; - std::optional > versions; + std::optional> versions; std::optional side; std::optional categoryIds; }; @@ -168,11 +168,23 @@ class ResourceAPI { protected: [[nodiscard]] inline QString debugName() const { return "External resource API"; } - [[nodiscard]] inline auto getGameVersionsString(std::list mcVersions) const -> QString + [[nodiscard]] inline QString mapMCVersionToModrinth(Version v) const + { + static const QString preString = " Pre-Release "; + auto verStr = v.toString(); + + if (verStr.contains(preString)) { + verStr.replace(preString, "-pre"); + } + verStr.replace(" ", "-"); + return verStr; + } + + [[nodiscard]] inline QString getGameVersionsString(std::list mcVersions) const { QString s; for (auto& ver : mcVersions) { - s += QString("\"%1\",").arg(ver.toString()); + s += QString("\"%1\",").arg(mapMCVersionToModrinth(ver)); } s.remove(s.length() - 1, 1); // remove last comma return s; diff --git a/launcher/modplatform/modrinth/ModrinthAPI.cpp b/launcher/modplatform/modrinth/ModrinthAPI.cpp index a954f65a5..bdef1a0e5 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.cpp +++ b/launcher/modplatform/modrinth/ModrinthAPI.cpp @@ -54,7 +54,7 @@ Task::Ptr ModrinthAPI::latestVersion(QString hash, if (mcVersions.has_value()) { QStringList game_versions; for (auto& ver : mcVersions.value()) { - game_versions.append(ver.toString()); + game_versions.append(mapMCVersionToModrinth(ver)); } Json::writeStringList(body_obj, "game_versions", game_versions); } @@ -87,7 +87,7 @@ Task::Ptr ModrinthAPI::latestVersions(const QStringList& hashes, if (mcVersions.has_value()) { QStringList game_versions; for (auto& ver : mcVersions.value()) { - game_versions.append(ver.toString()); + game_versions.append(mapMCVersionToModrinth(ver)); } Json::writeStringList(body_obj, "game_versions", game_versions); } diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 43fa956e6..4c82a5ec6 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -81,6 +81,21 @@ class ModrinthAPI : public NetworkResourceAPI { return {}; } + [[nodiscard]] static inline QString mapMCVersionFromModrinth(QString v) + { + static const QString preString = " Pre-Release "; + bool pre = false; + if (v.contains("-pre")) { + pre = true; + v.replace("-pre", preString); + } + v.replace("-", " "); + if (pre) { + v.replace(" Pre Release ", preString); + } + return v; + } + private: [[nodiscard]] static QString resourceTypeParameter(ModPlatform::ResourceType type) { @@ -168,16 +183,9 @@ class ModrinthAPI : public NetworkResourceAPI { QString getGameVersionsArray(std::list mcVersions) const { - static const QString preString = " Pre-Release "; QString s; for (auto& ver : mcVersions) { - auto verStr = ver.toString(); - - if (verStr.contains(preString)) { - verStr.replace(preString, "-pre"); - } - verStr.replace(" ", "-"); - s += QString("\"versions:%1\",").arg(verStr); + s += QString("\"versions:%1\",").arg(mapMCVersionToModrinth(ver)); } s.remove(s.length() - 1, 1); // remove last comma return s.isEmpty() ? QString() : s; @@ -194,7 +202,7 @@ class ModrinthAPI : public NetworkResourceAPI { : QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]") .arg(BuildConfig.MODRINTH_PROD_URL) .arg(args.dependency.addonId.toString()) - .arg(args.mcVersion.toString()) + .arg(mapMCVersionToModrinth(args.mcVersion)) .arg(getModLoaderStrings(args.loader).join("\",\"")); }; }; diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp index 48b27a597..72550937c 100644 --- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp @@ -131,9 +131,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArra pack.versionsLoaded = true; } -auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, - QString preferred_hash_type, - QString preferred_file_name) -> ModPlatform::IndexedVersion +ModPlatform::IndexedVersion Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_type, QString preferred_file_name) { ModPlatform::IndexedVersion file; @@ -145,7 +143,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, return {}; } for (auto mcVer : versionArray) { - file.mcVersion.append(mcVer.toString()); + file.mcVersion.append(ModrinthAPI::mapMCVersionFromModrinth(mcVer.toString())); } auto loaders = Json::requireArray(obj, "loaders"); for (auto loader : loaders) { @@ -247,9 +245,9 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, return {}; } -auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, - QJsonArray& arr, - const BaseInstance* inst) -> ModPlatform::IndexedVersion +ModPlatform::IndexedVersion Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, + QJsonArray& arr, + const BaseInstance* inst) { auto profile = (dynamic_cast(inst))->getPackProfile(); QString mcVersion = profile->getComponentVersion("net.minecraft"); diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp index c52a1743b..89ef6e4c4 100644 --- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp @@ -40,9 +40,6 @@ #include "modplatform/modrinth/ModrinthAPI.h" -#include "minecraft/MinecraftInstance.h" -#include "minecraft/PackProfile.h" - #include static ModrinthAPI api; @@ -134,6 +131,7 @@ auto loadIndexedVersion(QJsonObject& obj) -> ModpackVersion auto gameVersions = Json::ensureArray(obj, "game_versions"); if (!gameVersions.isEmpty()) { file.gameVersion = Json::ensureString(gameVersions[0]); + file.gameVersion = ModrinthAPI::mapMCVersionFromModrinth(file.gameVersion); } auto loaders = Json::requireArray(obj, "loaders"); for (auto loader : loaders) { From c7831fd69784e534f8f10641bedb03bef39020eb Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 31 Jan 2025 22:03:57 +0200 Subject: [PATCH 42/83] fix add resource with no instance Signed-off-by: Trial97 (cherry picked from commit c5efe081b4ff9ec81b882e6deabcbfc5be269329) --- launcher/ui/MainWindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 09c47b609..fa920c749 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1027,6 +1027,14 @@ void MainWindow::processURLs(QList urls) continue; } + if (APPLICATION->instances()->count() <= 0) { + CustomMessageBox::selectable(this, tr("No instance!"), + tr("No instance available to add the resource to.\nPlease create a new instance before " + "attempting to install this resource again."), + QMessageBox::Critical) + ->show(); + continue; + } ImportResourceDialog dlg(localFileName, type, this); if (dlg.exec() != QDialog::Accepted) From a37cac6f9b3e9c47bcdaaecc479def8a72e08753 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Thu, 6 Feb 2025 09:35:23 +0200 Subject: [PATCH 43/83] Fixed when game crashes, it doesn't log any time played (#3392) Signed-off-by: Trial97 --- launcher/minecraft/launch/LauncherPartLaunch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index 2e842632a..5a13d18cf 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -171,6 +171,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state) case LoggedProcess::Aborted: case LoggedProcess::Crashed: { m_parent->setPid(-1); + m_parent->instance()->setMinecraftRunning(false); emitFailed(tr("Game crashed.")); return; } From 9616d898d45e88327bf038de730081318287caeb Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 11 Feb 2025 10:59:10 +0200 Subject: [PATCH 44/83] Fix some undefined behaviour Signed-off-by: Trial97 (cherry picked from commit bf1084d7fa6503b65bdb63374e5f92020ae4a3d1) --- CMakeLists.txt | 8 ++++---- launcher/launch/LogModel.h | 6 +++--- launcher/ui/widgets/CheckComboBox.cpp | 16 ++++++++-------- launcher/ui/widgets/CheckComboBox.h | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a0ac672b..3753ccab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,14 +113,14 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI else() # AppleClang and Clang message(STATUS "Address Sanitizer available on Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null") endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # GCC message(STATUS "Address Sanitizer available on GCC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover") link_libraries("asan") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") message(STATUS "Address Sanitizer available on MSVC") diff --git a/launcher/launch/LogModel.h b/launcher/launch/LogModel.h index 18e51d7e3..bc08053fb 100644 --- a/launcher/launch/LogModel.h +++ b/launcher/launch/LogModel.h @@ -32,12 +32,12 @@ class LogModel : public QAbstractListModel { private /* types */: struct entry { - MessageLevel::Enum level; - QString line; + MessageLevel::Enum level = MessageLevel::Enum::Unknown; + QString line = {}; }; private: /* data */ - QVector m_content; + QVector m_content = {}; int m_maxLines = 1000; // first line in the circular buffer int m_firstLine = 0; diff --git a/launcher/ui/widgets/CheckComboBox.cpp b/launcher/ui/widgets/CheckComboBox.cpp index 41def3ba1..a84e6a8fa 100644 --- a/launcher/ui/widgets/CheckComboBox.cpp +++ b/launcher/ui/widgets/CheckComboBox.cpp @@ -40,7 +40,7 @@ class CheckComboModel : public QIdentityProxyModel { { if (role == Qt::CheckStateRole) { auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString(); - return checked.contains(txt) ? Qt::Checked : Qt::Unchecked; + return m_checked.contains(txt) ? Qt::Checked : Qt::Unchecked; } if (role == Qt::DisplayRole) return QIdentityProxyModel::data(index, Qt::DisplayRole); @@ -50,10 +50,10 @@ class CheckComboModel : public QIdentityProxyModel { { if (role == Qt::CheckStateRole) { auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString(); - if (checked.contains(txt)) { - checked.removeOne(txt); + if (m_checked.contains(txt)) { + m_checked.removeOne(txt); } else { - checked.push_back(txt); + m_checked.push_back(txt); } emit dataChanged(index, index); emit checkStateChanged(); @@ -61,13 +61,13 @@ class CheckComboModel : public QIdentityProxyModel { } return QIdentityProxyModel::setData(index, value, role); } - QStringList getChecked() { return checked; } + QStringList getChecked() { return m_checked; } signals: void checkStateChanged(); private: - QStringList checked; + QStringList m_checked = {}; }; CheckComboBox::CheckComboBox(QWidget* parent) : QComboBox(parent), m_separator(", ") @@ -92,7 +92,7 @@ void CheckComboBox::setSourceModel(QAbstractItemModel* new_model) void CheckComboBox::hidePopup() { - if (!containerMousePress) + if (!m_containerMousePress) QComboBox::hidePopup(); } @@ -138,7 +138,7 @@ bool CheckComboBox::eventFilter(QObject* receiver, QEvent* event) } case QEvent::MouseButtonPress: { auto ev = static_cast(event); - containerMousePress = ev && view()->indexAt(ev->pos()).isValid(); + m_containerMousePress = ev && view()->indexAt(ev->pos()).isValid(); break; } case QEvent::Wheel: diff --git a/launcher/ui/widgets/CheckComboBox.h b/launcher/ui/widgets/CheckComboBox.h index 876c6e3e1..02516982f 100644 --- a/launcher/ui/widgets/CheckComboBox.h +++ b/launcher/ui/widgets/CheckComboBox.h @@ -58,7 +58,7 @@ class CheckComboBox : public QComboBox { void toggleCheckState(int index); private: - QString m_default_text; - QString m_separator; - bool containerMousePress; + QString m_default_text = {}; + QString m_separator = {}; + bool m_containerMousePress = false; }; \ No newline at end of file From 159771f2835ce6d659ab1f6791abf9bcc001e4ef Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 11 Feb 2025 21:02:27 +0200 Subject: [PATCH 45/83] Apply suggestions from code review Co-authored-by: TheKodeToad Signed-off-by: Alexandru Ionut Tripon (cherry picked from commit 1d1a4f1b30837e13ebd99c016af171d79697f22f) --- launcher/launch/LogModel.h | 4 ++-- launcher/ui/widgets/CheckComboBox.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/launch/LogModel.h b/launcher/launch/LogModel.h index bc08053fb..167f74190 100644 --- a/launcher/launch/LogModel.h +++ b/launcher/launch/LogModel.h @@ -33,11 +33,11 @@ class LogModel : public QAbstractListModel { private /* types */: struct entry { MessageLevel::Enum level = MessageLevel::Enum::Unknown; - QString line = {}; + QString line; }; private: /* data */ - QVector m_content = {}; + QVector m_content; int m_maxLines = 1000; // first line in the circular buffer int m_firstLine = 0; diff --git a/launcher/ui/widgets/CheckComboBox.h b/launcher/ui/widgets/CheckComboBox.h index 02516982f..469587762 100644 --- a/launcher/ui/widgets/CheckComboBox.h +++ b/launcher/ui/widgets/CheckComboBox.h @@ -58,7 +58,7 @@ class CheckComboBox : public QComboBox { void toggleCheckState(int index); private: - QString m_default_text = {}; - QString m_separator = {}; + QString m_default_text; + QString m_separator; bool m_containerMousePress = false; }; \ No newline at end of file From 945614015563aaa3a39ab586451670c9d153aea9 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 11 Feb 2025 21:03:04 +0200 Subject: [PATCH 46/83] Update launcher/ui/widgets/CheckComboBox.cpp Signed-off-by: Alexandru Ionut Tripon (cherry picked from commit 22b59e760c0f39749916052b9323e55f4217dd72) --- launcher/ui/widgets/CheckComboBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/widgets/CheckComboBox.cpp b/launcher/ui/widgets/CheckComboBox.cpp index a84e6a8fa..02b629162 100644 --- a/launcher/ui/widgets/CheckComboBox.cpp +++ b/launcher/ui/widgets/CheckComboBox.cpp @@ -67,7 +67,7 @@ class CheckComboModel : public QIdentityProxyModel { void checkStateChanged(); private: - QStringList m_checked = {}; + QStringList m_checked; }; CheckComboBox::CheckComboBox(QWidget* parent) : QComboBox(parent), m_separator(", ") From 05bf9c3689930ccddb2aa1b5f98e0cb0f0b57204 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Feb 2025 20:40:09 +0200 Subject: [PATCH 47/83] make sure if user changes java path also disable java management Signed-off-by: Trial97 (cherry picked from commit 174cddcf42f26b24a5a74ce2eaf4923b5b269d47) --- launcher/ui/widgets/JavaSettingsWidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 6efd3f581..77d673abb 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -171,6 +171,11 @@ void JavaSettingsWidget::setupUi() m_verticalLayout->addSpacerItem(m_verticalSpacer); } }); + connect(m_ui->javaPathTextBox, &QLineEdit::textChanged, [this](QString newValue) { + if (m_instance->settings()->get("JavaPath").toString() != newValue) { + m_instance->settings()->set("AutomaticJava", false); + } + }); } m_verticalLayout->addWidget(m_autoJavaGroupBox); From 1ab6ce42b5c9f3a128bccccb6c9a80f4a611a829 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Feb 2025 20:21:45 +0200 Subject: [PATCH 48/83] add libMangoHud_shim.so to mangohub preloadlist Signed-off-by: Trial97 (cherry picked from commit 9e954548dd702c05fbf33474c9c86f52fb67d4b4) --- launcher/minecraft/MinecraftInstance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index c7f639a61..9500ac002 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -606,6 +606,7 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment() // dlsym variant is only needed for OpenGL and not included in the vulkan layer appendLib("libMangoHud_dlsym.so"); appendLib("libMangoHud_opengl.so"); + appendLib("libMangoHud_shim.so"); preloadList << mangoHudLibString; } From 97180324eebe5d8f375f83580a181f5011ac9bf1 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 17 Feb 2025 16:14:15 +0200 Subject: [PATCH 49/83] make sure if user changes java path also disable java management Signed-off-by: Trial97 --- launcher/ui/pages/instance/InstanceSettingsPage.cpp | 5 +++++ launcher/ui/widgets/JavaSettingsWidget.cpp | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp index cf8d86cd4..af66209de 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp +++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp @@ -93,6 +93,11 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance* inst, QWidget* parent) ui->serverJoinAddress->setEnabled(true); ui->serverJoinAddressButton->setStyleSheet("QRadioButton::indicator { width: 0px; height: 0px; }"); } + connect(ui->javaPathTextBox, &QLineEdit::textChanged, [this](QString newValue) { + if (m_instance->settings()->get("JavaPath").toString() != newValue) { + m_instance->settings()->set("AutomaticJava", false); + } + }); loadSettings(); diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 77d673abb..6efd3f581 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -171,11 +171,6 @@ void JavaSettingsWidget::setupUi() m_verticalLayout->addSpacerItem(m_verticalSpacer); } }); - connect(m_ui->javaPathTextBox, &QLineEdit::textChanged, [this](QString newValue) { - if (m_instance->settings()->get("JavaPath").toString() != newValue) { - m_instance->settings()->set("AutomaticJava", false); - } - }); } m_verticalLayout->addWidget(m_autoJavaGroupBox); From d75b23c0929a0a26478e05f31d094092faddebb2 Mon Sep 17 00:00:00 2001 From: thonkdifferent <41342923+thonkdifferent@users.noreply.github.com> Date: Sun, 16 Feb 2025 19:30:31 +0200 Subject: [PATCH 50/83] Recognize riscv64 as a 64-bit platform Currently PrismLauncher complains about the installed JDK being a 32-bit version, despite it being compiled for 64-bit RISC-V `riscv64`. This PR fixes this issue. Signed-off-by: thonkdifferent <41342923+thonkdifferent@users.noreply.github.com> (cherry picked from commit 8f1750df51668a94ab750dd05345ec5cc4e124c2) --- launcher/java/JavaChecker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/java/JavaChecker.cpp b/launcher/java/JavaChecker.cpp index 772c90e42..07b5d7b40 100644 --- a/launcher/java/JavaChecker.cpp +++ b/launcher/java/JavaChecker.cpp @@ -171,7 +171,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" || os_arch == "aarch64" || os_arch == "arm64"; + bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64" || os_arch == "riscv64"; result.validity = Result::Validity::Valid; result.is_64bit = is_64; From 70db5a2f92c635063501cadb840fd79eb8c765d2 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Fri, 28 Feb 2025 21:04:31 +0000 Subject: [PATCH 51/83] Default to Fusion based Dark/Bright themes on Windows Signed-off-by: TheKodeToad (cherry picked from commit 5261b615d72eb0adbeb9c53e30b73448d722cf11) --- launcher/Application.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 1d5efe7fc..038444b3a 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -156,6 +156,7 @@ #if defined Q_OS_WIN32 #include +#include #include "WindowsConsole.h" #endif @@ -1102,8 +1103,16 @@ bool Application::createSetupWizard() // set default theme after going into theme wizard if (!validIcons) settings()->set("IconTheme", QString("pe_colored")); - if (!validWidgets) - settings()->set("ApplicationTheme", QString("system")); + if (!validWidgets) { +#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + const QString style = + QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ? QStringLiteral("dark") : QStringLiteral("bright"); +#else + const QString style = QStringLiteral("system"); +#endif + + settings()->set("ApplicationTheme", style); + } m_themeManager->applyCurrentlySelectedTheme(true); From b85e53eaf939a23f4308de099eb7bf0e5c3c51d0 Mon Sep 17 00:00:00 2001 From: txtsd Date: Mon, 3 Mar 2025 10:14:06 +0530 Subject: [PATCH 52/83] chore: Update year range Signed-off-by: txtsd (cherry picked from commit f99b7e9ebd17129448aabd630c87e8a15fb2734c) --- COPYING.md | 2 +- program_info/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/COPYING.md b/COPYING.md index 111587060..0ea3437d3 100644 --- a/COPYING.md +++ b/COPYING.md @@ -1,7 +1,7 @@ ## Prism Launcher Prism Launcher - Minecraft Launcher - Copyright (C) 2022-2024 Prism Launcher Contributors + Copyright (C) 2022-2025 Prism Launcher Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index e693d757a..5108730a5 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -14,8 +14,8 @@ set(Launcher_DisplayName "Prism Launcher") set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE) set(Launcher_DisplayName "${Launcher_DisplayName}" PARENT_SCOPE) -set(Launcher_Copyright "© 2022-2024 Prism Launcher Contributors\\n© 2021-2022 PolyMC Contributors\\n© 2012-2021 MultiMC Contributors") -set(Launcher_Copyright_Mac "© 2022-2024 Prism Launcher Contributors, © 2021-2022 PolyMC Contributors and © 2012-2021 MultiMC Contributors" PARENT_SCOPE) +set(Launcher_Copyright "© 2022-2025 Prism Launcher Contributors\\n© 2021-2022 PolyMC Contributors\\n© 2012-2021 MultiMC Contributors") +set(Launcher_Copyright_Mac "© 2022-2025 Prism Launcher Contributors, © 2021-2022 PolyMC Contributors and © 2012-2021 MultiMC Contributors" PARENT_SCOPE) set(Launcher_Copyright "${Launcher_Copyright}" PARENT_SCOPE) set(Launcher_Domain "prismlauncher.org" PARENT_SCOPE) set(Launcher_UserAgent "${Launcher_CommonName}/${Launcher_VERSION_NAME}" PARENT_SCOPE) From c206064976e00a5ca448ba1dbd82ca40ea73ad1b Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 3 Mar 2025 23:55:43 +0200 Subject: [PATCH 53/83] rename some variables Signed-off-by: Trial97 (cherry picked from commit 162bbcfe19e67f23bf8d21142fdad253500a3b64) --- launcher/Application.cpp | 2 +- launcher/Application.h | 4 +- launcher/minecraft/auth/steps/MSAStep.cpp | 48 +++++++++++------------ launcher/minecraft/auth/steps/MSAStep.h | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 038444b3a..348ca1722 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -228,7 +228,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString())); setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT); setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME); - startTime = QDateTime::currentDateTime(); + m_startTime = QDateTime::currentDateTime(); // Don't quit on hiding the last window this->setQuitOnLastWindowClosed(false); diff --git a/launcher/Application.h b/launcher/Application.h index 164ec3a4f..ba26dc607 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -112,7 +112,7 @@ class Application : public QApplication { std::shared_ptr settings() const { return m_settings; } - qint64 timeSinceStart() const { return startTime.msecsTo(QDateTime::currentDateTime()); } + qint64 timeSinceStart() const { return m_startTime.msecsTo(QDateTime::currentDateTime()); } QIcon getThemedIcon(const QString& name); @@ -236,7 +236,7 @@ class Application : public QApplication { bool shouldExitNow() const; private: - QDateTime startTime; + QDateTime m_startTime; shared_qobject_ptr m_network; diff --git a/launcher/minecraft/auth/steps/MSAStep.cpp b/launcher/minecraft/auth/steps/MSAStep.cpp index 151ee4e68..87a0f8f08 100644 --- a/launcher/minecraft/auth/steps/MSAStep.cpp +++ b/launcher/minecraft/auth/steps/MSAStep.cpp @@ -99,29 +99,29 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile )XXX") .arg(BuildConfig.LOGIN_CALLBACK_URL)); - oauth2.setReplyHandler(replyHandler); + m_oauth2.setReplyHandler(replyHandler); } else { - oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this)); + m_oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this)); } - oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize")); - oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token")); - oauth2.setScope("XboxLive.SignIn XboxLive.offline_access"); - oauth2.setClientIdentifier(m_clientId); - oauth2.setNetworkAccessManager(APPLICATION->network().get()); + m_oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize")); + m_oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token")); + m_oauth2.setScope("XboxLive.SignIn XboxLive.offline_access"); + m_oauth2.setClientIdentifier(m_clientId); + m_oauth2.setNetworkAccessManager(APPLICATION->network().get()); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] { - m_data->msaClientID = oauth2.clientIdentifier(); + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] { + m_data->msaClientID = m_oauth2.clientIdentifier(); m_data->msaToken.issueInstant = QDateTime::currentDateTimeUtc(); - m_data->msaToken.notAfter = oauth2.expirationAt(); - m_data->msaToken.extra = oauth2.extraTokens(); - m_data->msaToken.refresh_token = oauth2.refreshToken(); - m_data->msaToken.token = oauth2.token(); + m_data->msaToken.notAfter = m_oauth2.expirationAt(); + m_data->msaToken.extra = m_oauth2.extraTokens(); + m_data->msaToken.refresh_token = m_oauth2.refreshToken(); + m_data->msaToken.token = m_oauth2.token(); emit finished(AccountTaskState::STATE_WORKING, tr("Got ")); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) { + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser); + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) { auto state = AccountTaskState::STATE_FAILED_HARD; - if (oauth2.status() == QAbstractOAuth::Status::Granted || silent) { + if (m_oauth2.status() == QAbstractOAuth::Status::Granted || silent) { if (err == QAbstractOAuth2::Error::NetworkError) { state = AccountTaskState::STATE_OFFLINE; } else { @@ -135,16 +135,16 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile qWarning() << message; emit finished(state, message); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::error, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::error, this, [this](const QString& error, const QString& errorDescription, const QUrl& uri) { qWarning() << "Failed to login because" << error << errorDescription; emit finished(AccountTaskState::STATE_FAILED_HARD, errorDescription); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this, [this](const QVariantMap& tokens) { m_data->msaToken.extra = tokens; }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this, [this](const QString& clientIdentifier) { m_data->msaClientID = clientIdentifier; }); } @@ -165,20 +165,20 @@ void MSAStep::perform() emit finished(AccountTaskState::STATE_DISABLED, tr("Microsoft user authentication failed - refresh token is empty.")); return; } - oauth2.setRefreshToken(m_data->msaToken.refresh_token); - oauth2.refreshAccessToken(); + m_oauth2.setRefreshToken(m_data->msaToken.refresh_token); + m_oauth2.refreshAccessToken(); } else { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // QMultiMap param changed in 6.0 - oauth2.setModifyParametersFunction( + m_oauth2.setModifyParametersFunction( [](QAbstractOAuth::Stage stage, QMultiMap* map) { map->insert("prompt", "select_account"); }); #else - oauth2.setModifyParametersFunction( + m_oauth2.setModifyParametersFunction( [](QAbstractOAuth::Stage stage, QMap* map) { map->insert("prompt", "select_account"); }); #endif *m_data = AccountData(); m_data->msaClientID = m_clientId; - oauth2.grant(); + m_oauth2.grant(); } } diff --git a/launcher/minecraft/auth/steps/MSAStep.h b/launcher/minecraft/auth/steps/MSAStep.h index 675cfb2ca..2f4e7812b 100644 --- a/launcher/minecraft/auth/steps/MSAStep.h +++ b/launcher/minecraft/auth/steps/MSAStep.h @@ -55,5 +55,5 @@ class MSAStep : public AuthStep { private: bool m_silent; QString m_clientId; - QOAuth2AuthorizationCodeFlow oauth2; + QOAuth2AuthorizationCodeFlow m_oauth2; }; From 2bb094a90b23576324d6d9acf0c883d327672bc6 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 3 Mar 2025 23:36:03 +0200 Subject: [PATCH 54/83] fix null mainwindow in case of login on setup Signed-off-by: Trial97 (cherry picked from commit 7db717ee7c503aef3f3b70bbc4becb8c20485897) --- launcher/Application.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 348ca1722..9ecde7bd2 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1179,6 +1179,9 @@ bool Application::event(QEvent* event) #endif if (event->type() == QEvent::FileOpen) { + if (!m_mainWindow) { + showMainWindow(false); + } auto ev = static_cast(event); m_mainWindow->processURLs({ ev->url() }); } @@ -1312,6 +1315,9 @@ void Application::messageReceived(const QByteArray& message) qWarning() << "Received" << command << "message without a zip path/URL."; return; } + if (!m_mainWindow) { + showMainWindow(false); + } m_mainWindow->processURLs({ normalizeImportUrl(url) }); } else if (command == "launch") { QString id = received.args["id"]; From fc639c090217c515f826c2257ccddea762816619 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 5 Mar 2025 13:06:29 +0200 Subject: [PATCH 55/83] fix beginResetModel called before endResetModel Signed-off-by: Trial97 (cherry picked from commit c441ae05df58eecf315c1379962a59d52c263f14) --- launcher/VersionProxyModel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/VersionProxyModel.cpp b/launcher/VersionProxyModel.cpp index 12a82f73d..7538ce08c 100644 --- a/launcher/VersionProxyModel.cpp +++ b/launcher/VersionProxyModel.cpp @@ -307,6 +307,7 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel* replacingRaw) if (!replacing) { roles.clear(); filterModel->setSourceModel(replacing); + endResetModel(); return; } From 299cbf8009c8c0ea1cf7bec9c27cb1baa06bc0ed Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 1 Mar 2025 22:45:36 +0200 Subject: [PATCH 56/83] fix mod load with empty gameversions Signed-off-by: Trial97 (cherry picked from commit 29b3eb5cc6fe3ba48a28598222212966bade1444) --- launcher/modplatform/flame/FileResolvingTask.cpp | 2 ++ launcher/modplatform/flame/FlameModIndex.cpp | 3 --- launcher/modplatform/flame/PackManifest.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp index d69bf12c0..8ee599f27 100644 --- a/launcher/modplatform/flame/FileResolvingTask.cpp +++ b/launcher/modplatform/flame/FileResolvingTask.cpp @@ -112,6 +112,8 @@ void Flame::FileResolvingTask::netJobFinished() auto obj = Json::requireObject(file); auto version = FlameMod::loadIndexedPackVersion(obj); auto fileid = version.fileId.toInt(); + Q_ASSERT(fileid != 0); + Q_ASSERT(m_manifest.files.contains(fileid)); m_manifest.files[fileid].version = version; auto url = QUrl(version.downloadUrl, QUrl::TolerantMode); if (!url.isValid() && "sha1" == version.hash_type && !version.hash.isEmpty()) { diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp index 7de05f177..eb5b3cc67 100644 --- a/launcher/modplatform/flame/FlameModIndex.cpp +++ b/launcher/modplatform/flame/FlameModIndex.cpp @@ -105,9 +105,6 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion { auto versionArray = Json::requireArray(obj, "gameVersions"); - if (versionArray.isEmpty()) { - return {}; - } ModPlatform::IndexedVersion file; for (auto mcVer : versionArray) { diff --git a/launcher/modplatform/flame/PackManifest.cpp b/launcher/modplatform/flame/PackManifest.cpp index e576a6a84..278105f4a 100644 --- a/launcher/modplatform/flame/PackManifest.cpp +++ b/launcher/modplatform/flame/PackManifest.cpp @@ -45,7 +45,7 @@ static void loadManifestV1(Flame::Manifest& pack, QJsonObject& manifest) Flame::File file; loadFileV1(file, obj); - + Q_ASSERT(file.projectId != 0); pack.files.insert(file.fileId, file); } From 190d17acd3b694c91400e7dd68ce5ce57d22e3f3 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Mar 2025 00:01:45 +0200 Subject: [PATCH 57/83] Fix crash with invalid quilt mod info Signed-off-by: Trial97 (cherry picked from commit 0626e354a026f9a2a35a4d6e28a0af105cb22986) --- .../minecraft/mod/tasks/LocalModParseTask.cpp | 134 +++++++++--------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 7417dffe6..872b6f8bd 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -293,86 +293,90 @@ ModDetails ReadFabricModInfo(QByteArray contents) // https://github.com/QuiltMC/rfcs/blob/master/specification/0002-quilt.mod.json.md ModDetails ReadQuiltModInfo(QByteArray contents) { - QJsonParseError jsonError; - QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError); - auto object = Json::requireObject(jsonDoc, "quilt.mod.json"); - auto schemaVersion = Json::ensureInteger(object.value("schema_version"), 0, "Quilt schema_version"); - ModDetails details; + try { + QJsonParseError jsonError; + QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError); + auto object = Json::requireObject(jsonDoc, "quilt.mod.json"); + auto schemaVersion = Json::ensureInteger(object.value("schema_version"), 0, "Quilt schema_version"); - // https://github.com/QuiltMC/rfcs/blob/be6ba280d785395fefa90a43db48e5bfc1d15eb4/specification/0002-quilt.mod.json.md - if (schemaVersion == 1) { - auto modInfo = Json::requireObject(object.value("quilt_loader"), "Quilt mod info"); + // https://github.com/QuiltMC/rfcs/blob/be6ba280d785395fefa90a43db48e5bfc1d15eb4/specification/0002-quilt.mod.json.md + if (schemaVersion == 1) { + auto modInfo = Json::requireObject(object.value("quilt_loader"), "Quilt mod info"); - details.mod_id = Json::requireString(modInfo.value("id"), "Mod ID"); - details.version = Json::requireString(modInfo.value("version"), "Mod version"); + details.mod_id = Json::requireString(modInfo.value("id"), "Mod ID"); + details.version = Json::requireString(modInfo.value("version"), "Mod version"); - auto modMetadata = Json::ensureObject(modInfo.value("metadata")); + auto modMetadata = Json::ensureObject(modInfo.value("metadata")); - details.name = Json::ensureString(modMetadata.value("name"), details.mod_id); - details.description = Json::ensureString(modMetadata.value("description")); + details.name = Json::ensureString(modMetadata.value("name"), details.mod_id); + details.description = Json::ensureString(modMetadata.value("description")); - auto modContributors = Json::ensureObject(modMetadata.value("contributors")); + auto modContributors = Json::ensureObject(modMetadata.value("contributors")); - // We don't really care about the role of a contributor here - details.authors += modContributors.keys(); + // We don't really care about the role of a contributor here + details.authors += modContributors.keys(); - auto modContact = Json::ensureObject(modMetadata.value("contact")); + auto modContact = Json::ensureObject(modMetadata.value("contact")); - if (modContact.contains("homepage")) { - details.homeurl = Json::requireString(modContact.value("homepage")); - } - if (modContact.contains("issues")) { - details.issue_tracker = Json::requireString(modContact.value("issues")); - } + if (modContact.contains("homepage")) { + details.homeurl = Json::requireString(modContact.value("homepage")); + } + if (modContact.contains("issues")) { + details.issue_tracker = Json::requireString(modContact.value("issues")); + } - if (modMetadata.contains("license")) { - auto license = modMetadata.value("license"); - if (license.isArray()) { - for (auto l : license.toArray()) { - if (l.isString()) { - details.licenses.append(ModLicense(l.toString())); - } else if (l.isObject()) { - auto obj = l.toObject(); - details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(), - obj.value("url").toString(), obj.value("description").toString())); + if (modMetadata.contains("license")) { + auto license = modMetadata.value("license"); + if (license.isArray()) { + for (auto l : license.toArray()) { + if (l.isString()) { + details.licenses.append(ModLicense(l.toString())); + } else if (l.isObject()) { + auto obj = l.toObject(); + details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(), + obj.value("url").toString(), obj.value("description").toString())); + } } + } else if (license.isString()) { + details.licenses.append(ModLicense(license.toString())); + } else if (license.isObject()) { + auto obj = license.toObject(); + details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(), + obj.value("url").toString(), obj.value("description").toString())); + } + } + + if (modMetadata.contains("icon")) { + auto icon = modMetadata.value("icon"); + if (icon.isObject()) { + auto obj = icon.toObject(); + // take the largest icon + int largest = 0; + for (auto key : obj.keys()) { + auto size = key.split('x').first().toInt(); + if (size > largest) { + largest = size; + } + } + if (largest > 0) { + auto key = QString::number(largest) + "x" + QString::number(largest); + details.icon_file = obj.value(key).toString(); + } else { // parsing the sizes failed + // take the first + for (auto i : obj) { + details.icon_file = i.toString(); + break; + } + } + } else if (icon.isString()) { + details.icon_file = icon.toString(); } - } else if (license.isString()) { - details.licenses.append(ModLicense(license.toString())); - } else if (license.isObject()) { - auto obj = license.toObject(); - details.licenses.append(ModLicense(obj.value("name").toString(), obj.value("id").toString(), obj.value("url").toString(), - obj.value("description").toString())); } } - if (modMetadata.contains("icon")) { - auto icon = modMetadata.value("icon"); - if (icon.isObject()) { - auto obj = icon.toObject(); - // take the largest icon - int largest = 0; - for (auto key : obj.keys()) { - auto size = key.split('x').first().toInt(); - if (size > largest) { - largest = size; - } - } - if (largest > 0) { - auto key = QString::number(largest) + "x" + QString::number(largest); - details.icon_file = obj.value(key).toString(); - } else { // parsing the sizes failed - // take the first - for (auto i : obj) { - details.icon_file = i.toString(); - break; - } - } - } else if (icon.isString()) { - details.icon_file = icon.toString(); - } - } + } catch (const Exception& e) { + qWarning() << "Unable to parse mof info:" << e.cause(); } return details; } From b9d15a47819ff18ec1709ebe74c230f0ae4dd413 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Wed, 12 Mar 2025 00:14:53 +0200 Subject: [PATCH 58/83] Update launcher/minecraft/mod/tasks/LocalModParseTask.cpp Signed-off-by: Alexandru Ionut Tripon (cherry picked from commit 88bdb6541e3a57d6f84e75080dd6d24c1589a73d) --- launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 872b6f8bd..d15bb094f 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -376,7 +376,7 @@ ModDetails ReadQuiltModInfo(QByteArray contents) } } catch (const Exception& e) { - qWarning() << "Unable to parse mof info:" << e.cause(); + qWarning() << "Unable to parse mod info:" << e.cause(); } return details; } From 07604c9271c48cee79d5a2c660c7e4378bb9ae6e Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 23 Mar 2025 14:02:09 +0200 Subject: [PATCH 59/83] fix account help link Signed-off-by: Trial97 (cherry picked from commit a4472406b96faabf2bdb78d152fc0e66bfe4ac63) --- launcher/ui/pages/global/AccountListPage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/AccountListPage.h b/launcher/ui/pages/global/AccountListPage.h index 4f02b7df5..7bd5101c0 100644 --- a/launcher/ui/pages/global/AccountListPage.h +++ b/launcher/ui/pages/global/AccountListPage.h @@ -66,7 +66,7 @@ class AccountListPage : public QMainWindow, public BasePage { return icon; } QString id() const override { return "accounts"; } - QString helpPage() const override { return "/getting-started/adding-an-account"; } + QString helpPage() const override { return "getting-started/adding-an-account"; } void retranslate() override; public slots: From b348114dee8fbb9d0eb808557af484185c2b8650 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 23 Mar 2025 08:52:08 +0200 Subject: [PATCH 60/83] rename variable Signed-off-by: Trial97 (cherry picked from commit 269938dfd866df5918eb44779667142f7a157c22) --- launcher/net/FileSink.cpp | 8 ++++---- launcher/net/FileSink.h | 2 +- launcher/net/MetaCacheSink.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/net/FileSink.cpp b/launcher/net/FileSink.cpp index 95c1a8f44..3f30c5e54 100644 --- a/launcher/net/FileSink.cpp +++ b/launcher/net/FileSink.cpp @@ -54,7 +54,7 @@ Task::State FileSink::init(QNetworkRequest& request) return Task::State::Failed; } - wroteAnyData = false; + m_wroteAnyData = false; m_output_file.reset(new PSaveFile(m_filename)); if (!m_output_file->open(QIODevice::WriteOnly)) { qCCritical(taskNetLogC) << "Could not open " + m_filename + " for writing"; @@ -72,11 +72,11 @@ Task::State FileSink::write(QByteArray& data) qCCritical(taskNetLogC) << "Failed writing into " + m_filename; m_output_file->cancelWriting(); m_output_file.reset(); - wroteAnyData = false; + m_wroteAnyData = false; return Task::State::Failed; } - wroteAnyData = true; + m_wroteAnyData = true; return Task::State::Running; } @@ -100,7 +100,7 @@ Task::State FileSink::finalize(QNetworkReply& reply) // if we wrote any data to the save file, we try to commit the data to the real file. // if it actually got a proper file, we write it even if it was empty - if (gotFile || wroteAnyData) { + if (gotFile || m_wroteAnyData) { // ask validators for data consistency // we only do this for actual downloads, not 'your data is still the same' cache hits if (!finalizeAllValidators(reply)) diff --git a/launcher/net/FileSink.h b/launcher/net/FileSink.h index 272f8ddc3..67c25361c 100644 --- a/launcher/net/FileSink.h +++ b/launcher/net/FileSink.h @@ -58,7 +58,7 @@ class FileSink : public Sink { protected: QString m_filename; - bool wroteAnyData = false; + bool m_wroteAnyData = false; std::unique_ptr m_output_file; }; } // namespace Net diff --git a/launcher/net/MetaCacheSink.cpp b/launcher/net/MetaCacheSink.cpp index 889588a11..432c0c84b 100644 --- a/launcher/net/MetaCacheSink.cpp +++ b/launcher/net/MetaCacheSink.cpp @@ -78,7 +78,7 @@ Task::State MetaCacheSink::finalizeCache(QNetworkReply& reply) { QFileInfo output_file_info(m_filename); - if (wroteAnyData) { + if (m_wroteAnyData) { m_entry->setMD5Sum(m_md5Node->hash().toHex().constData()); } From 9686a3c81c09bd9af64e16f1c1e6385bd1eee0b7 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 23 Mar 2025 08:52:30 +0200 Subject: [PATCH 61/83] fix crash on accessing reseted output Signed-off-by: Trial97 (cherry picked from commit 9ce5587f60d637d48bf20a8b9a40f020898710de) --- launcher/net/FileSink.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/launcher/net/FileSink.cpp b/launcher/net/FileSink.cpp index 3f30c5e54..3a58a4667 100644 --- a/launcher/net/FileSink.cpp +++ b/launcher/net/FileSink.cpp @@ -82,7 +82,9 @@ Task::State FileSink::write(QByteArray& data) Task::State FileSink::abort() { - m_output_file->cancelWriting(); + if (m_output_file) { + m_output_file->cancelWriting(); + } failAllValidators(); return Task::State::Failed; } From 57120e0c9de98caf1cd4eadb97d7e91fb9dd1834 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 23 Mar 2025 14:17:43 +0000 Subject: [PATCH 62/83] Use correct colours for all system themes Signed-off-by: TheKodeToad (cherry picked from commit f08478c7ece0cd4e13b0bc188d0dcb9ea04c3199) --- launcher/ui/themes/SystemTheme.cpp | 16 ++-------------- launcher/ui/themes/SystemTheme.h | 3 +-- launcher/ui/themes/ThemeManager.cpp | 6 ++---- launcher/ui/themes/ThemeManager.h | 1 - 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp index a1674455a..31f6a96ab 100644 --- a/launcher/ui/themes/SystemTheme.cpp +++ b/launcher/ui/themes/SystemTheme.cpp @@ -40,23 +40,11 @@ #include "HintOverrideProxyStyle.h" #include "ThemeManager.h" -SystemTheme::SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme) +SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme) { themeName = isDefaultTheme ? "system" : styleName; widgetTheme = styleName; - colorPalette = palette; -} - -void SystemTheme::apply(bool initial) -{ - // See https://github.com/MultiMC/Launcher/issues/1790 - // or https://github.com/PrismLauncher/PrismLauncher/issues/490 - if (initial) { - QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); - return; - } - - ITheme::apply(initial); + colorPalette = QStyleFactory::create(styleName)->standardPalette(); } QString SystemTheme::id() diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h index 7c260fdc4..195b8e368 100644 --- a/launcher/ui/themes/SystemTheme.h +++ b/launcher/ui/themes/SystemTheme.h @@ -38,9 +38,8 @@ class SystemTheme : public ITheme { public: - SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme); + SystemTheme(const QString& styleName, bool isDefaultTheme); virtual ~SystemTheme() {} - void apply(bool initial) override; QString id() override; QString name() override; diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp index 30a1fe7be..6c50d7409 100644 --- a/launcher/ui/themes/ThemeManager.cpp +++ b/launcher/ui/themes/ThemeManager.cpp @@ -44,8 +44,6 @@ ThemeManager::ThemeManager() m_defaultStyle = style->objectName(); themeDebugLog() << "System theme seems to be:" << m_defaultStyle; - m_defaultPalette = QApplication::palette(); - initializeThemes(); initializeCatPacks(); } @@ -128,7 +126,7 @@ void ThemeManager::initializeIcons() void ThemeManager::initializeWidgets() { themeDebugLog() << "<> Initializing Widget Themes"; - themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique(m_defaultStyle, m_defaultPalette, true)); + themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique(m_defaultStyle, true)); auto darkThemeId = addTheme(std::make_unique()); themeDebugLog() << "Loading Built-in Theme:" << darkThemeId; themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); @@ -141,7 +139,7 @@ void ThemeManager::initializeWidgets() continue; } #endif - themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique(st, m_defaultPalette, false)); + themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique(st, false)); } // TODO: need some way to differentiate same name themes in different subdirectories diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h index a9036107c..9c9e818e5 100644 --- a/launcher/ui/themes/ThemeManager.h +++ b/launcher/ui/themes/ThemeManager.h @@ -69,7 +69,6 @@ class ThemeManager { QDir m_catPacksFolder{ "catpacks" }; std::map> m_catPacks; QString m_defaultStyle; - QPalette m_defaultPalette; LogColors m_logColors; void initializeThemes(); From d0a77df703ba72839bc1458a0cc4af96d10cde1a Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 23 Mar 2025 14:29:58 +0000 Subject: [PATCH 63/83] Try best to avoid regression Signed-off-by: TheKodeToad (cherry picked from commit 513959750f23719b55030cd34b9a8f5b248289c5) --- launcher/ui/themes/SystemTheme.cpp | 12 ++++++++++++ launcher/ui/themes/SystemTheme.h | 1 + 2 files changed, 13 insertions(+) diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp index 31f6a96ab..59644ddde 100644 --- a/launcher/ui/themes/SystemTheme.cpp +++ b/launcher/ui/themes/SystemTheme.cpp @@ -47,6 +47,18 @@ SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme) colorPalette = QStyleFactory::create(styleName)->standardPalette(); } +void SystemTheme::apply(bool initial) +{ + // See https://github.com/MultiMC/Launcher/issues/1790 + // or https://github.com/PrismLauncher/PrismLauncher/issues/490 + if (initial && themeName == "system") { + QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); + return; + } + + ITheme::apply(initial); +} + QString SystemTheme::id() { return themeName; diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h index 195b8e368..09db1a322 100644 --- a/launcher/ui/themes/SystemTheme.h +++ b/launcher/ui/themes/SystemTheme.h @@ -40,6 +40,7 @@ class SystemTheme : public ITheme { public: SystemTheme(const QString& styleName, bool isDefaultTheme); virtual ~SystemTheme() {} + void apply(bool initial) override; QString id() override; QString name() override; From 1425c9801e4cc4a91937f293c4962095a380c49f Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 24 Mar 2025 17:59:53 -0400 Subject: [PATCH 64/83] ci: use bundled linuxdeploy appimage plugin Signed-off-by: Seth Flynn (cherry picked from commit 6ef59fe984777e2620b445a78493afb86074eb8b) --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3361dbd2d..a5a928634 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -251,7 +251,6 @@ jobs: if: runner.os == 'Linux' && matrix.qt_ver != 5 run: | wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" - wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage" wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage" From 88109eaa7117628e9ae0468bd9dc8781d9137190 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 24 Mar 2025 18:16:58 -0400 Subject: [PATCH 65/83] ci: pin appimage tooling Signed-off-by: Seth Flynn (cherry picked from commit 5d5155bb22f9935e17e33008a644736404629928) --- .github/workflows/build.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5a928634..99f4a85dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,6 +65,9 @@ jobs: qt_arch: "" qt_version: "6.5.3" qt_modules: "qt5compat qtimageformats qtnetworkauth" + linuxdeploy_hash: "4648f278ab3ef31f819e67c30d50f462640e5365a77637d7e6f2ad9fd0b4522a linuxdeploy-x86_64.AppImage" + linuxdeploy_qt_hash: "15106be885c1c48a021198e7e1e9a48ce9d02a86dd0a1848f00bdbf3c1c92724 linuxdeploy-plugin-qt-x86_64.AppImage" + appimageupdate_hash: "f1747cf60058e99f1bb9099ee9787d16c10241313b7acec81810ea1b1e568c11 AppImageUpdate-x86_64.AppImage" - os: windows-2022 name: "Windows-MinGW-w64" @@ -249,11 +252,19 @@ jobs: - name: Prepare AppImage (Linux) if: runner.os == 'Linux' && matrix.qt_ver != 5 + env: + APPIMAGEUPDATE_HASH: ${{ matrix.appimageupdate_hash }} + LINUXDEPLOY_HASH: ${{ matrix.linuxdeploy_hash }} + LINUXDEPLOY_QT_HASH: ${{ matrix.linuxdeploy_qt_hash }} run: | - wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" - wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" + wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20250213-2/linuxdeploy-x86_64.AppImage" + wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage" - wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage" + wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/2.0.0-alpha-1-20241225/AppImageUpdate-x86_64.AppImage" + + sha256sum -c - <<< "$LINUXDEPLOY_HASH" + sha256sum -c - <<< "$LINUXDEPLOY_QT_HASH" + sha256sum -c - <<< "$APPIMAGEUPDATE_HASH" sudo apt install libopengl0 libfuse2 From 0f21e01b463c2b03f953773b85c6ba6d32349b8c Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 24 Mar 2025 18:17:26 -0400 Subject: [PATCH 66/83] ci: don't install libfuse2 Signed-off-by: Seth Flynn (cherry picked from commit 671aad88f52e3fbba872e80f2805c0c5c64b7a8d) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99f4a85dc..5476ac431 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,7 +266,7 @@ jobs: sha256sum -c - <<< "$LINUXDEPLOY_QT_HASH" sha256sum -c - <<< "$APPIMAGEUPDATE_HASH" - sudo apt install libopengl0 libfuse2 + sudo apt install libopengl0 - name: Add QT_HOST_PATH var (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' From fcc1e80237a4e6e798eb94729cdebfa3e572e8f7 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 30 Mar 2025 00:46:59 +0200 Subject: [PATCH 67/83] fix themes leak Signed-off-by: Trial97 (cherry picked from commit 5b12d3cfff9092c0364e455c211fc189d87039cd) --- launcher/ui/themes/SystemTheme.cpp | 36 ++++++++++++++++-------------- launcher/ui/themes/SystemTheme.h | 6 ++--- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp index 59644ddde..c755b379b 100644 --- a/launcher/ui/themes/SystemTheme.cpp +++ b/launcher/ui/themes/SystemTheme.cpp @@ -42,16 +42,18 @@ SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme) { - themeName = isDefaultTheme ? "system" : styleName; - widgetTheme = styleName; - colorPalette = QStyleFactory::create(styleName)->standardPalette(); + m_themeName = isDefaultTheme ? "system" : styleName; + m_widgetTheme = styleName; + auto style = QStyleFactory::create(styleName); + m_colorPalette = style->standardPalette(); + delete style; } void SystemTheme::apply(bool initial) { // See https://github.com/MultiMC/Launcher/issues/1790 // or https://github.com/PrismLauncher/PrismLauncher/issues/490 - if (initial && themeName == "system") { + if (initial && m_themeName == "system") { QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); return; } @@ -61,35 +63,35 @@ void SystemTheme::apply(bool initial) QString SystemTheme::id() { - return themeName; + return m_themeName; } QString SystemTheme::name() { - if (themeName.toLower() == "windowsvista") { + if (m_themeName.toLower() == "windowsvista") { return QObject::tr("Windows Vista"); - } else if (themeName.toLower() == "windows") { + } else if (m_themeName.toLower() == "windows") { return QObject::tr("Windows 9x"); - } else if (themeName.toLower() == "windows11") { + } else if (m_themeName.toLower() == "windows11") { return QObject::tr("Windows 11"); - } else if (themeName.toLower() == "system") { + } else if (m_themeName.toLower() == "system") { return QObject::tr("System"); } else { - return themeName; + return m_themeName; } } QString SystemTheme::tooltip() { - if (themeName.toLower() == "windowsvista") { + if (m_themeName.toLower() == "windowsvista") { return QObject::tr("Widget style trying to look like your win32 theme"); - } else if (themeName.toLower() == "windows") { + } else if (m_themeName.toLower() == "windows") { return QObject::tr("Windows 9x inspired widget style"); - } else if (themeName.toLower() == "windows11") { + } else if (m_themeName.toLower() == "windows11") { return QObject::tr("WinUI 3 inspired Qt widget style"); - } else if (themeName.toLower() == "fusion") { + } else if (m_themeName.toLower() == "fusion") { return QObject::tr("The default Qt widget style"); - } else if (themeName.toLower() == "system") { + } else if (m_themeName.toLower() == "system") { return QObject::tr("Your current system theme"); } else { return ""; @@ -98,12 +100,12 @@ QString SystemTheme::tooltip() QString SystemTheme::qtTheme() { - return widgetTheme; + return m_widgetTheme; } QPalette SystemTheme::colorScheme() { - return colorPalette; + return m_colorPalette; } QString SystemTheme::appStyleSheet() diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h index 09db1a322..54404d052 100644 --- a/launcher/ui/themes/SystemTheme.h +++ b/launcher/ui/themes/SystemTheme.h @@ -53,7 +53,7 @@ class SystemTheme : public ITheme { QColor fadeColor() override; private: - QPalette colorPalette; - QString widgetTheme; - QString themeName; + QPalette m_colorPalette; + QString m_widgetTheme; + QString m_themeName; }; From 6de8ed91a3027a6578ae807f97bfbbbee5fa678c Mon Sep 17 00:00:00 2001 From: LAHarbottle <87842870+LAHarbottle@users.noreply.github.com> Date: Sat, 29 Mar 2025 17:17:57 +0000 Subject: [PATCH 68/83] Fix typo in NetRequest.cpp Signed-off-by: LAHarbottle <87842870+LAHarbottle@users.noreply.github.com> (cherry picked from commit 66c6399adedcb52c2b7391cdbf38602f8b2814a6) --- launcher/net/NetRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/net/NetRequest.cpp b/launcher/net/NetRequest.cpp index cf2e72858..310653508 100644 --- a/launcher/net/NetRequest.cpp +++ b/launcher/net/NetRequest.cpp @@ -80,7 +80,7 @@ void NetRequest::executeTask() emit finished(); return; case State::Running: - qCDebug(logCat) << getUid().toString() << "Runninng " << m_url.toString(); + qCDebug(logCat) << getUid().toString() << "Running " << m_url.toString(); break; case State::Inactive: case State::Failed: From 2952b1d6b6f9f0a8e9e806afb9b7f61565b80757 Mon Sep 17 00:00:00 2001 From: sticks Date: Fri, 28 Feb 2025 15:05:30 -0600 Subject: [PATCH 69/83] feat: add updater dialogues Signed-off-by: sticks (cherry picked from commit 998bc660fa97f4527443dd826eede5e8eab23651) --- .../ui/pages/instance/ManagedPackPage.cpp | 38 ++++++++++++------- launcher/ui/pages/instance/ManagedPackPage.h | 2 + 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index a909d10d1..f44e211f6 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -245,7 +245,6 @@ ModrinthManagedPackPage::ModrinthManagedPackPage(BaseInstance* inst, InstanceWin } // MODRINTH - void ModrinthManagedPackPage::parseManagedPack() { qDebug() << "Parsing Modrinth pack"; @@ -338,6 +337,24 @@ void ModrinthManagedPackPage::suggestVersion() ManagedPackPage::suggestVersion(); } +/// @brief Called when the update task has completed. +/// Internally handles the closing of the instance window if the update was successful and shows a message box. +/// @param did_succeed Whether the update task was successful. +void ManagedPackPage::onUpdateTaskCompleted(bool did_succeed) const +{ + // Close the window if the update was successful + if (m_instance_window && did_succeed) { + m_instance_window->close(); + CustomMessageBox::selectable(nullptr, tr("Update Successful"), tr("The instance updated to pack version %1 successfully.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Information) + ->show(); + } else if (!did_succeed) { + CustomMessageBox::selectable(nullptr, tr("Update Failed"), tr("The instance failed to update to pack version %1. -- Please check launcher logs for more information.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Critical) + ->show(); + qWarning() << "onUpdateTaskCompleted: unknown state encountered: did_succeed=" << did_succeed << " m_instance_window=" << m_instance_window; + } + +} + void ModrinthManagedPackPage::update() { auto index = ui->versionsComboBox->currentIndex(); @@ -363,10 +380,9 @@ void ModrinthManagedPackPage::update() extracted->setIcon(m_inst->iconKey()); extracted->setConfirmUpdate(false); + // Run our task then handle the result auto did_succeed = runUpdateTask(extracted); - - if (m_instance_window && did_succeed) - m_instance_window->close(); + onUpdateTaskCompleted(did_succeed); } void ModrinthManagedPackPage::updateFromFile() @@ -386,14 +402,12 @@ void ModrinthManagedPackPage::updateFromFile() extracted->setIcon(m_inst->iconKey()); extracted->setConfirmUpdate(false); + // Run our task then handle the result auto did_succeed = runUpdateTask(extracted); - - if (m_instance_window && did_succeed) - m_instance_window->close(); + onUpdateTaskCompleted(did_succeed); } // FLAME - FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent) : ManagedPackPage(inst, instance_window, parent) { @@ -531,9 +545,7 @@ void FlameManagedPackPage::update() extracted->setConfirmUpdate(false); auto did_succeed = runUpdateTask(extracted); - - if (m_instance_window && did_succeed) - m_instance_window->close(); + onUpdateTaskCompleted(did_succeed); } void FlameManagedPackPage::updateFromFile() @@ -555,8 +567,6 @@ void FlameManagedPackPage::updateFromFile() extracted->setConfirmUpdate(false); auto did_succeed = runUpdateTask(extracted); - - if (m_instance_window && did_succeed) - m_instance_window->close(); + onUpdateTaskCompleted(did_succeed); } #include "ManagedPackPage.moc" diff --git a/launcher/ui/pages/instance/ManagedPackPage.h b/launcher/ui/pages/instance/ManagedPackPage.h index c44f77070..e8d304c6b 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.h +++ b/launcher/ui/pages/instance/ManagedPackPage.h @@ -94,6 +94,8 @@ class ManagedPackPage : public QWidget, public BasePage { BaseInstance* m_inst; bool m_loaded = false; + + void onUpdateTaskCompleted(bool did_succeed) const; }; /** Simple page for when we aren't a managed pack. */ From 25ce20a87792b9d3c7fa4f65438aa7a8933aa0f7 Mon Sep 17 00:00:00 2001 From: Sticks Date: Fri, 28 Feb 2025 21:06:34 -0600 Subject: [PATCH 70/83] fix: Grammar correction in failed message for update dialogues Co-authored-by: TheKodeToad Signed-off-by: Sticks (cherry picked from commit ea5458ed2253a4e8a9ef50d076fe72c57d2cb669) --- launcher/ui/pages/instance/ManagedPackPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index f44e211f6..ce68c24d3 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -348,7 +348,7 @@ void ManagedPackPage::onUpdateTaskCompleted(bool did_succeed) const CustomMessageBox::selectable(nullptr, tr("Update Successful"), tr("The instance updated to pack version %1 successfully.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Information) ->show(); } else if (!did_succeed) { - CustomMessageBox::selectable(nullptr, tr("Update Failed"), tr("The instance failed to update to pack version %1. -- Please check launcher logs for more information.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Critical) + CustomMessageBox::selectable(nullptr, tr("Update Failed"), tr("The instance failed to update to pack version %1. Please check launcher logs for more information.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Critical) ->show(); qWarning() << "onUpdateTaskCompleted: unknown state encountered: did_succeed=" << did_succeed << " m_instance_window=" << m_instance_window; } From b0ee4f6e58a3c0e912568a65ac2170b63beda9d2 Mon Sep 17 00:00:00 2001 From: Sticks Date: Tue, 4 Mar 2025 22:20:40 -0600 Subject: [PATCH 71/83] fix: remove qWarning for unknown state Co-authored-by: TheKodeToad Signed-off-by: Sticks (cherry picked from commit d4e1851e6779d99e3ffde79c7e4e8edb568415ce) --- launcher/ui/pages/instance/ManagedPackPage.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index ce68c24d3..0fccd1d33 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -343,14 +343,15 @@ void ModrinthManagedPackPage::suggestVersion() void ManagedPackPage::onUpdateTaskCompleted(bool did_succeed) const { // Close the window if the update was successful - if (m_instance_window && did_succeed) { - m_instance_window->close(); + if (did_succeed) { + if (m_instance_window != nullptr) + m_instance_window->close(); + CustomMessageBox::selectable(nullptr, tr("Update Successful"), tr("The instance updated to pack version %1 successfully.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Information) ->show(); - } else if (!did_succeed) { + } else { CustomMessageBox::selectable(nullptr, tr("Update Failed"), tr("The instance failed to update to pack version %1. Please check launcher logs for more information.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Critical) ->show(); - qWarning() << "onUpdateTaskCompleted: unknown state encountered: did_succeed=" << did_succeed << " m_instance_window=" << m_instance_window; } } From b5fc23952ea99d7f3eac62714e4937cf9da31074 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 16:41:19 -0400 Subject: [PATCH 72/83] Reapply "refactor(nix): nix-filter -> lib.fileset" After extensive (5 minutes) of testing, it seems we don't actually come across any Nix bugs with lib.fileset! (aside from those inherit to it...but :shrug:) This reverts commit a49a58bc4571f87f42f45bb9eeb1a957d5d12331. Signed-off-by: Seth Flynn (cherry picked from commit 99852c972c6e9fc6a8caca727946a71a85c1672f) --- flake.lock | 39 +++------------------------------------ flake.nix | 4 ---- nix/unwrapped.nix | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 51 deletions(-) diff --git a/flake.lock b/flake.lock index a82e6f65f..d8c7c5248 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "libnbtplusplus": { "flake": false, "locked": { @@ -32,28 +16,13 @@ "type": "github" } }, - "nix-filter": { - "locked": { - "lastModified": 1710156097, - "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "3342559a24e85fc164b295c3444e8a139924675b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1729256560, - "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", + "lastModified": 1743095683, + "narHash": "sha256-gWd4urRoLRe8GLVC/3rYRae1h+xfQzt09xOfb0PaHSk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", + "rev": "5e5402ecbcb27af32284d4a62553c019a3a49ea6", "type": "github" }, "original": { @@ -65,9 +34,7 @@ }, "root": { "inputs": { - "flake-compat": "flake-compat", "libnbtplusplus": "libnbtplusplus", - "nix-filter": "nix-filter", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 54add656d..f8954af23 100644 --- a/flake.nix +++ b/flake.nix @@ -16,8 +16,6 @@ flake = false; }; - nix-filter.url = "github:numtide/nix-filter"; - /* Inputs below this are optional and can be removed @@ -44,7 +42,6 @@ self, nixpkgs, libnbtplusplus, - nix-filter, ... }: let @@ -89,7 +86,6 @@ prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix { inherit libnbtplusplus - nix-filter self ; }; diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index 1b14886ef..f47051287 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -11,7 +11,6 @@ kdePackages, libnbtplusplus, ninja, - nix-filter, self, stripJavaArchivesHook, tomlplusplus, @@ -29,17 +28,18 @@ stdenv.mkDerivation { pname = "prismlauncher-unwrapped"; version = self.shortRev or self.dirtyShortRev or "unknown"; - src = nix-filter.lib { - root = self; - include = [ - "buildconfig" - "cmake" - "launcher" - "libraries" - "program_info" - "tests" - ../COPYING.md + src = lib.fileset.toSource { + root = ../.; + fileset = lib.fileset.unions [ ../CMakeLists.txt + ../COPYING.md + + ../buildconfig + ../cmake + ../launcher + ../libraries + ../program_info + ../tests ]; }; From 80ff62c96d19fa9fe2d4446267ce1cb9cc22459a Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 16:43:49 -0400 Subject: [PATCH 73/83] refactor(nix): pin flake-compat in default.nix Avoids polluting downstream flake.locks Signed-off-by: Seth Flynn (cherry picked from commit c367f48ec99f048f8d4bcaf0634370be33b29c62) --- default.nix | 13 ++++--------- flake.nix | 20 -------------------- nix/README.md | 6 ------ 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/default.nix b/default.nix index 6466507b7..5ecef5590 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,4 @@ -(import ( - let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); - in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } -) { src = ./.; }).defaultNix +(import (fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec.tar.gz"; + sha256 = "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU="; +}) { src = ./.; }).defaultNix diff --git a/flake.nix b/flake.nix index f8954af23..153cf7c77 100644 --- a/flake.nix +++ b/flake.nix @@ -15,26 +15,6 @@ url = "github:PrismLauncher/libnbtplusplus"; flake = false; }; - - /* - Inputs below this are optional and can be removed - - ``` - { - inputs.prismlauncher = { - url = "github:PrismLauncher/PrismLauncher"; - inputs = { - flake-compat.follows = ""; - }; - }; - } - ``` - */ - - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; }; outputs = diff --git a/nix/README.md b/nix/README.md index 8bb658477..041a20519 100644 --- a/nix/README.md +++ b/nix/README.md @@ -44,9 +44,6 @@ Example: # Note that this may break the reproducibility mentioned above, and you might not be able to access the binary cache # # inputs.nixpkgs.follows = "nixpkgs"; - - # This is not required for Flakes - inputs.flake-compat.follows = ""; }; }; @@ -92,9 +89,6 @@ Example: # Note that this may break the reproducibility mentioned above, and you might not be able to access the binary cache # # inputs.nixpkgs.follows = "nixpkgs"; - - # This is not required for Flakes - inputs.flake-compat.follows = ""; }; }; From 87c5b6cc831f5ddfd38fe5307246eea29d79b94d Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 17:11:51 -0400 Subject: [PATCH 74/83] refactor(nix): cleanup flake Signed-off-by: Seth Flynn (cherry picked from commit 32b49ecb84da5683bce42e2e888319f4517f1d53) --- flake.nix | 78 +++++++++++++++++++++++++++++++++++++++++++------- nix/checks.nix | 42 --------------------------- 2 files changed, 67 insertions(+), 53 deletions(-) delete mode 100644 nix/checks.nix diff --git a/flake.nix b/flake.nix index 153cf7c77..ea14f9048 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,8 @@ self, nixpkgs, libnbtplusplus, - ... }: + let inherit (nixpkgs) lib; @@ -35,27 +35,79 @@ forAllSystems = lib.genAttrs systems; nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); in + { checks = forAllSystems ( system: + let - checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; }; + pkgs = nixpkgsFor.${system}; + llvm = pkgs.llvmPackages_19; in - lib.filterAttrs (_: lib.isDerivation) checks' + + { + formatting = + pkgs.runCommand "check-formatting" + { + nativeBuildInputs = with pkgs; [ + deadnix + llvm.clang-tools + markdownlint-cli + nixfmt-rfc-style + statix + ]; + } + '' + cd ${self} + + echo "Running clang-format...." + clang-format --dry-run --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} + + echo "Running deadnix..." + deadnix --fail + + echo "Running markdownlint..." + markdownlint --dot . + + echo "Running nixfmt..." + find -type f -name '*.nix' -exec nixfmt --check {} + + + echo "Running statix" + statix check . + + touch $out + ''; + } ); devShells = forAllSystems ( system: + let pkgs = nixpkgsFor.${system}; + llvm = pkgs.llvmPackages_19; + + packages' = self.packages.${system}; in + { default = pkgs.mkShell { - inputsFrom = [ self.packages.${system}.prismlauncher-unwrapped ]; - buildInputs = with pkgs; [ + inputsFrom = [ packages'.prismlauncher-unwrapped ]; + + nativeBuildInputs = with pkgs; [ ccache - ninja + llvm.clang-tools ]; + + cmakeFlags = packages'.prismlauncher-unwrapped.cmakeFlags ++ [ + "-GNinja" + "-Bbuild" + ]; + + shellHook = '' + cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug + ln -s {build/,}compile_commands.json + ''; }; } ); @@ -75,6 +127,7 @@ packages = forAllSystems ( system: + let pkgs = nixpkgsFor.${system}; @@ -87,6 +140,7 @@ default = prismPackages.prismlauncher; }; in + # Only output them if they're available on the current system lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages ); @@ -94,16 +148,18 @@ # We put these under legacyPackages as they are meant for CI, not end user consumption legacyPackages = forAllSystems ( system: + let - prismPackages = self.packages.${system}; - legacyPackages = self.legacyPackages.${system}; + packages' = self.packages.${system}; + legacyPackages' = self.legacyPackages.${system}; in + { - prismlauncher-debug = prismPackages.prismlauncher.override { - prismlauncher-unwrapped = legacyPackages.prismlauncher-unwrapped-debug; + prismlauncher-debug = packages'.prismlauncher.override { + prismlauncher-unwrapped = legacyPackages'.prismlauncher-unwrapped-debug; }; - prismlauncher-unwrapped-debug = prismPackages.prismlauncher-unwrapped.overrideAttrs { + prismlauncher-unwrapped-debug = packages'.prismlauncher-unwrapped.overrideAttrs { cmakeBuildType = "Debug"; dontStrip = true; }; diff --git a/nix/checks.nix b/nix/checks.nix deleted file mode 100644 index ec219d6f8..000000000 --- a/nix/checks.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - runCommand, - deadnix, - llvmPackages_18, - markdownlint-cli, - nixfmt-rfc-style, - statix, - self, -}: -{ - formatting = - runCommand "check-formatting" - { - nativeBuildInputs = [ - deadnix - llvmPackages_18.clang-tools - markdownlint-cli - nixfmt-rfc-style - statix - ]; - } - '' - cd ${self} - - echo "Running clang-format...." - clang-format --dry-run --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} - - echo "Running deadnix..." - deadnix --fail - - echo "Running markdownlint..." - markdownlint --dot . - - echo "Running nixfmt..." - nixfmt --check . - - echo "Running statix" - statix check . - - touch $out - ''; -} From 5c4bd3db52b927f9a4ccd8cb4f1fe7c7d7a8f374 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 17:19:20 -0400 Subject: [PATCH 75/83] fix(nix): only create compile_commands.json if it doesn't exist Signed-off-by: Seth Flynn (cherry picked from commit 58579539d071c569800ba0370a6d5918de025e33) --- flake.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index ea14f9048..ceb4bad4b 100644 --- a/flake.nix +++ b/flake.nix @@ -105,8 +105,10 @@ ]; shellHook = '' - cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug - ln -s {build/,}compile_commands.json + if [ ! -f compile_commands.json ]; then + cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug + ln -s {build/,}compile_commands.json + fi ''; }; } From 760fbdf54fd561dee40a3b378f0b7ab7cc9e2270 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 18:41:06 -0400 Subject: [PATCH 76/83] build(nix): properly wrap development shell Allows actually running the executables built in the development shell Signed-off-by: Seth Flynn (cherry picked from commit 2d4bc09cb9bec621997e00c23acac0b7cf3e99d7) --- flake.nix | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ceb4bad4b..55d8b0464 100644 --- a/flake.nix +++ b/flake.nix @@ -88,13 +88,35 @@ llvm = pkgs.llvmPackages_19; packages' = self.packages.${system}; + + # Re-use our package wrapper to wrap our development environment + qt-wrapper-env = packages'.prismlauncher.overrideAttrs (old: { + name = "qt-wrapper-env"; + + # Required to use script-based makeWrapper below + strictDeps = true; + + # We don't need/want the unwrapped Prism package + paths = [ ]; + + nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ + # Ensure the wrapper is script based so it can be sourced + pkgs.makeWrapper + ]; + + # Inspired by https://discourse.nixos.org/t/python-qt-woes/11808/10 + buildCommand = '' + makeQtWrapper ${lib.getExe pkgs.runtimeShellPackage} "$out" + sed -i '/^exec/d' "$out" + ''; + }); in { default = pkgs.mkShell { inputsFrom = [ packages'.prismlauncher-unwrapped ]; - nativeBuildInputs = with pkgs; [ + packages = with pkgs; [ ccache llvm.clang-tools ]; @@ -105,6 +127,9 @@ ]; shellHook = '' + echo "Sourcing ${qt-wrapper-env}" + source ${qt-wrapper-env} + if [ ! -f compile_commands.json ]; then cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug ln -s {build/,}compile_commands.json From ddcd61c808329c6fb11f597be8628003a1318121 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 19:01:47 -0400 Subject: [PATCH 77/83] refactor(nix): rely more on setup hooks in dev shell Signed-off-by: Seth Flynn (cherry picked from commit de923a07d8a4b7c9f8cd688b9682587c78116e14) --- flake.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 55d8b0464..339a4026c 100644 --- a/flake.nix +++ b/flake.nix @@ -121,18 +121,18 @@ llvm.clang-tools ]; - cmakeFlags = packages'.prismlauncher-unwrapped.cmakeFlags ++ [ - "-GNinja" - "-Bbuild" - ]; + cmakeBuildType = "Debug"; + cmakeFlags = [ "-GNinja" ] ++ packages'.prismlauncher.cmakeFlags; + dontFixCmake = true; shellHook = '' echo "Sourcing ${qt-wrapper-env}" source ${qt-wrapper-env} if [ ! -f compile_commands.json ]; then - cmake $cmakeFlags -D CMAKE_BUILD_TYPE=Debug - ln -s {build/,}compile_commands.json + cmakeConfigurePhase + cd .. + ln -s "$cmakeBuildDir"/compile_commands.json compile_commands.json fi ''; }; From b02718ee57e625d87b664da33c1903524d9ab4a5 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 19:01:47 -0400 Subject: [PATCH 78/83] chore(nix): add nice welcome message to dev shell Signed-off-by: Seth Flynn (cherry picked from commit 38ec7def324891c5062d9b58c1180d44494f91d1) --- flake.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/flake.nix b/flake.nix index 339a4026c..cf5f656d5 100644 --- a/flake.nix +++ b/flake.nix @@ -89,6 +89,24 @@ packages' = self.packages.${system}; + welcomeMessage = '' + Welcome to the Prism Launcher repository! 🌈 + + We just set some things up for you. To get building, you can run: + + ``` + $ cd "$cmakeBuildDir" + $ ninjaBuildPhase + $ ninjaInstallPhase + ``` + + Feel free to ask any questions in our Discord server or Matrix space: + - https://prismlauncher.org/discord + - https://matrix.to/#/#prismlauncher:matrix.org + + And thanks for helping out :) + ''; + # Re-use our package wrapper to wrap our development environment qt-wrapper-env = packages'.prismlauncher.overrideAttrs (old: { name = "qt-wrapper-env"; @@ -134,6 +152,8 @@ cd .. ln -s "$cmakeBuildDir"/compile_commands.json compile_commands.json fi + + echo ${lib.escapeShellArg welcomeMessage} ''; }; } From da9c3591848de09ad92b1878e90dce99e244d5ea Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 19:01:47 -0400 Subject: [PATCH 79/83] chore(nix): clone git submodules automatically Signed-off-by: Seth Flynn (cherry picked from commit 9b38226f8cb0e2f82bcb017c686fd03520990dd1) --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index cf5f656d5..fd3003bc4 100644 --- a/flake.nix +++ b/flake.nix @@ -147,6 +147,8 @@ echo "Sourcing ${qt-wrapper-env}" source ${qt-wrapper-env} + git submodule update --init --force + if [ ! -f compile_commands.json ]; then cmakeConfigurePhase cd .. From e8bdc72476d499378afcce1fe5ab168e2d479f7c Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 19:19:30 -0400 Subject: [PATCH 80/83] refactor(nix): use date for version Helps avoid needless rebuilds where only the revision changed. Also better conforms to Nixpkgs' version standards Signed-off-by: Seth Flynn (cherry picked from commit e9cac2e0e37c4531f662545bdc45b72499654642) --- nix/unwrapped.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index f47051287..2cd127f99 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -24,9 +24,28 @@ assert lib.assertMsg ( gamemodeSupport -> stdenv.hostPlatform.isLinux ) "gamemodeSupport is only available on Linux."; +let + date = + let + # YYYYMMDD + date' = lib.substring 0 8 self.lastModifiedDate; + year = lib.substring 0 4 date'; + month = lib.substring 4 2 date'; + date = lib.substring 6 2 date'; + in + if (self ? "lastModifiedDate") then + lib.concatStringsSep "-" [ + year + month + date + ] + else + "unknown"; +in + stdenv.mkDerivation { pname = "prismlauncher-unwrapped"; - version = self.shortRev or self.dirtyShortRev or "unknown"; + version = "10.0-unstable-${date}"; src = lib.fileset.toSource { root = ../.; From b228800de1983a76a3890ccf6940bbf1578a9c57 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 30 Mar 2025 19:48:17 -0400 Subject: [PATCH 81/83] chore(gitignore): add more nix-related files Signed-off-by: Seth Flynn (cherry picked from commit de08d7c3644e96a3694f232b53c81f53c40c077a) --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5523f685..1f4e258a3 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,12 @@ run/ # Nix/NixOS .direnv/ -.pre-commit-config.yaml +## Used when manually invoking stdenv phases +outputs/ +## Regular artifacts result +result-* +repl-result-* # Flatpak .flatpak-builder From 83f79c93f83c6ccf51bf2eb7bd11632d7572f57b Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Fri, 4 Apr 2025 05:23:47 -0400 Subject: [PATCH 82/83] chore(nix): set stable version Signed-off-by: Seth Flynn --- nix/unwrapped.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index 2cd127f99..3e91afd89 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -45,7 +45,7 @@ in stdenv.mkDerivation { pname = "prismlauncher-unwrapped"; - version = "10.0-unstable-${date}"; + version = "9.3-unstable-${date}"; src = lib.fileset.toSource { root = ../.; From f00226f79780b4138e0138654ffb2d7279f4ee28 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sun, 6 Apr 2025 06:40:43 -0400 Subject: [PATCH 83/83] fix(SystemTheme): use default palette on all system themes Signed-off-by: Seth Flynn (cherry picked from commit e5861129ad58a8b5cdf55ed69bb9a7ce92811b87) --- launcher/ui/themes/SystemTheme.cpp | 23 ++++++++++++++++------- launcher/ui/themes/SystemTheme.h | 2 +- launcher/ui/themes/ThemeManager.cpp | 6 ++++-- launcher/ui/themes/ThemeManager.h | 1 + 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp index c755b379b..7fba08026 100644 --- a/launcher/ui/themes/SystemTheme.cpp +++ b/launcher/ui/themes/SystemTheme.cpp @@ -40,20 +40,29 @@ #include "HintOverrideProxyStyle.h" #include "ThemeManager.h" -SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme) +// See https://github.com/MultiMC/Launcher/issues/1790 +// or https://github.com/PrismLauncher/PrismLauncher/issues/490 +static const QStringList S_NATIVE_STYLES{ "windows11", "windowsvista", "macos", "system", "windows" }; + +SystemTheme::SystemTheme(const QString& styleName, const QPalette& defaultPalette, bool isDefaultTheme) { m_themeName = isDefaultTheme ? "system" : styleName; m_widgetTheme = styleName; - auto style = QStyleFactory::create(styleName); - m_colorPalette = style->standardPalette(); - delete style; + // NOTE: SystemTheme is reconstructed on page refresh. We can't accurately determine the system palette here + // See also S_NATIVE_STYLES comment + if (S_NATIVE_STYLES.contains(m_themeName)) { + m_colorPalette = defaultPalette; + } else { + auto style = QStyleFactory::create(styleName); + m_colorPalette = style->standardPalette(); + delete style; + } } void SystemTheme::apply(bool initial) { - // See https://github.com/MultiMC/Launcher/issues/1790 - // or https://github.com/PrismLauncher/PrismLauncher/issues/490 - if (initial && m_themeName == "system") { + // See S_NATIVE_STYLES comment + if (initial && S_NATIVE_STYLES.contains(m_themeName)) { QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); return; } diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h index 54404d052..7ae24c3db 100644 --- a/launcher/ui/themes/SystemTheme.h +++ b/launcher/ui/themes/SystemTheme.h @@ -38,7 +38,7 @@ class SystemTheme : public ITheme { public: - SystemTheme(const QString& styleName, bool isDefaultTheme); + SystemTheme(const QString& styleName, const QPalette& defaultPalette, bool isDefaultTheme); virtual ~SystemTheme() {} void apply(bool initial) override; diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp index 6c50d7409..30a1fe7be 100644 --- a/launcher/ui/themes/ThemeManager.cpp +++ b/launcher/ui/themes/ThemeManager.cpp @@ -44,6 +44,8 @@ ThemeManager::ThemeManager() m_defaultStyle = style->objectName(); themeDebugLog() << "System theme seems to be:" << m_defaultStyle; + m_defaultPalette = QApplication::palette(); + initializeThemes(); initializeCatPacks(); } @@ -126,7 +128,7 @@ void ThemeManager::initializeIcons() void ThemeManager::initializeWidgets() { themeDebugLog() << "<> Initializing Widget Themes"; - themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique(m_defaultStyle, true)); + themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique(m_defaultStyle, m_defaultPalette, true)); auto darkThemeId = addTheme(std::make_unique()); themeDebugLog() << "Loading Built-in Theme:" << darkThemeId; themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); @@ -139,7 +141,7 @@ void ThemeManager::initializeWidgets() continue; } #endif - themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique(st, false)); + themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique(st, m_defaultPalette, false)); } // TODO: need some way to differentiate same name themes in different subdirectories diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h index 9c9e818e5..8de7562d1 100644 --- a/launcher/ui/themes/ThemeManager.h +++ b/launcher/ui/themes/ThemeManager.h @@ -68,6 +68,7 @@ class ThemeManager { QDir m_applicationThemeFolder{ "themes" }; QDir m_catPacksFolder{ "catpacks" }; std::map> m_catPacks; + QPalette m_defaultPalette; QString m_defaultStyle; LogColors m_logColors;