1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Fix ECM minimum version, update libphysis and fix compilation

This commit is contained in:
Joshua Goins 2023-12-17 10:09:01 -05:00
parent da038c6408
commit a319839611
17 changed files with 52 additions and 51 deletions

View file

@ -21,7 +21,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_MIN_VERSION 6.5) set(QT_MIN_VERSION 6.5)
set(KF_MIN_VERSION 5.240) set(KF_MIN_VERSION 5.240)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs) include(KDEInstallDirs)
@ -49,7 +49,7 @@ find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
WebView WebView
Concurrent Concurrent
Test) Test)
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n Config CoreAddons) find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami I18n Config CoreAddons)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml) find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
qcoro_enable_coroutines() qcoro_enable_coroutines()

2
external/libphysis vendored

@ -1 +1 @@
Subproject commit 36e7baf610bef4c61bcbbaefe1666e6d39516030 Subproject commit ca98182e41ea2e06af831e1613343c7172cfd6ce

View file

@ -137,7 +137,7 @@ target_link_libraries(astra PRIVATE
Qt6::QuickControls2 Qt6::QuickControls2
Qt6::WebView Qt6::WebView
Qt6::Concurrent Qt6::Concurrent
KF6::Kirigami2 KF6::Kirigami
KF6::I18n KF6::I18n
KF6::ConfigCore KF6::ConfigCore
KF6::ConfigGui KF6::ConfigGui

View file

@ -195,7 +195,7 @@ QString Account::getOTP()
char *totp = get_totp(otpSecret.toStdString().c_str(), 6, 30, SHA1, &err); char *totp = get_totp(otpSecret.toStdString().c_str(), 6, 30, SHA1, &err);
if (err == NO_ERROR) { if (err == NO_ERROR) {
QString totpStr(totp); QString totpStr = QString::fromLatin1(totp);
free(totp); free(totp);
return totpStr; return totpStr;
} else { } else {
@ -242,7 +242,7 @@ void Account::fetchAvatar()
connect(reply, &QNetworkReply::finished, [this, filename, reply] { connect(reply, &QNetworkReply::finished, [this, filename, reply] {
auto document = QJsonDocument::fromJson(reply->readAll()); auto document = QJsonDocument::fromJson(reply->readAll());
if (document.isObject()) { if (document.isObject()) {
const QNetworkRequest avatarRequest(document.object()[QLatin1String("Character")].toObject()[QLatin1String("Avatar")].toString()); const QNetworkRequest avatarRequest(QUrl(document.object()[QLatin1String("Character")].toObject()[QLatin1String("Avatar")].toString()));
Utility::printRequest(QStringLiteral("GET"), avatarRequest); Utility::printRequest(QStringLiteral("GET"), avatarRequest);
auto avatarReply = m_launcher.mgr()->get(avatarRequest); auto avatarReply = m_launcher.mgr()->get(avatarRequest);
@ -252,13 +252,13 @@ void Account::fetchAvatar()
file.write(avatarReply->readAll()); file.write(avatarReply->readAll());
file.close(); file.close();
m_url = QStringLiteral("file:///%1").arg(filename); m_url = QUrl(QStringLiteral("file:///%1").arg(filename));
Q_EMIT avatarUrlChanged(); Q_EMIT avatarUrlChanged();
}); });
} }
}); });
} else { } else {
m_url = QStringLiteral("file:///%1").arg(filename); m_url = QUrl(QStringLiteral("file:///%1").arg(filename));
Q_EMIT avatarUrlChanged(); Q_EMIT avatarUrlChanged();
} }
} }
@ -294,7 +294,7 @@ QCoro::Task<QString> Account::getKeychainValue(const QString &key)
void Account::updateConfig() void Account::updateConfig()
{ {
auto configDir = getConfigDir().absoluteFilePath("FFXIV.cfg"); auto configDir = getConfigDir().absoluteFilePath(QStringLiteral("FFXIV.cfg"));
if (!QFile::exists(configDir)) { if (!QFile::exists(configDir)) {
return; return;

View file

@ -139,7 +139,7 @@ QCoro::Task<bool> AssetUpdater::installDalamudAssets()
QFutureSynchronizer<void> synchronizer; QFutureSynchronizer<void> synchronizer;
for (const auto &assetObject : m_remoteDalamudAssetArray) { for (const auto &assetObject : m_remoteDalamudAssetArray) {
const QNetworkRequest assetRequest(assetObject.toObject()[QLatin1String("url")].toString()); const QNetworkRequest assetRequest(QUrl(assetObject.toObject()[QLatin1String("url")].toString()));
Utility::printRequest(QStringLiteral("GET"), assetRequest); Utility::printRequest(QStringLiteral("GET"), assetRequest);
const auto assetReply = launcher.mgr()->get(assetRequest); const auto assetReply = launcher.mgr()->get(assetRequest);
@ -182,7 +182,7 @@ QCoro::Task<bool> AssetUpdater::installDalamud()
{ {
Q_EMIT launcher.stageChanged(i18n("Updating Dalamud...")); Q_EMIT launcher.stageChanged(i18n("Updating Dalamud..."));
const QNetworkRequest request(m_remoteDalamudDownloadUrl); const QNetworkRequest request = QNetworkRequest(QUrl(m_remoteDalamudDownloadUrl));
Utility::printRequest(QStringLiteral("GET"), request); Utility::printRequest(QStringLiteral("GET"), request);
const auto reply = launcher.mgr()->get(request); const auto reply = launcher.mgr()->get(request);

View file

@ -71,14 +71,14 @@ QString encryptGameArg(const QString &arg)
uint8_t *out_data = nullptr; uint8_t *out_data = nullptr;
uint32_t out_size = 0; uint32_t out_size = 0;
QByteArray toEncrypt = (QString(" /T =%1").arg(ticks) + arg).toUtf8(); QByteArray toEncrypt = (QStringLiteral(" /T =%1").arg(ticks) + arg).toUtf8();
physis_blowfish_encrypt(blowfish, reinterpret_cast<uint8_t *>(toEncrypt.data()), toEncrypt.size(), &out_data, &out_size); physis_blowfish_encrypt(blowfish, reinterpret_cast<uint8_t *>(toEncrypt.data()), toEncrypt.size(), &out_data, &out_size);
const QByteArray encryptedArg = QByteArray::fromRawData(reinterpret_cast<const char *>(out_data), static_cast<int>(out_size)); const QByteArray encryptedArg = QByteArray::fromRawData(reinterpret_cast<const char *>(out_data), static_cast<int>(out_size));
const QString base64 = encryptedArg.toBase64(QByteArray::Base64Option::Base64UrlEncoding | QByteArray::Base64Option::KeepTrailingEquals); const QString base64 = QString::fromUtf8(encryptedArg.toBase64(QByteArray::Base64Option::Base64UrlEncoding | QByteArray::Base64Option::KeepTrailingEquals));
const char checksum = GetChecksum(key); const char checksum = GetChecksum(key);
return QString("//**sqex0003%1%2**//").arg(base64, QString(checksum)); return QStringLiteral("//**sqex0003%1%2**//").arg(base64, QString(QLatin1Char(checksum)));
} }

View file

@ -48,7 +48,7 @@ void GameInstaller::installGame()
// TODO: turn into a proper error // TODO: turn into a proper error
Q_ASSERT(hash.result() == installerSha256); Q_ASSERT(hash.result() == installerSha256);
QFile file(dataDir.absoluteFilePath("ffxivsetup.exe")); QFile file(dataDir.absoluteFilePath(QStringLiteral("ffxivsetup.exe")));
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
file.write(data); file.write(data);
file.close(); file.close();

View file

@ -256,9 +256,9 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
} else { } else {
QString version = dirName.remove(QLatin1String("Proton ")); QString version = dirName.remove(QLatin1String("Proton "));
// Exclude "BattlEye Runtime" and other unrelated things // Exclude "BattlEye Runtime" and other unrelated things
if (version.contains('.')) { if (version.contains(QLatin1Char('.'))) {
// TODO: better error handling (they might never be invalid, but better safe than sorry) // TODO: better error handling (they might never be invalid, but better safe than sorry)
QStringList parts = version.split('.'); QStringList parts = version.split(QLatin1Char('.'));
int versionNum = parts[0].toInt(); int versionNum = parts[0].toInt();
// TODO: doesn't handle minor versions, not like they really exist anymore anyway // TODO: doesn't handle minor versions, not like they really exist anymore anyway

View file

@ -175,7 +175,8 @@ void LauncherCore::buildRequest(const Profile &settings, QNetworkRequest &reques
if (settings.account()->license() == Account::GameLicense::macOS) { if (settings.account()->license() == Account::GameLicense::macOS) {
request.setHeader(QNetworkRequest::UserAgentHeader, QByteArrayLiteral("macSQEXAuthor/2.0.0(MacOSX; ja-jp)")); request.setHeader(QNetworkRequest::UserAgentHeader, QByteArrayLiteral("macSQEXAuthor/2.0.0(MacOSX; ja-jp)"));
} else { } else {
request.setHeader(QNetworkRequest::UserAgentHeader, QStringLiteral("SQEXAuthor/2.0.0(Windows 6.2; ja-jp; %1)").arg(QString(QSysInfo::bootUniqueId()))); request.setHeader(QNetworkRequest::UserAgentHeader,
QStringLiteral("SQEXAuthor/2.0.0(Windows 6.2; ja-jp; %1)").arg(QString::fromUtf8(QSysInfo::bootUniqueId())));
} }
request.setRawHeader(QByteArrayLiteral("Accept"), request.setRawHeader(QByteArrayLiteral("Accept"),
@ -295,12 +296,12 @@ QCoro::Task<> LauncherCore::fetchNews()
url.setPath(QStringLiteral("/news/headline.json")); url.setPath(QStringLiteral("/news/headline.json"));
url.setQuery(query); url.setQuery(query);
QNetworkRequest request(QStringLiteral("%1&%2").arg(url.toString(), QString::number(QDateTime::currentMSecsSinceEpoch()))); QNetworkRequest request(QUrl(QStringLiteral("%1&%2").arg(url.toString(), QString::number(QDateTime::currentMSecsSinceEpoch()))));
request.setRawHeader(QByteArrayLiteral("Accept"), QByteArrayLiteral("application/json, text/plain, */*")); request.setRawHeader(QByteArrayLiteral("Accept"), QByteArrayLiteral("application/json, text/plain, */*"));
request.setRawHeader(QByteArrayLiteral("Origin"), QByteArrayLiteral("https://launcher.finalfantasyxiv.com")); request.setRawHeader(QByteArrayLiteral("Origin"), QByteArrayLiteral("https://launcher.finalfantasyxiv.com"));
request.setRawHeader(QByteArrayLiteral("Referer"), request.setRawHeader(QByteArrayLiteral("Referer"),
QStringLiteral("https://launcher.finalfantasyxiv.com/v600/index.html?rc_lang=%1&time=%2") QStringLiteral("https://launcher.finalfantasyxiv.com/v600/index.html?rc_lang=%1&time=%2")
.arg("en-us", QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd-HH")) .arg(QStringLiteral("en-us"), QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH")))
.toUtf8()); .toUtf8());
Utility::printRequest(QStringLiteral("GET"), request); Utility::printRequest(QStringLiteral("GET"), request);

View file

@ -6,7 +6,7 @@
LauncherSettings::LauncherSettings(QObject *parent) LauncherSettings::LauncherSettings(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
m_config = new Config(KSharedConfig::openConfig("astrarc", KConfig::SimpleConfig, QStandardPaths::AppConfigLocation)); m_config = new Config(KSharedConfig::openConfig(QStringLiteral("astrarc"), KConfig::SimpleConfig, QStandardPaths::AppConfigLocation));
} }
bool LauncherSettings::closeWhenLaunched() const bool LauncherSettings::closeWhenLaunched() const

View file

@ -38,7 +38,7 @@ public:
{ {
const QString filename{QStringLiteral("astra.log")}; const QString filename{QStringLiteral("astra.log")};
const QDir logDirectory = Utility::stateDirectory().absoluteFilePath("log"); const QDir logDirectory = Utility::stateDirectory().absoluteFilePath(QStringLiteral("log"));
if (!logDirectory.exists()) { if (!logDirectory.exists()) {
QDir().mkpath(logDirectory.absolutePath()); QDir().mkpath(logDirectory.absolutePath());

View file

@ -50,16 +50,16 @@ int main(int argc, char *argv[])
i18n("Maintainer"), i18n("Maintainer"),
QStringLiteral("josh@redstrate.com"), QStringLiteral("josh@redstrate.com"),
QStringLiteral("https://redstrate.com/"), QStringLiteral("https://redstrate.com/"),
QUrl("https://redstrate.com/rss-image.png")); QUrl(QStringLiteral("https://redstrate.com/rss-image.png")));
about.setHomepage(QStringLiteral("https://xiv.zone/astra")); about.setHomepage(QStringLiteral("https://xiv.zone/astra"));
about.addComponent(QStringLiteral("physis"), about.addComponent(QStringLiteral("physis"),
QStringLiteral("Library to access FFXIV data"), QStringLiteral("Library to access FFXIV data"),
physis_get_physis_version(), QString::fromLatin1(physis_get_physis_version()),
QStringLiteral("https://xiv.zone/physis"), QStringLiteral("https://xiv.zone/physis"),
KAboutLicense::GPL_V3); KAboutLicense::GPL_V3);
about.addComponent(QStringLiteral("libphysis"), about.addComponent(QStringLiteral("libphysis"),
QStringLiteral("C bindings for physis"), QStringLiteral("C bindings for physis"),
physis_get_libphysis_version(), QString::fromLatin1(physis_get_libphysis_version()),
QStringLiteral("https://git.sr.ht/~redstrate/libphysis"), QStringLiteral("https://git.sr.ht/~redstrate/libphysis"),
KAboutLicense::GPL_V3); KAboutLicense::GPL_V3);
about.setDesktopFileName(QStringLiteral("zone.xiv.astra")); about.setDesktopFileName(QStringLiteral("zone.xiv.astra"));
@ -81,11 +81,11 @@ int main(int argc, char *argv[])
about.processCommandLine(&parser); about.processCommandLine(&parser);
// We must handle these manually, since we use parse() and not process() // We must handle these manually, since we use parse() and not process()
if (parser.isSet("help")) { if (parser.isSet(QStringLiteral("help"))) {
parser.showHelp(); parser.showHelp();
} }
if (parser.isSet("version")) { if (parser.isSet(QStringLiteral("version"))) {
parser.showVersion(); parser.showVersion();
} }

View file

@ -90,7 +90,7 @@ QCoro::Task<bool> Patcher::patch(const PatchList &patchList)
m_patchQueue[ourIndex] = queuedPatch; m_patchQueue[ourIndex] = queuedPatch;
if (!QFile::exists(patchPath)) { if (!QFile::exists(patchPath)) {
const auto patchRequest = QNetworkRequest(patch.url); const auto patchRequest = QNetworkRequest(QUrl(patch.url));
Utility::printRequest(QStringLiteral("GET"), patchRequest); Utility::printRequest(QStringLiteral("GET"), patchRequest);
auto patchReply = m_launcher.mgr()->get(patchRequest); auto patchReply = m_launcher.mgr()->get(patchRequest);
@ -167,7 +167,7 @@ void Patcher::processPatch(const QueuedPatch &patch)
QCryptographicHash hash(QCryptographicHash::Sha1); QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData(block); hash.addData(block);
Q_ASSERT(hash.result().toHex() == patch.hashes[i]); Q_ASSERT(QString::fromUtf8(hash.result().toHex()) == patch.hashes[i]);
} }
} }
@ -237,7 +237,7 @@ void Patcher::updateMessage()
} }
const float progress = ((float)patch.bytesDownloaded / (float)patch.length) * 100.0f; const float progress = ((float)patch.bytesDownloaded / (float)patch.length) * 100.0f;
const QString progressStr = QStringLiteral("%1").arg(progress, 1, 'f', 1, '0'); const QString progressStr = QStringLiteral("%1").arg(progress, 1, 'f', 1, QLatin1Char('0'));
Q_EMIT m_launcher.stageChanged(i18n("Downloading %1 - %2 [%3/%4]", repositoryName, patch.version, m_finishedPatches, m_remainingPatches), Q_EMIT m_launcher.stageChanged(i18n("Downloading %1 - %2 [%3/%4]", repositoryName, patch.version, m_finishedPatches, m_remainingPatches),
i18n("%1%", progressStr)); i18n("%1%", progressStr));

View file

@ -8,7 +8,7 @@
PatchList::PatchList(const QString &patchList) PatchList::PatchList(const QString &patchList)
{ {
const QStringList parts = patchList.split("\r\n"); const QStringList parts = patchList.split(QStringLiteral("\r\n"));
for (int i = 5; i < parts.size() - 2; i++) { for (int i = 5; i < parts.size() - 2; i++) {
const QStringList patchParts = parts[i].split(QLatin1Char('\t')); const QStringList patchParts = parts[i].split(QLatin1Char('\t'));

View file

@ -7,7 +7,7 @@
ProcessLogger::ProcessLogger(QProcess *process) ProcessLogger::ProcessLogger(QProcess *process)
{ {
const QDir logDirectory = Utility::stateDirectory().absoluteFilePath("log"); const QDir logDirectory = Utility::stateDirectory().absoluteFilePath(QStringLiteral("log"));
m_file.setFileName(logDirectory.absoluteFilePath(QStringLiteral("ffxiv.log"))); m_file.setFileName(logDirectory.absoluteFilePath(QStringLiteral("ffxiv.log")));
m_file.open(QIODevice::WriteOnly | QIODevice::Unbuffered); m_file.open(QIODevice::WriteOnly | QIODevice::Unbuffered);

View file

@ -57,7 +57,7 @@ void Profile::readDalamudInfo()
QFile assetJson(dalamudAssetsVer); QFile assetJson(dalamudAssetsVer);
assetJson.open(QFile::ReadOnly | QFile::Text); assetJson.open(QFile::ReadOnly | QFile::Text);
m_dalamudAssetVersion = QString(assetJson.readAll()).toInt(); m_dalamudAssetVersion = QString::fromUtf8(assetJson.readAll()).toInt();
qInfo(ASTRA_LOG) << "Dalamud asset version:" << m_dalamudVersion; qInfo(ASTRA_LOG) << "Dalamud asset version:" << m_dalamudVersion;
} }
@ -66,7 +66,7 @@ void Profile::readDalamudInfo()
QFile runtimeVer(dalamudRuntimeVer); QFile runtimeVer(dalamudRuntimeVer);
runtimeVer.open(QFile::ReadOnly | QFile::Text); runtimeVer.open(QFile::ReadOnly | QFile::Text);
m_runtimeVersion = QString(runtimeVer.readAll()); m_runtimeVersion = QString::fromUtf8(runtimeVer.readAll());
qInfo(ASTRA_LOG) << "Dalamud runtime version:" << m_dalamudVersion; qInfo(ASTRA_LOG) << "Dalamud runtime version:" << m_dalamudVersion;
} }
} }
@ -84,7 +84,7 @@ void Profile::readGameData()
physis_EXD exd = physis_gamedata_read_excel_sheet(m_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++) {
m_expansionNames.push_back(exd.row_data[i].column_data[0].string._0); m_expansionNames.push_back(QString::fromLatin1(exd.row_data[i].column_data[0].string._0));
} }
physis_gamedata_free_sheet(exd); physis_gamedata_free_sheet(exd);
@ -98,7 +98,7 @@ void Profile::readWineInfo()
auto wineProcess = new QProcess(this); auto wineProcess = new QProcess(this);
connect(wineProcess, &QProcess::readyReadStandardOutput, this, [wineProcess, this] { connect(wineProcess, &QProcess::readyReadStandardOutput, this, [wineProcess, this] {
m_wineVersion = wineProcess->readAllStandardOutput().trimmed(); m_wineVersion = QString::fromUtf8(wineProcess->readAllStandardOutput().trimmed());
Q_EMIT wineChanged(); Q_EMIT wineChanged();
}); });
@ -409,8 +409,8 @@ void Profile::readGameVersion()
return; return;
} }
m_gameData = physis_gamedata_initialize((gamePath() + QStringLiteral("/game")).toStdString().c_str()); m_gameData = physis_gamedata_initialize(QString(gamePath() + QStringLiteral("/game")).toStdString().c_str());
m_bootData = physis_bootdata_initialize((gamePath() + QStringLiteral("/boot")).toStdString().c_str()); m_bootData = physis_bootdata_initialize(QString(gamePath() + QStringLiteral("/boot")).toStdString().c_str());
if (m_bootData != nullptr) { if (m_bootData != nullptr) {
m_bootVersion = physis_bootdata_get_version(m_bootData); m_bootVersion = physis_bootdata_get_version(m_bootData);
@ -437,7 +437,7 @@ QString Profile::expansionVersionText() const
QString expacString; QString expacString;
expacString += QStringLiteral("Boot"); expacString += QStringLiteral("Boot");
expacString += QStringLiteral(" (%1)").arg(m_bootVersion); expacString += QStringLiteral(" (%1)").arg(QString::fromLatin1(m_bootVersion));
for (unsigned int i = 0; i < m_repositories.repositories_count; i++) { for (unsigned int i = 0; i < m_repositories.repositories_count; i++) {
QString expansionName = i18n("Unknown Expansion"); QString expansionName = i18n("Unknown Expansion");
@ -445,7 +445,7 @@ QString Profile::expansionVersionText() const
expansionName = m_expansionNames[i]; expansionName = m_expansionNames[i];
} }
expacString += QStringLiteral("\n%1 (%2)").arg(expansionName, m_repositories.repositories[i].version); expacString += QStringLiteral("\n%1 (%2)").arg(expansionName, QString::fromLatin1(m_repositories.repositories[i].version));
} }
return expacString; return expacString;
@ -510,13 +510,13 @@ QString Profile::dalamudChannelName() const
QString Profile::bootVersion() const QString Profile::bootVersion() const
{ {
return m_bootVersion; return QString::fromLatin1(m_bootVersion);
} }
QString Profile::baseGameVersion() const QString Profile::baseGameVersion() const
{ {
Q_ASSERT(m_repositories.repositories_count >= 1); Q_ASSERT(m_repositories.repositories_count >= 1);
return m_repositories.repositories[0].version; return QString::fromLatin1(m_repositories.repositories[0].version);
} }
int Profile::numInstalledExpansions() const int Profile::numInstalledExpansions() const
@ -528,7 +528,7 @@ int Profile::numInstalledExpansions() const
QString Profile::expansionVersion(const int index) const QString Profile::expansionVersion(const int index) const
{ {
Q_ASSERT(index <= numInstalledExpansions()); Q_ASSERT(index <= numInstalledExpansions());
return m_repositories.repositories[index + 1].version; return QString::fromLatin1(m_repositories.repositories[index + 1].version);
} }
int Profile::dalamudAssetVersion() const int Profile::dalamudAssetVersion() const

View file

@ -87,7 +87,7 @@ QCoro::Task<> SquareEnixLogin::checkBootUpdates()
qInfo(ASTRA_LOG) << "Checking for updates to boot components..."; qInfo(ASTRA_LOG) << "Checking for updates to boot components...";
QString formattedDate = QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH-mm")); QString formattedDate = QDateTime::currentDateTimeUtc().toString(QStringLiteral("yyyy-MM-dd-HH-mm"));
formattedDate[15] = '0'; formattedDate[15] = QLatin1Char('0');
const QUrlQuery query{{QStringLiteral("time"), formattedDate}}; const QUrlQuery query{{QStringLiteral("time"), formattedDate}};
@ -110,7 +110,7 @@ QCoro::Task<> SquareEnixLogin::checkBootUpdates()
const auto reply = m_launcher.mgr()->get(request); const auto reply = m_launcher.mgr()->get(request);
co_await reply; co_await reply;
const QString patchList = reply->readAll(); const QString patchList = QString::fromUtf8(reply->readAll());
if (!patchList.isEmpty()) { if (!patchList.isEmpty()) {
m_patcher = new Patcher(m_launcher, m_info->profile->gamePath() + QStringLiteral("/boot"), *m_info->profile->bootData(), this); m_patcher = new Patcher(m_launcher, m_info->profile->gamePath() + QStringLiteral("/boot"), *m_info->profile->bootData(), this);
const bool hasPatched = co_await m_patcher->patch(PatchList(patchList)); const bool hasPatched = co_await m_patcher->patch(PatchList(patchList));
@ -162,7 +162,7 @@ QCoro::Task<std::optional<SquareEnixLogin::StoredInfo>> SquareEnixLogin::getStor
const auto reply = m_launcher.mgr()->get(request); const auto reply = m_launcher.mgr()->get(request);
co_await reply; co_await reply;
const QString str = reply->readAll(); const QString str = QString::fromUtf8(reply->readAll());
// fetches Steam username // fetches Steam username
if (m_info->profile->account()->license() == Account::GameLicense::WindowsSteam) { if (m_info->profile->account()->license() == Account::GameLicense::WindowsSteam) {
@ -223,7 +223,7 @@ QCoro::Task<bool> SquareEnixLogin::loginOAuth()
m_launcher.setupIgnoreSSL(reply); m_launcher.setupIgnoreSSL(reply);
co_await reply; co_await reply;
const QString str = reply->readAll(); const QString str = QString::fromUtf8(reply->readAll());
const QRegularExpression re(QStringLiteral(R"lit(window.external.user\("login=auth,ok,(?<launchParams>.*)\);)lit")); const QRegularExpression re(QStringLiteral(R"lit(window.external.user\("login=auth,ok,(?<launchParams>.*)\);)lit"));
const QRegularExpressionMatch match = re.match(str); const QRegularExpressionMatch match = re.match(str);
@ -291,13 +291,13 @@ QCoro::Task<bool> SquareEnixLogin::registerSession()
if (reply->error() == QNetworkReply::NoError) { if (reply->error() == QNetworkReply::NoError) {
QString patchUniqueId; QString patchUniqueId;
if (reply->rawHeaderList().contains(QByteArrayLiteral("X-Patch-Unique-Id"))) { if (reply->rawHeaderList().contains(QByteArrayLiteral("X-Patch-Unique-Id"))) {
patchUniqueId = reply->rawHeader(QByteArrayLiteral("X-Patch-Unique-Id")); patchUniqueId = QString::fromUtf8(reply->rawHeader(QByteArrayLiteral("X-Patch-Unique-Id")));
} else if (reply->rawHeaderList().contains(QByteArrayLiteral("x-patch-unique-id"))) { } else if (reply->rawHeaderList().contains(QByteArrayLiteral("x-patch-unique-id"))) {
patchUniqueId = reply->rawHeader(QByteArrayLiteral("x-patch-unique-id")); patchUniqueId = QString::fromUtf8(reply->rawHeader(QByteArrayLiteral("x-patch-unique-id")));
} }
if (!patchUniqueId.isEmpty()) { if (!patchUniqueId.isEmpty()) {
const QString body = reply->readAll(); const QString body = QString::fromUtf8(reply->readAll());
if (!body.isEmpty()) { if (!body.isEmpty()) {
m_patcher = new Patcher(m_launcher, m_info->profile->gamePath() + QStringLiteral("/game"), *m_info->profile->gameData(), this); m_patcher = new Patcher(m_launcher, m_info->profile->gamePath() + QStringLiteral("/game"), *m_info->profile->gameData(), this);
@ -367,5 +367,5 @@ QString SquareEnixLogin::getFileHash(const QString &file)
QCryptographicHash hash(QCryptographicHash::Sha1); QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData(&f); hash.addData(&f);
return QStringLiteral("%1/%2").arg(QString::number(f.size()), hash.result().toHex()); return QStringLiteral("%1/%2").arg(QString::number(f.size()), QString::fromUtf8(hash.result().toHex()));
} }