1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-27 14:37:46 +00:00

Check if Dalamud version is applicable to this game version before using

This stops it from trying to launch even though goatcorp said no. The
check is basic but should allow Dawntrail and future expansions to work
without having to toggle Dalamud off manually.
This commit is contained in:
Joshua Goins 2024-06-27 16:38:18 -04:00
parent efac97a376
commit 498391bbb9
4 changed files with 43 additions and 17 deletions

View file

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

View file

@ -176,6 +176,9 @@ QCoro::Task<bool> 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;

View file

@ -29,7 +29,7 @@ void GameRunner::beginGameExecutable(Profile &profile, const std::optional<Login
gameExectuable = profile.gamePath() + QStringLiteral("/game/ffxiv_dx11.exe");
}
if (profile.dalamudEnabled()) {
if (profile.dalamudShouldLaunch()) {
beginDalamudGame(gameExectuable, profile, auth);
} else {
beginVanillaGame(gameExectuable, profile, auth);
@ -127,22 +127,7 @@ QString GameRunner::getGameArgs(const Profile &profile, const std::optional<Logi
{
QList<std::pair<QString, QString>> 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::optional<Logi
gameArgs.push_back({QStringLiteral("SYS.ScreenMode"), QString::number(0)});
gameArgs.push_back({QStringLiteral("SYS.ScreenWidth"), QString::number(1920)});
gameArgs.push_back({QStringLiteral("SYS.ScreenHeight"), QString::number(1080)});
} else {
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")});
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());
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...

View file

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