From 05abbf329b8ef308298fbaae2645c8801bf20d62 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Sat, 24 Jan 2026 13:49:59 +0100 Subject: [PATCH] Import: Filter non-game Steam entries Ignore Steam runtime/redistributable entries and other non-game content. Also skip manifests that are not fully installed and ensure the install folder exists before importing. --- src/steamimporter.cpp | 51 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/src/steamimporter.cpp b/src/steamimporter.cpp index 0367af0..65a39a3 100644 --- a/src/steamimporter.cpp +++ b/src/steamimporter.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include SteamImporter::SteamImporter(QObject *parent) @@ -122,10 +123,54 @@ Game *SteamImporter::parseAppManifest(const QString &path) return nullptr; } + auto isNonGameEntry = [](const QString &title, const QString &dir) { + auto normalize = [](QString s) { + s = s.toLower(); + s.remove(QLatin1Char(' ')); + s.remove(QLatin1Char('_')); + s.remove(QLatin1Char('-')); + return s; + }; + + const QString t = normalize(title); + const QString d = normalize(dir); + static const QStringList patterns = { + QStringLiteral("steamlinuxruntime"), + QStringLiteral("steamworkscommonredistributables"), + QStringLiteral("steamworkssdkredist"), + QStringLiteral("shaderprecaching"), + QStringLiteral("proton"), + QStringLiteral("steamvr"), + }; + for (const QString &p : patterns) { + if (t.contains(p) || d.contains(p)) { + return true; + } + } + return false; + }; + + if (isNonGameEntry(name, installDir)) { + return nullptr; + } + // Skip tools and other non-game content QString stateFlags = getValue(QStringLiteral("StateFlags")); - if (stateFlags == QLatin1String("2")) { - // Only partially installed + if (!stateFlags.isEmpty()) { + bool ok = false; + const int flags = stateFlags.toInt(&ok); + if (ok) { + constexpr int InstalledFlag = 4; + if ((flags & InstalledFlag) == 0) { + return nullptr; + } + } + } + + QFileInfo manifestInfo(path); + const QString gameDir = manifestInfo.absolutePath() + QStringLiteral("/common/") + installDir; + if (!QDir(gameDir).exists()) { + return nullptr; } Game *game = new Game(QStringLiteral("steam-%1").arg(appId), name); @@ -140,8 +185,6 @@ Game *SteamImporter::parseAppManifest(const QString &path) } // Set installation directory - QFileInfo manifestInfo(path); - QString gameDir = manifestInfo.absolutePath() + QStringLiteral("/common/") + installDir; game->setWorkingDirectory(gameDir); game->setInstalled(true);