From 27a385e3c3d9eb9dfe9c0e32440148e88aa6fb14 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Thu, 12 Feb 2026 14:42:22 +0100 Subject: [PATCH] ui: enforce daemon-only launches --- src/gamelauncher.cpp | 51 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/gamelauncher.cpp b/src/gamelauncher.cpp index bd1bec3..a80e178 100644 --- a/src/gamelauncher.cpp +++ b/src/gamelauncher.cpp @@ -13,13 +13,11 @@ #include #include #include -#include #include #include #include #include #include -#include static const QString kGameCenterService = QStringLiteral("org.kde.GameCenter1"); static const QString kGameCenterPath = QStringLiteral("/org/kde/GameCenter1"); @@ -399,7 +397,7 @@ QVariantMap GameLauncher::resolveLaunchInfo(Game *game) const return info; } - if (!runnerId.isEmpty() || runner == QLatin1String("wine") || runner == QLatin1String("proton")) { + { QVariantMap runnerSpec = { {QStringLiteral("runnerId"), runnerId}, {QStringLiteral("runner"), runner}, @@ -409,6 +407,7 @@ QVariantMap GameLauncher::resolveLaunchInfo(Game *game) const {QStringLiteral("program"), program}, {QStringLiteral("args"), parts}, {QStringLiteral("envOverrides"), envOverrides}, + {QStringLiteral("useGameProfile"), true}, }; QVariantMap resolved; @@ -418,22 +417,33 @@ QVariantMap GameLauncher::resolveLaunchInfo(Game *game) const return info; } - info.insert(QStringLiteral("finalProgram"), resolved.value(QStringLiteral("finalProgram")).toString()); - info.insert(QStringLiteral("finalArgs"), resolved.value(QStringLiteral("finalArgs")).toStringList()); - info.insert(QStringLiteral("effectiveEnv"), resolved.value(QStringLiteral("effectiveEnv")).toMap()); + if (resolved.contains(QStringLiteral("effectiveEnv"))) { + effectiveEnv = resolved.value(QStringLiteral("effectiveEnv")).toMap(); + } + const QString resolvedFinalProgram = resolved.value(QStringLiteral("finalProgram")).toString(); + const QStringList resolvedFinalArgs = resolved.value(QStringLiteral("finalArgs")).toStringList(); const QString resolvedPrefixPath = resolved.value(QStringLiteral("resolvedPrefixPath")).toString(); - if (!resolvedPrefixPath.isEmpty()) { - info.insert(QStringLiteral("resolvedPrefixPath"), resolvedPrefixPath); - } - const QString resolvedSteamInstallPath = resolved.value(QStringLiteral("resolvedSteamInstallPath")).toString(); - if (!resolvedSteamInstallPath.isEmpty()) { - info.insert(QStringLiteral("resolvedSteamInstallPath"), resolvedSteamInstallPath); - } - info.insert(QStringLiteral("ok"), true); - return info; + const bool runnerManagerWrapped = + (resolvedFinalProgram != program) || (resolvedFinalArgs != parts) || !resolvedPrefixPath.isEmpty() || !resolvedSteamInstallPath.isEmpty(); + + if (runnerManagerWrapped) { + info.insert(QStringLiteral("finalProgram"), resolvedFinalProgram); + info.insert(QStringLiteral("finalArgs"), resolvedFinalArgs); + info.insert(QStringLiteral("effectiveEnv"), effectiveEnv); + + if (!resolvedPrefixPath.isEmpty()) { + info.insert(QStringLiteral("resolvedPrefixPath"), resolvedPrefixPath); + } + if (!resolvedSteamInstallPath.isEmpty()) { + info.insert(QStringLiteral("resolvedSteamInstallPath"), resolvedSteamInstallPath); + } + + info.insert(QStringLiteral("ok"), true); + return info; + } } else if (!runnerId.isEmpty()) { info.insert(QStringLiteral("error"), tr("Runner service is not available")); return info; @@ -606,17 +616,6 @@ void GameLauncher::launchGame(Game *game) const QString launchError = reply.isValid() ? QString() : reply.error().message(); - // Daemon call failed — fallback for URL-type commands only - if (launchType == QLatin1String("url")) { - const QString url = info.value(QStringLiteral("url")).toString(); - if (!url.isEmpty()) { - QDesktopServices::openUrl(QUrl(url)); - game->setLastPlayed(QDateTime::currentDateTime()); - Q_EMIT gameStarted(game); - return; - } - } - // No fallback for non-URL commands — emit error if (!launchError.isEmpty()) { Q_EMIT gameError(game, tr("Game Center launch failed: %1").arg(launchError));