diff --git a/launcher/include/account.h b/launcher/include/account.h index 851adfc..3ba0717 100644 --- a/launcher/include/account.h +++ b/launcher/include/account.h @@ -83,9 +83,6 @@ public: [[nodiscard]] QDir getConfigDir() const; [[nodiscard]] Q_INVOKABLE QString getConfigPath() const; - /// Updates FFXIV.cfg with some recommended options like turning the opening cutscene movie off - void updateConfig(); - [[nodiscard]] bool needsPassword() const; Q_SIGNALS: diff --git a/launcher/include/launchercore.h b/launcher/include/launchercore.h index a41ae45..3052663 100755 --- a/launcher/include/launchercore.h +++ b/launcher/include/launchercore.h @@ -164,6 +164,9 @@ private: QCoro::Task<> handleGameExit(const Profile *profile); + /// Updates FFXIV.cfg with some recommended options like turning the opening cutscene movie off + void updateConfig(const Account *account); + SteamAPI *m_steamApi = nullptr; bool m_loadingFinished = false; diff --git a/launcher/src/account.cpp b/launcher/src/account.cpp index 1ee632c..caaa97e 100644 --- a/launcher/src/account.cpp +++ b/launcher/src/account.cpp @@ -281,43 +281,6 @@ QCoro::Task Account::getKeychainValue(const QString &key) } } -// ReSharper disable once CppMemberFunctionMayBeConst -// ^ Could be const, but this function shouldn't be considered as such -void Account::updateConfig() -{ - const auto configDir = getConfigDir().absoluteFilePath(QStringLiteral("FFXIV.cfg")); - - if (!QFile::exists(configDir)) { - return; - } - - qInfo(ASTRA_LOG) << "Updating FFXIV.cfg..."; - - const auto configDirStd = configDir.toStdString(); - - const auto cfgFileBuffer = physis_read_file(configDirStd.c_str()); - const 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"); - - const auto screenshotDir = m_launcher.settings()->screenshotDir(); - Utility::createPathIfNeeded(screenshotDir); - - const auto screenshotDirWin = Utility::toWindowsPath(screenshotDir); - const auto screenshotDirWinStd = screenshotDirWin.toStdString(); - - // Set the screenshot path - physis_cfg_set_value(cfgFile, "ScreenShotDir", screenshotDirWinStd.c_str()); - - const auto buffer = physis_cfg_write(cfgFile); - - QFile file(configDir); - file.open(QIODevice::WriteOnly); - file.write(reinterpret_cast(buffer.data), buffer.size); - file.close(); -} - bool Account::needsPassword() const { return m_needsPassword; diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index cd3d89f..a70960a 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -440,7 +440,7 @@ QCoro::Task<> LauncherCore::beginLogin(LoginInformation &info) { // Hmm, I don't think we're set up for this yet? if (!info.profile->isBenchmark()) { - info.profile->account()->updateConfig(); + updateConfig(info.profile->account()); } #ifdef BUILD_SYNC @@ -595,4 +595,39 @@ QCoro::Task<> LauncherCore::handleGameExit(const Profile *profile) co_return; } +void LauncherCore::updateConfig(const Account *account) +{ + const auto configDir = account->getConfigDir().absoluteFilePath(QStringLiteral("FFXIV.cfg")); + + if (!QFile::exists(configDir)) { + return; + } + + qInfo(ASTRA_LOG) << "Updating FFXIV.cfg..."; + + const auto configDirStd = configDir.toStdString(); + + const auto cfgFileBuffer = physis_read_file(configDirStd.c_str()); + const 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"); + + const auto screenshotDir = settings()->screenshotDir(); + Utility::createPathIfNeeded(screenshotDir); + + const auto screenshotDirWin = Utility::toWindowsPath(screenshotDir); + const auto screenshotDirWinStd = screenshotDirWin.toStdString(); + + // Set the screenshot path + physis_cfg_set_value(cfgFile, "ScreenShotDir", screenshotDirWinStd.c_str()); + + const auto buffer = physis_cfg_write(cfgFile); + + QFile file(configDir); + file.open(QIODevice::WriteOnly); + file.write(reinterpret_cast(buffer.data), buffer.size); + file.close(); +} + #include "moc_launchercore.cpp" \ No newline at end of file