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
Joshua Goins 8dd26f74a5 Improve the config/data directory, introduce more separation
The data directory has been rearranged, and all the Dalamud data is
stored separately, so it's no longer clogging up everything. Dalamud
logs (and our own logs, when that's implemented) now exist in
XDG_STATE_HOME, instead of the data directory.

The game directory now exists under the data directory, instead of
~/.wine. The user path is set before launching the game, and it now
 exists under the data directory too. These are also prefixed to the
user and profile UUID that it belongs to.

The "keep patches" option is now implemented (which is off by default)
and it lives in the temporary directory now.
2023-08-18 14:52:06 -04:00

55 lines
No EOL
1.3 KiB
C++

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QDir>
#include <QNetworkAccessManager>
#include <QString>
#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
{
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;
};