1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00
astra/src/gameinstaller.cpp
Joshua Goins 0ef0bca80e Big macOS changes pt. 1
There's a new "Game" menu where you can install the game if you
missed the initial prompt on start-up.

If you have XIV on Mac (a fellow XIV launcher) installed, you
now have the option of using their wine binaries and libraries. There is
more to come in future commits, especially pertaining DXVK and MoltenVK.

Game installation has been fixed for macOS, enabling you to start
updating right away without having to fiddle around with finding the
right installer or app package.
2022-04-14 16:29:23 -04:00

34 lines
No EOL
1.1 KiB
C++

#include "gameinstaller.h"
#include <installextract.h>
#include <QNetworkReply>
#include <QStandardPaths>
#include <QFile>
#include "launchercore.h"
void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function<void()> returnFunc) {
QString installDirectory = profile.gamePath;
qDebug() << "Installing game to " << installDirectory << "!";
qDebug() << "Now downloading installer file...";
QNetworkRequest request(QUrl("https://gdl.square-enix.com/ffxiv/inst/ffxivsetup.exe"));
auto reply = launcher.mgr->get(request);
launcher.connect(reply, &QNetworkReply::finished, [reply, installDirectory, returnFunc] {
QString dataDir =
QStandardPaths::writableLocation(QStandardPaths::TempLocation);
QFile file(dataDir + "/ffxivsetup.exe");
file.open(QIODevice::WriteOnly);
file.write(reply->readAll());
file.close();
extractBootstrapFiles((dataDir + "/ffxivsetup.exe").toStdString(), installDirectory.toStdString());
qDebug() << "Done installing to " << installDirectory << "!";
returnFunc();
});
}