diff --git a/launcher/include/profile.h b/launcher/include/profile.h index 112d6a6..0fac726 100644 --- a/launcher/include/profile.h +++ b/launcher/include/profile.h @@ -143,6 +143,13 @@ public: [[nodiscard]] QString dalamudVersion() const; void setDalamudVersion(const QString &version); + /// @brief Sets whether or not the Dalamud version is applicable to the current game version. + /// @note If this is false, Dalamud will not launch. + void setDalamudApplicable(bool applicable); + + /// @return If Dalamud is enabled, and it's also applicable for the current game version. + bool dalamudShouldLaunch() const; + [[nodiscard]] QString compatibilityToolVersion() const; void setCompatibilityToolVersion(const QString &version); @@ -200,6 +207,7 @@ private: int m_dalamudAssetVersion = -1; QString m_runtimeVersion; QString m_compatibilityToolVersion; + bool m_dalamudApplicable = false; bool m_loggedIn = false; diff --git a/launcher/src/assetupdater.cpp b/launcher/src/assetupdater.cpp index eefa9f5..bc70de7 100644 --- a/launcher/src/assetupdater.cpp +++ b/launcher/src/assetupdater.cpp @@ -176,6 +176,9 @@ QCoro::Task AssetUpdater::checkRemoteDalamudVersion() m_remoteRuntimeVersion = doc["runtimeVersion"_L1].toString(); m_remoteDalamudDownloadUrl = doc["downloadUrl"_L1].toString(); + // TODO: Also check supportedGameVer as a fallback + m_profile.setDalamudApplicable(doc["isApplicableForCurrentGameVer"_L1].toBool()); + qInfo(ASTRA_LOG) << "Latest available Dalamud version:" << m_remoteDalamudVersion << "local:" << m_profile.dalamudVersion(); qInfo(ASTRA_LOG) << "Latest available NET runtime:" << m_remoteRuntimeVersion; diff --git a/launcher/src/gamerunner.cpp b/launcher/src/gamerunner.cpp index 366c064..13d89f8 100644 --- a/launcher/src/gamerunner.cpp +++ b/launcher/src/gamerunner.cpp @@ -29,7 +29,7 @@ void GameRunner::beginGameExecutable(Profile &profile, const std::optional> gameArgs; - if (!profile.isBenchmark()) { - gameArgs.push_back({QStringLiteral("DEV.DataPathType"), QString::number(1)}); - gameArgs.push_back({QStringLiteral("DEV.UseSqPack"), QString::number(1)}); - gameArgs.push_back({QStringLiteral("ver"), profile.baseGameVersion()}); - gameArgs.push_back({QStringLiteral("resetconfig"), QStringLiteral("0")}); - } - - if (auth) { - gameArgs.push_back({QStringLiteral("DEV.MaxEntitledExpansionID"), QString::number(auth->maxExpansion)}); - gameArgs.push_back({QStringLiteral("DEV.TestSID"), auth->SID}); - gameArgs.push_back({QStringLiteral("SYS.Region"), QString::number(auth->region)}); - gameArgs.push_back({QStringLiteral("language"), QString::number(profile.account()->language())}); - gameArgs.push_back({QStringLiteral("UserPath"), Utility::toWindowsPath(profile.account()->getConfigDir().absolutePath())}); - - Utility::createPathIfNeeded(profile.account()->getConfigDir().absolutePath()); - } else if (profile.isBenchmark()) { + if (profile.isBenchmark()) { gameArgs.push_back({QStringLiteral("SYS.Language"), QString::number(1)}); gameArgs.push_back({QStringLiteral("SYS.Fps"), QString::number(0)}); gameArgs.push_back({QStringLiteral("SYS.WaterWet_DX11"), QString::number(1)}); @@ -174,6 +159,26 @@ QString GameRunner::getGameArgs(const Profile &profile, const std::optionallanguage())}); + gameArgs.push_back({QStringLiteral("UserPath"), Utility::toWindowsPath(profile.account()->getConfigDir().absolutePath())}); + + Utility::createPathIfNeeded(profile.account()->getConfigDir().absolutePath()); + + if (auth) { + gameArgs.push_back({QStringLiteral("DEV.MaxEntitledExpansionID"), QString::number(auth->maxExpansion)}); + gameArgs.push_back({QStringLiteral("DEV.TestSID"), auth->SID}); + gameArgs.push_back({QStringLiteral("SYS.Region"), QString::number(auth->region)}); + } else { + // fallback just needed to get to the title screen + gameArgs.push_back({QStringLiteral("DEV.MaxEntitledExpansionID"), QString::number(1)}); + gameArgs.push_back({QStringLiteral("DEV.TestSID"), QString::number(1)}); + gameArgs.push_back({QStringLiteral("SYS.Region"), QString::number(1)}); + } } // FIXME: this should belong somewhere else... diff --git a/launcher/src/profile.cpp b/launcher/src/profile.cpp index 05a8f28..80fab33 100644 --- a/launcher/src/profile.cpp +++ b/launcher/src/profile.cpp @@ -556,6 +556,16 @@ void Profile::setDalamudVersion(const QString &version) m_dalamudVersion = version; } +void Profile::setDalamudApplicable(bool applicable) +{ + m_dalamudApplicable = applicable; +} + +bool Profile::dalamudShouldLaunch() const +{ + return dalamudEnabled() && m_dalamudApplicable; +} + QString Profile::compatibilityToolVersion() const { return m_compatibilityToolVersion;