1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 21:07:45 +00:00

Add a bunch of Wine performance options to settings

This commit is contained in:
redstrate 2021-11-01 14:35:32 -04:00
parent f8566a5669
commit 95abfb472d
3 changed files with 86 additions and 36 deletions

View file

@ -5,6 +5,8 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QLabel> #include <QLabel>
#include <QFileDialog> #include <QFileDialog>
#include <QCheckBox>
#include <QGroupBox>
#include "xivlauncher.h" #include "xivlauncher.h"
@ -15,6 +17,57 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
auto layout = new QFormLayout(this); auto layout = new QFormLayout(this);
setLayout(layout); setLayout(layout);
#if defined(Q_OS_LINUX)
auto wineBox = new QGroupBox("Wine Options");
auto wineBoxLayout = new QFormLayout();
wineBox->setLayout(wineBoxLayout);
auto infoLabel = new QLabel("This is a list of possible enhancements you can make to your Wine gaming experience.\n"
"This is all stuff you can do outside of the launcher, but we can take care of it for you.");
wineBoxLayout->addWidget(infoLabel);
auto useEsync = new QCheckBox("Use Esync");
useEsync->setChecked(window.settings.value("useEsync", false).toBool());
wineBoxLayout->addWidget(useEsync);
auto esyncLabel = new QLabel("Improves general game performance, but requires a Wine built with the Esync patches.\n"
"If you use the latest Wine staging, it should work.");
wineBoxLayout->addWidget(esyncLabel);
connect(useEsync, &QCheckBox::stateChanged, [this](int state) {
this->window.useEsync = state;
this->window.settings.setValue("useEsync", static_cast<bool>(state));
});
auto useGamescope = new QCheckBox("Use Gamescope");
useGamescope->setChecked(window.settings.value("useGamescope", false).toBool());
wineBoxLayout->addWidget( useGamescope);
auto gamescopeLabel = new QLabel("Use the SteamOS compositor that uses Wayland.\n"
"If you are experiencing input issues on XWayland, try this option if you have it installed.");
wineBoxLayout->addWidget(gamescopeLabel);
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
this->window.useGamescope = state;
this->window.settings.setValue("useGamescope", static_cast<bool>(state));
});
auto useGamemode = new QCheckBox("Use Gamemode");
useGamemode->setChecked(window.settings.value("useGamemode", false).toBool());
wineBoxLayout->addWidget(useGamemode);
auto gamemodeLabel = new QLabel("Use Feral Interactive's GameMode, which applies a couple of performance enhancements.\n"
"May give a slight performance boost, but requires GameMode to be installed.\n");
wineBoxLayout->addWidget(gamemodeLabel);
connect(useGamemode, &QCheckBox::stateChanged, [this](int state) {
this->window.useGamemode = state;
this->window.settings.setValue("useGamemode", static_cast<bool>(state));
});
layout->addRow(wineBox);
#endif
auto currentGameDirectory = new QLabel(window.gamePath); auto currentGameDirectory = new QLabel(window.gamePath);
layout->addRow("Game Directory", currentGameDirectory); layout->addRow("Game Directory", currentGameDirectory);

View file

@ -42,42 +42,42 @@ void LauncherWindow::buildRequest(QNetworkRequest& request) {
void LauncherWindow::launch(const LoginAuth auth) { void LauncherWindow::launch(const LoginAuth auth) {
auto process = new QProcess(this); auto process = new QProcess(this);
process->setProcessChannelMode(QProcess::ForwardedChannels); process->setProcessChannelMode(QProcess::ForwardedChannels);
process->setWorkingDirectory(gamePath + "/game/");
bool isWine = false; QList<QString> arguments;
QString winePath;
QString ffxivPath;
#if defined(Q_OS_WIN)
ffxivPath = gamePath + "\\game\\ffxiv_dx11.exe";
#endif
// for platforms using wine, set wine before ffxiv_dx11.exe
// TODO: make wine path configurable
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
isWine = true; arguments.push_back("/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine");
// TODO: this is assuming FFXIV is installed in /Applications
winePath = "/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine";
ffxivPath = QDir::homePath() + "/Library/Application Support/FINAL FANTASY XIV ONLINE/Bottles/published_Final_Fantasy/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn/game/ffxiv_dx11.exe";
#endif #endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
isWine = true; if(useGamescope) {
// TODO: this is assuming you want to use the wine in your PATH, which isn't always the case arguments.push_back("gamescope");
winePath = "wine"; arguments.push_back("-f");
arguments.push_back("-b");
// TODO: this is assuming it's in your default WINEPREFIX
ffxivPath = gamePath + "/game/ffxiv_dx11.exe";
process->setWorkingDirectory(gamePath + "/game/");
#endif
QList<QString> arguments;
if (isWine) {
arguments.push_back(ffxivPath);
} }
// i wonder what these mean... if(useGamemode)
arguments.push_back("gamemoderun");
arguments.push_back("wine");
QStringList env = QProcess::systemEnvironment();
env << "DXVK_HUD=full";
if(useEsync) {
env << "WINEESYNC=1";
}
process->setEnvironment(env);
#endif
// now for the actual game...
arguments.push_back(gamePath + "\\game\\ffxiv_dx11.exe");
arguments.push_back("DEV.DataPathType=1"); arguments.push_back("DEV.DataPathType=1");
arguments.push_back("DEV.UseSqPack=1"); arguments.push_back("DEV.UseSqPack=1");
// by the way, it looks like setting graphics options is possible via these too, i wonder what
// else is hiding :-)))
arguments.push_back(QString("DEV.MaxEntitledExpansionID=%1").arg(auth.maxExpansion)); arguments.push_back(QString("DEV.MaxEntitledExpansionID=%1").arg(auth.maxExpansion));
arguments.push_back(QString("DEV.TestSID=%1").arg(auth.SID)); arguments.push_back(QString("DEV.TestSID=%1").arg(auth.SID));
@ -91,14 +91,9 @@ void LauncherWindow::launch(const LoginAuth auth) {
arguments.push_back(QString("DEV.LobbyHost0%1=%2 DEV.LobbyPort0%1=54994").arg(QString::number(i), auth.lobbyhost)); arguments.push_back(QString("DEV.LobbyHost0%1=%2 DEV.LobbyPort0%1=54994").arg(QString::number(i), auth.lobbyhost));
} }
if (isWine) { auto executable = arguments[0];
QStringList env = QProcess::systemEnvironment(); arguments.removeFirst();
//env << "DXVK_FILTER_DEVICE_NAME=AMD"; process->start(executable, arguments);
process->setEnvironment(env);
process->start(winePath, arguments);
} else {
process->start(ffxivPath, arguments);
}
} }
QString LauncherWindow::readVersion(QString path) { QString LauncherWindow::readVersion(QString path) {

View file

@ -35,17 +35,19 @@ public:
QString gamePath; QString gamePath;
QString bootVersion, gameVersion; QString bootVersion, gameVersion;
bool useEsync, useGamescope, useGamemode;
void launch(const LoginAuth auth); void launch(const LoginAuth auth);
void buildRequest(QNetworkRequest& request); void buildRequest(QNetworkRequest& request);
void setSSL(QNetworkRequest& request); void setSSL(QNetworkRequest& request);
QString readVersion(QString path); QString readVersion(QString path);
QSettings settings;
private: private:
void readInitialInformation(); void readInitialInformation();
SapphireLauncher* sapphireLauncher; SapphireLauncher* sapphireLauncher;
SquareBoot* squareBoot; SquareBoot* squareBoot;
SquareLauncher* squareLauncher; SquareLauncher* squareLauncher;
QSettings settings;
}; };