15#include <nlohmann/json.hpp>
73 return "Native Linux";
100 return "Not Installed";
117 int64_t totalSeconds =
118 std::max(
static_cast<int64_t
>(0),
static_cast<int64_t
>(
statistics.totalPlayTimeSeconds));
119 int64_t hours = totalSeconds / 3600;
120 int64_t minutes = (totalSeconds % 3600) / 60;
122 std::ostringstream oss;
129 oss <<
" " << minutes <<
"m";
132 else if (minutes > 0)
134 oss << minutes <<
"m";
146 const char* units[] = {
"B",
"KB",
"MB",
"GB",
"TB"};
150 while (size >= 1024.0 && unitIndex < 4)
156 std::ostringstream oss;
157 oss << std::fixed << std::setprecision(1) << size <<
" " << units[unitIndex];
166static std::string
toLower(
const std::string& str)
168 std::string result = str;
169 for (
char& c : result)
171 c =
static_cast<char>(std::tolower(
static_cast<unsigned char>(c)));
228 if (!
metadata.imagePaths.verticalCover.empty())
229 return metadata.imagePaths.verticalCover;
234 if (!
metadata.imagePaths.header.empty())
236 if (!
metadata.imagePaths.heroImage.empty())
237 return metadata.imagePaths.heroImage;
238 if (!
metadata.imagePaths.capsule.empty())
244 if (!
metadata.imagePaths.heroImage.empty())
245 return metadata.imagePaths.heroImage;
250 if (!
metadata.imagePaths.header.empty())
259 if (!
metadata.imagePaths.header.empty())
262 if (!
metadata.imagePaths.heroImage.empty())
263 return metadata.imagePaths.heroImage;
267 if (!
metadata.imagePaths.capsule.empty())
270 if (!
metadata.imagePaths.header.empty())
314 double targetHours = 0.0;
318 targetHours =
hltbInfo.mainStoryHours;
321 targetHours =
hltbInfo.mainPlusExtrasHours;
324 targetHours =
hltbInfo.completionistHours;
327 targetHours =
hltbInfo.allStylesHours;
331 if (targetHours <= 0.0)
334 double playedHours =
statistics.totalPlayTimeSeconds / 3600.0;
335 return targetHours - playedHours;
343 double targetHours = 0.0;
347 targetHours =
hltbInfo.mainStoryHours;
350 targetHours =
hltbInfo.mainPlusExtrasHours;
353 targetHours =
hltbInfo.completionistHours;
356 targetHours =
hltbInfo.allStylesHours;
360 if (targetHours <= 0.0)
363 double playedHours =
statistics.totalPlayTimeSeconds / 3600.0;
364 return (playedHours / targetHours) * 100.0;
372 double totalDuration = 0.0;
373 int completedSessions = 0;
377 if (!session.isActive() && session.durationSeconds > 0)
379 totalDuration += session.durationSeconds;
384 return completedSessions > 0 ? totalDuration / completedSessions : 0.0;
394 int hours =
static_cast<int>(totalSeconds / 3600);
395 int minutes =
static_cast<int>((totalSeconds % 3600) / 60);
397 std::ostringstream oss;
402 oss <<
" " << minutes <<
"m";
404 else if (minutes > 0)
406 oss << minutes <<
"m";
424 time_t now = std::time(
nullptr);
434 std::ostringstream oss;
437 int minutes =
static_cast<int>(hours * 60);
438 oss << minutes <<
"m";
440 else if (hours < 100.0)
442 oss << std::fixed << std::setprecision(1) << hours <<
"h";
446 oss << static_cast<int>(hours) <<
"h";
480 static const std::set<std::string> keys = {
493 "mangoHudConfigFile",
495 "enableGamePerformance",
500 "gamescopeInternalWidth",
501 "gamescopeInternalHeight",
502 "gamescopeRefreshRate",
503 "gamescopeFullscreen",
504 "gamescopeBorderless",
505 "gamescopeEnableFSR",
506 "gamescopeFSRSharpness",
507 "gamescopeEnableVRR",
508 "gamescopeEnableHDR",
509 "gamescopeEnableITM",
510 "gamescopeITMSDRNits",
511 "gamescopeIntegerScaling",
512 "gamescopeForceGrabCursor",
515 "enableDetailedLogging",
517 "virtualDesktopWidth",
518 "virtualDesktopHeight",
520 "environmentVariables",
527 static const std::set<std::string> keys = {
541 "steamLaunchOptions",
543 "steamPlaytime2Weeks",
548 "steamUserCategories",
550 "protondbConfidence",
552 "protondbLastUpdated",
564std::string
jstr(
const gjson& j,
const char* key,
const char* def =
"")
566 auto it = j.find(key);
567 if (it != j.end() && it->is_string())
568 return it->get<std::string>();
573 auto it = j.find(key);
574 if (it != j.end() && it->is_number_integer())
575 return it->get<
int>();
576 if (it != j.end() && it->is_number_float())
577 return static_cast<int>(it->get<
double>());
582 auto it = j.find(key);
583 if (it != j.end() && it->is_number())
584 return it->get<
double>();
589 auto it = j.find(key);
590 if (it != j.end() && it->is_boolean())
591 return it->get<
bool>();
596 auto it = j.find(key);
597 if (it != j.end() && it->is_number_integer())
598 return it->get<int64_t>();
607 if (!src.is_object())
609 gjson extras = gjson::object();
610 for (
auto it = src.begin(); it != src.end(); ++it)
612 if (known.find(it.key()) == known.end())
613 extras[it.key()] = it.value();
617 return extras.dump();
626 if (extrasStr.empty())
630 gjson extras = gjson::parse(extrasStr);
631 if (!extras.is_object())
633 for (
auto it = extras.begin(); it != extras.end(); ++it)
635 if (!dst.contains(it.key()))
636 dst[it.key()] = it.value();
639 catch (
const gjson::exception& e)
641 Logger::warn(
"[Game] unknownJsonExtras stash is malformed; skipping merge: {}", e.what());
670 j[
"mangoHudConfigFile"] =
runnerConfig.mangoHudConfigFile;
672 j[
"enableGamePerformance"] =
runnerConfig.enableGamePerformance;
679 j[
"gamescopeInternalWidth"] =
runnerConfig.gamescopeInternalWidth;
680 j[
"gamescopeInternalHeight"] =
runnerConfig.gamescopeInternalHeight;
681 j[
"gamescopeRefreshRate"] =
runnerConfig.gamescopeRefreshRate;
682 j[
"gamescopeFullscreen"] =
runnerConfig.gamescopeFullscreen;
683 j[
"gamescopeBorderless"] =
runnerConfig.gamescopeBorderless;
684 j[
"gamescopeEnableFSR"] =
runnerConfig.gamescopeEnableFSR;
685 j[
"gamescopeFSRSharpness"] =
runnerConfig.gamescopeFSRSharpness;
686 j[
"gamescopeEnableVRR"] =
runnerConfig.gamescopeEnableVRR;
687 j[
"gamescopeEnableHDR"] =
runnerConfig.gamescopeEnableHDR;
688 j[
"gamescopeEnableITM"] =
runnerConfig.gamescopeEnableITM;
689 j[
"gamescopeITMSDRNits"] =
runnerConfig.gamescopeITMSDRNits;
690 j[
"gamescopeIntegerScaling"] =
runnerConfig.gamescopeIntegerScaling;
691 j[
"gamescopeForceGrabCursor"] =
runnerConfig.gamescopeForceGrabCursor;
698 j[
"enableDetailedLogging"] =
runnerConfig.enableDetailedLogging;
701 j[
"useVirtualDesktop"] =
runnerConfig.useVirtualDesktop;
702 j[
"virtualDesktopWidth"] =
runnerConfig.virtualDesktopWidth;
703 j[
"virtualDesktopHeight"] =
runnerConfig.virtualDesktopHeight;
711 gjson envArr = gjson::array();
712 for (
const auto& [key, value] :
runnerConfig.environmentVariables)
714 envArr.push_back({{
"k", key}, {
"v", value}});
716 j[
"environmentVariables"] = std::move(envArr);
732 j = gjson::parse(
json);
734 catch (
const gjson::exception& e)
736 Logger::warn(
"[Game] runner_config blob malformed; keeping defaults: {}", e.what());
741 Logger::warn(
"[Game] runner_config blob is not a JSON object; keeping defaults");
747 runnerConfig.executablePath = jstr(j,
"executablePath");
748 runnerConfig.workingDirectory = jstr(j,
"workingDirectory");
755 runnerConfig.useSteamDefaults = jbool(j,
"useSteamDefaults",
true);
756 runnerConfig.useSteamLaunch = jbool(j,
"useSteamLaunch");
758 runnerConfig.enableMangoHud = jbool(j,
"enableMangoHud");
759 runnerConfig.mangoHudConfigFile = jstr(j,
"mangoHudConfigFile");
760 runnerConfig.enableGameMode = jbool(j,
"enableGameMode");
761 runnerConfig.enableGamePerformance = jbool(j,
"enableGamePerformance");
762 runnerConfig.enableVkBasalt = jbool(j,
"enableVkBasalt");
764 runnerConfig.enableGamescope = jbool(j,
"enableGamescope");
765 runnerConfig.gamescopeWidth = jint(j,
"gamescopeWidth", 0);
766 runnerConfig.gamescopeHeight = jint(j,
"gamescopeHeight", 0);
767 runnerConfig.gamescopeInternalWidth = jint(j,
"gamescopeInternalWidth", 0);
768 runnerConfig.gamescopeInternalHeight = jint(j,
"gamescopeInternalHeight", 0);
769 runnerConfig.gamescopeRefreshRate = jint(j,
"gamescopeRefreshRate", 0);
770 runnerConfig.gamescopeFullscreen = jbool(j,
"gamescopeFullscreen",
true);
771 runnerConfig.gamescopeBorderless = jbool(j,
"gamescopeBorderless");
772 runnerConfig.gamescopeEnableFSR = jbool(j,
"gamescopeEnableFSR");
773 runnerConfig.gamescopeFSRSharpness = jint(j,
"gamescopeFSRSharpness", 5);
774 runnerConfig.gamescopeEnableVRR = jbool(j,
"gamescopeEnableVRR");
775 runnerConfig.gamescopeEnableHDR = jbool(j,
"gamescopeEnableHDR");
776 runnerConfig.gamescopeEnableITM = jbool(j,
"gamescopeEnableITM");
777 runnerConfig.gamescopeITMSDRNits = jint(j,
"gamescopeITMSDRNits", 0);
778 runnerConfig.gamescopeIntegerScaling = jbool(j,
"gamescopeIntegerScaling");
779 runnerConfig.gamescopeForceGrabCursor = jbool(j,
"gamescopeForceGrabCursor");
781 runnerConfig.enableFsync = jbool(j,
"enableFsync",
true);
782 runnerConfig.autoDetectSync = jbool(j,
"autoDetectSync",
true);
784 runnerConfig.enableDetailedLogging = jbool(j,
"enableDetailedLogging");
786 runnerConfig.useVirtualDesktop = jbool(j,
"useVirtualDesktop");
787 runnerConfig.virtualDesktopWidth = jint(j,
"virtualDesktopWidth", 1920);
788 runnerConfig.virtualDesktopHeight = jint(j,
"virtualDesktopHeight", 1080);
791 if (
auto it = j.find(
"excludeProcesses"); it != j.end() && it->is_array())
793 for (
const auto& v : *it)
795 runnerConfig.excludeProcesses.push_back(v.get<std::string>());
799 if (
auto it = j.find(
"environmentVariables"); it != j.end() && it->is_array())
801 for (
const auto& entry : *it)
803 if (!entry.is_object())
805 std::string key = jstr(entry,
"k");
806 std::string val = jstr(entry,
"v");
814 runnerConfig.unknownJsonExtras = captureUnknownKeys(j, kKnownRunnerConfigKeys());
823 j[
"coverArtPath"] =
metadata.coverArtPath;
824 j[
"bannerPath"] =
metadata.bannerPath;
827 {
"verticalCover",
metadata.imagePaths.verticalCover},
828 {
"heroImage",
metadata.imagePaths.heroImage},
830 {
"header",
metadata.imagePaths.header},
831 {
"capsule",
metadata.imagePaths.capsule},
835 j[
"description"] =
metadata.description;
838 j[
"developer"] =
metadata.developer;
839 j[
"publisher"] =
metadata.publisher;
840 j[
"releaseYear"] =
metadata.releaseYear;
841 j[
"userRating"] =
metadata.userRating;
843 j[
"isSteamGame"] =
metadata.isSteamGame;
844 j[
"steamAppId"] =
metadata.steamAppId;
845 j[
"steamInstalled"] =
metadata.steamInstalled;
846 j[
"steamLaunchOptions"] =
metadata.steamLaunchOptions;
847 j[
"steamBuildId"] =
metadata.steamBuildId;
848 j[
"steamPlaytime2Weeks"] =
metadata.steamPlaytime2Weeks;
849 j[
"steamLastLaunch"] =
static_cast<int64_t
>(
metadata.steamLastLaunch);
850 j[
"steamLastExit"] =
static_cast<int64_t
>(
metadata.steamLastExit);
851 j[
"steamType"] =
metadata.steamType;
852 j[
"steamCategories"] =
metadata.steamCategories;
853 j[
"steamUserCategories"] =
metadata.steamUserCategories;
855 j[
"protondbTier"] =
metadata.protondbTier;
856 j[
"protondbConfidence"] =
metadata.protondbConfidence;
857 j[
"protondbScore"] =
metadata.protondbScore;
858 j[
"protondbLastUpdated"] =
static_cast<int64_t
>(
metadata.protondbLastUpdated);
861 {
"enabled",
metadata.cloudSave.enabled},
862 {
"supported",
metadata.cloudSave.supported},
863 {
"lastSyncState",
metadata.cloudSave.lastSyncState},
864 {
"storageBytes",
metadata.cloudSave.storageBytes},
865 {
"lastSyncTime",
static_cast<int64_t
>(
metadata.cloudSave.lastSyncTime)},
870 j[
"dlcCount"] =
metadata.dlc.size();
871 gjson dlcArr = gjson::array();
872 for (
const auto& dlc :
metadata.dlc)
875 {
"appId", dlc.appId},
877 {
"installed", dlc.installed},
878 {
"sizeBytes", dlc.sizeBytes},
881 j[
"dlc"] = std::move(dlcArr);
884 mergeUnknownKeys(j,
metadata.unknownJsonExtras);
896 j = gjson::parse(
json);
898 catch (
const gjson::exception& e)
900 Logger::warn(
"[Game] metadata blob malformed; keeping defaults: {}", e.what());
905 Logger::warn(
"[Game] metadata blob is not a JSON object; keeping defaults");
909 metadata.coverArtPath = jstr(j,
"coverArtPath");
910 metadata.bannerPath = jstr(j,
"bannerPath");
912 if (
auto it = j.find(
"imagePaths"); it != j.end() && it->is_object())
914 const auto& ip = *it;
915 metadata.imagePaths.verticalCover = jstr(ip,
"verticalCover");
916 metadata.imagePaths.heroImage = jstr(ip,
"heroImage");
917 metadata.imagePaths.logo = jstr(ip,
"logo");
918 metadata.imagePaths.header = jstr(ip,
"header");
919 metadata.imagePaths.capsule = jstr(ip,
"capsule");
920 metadata.imagePaths.icon = jstr(ip,
"icon");
923 metadata.description = jstr(j,
"description");
925 if (
auto it = j.find(
"genres"); it != j.end() && it->is_array())
926 for (
const auto& v : *it)
928 metadata.genres.push_back(v.get<std::string>());
930 if (
auto it = j.find(
"tags"); it != j.end() && it->is_array())
931 for (
const auto& v : *it)
933 metadata.tags.push_back(v.get<std::string>());
935 metadata.developer = jstr(j,
"developer");
936 metadata.publisher = jstr(j,
"publisher");
937 metadata.releaseYear = jint(j,
"releaseYear");
938 metadata.userRating =
static_cast<float>(jdouble(j,
"userRating"));
940 metadata.isSteamGame = jbool(j,
"isSteamGame");
941 metadata.steamAppId = jint(j,
"steamAppId");
942 metadata.steamInstalled = jbool(j,
"steamInstalled",
true);
943 metadata.steamLaunchOptions = jstr(j,
"steamLaunchOptions");
944 metadata.steamBuildId = jstr(j,
"steamBuildId");
945 metadata.steamPlaytime2Weeks =
static_cast<uint32_t
>(jint(j,
"steamPlaytime2Weeks"));
946 metadata.steamLastLaunch =
static_cast<time_t
>(jint64(j,
"steamLastLaunch"));
947 metadata.steamLastExit =
static_cast<time_t
>(jint64(j,
"steamLastExit"));
948 metadata.steamType = jstr(j,
"steamType");
950 if (
auto it = j.find(
"steamCategories"); it != j.end() && it->is_array())
951 for (
const auto& v : *it)
953 metadata.steamCategories.push_back(v.get<std::string>());
954 metadata.steamUserCategories.clear();
955 if (
auto it = j.find(
"steamUserCategories"); it != j.end() && it->is_array())
956 for (
const auto& v : *it)
958 metadata.steamUserCategories.push_back(v.get<std::string>());
960 metadata.protondbTier = jstr(j,
"protondbTier");
961 metadata.protondbConfidence = jstr(j,
"protondbConfidence");
962 metadata.protondbScore =
static_cast<float>(jdouble(j,
"protondbScore"));
963 metadata.protondbLastUpdated =
static_cast<time_t
>(jint64(j,
"protondbLastUpdated"));
965 if (
auto it = j.find(
"cloudSave"); it != j.end() && it->is_object())
967 const auto& cs = *it;
968 metadata.cloudSave.enabled = jbool(cs,
"enabled");
969 metadata.cloudSave.supported = jbool(cs,
"supported");
970 metadata.cloudSave.lastSyncState = jint(cs,
"lastSyncState");
971 metadata.cloudSave.storageBytes =
static_cast<uint64_t
>(jint64(cs,
"storageBytes"));
972 metadata.cloudSave.lastSyncTime =
static_cast<time_t
>(jint64(cs,
"lastSyncTime"));
976 if (
auto it = j.find(
"dlc"); it != j.end() && it->is_array())
978 for (
const auto& entry : *it)
980 if (!entry.is_object())
983 dlc.
appId = jint(entry,
"appId");
984 dlc.
name = jstr(entry,
"name");
985 dlc.
installed = jbool(entry,
"installed");
986 dlc.
sizeBytes =
static_cast<uint64_t
>(jint64(entry,
"sizeBytes"));
988 metadata.dlc.push_back(std::move(dlc));
992 metadata.unknownJsonExtras = captureUnknownKeys(j, kKnownMetadataKeys());
1002 info.
pid = processId;
1010 std::string environPath =
"/proc/" + std::to_string(processId) +
"/environ";
1011 std::ifstream environFile(environPath, std::ios::binary);
1012 if (environFile.is_open())
1014 std::string content((std::istreambuf_iterator<char>(environFile)),
1015 std::istreambuf_iterator<char>());
1016 environFile.close();
1020 while (start < content.size())
1022 size_t end = content.find(
'\0', start);
1023 if (end == std::string::npos)
1024 end = content.size();
1026 std::string entry = content.substr(start, end - start);
1027 size_t eqPos = entry.find(
'=');
1028 if (eqPos != std::string::npos)
1030 std::string key = entry.substr(0, eqPos);
1031 std::string value = entry.substr(eqPos + 1);
1040 std::string cmdlinePath =
"/proc/" + std::to_string(processId) +
"/cmdline";
1041 std::ifstream cmdlineFile(cmdlinePath, std::ios::binary);
1042 if (cmdlineFile.is_open())
1044 std::string content((std::istreambuf_iterator<char>(cmdlineFile)),
1045 std::istreambuf_iterator<char>());
1046 cmdlineFile.close();
1049 for (
char& c : content)
1055 while (!content.empty() && content.back() ==
' ')
1069 std::map<std::string, std::string> result;
1072 for (
const auto& key : keys)
1077 result[key] = it->second;
1084std::vector<std::string>
1087 std::vector<std::string> differences;
1090 std::map<std::string, std::string> configuredMap;
1091 for (
const auto& entry : configured)
1093 size_t eqPos = entry.find(
'=');
1094 if (eqPos != std::string::npos)
1096 configuredMap[entry.substr(0, eqPos)] = entry.substr(eqPos + 1);
1101 for (
const auto& [key, expectedValue] : configuredMap)
1103 auto actualIt =
envVars.find(key);
1104 if (actualIt ==
envVars.end())
1106 differences.push_back(key +
": MISSING (expected '" + expectedValue +
"')");
1108 else if (actualIt->second != expectedValue)
1110 differences.push_back(key +
": MISMATCH expected '" + expectedValue +
"', actual '" +
1111 actualIt->second +
"'");
1117 for (
const auto& key : keyVars)
1119 if (configuredMap.find(key) == configuredMap.end())
1121 auto actualIt =
envVars.find(key);
1122 if (actualIt !=
envVars.end())
1124 differences.push_back(key +
": EXTRA (not configured, actual '" + actualIt->second +
std::string publisherLowerCache_
Cached lowercase publisher for case-insensitive search (computed on first access).
std::string nameLowerCache_
Cached lowercase name for case-insensitive search (computed on first access).
GameMetadata metadata
Descriptive information and media.
std::string getPlatformName() const
Get human-readable platform name.
void deserializeMetadata(const std::string &json)
Deserialize metadata from JSON.
std::vector< PlaySession > recentSessions
Recent play sessions (last 20 kept in memory).
std::string getFormattedInstallSize() const
Format install size as human-readable string.
CompletionStatus completionStatus
User's completion status.
bool cacheInitialized_
True if caches have been computed.
const std::string & getDeveloperLower() const
Get lowercase developer (cached for performance).
std::string name
Display name shown in UI.
const std::string & getNameLower() const
Get lowercase name (cached for performance).
std::string getSourceName() const
Get human-readable source name.
std::string serializeRunnerConfig() const
Serialize runner configuration to JSON.
std::string descriptionLowerCache_
Cached lowercase description for case-insensitive search (computed on first access).
GameStatistics statistics
Play statistics and usage tracking.
GameRunner runner
Runner/compatibility layer to use (Native, Proton, Wine, etc.).
double getAverageSessionDuration() const
Get average session duration for this game.
const std::string & getPublisherLower() const
Get lowercase publisher (cached for performance).
GameRunnerConfig runnerConfig
How to launch and run the game.
std::string getFormattedPlayTime() const
Format total play time as human-readable string.
std::string getCompletionStatusName() const
Get human-readable completion status name.
GameStatus status
Current installation and execution status.
std::string getStatusName() const
Get human-readable status name.
HowLongToBeatInfo hltbInfo
Time-to-beat estimates.
uint64_t installSizeBytes
Installation size in bytes.
std::string developerLowerCache_
Cached lowercase developer for case-insensitive search (computed on first access).
double getRemainingPlaytime(int targetStyle=0) const
Get estimated remaining playtime based on HLTB data.
std::string serializeMetadata() const
Serialize metadata to JSON.
void deserializeRunnerConfig(const std::string &json)
Deserialize runner configuration from JSON.
GameSource source
Where the game was acquired from (Steam, GOG, Local, etc.).
double getCompletionPercentage(int targetStyle=0) const
Get completion percentage based on HLTB estimate.
std::string getRunnerName() const
Get human-readable runner name.
std::string getImagePath(ImageType type) const
Get path for a specific image type.
const std::string & getDescriptionLower() const
Get lowercase description (cached for performance).
static void warn(const std::string &message, Args &&... args)
Log warning message (non-critical issue).
static std::string toLower(const std::string &str)
@ Steam
Steam store/platform.
@ Local
Manually added game (not from a store).
@ Itch
itch.io indie games
@ Lutris
Lutris community scripts.
@ Unknown
Unknown or unspecified source.
@ GOG
GOG.com (DRM-free games).
@ Flatpak
Flatpak package.
@ ScummVM
ScummVM game (adventure game engine).
@ RetroArch
RetroArch/emulated game (console emulation).
@ Steam
Steam game (launched via Steam client).
@ Proton
Windows game via Proton (Steam's Wine fork).
@ Native
Native Linux executable (no compatibility layer).
@ GOG
GOG game (DRM-free game from GOG.com).
@ Wine
Windows game via Wine compatibility layer.
@ Epic
Epic Games Store game.
@ DOSBox
DOS game via DOSBox emulator.
ImageType
Types of game images available.
@ HeroImage
Wide banner/hero image (landscape).
@ Capsule
Store capsule image (616x353).
@ VerticalCover
Vertical cover art (600x900, portrait).
@ Logo
Game logo with transparency (PNG).
@ Header
Small header image (460x215).
@ Installing
Game is being installed.
@ NotInstalled
Game is in library but not installed.
@ Running
Game is currently running.
@ Updating
Game is being updated.
@ Installed
Game is installed and ready to play.
@ Proton
Proton (Steam's Wine fork).
@ Native
Native Linux executable (no compatibility layer).
@ Wine
Wine compatibility layer.
@ Played
Played but no clear completion criteria (e.g., multiplayer).
@ Completed
100% completion (achievements, side content, etc.)
@ Abandoned
Stopped playing, unlikely to return.
@ Beaten
Main story/campaign completed.
@ OnHold
Temporarily paused.
@ Playing
Currently playing.
@ NotPlayed
Never played (backlog).
int64_t jint64(const gjson &j, const char *key, int64_t def=0)
const std::set< std::string > & kKnownMetadataKeys()
double jdouble(const gjson &j, const char *key, double def=0.0)
const std::set< std::string > & kKnownRunnerConfigKeys()
Set of keys that the typed struct knows about.
std::string captureUnknownKeys(const gjson &src, const std::set< std::string > &known)
Extract any keys not in known into a JSON object string.
void mergeUnknownKeys(gjson &dst, const std::string &extrasStr)
Inverse of captureUnknownKeys: merge stashed unknowns into the JSON object we're about to serialise.
int jint(const gjson &j, const char *key, int def=0)
std::string jstr(const gjson &j, const char *key, const char *def="")
Type-tolerant getter helpers — return defaultVal when the key is missing or the value is the wrong ty...
bool jbool(const gjson &j, const char *key, bool def=false)
Actual environment and command line read from a running process.
static const std::vector< std::string > & getKeyEnvVars()
std::vector< std::string > compareWithConfigured(const std::vector< std::string > &configured) const
Compare configured vs actual environment.
int pid
Process ID this info was read from.
static ActualRuntimeInfo readFromProcess(int processId)
Read actual runtime info from a process.
std::map< std::string, std::string > envVars
All environment variables.
std::map< std::string, std::string > getKeyEnvironment() const
Get only gaming-related environment variables.
std::string commandLine
Full command line from /proc/pid/cmdline.
bool valid
Whether the read was successful.
Information about downloadable content (DLC).
int appId
Steam App ID of the DLC.
bool installed
True if DLC is installed.
uint64_t sizeBytes
Installation size in bytes.
std::string name
DLC display name.
bool isStale() const
Check if data is stale (older than 30 days).
time_t lastUpdated
When this data was fetched.
static std::string formatHours(double hours)
Get formatted time string for a playstyle.
std::string getFormattedDuration() const
Get formatted duration string.
double durationSeconds
Session duration in seconds.