2021-11-23 14:37:37 -05:00
|
|
|
#include "assetupdater.h"
|
|
|
|
|
|
|
|
#include <QFile>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QJsonArray>
|
2022-01-27 10:46:22 -05:00
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
2022-02-23 19:05:53 -05:00
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QStandardPaths>
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-03-01 16:43:49 -05:00
|
|
|
#include <JlCompress.h>
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
#include "launchercore.h"
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
const QString baseGoatDomain = "https://goatcorp.github.io";
|
2022-02-25 18:08:57 -05:00
|
|
|
|
2022-04-13 10:45:00 -04:00
|
|
|
const QString baseDalamudDistribution = baseGoatDomain + "/dalamud-distrib/";
|
|
|
|
const QString dalamudLatestPackageURL = baseDalamudDistribution + "%1latest.zip";
|
|
|
|
const QString dalamudVersionManifestURL = baseDalamudDistribution + "%1version";
|
2022-02-25 18:08:57 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
const QString baseDalamudAssetDistribution = baseGoatDomain + "/DalamudAssets";
|
|
|
|
const QString dalamudAssetManifestURL = baseDalamudAssetDistribution + "/asset.json";
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
const QString baseNativeLauncherDistribution = "https://xiv.zone/astra-distrib/nativelauncher";
|
|
|
|
const QString nativeLauncherLatestPackageURL = baseNativeLauncherDistribution + "/NativeLauncher.exe";
|
2022-04-08 19:34:51 -04:00
|
|
|
const QString nativeLauncherVersionManifestURL = baseNativeLauncherDistribution + "/version";
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
const QString dotnetRuntimePackageURL =
|
|
|
|
"https://dotnetcli.azureedge.net/dotnet/Runtime/%1/dotnet-runtime-%1-win-x64.zip";
|
|
|
|
const QString dotnetDesktopPackageURL =
|
|
|
|
"https://dotnetcli.azureedge.net/dotnet/WindowsDesktop/%1/windowsdesktop-runtime-%1-win-x64.zip";
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-04-13 10:45:00 -04:00
|
|
|
QMap<DalamudChannel, QString> channelToDistribPrefix = {
|
|
|
|
{DalamudChannel::Stable, "/"},
|
|
|
|
{DalamudChannel::Staging, "stg/"},
|
2022-08-15 11:14:37 -04:00
|
|
|
{DalamudChannel::Net5, "net5/"}};
|
2022-04-13 10:45:00 -04:00
|
|
|
|
2022-07-21 21:38:26 -04:00
|
|
|
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher), QObject(&launcher) {
|
2021-11-23 14:37:37 -05:00
|
|
|
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
2022-03-13 20:44:57 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
2022-04-27 15:09:34 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!QDir().exists(dataDir))
|
2022-04-27 15:09:34 -04:00
|
|
|
QDir().mkdir(dataDir);
|
2021-11-23 14:37:37 -05:00
|
|
|
}
|
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
void AssetUpdater::update(const ProfileSettings& profile) {
|
2022-02-25 18:08:57 -05:00
|
|
|
// non-dalamud users can bypass this process since it's not needed
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!profile.dalamud.enabled) {
|
2022-02-25 18:08:57 -05:00
|
|
|
finishedUpdating();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-14 13:19:36 -04:00
|
|
|
dialog = new QProgressDialog("Updating assets...", "Cancel", 0, 0);
|
2022-03-13 20:48:43 -04:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
// first, we want to collect all of the remote versions
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-02-23 19:05:53 -05:00
|
|
|
qInfo() << "Starting update sequence...";
|
2022-03-13 20:44:57 -04:00
|
|
|
dialog->setLabelText("Checking for updates...");
|
2022-02-23 19:05:53 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
// dalamud assets
|
|
|
|
{
|
2022-02-25 18:08:57 -05:00
|
|
|
// we want to prevent logging in before we actually check the version
|
2022-03-13 20:48:43 -04:00
|
|
|
dalamudAssetNeededFilenames.clear();
|
|
|
|
remoteDalamudAssetVersion = -1;
|
|
|
|
|
2022-02-25 18:08:57 -05:00
|
|
|
dalamudAssetNeededFilenames.append("dummy");
|
|
|
|
|
|
|
|
// first we want to fetch the list of assets required
|
2022-03-13 20:44:57 -04:00
|
|
|
QNetworkRequest request(dalamudAssetManifestURL);
|
2022-02-25 18:08:57 -05:00
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
2022-06-08 13:55:15 -04:00
|
|
|
connect(reply, &QNetworkReply::finished, [reply, this, &profile] {
|
2022-03-13 20:44:57 -04:00
|
|
|
dialog->setLabelText("Checking for Dalamud asset updates...");
|
|
|
|
|
2022-03-28 10:33:00 -04:00
|
|
|
// TODO: handle asset failure
|
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
|
2022-02-25 18:08:57 -05:00
|
|
|
|
|
|
|
qInfo() << "Dalamud asset remote version" << doc.object()["Version"].toInt();
|
2022-02-25 22:25:21 -05:00
|
|
|
qInfo() << "Dalamud asset local version" << launcher.dalamudAssetVersion;
|
2022-02-25 18:08:57 -05:00
|
|
|
|
|
|
|
remoteDalamudAssetVersion = doc.object()["Version"].toInt();
|
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
remoteDalamudAssetArray = doc.object()["Assets"].toArray();
|
2022-02-25 18:08:57 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
checkIfCheckingIsDone();
|
2022-02-25 18:08:57 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-08 19:34:51 -04:00
|
|
|
// native launcher
|
|
|
|
{
|
|
|
|
QNetworkRequest request(nativeLauncherVersionManifestURL);
|
|
|
|
|
|
|
|
remoteNativeLauncherVersion.clear();
|
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
2022-06-08 13:55:15 -04:00
|
|
|
connect(reply, &QNetworkReply::finished, [this, &profile, reply] {
|
2022-04-08 19:34:51 -04:00
|
|
|
dialog->setLabelText("Checking for native launcher updates...");
|
|
|
|
|
|
|
|
remoteNativeLauncherVersion = reply->readAll().trimmed();
|
|
|
|
|
|
|
|
qInfo() << "Latest native launcher version reported: " << remoteNativeLauncherVersion;
|
|
|
|
|
|
|
|
checkIfCheckingIsDone();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
// dalamud injector / net runtime / nativelauncher
|
|
|
|
// they're all updated in unison, so there's no reason to have multiple checks
|
|
|
|
{
|
2022-04-13 10:45:00 -04:00
|
|
|
QNetworkRequest request(dalamudVersionManifestURL.arg(channelToDistribPrefix[profile.dalamud.channel]));
|
|
|
|
|
|
|
|
chosenChannel = profile.dalamud.channel;
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-03-13 20:48:43 -04:00
|
|
|
remoteDalamudVersion.clear();
|
|
|
|
remoteRuntimeVersion.clear();
|
|
|
|
|
2022-02-25 20:06:29 -05:00
|
|
|
auto reply = launcher.mgr->get(request);
|
2022-06-08 13:55:15 -04:00
|
|
|
connect(reply, &QNetworkReply::finished, [this, &profile, reply] {
|
2022-03-13 20:44:57 -04:00
|
|
|
dialog->setLabelText("Checking for Dalamud updates...");
|
|
|
|
|
|
|
|
QByteArray str = reply->readAll();
|
|
|
|
// for some god forsaken reason, the version string comes back as raw
|
|
|
|
// bytes, ex: \xFF\xFE{\x00\"\x00""A\x00s\x00s\x00""e\x00m\x00 so we
|
|
|
|
// start at the first character of the json '{' and work our way up.
|
|
|
|
QString reassmbled;
|
|
|
|
for (int i = str.indexOf('{'); i < str.size(); i++) {
|
|
|
|
char t = str[i];
|
|
|
|
if (QChar(t).isPrint())
|
|
|
|
reassmbled += t;
|
|
|
|
}
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(reassmbled.toUtf8());
|
|
|
|
remoteDalamudVersion = doc["AssemblyVersion"].toString();
|
|
|
|
remoteRuntimeVersion = doc["RuntimeVersion"].toString();
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
qInfo() << "Latest Dalamud version reported: " << remoteDalamudVersion;
|
|
|
|
qInfo() << "Latest NET runtime reported: " << remoteRuntimeVersion;
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
checkIfCheckingIsDone();
|
|
|
|
});
|
2021-11-23 14:37:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AssetUpdater::beginInstall() {
|
2022-08-15 11:14:37 -04:00
|
|
|
if (needsDalamudInstall) {
|
|
|
|
bool success = !JlCompress::extractDir(tempDir.path() + "/latest.zip", dataDir + "/Dalamud").empty();
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!success) {
|
2022-02-25 20:06:29 -05:00
|
|
|
// TODO: handle failure here
|
2022-04-08 19:34:51 -04:00
|
|
|
qInfo() << "Failed to install Dalamud!";
|
2022-02-25 20:06:29 -05:00
|
|
|
} else {
|
|
|
|
needsDalamudInstall = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (needsNativeInstall) {
|
2022-04-08 19:34:51 -04:00
|
|
|
qInfo() << "Installing native launcher...";
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (QFile::exists(dataDir + "/NativeLauncher.exe"))
|
2022-04-08 19:34:51 -04:00
|
|
|
QFile::remove(dataDir + "/NativeLauncher.exe");
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
bool success = QFile::copy(tempDir.path() + "/NativeLauncher.exe", dataDir + "/NativeLauncher.exe");
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!success) {
|
2022-04-08 19:34:51 -04:00
|
|
|
qInfo() << "Failed to install native launcher!";
|
|
|
|
} else {
|
|
|
|
QFile file(dataDir + "/nativelauncher.ver");
|
|
|
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
file.write(remoteNativeLauncherVersion.toUtf8());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
needsNativeInstall = false;
|
|
|
|
}
|
2021-11-23 14:37:37 -05:00
|
|
|
}
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (needsRuntimeInstall) {
|
|
|
|
bool success =
|
|
|
|
!JlCompress::extractDir(tempDir.path() + "/dotnet-core.zip", dataDir + "/DalamudRuntime").empty();
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
success |= !JlCompress::extractDir(tempDir.path() + "/dotnet-desktop.zip", dataDir + "/DalamudRuntime").empty();
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!success) {
|
2022-04-08 19:34:51 -04:00
|
|
|
qInfo() << "Failed to install dotnet!";
|
2022-02-25 20:06:29 -05:00
|
|
|
} else {
|
|
|
|
QFile file(dataDir + "/DalamudRuntime/runtime.ver");
|
|
|
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
file.write(remoteRuntimeVersion.toUtf8());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
needsRuntimeInstall = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
checkIfFinished();
|
2022-01-27 10:46:22 -05:00
|
|
|
}
|
2022-02-25 18:08:57 -05:00
|
|
|
|
|
|
|
void AssetUpdater::checkIfDalamudAssetsDone() {
|
2022-08-15 11:14:37 -04:00
|
|
|
if (dialog->wasCanceled())
|
2022-03-13 20:48:43 -04:00
|
|
|
return;
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (dalamudAssetNeededFilenames.empty()) {
|
2022-02-25 18:08:57 -05:00
|
|
|
qInfo() << "Finished downloading Dalamud assets.";
|
|
|
|
|
2022-03-13 20:07:09 -04:00
|
|
|
launcher.dalamudAssetVersion = remoteDalamudAssetVersion;
|
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
QFile file(dataDir + "/DalamudAssets/" + "asset.ver");
|
2022-02-25 18:08:57 -05:00
|
|
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
file.write(QString::number(remoteDalamudAssetVersion).toUtf8());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
}
|
|
|
|
}
|
2022-02-25 20:06:29 -05:00
|
|
|
|
2022-02-25 18:08:57 -05:00
|
|
|
void AssetUpdater::checkIfFinished() {
|
2022-08-15 11:14:37 -04:00
|
|
|
if (dialog->wasCanceled())
|
2022-03-13 20:48:43 -04:00
|
|
|
return;
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (doneDownloadingDalamud && doneDownloadingNativelauncher && doneDownloadingRuntimeCore &&
|
|
|
|
doneDownloadingRuntimeDesktop && dalamudAssetNeededFilenames.empty()) {
|
2022-03-13 20:44:57 -04:00
|
|
|
if (needsRuntimeInstall || needsNativeInstall || needsDalamudInstall) {
|
2022-02-25 18:08:57 -05:00
|
|
|
beginInstall();
|
2022-03-13 20:44:57 -04:00
|
|
|
} else {
|
|
|
|
dialog->setLabelText("Finished!");
|
|
|
|
dialog->close();
|
|
|
|
|
2022-02-25 18:08:57 -05:00
|
|
|
finishedUpdating();
|
2022-03-13 20:44:57 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-13 20:48:43 -04:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
void AssetUpdater::checkIfCheckingIsDone() {
|
2022-08-15 11:14:37 -04:00
|
|
|
if (dialog->wasCanceled())
|
2022-03-13 20:48:43 -04:00
|
|
|
return;
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (remoteDalamudVersion.isEmpty() || remoteRuntimeVersion.isEmpty() || remoteDalamudAssetVersion == -1 ||
|
|
|
|
remoteNativeLauncherVersion.isEmpty()) {
|
2022-03-13 20:44:57 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// now that we got all the information we need, let's check if anything is
|
|
|
|
// updateable
|
|
|
|
|
|
|
|
dialog->setLabelText("Starting update...");
|
|
|
|
|
|
|
|
// dalamud injector / net runtime
|
2022-08-15 11:14:37 -04:00
|
|
|
if (launcher.runtimeVersion != remoteRuntimeVersion) {
|
2022-03-13 20:44:57 -04:00
|
|
|
needsRuntimeInstall = true;
|
|
|
|
|
|
|
|
// core
|
|
|
|
{
|
|
|
|
QNetworkRequest request(dotnetRuntimePackageURL.arg(remoteRuntimeVersion));
|
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
|
|
|
connect(reply, &QNetworkReply::finished, [this, reply] {
|
|
|
|
qInfo() << "Dotnet-core finished downloading!";
|
|
|
|
|
|
|
|
dialog->setLabelText("Updating Dotnet-core...");
|
|
|
|
|
|
|
|
QFile file(tempDir.path() + "/dotnet-core.zip");
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
|
|
file.write(reply->readAll());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
doneDownloadingRuntimeCore = true;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// desktop
|
|
|
|
{
|
|
|
|
QNetworkRequest request(dotnetDesktopPackageURL.arg(remoteRuntimeVersion));
|
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
|
|
|
connect(reply, &QNetworkReply::finished, [this, reply] {
|
|
|
|
qInfo() << "Dotnet-desktop finished downloading!";
|
|
|
|
|
|
|
|
dialog->setLabelText("Updating Dotnet-desktop...");
|
|
|
|
|
|
|
|
QFile file(tempDir.path() + "/dotnet-desktop.zip");
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
|
|
file.write(reply->readAll());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
doneDownloadingRuntimeDesktop = true;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
doneDownloadingRuntimeCore = true;
|
|
|
|
doneDownloadingRuntimeDesktop = true;
|
|
|
|
needsRuntimeInstall = false;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
}
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (remoteDalamudVersion != launcher.dalamudVersion) {
|
2022-03-13 20:44:57 -04:00
|
|
|
qInfo() << "Downloading Dalamud...";
|
2022-04-08 19:34:51 -04:00
|
|
|
|
2022-03-13 20:44:57 -04:00
|
|
|
needsDalamudInstall = true;
|
|
|
|
|
2022-04-13 10:45:00 -04:00
|
|
|
QNetworkRequest request(dalamudLatestPackageURL.arg(channelToDistribPrefix[chosenChannel]));
|
2022-03-13 20:44:57 -04:00
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
|
|
|
connect(reply, &QNetworkReply::finished, [this, reply] {
|
|
|
|
qInfo() << "Dalamud finished downloading!";
|
|
|
|
|
|
|
|
dialog->setLabelText("Updating Dalamud...");
|
|
|
|
|
|
|
|
QFile file(tempDir.path() + "/latest.zip");
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
|
|
file.write(reply->readAll());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
doneDownloadingDalamud = true;
|
|
|
|
|
|
|
|
launcher.dalamudVersion = remoteDalamudVersion;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
qInfo() << "No need to update Dalamud.";
|
|
|
|
|
|
|
|
doneDownloadingDalamud = true;
|
|
|
|
needsDalamudInstall = false;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
}
|
|
|
|
|
|
|
|
// dalamud assets
|
2022-08-15 11:14:37 -04:00
|
|
|
if (remoteDalamudAssetVersion != launcher.dalamudAssetVersion) {
|
2022-03-13 20:44:57 -04:00
|
|
|
qInfo() << "Dalamud assets out of date.";
|
|
|
|
|
|
|
|
dialog->setLabelText("Updating Dalamud assets...");
|
|
|
|
|
|
|
|
dalamudAssetNeededFilenames.clear();
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
for (auto assetObject : remoteDalamudAssetArray) {
|
2022-03-13 20:44:57 -04:00
|
|
|
{
|
|
|
|
dalamudAssetNeededFilenames.append(assetObject.toObject()["FileName"].toString());
|
|
|
|
|
|
|
|
QNetworkRequest assetRequest(assetObject.toObject()["Url"].toString());
|
|
|
|
auto assetReply = launcher.mgr->get(assetRequest);
|
|
|
|
|
|
|
|
connect(assetReply, &QNetworkReply::finished, [this, assetReply, assetObject = assetObject.toObject()] {
|
2022-04-27 11:48:42 -04:00
|
|
|
if (!QDir().exists(dataDir + "/DalamudAssets"))
|
|
|
|
QDir().mkdir(dataDir + "/DalamudAssets");
|
2022-03-13 20:44:57 -04:00
|
|
|
|
|
|
|
const QString fileName = assetObject["FileName"].toString();
|
|
|
|
const QList<QString> dirPath = fileName.left(fileName.lastIndexOf("/")).split('/');
|
|
|
|
|
|
|
|
QString build = dataDir + "/DalamudAssets/";
|
2022-08-15 11:14:37 -04:00
|
|
|
for (auto dir : dirPath) {
|
2022-03-13 20:44:57 -04:00
|
|
|
if (!QDir().exists(build + dir))
|
|
|
|
QDir().mkdir(build + dir);
|
|
|
|
|
|
|
|
build += dir + "/";
|
|
|
|
}
|
|
|
|
|
|
|
|
QFile file(dataDir + "/DalamudAssets/" + assetObject["FileName"].toString());
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
|
|
file.write(assetReply->readAll());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
dalamudAssetNeededFilenames.removeOne(assetObject["FileName"].toString());
|
|
|
|
checkIfDalamudAssetsDone();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dalamudAssetNeededFilenames.clear();
|
|
|
|
|
|
|
|
qInfo() << "Dalamud assets up to date.";
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
}
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (remoteNativeLauncherVersion != launcher.nativeLauncherVersion) {
|
2022-04-08 19:34:51 -04:00
|
|
|
qInfo() << "Native launcher out of date.";
|
|
|
|
|
|
|
|
dialog->setLabelText("Updating native launcher...");
|
2022-03-13 20:44:57 -04:00
|
|
|
|
|
|
|
needsNativeInstall = true;
|
|
|
|
|
|
|
|
QNetworkRequest request(nativeLauncherLatestPackageURL);
|
|
|
|
|
|
|
|
auto reply = launcher.mgr->get(request);
|
|
|
|
connect(reply, &QNetworkReply::finished, [this, reply] {
|
|
|
|
qInfo() << "NativeLauncher finished downloading!";
|
|
|
|
|
|
|
|
QFile file(tempDir.path() + "/NativeLauncher.exe");
|
|
|
|
file.open(QIODevice::WriteOnly);
|
|
|
|
file.write(reply->readAll());
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
doneDownloadingNativelauncher = true;
|
|
|
|
|
|
|
|
checkIfFinished();
|
|
|
|
});
|
2022-04-08 19:34:51 -04:00
|
|
|
} else {
|
|
|
|
qInfo() << "Native launcher up to date.";
|
|
|
|
|
|
|
|
doneDownloadingNativelauncher = true;
|
|
|
|
|
|
|
|
checkIfFinished();
|
2022-02-25 18:08:57 -05:00
|
|
|
}
|
|
|
|
}
|