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

Fix and re-enable gamescope launch

This commit is contained in:
Joshua Goins 2023-12-31 17:19:29 -05:00
parent da8b5d5e85
commit 06704728b7
2 changed files with 24 additions and 18 deletions

View file

@ -177,6 +177,9 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
setWindowsVersion(profile, QStringLiteral("win7")); setWindowsVersion(profile, QStringLiteral("win7"));
// TODO: band-aid fix to wait for wine to exit, otherwise gamescope will collide
QThread::sleep(2);
// copy DXVK // copy DXVK
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
const QDir compatibilityToolDir = dataDir.absoluteFilePath(QStringLiteral("tool")); const QDir compatibilityToolDir = dataDir.absoluteFilePath(QStringLiteral("tool"));
@ -206,14 +209,22 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
if (profile.gamescopeBorderless()) if (profile.gamescopeBorderless())
arguments.push_back(QStringLiteral("-b")); arguments.push_back(QStringLiteral("-b"));
if (profile.gamescopeWidth() > 0) if (profile.gamescopeWidth() > 0) {
arguments.push_back(QStringLiteral("-w ") + QString::number(profile.gamescopeWidth())); arguments.push_back(QStringLiteral("-w"));
arguments.push_back(QString::number(profile.gamescopeWidth()));
}
if (profile.gamescopeHeight() > 0) if (profile.gamescopeHeight() > 0) {
arguments.push_back(QStringLiteral("-h ") + QString::number(profile.gamescopeHeight())); arguments.push_back(QStringLiteral("-h"));
arguments.push_back(QString::number(profile.gamescopeHeight()));
}
if (profile.gamescopeRefreshRate() > 0) if (profile.gamescopeRefreshRate() > 0) {
arguments.push_back(QStringLiteral("-r ") + QString::number(profile.gamescopeRefreshRate())); arguments.push_back(QStringLiteral("-r"));
arguments.push_back(QString::number(profile.gamescopeRefreshRate()));
}
arguments.push_back(QStringLiteral("--"));
} }
#ifdef ENABLE_GAMEMODE #ifdef ENABLE_GAMEMODE
@ -258,9 +269,10 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
process->setProcessEnvironment(env); process->setProcessEnvironment(env);
qInfo() << executable << arguments; process->setProgram(executable);
process->setArguments(arguments);
process->start(executable, arguments); process->start();
} }
void GameRunner::addRegistryKey(const Profile &settings, const QString &key, const QString &value, const QString &data) void GameRunner::addRegistryKey(const Profile &settings, const QString &key, const QString &value, const QString &data)
@ -272,6 +284,7 @@ void GameRunner::addRegistryKey(const Profile &settings, const QString &key, con
{QStringLiteral("reg"), QStringLiteral("add"), key, QStringLiteral("/v"), value, QStringLiteral("/d"), data, QStringLiteral("/f")}, {QStringLiteral("reg"), QStringLiteral("add"), key, QStringLiteral("/v"), value, QStringLiteral("/d"), data, QStringLiteral("/f")},
false, false,
false); false);
process->waitForFinished();
} }
void GameRunner::setWindowsVersion(const Profile &settings, const QString &version) void GameRunner::setWindowsVersion(const Profile &settings, const QString &version)
@ -279,4 +292,5 @@ void GameRunner::setWindowsVersion(const Profile &settings, const QString &versi
auto process = new QProcess(this); auto process = new QProcess(this);
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
launchExecutable(settings, process, {QStringLiteral("winecfg"), QStringLiteral("/v"), version}, false, false); launchExecutable(settings, process, {QStringLiteral("winecfg"), QStringLiteral("/v"), version}, false, false);
process->waitForFinished();
} }

View file

@ -134,19 +134,13 @@ FormCard.FormCardPage {
description: i18n("A micro-compositor that uses Wayland to create a nested session.\nIf you use fullscreen mode, it may improve input handling.") description: i18n("A micro-compositor that uses Wayland to create a nested session.\nIf you use fullscreen mode, it may improve input handling.")
checked: page.profile.gamescopeEnabled checked: page.profile.gamescopeEnabled
onCheckedChanged: page.profile.gamescopeEnabled = checked onCheckedChanged: page.profile.gamescopeEnabled = checked
visible: false
enabled: false
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {}
visible: false
}
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18n("Configure Gamescope...") text: i18n("Configure Gamescope...")
icon.name: "configure" icon.name: "configure"
enabled: false
visible: false
Kirigami.PromptDialog { Kirigami.PromptDialog {
id: gamescopeSettingsDialog id: gamescopeSettingsDialog
title: i18n("Configure Gamescope") title: i18n("Configure Gamescope")
@ -186,9 +180,7 @@ FormCard.FormCardPage {
onClicked: gamescopeSettingsDialog.open() onClicked: gamescopeSettingsDialog.open()
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {}
visible: false
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: gamemodeDelegate id: gamemodeDelegate