mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 04:57:44 +00:00
Add option to change to a custom WINE prefix
This commit is contained in:
parent
f921e734ef
commit
01881e5490
4 changed files with 49 additions and 9 deletions
|
@ -78,6 +78,25 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
||||||
winePathLabel->setText(this->window.winePath);
|
winePathLabel->setText(this->window.winePath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto winePrefixDirectory = new QLabel(window.winePrefixPath);
|
||||||
|
winePrefixDirectory->setWordWrap(true);
|
||||||
|
wineBoxLayout->addRow("Wine Prefix", winePrefixDirectory);
|
||||||
|
|
||||||
|
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
||||||
|
connect(selectPrefixButton, &QPushButton::pressed, [this, winePrefixDirectory] {
|
||||||
|
this->window.winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
||||||
|
winePrefixDirectory->setText(this->window.winePrefixPath);
|
||||||
|
|
||||||
|
this->window.readInitialInformation();
|
||||||
|
});
|
||||||
|
wineBoxLayout->addWidget(selectPrefixButton);
|
||||||
|
|
||||||
|
auto openPrefixButton = new QPushButton("Open Wine Prefix");
|
||||||
|
connect(openPrefixButton, &QPushButton::pressed, [this] {
|
||||||
|
openPath(this->window.winePrefixPath);
|
||||||
|
});
|
||||||
|
wineBoxLayout->addWidget(openPrefixButton);
|
||||||
|
|
||||||
auto enableDXVKhud = new QCheckBox("Enable DXVK HUD");
|
auto enableDXVKhud = new QCheckBox("Enable DXVK HUD");
|
||||||
enableDXVKhud->setChecked(window.enableDXVKhud);
|
enableDXVKhud->setChecked(window.enableDXVKhud);
|
||||||
wineBoxLayout->addWidget(enableDXVKhud);
|
wineBoxLayout->addWidget(enableDXVKhud);
|
||||||
|
@ -147,14 +166,18 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
||||||
|
|
||||||
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||||
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
#if defined(Q_OS_WIN)
|
openPath(this->window.gamePath);
|
||||||
// for some reason, windows requires special treatment (what else is new?)
|
|
||||||
const QFileInfo fileInfo(this->window.gamePath);
|
|
||||||
|
|
||||||
QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath())));
|
|
||||||
#else
|
|
||||||
QDesktopServices::openUrl("file://" + this->window.gamePath);
|
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
layout->addWidget(gameDirectoryButton);
|
layout->addWidget(gameDirectoryButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWindow::openPath(const QString path) {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
// for some reason, windows requires special treatment (what else is new?)
|
||||||
|
const QFileInfo fileInfo(path);
|
||||||
|
|
||||||
|
QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath())));
|
||||||
|
#else
|
||||||
|
QDesktopServices::openUrl("file://" + path);
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -9,5 +9,7 @@ public:
|
||||||
SettingsWindow(LauncherWindow& window, QWidget* parent = nullptr);
|
SettingsWindow(LauncherWindow& window, QWidget* parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void openPath(const QString path);
|
||||||
|
|
||||||
LauncherWindow& window;
|
LauncherWindow& window;
|
||||||
};
|
};
|
|
@ -89,13 +89,15 @@ void LauncherWindow::launchExecutable(const QStringList args) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
arguments.push_back(winePath);
|
env << "WINEPREFIX=" + winePrefixPath;
|
||||||
#endif
|
|
||||||
|
|
||||||
if(enableDXVKhud)
|
if(enableDXVKhud)
|
||||||
env << "DXVK_HUD=full";
|
env << "DXVK_HUD=full";
|
||||||
|
|
||||||
|
arguments.push_back(winePath);
|
||||||
|
#endif
|
||||||
|
|
||||||
arguments.append(args);
|
arguments.append(args);
|
||||||
|
|
||||||
auto executable = arguments[0];
|
auto executable = arguments[0];
|
||||||
|
@ -156,6 +158,18 @@ void LauncherWindow::readInitialInformation() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(settings.contains("winePrefix") && settings.value("winePrefix").canConvert<QString>() && !settings.value("winePrefix").toString().isEmpty()) {
|
||||||
|
winePrefixPath = settings.value("winePrefix").toString();
|
||||||
|
} else {
|
||||||
|
#if defined(Q_OS_MACOS)
|
||||||
|
winePrefixPath = QDir::homePath() + "/Library/Application Support/FINAL FANTASY XIV ONLINE/Bottles/published_Final_Fantasy";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
winePrefixPath = QDir::homePath() + "/.wine";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bootVersion = readVersion(gamePath + "/boot/ffxivboot.ver");
|
bootVersion = readVersion(gamePath + "/boot/ffxivboot.ver");
|
||||||
gameVersion = readVersion(gamePath + "/game/ffxivgame.ver");
|
gameVersion = readVersion(gamePath + "/game/ffxivgame.ver");
|
||||||
|
|
||||||
|
@ -298,6 +312,7 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
||||||
auto info = LoginInformation{usernameEdit->text(), passwordEdit->text(), otpEdit->text()};
|
auto info = LoginInformation{usernameEdit->text(), passwordEdit->text(), otpEdit->text()};
|
||||||
|
|
||||||
settings.setValue("gamePath", gamePath);
|
settings.setValue("gamePath", gamePath);
|
||||||
|
settings.setValue("winePrefix", winePrefixPath);
|
||||||
|
|
||||||
settings.setValue("rememberUsername", rememberUsernameBox->checkState() == Qt::CheckState::Checked);
|
settings.setValue("rememberUsername", rememberUsernameBox->checkState() == Qt::CheckState::Checked);
|
||||||
if(rememberUsernameBox->checkState() == Qt::CheckState::Checked) {
|
if(rememberUsernameBox->checkState() == Qt::CheckState::Checked) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
QNetworkAccessManager* mgr;
|
QNetworkAccessManager* mgr;
|
||||||
|
|
||||||
int language = 1; // 1 is english, thats all i know
|
int language = 1; // 1 is english, thats all i know
|
||||||
QString gamePath, winePath;
|
QString gamePath, winePath, winePrefixPath;
|
||||||
QString bootVersion, gameVersion;
|
QString bootVersion, gameVersion;
|
||||||
|
|
||||||
bool useEsync, useGamescope, useGamemode;
|
bool useEsync, useGamescope, useGamemode;
|
||||||
|
|
Loading…
Add table
Reference in a new issue