1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 20:47:45 +00:00

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.
This commit is contained in:
Joshua Goins 2022-04-14 16:29:23 -04:00
parent 3469c99953
commit 0ef0bca80e
8 changed files with 56 additions and 9 deletions

2
external/libxiv vendored

@ -1 +1 @@
Subproject commit 0e653bf6e95b7633b3f0a55217d82cf799b4a289
Subproject commit 58a24f08b86ea41e5c5b4cb18ec104b9ad872118

View file

@ -4,6 +4,7 @@
#include <functional>
class LauncherCore;
class ProfileSettings;
// TODO: convert to a nice signal/slots class like assetupdater
void installGame(LauncherCore& launcher, std::function<void()> returnFunc);
void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function<void()> returnFunc);

View file

@ -24,7 +24,8 @@ enum class GameLicense {
enum class WineType {
System,
Custom,
Builtin // macos only
Builtin, // macos only
XIVOnMac // macos only
};
enum class DalamudChannel {

View file

@ -7,8 +7,8 @@
#include "launchercore.h"
void installGame(LauncherCore& launcher, std::function<void()> returnFunc) {
QString installDirectory = launcher.getProfile(launcher.defaultProfileIndex).gamePath;
void installGame(LauncherCore& launcher, ProfileSettings& profile, std::function<void()> returnFunc) {
QString installDirectory = profile.gamePath;
qDebug() << "Installing game to " << installDirectory << "!";
qDebug() << "Now downloading installer file...";
@ -27,7 +27,7 @@ void installGame(LauncherCore& launcher, std::function<void()> returnFunc) {
extractBootstrapFiles((dataDir + "/ffxivsetup.exe").toStdString(), installDirectory.toStdString());
qDebug() << "Done installing!";
qDebug() << "Done installing to " << installDirectory << "!";
returnFunc();
});

View file

@ -250,6 +250,14 @@ void LauncherCore::launchExecutable(const ProfileSettings& profile, QProcess* pr
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
env.insert("WINEPREFIX", profile.winePrefixPath);
// XIV on Mac bundle their own Wine install directory, complete with libs etc
if(profile.wineType == WineType::XIVOnMac) {
// TODO: don't hardcode this
QString xivLibPath = "/Applications/XIV on Mac.app/Contents/Resources/wine/lib";
env.insert("DYLD_FALLBACK_LIBRARY_PATH", xivLibPath);
}
arguments.push_back(profile.winePath);
#endif
@ -354,8 +362,6 @@ void LauncherCore::readInitialInformation() {
profile.name = settings.value("name", "Default").toString();
readWineInfo(profile);
if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) {
profile.gamePath = settings.value("gamePath").toString();
} else {
@ -389,6 +395,8 @@ void LauncherCore::readInitialInformation() {
profile.wineType = (WineType)settings.value("wineType", (int)defaultSettings.wineType).toInt();
profile.useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
readWineInfo(profile);
if(gamescopeAvailable)
profile.useGamescope = settings.value("useGamescope", defaultSettings.useGamescope).toBool();
@ -430,6 +438,9 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
case WineType::Builtin: // ffxiv built-in (for mac users)
profile.winePath = "/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine";
break;
case WineType::XIVOnMac:
profile.winePath = "/Applications/XIV on Mac.app/Contents/Resources/wine/bin/wine64";
break;
}
#endif

View file

@ -17,6 +17,7 @@
#include "headline.h"
#include "config.h"
#include "aboutwindow.h"
#include "gameinstaller.h"
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
setWindowTitle("Astra");
@ -51,6 +52,38 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
openPath(currentProfile().gamePath);
});
QMenu* gameMenu = menuBar()->addMenu("Game");
auto installGameAction = gameMenu->addAction("Install game...");
connect(installGameAction, &QAction::triggered, [this] {
// TODO: lol duplication
auto messageBox = new QMessageBox(this);
messageBox->setIcon(QMessageBox::Icon::Question);
messageBox->setText("Warning");
messageBox->setInformativeText("FFXIV will be installed to your selected game directory.");
QString detailedText = QString("Astra will install FFXIV for you at '%1'").arg(this->currentProfile().gamePath);
detailedText.append("\n\nIf you do not wish to install it to this location, please change your profile settings.");
messageBox->setDetailedText(detailedText);
messageBox->setWindowModality(Qt::WindowModal);
auto installButton = messageBox->addButton("Install Game", QMessageBox::YesRole);
connect(installButton, &QPushButton::clicked, [this, messageBox] {
installGame(this->core, this->currentProfile(), [this, messageBox] {
this->core.readGameVersion();
messageBox->close();
});
});
messageBox->addButton(QMessageBox::StandardButton::No);
messageBox->setDefaultButton(installButton);
messageBox->exec();
});
QMenu* fileMenu = menuBar()->addMenu("Settings");
QAction* settingsAction = fileMenu->addAction("Configure Astra...");

View file

@ -124,7 +124,7 @@ int main(int argc, char* argv[]) {
auto installButton = messageBox->addButton("Install Game", QMessageBox::YesRole);
c.connect(installButton, &QPushButton::clicked, [&c, messageBox] {
installGame(c, [messageBox, &c] {
installGame(c, c.getProfile(c.defaultProfileIndex), [messageBox, &c] {
c.readGameVersion();
messageBox->close();

View file

@ -264,6 +264,7 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
#if defined(Q_OS_MAC)
wineTypeCombo->insertItem(2, "FFXIV Built-In");
wineTypeCombo->insertItem(3, "XIV on Mac");
#endif
wineTypeCombo->insertItem(0, "System Wine");