mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Move dalamud version out of profile settings
This commit is contained in:
parent
92fce532b3
commit
7a08eb549f
4 changed files with 48 additions and 48 deletions
|
@ -47,10 +47,6 @@ struct ProfileSettings {
|
|||
int refreshRate = 0;
|
||||
} gamescope;
|
||||
|
||||
QString dalamudVersion; // TODO: move out of profile settings
|
||||
int dalamudAssetVersion = -1;
|
||||
QString runtimeVersion;
|
||||
|
||||
// login
|
||||
bool encryptArguments = true;
|
||||
bool isSapphire = false;
|
||||
|
@ -131,6 +127,10 @@ public:
|
|||
|
||||
AppSettings appSettings;
|
||||
|
||||
QString dalamudVersion;
|
||||
int dalamudAssetVersion = -1;
|
||||
QString runtimeVersion;
|
||||
|
||||
int defaultProfileIndex = 0;
|
||||
signals:
|
||||
void settingsChanged();
|
||||
|
|
|
@ -53,14 +53,14 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
|||
|
||||
return;
|
||||
} else {
|
||||
if (profile.dalamudVersion != remoteDalamudVersion) {
|
||||
if (launcher.dalamudVersion != remoteDalamudVersion) {
|
||||
isDalamudUpdated = false;
|
||||
} else {
|
||||
qInfo() << "No need to update Dalamud.";
|
||||
isDalamudUpdated = true;
|
||||
}
|
||||
|
||||
if(profile.runtimeVersion != remoteRuntimeVersion) {
|
||||
if(launcher.runtimeVersion != remoteRuntimeVersion) {
|
||||
doneDownloadingRuntimeCore = false;
|
||||
doneDownloadingRuntimeDesktop = false;
|
||||
needsRuntimeInstall = true;
|
||||
|
@ -126,11 +126,11 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
|||
QJsonDocument doc = QJsonDocument::fromJson(badJson.toUtf8());
|
||||
|
||||
qInfo() << "Dalamud asset remote version" << doc.object()["Version"].toInt();
|
||||
qInfo() << "Dalamud asset local version" << profile.dalamudAssetVersion;
|
||||
qInfo() << "Dalamud asset local version" << launcher.dalamudAssetVersion;
|
||||
|
||||
remoteDalamudAssetVersion = doc.object()["Version"].toInt();
|
||||
|
||||
if(remoteDalamudAssetVersion != profile.dalamudAssetVersion) {
|
||||
if(remoteDalamudAssetVersion != launcher.dalamudAssetVersion) {
|
||||
qInfo() << "Dalamud assets out of date.";
|
||||
|
||||
dalamudAssetNeededFilenames.clear();
|
||||
|
@ -184,7 +184,7 @@ void AssetUpdater::update(const ProfileSettings& profile) {
|
|||
});
|
||||
}
|
||||
|
||||
if(remoteDalamudVersion != profile.dalamudVersion) {
|
||||
if(remoteDalamudVersion != launcher.dalamudVersion) {
|
||||
qInfo() << "Downloading Dalamud...";
|
||||
doneDownloadingDalamud = false;
|
||||
needsDalamudInstall = true;
|
||||
|
|
|
@ -263,6 +263,41 @@ void LauncherCore::readInitialInformation() {
|
|||
gamescopeAvailable = checkIfInPath("gamescope");
|
||||
gamemodeAvailable = checkIfInPath("gamemoderun");
|
||||
|
||||
const QString dataDir =
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
|
||||
const bool hasDalamud = QFile::exists(dataDir + "/Dalamud");
|
||||
if (hasDalamud) {
|
||||
if (QFile::exists(dataDir + "/Dalamud/Dalamud.deps.json")) {
|
||||
QFile depsJson(dataDir + "/Dalamud/Dalamud.deps.json");
|
||||
depsJson.open(QFile::ReadOnly);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
||||
|
||||
// TODO: UGLY
|
||||
QString versionString =
|
||||
doc["targets"]
|
||||
.toObject()[".NETCoreApp,Version=v5.0"]
|
||||
.toObject()
|
||||
.keys()
|
||||
.filter("Dalamud")[0];
|
||||
dalamudVersion = versionString.remove("Dalamud/");
|
||||
}
|
||||
|
||||
if(QFile::exists(dataDir + "/DalamudAssets/asset.ver")) {
|
||||
QFile assetJson(dataDir + "/DalamudAssets/asset.ver");
|
||||
assetJson.open(QFile::ReadOnly | QFile::Text);
|
||||
|
||||
dalamudAssetVersion = QString(assetJson.readAll()).toInt();
|
||||
}
|
||||
|
||||
if(QFile::exists(dataDir + "/DalamudRuntime/runtime.ver")) {
|
||||
QFile runtimeVer(dataDir + "/DalamudRuntime/runtime.ver");
|
||||
runtimeVer.open(QFile::ReadOnly | QFile::Text);
|
||||
|
||||
runtimeVersion = QString(runtimeVer.readAll());
|
||||
}
|
||||
}
|
||||
|
||||
auto profiles = settings.childGroups();
|
||||
|
||||
// create the Default profile if it doesnt exist
|
||||
|
@ -282,41 +317,6 @@ void LauncherCore::readInitialInformation() {
|
|||
|
||||
readWineInfo(profile);
|
||||
|
||||
const QString dataDir =
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
|
||||
const bool hasDalamud = QFile::exists(dataDir + "/Dalamud");
|
||||
if (hasDalamud) {
|
||||
if (QFile::exists(dataDir + "/Dalamud/Dalamud.deps.json")) {
|
||||
QFile depsJson(dataDir + "/Dalamud/Dalamud.deps.json");
|
||||
depsJson.open(QFile::ReadOnly);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(depsJson.readAll());
|
||||
|
||||
// TODO: UGLY
|
||||
QString versionString =
|
||||
doc["targets"]
|
||||
.toObject()[".NETCoreApp,Version=v5.0"]
|
||||
.toObject()
|
||||
.keys()
|
||||
.filter("Dalamud")[0];
|
||||
profile.dalamudVersion = versionString.remove("Dalamud/");
|
||||
}
|
||||
|
||||
if(QFile::exists(dataDir + "/DalamudAssets/asset.ver")) {
|
||||
QFile assetJson(dataDir + "/DalamudAssets/asset.ver");
|
||||
assetJson.open(QFile::ReadOnly | QFile::Text);
|
||||
|
||||
profile.dalamudAssetVersion = QString(assetJson.readAll()).toInt();
|
||||
}
|
||||
|
||||
if(QFile::exists(dataDir + "/DalamudRuntime/runtime.ver")) {
|
||||
QFile runtimeVer(dataDir + "/DalamudRuntime/runtime.ver");
|
||||
runtimeVer.open(QFile::ReadOnly | QFile::Text);
|
||||
|
||||
profile.runtimeVersion = QString(runtimeVer.readAll());
|
||||
}
|
||||
}
|
||||
|
||||
if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) {
|
||||
profile.gamePath = settings.value("gamePath").toString();
|
||||
} else {
|
||||
|
|
|
@ -475,16 +475,16 @@ void SettingsWindow::reloadControls() {
|
|||
|
||||
// dalamud
|
||||
enableDalamudBox->setChecked(profile.enableDalamud);
|
||||
if(profile.dalamudVersion.isEmpty()) {
|
||||
if(core.dalamudVersion.isEmpty()) {
|
||||
dalamudVersionLabel->setText("Dalamud is not installed.");
|
||||
} else {
|
||||
dalamudVersionLabel->setText(profile.dalamudVersion);
|
||||
dalamudVersionLabel->setText(core.dalamudVersion);
|
||||
}
|
||||
|
||||
if(profile.dalamudAssetVersion == -1) {
|
||||
if(core.dalamudAssetVersion == -1) {
|
||||
dalamudAssetVersionLabel->setText("Dalamud assets are not installed.");
|
||||
} else {
|
||||
dalamudAssetVersionLabel->setText(QString::number(profile.dalamudAssetVersion));
|
||||
dalamudAssetVersionLabel->setText(QString::number(core.dalamudAssetVersion));
|
||||
}
|
||||
|
||||
window.reloadControls();
|
||||
|
|
Loading…
Add table
Reference in a new issue