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

Modernize Profile

This commit is contained in:
Joshua Goins 2023-09-17 08:51:26 -04:00
parent c50780e149
commit 8d103c33d8
6 changed files with 176 additions and 95 deletions

View file

@ -56,100 +56,97 @@ public:
enum class DalamudChannel { Stable, Staging, Net5 }; enum class DalamudChannel { Stable, Staging, Net5 };
Q_ENUM(DalamudChannel) Q_ENUM(DalamudChannel)
QString uuid() const; [[nodiscard]] QString uuid() const;
QString name() const; [[nodiscard]] QString name() const;
void setName(const QString &name); void setName(const QString &name);
QString gamePath() const; [[nodiscard]] QString gamePath() const;
void setGamePath(const QString &path); void setGamePath(const QString &path);
QString winePath() const; [[nodiscard]] QString winePath() const;
void setWinePath(const QString &path); void setWinePath(const QString &path);
QString winePrefixPath() const; [[nodiscard]] QString winePrefixPath() const;
void setWinePrefixPath(const QString &path); void setWinePrefixPath(const QString &path);
bool watchdogEnabled() const; [[nodiscard]] bool watchdogEnabled() const;
void setWatchdogEnabled(bool value); void setWatchdogEnabled(bool value);
WineType wineType() const; [[nodiscard]] WineType wineType() const;
void setWineType(WineType type); void setWineType(WineType type);
bool esyncEnabled() const; [[nodiscard]] bool esyncEnabled() const;
void setESyncEnabled(bool value); void setESyncEnabled(bool value);
bool gamescopeEnabled() const; [[nodiscard]] bool gamescopeEnabled() const;
void setGamescopeEnabled(bool value); void setGamescopeEnabled(bool value);
bool gamemodeEnabled() const; [[nodiscard]] bool gamemodeEnabled() const;
void setGamemodeEnabled(bool value); void setGamemodeEnabled(bool value);
bool directx9Enabled() const; [[nodiscard]] bool directx9Enabled() const;
void setDirectX9Enabled(bool value); void setDirectX9Enabled(bool value);
bool gamescopeFullscreen() const; [[nodiscard]] bool gamescopeFullscreen() const;
void setGamescopeFullscreen(bool value); void setGamescopeFullscreen(bool value);
bool gamescopeBorderless() const; [[nodiscard]] bool gamescopeBorderless() const;
void setGamescopeBorderless(bool value); void setGamescopeBorderless(bool value);
int gamescopeWidth() const; [[nodiscard]] int gamescopeWidth() const;
void setGamescopeWidth(int value); void setGamescopeWidth(int value);
int gamescopeHeight() const; [[nodiscard]] int gamescopeHeight() const;
void setGamescopeHeight(int value); void setGamescopeHeight(int value);
int gamescopeRefreshRate() const; [[nodiscard]] int gamescopeRefreshRate() const;
void setGamescopeRefreshRate(int value); void setGamescopeRefreshRate(int value);
bool dalamudEnabled() const; [[nodiscard]] bool dalamudEnabled() const;
void setDalamudEnabled(bool value); void setDalamudEnabled(bool value);
bool dalamudOptOut() const; [[nodiscard]] bool dalamudOptOut() const;
void setDalamudOptOut(bool value); void setDalamudOptOut(bool value);
DalamudChannel dalamudChannel() const; [[nodiscard]] DalamudChannel dalamudChannel() const;
void setDalamudChannel(DalamudChannel channel); void setDalamudChannel(DalamudChannel channel);
bool argumentsEncrypted() const; [[nodiscard]] bool argumentsEncrypted() const;
void setArgumentsEncrypted(bool value); void setArgumentsEncrypted(bool value);
Account *account() const; [[nodiscard]] Account *account() const;
QString accountUuid() const; [[nodiscard]] QString accountUuid() const;
void setAccount(Account *account); void setAccount(Account *account);
void readGameData(); void readGameData();
void readGameVersion(); void readGameVersion();
void readWineInfo(); void readWineInfo();
QVector<QString> expansionNames; [[nodiscard]] QString expansionVersionText() const;
[[nodiscard]] QString dalamudVersionText() const;
[[nodiscard]] QString wineVersionText() const;
BootData *bootData; [[nodiscard]] QString dalamudChannelName() const;
GameData *gameData;
physis_Repositories repositories = {}; [[nodiscard]] bool isGameInstalled() const;
const char *bootVersion = nullptr; [[nodiscard]] bool isWineInstalled() const;
QString dalamudVersion; [[nodiscard]] QString bootVersion() const;
int dalamudAssetVersion = -1; [[nodiscard]] QString baseGameVersion() const;
QString runtimeVersion; [[nodiscard]] int numInstalledExpansions() const;
[[nodiscard]] QString expansionVersion(int index) const;
QString expansionVersionText() const; [[nodiscard]] int dalamudAssetVersion() const;
QString dalamudVersionText() const; void setDalamudAssetVersion(int version);
QString wineVersionText() const;
[[nodiscard]] bool isGameInstalled() const [[nodiscard]] QString runtimeVersion() const;
{
return repositories.repositories_count > 0;
}
[[nodiscard]] bool isWineInstalled() const [[nodiscard]] QString dalamudVersion() const;
{ void setDalamudVersion(const QString &version);
return !m_wineVersion.isEmpty();
}
QString dalamudChannelName() const; BootData *bootData();
GameData *gameData();
Q_SIGNALS: Q_SIGNALS:
void gameInstallChanged(); void gameInstallChanged();
@ -180,5 +177,18 @@ private:
QString m_wineVersion; QString m_wineVersion;
ProfileConfig *m_config = nullptr; ProfileConfig *m_config = nullptr;
Account *m_account = nullptr; Account *m_account = nullptr;
QVector<QString> m_expansionNames;
BootData *m_bootData = nullptr;
GameData *m_gameData = nullptr;
physis_Repositories m_repositories = {};
const char *m_bootVersion = nullptr;
QString m_dalamudVersion;
int m_dalamudAssetVersion = -1;
QString m_runtimeVersion;
LauncherCore &m_launcher; LauncherCore &m_launcher;
}; };

View file

@ -71,7 +71,7 @@ void AssetUpdater::update()
QJsonDocument doc = QJsonDocument::fromJson(reply->readAll()); QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
qInfo() << "Dalamud asset remote version" << doc.object()["Version"].toInt(); qInfo() << "Dalamud asset remote version" << doc.object()["Version"].toInt();
qInfo() << "Dalamud asset local version" << m_profile.dalamudAssetVersion; qInfo() << "Dalamud asset local version" << m_profile.dalamudAssetVersion();
remoteDalamudAssetVersion = doc.object()["Version"].toInt(); remoteDalamudAssetVersion = doc.object()["Version"].toInt();
@ -162,7 +162,7 @@ void AssetUpdater::checkIfDalamudAssetsDone()
if (dalamudAssetNeededFilenames.empty()) { if (dalamudAssetNeededFilenames.empty()) {
qInfo() << "Finished downloading Dalamud assets."; qInfo() << "Finished downloading Dalamud assets.";
m_profile.dalamudAssetVersion = remoteDalamudAssetVersion; m_profile.setDalamudAssetVersion(remoteDalamudAssetVersion);
QFile file(dalamudAssetDir.absoluteFilePath("asset.ver")); QFile file(dalamudAssetDir.absoluteFilePath("asset.ver"));
file.open(QIODevice::WriteOnly | QIODevice::Text); file.open(QIODevice::WriteOnly | QIODevice::Text);
@ -196,7 +196,7 @@ void AssetUpdater::checkIfCheckingIsDone()
Q_EMIT launcher.stageChanged("Starting Dalamud update..."); Q_EMIT launcher.stageChanged("Starting Dalamud update...");
// dalamud injector / net runtime // dalamud injector / net runtime
if (m_profile.runtimeVersion != remoteRuntimeVersion) { if (m_profile.runtimeVersion() != remoteRuntimeVersion) {
needsRuntimeInstall = true; needsRuntimeInstall = true;
// core // core
@ -248,7 +248,7 @@ void AssetUpdater::checkIfCheckingIsDone()
checkIfFinished(); checkIfFinished();
} }
if (remoteDalamudVersion != m_profile.dalamudVersion) { if (remoteDalamudVersion != m_profile.dalamudVersion()) {
qInfo() << "Downloading Dalamud..."; qInfo() << "Downloading Dalamud...";
needsDalamudInstall = true; needsDalamudInstall = true;
@ -268,7 +268,7 @@ void AssetUpdater::checkIfCheckingIsDone()
doneDownloadingDalamud = true; doneDownloadingDalamud = true;
m_profile.dalamudVersion = remoteDalamudVersion; m_profile.setDalamudVersion(remoteDalamudVersion);
checkIfFinished(); checkIfFinished();
}); });
@ -282,7 +282,7 @@ void AssetUpdater::checkIfCheckingIsDone()
} }
// dalamud assets // dalamud assets
if (remoteDalamudAssetVersion != m_profile.dalamudAssetVersion) { if (remoteDalamudAssetVersion != m_profile.dalamudAssetVersion()) {
qInfo() << "Dalamud assets out of date."; qInfo() << "Dalamud assets out of date.";
Q_EMIT launcher.stageChanged("Updating Dalamud assets..."); Q_EMIT launcher.stageChanged("Updating Dalamud assets...");

View file

@ -182,7 +182,7 @@ QString LauncherCore::getGameArgs(const Profile &profile, const LoginAuth &auth)
gameArgs.push_back({QStringLiteral("DEV.TestSID"), auth.SID}); gameArgs.push_back({QStringLiteral("DEV.TestSID"), auth.SID});
gameArgs.push_back({QStringLiteral("SYS.Region"), QString::number(auth.region)}); gameArgs.push_back({QStringLiteral("SYS.Region"), QString::number(auth.region)});
gameArgs.push_back({QStringLiteral("language"), QString::number(profile.account()->language())}); gameArgs.push_back({QStringLiteral("language"), QString::number(profile.account()->language())});
gameArgs.push_back({QStringLiteral("ver"), profile.repositories.repositories[0].version}); gameArgs.push_back({QStringLiteral("ver"), profile.baseGameVersion()});
gameArgs.push_back({QStringLiteral("UserPath"), Utility::toWindowsPath(profile.account()->getConfigDir().absolutePath())}); gameArgs.push_back({QStringLiteral("UserPath"), Utility::toWindowsPath(profile.account()->getConfigDir().absolutePath())});
// FIXME: this should belong somewhere else... // FIXME: this should belong somewhere else...

View file

@ -3,6 +3,7 @@
#include "profile.h" #include "profile.h"
#include <KLocalizedString>
#include <QFile> #include <QFile>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
@ -23,55 +24,55 @@ Profile::Profile(LauncherCore &launcher, const QString &key, QObject *parent)
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
const QDir dalamudDir = dataDir.absoluteFilePath("dalamud"); const QDir dalamudDir = dataDir.absoluteFilePath(QStringLiteral("dalamud"));
if (dalamudDir.exists()) { if (dalamudDir.exists()) {
const QDir dalamudInstallDir = dalamudDir.absoluteFilePath(dalamudChannelName()); const QDir dalamudInstallDir = dalamudDir.absoluteFilePath(dalamudChannelName());
const QDir dalamudAssetsDir = dalamudDir.absoluteFilePath("assets"); const QDir dalamudAssetsDir = dalamudDir.absoluteFilePath(QStringLiteral("assets"));
const QDir dalamudRuntimeDir = dalamudDir.absoluteFilePath("runtime"); const QDir dalamudRuntimeDir = dalamudDir.absoluteFilePath(QStringLiteral("runtime"));
const QString dalamudDepsJson = dalamudInstallDir.absoluteFilePath("Dalamud.deps.json"); const QString dalamudDepsJson = dalamudInstallDir.absoluteFilePath(QStringLiteral("Dalamud.deps.json"));
if (QFile::exists(dalamudDepsJson)) { if (QFile::exists(dalamudDepsJson)) {
QFile depsJson(dalamudDepsJson); QFile depsJson(dalamudDepsJson);
depsJson.open(QFile::ReadOnly); depsJson.open(QFile::ReadOnly);
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll()); QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
QString versionString; QString versionString;
for (auto target : doc["targets"].toObject().keys()) { for (const auto &target : doc[QLatin1String("targets")].toObject().keys()) {
if (target.contains(".NETCoreApp")) { if (target.contains(QLatin1String(".NETCoreApp"))) {
versionString = doc["targets"].toObject()[target].toObject().keys().filter("Dalamud/")[0]; versionString = doc[QLatin1String("targets")].toObject()[target].toObject().keys().filter(QStringLiteral("Dalamud/"))[0];
} }
} }
dalamudVersion = versionString.remove("Dalamud/"); m_dalamudVersion = versionString.remove(QLatin1String("Dalamud/"));
} }
const QString dalamudAssetsVer = dalamudAssetsDir.absoluteFilePath("asset.ver"); const QString dalamudAssetsVer = dalamudAssetsDir.absoluteFilePath(QStringLiteral("asset.ver"));
if (QFile::exists(dalamudAssetsVer)) { if (QFile::exists(dalamudAssetsVer)) {
QFile assetJson(dalamudAssetsVer); QFile assetJson(dalamudAssetsVer);
assetJson.open(QFile::ReadOnly | QFile::Text); assetJson.open(QFile::ReadOnly | QFile::Text);
dalamudAssetVersion = QString(assetJson.readAll()).toInt(); m_dalamudAssetVersion = QString(assetJson.readAll()).toInt();
} }
const QString dalamudRuntimeVer = dalamudRuntimeDir.absoluteFilePath("runtime.ver"); const QString dalamudRuntimeVer = dalamudRuntimeDir.absoluteFilePath(QStringLiteral("runtime.ver"));
if (QFile::exists(dalamudRuntimeVer)) { if (QFile::exists(dalamudRuntimeVer)) {
QFile runtimeVer(dalamudRuntimeVer); QFile runtimeVer(dalamudRuntimeVer);
runtimeVer.open(QFile::ReadOnly | QFile::Text); runtimeVer.open(QFile::ReadOnly | QFile::Text);
runtimeVersion = QString(runtimeVer.readAll()); m_runtimeVersion = QString(runtimeVer.readAll());
} }
} }
} }
void Profile::readGameData() void Profile::readGameData()
{ {
physis_EXH *exh = physis_gamedata_read_excel_sheet_header(gameData, "ExVersion"); physis_EXH *exh = physis_gamedata_read_excel_sheet_header(m_gameData, "ExVersion");
if (exh != nullptr) { if (exh != nullptr) {
physis_EXD exd = physis_gamedata_read_excel_sheet(gameData, "ExVersion", exh, Language::English, 0); physis_EXD exd = physis_gamedata_read_excel_sheet(m_gameData, "ExVersion", exh, Language::English, 0);
for (unsigned int i = 0; i < exd.row_count; i++) { for (unsigned int i = 0; i < exd.row_count; i++) {
expansionNames.push_back(exd.row_data[i].column_data[0].string._0); m_expansionNames.push_back(exd.row_data[i].column_data[0].string._0);
} }
physis_gamedata_free_sheet(exd); physis_gamedata_free_sheet(exd);
@ -103,7 +104,7 @@ void Profile::readWineInfo()
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
switch (wineType()) { switch (wineType()) {
case WineType::System: // system wine (should be in $PATH) case WineType::System: // system wine (should be in $PATH)
setWinePath("wine"); setWinePath(QStringLiteral("wine"));
break; break;
case WineType::Custom: // custom pth case WineType::Custom: // custom pth
default: default:
@ -117,10 +118,10 @@ void Profile::readWineInfo()
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, this] { connect(wineProcess, &QProcess::readyRead, this, [wineProcess, this] {
m_wineVersion = wineProcess->readAllStandardOutput().trimmed(); m_wineVersion = wineProcess->readAllStandardOutput().trimmed();
Q_EMIT wineVersionText(); Q_EMIT wineChanged();
}); });
m_launcher.launchExecutable(*this, wineProcess, {"--version"}, false, false); m_launcher.launchExecutable(*this, wineProcess, {QStringLiteral("--version")}, false, false);
wineProcess->waitForFinished(); wineProcess->waitForFinished();
#endif #endif
@ -416,15 +417,15 @@ void Profile::readGameVersion()
return; return;
} }
gameData = physis_gamedata_initialize((gamePath() + "/game").toStdString().c_str()); m_gameData = physis_gamedata_initialize((gamePath() + QStringLiteral("/game")).toStdString().c_str());
bootData = physis_bootdata_initialize((gamePath() + "/boot").toStdString().c_str()); m_bootData = physis_bootdata_initialize((gamePath() + QStringLiteral("/boot")).toStdString().c_str());
if (bootData != nullptr) { if (m_bootData != nullptr) {
bootVersion = physis_bootdata_get_version(bootData); m_bootVersion = physis_bootdata_get_version(m_bootData);
} }
if (gameData != nullptr) { if (m_gameData != nullptr) {
repositories = physis_gamedata_get_repositories(gameData); m_repositories = physis_gamedata_get_repositories(m_gameData);
readGameData(); readGameData();
} }
@ -439,20 +440,20 @@ QString Profile::accountUuid() const
QString Profile::expansionVersionText() const QString Profile::expansionVersionText() const
{ {
if (!isGameInstalled()) { if (!isGameInstalled()) {
return "No game installed."; return i18n("No game installed.");
} else { } else {
QString expacString; QString expacString;
expacString += "Boot"; expacString += QStringLiteral("Boot");
expacString += QString(" (%1)").arg(bootVersion); expacString += QStringLiteral(" (%1)").arg(m_bootVersion);
for (unsigned int i = 0; i < repositories.repositories_count; i++) { for (unsigned int i = 0; i < m_repositories.repositories_count; i++) {
QString expansionName = "Unknown Expansion"; QString expansionName = i18n("Unknown Expansion");
if (i < static_cast<unsigned int>(expansionNames.size())) { if (i < static_cast<unsigned int>(m_expansionNames.size())) {
expansionName = expansionNames[i]; expansionName = m_expansionNames[i];
} }
expacString += QString("\n%1 (%2)").arg(expansionName, repositories.repositories[i].version); expacString += QStringLiteral("\n%1 (%2)").arg(expansionName, m_repositories.repositories[i].version);
} }
return expacString; return expacString;
@ -462,14 +463,14 @@ QString Profile::expansionVersionText() const
QString Profile::dalamudVersionText() const QString Profile::dalamudVersionText() const
{ {
QString text; QString text;
if (dalamudVersion.isEmpty()) { if (m_dalamudVersion.isEmpty()) {
text += "Dalamud is not installed."; text += i18n("Dalamud is not installed.");
} else { } else {
text += QStringLiteral("Dalamud (%1)").arg(dalamudVersion); text += QStringLiteral("Dalamud (%1)").arg(m_dalamudVersion);
} }
if (dalamudAssetVersion != -1) { if (m_dalamudAssetVersion != -1) {
text += QStringLiteral("\nAssets (%1)").arg(QString::number(dalamudAssetVersion)); text += QStringLiteral("\nAssets (%1)").arg(QString::number(m_dalamudAssetVersion));
} }
return text; return text;
@ -483,11 +484,11 @@ QString Profile::uuid() const
QString Profile::wineVersionText() const QString Profile::wineVersionText() const
{ {
if (m_launcher.isSteam()) { if (m_launcher.isSteam()) {
return "Wine is being managed by Steam."; return i18n("Wine is being managed by Steam.");
} }
if (!isWineInstalled()) { if (!isWineInstalled()) {
return "Wine is not installed."; return i18n("Wine is not installed.");
} else { } else {
return m_wineVersion; return m_wineVersion;
} }
@ -506,3 +507,71 @@ QString Profile::dalamudChannelName() const
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
[[nodiscard]] bool Profile::isGameInstalled() const
{
return m_repositories.repositories_count > 0;
}
[[nodiscard]] bool Profile::isWineInstalled() const
{
return !m_wineVersion.isEmpty();
}
QString Profile::bootVersion() const
{
return m_bootVersion;
}
QString Profile::baseGameVersion() const
{
Q_ASSERT(m_repositories.repositories_count > 1);
return m_repositories.repositories[0].version;
}
int Profile::numInstalledExpansions() const
{
Q_ASSERT(m_repositories.repositories_count > 1);
return m_repositories.repositories_count - 1;
}
QString Profile::expansionVersion(const int index) const
{
Q_ASSERT(index < numInstalledExpansions());
return m_repositories.repositories[index + 1].version;
}
int Profile::dalamudAssetVersion() const
{
return m_dalamudAssetVersion;
}
void Profile::setDalamudAssetVersion(int version)
{
m_dalamudAssetVersion = version;
}
QString Profile::runtimeVersion() const
{
return m_runtimeVersion;
}
QString Profile::dalamudVersion() const
{
return m_dalamudVersion;
}
void Profile::setDalamudVersion(const QString &version)
{
m_dalamudVersion = version;
}
BootData *Profile::bootData()
{
return m_bootData;
}
GameData *Profile::gameData()
{
return m_gameData;
}

View file

@ -32,7 +32,7 @@ QCoro::Task<> SquareBoot::bootCheck(const LoginInformation &info)
QUrl url; QUrl url;
url.setScheme(QStringLiteral("http")); url.setScheme(QStringLiteral("http"));
url.setHost(QStringLiteral("patch-bootver.%1").arg(window.squareEnixServer())); url.setHost(QStringLiteral("patch-bootver.%1").arg(window.squareEnixServer()));
url.setPath(QStringLiteral("/http/win32/ffxivneo_release_boot/%1").arg(info.profile->bootVersion)); url.setPath(QStringLiteral("/http/win32/ffxivneo_release_boot/%1").arg(info.profile->bootVersion()));
url.setQuery(query); url.setQuery(query);
auto request = QNetworkRequest(url); auto request = QNetworkRequest(url);
@ -47,7 +47,7 @@ QCoro::Task<> SquareBoot::bootCheck(const LoginInformation &info)
const auto reply = window.mgr->get(request); const auto reply = window.mgr->get(request);
co_await reply; co_await reply;
patcher = new Patcher(window, info.profile->gamePath() + QStringLiteral("/boot"), *info.profile->bootData, this); patcher = new Patcher(window, info.profile->gamePath() + QStringLiteral("/boot"), *info.profile->bootData(), this);
co_await patcher->patch(reply->readAll()); co_await patcher->patch(reply->readAll());
// update game version information // update game version information

View file

@ -160,7 +160,7 @@ QCoro::Task<> SquareLauncher::registerSession(const LoginInformation &info)
QUrl url; QUrl url;
url.setScheme(QStringLiteral("https")); url.setScheme(QStringLiteral("https"));
url.setHost(QStringLiteral("patch-gamever.%1").arg(window.squareEnixServer())); url.setHost(QStringLiteral("patch-gamever.%1").arg(window.squareEnixServer()));
url.setPath(QStringLiteral("/http/win32/ffxivneo_release_game/%1/%2").arg(info.profile->repositories.repositories[0].version, SID)); url.setPath(QStringLiteral("/http/win32/ffxivneo_release_game/%1/%2").arg(info.profile->baseGameVersion(), SID));
auto request = QNetworkRequest(url); auto request = QNetworkRequest(url);
window.setSSL(request); window.setSSL(request);
@ -168,15 +168,17 @@ QCoro::Task<> SquareLauncher::registerSession(const LoginInformation &info)
request.setRawHeader(QByteArrayLiteral("User-Agent"), QByteArrayLiteral("FFXIV PATCH CLIENT")); request.setRawHeader(QByteArrayLiteral("User-Agent"), QByteArrayLiteral("FFXIV PATCH CLIENT"));
request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded")); request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded"));
QString report = QStringLiteral("%1=%2").arg(info.profile->bootVersion, getBootHash(info)); QString report = QStringLiteral("%1=%2").arg(info.profile->bootVersion(), getBootHash(info));
for (int i = 1; i < auth.maxExpansion + 1; i++) { for (int i = 1; i < auth.maxExpansion + 1; i++) {
if (i < static_cast<int>(info.profile->repositories.repositories_count)) { if (i < static_cast<int>(info.profile->numInstalledExpansions())) {
report += QStringLiteral("\nex%1\t%2").arg(QString::number(i), info.profile->repositories.repositories[i].version); report += QStringLiteral("\nex%1\t%2").arg(QString::number(i), info.profile->expansionVersion(i));
} else { } else {
report += QStringLiteral("\nex%1\t2012.01.01.0000.0000").arg(QString::number(i)); report += QStringLiteral("\nex%1\t2012.01.01.0000.0000").arg(QString::number(i));
} }
} }
qInfo() << report;
const auto reply = window.mgr->post(request, report.toUtf8()); const auto reply = window.mgr->post(request, report.toUtf8());
co_await reply; co_await reply;
@ -184,7 +186,7 @@ QCoro::Task<> SquareLauncher::registerSession(const LoginInformation &info)
if (reply->rawHeaderList().contains(QByteArrayLiteral("X-Patch-Unique-Id"))) { if (reply->rawHeaderList().contains(QByteArrayLiteral("X-Patch-Unique-Id"))) {
const QString body = reply->readAll(); const QString body = reply->readAll();
patcher = new Patcher(window, info.profile->gamePath() + QStringLiteral("/game"), *info.profile->gameData, this); patcher = new Patcher(window, info.profile->gamePath() + QStringLiteral("/game"), *info.profile->gameData(), this);
co_await patcher->patch(body); co_await patcher->patch(body);
info.profile->readGameVersion(); info.profile->readGameVersion();