1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 12:57:45 +00:00

Add update config step to work around some launch issues

This will update the config file on boot to prevent stalls due to the
opening cutscene movie, and also update the screenshot dir.
This commit is contained in:
Joshua Goins 2023-10-11 13:03:23 -04:00
parent 99652708dc
commit e2ad7e71d5
3 changed files with 42 additions and 0 deletions

View file

@ -78,6 +78,8 @@ public:
[[nodiscard]] QDir getConfigDir() const; [[nodiscard]] QDir getConfigDir() const;
void updateConfig();
Q_SIGNALS: Q_SIGNALS:
void nameChanged(); void nameChanged();
void languageChanged(); void languageChanged();

View file

@ -10,6 +10,7 @@
#include <qcorocore.h> #include <qcorocore.h>
#include <qt6keychain/keychain.h> #include <qt6keychain/keychain.h>
#include "astra_log.h"
#include "launchercore.h" #include "launchercore.h"
#include "utility.h" #include "utility.h"
@ -290,3 +291,40 @@ QCoro::Task<QString> Account::getKeychainValue(const QString &key)
co_return job->textData(); co_return job->textData();
} }
void Account::updateConfig()
{
auto configDir = getConfigDir().absoluteFilePath("FFXIV.cfg");
if (!QFile::exists(configDir)) {
return;
}
qInfo(ASTRA_LOG) << "Updating FFXIV.cfg...";
auto configDirStd = configDir.toStdString();
auto cfgFileBuffer = physis_read_file(configDirStd.c_str());
auto cfgFile = physis_cfg_parse(cfgFileBuffer);
// Ensure that the opening cutscene movie never plays, since it's broken in most versions of Wine
physis_cfg_set_value(cfgFile, "CutsceneMovieOpening", "1");
auto screenshotDir = m_launcher.screenshotDir();
if (!QDir().exists(screenshotDir))
QDir().mkpath(screenshotDir);
auto screenshotDirWin = Utility::toWindowsPath(screenshotDir);
auto screenshotDirWinStd = screenshotDirWin.toStdString();
// Set the screenshot path
physis_cfg_set_value(cfgFile, "ScreenShotDir", screenshotDirWinStd.c_str());
auto buffer = physis_cfg_write(cfgFile);
QFile file(configDir);
file.open(QIODevice::WriteOnly);
file.write(reinterpret_cast<const char *>(buffer.data), buffer.size);
file.close();
}

View file

@ -76,6 +76,8 @@ void LauncherCore::launchGame(Profile &profile, const LoginAuth &auth)
QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info) QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info)
{ {
info.profile->account()->updateConfig();
auto assetUpdater = new AssetUpdater(*info.profile, *this, this); auto assetUpdater = new AssetUpdater(*info.profile, *this, this);
if (co_await assetUpdater->update()) { if (co_await assetUpdater->update()) {
if (info.profile->account()->isSapphire()) { if (info.profile->account()->isSapphire()) {