28#include <unordered_map>
59 if (tier ==
"platinum" || tier ==
"native")
74 return tier ==
"platinum" || tier ==
"native" || tier ==
"gold";
85 { return s.priority == SuggestionPriority::Critical; });
92 { return s.category == SuggestionCategory::Runner && !s.recommendedRunner.empty(); });
97 std::vector<GameSuggestion> result;
100 if (s.category == category)
110 std::vector<GameSuggestion> result;
113 if (s.priority == priority)
127 return s.recommendedRunner;
135 std::vector<std::pair<std::string, std::string>> result;
138 if (!s.envKey.empty() && !s.envValue.empty())
140 result.emplace_back(s.envKey, s.envValue);
148 std::string combined;
151 if (!s.dllOverrides.empty())
153 if (!combined.empty())
157 combined += s.dllOverrides;
189 if ((hasDeckVerified && hasPlatinum) ||
190 (hasPlatinum && hasStrongConfidence && hasHighReportCount))
196 if (hasDeckVerified || (hasPlatinum && hasStrongConfidence && hasGoodReportCount))
202 if (hasDeckPlayable && (hasGold || hasPlatinum))
214 if (hasSilver || hasGold)
314 return std::max(0.0f, std::min(1.0f, score));
323 summary =
"⚠️ Known issues may prevent this game from running (anti-cheat, DRM, etc.)";
329 summary =
"✓ Native Linux version available - best compatibility";
337 summary =
"✓ Excellent compatibility - ";
339 summary +=
"Steam Deck Verified + ProtonDB Platinum";
341 summary +=
"Steam Deck Verified by Valve";
343 summary +=
"ProtonDB Platinum with strong community confidence";
347 summary =
"✓ Good compatibility - ";
349 summary +=
"Steam Deck Verified";
351 summary +=
"Steam Deck Playable + " +
protondbTier +
" on ProtonDB";
358 summary =
"○ Likely works - ";
364 summary +=
"limited data available";
368 summary =
"⚠ Limited data - ";
370 summary +=
"ProtonDB Bronze rating, may have issues";
372 summary +=
"ProtonDB Borked rating, likely won't work";
374 summary +=
"proceed with caution, results may vary";
378 summary =
"? No compatibility data found - game may or may not work with Proton";
403 Logger::debug(
"Suggestions cache hit for {} (AppID: {})", gameName, steamAppId);
408 Logger::info(
"=== Generating recommendations for: {} (AppID: {}) ===", gameName, steamAppId);
415 const auto& caps = effectiveCapabilities();
416 suggestions.
detectedGPU = effectiveGPUVendorName();
417 suggestions.
isCachyOS = caps.isCachyOS();
421 static_cast<int>(caps.gpu.generation), suggestions.
isCachyOS ?
"yes" :
"no",
422 caps.runners.size());
424 Logger::info(
"GPU features: RDNA2+={}, RTX={}, FSR3={}, DLSS={}, XeSS={}",
425 caps.hasRDNA2OrNewer() ?
"yes" :
"no", caps.hasRTXCapable() ?
"yes" :
"no",
426 caps.gpu.supportsFSR3 ?
"yes" :
"no", caps.gpu.supportsDLSS ?
"yes" :
"no",
427 caps.gpu.supportsXeSS ?
"yes" :
"no");
433 addProtonDBSuggestions(suggestions, steamAppId);
437 addSystemSuggestions(suggestions);
442 addCachyOSSuggestions(suggestions);
446 addBuiltinFixes(suggestions, steamAppId, gameName);
451 std::unordered_map<std::string, size_t> envVarSeen;
452 std::vector<GameSuggestion> deduplicated;
453 deduplicated.reserve(suggestions.
suggestions.size());
457 if (!s.envKey.empty())
459 auto it = envVarSeen.find(s.envKey);
460 if (it != envVarSeen.end())
463 auto& existing = deduplicated[it->second];
464 if (s.reportCount > existing.reportCount ||
465 (s.source ==
"ProtonDB" && existing.source !=
"ProtonDB"))
468 existing.reason +=
" (also confirmed by " + s.source +
")";
469 existing.reportCount = std::max(existing.reportCount, s.reportCount);
474 existing.reason +=
" (also confirmed by " + s.source +
")";
478 envVarSeen[s.envKey] = deduplicated.size();
480 deduplicated.push_back(std::move(s));
483 if (suggestions.
suggestions.size() != deduplicated.size())
485 Logger::debug(
"Deduplicated {} suggestions (removed {} duplicates)",
487 suggestions.
suggestions.size() - deduplicated.size());
495 { return static_cast<int>(a.priority) < static_cast<int>(b.priority); });
498 int critical = 0, recommended = 0, optional = 0, informational = 0;
517 Logger::info(
"Generated {} total suggestions: {} critical, {} recommended, {} optional, {} "
519 suggestions.
suggestions.size(), critical, recommended, optional, informational);
526 Logger::debug(
"Data sources: ProtonDB={} (tier={}, reports={}), Deck={}, Lutris={} "
527 "(downloads={}), Native={}",
539 if (!s.envKey.empty())
540 details += s.envKey +
"=" + s.envValue;
541 if (!s.recommendedRunner.empty())
542 details +=
"runner=" + s.recommendedRunner;
544 details.empty() ?
"" :
"(" + details +
")");
554 if (stats.currentSize % 20 == 0)
556 Logger::debug(
"Suggestions cache: {} entries, {:.1f}% hit rate", stats.currentSize,
557 stats.hitRate() * 100.0f);
573 static std::mutex futuresMutex;
574 static std::vector<std::shared_ptr<std::future<void>>> activeFutures;
582 std::lock_guard<std::mutex> lock(futuresMutex);
585 activeFutures.erase(std::remove_if(activeFutures.begin(), activeFutures.end(),
586 [](
const std::shared_ptr<std::future<void>>& f)
588 return f->wait_for(std::chrono::milliseconds(0)) ==
589 std::future_status::ready;
591 activeFutures.end());
595 constexpr size_t kMaxActiveFutures = 32;
596 if (activeFutures.size() >= kMaxActiveFutures)
598 Logger::warn(
"[Suggestions] Too many pending async requests, dropping new request");
609 auto future = std::make_shared<std::future<void>>(
610 std::async(std::launch::async,
611 [steamAppId, gameName, callback = std::move(callback)]()
614 callback(suggestions);
618 std::lock_guard<std::mutex> lock(futuresMutex);
619 activeFutures.push_back(future);
623void GameSuggestionService::addProtonDBSuggestions(
GameSuggestions& suggestions,
int steamAppId)
627 Logger::debug(
"Fetching data from 4 APIs in parallel for AppID {}", steamAppId);
629 auto protonFuture = std::async(std::launch::async, [steamAppId]()
632 auto deckFuture = std::async(std::launch::async, [steamAppId]()
635 auto steamFuture = std::async(std::launch::async, [steamAppId]()
638 auto lutrisFuture = std::async(std::launch::async, [steamAppId]()
642 auto protonInfo = protonFuture.get();
643 auto deckInfo = deckFuture.get();
644 auto steamInfo = steamFuture.get();
645 auto lutrisInfo = lutrisFuture.get();
647 Logger::debug(
"All API fetches completed for AppID {}", steamAppId);
650 if (steamInfo.found && steamInfo.supportsLinux)
654 GameSuggestion nativeSuggestion;
658 nativeSuggestion.
title =
"Native Linux Available";
660 "This game has a native Linux version. Consider using it instead of Proton.";
662 "Native builds typically have better performance and fewer issues";
664 nativeSuggestion.
source =
"Steam Store";
666 suggestions.
suggestions.push_back(std::move(nativeSuggestion));
677 GameSuggestion deckSuggestion;
679 deckSuggestion.
source =
"Steam Deck (Valve Testing)";
682 switch (deckInfo.compatibility)
686 deckSuggestion.
title =
"Steam Deck Verified";
688 "Valve has verified this game works great on Steam Deck with Proton";
689 deckSuggestion.
reason =
"Official Valve testing confirms excellent compatibility";
695 deckSuggestion.
title =
"Steam Deck Playable";
697 "This game is playable on Steam Deck but may require configuration";
698 deckSuggestion.
reason =
"Valve testing confirms the game works with Proton";
704 deckSuggestion.
title =
"Steam Deck Unsupported";
706 "Valve reports this game does not currently work on Steam Deck";
707 deckSuggestion.
reason =
"May have anti-cheat, DRM, or other blocking issues";
718 suggestions.
suggestions.push_back(std::move(deckSuggestion));
723 if (steamInfo.found && steamInfo.hasMultiplayer && !steamInfo.supportsLinux)
726 GameSuggestion acWarning;
729 acWarning.
title =
"Multiplayer Game Warning";
731 "This is a multiplayer game. Some anti-cheat systems may not work with Proton.";
732 acWarning.
reason =
"Check ProtonDB reports or areweanticheatyet.com for anti-cheat status";
733 acWarning.
source =
"Steam Store";
735 suggestions.
suggestions.push_back(std::move(acWarning));
739 if (steamInfo.found && !steamInfo.drmNotice.empty())
741 GameSuggestion drmWarning;
744 drmWarning.
title =
"Third-Party DRM";
745 drmWarning.
description =
"Game uses: " + steamInfo.drmNotice;
746 drmWarning.
reason =
"Some DRM may affect compatibility or require additional setup";
747 drmWarning.
source =
"Steam Store";
748 suggestions.
suggestions.push_back(std::move(drmWarning));
752 if (lutrisInfo.found && !lutrisInfo.installers.empty())
755 const auto& bestInstaller = lutrisInfo.installers[0];
762 if (bestInstaller.eac)
765 GameSuggestion eacRt;
768 eacRt.
title =
"Easy Anti-Cheat Runtime";
770 "Enable the Proton EAC runtime so the anti-cheat initialises correctly.";
771 eacRt.
reason =
"Lutris installer reports this game requires Easy Anti-Cheat";
772 eacRt.
envKey =
"PROTON_EAC_RUNTIME";
776 suggestions.
suggestions.push_back(std::move(eacRt));
778 if (bestInstaller.battleye)
784 beRt.
title =
"BattlEye Runtime";
786 "Enable the Proton BattlEye runtime so the anti-cheat initialises correctly.";
787 beRt.
reason =
"Lutris installer reports this game requires BattlEye";
788 beRt.
envKey =
"PROTON_BATTLEYE_RUNTIME";
792 suggestions.
suggestions.push_back(std::move(beRt));
796 for (
const auto& [key, value] : bestInstaller.environmentVariables)
798 GameSuggestion envSuggestion;
801 envSuggestion.
title = key;
802 envSuggestion.
description =
"Set " + key +
"=" + value;
803 envSuggestion.
reason =
"From Lutris community-tested installer";
804 envSuggestion.
envKey = key;
806 envSuggestion.
source =
"Lutris";
808 suggestions.
suggestions.push_back(std::move(envSuggestion));
812 if (!bestInstaller.dllOverrides.empty())
814 GameSuggestion dllSuggestion;
817 dllSuggestion.
title =
"DLL Overrides (Lutris)";
818 dllSuggestion.
description =
"Apply: " + bestInstaller.dllOverrides;
819 dllSuggestion.
reason =
"From Lutris tested configuration";
820 dllSuggestion.
dllOverrides = bestInstaller.dllOverrides;
821 dllSuggestion.
source =
"Lutris";
823 suggestions.
suggestions.push_back(std::move(dllSuggestion));
827 if (!bestInstaller.wineVersion.empty())
829 GameSuggestion wineSuggestion;
832 wineSuggestion.
title =
"Lutris Wine Version";
833 wineSuggestion.
description =
"Lutris uses: " + bestInstaller.wineVersion;
834 wineSuggestion.
reason =
"Community-tested Wine/Proton version";
835 wineSuggestion.
source =
"Lutris";
836 suggestions.
suggestions.push_back(std::move(wineSuggestion));
840 bestInstaller.environmentVariables.size() +
841 (bestInstaller.dllOverrides.empty() ? 0 : 1),
846 if (!protonInfo.found)
861 const std::string tierReason =
862 protonInfo.tier.empty() ? std::string(
"community reports")
863 :
"tier=" + protonInfo.tier +
", " +
864 std::to_string(protonInfo.tweaks.reportCount) +
" reports";
867 if (!protonInfo.tweaks.recommendedProtonVersion.empty())
869 GameSuggestion runnerSuggestion;
870 runnerSuggestion.priority = tierPriority;
871 runnerSuggestion.category = SuggestionCategory::Runner;
872 runnerSuggestion.title =
"Recommended Proton Version";
873 runnerSuggestion.description =
"Use " + protonInfo.tweaks.recommendedProtonVersion;
874 runnerSuggestion.reason =
"Based on " + tierReason;
875 runnerSuggestion.recommendedRunner = protonInfo.tweaks.recommendedProtonVersion;
876 runnerSuggestion.source =
"ProtonDB";
877 runnerSuggestion.reportCount = protonInfo.tweaks.reportCount;
878 runnerSuggestion.canAutoApply = tierAutoApply;
879 suggestions.suggestions.push_back(std::move(runnerSuggestion));
883 for (
const auto& [key, value] : protonInfo.tweaks.environmentVariables)
885 GameSuggestion envSuggestion;
886 envSuggestion.priority = tierPriority;
887 envSuggestion.category = SuggestionCategory::Compatibility;
888 envSuggestion.title = key;
889 envSuggestion.description =
"Set " + key +
"=" + value;
890 envSuggestion.reason =
"Commonly used fix (" + tierReason +
")";
891 envSuggestion.envKey = key;
892 envSuggestion.envValue = value;
893 envSuggestion.source =
"ProtonDB";
894 envSuggestion.reportCount = protonInfo.tweaks.reportCount;
895 envSuggestion.canAutoApply = tierAutoApply;
896 suggestions.suggestions.push_back(std::move(envSuggestion));
900 if (!protonInfo.tweaks.dllOverrides.empty())
902 GameSuggestion dllSuggestion;
903 dllSuggestion.priority = tierPriority;
904 dllSuggestion.category = SuggestionCategory::Compatibility;
905 dllSuggestion.title =
"DLL Overrides";
906 dllSuggestion.description =
"Apply DLL overrides: " + protonInfo.tweaks.dllOverrides;
907 dllSuggestion.reason =
"Community-reported fix (" + tierReason +
")";
908 dllSuggestion.dllOverrides = protonInfo.tweaks.dllOverrides;
909 dllSuggestion.source =
"ProtonDB";
910 dllSuggestion.canAutoApply = tierAutoApply;
911 suggestions.suggestions.push_back(std::move(dllSuggestion));
916 if (!protonInfo.tweaks.launchArguments.empty())
918 GameSuggestion argsSuggestion;
921 argsSuggestion.priority = std::max(tierPriority, SuggestionPriority::Optional);
922 argsSuggestion.category = SuggestionCategory::Compatibility;
923 argsSuggestion.title =
"Launch Arguments";
924 argsSuggestion.description =
"Add launch arguments: " + protonInfo.tweaks.launchArguments;
925 argsSuggestion.reason =
"May improve game behavior (" + tierReason +
")";
926 argsSuggestion.launchArgs = protonInfo.tweaks.launchArguments;
927 argsSuggestion.source =
"ProtonDB";
928 argsSuggestion.canAutoApply = tierAutoApply;
929 suggestions.suggestions.push_back(std::move(argsSuggestion));
933 for (
const auto& note : protonInfo.tweaks.notes)
935 if (note.length() > 10)
937 GameSuggestion noteSuggestion;
938 noteSuggestion.priority = SuggestionPriority::Informational;
939 noteSuggestion.category = SuggestionCategory::General;
940 noteSuggestion.title =
"Community Note";
941 noteSuggestion.description = note;
942 noteSuggestion.source =
"ProtonDB";
943 suggestions.suggestions.push_back(std::move(noteSuggestion));
951void GameSuggestionService::addRunnerSuggestions(
GameSuggestions& suggestions)
953 const auto& caps = effectiveCapabilities();
954 const auto& runners = caps.runners;
958 GameSuggestion noRunners;
961 noRunners.
title =
"No Proton Versions Found";
963 "No Proton/Wine versions detected. Install Proton via Steam or a custom Proton build.";
964 noRunners.
reason =
"Proton is required to run Windows games";
965 noRunners.
source =
"System Detection";
967 suggestions.
suggestions.push_back(std::move(noRunners));
978 const RunnerInfo* bestRunner =
nullptr;
979 const RunnerInfo* geProton =
nullptr;
980 const RunnerInfo* cachyProton =
nullptr;
981 const RunnerInfo* cachyProtonSLR =
nullptr;
982 const RunnerInfo* protonExp =
nullptr;
983 const RunnerInfo* latestOfficial =
nullptr;
985 for (
const auto& runner : runners)
988 if (runner.type ==
"proton-ge" && (!geProton || runner.version > geProton->
version))
992 else if (runner.type ==
"proton-cachyos")
994 const bool isSLR = runner.name.find(
"slr") != std::string::npos ||
995 runner.name.find(
"SLR") != std::string::npos;
996 if (isSLR && (!cachyProtonSLR || runner.version > cachyProtonSLR->
version))
998 cachyProtonSLR = &runner;
1000 if (!cachyProton || runner.version > cachyProton->
version)
1002 cachyProton = &runner;
1005 else if (runner.name.find(
"Experimental") != std::string::npos)
1007 protonExp = &runner;
1009 else if (runner.type ==
"proton" &&
1010 (!latestOfficial || runner.version > latestOfficial->
version))
1012 latestOfficial = &runner;
1024 if (needsAntiCheat && caps.isCachyOS() && cachyProtonSLR)
1026 bestRunner = cachyProtonSLR;
1027 reason =
"proton-cachyos-slr ships the SLR container and anti-cheat runtimes "
1028 "this game requires";
1033 else if (caps.isCachyOS() && cachyProton)
1035 bestRunner = cachyProton;
1036 reason =
"proton-cachyos is the CachyOS-optimised build and tracks upstream daily";
1038 else if (caps.hasNVIDIAGPU() && geProton)
1041 bestRunner = geProton;
1042 reason =
"GE-Proton includes extra patches and often better NVIDIA support";
1044 else if (caps.hasAMDGPU())
1049 bestRunner = geProton;
1050 reason =
"GE-Proton has excellent AMD support and additional game fixes";
1054 bestRunner = protonExp;
1055 reason =
"Proton Experimental has the latest features for AMD GPUs";
1058 else if (caps.hasIntelGPU())
1063 bestRunner = protonExp;
1064 reason =
"Proton Experimental has the best Intel Arc GPU support";
1068 bestRunner = geProton;
1069 reason =
"GE-Proton includes fixes that may help Intel GPU compatibility";
1078 bestRunner = geProton;
1079 reason =
"GE-Proton includes community patches and additional codec support";
1083 bestRunner = protonExp;
1084 reason =
"Proton Experimental has the latest features and fixes";
1086 else if (latestOfficial)
1088 bestRunner = latestOfficial;
1089 reason =
"Latest stable Proton version";
1095 GameSuggestion runnerSuggestion;
1098 runnerSuggestion.
title =
"Recommended Runner";
1099 runnerSuggestion.
description =
"Use " + bestRunner->
name +
" for best compatibility";
1100 runnerSuggestion.
reason = reason;
1102 runnerSuggestion.
source =
"System Detection";
1104 suggestions.
suggestions.push_back(std::move(runnerSuggestion));
1108 if (runners.size() > 1)
1110 std::string runnerList;
1112 for (
const auto& runner : runners)
1116 runnerList += runner.name;
1119 runnerList +=
" (+" + std::to_string(runners.size() - 5) +
" more)";
1124 GameSuggestion availableRunners;
1127 availableRunners.
title =
"Available Runners";
1129 availableRunners.
reason =
1130 std::to_string(runners.size()) +
" Proton/Wine versions installed";
1131 availableRunners.
source =
"System Detection";
1133 suggestions.
suggestions.push_back(std::move(availableRunners));
1139 std::string latestVersion = getLatestGEProtonVersion();
1140 if (!latestVersion.empty() && latestVersion != geProton->
name &&
1141 latestVersion > geProton->
name)
1143 GameSuggestion updateSuggestion;
1146 updateSuggestion.
title =
"GE-Proton Update Available";
1148 "Latest version: " + latestVersion +
" (you have: " + geProton->
name +
")";
1149 updateSuggestion.
reason =
1150 "Newer versions may include bug fixes and game compatibility improvements";
1151 updateSuggestion.
source =
"GitHub";
1153 suggestions.
suggestions.push_back(std::move(updateSuggestion));
1158void GameSuggestionService::addSystemSuggestions(
GameSuggestions& suggestions)
1161 addRunnerSuggestions(suggestions);
1162 addGPUSuggestions(suggestions);
1163 addSyncSuggestions(suggestions);
1164 addShaderCacheSuggestions(suggestions);
1165 addKernelParamSuggestions(suggestions);
1166 addDisplaySuggestions(suggestions);
1167 addMemorySuggestions(suggestions);
1168 addPowerSuggestions(suggestions);
1169 addControllerSuggestions(suggestions);
1170 addAudioSuggestions(suggestions);
1172 const auto& caps = effectiveCapabilities();
1176 if (caps.canUseGameMode() && caps.tools.shouldUseGameMode())
1178 GameSuggestion gameMode;
1181 gameMode.
title =
"GameMode";
1182 gameMode.
description =
"Enable GameMode for CPU optimizations";
1183 gameMode.
reason =
"GameMode is installed on this system";
1184 gameMode.
source =
"System Detection";
1186 suggestions.
suggestions.push_back(std::move(gameMode));
1190 if (caps.tools.mangoHud)
1192 GameSuggestion mangoHud;
1195 mangoHud.
title =
"MangoHud Available";
1196 mangoHud.
description =
"MangoHud is available for FPS/performance monitoring";
1197 mangoHud.
reason =
"MangoHud is installed on this system";
1198 mangoHud.
source =
"System Detection";
1200 suggestions.
suggestions.push_back(std::move(mangoHud));
1204 if (caps.tools.gamescope)
1206 GameSuggestion gamescope;
1209 gamescope.
title =
"Gamescope Available";
1211 "Gamescope compositor available for HDR, FSR, and resolution scaling";
1212 gamescope.
reason =
"Gamescope is installed on this system";
1213 gamescope.
source =
"System Detection";
1215 suggestions.
suggestions.push_back(std::move(gamescope));
1219 if (!caps.cpu.hasOptimalGovernor())
1221 GameSuggestion govSuggestion;
1224 govSuggestion.
title =
"CPU Governor Optimization";
1226 "Current governor '" + caps.cpu.governor +
1227 "' may not be optimal for gaming. Consider using 'performance' or 'schedutil'.";
1228 govSuggestion.
reason =
"Non-optimal CPU governor can cause frame drops";
1229 govSuggestion.
source =
"System Detection";
1231 suggestions.
suggestions.push_back(std::move(govSuggestion));
1237 GameSuggestion schedInfo;
1240 schedInfo.
title =
"BORE Scheduler";
1241 schedInfo.
description =
"You're using the BORE scheduler which is optimized for gaming and "
1242 "desktop responsiveness";
1243 schedInfo.
reason =
"CachyOS BORE scheduler detected";
1244 schedInfo.
source =
"System Detection";
1246 suggestions.
suggestions.push_back(std::move(schedInfo));
1250void GameSuggestionService::addGPUSuggestions(
GameSuggestions& suggestions)
1252 const auto& caps = effectiveCapabilities();
1254 if (caps.hasAMDGPU())
1257 if (caps.gpu.isTeraScale())
1259 GameSuggestion noVulkan;
1262 noVulkan.
title =
"No Vulkan Support";
1264 "TeraScale GPU detected (HD 2000-6000 series) - Vulkan is not supported";
1266 "Proton and DXVK require Vulkan. Consider Wine + wined3d for OpenGL games";
1267 noVulkan.
source =
"System Detection";
1269 suggestions.
suggestions.push_back(std::move(noVulkan));
1272 GameSuggestion useWined3d;
1275 useWined3d.
title =
"Use WineD3D (OpenGL)";
1276 useWined3d.
description =
"Use WineD3D OpenGL backend instead of DXVK";
1277 useWined3d.
reason =
"WineD3D works on GPUs without Vulkan support";
1278 useWined3d.
envKey =
"PROTON_USE_WINED3D";
1280 useWined3d.
source =
"System Detection";
1282 suggestions.
suggestions.push_back(std::move(useWined3d));
1288 if (!caps.gpu.isPolarisOrNewer() && caps.gpu.isGCNArchitecture())
1290 GameSuggestion gcnWarning;
1293 gcnWarning.
title =
"Pre-Polaris GCN GPU";
1294 gcnWarning.
description =
"GCN 1-4 GPU detected - some newer games may have issues";
1295 gcnWarning.
reason =
"Older GCN GPUs have limited Vulkan feature support";
1296 gcnWarning.
source =
"System Detection";
1298 suggestions.
suggestions.push_back(std::move(gcnWarning));
1301 GameSuggestion acoCompiler;
1304 acoCompiler.
title =
"ACO Shader Compiler";
1305 acoCompiler.
description =
"Use ACO compiler for better shader compilation on GCN";
1306 acoCompiler.
reason =
"ACO is faster and has better GCN support than LLVM";
1307 acoCompiler.
envKey =
"AMD_VULKAN_ICD";
1309 acoCompiler.
source =
"Mesa";
1311 suggestions.
suggestions.push_back(std::move(acoCompiler));
1315 if (caps.gpu.isPolarisOrNewer())
1317 GameSuggestion antiLag;
1320 antiLag.
title =
"AMD Anti-Lag";
1321 antiLag.
description =
"Enable AMD Anti-Lag via Mesa layer for reduced input latency";
1322 antiLag.
reason =
"Detected AMD GPU";
1323 antiLag.
envKey =
"ENABLE_LAYER_MESA_ANTI_LAG";
1325 antiLag.
source =
"CachyOS Wiki";
1327 suggestions.
suggestions.push_back(std::move(antiLag));
1333 if (caps.gpu.isGCNArchitecture())
1338 fsr.
title =
"Wine FSR Upscaling";
1339 fsr.
description =
"Enable FidelityFX Super Resolution for better performance";
1340 fsr.
reason =
"Detected AMD GPU with Vulkan/FSR support";
1341 fsr.
envKey =
"WINE_FULLSCREEN_FSR";
1343 fsr.
source =
"CachyOS Wiki";
1345 suggestions.
suggestions.push_back(std::move(fsr));
1351 if (caps.gpu.supportsFSR4 && caps.isCachyOS())
1353 GameSuggestion fsr4;
1356 fsr4.
title =
"FSR 4 Auto-Upgrade";
1357 fsr4.
description =
"Upgrade in-game FSR to FSR 4 ML upscaling (native on RDNA4)";
1358 fsr4.
reason =
"RDNA4 GPU with proton-cachyos available";
1359 fsr4.
envKey =
"PROTON_FSR4_UPGRADE";
1361 fsr4.
source =
"proton-cachyos";
1363 suggestions.
suggestions.push_back(std::move(fsr4));
1365 else if (caps.gpu.supportsFSR4RDNA3 && !caps.gpu.supportsFSR4 && caps.isCachyOS())
1367 GameSuggestion fsr4r3;
1370 fsr4r3.
title =
"FSR 4 on RDNA 3 (opt-in)";
1372 "Use the RDNA3-optimised FSR 4 DLL in proton-cachyos. "
1373 "ML Frame-Gen auto-enables once amdxcffx64.dll >= 4.0.3 is cached.";
1374 fsr4r3.
reason =
"RDNA3 GPU with proton-cachyos available";
1375 fsr4r3.
envKey =
"PROTON_FSR4_RDNA3_UPGRADE";
1377 fsr4r3.
source =
"proton-cachyos";
1379 suggestions.
suggestions.push_back(std::move(fsr4r3));
1382 else if (caps.hasNVIDIAGPU())
1385 GameSuggestion nvapi;
1388 nvapi.
title =
"NVIDIA NVAPI";
1389 nvapi.
description =
"Enable NVAPI for DLSS/Reflex support";
1390 nvapi.
reason =
"Detected NVIDIA GPU";
1391 nvapi.
envKey =
"PROTON_FORCE_NVAPI";
1393 nvapi.
source =
"CachyOS Wiki";
1395 suggestions.
suggestions.push_back(std::move(nvapi));
1398 if (caps.hasRTXCapable())
1400 GameSuggestion dlss;
1403 dlss.
title =
"DLSS Auto-Upgrade";
1404 dlss.
description =
"Automatically upgrade DLSS to the latest version in games";
1405 dlss.
reason =
"RTX GPU detected - supports DLSS";
1406 dlss.
envKey =
"PROTON_DLSS_UPGRADE";
1408 dlss.
source =
"CachyOS Wiki";
1410 suggestions.
suggestions.push_back(std::move(dlss));
1416 GameSuggestion dlss3;
1419 dlss3.
title =
"DLSS 3 Frame Generation";
1420 dlss3.
description =
"RTX 40 series GPU detected - DLSS 3 Frame Gen supported";
1421 dlss3.
reason =
"Ada Lovelace GPU supports DLSS 3 Frame Generation";
1422 dlss3.
source =
"System Detection";
1428 GameSuggestion nvLibs;
1431 nvLibs.
title =
"NVIDIA PhysX/CUDA";
1432 nvLibs.
description =
"Enable PhysX and CUDA support for compatible games";
1433 nvLibs.
reason =
"Enables GPU-accelerated physics and compute";
1434 nvLibs.
envKey =
"PROTON_NVIDIA_LIBS";
1436 nvLibs.
source =
"CachyOS Wiki";
1438 suggestions.
suggestions.push_back(std::move(nvLibs));
1440 else if (caps.hasIntelGPU())
1443 if (caps.hasArcGPU())
1445 GameSuggestion xess;
1448 xess.
title =
"XeSS Auto-Upgrade";
1449 xess.
description =
"Automatically upgrade Intel XeSS to the latest version";
1450 xess.
reason =
"Intel Arc GPU detected - supports XeSS";
1451 xess.
envKey =
"PROTON_XESS_UPGRADE";
1453 xess.
source =
"CachyOS Wiki";
1455 suggestions.
suggestions.push_back(std::move(xess));
1460 if (!caps.hasAMDGPU())
1465 fsr.
title =
"Wine FSR Upscaling";
1466 fsr.
description =
"Enable AMD FSR upscaling (works on all GPUs)";
1467 fsr.
reason =
"FSR is vendor-agnostic and works on all Vulkan GPUs";
1468 fsr.
envKey =
"WINE_FULLSCREEN_FSR";
1470 fsr.
source =
"System Detection";
1472 suggestions.
suggestions.push_back(std::move(fsr));
1476void GameSuggestionService::addSyncSuggestions(
GameSuggestions& suggestions)
1478 const auto& caps = effectiveCapabilities();
1481 if (caps.canUseNTSync())
1483 GameSuggestion ntsync;
1486 ntsync.
title =
"NTSync Enabled";
1487 ntsync.
description =
"NTSync is available for best synchronization performance";
1488 ntsync.
reason =
"Kernel " + caps.kernel.version +
" has NTSync support";
1489 ntsync.
envKey =
"PROTON_USE_NTSYNC";
1491 ntsync.
source =
"CachyOS Wiki";
1493 suggestions.
suggestions.push_back(std::move(ntsync));
1495 else if (caps.kernel.supportsNTSync && !caps.kernel.ntsyncModuleLoaded)
1498 GameSuggestion ntsyncHint;
1501 ntsyncHint.
title =
"NTSync Available (needs modprobe)";
1503 "NTSync module available but not loaded. Run: sudo modprobe ntsync";
1504 ntsyncHint.
reason =
"NTSync provides better performance than fsync/esync";
1505 ntsyncHint.
source =
"System Detection";
1507 suggestions.
suggestions.push_back(std::move(ntsyncHint));
1511 if (caps.canUseFsync() && !caps.canUseNTSync())
1513 GameSuggestion fsync;
1516 fsync.
title =
"Fsync Enabled";
1517 fsync.
description =
"Fsync is available for improved synchronization";
1518 fsync.
reason =
"Kernel " + caps.kernel.version +
" supports fsync";
1519 fsync.
source =
"System Detection";
1521 suggestions.
suggestions.push_back(std::move(fsync));
1523 else if (caps.canUseNTSync())
1526 GameSuggestion fsyncInfo;
1529 fsyncInfo.
title =
"Fsync Available";
1530 fsyncInfo.
description =
"Fsync is available as fallback (NTSync is preferred)";
1531 fsyncInfo.
reason =
"Kernel supports both NTSync and fsync";
1532 fsyncInfo.
source =
"System Detection";
1534 suggestions.
suggestions.push_back(std::move(fsyncInfo));
1538void GameSuggestionService::addShaderCacheSuggestions(
GameSuggestions& suggestions)
1540 const auto& caps = effectiveCapabilities();
1543 GameSuggestion localCache;
1546 localCache.
title =
"Local Shader Cache";
1547 localCache.
description =
"Enable per-game shader cache for faster subsequent loads";
1548 localCache.
reason =
"Reduces shader compilation stutter on repeated plays";
1549 localCache.
envKey =
"__GL_SHADER_DISK_CACHE";
1551 localCache.
source =
"CachyOS Wiki";
1553 suggestions.
suggestions.push_back(std::move(localCache));
1556 uint64_t cacheSize = caps.getRecommendedShaderCacheSize();
1557 std::string cacheSizeStr = std::to_string(cacheSize);
1559 if (caps.hasNVIDIAGPU())
1561 GameSuggestion nvCache;
1564 nvCache.
title =
"NVIDIA Shader Cache Size";
1565 nvCache.
description =
"Set NVIDIA shader disk cache to " +
1566 std::to_string(cacheSize / (1024 * 1024 * 1024)) +
"GB";
1567 nvCache.
reason =
"Larger cache reduces shader recompilation";
1568 nvCache.
envKey =
"__GL_SHADER_DISK_CACHE_SIZE";
1570 nvCache.
source =
"CachyOS Wiki";
1572 suggestions.
suggestions.push_back(std::move(nvCache));
1574 else if (caps.hasAMDGPU() || caps.hasIntelGPU())
1577 std::string mesaCacheSize = std::to_string(cacheSize / (1024 * 1024 * 1024)) +
"G";
1578 GameSuggestion mesaCache;
1581 mesaCache.
title =
"Mesa Shader Cache Size";
1582 mesaCache.
description =
"Set Mesa shader cache to " + mesaCacheSize;
1583 mesaCache.
reason =
"Larger cache reduces shader recompilation";
1584 mesaCache.
envKey =
"MESA_SHADER_CACHE_MAX_SIZE";
1585 mesaCache.
envValue = mesaCacheSize;
1586 mesaCache.
source =
"CachyOS Wiki";
1588 suggestions.
suggestions.push_back(std::move(mesaCache));
1592void GameSuggestionService::addKernelParamSuggestions(
GameSuggestions& suggestions)
1594 const auto& caps = effectiveCapabilities();
1597 if (!caps.kernel.maxMapCountOk)
1599 GameSuggestion maxMap;
1602 maxMap.
title =
"Increase vm.max_map_count";
1603 maxMap.
description =
"Current value (" + std::to_string(caps.kernel.maxMapCount) +
1604 ") is too low. Some games may crash.";
1605 maxMap.
reason =
"Many games need higher memory map limits. Add to "
1606 "/etc/sysctl.d/gaming.conf: vm.max_map_count=2147483642";
1607 maxMap.
source =
"Arch Wiki Gaming";
1609 suggestions.
suggestions.push_back(std::move(maxMap));
1613 if (!caps.kernel.swappinessOk && caps.kernel.swappiness >= 0)
1615 GameSuggestion swappiness;
1618 swappiness.
title =
"Reduce vm.swappiness";
1619 swappiness.
description =
"Current value (" + std::to_string(caps.kernel.swappiness) +
1620 ") may cause stutters. Recommended: 10 or lower.";
1621 swappiness.
reason =
"Lower swappiness reduces disk I/O during gaming";
1622 swappiness.
source =
"Arch Wiki Gaming";
1624 suggestions.
suggestions.push_back(std::move(swappiness));
1632 if (caps.cpu.coreCount >= 12 && caps.cpu.vendor ==
"AMD")
1634 const int physical = caps.cpu.coreCount;
1638 const int firstCcdCores = std::max(4, std::min(8, physical / 2));
1639 std::string cpuList;
1640 for (
int i = 0; i < firstCcdCores; ++i)
1642 if (!cpuList.empty())
1644 cpuList += std::to_string(i * 2);
1646 const std::string topologyValue = std::to_string(firstCcdCores) +
":" + cpuList;
1648 GameSuggestion topology;
1651 topology.
title =
"CPU Topology Optimization";
1652 topology.
description =
"High-core AMD CPU detected. Some games may benefit from "
1653 "limiting cores to a single CCD to avoid cross-chiplet latency.";
1654 topology.
reason = caps.cpu.model +
" has " + std::to_string(physical) +
1655 " cores across multiple CCDs. Games that don't use many threads may "
1656 "perform better pinned to one CCD.";
1657 topology.
envKey =
"PROTON_CPU_TOPOLOGY";
1659 topology.
source =
"CachyOS/AMD Gaming";
1661 suggestions.
suggestions.push_back(std::move(topology));
1665 if (caps.cpu.isHybrid && caps.cpu.performanceCores > 0)
1667 GameSuggestion hybridNote;
1670 hybridNote.
title =
"Intel Hybrid CPU";
1671 hybridNote.
description =
"Hybrid CPU detected with " +
1672 std::to_string(caps.cpu.performanceCores) +
" P-cores and " +
1673 std::to_string(caps.cpu.efficiencyCores) +
1675 "Some games may benefit from disabling E-cores.";
1676 hybridNote.
reason =
"Games not optimized for hybrid architectures may stutter when "
1677 "threads are scheduled on E-cores. CachyOS sched-ext helps with this.";
1678 hybridNote.
source =
"Intel Gaming";
1680 suggestions.
suggestions.push_back(std::move(hybridNote));
1684 if (!caps.cpu.isPerformanceGovernor() && !caps.cpu.hasOptimalGovernor())
1686 GameSuggestion governor;
1689 governor.
title =
"CPU Governor: " + caps.cpu.governor;
1690 governor.
description =
"Your CPU is using '" + caps.cpu.governor +
1691 "' governor. Consider 'performance' or 'schedutil' for gaming.";
1692 governor.
reason =
"GameMode automatically sets performance governor while gaming";
1693 governor.
source =
"CachyOS Wiki";
1695 suggestions.
suggestions.push_back(std::move(governor));
1699void GameSuggestionService::addDisplaySuggestions(
GameSuggestions& suggestions)
1701 const auto& caps = effectiveCapabilities();
1704 if (caps.isWayland())
1706 GameSuggestion wayland;
1709 wayland.
title =
"Native Wayland Support";
1710 wayland.
description =
"Enable experimental native Wayland mode in Proton";
1711 wayland.
reason =
"Running on Wayland - native mode may improve latency";
1712 wayland.
envKey =
"PROTON_ENABLE_WAYLAND";
1714 wayland.
source =
"CachyOS Wiki";
1716 suggestions.
suggestions.push_back(std::move(wayland));
1720 if (caps.hasHDRMonitor())
1725 hdr.
title =
"HDR Support";
1726 hdr.
description =
"Enable HDR output for supported games";
1727 hdr.
reason =
"HDR-capable monitor detected";
1728 hdr.
envKey =
"PROTON_ENABLE_HDR";
1730 hdr.
source =
"System Detection";
1732 suggestions.
suggestions.push_back(std::move(hdr));
1735 GameSuggestion dxvkHdr;
1738 dxvkHdr.
title =
"DXVK HDR";
1739 dxvkHdr.
description =
"Enable DXVK HDR for DirectX games";
1740 dxvkHdr.
reason =
"May improve HDR output in some games";
1741 dxvkHdr.
envKey =
"DXVK_HDR";
1743 dxvkHdr.
source =
"System Detection";
1745 suggestions.
suggestions.push_back(std::move(dxvkHdr));
1749 if (caps.hasVRRMonitor())
1754 vrr.
title =
"Variable Refresh Rate";
1756 "Your monitor supports VRR (FreeSync/G-Sync). Ensure it's enabled in your compositor.";
1757 vrr.
reason =
"VRR reduces screen tearing and stuttering";
1758 vrr.
source =
"System Detection";
1760 suggestions.
suggestions.push_back(std::move(vrr));
1764 if (caps.hasHighRefreshMonitor())
1766 const auto* primary = caps.getPrimaryMonitor();
1769 GameSuggestion highRefresh;
1772 highRefresh.
title =
"High Refresh Monitor";
1773 highRefresh.
description =
"Your monitor supports " +
1774 std::to_string(
static_cast<int>(primary->refreshRate)) +
1775 "Hz. Disable V-Sync in-game for best responsiveness.";
1776 highRefresh.
reason =
"High refresh rate monitor detected";
1777 highRefresh.
source =
"System Detection";
1779 suggestions.
suggestions.push_back(std::move(highRefresh));
1784 const auto* primary = caps.getPrimaryMonitor();
1785 if (primary && primary->is4K())
1787 GameSuggestion upscale;
1790 upscale.
title =
"4K Display - Consider Upscaling";
1791 upscale.
description =
"Running at 4K. Consider FSR/DLSS/XeSS for better performance.";
1792 upscale.
reason =
"4K native rendering is demanding";
1793 upscale.
source =
"System Detection";
1795 suggestions.
suggestions.push_back(std::move(upscale));
1799 GameSuggestion noDecor;
1802 noDecor.
title =
"Disable Window Decorations";
1803 noDecor.
description =
"Remove window decorations for borderless fullscreen";
1804 noDecor.
reason =
"May improve fullscreen behavior in some games";
1805 noDecor.
envKey =
"PROTON_NO_WM_DECORATION";
1807 noDecor.
source =
"CachyOS Wiki";
1809 suggestions.
suggestions.push_back(std::move(noDecor));
1812void GameSuggestionService::addMemorySuggestions(
GameSuggestions& suggestions)
1814 const auto& caps = effectiveCapabilities();
1815 const auto& mem = caps.memory;
1818 if (mem.totalMB < 8000)
1820 GameSuggestion lowRam;
1823 lowRam.
title =
"Low System Memory";
1824 lowRam.
description =
"Your system has less than 8GB RAM (" +
1825 std::to_string(mem.totalMB / 1024) +
1826 "GB). Many modern games require 16GB+.";
1827 lowRam.
reason =
"Insufficient RAM can cause severe performance issues and crashes";
1828 lowRam.
source =
"System Detection";
1830 suggestions.
suggestions.push_back(std::move(lowRam));
1832 else if (mem.totalMB < 16000)
1834 GameSuggestion medRam;
1837 medRam.
title =
"Memory Notice";
1838 medRam.
description =
"Your system has " + std::to_string(mem.totalMB / 1024) +
1839 "GB RAM. Some AAA games may benefit from 16GB+.";
1840 medRam.
reason =
"Newer AAA titles often recommend 16GB RAM";
1841 medRam.
source =
"System Detection";
1843 suggestions.
suggestions.push_back(std::move(medRam));
1847 if (mem.availableMB < 4000 && mem.totalMB >= 8000)
1849 GameSuggestion lowAvail;
1852 lowAvail.
title =
"Low Available Memory";
1853 lowAvail.
description =
"Only " + std::to_string(mem.availableMB / 1024) +
1854 "GB RAM currently available. Consider closing other applications.";
1855 lowAvail.
reason =
"Other applications are using significant memory";
1856 lowAvail.
source =
"System Detection";
1858 suggestions.
suggestions.push_back(std::move(lowAvail));
1862 if (mem.swapTotalMB == 0)
1864 GameSuggestion noSwap;
1867 noSwap.
title =
"No Swap Space";
1869 "No swap space configured. This may cause crashes if RAM is exhausted.";
1870 noSwap.
reason =
"Swap provides a safety net when RAM is full";
1871 noSwap.
source =
"System Detection";
1873 suggestions.
suggestions.push_back(std::move(noSwap));
1877void GameSuggestionService::addPowerSuggestions(
GameSuggestions& suggestions)
1879 const auto& caps = effectiveCapabilities();
1880 const auto& power = caps.power;
1883 if (power.isLaptop && power.onBattery)
1885 GameSuggestion batteryWarn;
1888 batteryWarn.
title =
"Running on Battery";
1889 batteryWarn.
description =
"You're running on battery power. Performance may be limited.";
1890 if (power.batteryPercent >= 0)
1892 batteryWarn.
description +=
" Battery: " + std::to_string(power.batteryPercent) +
"%";
1894 batteryWarn.
reason =
"Battery power limits CPU/GPU performance to conserve power";
1895 batteryWarn.
source =
"System Detection";
1897 suggestions.
suggestions.push_back(std::move(batteryWarn));
1904 GameSuggestion powerProfile;
1907 powerProfile.
title =
"Power Profile";
1909 "Consider switching to 'performance' power profile for better gaming performance.";
1910 powerProfile.
reason =
"Current profile: " + power.activeProfile;
1911 powerProfile.
source =
"System Detection";
1913 suggestions.
suggestions.push_back(std::move(powerProfile));
1917 if (power.isLaptop && power.onBattery && power.batteryPercent >= 0 && power.batteryPercent < 20)
1919 GameSuggestion lowBattery;
1922 lowBattery.
title =
"Low Battery Warning";
1923 lowBattery.
description =
"Battery is at " + std::to_string(power.batteryPercent) +
1924 "%. Plug in to avoid losing progress!";
1925 lowBattery.
reason =
"Game may be interrupted if battery dies";
1926 lowBattery.
source =
"System Detection";
1928 suggestions.
suggestions.push_back(std::move(lowBattery));
1932void GameSuggestionService::addControllerSuggestions(
GameSuggestions& suggestions)
1934 const auto& caps = effectiveCapabilities();
1937 if (caps.controllers.empty())
1944 if (caps.hasPlayStationController())
1946 GameSuggestion psSuggestion;
1949 psSuggestion.
title =
"PlayStation Controller Detected";
1951 "Enable SDL for better PlayStation controller support in some games";
1952 psSuggestion.
reason =
"PlayStation controllers may need SDL for proper button mapping";
1953 psSuggestion.
envKey =
"PROTON_PREFER_SDL";
1955 psSuggestion.
source =
"System Detection";
1957 suggestions.
suggestions.push_back(std::move(psSuggestion));
1961 if (caps.controllers.size() > 1)
1963 GameSuggestion multiController;
1966 multiController.
title =
"Multiple Controllers";
1968 std::to_string(caps.controllers.size()) +
1969 " controllers detected. Some games may have issues with multiple inputs.";
1970 multiController.
reason =
"Detected: " + caps.controllers[0].name +
" and others";
1971 multiController.
source =
"System Detection";
1973 suggestions.
suggestions.push_back(std::move(multiController));
1980 GameSuggestion xaliaHint;
1983 xaliaHint.
title =
"Xalia controller-to-kbd/mouse (default on)";
1984 xaliaHint.
description =
"Proton 10.0-2+ auto-maps controllers to "
1985 "keyboard/mouse for games without controller "
1986 "support. Set PROTON_USE_XALIA=0 for flight "
1987 "sims or rhythm games that expect raw input.";
1988 xaliaHint.
reason =
"Proton default behaviour; reversible per-game";
1989 xaliaHint.
envKey =
"PROTON_USE_XALIA";
1991 xaliaHint.
source =
"Proton 10.0-2 release notes";
1993 suggestions.
suggestions.push_back(std::move(xaliaHint));
1997void GameSuggestionService::addAudioSuggestions(
GameSuggestions& suggestions)
2003 const bool pipewireActive =
2004 std::system(
"systemctl --user is-active --quiet pipewire.service 2>/dev/null") == 0;
2005 const bool pulseActive =
2006 std::system(
"systemctl --user is-active --quiet pulseaudio.service 2>/dev/null") == 0;
2010 GameSuggestion pipewireHint;
2013 pipewireHint.
title =
"PipeWire audio stack detected";
2014 pipewireHint.
description =
"Native PipeWire support via pipewire-pulse. "
2015 "No additional env vars needed for most games.";
2016 pipewireHint.
reason =
"pipewire.service is active";
2017 pipewireHint.
source =
"System Detection";
2019 suggestions.
suggestions.push_back(std::move(pipewireHint));
2021 else if (pulseActive)
2025 GameSuggestion pulseLatency;
2028 pulseLatency.
title =
"PulseAudio latency buffer";
2029 pulseLatency.
description =
"Increase PulseAudio latency to reduce audio "
2030 "crackling or stutter in demanding games.";
2031 pulseLatency.
reason =
"PulseAudio-only server detected";
2032 pulseLatency.
envKey =
"PULSE_LATENCY_MSEC";
2034 pulseLatency.
source =
"Arch Wiki - Gaming audio";
2036 suggestions.
suggestions.push_back(std::move(pulseLatency));
2040void GameSuggestionService::addCachyOSSuggestions(
GameSuggestions& suggestions)
2042 const auto& caps = effectiveCapabilities();
2045 if (caps.tools.gamePerformance)
2047 GameSuggestion gamePerf;
2050 gamePerf.
title =
"CachyOS game-performance";
2051 gamePerf.
description =
"Use game-performance wrapper for optimal CPU scheduling";
2052 gamePerf.
reason =
"Running on CachyOS with game-performance available";
2053 gamePerf.
source =
"CachyOS";
2055 suggestions.
suggestions.push_back(std::move(gamePerf));
2059 GameSuggestion kernelOpt;
2062 kernelOpt.
title =
"CachyOS Kernel";
2063 kernelOpt.
description =
"You're running the CachyOS kernel with gaming optimizations";
2064 kernelOpt.
reason =
"CachyOS kernel detected: " + caps.kernel.version;
2065 kernelOpt.
source =
"CachyOS";
2066 suggestions.
suggestions.push_back(std::move(kernelOpt));
2069 for (
const auto& runner : caps.runners)
2071 if (runner.type ==
"proton-cachyos")
2073 GameSuggestion cachyProton;
2076 cachyProton.
title =
"CachyOS Proton";
2077 cachyProton.
description =
"Use " + runner.name +
" for best CachyOS integration";
2078 cachyProton.
reason =
"CachyOS Proton is optimized for this distro";
2080 cachyProton.
source =
"CachyOS";
2082 suggestions.
suggestions.push_back(std::move(cachyProton));
2088void GameSuggestionService::addBuiltinFixes(
GameSuggestions& suggestions,
int steamAppId,
2089 const std::string& gameName)
2092 static bool loadAttempted =
false;
2095 loadAttempted =
true;
2097 const char* homeEnv = std::getenv(
"HOME");
2098 const std::string homeStr = homeEnv ? homeEnv :
"";
2099 std::vector<std::string> searchPaths = {
2100 "./data/game_fixes.json",
2101 "../data/game_fixes.json",
2102 "/usr/share/gamelauncher/game_fixes.json",
2103 homeStr +
"/.local/share/gamelauncher/game_fixes.json",
2104 homeStr +
"/.config/gamelauncher/game_fixes.json"
2107 for (
const auto& path : searchPaths)
2109 if (loadFixesFromJSON(path))
2118 if (hasLoadedExternalFixes_)
2120 auto it = fixesByAppId_.find(steamAppId);
2121 if (it != fixesByAppId_.end())
2123 Logger::debug(
"Applying JSON fixes for {} (AppID: {})", it->second->name, steamAppId);
2124 for (
const auto& suggestion : it->second->suggestions)
2145 for (
const auto& conflict : conflicts)
2150 int appliedCount = 0;
2151 int skippedCount = 0;
2153 for (
const auto& suggestion : suggestions.
suggestions)
2155 if (!suggestion.canAutoApply)
2160 if (
static_cast<int>(suggestion.priority) >
static_cast<int>(applyLevel))
2166 std::string validationReason;
2169 Logger::warn(
"Skipping suggestion '{}': {}", suggestion.title, validationReason);
2175 if (!suggestion.envKey.empty() && !suggestion.envValue.empty())
2178 Logger::debug(
"Applied env var: {}={}", suggestion.envKey, suggestion.envValue);
2185 if (!suggestion.recommendedRunner.empty())
2190 Logger::debug(
"Applied Proton version: {}", suggestion.recommendedRunner);
2196 Logger::debug(
"Applied runner: {}", suggestion.recommendedRunner);
2202 if (!suggestion.dllOverrides.empty())
2212 Logger::debug(
"Applied DLL overrides: {}", suggestion.dllOverrides);
2217 if (!suggestion.launchArgs.empty())
2227 Logger::debug(
"Applied launch args: {}", suggestion.launchArgs);
2232 Logger::info(
"Applied {} suggestions, skipped {} (validation failed)", appliedCount,
2234 return appliedCount;
2242 std::string& reason)
2250 "Runner '" + suggestion.
recommendedRunner +
"' is not installed on this system";
2256 if (!suggestion.
envKey.empty())
2259 const std::string& key = suggestion.
envKey;
2260 if (key.empty() || (!std::isalpha(
static_cast<unsigned char>(key[0])) && key[0] !=
'_'))
2262 reason =
"Invalid environment variable name: " + key;
2268 if (!std::isalnum(
static_cast<unsigned char>(c)) && c !=
'_')
2270 reason =
"Invalid character in environment variable name: " + key;
2276 const std::string& value = suggestion.
envValue;
2277 if (value.find(
'`') != std::string::npos || value.find(
"$(") != std::string::npos ||
2278 value.find(
"${") != std::string::npos)
2280 reason =
"Environment variable value contains potentially unsafe characters";
2286 const auto& caps = effectiveCapabilities();
2289 if (suggestion.
envKey.find(
"DLSS") != std::string::npos ||
2290 suggestion.
envKey.find(
"NVIDIA") != std::string::npos ||
2291 suggestion.
envKey.find(
"NV_") != std::string::npos)
2295 reason =
"NVIDIA-specific setting on non-NVIDIA system (detected: " +
2296 effectiveGPUVendorName() +
")";
2302 if (suggestion.
envKey.find(
"FSR4") != std::string::npos)
2306 reason =
"AMD FSR4-specific setting on non-AMD system (detected: " +
2307 effectiveGPUVendorName() +
")";
2312 const bool isRdna3UpgradeKey = (suggestion.
envKey ==
"PROTON_FSR4_RDNA3_UPGRADE");
2313 if (isRdna3UpgradeKey && !caps.gpu.supportsFSR4RDNA3)
2315 reason =
"PROTON_FSR4_RDNA3_UPGRADE requires RDNA3 or newer GPU";
2318 if (!isRdna3UpgradeKey && !caps.gpu.supportsFSR4 && !caps.gpu.supportsFSR4RDNA3)
2320 reason =
"FSR4 requires RDNA3 or newer GPU";
2326 if (suggestion.
envKey.find(
"XESS") != std::string::npos)
2330 reason =
"Intel XeSS-specific setting on non-Intel system (detected: " +
2331 effectiveGPUVendorName() +
")";
2341 const auto& runners = effectiveCapabilities().runners;
2344 std::string runnerLower = runnerName;
2345 std::transform(runnerLower.begin(), runnerLower.end(), runnerLower.begin(),
2346 [](
unsigned char c) { return static_cast<char>(::tolower(c)); });
2348 for (
const auto& runner : runners)
2350 std::string installedLower = runner.name;
2351 std::transform(installedLower.begin(), installedLower.end(), installedLower.begin(),
2352 [](
unsigned char c) { return static_cast<char>(::tolower(c)); });
2355 if (installedLower == runnerLower)
2357 Logger::debug(
"Runner '{}' found (exact match)", runnerName);
2362 if (installedLower.find(runnerLower) != std::string::npos)
2364 Logger::debug(
"Runner '{}' found (partial match: {})", runnerName, runner.name);
2370 if (runnerLower.find(
"ge-proton") != std::string::npos &&
2371 installedLower.find(
"ge-proton") != std::string::npos)
2373 Logger::debug(
"Runner '{}' found (GE-Proton family match: {})", runnerName,
2379 if (runnerLower.find(
"proton") != std::string::npos &&
2380 installedLower.find(
"proton") != std::string::npos)
2383 std::regex versionRegex(R
"(proton[- ]?(\d+)\.?(\d*))", std::regex::icase);
2384 std::smatch runnerMatch, installedMatch;
2386 if (std::regex_search(runnerName, runnerMatch, versionRegex) &&
2387 std::regex_search(runner.name, installedMatch, versionRegex))
2394 int runnerMajor = std::stoi(runnerMatch[1].str());
2395 int installedMajor = std::stoi(installedMatch[1].str());
2397 if (installedMajor >= runnerMajor)
2399 Logger::debug(
"Runner '{}' satisfied by newer version: {}", runnerName,
2404 catch (
const std::exception&)
2413 if (runners.empty())
2416 "No runners detected on system, allowing runner '{}' (detection may have failed)",
2421 Logger::debug(
"Runner '{}' not found among {} detected runners", runnerName, runners.size());
2427 std::vector<std::string> conflicts;
2430 std::map<std::string, std::string> envVars;
2433 if (!s.envKey.empty() && s.canAutoApply)
2435 envVars[s.envKey] = s.envValue;
2441 if (envVars.count(
"PROTON_USE_WINED3D") && envVars.count(
"DXVK_ASYNC"))
2443 conflicts.push_back(
"PROTON_USE_WINED3D conflicts with DXVK_ASYNC (WINED3D disables DXVK)");
2447 if (envVars.count(
"PROTON_FSR4_UPGRADE") && envVars.count(
"PROTON_DLSS_UPGRADE"))
2449 conflicts.push_back(
"Both FSR4 and DLSS upgrades enabled - only one should be active");
2453 if (envVars.count(
"WINE_FULLSCREEN_FSR") && envVars.count(
"PROTON_DLSS_UPGRADE"))
2455 conflicts.push_back(
"WINE_FULLSCREEN_FSR with DLSS upgrade is redundant - DLSS upgrade "
2456 "should be sufficient");
2460 if (envVars.count(
"PROTON_NO_ESYNC") && envVars.count(
"PROTON_NO_FSYNC"))
2462 if (envVars[
"PROTON_NO_ESYNC"] ==
"0" && envVars[
"PROTON_NO_FSYNC"] ==
"0")
2464 conflicts.push_back(
2465 "Both Esync and Fsync enabled - Fsync is preferred and supersedes Esync");
2470 if (envVars.count(
"DXVK_HDR") && envVars.count(
"PROTON_USE_WINED3D"))
2472 conflicts.push_back(
"DXVK_HDR incompatible with WINED3D (HDR requires DXVK)");
2476 const auto& caps = effectiveCapabilities();
2480 if (envVars.count(
"PROTON_DLSS_UPGRADE"))
2482 conflicts.push_back(
"DLSS upgrade set but AMD GPU detected - should use FSR instead");
2484 if (envVars.count(
"PROTON_ENABLE_XESS"))
2486 conflicts.push_back(
"XeSS set but AMD GPU detected - should use FSR instead");
2491 if (envVars.count(
"PROTON_FSR4_UPGRADE"))
2493 conflicts.push_back(
2494 "FSR4 upgrade set but NVIDIA GPU detected - should use DLSS instead");
2499 if (envVars.count(
"PROTON_DLSS_UPGRADE"))
2501 conflicts.push_back(
2502 "DLSS upgrade set but Intel GPU detected - should use XeSS instead");
2504 if (envVars.count(
"PROTON_FSR4_UPGRADE"))
2506 conflicts.push_back(
2507 "FSR4 upgrade set but Intel GPU detected - should use XeSS instead");
2521 return "Recommended";
2538 return "Environment";
2540 return "Performance";
2542 return "Compatibility";
2556void GameSuggestionService::initBuiltinFixes()
2568std::string GameSuggestionService::cachedGEProtonVersion_;
2570std::chrono::steady_clock::time_point GameSuggestionService::geProtonCacheTime_;
2571bool GameSuggestionService::hasLoadedExternalFixes_ =
false;
2572std::vector<GameSuggestionService::GameFixEntry> GameSuggestionService::loadedFixes_;
2573std::unordered_map<int, const GameSuggestionService::GameFixEntry*>
2574 GameSuggestionService::fixesByAppId_;
2583 capabilitiesOverride_ = caps;
2588 if (capabilitiesOverride_)
2589 return *capabilitiesOverride_;
2593std::string GameSuggestionService::effectiveGPUVendorName()
2595 if (capabilitiesOverride_)
2597 switch (capabilitiesOverride_->gpu.vendor)
2628 const auto& caps = effectiveCapabilities();
2629 suggestions.
detectedGPU = effectiveGPUVendorName();
2630 suggestions.
isCachyOS = caps.isCachyOS();
2632 addSystemSuggestions(suggestions);
2634 addCachyOSSuggestions(suggestions);
2645bool GameSuggestionService::loadFixesFromJSON(
const std::string& jsonPath)
2648 std::ifstream file(jsonPath);
2649 if (!file.is_open())
2651 Logger::debug(
"Could not open game fixes JSON: {}", jsonPath);
2655 std::stringstream buffer;
2656 buffer << file.rdbuf();
2657 std::string jsonContent = buffer.str();
2660 if (jsonContent.empty())
2662 Logger::warn(
"Empty game fixes JSON file: {}", jsonPath);
2668 size_t fixesStart = jsonContent.find(
"\"fixes\"");
2669 if (fixesStart == std::string::npos)
2676 loadedFixes_.clear();
2679 std::regex appIdRegex(
"\"steamAppId\"\\s*:\\s*(\\d+)");
2680 std::regex nameRegex(
"\"name\"\\s*:\\s*\"([^\"]+)\"");
2681 std::regex priorityRegex(
"\"priority\"\\s*:\\s*\"([^\"]+)\"");
2682 std::regex categoryRegex(
"\"category\"\\s*:\\s*\"([^\"]+)\"");
2683 std::regex titleRegex(
"\"title\"\\s*:\\s*\"([^\"]+)\"");
2684 std::regex descRegex(
"\"description\"\\s*:\\s*\"([^\"]+)\"");
2685 std::regex envKeyRegex(
"\"envKey\"\\s*:\\s*\"([^\"]+)\"");
2686 std::regex envValueRegex(
"\"envValue\"\\s*:\\s*\"([^\"]+)\"");
2687 std::regex launchArgsRegex(
"\"launchArgs\"\\s*:\\s*\"([^\"]+)\"");
2688 std::regex reasonRegex(
"\"reason\"\\s*:\\s*\"([^\"]+)\"");
2689 std::regex sourceRegex(
"\"source\"\\s*:\\s*\"([^\"]+)\"");
2690 std::regex autoApplyRegex(
"\"canAutoApply\"\\s*:\\s*(true|false)");
2694 while ((pos = jsonContent.find(
"\"steamAppId\"", pos)) != std::string::npos)
2697 size_t nextPos = jsonContent.find(
"\"steamAppId\"", pos + 12);
2698 size_t endPos = (nextPos != std::string::npos) ? nextPos : jsonContent.length();
2699 std::string gameBlock = jsonContent.substr(pos, endPos - pos);
2705 if (std::regex_search(gameBlock, match, appIdRegex))
2707 entry.steamAppId = std::stoi(match[1].str());
2716 if (std::regex_search(gameBlock, match, nameRegex))
2718 entry.name = match[1].str();
2722 size_t suggestionsStart = gameBlock.find(
"\"suggestions\"");
2723 if (suggestionsStart != std::string::npos)
2726 std::string suggestionsBlock = gameBlock.substr(suggestionsStart);
2729 size_t suggStart = 0;
2730 while ((suggStart = suggestionsBlock.find(
'{', suggStart)) != std::string::npos)
2732 size_t suggEnd = suggestionsBlock.find(
'}', suggStart);
2733 if (suggEnd == std::string::npos)
2736 std::string suggBlock = suggestionsBlock.substr(suggStart, suggEnd - suggStart + 1);
2738 GameSuggestion suggestion;
2741 if (std::regex_search(suggBlock, match, priorityRegex))
2743 std::string p = match[1].str();
2744 if (p ==
"critical")
2746 else if (p ==
"recommended")
2748 else if (p ==
"optional")
2755 if (std::regex_search(suggBlock, match, categoryRegex))
2757 std::string c = match[1].str();
2758 if (c ==
"compatibility")
2760 else if (c ==
"performance")
2762 else if (c ==
"graphics")
2764 else if (c ==
"input")
2771 if (std::regex_search(suggBlock, match, titleRegex))
2772 suggestion.
title = match[1].str();
2773 if (std::regex_search(suggBlock, match, descRegex))
2775 if (std::regex_search(suggBlock, match, envKeyRegex))
2776 suggestion.
envKey = match[1].str();
2777 if (std::regex_search(suggBlock, match, envValueRegex))
2778 suggestion.
envValue = match[1].str();
2779 if (std::regex_search(suggBlock, match, launchArgsRegex))
2781 if (std::regex_search(suggBlock, match, reasonRegex))
2782 suggestion.
reason = match[1].str();
2783 if (std::regex_search(suggBlock, match, sourceRegex))
2784 suggestion.
source = match[1].str();
2785 if (std::regex_search(suggBlock, match, autoApplyRegex))
2788 if (!suggestion.
title.empty())
2790 entry.suggestions.push_back(suggestion);
2793 suggStart = suggEnd + 1;
2797 if (!entry.suggestions.empty())
2799 loadedFixes_.push_back(entry);
2800 Logger::debug(
"Loaded {} fixes for {} (AppID: {})", entry.suggestions.size(),
2801 entry.name, entry.steamAppId);
2808 fixesByAppId_.clear();
2809 for (
const auto& entry : loadedFixes_)
2811 fixesByAppId_[entry.steamAppId] = &entry;
2814 hasLoadedExternalFixes_ = !loadedFixes_.empty();
2815 Logger::info(
"Loaded {} game fix entries from JSON ({} indexed)", loadedFixes_.size(),
2816 fixesByAppId_.size());
2817 return hasLoadedExternalFixes_;
2820std::string GameSuggestionService::getLatestGEProtonVersion()
2823 auto now = std::chrono::steady_clock::now();
2824 auto cacheAge = std::chrono::duration_cast<std::chrono::minutes>(now - geProtonCacheTime_);
2826 if (!cachedGEProtonVersion_.empty() && cacheAge.count() < 60)
2828 return cachedGEProtonVersion_;
2832 static const std::string url =
2833 "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest";
2834 std::string command =
"curl -s -L --proto =https --connect-timeout 5 --max-time 10 " +
2837 std::array<char, 4096> buffer;
2840 FILE* pipe = popen(command.c_str(),
"r");
2843 Logger::warn(
"GE-Proton: Failed to execute curl command");
2847 constexpr size_t kMaxGitHubResponse = 1u * 1024 * 1024;
2848 while (fgets(buffer.data(),
static_cast<int>(buffer.size()), pipe) !=
nullptr)
2850 result += buffer.data();
2851 if (result.size() > kMaxGitHubResponse)
2855 int pcloseStatus = pclose(pipe);
2856 if (pcloseStatus == -1)
2858 Logger::warn(
"GE-Proton: pclose failed: {}", strerror(errno));
2861 if (WIFEXITED(pcloseStatus) && WEXITSTATUS(pcloseStatus) != 0)
2863 Logger::warn(
"GE-Proton: curl exited with code {}", WEXITSTATUS(pcloseStatus));
2869 Logger::warn(
"GE-Proton: Empty response from GitHub API");
2874 std::regex tagRegex(
"\"tag_name\"\\s*:\\s*\"([^\"]+)\"");
2876 if (std::regex_search(result, match, tagRegex))
2878 cachedGEProtonVersion_ = match[1].str();
2879 geProtonCacheTime_ = now;
2880 Logger::info(
"GE-Proton: Latest version is {}", cachedGEProtonVersion_);
2881 return cachedGEProtonVersion_;
2884 Logger::warn(
"GE-Proton: Could not parse tag_name from GitHub response");
static GameSuggestions getLocalSuggestions(const Game &game)
Get local-only suggestions (no network requests).
static bool validateSuggestion(const GameSuggestion &suggestion, std::string &reason)
Validate a suggestion before applying.
static std::string categoryToString(SuggestionCategory category)
Get category as human-readable string.
static void setCapabilitiesOverrideForTesting(const SystemCapabilities *caps)
Override the SystemCapabilities consulted by suggestion generation.
static int applySuggestions(Game &game, const GameSuggestions &suggestions, SuggestionPriority applyLevel=SuggestionPriority::Recommended)
Apply suggestions to a game's runner config.
static bool isRunnerAvailable(const std::string &runnerName)
Check if a runner exists on the system.
static std::string priorityToString(SuggestionPriority priority)
Get priority as human-readable string.
static void getSuggestionsAsync(const Game &game, SuggestionsCallback callback)
Get suggestions asynchronously.
static GameSuggestions getSuggestions(const Game &game)
Get suggestions for a game.
std::function< void(const GameSuggestions &)> SuggestionsCallback
static std::vector< std::string > checkConflicts(const GameSuggestions &suggestions)
Check for conflicting environment variables.
Complete representation of a game in the library.
GameMetadata metadata
Descriptive information and media.
std::string name
Display name shown in UI.
GameRunner runner
Runner/compatibility layer to use (Native, Proton, Wine, etc.).
GameRunnerConfig runnerConfig
How to launch and run the game.
Thread-safe LRU cache with optional TTL support.
static void info(const std::string &message, Args &&... args)
Log info message (general information).
static void debug(const std::string &message, Args &&... args)
Log debug message (verbose development info).
static void warn(const std::string &message, Args &&... args)
Log warning message (non-critical issue).
static SteamAppInfo getSteamAppInfo(int steamAppId)
Get Steam store information (native Linux, genres, DRM, etc.).
static LutrisGameInfo getLutrisInfo(int steamAppId)
Get Lutris game info and installers.
static ProtonDBGameInfo getGameInfo(int steamAppId)
Get game info by Steam App ID.
static SteamDeckInfo getSteamDeckInfo(int steamAppId)
Get Steam Deck compatibility status from Valve's testing.
static std::string escapeArg(const std::string &arg)
Escape a string for safe use as a shell argument.
static SystemInfoService & instance()
Get singleton instance.
const SystemCapabilities & getCapabilities()
Get complete system capabilities.
std::string getGPUVendorName()
Get GPU vendor name as string.
@ Proton
Proton (Steam's Wine fork).
static LRUCache< int, GameSuggestions > suggestionsCache_(SUGGESTIONS_CACHE_MAX_SIZE, SUGGESTIONS_CACHE_TTL_SECONDS)
static constexpr int SUGGESTIONS_CACHE_TTL_SECONDS
static constexpr size_t SUGGESTIONS_CACHE_MAX_SIZE
ConfidenceLevel
How confident we are that our recommendations will work.
SuggestionCategory
Category of the suggestion.
SuggestionPriority
Priority level for suggestions.
bool protonDbTierAutoApply(const std::string &tier)
SuggestionPriority protonDbTierPriority(const std::string &tier)
std::string wineDLL
DLL overrides (e.g., "d3d11=native,builtin").
std::string arguments
Command line arguments to pass to game.
std::string runnerVersion
Runner version: "wine-8.0", "proton-8.0-5", etc.
std::string protonVersion
Proton version (e.g., "proton-cachyos-slr").
std::map< std::string, std::string > environmentVariables
Environment variables to set before launching (KEY=VALUE pairs).
A single setting recommendation.
SuggestionCategory category
SuggestionPriority priority
std::string recommendedRunner
Collection of suggestions for a game.
std::string protondbConfidence
bool hasRunnerSuggestion() const
std::vector< GameSuggestion > getByPriority(SuggestionPriority priority) const
std::string steamDeckStatus
float getConfidenceScore() const
std::string getCombinedDLLOverrides() const
std::string getRecommendedRunner() const
ConfidenceLevel getConfidenceLevel() const
std::vector< std::pair< std::string, std::string > > getEnvironmentVariables() const
std::vector< GameSuggestion > getByCategory(SuggestionCategory category) const
std::string getConfidenceSummary() const
bool needsBattleyeRuntime
std::vector< GameSuggestion > suggestions
Complete system capabilities summary.