2023-08-05 22:14:05 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-11-23 14:37:37 -05:00
|
|
|
#pragma once
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QJsonArray>
|
2021-11-23 14:37:37 -05:00
|
|
|
#include <QObject>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QTemporaryDir>
|
2023-09-17 18:43:58 -04:00
|
|
|
#include <qcorotask.h>
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-04-13 10:45:00 -04:00
|
|
|
#include "launchercore.h"
|
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
class LauncherCore;
|
2021-11-23 14:37:37 -05:00
|
|
|
class QNetworkReply;
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
class AssetUpdater : public QObject
|
|
|
|
{
|
2021-11-23 14:37:37 -05:00
|
|
|
Q_OBJECT
|
2023-09-17 08:32:47 -04:00
|
|
|
|
2021-11-23 14:37:37 -05:00
|
|
|
public:
|
2023-07-30 08:49:34 -04:00
|
|
|
explicit AssetUpdater(Profile &profile, LauncherCore &launcher, QObject *parent = nullptr);
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2023-10-11 14:40:56 -04:00
|
|
|
/// Checks for any asset updates. (This currently only means Dalamud.)
|
|
|
|
/// \return False if the asset update failed, which should be considered fatal and Dalamud should not be used.
|
2023-10-08 19:07:34 -04:00
|
|
|
QCoro::Task<bool> update();
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2023-09-17 18:43:58 -04:00
|
|
|
private:
|
2023-12-20 18:00:40 -05:00
|
|
|
QCoro::Task<bool> checkRemoteCompatibilityToolVersion();
|
2023-12-20 20:19:48 -05:00
|
|
|
QCoro::Task<bool> checkRemoteDxvkVersion();
|
2023-12-20 18:00:40 -05:00
|
|
|
|
2023-10-08 19:07:34 -04:00
|
|
|
QCoro::Task<bool> checkRemoteDalamudAssetVersion();
|
|
|
|
QCoro::Task<bool> checkRemoteDalamudVersion();
|
2022-02-25 18:08:57 -05:00
|
|
|
|
2023-12-20 18:00:40 -05:00
|
|
|
QCoro::Task<bool> installCompatibilityTool();
|
2023-12-20 20:19:48 -05:00
|
|
|
QCoro::Task<bool> installDxvkTool();
|
2023-10-08 19:07:34 -04:00
|
|
|
QCoro::Task<bool> installDalamudAssets();
|
|
|
|
QCoro::Task<bool> installDalamud();
|
|
|
|
QCoro::Task<bool> installRuntime();
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2023-10-08 18:54:03 -04:00
|
|
|
[[nodiscard]] QUrl dalamudVersionManifestUrl() const;
|
2023-09-17 09:02:11 -04:00
|
|
|
[[nodiscard]] QUrl dalamudAssetManifestUrl() const;
|
2023-10-08 18:54:03 -04:00
|
|
|
[[nodiscard]] QUrl dotnetRuntimePackageUrl(const QString &version) const;
|
|
|
|
[[nodiscard]] QUrl dotnetDesktopPackageUrl(const QString &version) const;
|
2023-08-18 21:36:29 -04:00
|
|
|
|
2023-12-20 18:00:40 -05:00
|
|
|
bool extractZip(const QString &filePath, const QString &directory);
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
LauncherCore &launcher;
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2023-10-11 13:39:10 -04:00
|
|
|
QString m_remoteDalamudVersion;
|
|
|
|
QString m_remoteRuntimeVersion;
|
|
|
|
|
|
|
|
QTemporaryDir m_tempDir;
|
2023-12-20 18:00:40 -05:00
|
|
|
QDir m_wineDir;
|
2023-12-20 20:19:48 -05:00
|
|
|
QDir m_dxvkDir;
|
2023-10-11 13:39:10 -04:00
|
|
|
QDir m_dataDir;
|
|
|
|
QDir m_appDataDir;
|
|
|
|
QDir m_dalamudDir;
|
|
|
|
QDir m_dalamudAssetDir;
|
|
|
|
QDir m_dalamudRuntimeDir;
|
|
|
|
|
|
|
|
int m_remoteDalamudAssetVersion = -1;
|
|
|
|
QJsonArray m_remoteDalamudAssetArray;
|
|
|
|
QString m_remoteDalamudDownloadUrl;
|
2024-02-24 11:48:02 -05:00
|
|
|
QString m_remoteDalamudAssetPackageUrl;
|
2023-12-20 18:00:40 -05:00
|
|
|
QString m_remoteCompatibilityToolVersion;
|
2023-12-20 20:19:48 -05:00
|
|
|
QString m_remoteDxvkToolVersion;
|
2023-12-20 18:00:40 -05:00
|
|
|
// TODO: hardcoded
|
|
|
|
QString m_remoteCompatibilityToolUrl =
|
|
|
|
QStringLiteral("https://github.com/goatcorp/wine-xiv-git/releases/download/8.5.r4.g4211bac7/wine-xiv-staging-fsync-git-ubuntu-8.5.r4.g4211bac7.tar.xz");
|
2023-12-20 20:19:48 -05:00
|
|
|
QString m_remoteDxvkToolUrl = QStringLiteral("https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz");
|
2022-03-13 20:44:57 -04:00
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
Profile &m_profile;
|
2022-01-27 10:46:22 -05:00
|
|
|
};
|