Start tracking cloud support for games

This commit is contained in:
mtkennerly 2024-05-31 23:36:47 -04:00
parent 5a8369af1e
commit adf4da57c6
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
8 changed files with 2027 additions and 31 deletions

View file

@ -198,6 +198,8 @@ impl Manifest {
pub struct Game {
#[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<String>,
#[serde(skip_serializing_if = "CloudMetadata::is_empty")]
pub cloud: CloudMetadata,
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub files: BTreeMap<String, GameFileEntry>,
#[serde(skip_serializing_if = "GogMetadata::is_empty")]
@ -234,6 +236,13 @@ impl Game {
.copied()
.collect(),
};
self.cloud = CloudMetadata {
epic: cache.cloud.epic,
gog: cache.cloud.gog,
origin: cache.cloud.origin,
steam: cache.cloud.steam,
uplay: cache.cloud.uplay,
};
let paths = cache.parse_paths(title.to_string());
for path in paths {
@ -574,6 +583,35 @@ impl IdMetadata {
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct CloudMetadata {
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub epic: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub gog: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub origin: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub steam: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub uplay: bool,
}
impl CloudMetadata {
pub fn is_empty(&self) -> bool {
let Self {
epic,
gog,
origin,
steam,
uplay,
} = self;
!epic && !gog && !origin && !steam && !uplay
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ManifestOverride(pub BTreeMap<String, OverrideGame>);