Summit: Rust workspace with Steam/Heroic/Lutris scanner, heuristic detection and per-game profiles
This commit is contained in:
commit
6cdd92ab00
15 files changed
+1201
No files matched your search
@@ -0,0 +1,3 @@
|
||||
/target
|
||||
*.log
|
||||
.env*
|
||||
Generated
+522
@@ -0,0 +1,522 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "844c5c0b65be192cb68d570cca1b21a6444431d24e39c084dc0336177015337c"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.191"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell_polyfill"
|
||||
version = "1.70.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.154"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "summit"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"serde_json",
|
||||
"summit-core",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "summit-core"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dirs",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "3.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_write",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_write"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["crates/summit-core", "crates/summit-cli"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
repository = "https://git.molberg.cloud/alex/summit"
|
||||
authors = ["Alex <[email protected]>"]
|
||||
|
||||
[workspace.dependencies]
|
||||
anyhow = "1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
toml = "0.8"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
dirs = "5"
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Alex
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,48 @@
|
||||
<h1 align="center">Summit</h1>
|
||||
|
||||
<p align="center">
|
||||
<b>Every game. Every launcher. One place. On Linux.</b><br>
|
||||
Scan your drives, launch anything, pin each game to the right monitor, and add AI upscaling and frame generation to all of it.
|
||||
</p>
|
||||
|
||||
> [!NOTE]
|
||||
> **Pre-alpha.** What works today is the command-line core: library scanning with detection reasons, Steam playtime, and per-game display profiles. The launcher GUI, Steam shortcut export, in-game overlay and upscaling/frame-gen backends are planned and are **not built yet**. Nothing below is marked as working unless it is.
|
||||
|
||||
## Why
|
||||
|
||||
*"Bro, just install Summit and it works."* Linux gaming is good now, but it is spread across Steam, Heroic, Lutris, Bottles and a dozen scripts. Summit puts them in one library and gives every title the same tools.
|
||||
|
||||
## Status
|
||||
|
||||
| Feature | State |
|
||||
|---|---|
|
||||
| Scan Steam libraries (all library folders, installed or not) | Working |
|
||||
| Steam playtime, "most played" | Working |
|
||||
| Heroic (Epic, GOG) and Lutris detection | Working, only checked against sample files |
|
||||
| Heuristic game detection with a reason for every hit | Working |
|
||||
| Per-game profile: monitor, resolution, refresh, fullscreen, focus, upscaler, frame-gen | Profile storage works. **Applying it at launch is not built yet.** |
|
||||
| Launcher GUI: Home / Library / Unfiltered | Planned |
|
||||
| One-click "Add to Steam" with SteamGridDB artwork | Planned |
|
||||
| "My PS5" and "Capture Card" entries (Remote Play, capture cards, Moonlight, Sunshine) | Planned. Reuses the SmoovPlay pipeline. |
|
||||
| AI upscaling and frame generation (RIFE, FSR, RTX VSR, lsfg-vk) | Planned |
|
||||
| DLSS | Planned. Depends on what each game and driver really supports. |
|
||||
| `.deb`, AUR, AppImage, Flatpak and a one-line installer | Planned |
|
||||
|
||||
## Try the CLI
|
||||
|
||||
```sh
|
||||
cargo build --release
|
||||
./target/release/summit scan --why -p ~/Games # everything found, with reasons
|
||||
./target/release/summit home # most played
|
||||
./target/release/summit profile set my-game --monitor HDMI-A-1 --width 3840 --height 2160 --refresh 60 --fullscreen true --focus true
|
||||
```
|
||||
|
||||
## The three views
|
||||
|
||||
- **Home**: your most played games, from Steam's own playtime data.
|
||||
- **Library**: everything, installed or not, with install and add buttons.
|
||||
- **Unfiltered**: a compact list grouped by source, with the reason each entry was detected.
|
||||
|
||||
## License
|
||||
|
||||
MIT. See [LICENSE](LICENSE).
|
||||
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "summit"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
description = "Summit: one launcher for every game and app on Linux, with AI upscaling and frame generation"
|
||||
|
||||
[dependencies]
|
||||
summit-core = { path = "../summit-core" }
|
||||
anyhow.workspace = true
|
||||
toml.workspace = true
|
||||
serde_json.workspace = true
|
||||
clap.workspace = true
|
||||
@@ -0,0 +1,81 @@
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use summit_core::{model::Entry, profile, scan};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "summit", version, about = "One launcher for every game and app on Linux")]
|
||||
struct Cli { #[command(subcommand)] cmd: Cmd }
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Cmd {
|
||||
/// Scan Steam, Heroic, Lutris and (optionally) folders for games
|
||||
Scan {
|
||||
/// Extra folders to scan heuristically
|
||||
#[arg(short, long)] path: Vec<std::path::PathBuf>,
|
||||
#[arg(long, default_value_t = 4)] depth: usize,
|
||||
#[arg(long)] json: bool,
|
||||
/// Show the detection reasons (the Unfiltered view)
|
||||
#[arg(long)] why: bool,
|
||||
},
|
||||
/// Top played games from Steam playtime (the Home view)
|
||||
Home { #[arg(short, default_value_t = 10)] n: usize },
|
||||
/// Per-game profile
|
||||
Profile { #[command(subcommand)] cmd: ProfileCmd },
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum ProfileCmd {
|
||||
Show { id: String },
|
||||
Set {
|
||||
id: String,
|
||||
#[arg(long)] monitor: Option<String>,
|
||||
#[arg(long)] width: Option<u32>,
|
||||
#[arg(long)] height: Option<u32>,
|
||||
#[arg(long)] refresh: Option<f32>,
|
||||
#[arg(long)] fullscreen: Option<bool>,
|
||||
#[arg(long)] focus: Option<bool>,
|
||||
#[arg(long)] upscaler: Option<String>,
|
||||
#[arg(long)] framegen: Option<String>,
|
||||
#[arg(long)] multiplier: Option<u8>,
|
||||
},
|
||||
}
|
||||
|
||||
fn hours(m: u64) -> String { format!("{:.1} h", m as f64 / 60.0) }
|
||||
|
||||
fn main() -> Result<()> {
|
||||
match Cli::parse().cmd {
|
||||
Cmd::Scan { path, depth, json, why } => {
|
||||
let mut all: Vec<Entry> = scan::full(&path, depth);
|
||||
all.sort_by(|a, b| a.title.to_lowercase().cmp(&b.title.to_lowercase()));
|
||||
if json { println!("{}", serde_json::to_string_pretty(&all)?); return Ok(()); }
|
||||
for e in &all {
|
||||
println!("[{:?}/{:?}] {}{}", e.source, e.kind, e.title, if e.installed { "" } else { " (not installed)" });
|
||||
if why { for r in &e.reasons { println!(" - {r}"); } }
|
||||
}
|
||||
println!("{} entries", all.len());
|
||||
}
|
||||
Cmd::Home { n } => {
|
||||
let mut all = scan::full(&[], 1);
|
||||
all.retain(|e| e.installed && e.kind == summit_core::model::Kind::Game);
|
||||
all.sort_by(|a, b| b.playtime_minutes.cmp(&a.playtime_minutes));
|
||||
for e in all.iter().take(n) { println!("{:>9} {}", hours(e.playtime_minutes), e.title); }
|
||||
}
|
||||
Cmd::Profile { cmd: ProfileCmd::Show { id } } => {
|
||||
print!("{}", toml::to_string_pretty(&profile::load(&id)?)?);
|
||||
}
|
||||
Cmd::Profile { cmd: ProfileCmd::Set { id, monitor, width, height, refresh, fullscreen, focus, upscaler, framegen, multiplier } } => {
|
||||
let mut p = profile::load(&id)?;
|
||||
if monitor.is_some() { p.monitor = monitor; }
|
||||
if width.is_some() { p.width = width; }
|
||||
if height.is_some() { p.height = height; }
|
||||
if refresh.is_some() { p.refresh_hz = refresh; }
|
||||
if let Some(v) = fullscreen { p.fullscreen = v; }
|
||||
if let Some(v) = focus { p.focus = v; }
|
||||
if let Some(v) = upscaler { p.upscaler = v; }
|
||||
if let Some(v) = framegen { p.framegen = v; }
|
||||
if let Some(v) = multiplier { p.framegen_multiplier = v; }
|
||||
println!("saved {}", profile::save(&id, &p)?.display());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "summit-core"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
toml.workspace = true
|
||||
dirs.workspace = true
|
||||
@@ -0,0 +1,61 @@
|
||||
//! Heroic (Epic/GOG/Amazon) and Lutris discovery.
|
||||
use crate::model::{Entry, Kind, Source};
|
||||
use serde_json::Value;
|
||||
|
||||
pub fn heroic() -> Vec<Entry> {
|
||||
let mut out = Vec::new();
|
||||
let Some(cfg) = dirs::config_dir() else { return out };
|
||||
let files = [
|
||||
("Epic", cfg.join("heroic/legendaryConfig/legendary/installed.json")),
|
||||
("GOG", cfg.join("heroic/gog_store/installed.json")),
|
||||
];
|
||||
for (store, f) in files {
|
||||
let Ok(txt) = std::fs::read_to_string(&f) else { continue };
|
||||
let Ok(v) = serde_json::from_str::<Value>(&txt) else { continue };
|
||||
// legendary: { appName: {title, install_path} }; gog: { installed: [ {appName, install_path} ] }
|
||||
let mut items: Vec<(String, String, String)> = Vec::new();
|
||||
if let Some(o) = v.as_object() {
|
||||
if let Some(arr) = o.get("installed").and_then(|a| a.as_array()) {
|
||||
for a in arr {
|
||||
let n = a["appName"].as_str().unwrap_or("").to_string();
|
||||
items.push((n.clone(), n, a["install_path"].as_str().unwrap_or("").into()));
|
||||
}
|
||||
} else {
|
||||
for (k, a) in o {
|
||||
items.push((k.clone(), a["title"].as_str().unwrap_or(k).into(), a["install_path"].as_str().unwrap_or("").into()));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (id, title, path) in items {
|
||||
out.push(Entry {
|
||||
id: format!("heroic:{store}:{id}").to_lowercase(), title, source: Source::Heroic, kind: Kind::Game,
|
||||
installed: true, path: if path.is_empty() { None } else { Some(path) },
|
||||
steam_app_id: None, playtime_minutes: 0, last_played: None,
|
||||
reasons: vec![format!("listed as installed in Heroic {store} store ({})", f.display())],
|
||||
});
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Lutris keeps one YAML per game; we only need name/slug/runner so a line scan avoids a YAML dependency.
|
||||
pub fn lutris() -> Vec<Entry> {
|
||||
let mut out = Vec::new();
|
||||
let Some(data) = dirs::data_dir() else { return out };
|
||||
let dir = data.join("lutris/games");
|
||||
let Ok(rd) = std::fs::read_dir(&dir) else { return out };
|
||||
for f in rd.flatten() {
|
||||
let p = f.path();
|
||||
if p.extension().and_then(|e| e.to_str()) != Some("yml") { continue; }
|
||||
let Ok(txt) = std::fs::read_to_string(&p) else { continue };
|
||||
let get = |k: &str| txt.lines().find_map(|l| l.strip_prefix(&format!("{k}: "))).map(|s| s.trim().trim_matches('\'').trim_matches('"').to_string());
|
||||
let (Some(slug), Some(runner)) = (get("game_slug"), get("runner")) else { continue };
|
||||
let exe = get("exe");
|
||||
out.push(Entry {
|
||||
id: format!("lutris:{slug}"), title: slug.replace('-', " "), source: Source::Lutris, kind: Kind::Game,
|
||||
installed: true, path: exe, steam_app_id: None, playtime_minutes: 0, last_played: None,
|
||||
reasons: vec![format!("Lutris game config {} (runner: {runner})", p.display())],
|
||||
});
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//! Summit core: library scanning, per-game profiles, and the detection-reason model.
|
||||
pub mod epic;
|
||||
pub mod model;
|
||||
pub mod profile;
|
||||
pub mod scan;
|
||||
pub mod steam;
|
||||
pub mod vdf;
|
||||
@@ -0,0 +1,24 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Hash)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Source { Steam, Heroic, Lutris, Heuristic }
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Kind { Game, Software, Tool }
|
||||
|
||||
/// One thing Summit found. `reasons` is the "why was this added" list shown in the Unfiltered tab.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Entry {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
pub source: Source,
|
||||
pub kind: Kind,
|
||||
pub installed: bool,
|
||||
pub path: Option<String>,
|
||||
pub steam_app_id: Option<u32>,
|
||||
pub playtime_minutes: u64,
|
||||
pub last_played: Option<u64>,
|
||||
pub reasons: Vec<String>,
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//! Per-game profiles: which monitor, what mode, which upscaler/framegen. Stored as TOML, one file per game.
|
||||
use anyhow::{Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Profile {
|
||||
/// Output name as the compositor reports it, e.g. "DP-3" or "HDMI-A-1" (the projector).
|
||||
pub monitor: Option<String>,
|
||||
pub width: Option<u32>,
|
||||
pub height: Option<u32>,
|
||||
pub refresh_hz: Option<f32>,
|
||||
pub fullscreen: bool,
|
||||
/// Raise and focus the game window after launch.
|
||||
pub focus: bool,
|
||||
/// "none" | "fsr" | "nis" | "rtx-vsr" | "dlss"
|
||||
pub upscaler: String,
|
||||
/// "none" | "rife" | "lsfg"
|
||||
pub framegen: String,
|
||||
/// 1 = off, 2..4 = multiplier
|
||||
pub framegen_multiplier: u8,
|
||||
pub launch_args: Vec<String>,
|
||||
}
|
||||
|
||||
pub fn dir() -> Result<PathBuf> {
|
||||
Ok(dirs::config_dir().context("no config dir")?.join("summit/profiles"))
|
||||
}
|
||||
|
||||
fn file(id: &str) -> Result<PathBuf> {
|
||||
let safe: String = id.chars().map(|c| if c.is_ascii_alphanumeric() || c == '-' || c == '_' { c } else { '_' }).collect();
|
||||
Ok(dir()?.join(format!("{safe}.toml")))
|
||||
}
|
||||
|
||||
pub fn load(id: &str) -> Result<Profile> {
|
||||
let f = file(id)?;
|
||||
if !f.exists() { return Ok(Profile::default()); }
|
||||
Ok(toml::from_str(&std::fs::read_to_string(&f)?)?)
|
||||
}
|
||||
|
||||
pub fn save(id: &str, p: &Profile) -> Result<PathBuf> {
|
||||
let f = file(id)?;
|
||||
std::fs::create_dir_all(f.parent().unwrap())?;
|
||||
std::fs::write(&f, toml::to_string_pretty(p)?)?;
|
||||
Ok(f)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn roundtrip_toml() {
|
||||
let p = Profile { monitor: Some("HDMI-A-1".into()), width: Some(3840), height: Some(2160), refresh_hz: Some(60.0), fullscreen: true, focus: true, upscaler: "fsr".into(), framegen: "rife".into(), framegen_multiplier: 2, launch_args: vec![] };
|
||||
let s = toml::to_string_pretty(&p).unwrap();
|
||||
assert_eq!(toml::from_str::<Profile>(&s).unwrap(), p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
//! Full scan: known launchers first, then signature heuristics over arbitrary folders.
|
||||
use crate::model::{Entry, Kind, Source};
|
||||
use std::path::Path;
|
||||
|
||||
/// (marker file/dir name, what it tells us). Matched case-insensitively against directory entries.
|
||||
const SIGNATURES: &[(&str, &str)] = &[
|
||||
("UnityPlayer.dll", "Unity engine (UnityPlayer.dll)"),
|
||||
("UnityPlayer.so", "Unity engine (UnityPlayer.so)"),
|
||||
("GameAssembly.dll", "Unity IL2CPP (GameAssembly.dll)"),
|
||||
("steam_api64.dll", "Steamworks API (steam_api64.dll)"),
|
||||
("steam_api.dll", "Steamworks API (steam_api.dll)"),
|
||||
("libsteam_api.so", "Steamworks API (libsteam_api.so)"),
|
||||
("data.pck", "Godot engine package"),
|
||||
("EasyAntiCheat", "EasyAntiCheat folder"),
|
||||
("BattlEye", "BattlEye folder"),
|
||||
("d3d11.dll", "ships its own D3D11 runtime"),
|
||||
("Engine", "Unreal-style Engine/ folder"),
|
||||
("UE4PrereqSetup_x64.exe", "Unreal Engine 4 prerequisites"),
|
||||
("UnrealEditor", "Unreal Engine"),
|
||||
("goggame-*.info", "GOG game info file"),
|
||||
];
|
||||
|
||||
fn is_exe(name: &str) -> bool {
|
||||
let n = name.to_ascii_lowercase();
|
||||
n.ends_with(".exe") || n.ends_with(".x86_64") || n.ends_with(".sh") || n.ends_with(".appimage")
|
||||
}
|
||||
|
||||
fn matches(sig: &str, name: &str) -> bool {
|
||||
if let Some(pre) = sig.strip_suffix('*') { return name.to_ascii_lowercase().starts_with(&pre.to_ascii_lowercase()); }
|
||||
if let Some((a, b)) = sig.split_once('*') {
|
||||
let n = name.to_ascii_lowercase();
|
||||
return n.starts_with(&a.to_ascii_lowercase()) && n.ends_with(&b.to_ascii_lowercase());
|
||||
}
|
||||
sig.eq_ignore_ascii_case(name)
|
||||
}
|
||||
|
||||
/// Inspect one directory (non-recursive). Returns an entry if enough signals say "this is a game".
|
||||
pub fn inspect_dir(dir: &Path) -> Option<Entry> {
|
||||
let names: Vec<String> = std::fs::read_dir(dir).ok()?.flatten().map(|e| e.file_name().to_string_lossy().into_owned()).collect();
|
||||
let mut reasons: Vec<String> = Vec::new();
|
||||
for (sig, why) in SIGNATURES {
|
||||
if names.iter().any(|n| matches(sig, n)) { reasons.push((*why).to_string()); }
|
||||
}
|
||||
let has_exe = names.iter().any(|n| is_exe(n));
|
||||
let has_paks = names.iter().any(|n| n.to_ascii_lowercase().ends_with(".pak"));
|
||||
if has_paks { reasons.push("contains .pak asset archives".into()); }
|
||||
// Need an executable plus at least one engine/store signal. A lone exe is software, not a game.
|
||||
let game_signals = reasons.len();
|
||||
if has_exe && game_signals >= 1 {
|
||||
reasons.insert(0, "executable present".into());
|
||||
let title = dir.file_name()?.to_string_lossy().replace(['_', '-'], " ");
|
||||
return Some(Entry {
|
||||
id: format!("scan:{}", dir.display()), title, source: Source::Heuristic, kind: Kind::Game,
|
||||
installed: true, path: Some(dir.to_string_lossy().into_owned()), steam_app_id: None,
|
||||
playtime_minutes: 0, last_played: None, reasons,
|
||||
});
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Walk `root` up to `depth`, never descending into a directory already identified as a game.
|
||||
pub fn walk(root: &Path, depth: usize, out: &mut Vec<Entry>) {
|
||||
if depth == 0 { return; }
|
||||
let Ok(rd) = std::fs::read_dir(root) else { return };
|
||||
for e in rd.flatten() {
|
||||
let Ok(ft) = e.file_type() else { continue };
|
||||
if !ft.is_dir() || ft.is_symlink() { continue; }
|
||||
let p = e.path();
|
||||
if let Some(entry) = inspect_dir(&p) { out.push(entry); continue; }
|
||||
walk(&p, depth - 1, out);
|
||||
}
|
||||
}
|
||||
|
||||
/// Everything: Steam, Heroic, Lutris, plus heuristic walk of `extra` folders (deduped against known paths).
|
||||
pub fn full(extra: &[std::path::PathBuf], depth: usize) -> Vec<Entry> {
|
||||
let mut all = crate::steam::scan();
|
||||
all.extend(crate::epic::heroic());
|
||||
all.extend(crate::epic::lutris());
|
||||
let known: Vec<String> = all.iter().filter_map(|e| e.path.clone()).collect();
|
||||
let mut found = Vec::new();
|
||||
for r in extra { walk(r, depth, &mut found); }
|
||||
for f in found {
|
||||
if !known.iter().any(|k| f.path.as_deref().map_or(false, |p| p.starts_with(k.as_str()) || k.starts_with(p))) {
|
||||
all.push(f);
|
||||
}
|
||||
}
|
||||
all
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs;
|
||||
fn tmp(name: &str) -> std::path::PathBuf {
|
||||
let d = std::env::temp_dir().join(format!("summit-test-{name}-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&d); fs::create_dir_all(&d).unwrap(); d
|
||||
}
|
||||
#[test]
|
||||
fn unity_game_detected_with_reasons() {
|
||||
let d = tmp("unity"); let g = d.join("Cool_Game"); fs::create_dir_all(&g).unwrap();
|
||||
fs::write(g.join("CoolGame.exe"), b"MZ").unwrap(); fs::write(g.join("UnityPlayer.dll"), b"").unwrap();
|
||||
let mut out = vec![]; walk(&d, 3, &mut out);
|
||||
assert_eq!(out.len(), 1); assert_eq!(out[0].title, "Cool Game");
|
||||
assert!(out[0].reasons.iter().any(|r| r.contains("Unity")));
|
||||
}
|
||||
#[test]
|
||||
fn lone_exe_is_not_a_game() {
|
||||
let d = tmp("lone"); let g = d.join("Tool"); fs::create_dir_all(&g).unwrap();
|
||||
fs::write(g.join("setup.exe"), b"MZ").unwrap();
|
||||
let mut out = vec![]; walk(&d, 3, &mut out); assert!(out.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//! Steam library discovery: library folders, installed apps, playtime.
|
||||
use crate::model::{Entry, Kind, Source};
|
||||
use crate::vdf;
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn steam_roots() -> Vec<PathBuf> {
|
||||
let Some(home) = dirs::home_dir() else { return vec![] };
|
||||
let cands = [
|
||||
home.join(".steam/steam"),
|
||||
home.join(".local/share/Steam"),
|
||||
home.join(".var/app/com.valvesoftware.Steam/.local/share/Steam"),
|
||||
home.join("snap/steam/common/.local/share/Steam"),
|
||||
];
|
||||
let mut seen: Vec<PathBuf> = Vec::new();
|
||||
for c in cands {
|
||||
if let Ok(real) = c.canonicalize() {
|
||||
if real.join("steamapps").is_dir() && !seen.contains(&real) { seen.push(real); }
|
||||
}
|
||||
}
|
||||
seen
|
||||
}
|
||||
|
||||
/// All library folders (each contains steamapps/).
|
||||
pub fn library_folders(root: &Path) -> Vec<PathBuf> {
|
||||
let mut out = vec![root.to_path_buf()];
|
||||
if let Ok(txt) = std::fs::read_to_string(root.join("steamapps/libraryfolders.vdf")) {
|
||||
if let Ok(v) = vdf::parse(&txt) {
|
||||
if let Some(lf) = v.get("libraryfolders") {
|
||||
for (_, f) in lf.children() {
|
||||
if let Some(p) = f.get("path").and_then(|p| p.str()) {
|
||||
let p = PathBuf::from(p);
|
||||
if p.join("steamapps").is_dir() && !out.contains(&p) { out.push(p); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// appid -> (playtime minutes, last played unix) from every Steam user's localconfig.vdf.
|
||||
pub fn playtime(root: &Path) -> HashMap<u32, (u64, u64)> {
|
||||
let mut map: HashMap<u32, (u64, u64)> = HashMap::new();
|
||||
let Ok(rd) = std::fs::read_dir(root.join("userdata")) else { return map };
|
||||
for u in rd.flatten() {
|
||||
let Ok(txt) = std::fs::read_to_string(u.path().join("config/localconfig.vdf")) else { continue };
|
||||
let Ok(v) = vdf::parse(&txt) else { continue };
|
||||
let apps = v.path(&["UserLocalConfigStore", "Software", "Valve", "Steam", "apps"]);
|
||||
for (id, a) in apps.map(|a| a.children()).unwrap_or(&[]) {
|
||||
let Ok(id) = id.parse::<u32>() else { continue };
|
||||
let pt = a.get("Playtime").and_then(|p| p.str()).and_then(|s| s.parse().ok()).unwrap_or(0u64);
|
||||
let lp = a.get("LastPlayed").and_then(|p| p.str()).and_then(|s| s.parse().ok()).unwrap_or(0u64);
|
||||
let e = map.entry(id).or_insert((0, 0));
|
||||
e.0 = e.0.max(pt); e.1 = e.1.max(lp);
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
fn is_tool(name: &str) -> bool {
|
||||
let n = name.to_ascii_lowercase();
|
||||
n.starts_with("proton") || n.starts_with("steam linux runtime") || n.starts_with("steamworks common")
|
||||
|| n.contains("redistributable") || n == "steamvr"
|
||||
}
|
||||
|
||||
pub fn scan() -> Vec<Entry> {
|
||||
let mut out = Vec::new();
|
||||
for root in steam_roots() {
|
||||
let pt = playtime(&root);
|
||||
for lib in library_folders(&root) {
|
||||
let apps = lib.join("steamapps");
|
||||
let Ok(rd) = std::fs::read_dir(&apps) else { continue };
|
||||
for f in rd.flatten() {
|
||||
let name = f.file_name().to_string_lossy().into_owned();
|
||||
if !(name.starts_with("appmanifest_") && name.ends_with(".acf")) { continue; }
|
||||
let Ok(txt) = std::fs::read_to_string(f.path()) else { continue };
|
||||
let Ok(v) = vdf::parse(&txt) else { continue };
|
||||
let Some(st) = v.get("AppState") else { continue };
|
||||
let Some(id) = st.get("appid").and_then(|x| x.str()).and_then(|s| s.parse::<u32>().ok()) else { continue };
|
||||
let title = st.get("name").and_then(|x| x.str()).unwrap_or("?").to_string();
|
||||
let dir = st.get("installdir").and_then(|x| x.str()).unwrap_or("");
|
||||
let flags: u32 = st.get("StateFlags").and_then(|x| x.str()).and_then(|s| s.parse().ok()).unwrap_or(0);
|
||||
let (minutes, last) = pt.get(&id).copied().unwrap_or((0, 0));
|
||||
let tool = is_tool(&title);
|
||||
let mut reasons = vec![
|
||||
format!("appmanifest_{id}.acf in {}", apps.display()),
|
||||
format!("Steam library folder {}", lib.display()),
|
||||
];
|
||||
if flags & 4 == 0 { reasons.push(format!("StateFlags={flags}: not fully installed")); }
|
||||
if tool { reasons.push("name matches Proton/runtime tool pattern".into()); }
|
||||
out.push(Entry {
|
||||
id: format!("steam:{id}"),
|
||||
title,
|
||||
source: Source::Steam,
|
||||
kind: if tool { Kind::Tool } else { Kind::Game },
|
||||
installed: flags & 4 != 0,
|
||||
path: Some(apps.join("common").join(dir).to_string_lossy().into_owned()),
|
||||
steam_app_id: Some(id),
|
||||
playtime_minutes: minutes,
|
||||
last_played: if last > 0 { Some(last) } else { None },
|
||||
reasons,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//! Minimal parser for Valve's text KeyValues format (libraryfolders.vdf, appmanifest_*.acf, localconfig.vdf).
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Value {
|
||||
Str(String),
|
||||
Obj(Vec<(String, Value)>),
|
||||
}
|
||||
|
||||
impl Value {
|
||||
/// Case-insensitive child lookup (Steam writes both `Software` and `software`).
|
||||
pub fn get(&self, key: &str) -> Option<&Value> {
|
||||
match self {
|
||||
Value::Obj(kv) => kv.iter().find(|(k, _)| k.eq_ignore_ascii_case(key)).map(|(_, v)| v),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
pub fn str(&self) -> Option<&str> {
|
||||
match self { Value::Str(s) => Some(s), _ => None }
|
||||
}
|
||||
pub fn children(&self) -> &[(String, Value)] {
|
||||
match self { Value::Obj(kv) => kv, _ => &[] }
|
||||
}
|
||||
/// Walk a path of keys.
|
||||
pub fn path(&self, keys: &[&str]) -> Option<&Value> {
|
||||
keys.iter().try_fold(self, |v, k| v.get(k))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum Tok { Str(String), Open, Close }
|
||||
|
||||
fn lex(src: &str) -> Result<Vec<Tok>, String> {
|
||||
let mut out = Vec::new();
|
||||
let mut it = src.chars().peekable();
|
||||
while let Some(&c) = it.peek() {
|
||||
match c {
|
||||
c if c.is_whitespace() || c == '\u{feff}' => { it.next(); }
|
||||
'{' => { out.push(Tok::Open); it.next(); }
|
||||
'}' => { out.push(Tok::Close); it.next(); }
|
||||
'/' => {
|
||||
it.next();
|
||||
if it.peek() == Some(&'/') { while let Some(&c) = it.peek() { if c == '\n' { break; } it.next(); } }
|
||||
else { return Err("stray '/'".into()); }
|
||||
}
|
||||
'"' => {
|
||||
it.next();
|
||||
let mut s = String::new();
|
||||
loop {
|
||||
match it.next() {
|
||||
None => return Err("unterminated string".into()),
|
||||
Some('"') => break,
|
||||
Some('\\') => match it.next() {
|
||||
Some('n') => s.push('\n'),
|
||||
Some('t') => s.push('\t'),
|
||||
Some(o) => s.push(o),
|
||||
None => return Err("bad escape".into()),
|
||||
},
|
||||
Some(o) => s.push(o),
|
||||
}
|
||||
}
|
||||
out.push(Tok::Str(s));
|
||||
}
|
||||
_ => {
|
||||
let mut s = String::new();
|
||||
while let Some(&c) = it.peek() {
|
||||
if c.is_whitespace() || c == '{' || c == '}' || c == '"' { break; }
|
||||
s.push(c); it.next();
|
||||
}
|
||||
out.push(Tok::Str(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn parse_obj(toks: &[Tok], i: &mut usize, top: bool) -> Result<Value, String> {
|
||||
let mut kv = Vec::new();
|
||||
loop {
|
||||
match toks.get(*i) {
|
||||
None if top => return Ok(Value::Obj(kv)),
|
||||
None => return Err("unexpected end, missing '}'".into()),
|
||||
Some(Tok::Close) if !top => { *i += 1; return Ok(Value::Obj(kv)); }
|
||||
Some(Tok::Close) => return Err("unexpected '}'".into()),
|
||||
Some(Tok::Open) => return Err("unexpected '{'".into()),
|
||||
Some(Tok::Str(k)) => {
|
||||
*i += 1;
|
||||
match toks.get(*i) {
|
||||
Some(Tok::Str(v)) => { kv.push((k.clone(), Value::Str(v.clone()))); *i += 1; }
|
||||
Some(Tok::Open) => { *i += 1; let o = parse_obj(toks, i, false)?; kv.push((k.clone(), o)); }
|
||||
_ => return Err(format!("key '{k}' has no value")),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse(src: &str) -> Result<Value, String> {
|
||||
let toks = lex(src)?;
|
||||
let mut i = 0;
|
||||
parse_obj(&toks, &mut i, true)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn parses_nested_and_comments() {
|
||||
let v = parse("\"AppState\"\n{\n // c\n \"appid\" \"620\"\n \"UserConfig\" { \"language\" \"english\" }\n}").unwrap();
|
||||
assert_eq!(v.path(&["appstate", "appid"]).unwrap().str(), Some("620"));
|
||||
assert_eq!(v.path(&["AppState", "UserConfig", "language"]).unwrap().str(), Some("english"));
|
||||
}
|
||||
#[test]
|
||||
fn rejects_unbalanced() { assert!(parse("\"a\" {").is_err()); }
|
||||
}
|
||||
Reference in new issue
Block a user