From c3acd8f44ccec7c1af7754ca516de1d4bae5ec45 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 17 Mar 2025 19:24:43 -0400 Subject: [PATCH] Add a new developer option to disable updates for a specific profile Useful if you want to pin a game install to a specific version or whatever reason. This is a very niche option, so it's hidden behind developer settings. --- launcher/profileconfig.kcfg | 3 +++ launcher/src/squareenixlogin.cpp | 13 ++++++++++++- launcher/ui/Settings/ProfileSettings.qml | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/launcher/profileconfig.kcfg b/launcher/profileconfig.kcfg index c90e572..38f41d4 100644 --- a/launcher/profileconfig.kcfg +++ b/launcher/profileconfig.kcfg @@ -87,5 +87,8 @@ SPDX-License-Identifier: CC0-1.0 false + + true + diff --git a/launcher/src/squareenixlogin.cpp b/launcher/src/squareenixlogin.cpp index 328d970..093a02e 100644 --- a/launcher/src/squareenixlogin.cpp +++ b/launcher/src/squareenixlogin.cpp @@ -195,6 +195,12 @@ QCoro::Task SquareEnixLogin::checkBootUpdates() if (!patchList.isEmpty()) { qDebug(ASTRA_LOG) << "Boot patch list:" << patchList; + if (!m_info->profile->config()->allowPatching()) { + Q_EMIT m_launcher.loginError( + i18n("You require an update to play, but you have the “Allow Updates” option checked - so the login was canceled.")); + co_return false; + } + m_patcher = new Patcher(m_launcher, m_info->profile->config()->gamePath() + QStringLiteral("/boot"), *m_info->profile->bootData(), this); const std::string patchListStd = patchList.toStdString(); const bool hasPatched = co_await m_patcher->patch(physis_parse_patchlist(PatchListType::Boot, patchListStd.c_str())); @@ -398,11 +404,16 @@ QCoro::Task SquareEnixLogin::registerSession() if (!body.isEmpty()) { qDebug(ASTRA_LOG) << "Game patch list:" << body; + if (!m_info->profile->config()->allowPatching()) { + Q_EMIT m_launcher.loginError( + i18n("You require an update to play, but you have the “Allow Updates” option checked - so the login was canceled.")); + co_return false; + } + m_patcher = new Patcher(m_launcher, m_info->profile->config()->gamePath() + QStringLiteral("/game"), *m_info->profile->gameData(), this); std::string bodyStd = body.toStdString(); const bool hasPatched = co_await m_patcher->patch(physis_parse_patchlist(PatchListType::Game, bodyStd.c_str())); m_patcher->deleteLater(); - qInfo() << hasPatched; if (!hasPatched) { co_return false; } diff --git a/launcher/ui/Settings/ProfileSettings.qml b/launcher/ui/Settings/ProfileSettings.qml index 935e049..7d50556 100644 --- a/launcher/ui/Settings/ProfileSettings.qml +++ b/launcher/ui/Settings/ProfileSettings.qml @@ -106,6 +106,21 @@ FormCard.FormCardPage { visible: page.profile.hasDirectx9 } + FormCard.FormSwitchDelegate { + id: allowUpdatesDelegate + + text: i18n("Allow Updating") + description: i18n("If unchecked, Astra won't try to update the game automatically.") + checked: page.profile.config.allowPatching + onCheckedChanged: page.profile.config.allowPatching = checked + visible: LauncherCore.config.showDevTools + } + + FormCard.FormDelegateSeparator { + above: allowUpdatesDelegate + visible: LauncherCore.config.showDevTools + } + FormCard.FormTextDelegate { description: page.profile.expansionVersionText }