1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

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.
This commit is contained in:
Joshua Goins 2025-03-17 19:24:43 -04:00
parent 2466bc5448
commit c3acd8f44c
3 changed files with 30 additions and 1 deletions

View file

@ -87,5 +87,8 @@ SPDX-License-Identifier: CC0-1.0
<entry key="IsBenchmark" type="bool">
<default>false</default>
</entry>
<entry key="AllowPatching" type="bool">
<default>true</default>
</entry>
</group>
</kcfg>

View file

@ -195,6 +195,12 @@ QCoro::Task<bool> 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<bool> 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;
}

View file

@ -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
}