mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 04:37:46 +00:00
Add support for changing Dalamud update channel
This also fixes a bug where Astra couldn't get the correct version number for a future .Net 6 Dalamud release
This commit is contained in:
parent
805b1d8317
commit
3469c99953
6 changed files with 60 additions and 13 deletions
|
@ -5,6 +5,8 @@
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
#include "launchercore.h"
|
||||||
|
|
||||||
class LauncherCore;
|
class LauncherCore;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
struct ProfileSettings;
|
struct ProfileSettings;
|
||||||
|
@ -29,7 +31,7 @@ private:
|
||||||
|
|
||||||
QProgressDialog* dialog;
|
QProgressDialog* dialog;
|
||||||
|
|
||||||
const ProfileSettings* currentSettings = nullptr;
|
DalamudChannel chosenChannel;
|
||||||
|
|
||||||
QString remoteDalamudVersion;
|
QString remoteDalamudVersion;
|
||||||
QString remoteRuntimeVersion;
|
QString remoteRuntimeVersion;
|
||||||
|
|
|
@ -27,6 +27,12 @@ enum class WineType {
|
||||||
Builtin // macos only
|
Builtin // macos only
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class DalamudChannel {
|
||||||
|
Stable,
|
||||||
|
Staging,
|
||||||
|
Net5
|
||||||
|
};
|
||||||
|
|
||||||
struct ProfileSettings {
|
struct ProfileSettings {
|
||||||
QUuid uuid;
|
QUuid uuid;
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -68,6 +74,7 @@ struct ProfileSettings {
|
||||||
struct DalamudOptions {
|
struct DalamudOptions {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
bool optOutOfMbCollection = false;
|
bool optOutOfMbCollection = false;
|
||||||
|
DalamudChannel channel = DalamudChannel::Stable;
|
||||||
} dalamud;
|
} dalamud;
|
||||||
|
|
||||||
// login
|
// login
|
||||||
|
|
|
@ -62,6 +62,7 @@ private:
|
||||||
QLabel* dalamudAssetVersionLabel = nullptr;
|
QLabel* dalamudAssetVersionLabel = nullptr;
|
||||||
QLabel* nativeLauncherVersionLabel = nullptr;
|
QLabel* nativeLauncherVersionLabel = nullptr;
|
||||||
QCheckBox* dalamudOptOutBox = nullptr;
|
QCheckBox* dalamudOptOutBox = nullptr;
|
||||||
|
QComboBox* dalamudChannel = nullptr;
|
||||||
|
|
||||||
bool currentlyReloadingControls = false;
|
bool currentlyReloadingControls = false;
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
const QString baseGoatDomain = "https://goatcorp.github.io";
|
const QString baseGoatDomain = "https://goatcorp.github.io";
|
||||||
|
|
||||||
const QString baseDalamudDistribution = baseGoatDomain + "/dalamud-distrib";
|
const QString baseDalamudDistribution = baseGoatDomain + "/dalamud-distrib/";
|
||||||
const QString dalamudLatestPackageURL = baseDalamudDistribution + "/latest.zip";
|
const QString dalamudLatestPackageURL = baseDalamudDistribution + "%1latest.zip";
|
||||||
const QString dalamudVersionManifestURL = baseDalamudDistribution + "/version";
|
const QString dalamudVersionManifestURL = baseDalamudDistribution + "%1version";
|
||||||
|
|
||||||
const QString baseDalamudAssetDistribution = baseGoatDomain + "/DalamudAssets";
|
const QString baseDalamudAssetDistribution = baseGoatDomain + "/DalamudAssets";
|
||||||
const QString dalamudAssetManifestURL = baseDalamudAssetDistribution + "/asset.json";
|
const QString dalamudAssetManifestURL = baseDalamudAssetDistribution + "/asset.json";
|
||||||
|
@ -31,6 +31,12 @@ const QString dotnetRuntimePackageURL =
|
||||||
const QString dotnetDesktopPackageURL =
|
const QString dotnetDesktopPackageURL =
|
||||||
"https://dotnetcli.azureedge.net/dotnet/WindowsDesktop/%1/windowsdesktop-runtime-%1-win-x64.zip";
|
"https://dotnetcli.azureedge.net/dotnet/WindowsDesktop/%1/windowsdesktop-runtime-%1-win-x64.zip";
|
||||||
|
|
||||||
|
QMap<DalamudChannel, QString> channelToDistribPrefix = {
|
||||||
|
{DalamudChannel::Stable, "/"},
|
||||||
|
{DalamudChannel::Staging, "stg/"},
|
||||||
|
{DalamudChannel::Net5, "net5/"}
|
||||||
|
};
|
||||||
|
|
||||||
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
|
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
|
||||||
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
|
||||||
|
@ -102,7 +108,9 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
||||||
// dalamud injector / net runtime / nativelauncher
|
// dalamud injector / net runtime / nativelauncher
|
||||||
// they're all updated in unison, so there's no reason to have multiple checks
|
// they're all updated in unison, so there's no reason to have multiple checks
|
||||||
{
|
{
|
||||||
QNetworkRequest request(dalamudVersionManifestURL);
|
QNetworkRequest request(dalamudVersionManifestURL.arg(channelToDistribPrefix[profile.dalamud.channel]));
|
||||||
|
|
||||||
|
chosenChannel = profile.dalamud.channel;
|
||||||
|
|
||||||
remoteDalamudVersion.clear();
|
remoteDalamudVersion.clear();
|
||||||
remoteRuntimeVersion.clear();
|
remoteRuntimeVersion.clear();
|
||||||
|
@ -302,7 +310,7 @@ void AssetUpdater::checkIfCheckingIsDone() {
|
||||||
|
|
||||||
needsDalamudInstall = true;
|
needsDalamudInstall = true;
|
||||||
|
|
||||||
QNetworkRequest request(dalamudLatestPackageURL);
|
QNetworkRequest request(dalamudLatestPackageURL.arg(channelToDistribPrefix[chosenChannel]));
|
||||||
|
|
||||||
auto reply = launcher.mgr->get(request);
|
auto reply = launcher.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [this, reply] {
|
connect(reply, &QNetworkReply::finished, [this, reply] {
|
||||||
|
|
|
@ -296,13 +296,23 @@ void LauncherCore::readInitialInformation() {
|
||||||
depsJson.open(QFile::ReadOnly);
|
depsJson.open(QFile::ReadOnly);
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
||||||
|
|
||||||
// TODO: UGLY
|
QString versionString;
|
||||||
QString versionString =
|
if(doc["targets"].toObject().contains(".NETCoreApp,Version=v5.0")) {
|
||||||
doc["targets"]
|
versionString =
|
||||||
.toObject()[".NETCoreApp,Version=v5.0"]
|
doc["targets"]
|
||||||
.toObject()
|
.toObject()[".NETCoreApp,Version=v5.0"]
|
||||||
.keys()
|
.toObject()
|
||||||
.filter("Dalamud")[0];
|
.keys()
|
||||||
|
.filter("Dalamud")[0];
|
||||||
|
} else {
|
||||||
|
versionString =
|
||||||
|
doc["targets"]
|
||||||
|
.toObject()[".NETCoreApp,Version=v6.0"]
|
||||||
|
.toObject()
|
||||||
|
.keys()
|
||||||
|
.filter("Dalamud")[0];
|
||||||
|
}
|
||||||
|
|
||||||
dalamudVersion = versionString.remove("Dalamud/");
|
dalamudVersion = versionString.remove("Dalamud/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +408,7 @@ void LauncherCore::readInitialInformation() {
|
||||||
|
|
||||||
profile.dalamud.enabled = settings.value("enableDalamud", defaultSettings.dalamud.enabled).toBool();
|
profile.dalamud.enabled = settings.value("enableDalamud", defaultSettings.dalamud.enabled).toBool();
|
||||||
profile.dalamud.optOutOfMbCollection = settings.value("dalamudOptOut", defaultSettings.dalamud.optOutOfMbCollection).toBool();
|
profile.dalamud.optOutOfMbCollection = settings.value("dalamudOptOut", defaultSettings.dalamud.optOutOfMbCollection).toBool();
|
||||||
|
profile.dalamud.channel = (DalamudChannel)settings.value("dalamudChannel", (int)defaultSettings.dalamud.channel).toInt();
|
||||||
|
|
||||||
profileSettings[settings.value("index").toInt()] = profile;
|
profileSettings[settings.value("index").toInt()] = profile;
|
||||||
|
|
||||||
|
@ -595,6 +606,7 @@ void LauncherCore::saveSettings() {
|
||||||
|
|
||||||
settings.setValue("enableDalamud", profile.dalamud.enabled);
|
settings.setValue("enableDalamud", profile.dalamud.enabled);
|
||||||
settings.setValue("dalamudOptOut", profile.dalamud.optOutOfMbCollection);
|
settings.setValue("dalamudOptOut", profile.dalamud.optOutOfMbCollection);
|
||||||
|
settings.setValue("dalamudChannel", (int)profile.dalamud.channel);
|
||||||
settings.setValue("enableWatchdog", profile.enableWatchdog);
|
settings.setValue("enableWatchdog", profile.enableWatchdog);
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
|
@ -403,6 +403,22 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
|
||||||
});
|
});
|
||||||
dalamudBoxLayout->addRow("Opt Out of Automatic Marketboard Collection", dalamudOptOutBox);
|
dalamudBoxLayout->addRow("Opt Out of Automatic Marketboard Collection", dalamudOptOutBox);
|
||||||
|
|
||||||
|
dalamudChannel = new QComboBox();
|
||||||
|
dalamudChannel->insertItem(0, "Stable");
|
||||||
|
dalamudChannel->insertItem(1, "Staging");
|
||||||
|
dalamudChannel->insertItem(2, ".NET 5");
|
||||||
|
|
||||||
|
connect(dalamudChannel,
|
||||||
|
static_cast<void (QComboBox::*)(int)>(
|
||||||
|
&QComboBox::currentIndexChanged),
|
||||||
|
[=](int index) {
|
||||||
|
getCurrentProfile().dalamud.channel = (DalamudChannel)index;
|
||||||
|
|
||||||
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
|
||||||
|
dalamudBoxLayout->addRow("Dalamud Update Channel", dalamudChannel);
|
||||||
|
|
||||||
dalamudVersionLabel = new QLabel();
|
dalamudVersionLabel = new QLabel();
|
||||||
dalamudVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
dalamudVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
||||||
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
||||||
|
@ -550,6 +566,7 @@ void SettingsWindow::reloadControls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dalamudOptOutBox->setChecked(profile.dalamud.optOutOfMbCollection);
|
dalamudOptOutBox->setChecked(profile.dalamud.optOutOfMbCollection);
|
||||||
|
dalamudChannel->setCurrentIndex((int)profile.dalamud.channel);
|
||||||
|
|
||||||
window.reloadControls();
|
window.reloadControls();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue