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"));
// TODO: band-aid fix to wait for wine to exit, otherwise gamescope will collide
QThread::sleep(2);
// copy DXVK
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
const QDir compatibilityToolDir = dataDir.absoluteFilePath(QStringLiteral("tool"));
@ -206,14 +209,22 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
if (profile.gamescopeBorderless())
arguments.push_back(QStringLiteral("-b"));
if (profile.gamescopeWidth() > 0)
arguments.push_back(QStringLiteral("-w ") + QString::number(profile.gamescopeWidth()));
if (profile.gamescopeWidth() > 0) {
arguments.push_back(QStringLiteral("-w"));
arguments.push_back(QString::number(profile.gamescopeWidth()));
}
if (profile.gamescopeHeight() > 0)
arguments.push_back(QStringLiteral("-h ") + QString::number(profile.gamescopeHeight()));
if (profile.gamescopeHeight() > 0) {
arguments.push_back(QStringLiteral("-h"));
arguments.push_back(QString::number(profile.gamescopeHeight()));
}
if (profile.gamescopeRefreshRate() > 0)
arguments.push_back(QStringLiteral("-r ") + QString::number(profile.gamescopeRefreshRate()));
if (profile.gamescopeRefreshRate() > 0) {
arguments.push_back(QStringLiteral("-r"));
arguments.push_back(QString::number(profile.gamescopeRefreshRate()));
}
arguments.push_back(QStringLiteral("--"));
}
#ifdef ENABLE_GAMEMODE
@ -258,9 +269,10 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
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)
@ -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")},
false,
false);
process->waitForFinished();
}
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);
process->setProcessEnvironment(QProcessEnvironment::systemEnvironment());
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.")
checked: page.profile.gamescopeEnabled
onCheckedChanged: page.profile.gamescopeEnabled = checked
visible: false
enabled: false
}
FormCard.FormDelegateSeparator {
visible: false
}
FormCard.FormDelegateSeparator {}
FormCard.FormButtonDelegate {
text: i18n("Configure Gamescope...")
icon.name: "configure"
enabled: false
visible: false
Kirigami.PromptDialog {
id: gamescopeSettingsDialog
title: i18n("Configure Gamescope")
@ -186,9 +180,7 @@ FormCard.FormCardPage {
onClicked: gamescopeSettingsDialog.open()
}
FormCard.FormDelegateSeparator {
visible: false
}
FormCard.FormDelegateSeparator {}
FormCard.FormCheckDelegate {
id: gamemodeDelegate