From 820a8c1215e5a13722f9afd1d0671446d03ecfd9 Mon Sep 17 00:00:00 2001 From: Lucki Date: Wed, 15 Apr 2020 18:18:13 +0200 Subject: [PATCH 1/3] Add to the shortcut node instead of the root node --- src/data/sources/steam/Steam.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data/sources/steam/Steam.vala b/src/data/sources/steam/Steam.vala index 5c0f8972..d2158998 100644 --- a/src/data/sources/steam/Steam.vala +++ b/src/data/sources/steam/Steam.vala @@ -446,10 +446,14 @@ namespace GameHub.Data.Sources.Steam var root_node = vdf.read() as BinaryVDF.ListNode; - if(root_node == null) + if(root_node.get("shortcuts") == null) { root_node = new BinaryVDF.ListNode.node("shortcuts"); } + else + { + root_node = root_node.get("shortcuts") as BinaryVDF.ListNode; + } var game_node = new BinaryVDF.ListNode.node(root_node.nodes.size.to_string()); From a9023efcf0f353365c7cab8fe3b14a2ffee5b478 Mon Sep 17 00:00:00 2001 From: Lucki Date: Wed, 15 Apr 2020 19:01:12 +0200 Subject: [PATCH 2/3] Add all tags to the shortcut --- src/data/sources/steam/Steam.vala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/data/sources/steam/Steam.vala b/src/data/sources/steam/Steam.vala index d2158998..0433c5c9 100644 --- a/src/data/sources/steam/Steam.vala +++ b/src/data/sources/steam/Steam.vala @@ -476,6 +476,15 @@ namespace GameHub.Data.Sources.Steam var tags_node = new BinaryVDF.ListNode.node("tags"); tags_node.add_node(new BinaryVDF.StringNode.node("0", "GameHub")); + + foreach(var tag in game.tags) + { + if(tag.removable) + { + tags_node.add_node(new BinaryVDF.StringNode.node((game.tags.index_of(tag) + 1).to_string(), tag.name)); + } + } + game_node.add_node(tags_node); root_node.add_node(game_node); From 28a577f1abda1fc0638d9102d990db421d158b8c Mon Sep 17 00:00:00 2001 From: Lucki Date: Wed, 15 Apr 2020 22:10:41 +0200 Subject: [PATCH 3/3] Preset custom library image --- src/data/sources/steam/Steam.vala | 14 ++++++++++++++ src/meson.build | 1 + 2 files changed, 15 insertions(+) diff --git a/src/data/sources/steam/Steam.vala b/src/data/sources/steam/Steam.vala index 0433c5c9..5ffa8716 100644 --- a/src/data/sources/steam/Steam.vala +++ b/src/data/sources/steam/Steam.vala @@ -19,6 +19,7 @@ along with GameHub. If not, see . using Gee; using GameHub.Data.DB; using GameHub.Utils; +using ZLib.Utility; namespace GameHub.Data.Sources.Steam { @@ -474,6 +475,19 @@ namespace GameHub.Data.Sources.Steam game_node.add_node(new BinaryVDF.StringNode.node("icon", cached.get_path())); } + if(game.image_vertical != null) + { + try + { + var cached = ImageCache.local_file(game.image_vertical, @"games/$(game.source.id)/$(game.id)/images/"); + // https://github.com/boppreh/steamgrid/blob/master/games.go#L120 + uint64 id = crc32(0, (ProjectConfig.PROJECT_NAME + game.name).data) | 0x80000000; + var dest = FSUtils.file(get_userdata_dir().get_child("config").get_child("grid").get_path(), id.to_string() + "p.png"); + cached.copy(dest, NONE); + } + catch (Error e) {} + } + var tags_node = new BinaryVDF.ListNode.node("tags"); tags_node.add_node(new BinaryVDF.StringNode.node("0", "GameHub")); diff --git a/src/meson.build b/src/meson.build index 0d1f5bf8..4f276d33 100644 --- a/src/meson.build +++ b/src/meson.build @@ -29,6 +29,7 @@ deps = [ dependency('sqlite3'), dependency('libxml-2.0'), dependency('gio-unix-2.0'), + dependency('zlib'), meson.get_compiler('vala').find_library('posix'), meson.get_compiler('vala').find_library('linux') ]