mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
Check for wine version
This isn't displayed in the settings UI yet.
This commit is contained in:
parent
b095b343fe
commit
7b2a0ca1c2
6 changed files with 58 additions and 38 deletions
|
@ -21,6 +21,12 @@ enum class GameLicense {
|
||||||
FreeTrial
|
FreeTrial
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class WineType {
|
||||||
|
System,
|
||||||
|
Custom,
|
||||||
|
Builtin // macos only
|
||||||
|
};
|
||||||
|
|
||||||
struct ProfileSettings {
|
struct ProfileSettings {
|
||||||
QUuid uuid;
|
QUuid uuid;
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -28,7 +34,7 @@ struct ProfileSettings {
|
||||||
// game
|
// game
|
||||||
int language = 1; // 1 is english, thats all i know
|
int language = 1; // 1 is english, thats all i know
|
||||||
QString gamePath, winePath, winePrefixPath;
|
QString gamePath, winePath, winePrefixPath;
|
||||||
QString bootVersion, gameVersion;
|
QString bootVersion, gameVersion, wineVersion;
|
||||||
int installedMaxExpansion = -1;
|
int installedMaxExpansion = -1;
|
||||||
QList<QString> expansionVersions;
|
QList<QString> expansionVersions;
|
||||||
bool enableWatchdog = false;
|
bool enableWatchdog = false;
|
||||||
|
@ -37,14 +43,16 @@ struct ProfileSettings {
|
||||||
return !gameVersion.isEmpty();
|
return !gameVersion.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// wine
|
bool isWineInstalled() const {
|
||||||
// 0 = system, 1 = custom, 2 = built-in (mac only)
|
return !wineVersion.isEmpty();
|
||||||
// TODO: yes, i know this should be an enum
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
int wineVersion = 2;
|
WineType wineType = WineType::Builtin;
|
||||||
#else
|
#else
|
||||||
int wineVersion = 0;
|
WineType wineType = WineType::System;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool useEsync = false, useGamescope = false, useGamemode = false;
|
bool useEsync = false, useGamescope = false, useGamemode = false;
|
||||||
bool useDX9 = false;
|
bool useDX9 = false;
|
||||||
bool enableDXVKhud = false;
|
bool enableDXVKhud = false;
|
||||||
|
@ -160,7 +168,6 @@ private:
|
||||||
|
|
||||||
QString getDefaultGamePath();
|
QString getDefaultGamePath();
|
||||||
QString getDefaultWinePrefixPath();
|
QString getDefaultWinePrefixPath();
|
||||||
int getDefaultWineVersion();
|
|
||||||
|
|
||||||
QVector<ProfileSettings> profileSettings;
|
QVector<ProfileSettings> profileSettings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,4 +42,8 @@ private:
|
||||||
QLineEdit* otpEdit;
|
QLineEdit* otpEdit;
|
||||||
QCheckBox* rememberUsernameBox, *rememberPasswordBox;
|
QCheckBox* rememberUsernameBox, *rememberPasswordBox;
|
||||||
QPushButton* loginButton, *registerButton;
|
QPushButton* loginButton, *registerButton;
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
|
QAction* wineCfg;
|
||||||
|
#endif
|
||||||
};
|
};
|
|
@ -36,7 +36,7 @@ private:
|
||||||
QPushButton* gameDirectoryButton = nullptr;
|
QPushButton* gameDirectoryButton = nullptr;
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
QComboBox* wineVersionCombo;
|
QComboBox* wineTypeCombo;
|
||||||
QPushButton* selectWineButton;
|
QPushButton* selectWineButton;
|
||||||
QLineEdit* winePathLabel;
|
QLineEdit* winePathLabel;
|
||||||
QLineEdit* winePrefixDirectory;
|
QLineEdit* winePrefixDirectory;
|
||||||
|
|
|
@ -327,7 +327,6 @@ void LauncherCore::readInitialInformation() {
|
||||||
settings.beginGroup(uuid);
|
settings.beginGroup(uuid);
|
||||||
|
|
||||||
profile.name = settings.value("name", "Default").toString();
|
profile.name = settings.value("name", "Default").toString();
|
||||||
profile.wineVersion = settings.value("wineVersion", getDefaultWineVersion()).toInt();
|
|
||||||
|
|
||||||
readWineInfo(profile);
|
readWineInfo(profile);
|
||||||
|
|
||||||
|
@ -358,6 +357,9 @@ void LauncherCore::readInitialInformation() {
|
||||||
profile.license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
|
profile.license = (GameLicense)settings.value("license", (int)defaultSettings.license).toInt();
|
||||||
|
|
||||||
profile.useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();
|
profile.useDX9 = settings.value("useDX9", defaultSettings.useDX9).toBool();
|
||||||
|
|
||||||
|
// wine
|
||||||
|
profile.wineType = (WineType)settings.value("wineType", (int)defaultSettings.wineType).toInt();
|
||||||
profile.useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
|
profile.useEsync = settings.value("useEsync", defaultSettings.useEsync).toBool();
|
||||||
|
|
||||||
if(gamescopeAvailable)
|
if(gamescopeAvailable)
|
||||||
|
@ -367,6 +369,7 @@ void LauncherCore::readInitialInformation() {
|
||||||
profile.useGamemode = settings.value("useGamemode", defaultSettings.useGamemode).toBool();
|
profile.useGamemode = settings.value("useGamemode", defaultSettings.useGamemode).toBool();
|
||||||
|
|
||||||
profile.enableDXVKhud = settings.value("enableDXVKhud", defaultSettings.enableDXVKhud).toBool();
|
profile.enableDXVKhud = settings.value("enableDXVKhud", defaultSettings.enableDXVKhud).toBool();
|
||||||
|
|
||||||
profile.enableWatchdog = settings.value("enableWatchdog", defaultSettings.enableWatchdog).toBool();
|
profile.enableWatchdog = settings.value("enableWatchdog", defaultSettings.enableWatchdog).toBool();
|
||||||
|
|
||||||
// gamescope
|
// gamescope
|
||||||
|
@ -389,29 +392,41 @@ void LauncherCore::readInitialInformation() {
|
||||||
|
|
||||||
void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
switch(profile.wineVersion) {
|
switch(profile.wineType) {
|
||||||
case 0: // system wine
|
case WineType::System: // system wine
|
||||||
profile.winePath = "/usr/local/bin/wine64";
|
profile.winePath = "/usr/local/bin/wine64";
|
||||||
break;
|
break;
|
||||||
case 1: // custom path
|
case WineType::Custom: // custom path
|
||||||
profile.winePath = profile.winePath;
|
profile.winePath = profile.winePath;
|
||||||
break;
|
break;
|
||||||
case 2: // ffxiv built-in (for mac users)
|
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";
|
profile.winePath = "/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
switch(profile.wineVersion) {
|
switch(profile.wineType) {
|
||||||
case 0: // system wine (should be in $PATH)
|
case WineType::System: // system wine (should be in $PATH)
|
||||||
profile.winePath = "wine";
|
profile.winePath = "/usr/bin/wine";
|
||||||
break;
|
break;
|
||||||
case 1: // custom pth
|
case WineType::Custom: // custom pth
|
||||||
profile.winePath = profile.winePath;
|
profile.winePath = profile.winePath;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
|
auto wineProcess = new QProcess();
|
||||||
|
wineProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
|
||||||
|
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, &profile] {
|
||||||
|
profile.wineVersion = wineProcess->readAllStandardOutput().trimmed();
|
||||||
|
});
|
||||||
|
|
||||||
|
wineProcess->start(profile.winePath, {"--version"});
|
||||||
|
wineProcess->waitForFinished();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::readGameVersion() {
|
void LauncherCore::readGameVersion() {
|
||||||
|
@ -489,8 +504,6 @@ int LauncherCore::addProfile() {
|
||||||
newProfile.uuid = QUuid::createUuid();
|
newProfile.uuid = QUuid::createUuid();
|
||||||
newProfile.name = "New Profile";
|
newProfile.name = "New Profile";
|
||||||
|
|
||||||
newProfile.wineVersion = getDefaultWineVersion();
|
|
||||||
|
|
||||||
readWineInfo(newProfile);
|
readWineInfo(newProfile);
|
||||||
|
|
||||||
newProfile.gamePath = getDefaultGamePath();
|
newProfile.gamePath = getDefaultGamePath();
|
||||||
|
@ -537,7 +550,7 @@ void LauncherCore::saveSettings() {
|
||||||
settings.setValue("gamePath", profile.gamePath);
|
settings.setValue("gamePath", profile.gamePath);
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
settings.setValue("wineVersion", profile.wineVersion);
|
settings.setValue("wineType", (int)profile.wineType);
|
||||||
settings.setValue("winePath", profile.winePath);
|
settings.setValue("winePath", profile.winePath);
|
||||||
settings.setValue("winePrefixPath", profile.winePrefixPath);
|
settings.setValue("winePrefixPath", profile.winePrefixPath);
|
||||||
|
|
||||||
|
@ -618,11 +631,3 @@ QString LauncherCore::getDefaultGamePath() {
|
||||||
return QDir::homePath() + "/.wine/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn";
|
return QDir::homePath() + "/.wine/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int LauncherCore::getDefaultWineVersion() {
|
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
return 2;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
QAction* wineCfg = fileMenu->addAction("Configure Wine...");
|
wineCfg = fileMenu->addAction("Configure Wine...");
|
||||||
wineCfg->setIcon(QIcon::fromTheme("settings"));
|
wineCfg->setIcon(QIcon::fromTheme("settings"));
|
||||||
connect(wineCfg, &QAction::triggered, [=] {
|
connect(wineCfg, &QAction::triggered, [=] {
|
||||||
this->core.launchExecutable(currentProfile(), {"winecfg.exe"});
|
this->core.launchExecutable(currentProfile(), {"winecfg.exe"});
|
||||||
|
@ -331,6 +331,10 @@ void LauncherWindow::reloadControls() {
|
||||||
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
||||||
openGameDir->setEnabled(currentProfile().isGameInstalled());
|
openGameDir->setEnabled(currentProfile().isGameInstalled());
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
|
wineCfg->setEnabled(currentProfile().isWineInstalled());
|
||||||
|
#endif
|
||||||
|
|
||||||
currentlyReloadingControls = false;
|
currentlyReloadingControls = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,25 +231,25 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
|
||||||
winePathLabel->setReadOnly(true);
|
winePathLabel->setReadOnly(true);
|
||||||
wineBoxLayout->addRow("Wine Executable", winePathLabel);
|
wineBoxLayout->addRow("Wine Executable", winePathLabel);
|
||||||
|
|
||||||
wineVersionCombo = new QComboBox();
|
wineTypeCombo = new QComboBox();
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
wineVersionCombo->insertItem(2, "FFXIV Built-In");
|
wineTypeCombo->insertItem(2, "FFXIV Built-In");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wineVersionCombo->insertItem(0, "System Wine");
|
wineTypeCombo->insertItem(0, "System Wine");
|
||||||
wineVersionCombo->insertItem(1, "Custom Path...");
|
wineTypeCombo->insertItem(1, "Custom Wine");
|
||||||
|
|
||||||
wineBoxLayout->addWidget(wineVersionCombo);
|
wineBoxLayout->addWidget(wineTypeCombo);
|
||||||
|
|
||||||
selectWineButton = new QPushButton("Select Wine Executable");
|
selectWineButton = new QPushButton("Select Wine Executable");
|
||||||
wineBoxLayout->addWidget(selectWineButton);
|
wineBoxLayout->addWidget(selectWineButton);
|
||||||
|
|
||||||
connect(wineVersionCombo,
|
connect(wineTypeCombo,
|
||||||
static_cast<void (QComboBox::*)(int)>(
|
static_cast<void (QComboBox::*)(int)>(
|
||||||
&QComboBox::currentIndexChanged),
|
&QComboBox::currentIndexChanged),
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
getCurrentProfile().wineVersion = index;
|
getCurrentProfile().wineType = (WineType)index;
|
||||||
|
|
||||||
this->core.readWineInfo(getCurrentProfile());
|
this->core.readWineInfo(getCurrentProfile());
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
|
@ -450,8 +450,8 @@ void SettingsWindow::reloadControls() {
|
||||||
|
|
||||||
// wine
|
// wine
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
wineVersionCombo->setCurrentIndex(profile.wineVersion);
|
wineTypeCombo->setCurrentIndex((int)profile.wineType);
|
||||||
selectWineButton->setEnabled(profile.wineVersion == 1);
|
selectWineButton->setEnabled(profile.wineType == WineType::Custom);
|
||||||
winePathLabel->setText(profile.winePath);
|
winePathLabel->setText(profile.winePath);
|
||||||
winePrefixDirectory->setText(profile.winePrefixPath);
|
winePrefixDirectory->setText(profile.winePrefixPath);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue