mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Update patcher for new physis changes
This commit is contained in:
parent
5f4ef95dff
commit
440d5670e7
6 changed files with 35 additions and 24 deletions
|
@ -50,6 +50,9 @@ public:
|
||||||
QVector<QString> gameVersions;
|
QVector<QString> gameVersions;
|
||||||
bool enableWatchdog = false;
|
bool enableWatchdog = false;
|
||||||
|
|
||||||
|
BootData* bootData;
|
||||||
|
GameData* gameData;
|
||||||
|
|
||||||
bool isGameInstalled() const {
|
bool isGameInstalled() const {
|
||||||
return !gameVersions.isEmpty();
|
return !gameVersions.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
#include <physis.hpp>
|
||||||
|
|
||||||
// General-purpose patcher routine. It opens a nice dialog box, handles downloading
|
// General-purpose patcher routine. It opens a nice dialog box, handles downloading
|
||||||
// and processing patches.
|
// and processing patches.
|
||||||
class Patcher : public QObject {
|
class Patcher : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
// isBoot is used for telling the patcher that you're reading boot patches, which for some reason has a different patchlist format.
|
Patcher(QString baseDirectory, GameData* game_data);
|
||||||
Patcher(bool isBoot, QString baseDirectory);
|
Patcher(QString baseDirectory, BootData* game_data);
|
||||||
|
|
||||||
void processPatchList(QNetworkAccessManager& mgr, QString patchList);
|
void processPatchList(QNetworkAccessManager& mgr, QString patchList);
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ signals:
|
||||||
private:
|
private:
|
||||||
void checkIfDone();
|
void checkIfDone();
|
||||||
|
|
||||||
|
bool isBoot() const {
|
||||||
|
return boot_data != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
struct QueuedPatch {
|
struct QueuedPatch {
|
||||||
QString name, repository, version, path;
|
QString name, repository, version, path;
|
||||||
};
|
};
|
||||||
|
@ -28,8 +33,9 @@ private:
|
||||||
|
|
||||||
QVector<QueuedPatch> patchQueue;
|
QVector<QueuedPatch> patchQueue;
|
||||||
|
|
||||||
bool isBoot = false;
|
|
||||||
QString baseDirectory;
|
QString baseDirectory;
|
||||||
|
BootData* boot_data = nullptr;
|
||||||
|
GameData* game_data = nullptr;
|
||||||
|
|
||||||
QProgressDialog* dialog = nullptr;
|
QProgressDialog* dialog = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -704,12 +704,12 @@ void LauncherCore::addRegistryKey(const ProfileSettings& settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::readGameData(ProfileSettings& profile) {
|
void LauncherCore::readGameData(ProfileSettings& profile) {
|
||||||
auto path = profile.gamePath.toStdString() + "/game";
|
profile.gameData = physis_gamedata_initialize((profile.gamePath + "/game").toStdString().c_str());
|
||||||
GameData* game_data = physis_gamedata_initialize(path.c_str());
|
profile.bootData = physis_bootdata_initialize((profile.gamePath + "/boot").toStdString().c_str());
|
||||||
|
|
||||||
EXH* exh = physis_gamedata_read_excel_sheet_header(game_data, "ExVersion");
|
EXH* exh = physis_gamedata_read_excel_sheet_header(profile.gameData, "ExVersion");
|
||||||
if(exh != nullptr) {
|
if(exh != nullptr) {
|
||||||
physis_EXD exd = physis_gamedata_read_excel_sheet(game_data, "ExVersion", exh, Language::English, 0);
|
physis_EXD exd = physis_gamedata_read_excel_sheet(profile.gameData, "ExVersion", exh, Language::English, 0);
|
||||||
|
|
||||||
for(int i = 0; i < exd.row_count; i++) {
|
for(int i = 0; i < exd.row_count; i++) {
|
||||||
expansionNames.push_back(exd.row_data[i].column_data[0].string._0);
|
expansionNames.push_back(exd.row_data[i].column_data[0].string._0);
|
||||||
|
@ -718,6 +718,4 @@ void LauncherCore::readGameData(ProfileSettings& profile) {
|
||||||
physis_gamedata_free_sheet(exd);
|
physis_gamedata_free_sheet(exd);
|
||||||
physis_gamedata_free_sheet_header(exh);
|
physis_gamedata_free_sheet_header(exh);
|
||||||
}
|
}
|
||||||
|
|
||||||
physis_gamedata_free(game_data);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,16 @@
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
Patcher::Patcher(bool isBoot, QString baseDirectory) : isBoot(isBoot), baseDirectory(baseDirectory) {
|
Patcher::Patcher(QString baseDirectory, BootData* boot_data) : boot_data(boot_data), baseDirectory(baseDirectory) {
|
||||||
dialog = new QProgressDialog();
|
dialog = new QProgressDialog();
|
||||||
|
dialog->setLabelText("Checking the FINAL FANTASY XIV Updater/Launcher version.");
|
||||||
|
|
||||||
if(isBoot) {
|
dialog->show();
|
||||||
dialog->setLabelText("Checking the FINAL FANTASY XIV Updater/Launcher version.");
|
}
|
||||||
} else {
|
|
||||||
dialog->setLabelText("Checking the FINAL FANTASY XIV Game version.");
|
Patcher::Patcher(QString baseDirectory, GameData* game_data) : game_data(game_data), baseDirectory(baseDirectory) {
|
||||||
}
|
dialog = new QProgressDialog();
|
||||||
|
dialog->setLabelText("Checking the FINAL FANTASY XIV Game version.");
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +26,7 @@ void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) {
|
||||||
|
|
||||||
emit done();
|
emit done();
|
||||||
} else {
|
} else {
|
||||||
if(isBoot) {
|
if(isBoot()) {
|
||||||
dialog->setLabelText("Updating the FINAL FANTASY XIV Updater/Launcher version.");
|
dialog->setLabelText("Updating the FINAL FANTASY XIV Updater/Launcher version.");
|
||||||
} else {
|
} else {
|
||||||
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.");
|
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.");
|
||||||
|
@ -41,7 +43,7 @@ void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) {
|
||||||
|
|
||||||
QString name, url, version, repository;
|
QString name, url, version, repository;
|
||||||
|
|
||||||
if (isBoot) {
|
if (isBoot()) {
|
||||||
name = patchParts[4];
|
name = patchParts[4];
|
||||||
url = patchParts[5];
|
url = patchParts[5];
|
||||||
version = name;
|
version = name;
|
||||||
|
@ -54,7 +56,7 @@ void Patcher::processPatchList(QNetworkAccessManager& mgr, QString patchList) {
|
||||||
auto url_parts = url.split('/');
|
auto url_parts = url.split('/');
|
||||||
repository = url_parts[url_parts.size() - 3];
|
repository = url_parts[url_parts.size() - 3];
|
||||||
|
|
||||||
if(isBoot) {
|
if(isBoot()) {
|
||||||
dialog->setLabelText("Updating the FINAL FANTASY XIV Updater/Launcher version.\nDownloading ffxivboot - " + version);
|
dialog->setLabelText("Updating the FINAL FANTASY XIV Updater/Launcher version.\nDownloading ffxivboot - " + version);
|
||||||
} else {
|
} else {
|
||||||
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.\nDownloading " + repository + " - " + version);
|
dialog->setLabelText("Updating the FINAL FANTASY XIV Game version.\nDownloading " + repository + " - " + version);
|
||||||
|
@ -114,12 +116,14 @@ void Patcher::checkIfDone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patcher::processPatch(QueuedPatch patch) {
|
void Patcher::processPatch(QueuedPatch patch) {
|
||||||
auto data_path = baseDirectory.toStdString();
|
if(isBoot()) {
|
||||||
|
physis_bootdata_apply_patch(boot_data, patch.path.toStdString().c_str());
|
||||||
physis_patch_process(data_path.c_str(), patch.path.toStdString().c_str());
|
} else {
|
||||||
|
physis_gamedata_apply_patch(game_data, patch.path.toStdString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
QString verFilePath;
|
QString verFilePath;
|
||||||
if(isBoot) {
|
if(isBoot()) {
|
||||||
verFilePath = baseDirectory + "/ffxivboot.ver";
|
verFilePath = baseDirectory + "/ffxivboot.ver";
|
||||||
} else {
|
} else {
|
||||||
if(patch.repository == "game") {
|
if(patch.repository == "game") {
|
||||||
|
|
|
@ -17,7 +17,7 @@ SquareBoot::SquareBoot(LauncherCore& window, SquareLauncher& launcher) : window(
|
||||||
}
|
}
|
||||||
|
|
||||||
void SquareBoot::bootCheck(const LoginInformation& info) {
|
void SquareBoot::bootCheck(const LoginInformation& info) {
|
||||||
patcher = new Patcher(true, info.settings->gamePath + "/boot");
|
patcher = new Patcher(info.settings->gamePath + "/boot", info.settings->bootData);
|
||||||
connect(patcher, &Patcher::done, [=, &info] {
|
connect(patcher, &Patcher::done, [=, &info] {
|
||||||
window.readGameVersion();
|
window.readGameVersion();
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
||||||
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
|
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
|
||||||
QString body = reply->readAll();
|
QString body = reply->readAll();
|
||||||
|
|
||||||
patcher = new Patcher(false, info.settings->gamePath + "/game");
|
patcher = new Patcher(info.settings->gamePath + "/game", info.settings->gameData);
|
||||||
connect(patcher, &Patcher::done, [=, &info] {
|
connect(patcher, &Patcher::done, [=, &info] {
|
||||||
window.readGameVersion();
|
window.readGameVersion();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue