1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00
astra/launcher/include/patcher.h

55 lines
1.3 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QDir>
#include <QNetworkAccessManager>
2022-08-15 11:14:37 -04:00
#include <QString>
2022-08-09 22:44:10 -04:00
#include <physis.hpp>
class LauncherCore;
// General-purpose patcher routine. It opens a nice dialog box, handles downloading
// and processing patches.
class Patcher : public QObject
{
Q_OBJECT
public:
Patcher(LauncherCore &launcher, QString baseDirectory, GameData *game_data, QObject *parent = nullptr);
Patcher(LauncherCore &launcher, QString baseDirectory, BootData *game_data, QObject *parent = nullptr);
void processPatchList(QNetworkAccessManager &mgr, const QString &patchList);
signals:
void done();
private:
void checkIfDone();
void setupDirectories();
[[nodiscard]] bool isBoot() const
{
2022-08-09 22:44:10 -04:00
return boot_data != nullptr;
}
struct QueuedPatch {
QString name, repository, version, path;
QStringList hashes;
long hashBlockSize;
long length;
};
void processPatch(const QueuedPatch &patch);
QVector<QueuedPatch> patchQueue;
QDir patchesDir;
QString baseDirectory;
BootData *boot_data = nullptr;
GameData *game_data = nullptr;
int remainingPatches = -1;
LauncherCore &m_launcher;
};