steam-shortcuts: name grid art by the 32-bit appid (current Steam convention); report CLI smoke test

This commit is contained in:
alex authored and Bonzi committed 2026-11-24 07:09:19 +00:00
1 parent 19f79a561d
commit c97948db05
3 files changed
+12 -5

No files matched your search

+1 -1
View File
@@ -277,7 +277,7 @@ fn main() -> Result<()> {
});
summit_core::shortcuts::save(&shortcuts_path, &root, force)?;
let grid_id = summit_core::shortcuts::grid_app_id(appid);
let grid_id = summit_core::shortcuts::grid_file_id(appid);
let state = summit_core::state::load();
let sgdb_key = summit_core::sgdb::key();
let outcomes = summit_core::shortcuts::install_art(
+7 -2
View File
@@ -28,8 +28,12 @@ pub fn legacy_app_id(exe: &str, app_name: &str) -> u32 {
crc32(format!("{exe}{app_name}").as_bytes()) | 0x8000_0000
}
/// The 64-bit id used to name grid artwork files: the legacy id shifted into the high 32 bits,
/// with the low 32 bits set to Steam's "non-Steam game" marker (0x02000000).
/// The id that names grid artwork files (`<id>p.png`, `<id>_hero.png`, ...) in the current Steam
/// client: the shortcut's unsigned 32-bit appid.
pub fn grid_file_id(legacy: u32) -> u64 { legacy as u64 }
/// The older 64-bit "Big Picture" id (legacy id in the high 32 bits, 0x02000000 in the low).
/// Not used for artwork file names by the current client; kept for reference/tests.
pub fn grid_app_id(legacy: u32) -> u64 { ((legacy as u64) << 32) | 0x0200_0000 }
// ---- the shortcuts list itself ----
@@ -303,6 +307,7 @@ mod tests {
let grid = grid_app_id(legacy);
assert_eq!(grid >> 32, legacy as u64);
assert_eq!(grid & 0xFFFF_FFFF, 0x0200_0000);
assert_eq!(grid_file_id(legacy), legacy as u64);
}
#[test]
+4 -2
View File
@@ -6,8 +6,9 @@
(used by `shortcuts.vdf`). Unknown field types (float32, pointer, color, (u)int64, wide
string) are kept as raw bytes so an unrecognized field round-trips byte-for-byte.
- `crates/summit-core/src/shortcuts.rs`:
- `legacy_app_id`/`grid_app_id`: Steam's non-Steam-shortcut appid (CRC-32 of `exe+AppName`,
top bit set) and the 64-bit id used for grid artwork filenames.
- `legacy_app_id`/`grid_file_id`: Steam's non-Steam-shortcut appid (CRC-32 of `exe+AppName`,
top bit set); grid artwork files are named with that unsigned 32-bit id (`<id>p.png` etc.).
The older 64-bit Big Picture id (`grid_app_id`) is kept but not used for file names.
- `add_shortcut`/`remove_shortcut`/`find_by_name`/`list_names`: edit the shortcuts list by
`AppName`, preserving unknown fields on existing entries and renumbering the `"0"`, `"1"`, ...
keys after any change.
@@ -52,6 +53,7 @@
cleanly; `summit steam-add ps5` on this machine (no Steam installed) reports "no Steam userdata
found" rather than crashing or writing anywhere. No real Steam installation was touched, per
instructions — none exists on this machine, by design of the tests (fixtures only).
- Second pass: end-to-end CLI run against a throwaway `$HOME` with a fake `Steam/userdata/123/config` (no real Steam): `steam-add ps5`, `steam-add capture`, `steam-remove ps5` produced/edited `shortcuts.vdf` (+ `.bak`), `strings` showed the expected `AppName`/`LaunchOptions` (`run steam-shortcut:ps5 -- <summit> enhance ps5`), and the no-key art step printed one skip line per art kind without failing. Fixed grid file naming to use the unsigned 32-bit appid (`<appid>p.png`), which the current Steam client uses, instead of the old 64-bit Big Picture id; this naming is from my knowledge of the client, not checked against a real Steam.
- Did **not** verify: an actual SteamGridDB lookup (no key configured here, and I didn't want to
spend the user's quota on a live network call that isn't required for correctness — JSON
parsing and URL building are unit tested against fixture strings instead), or opening a real