From 22e297b9b6bd857022009c8852c648859ca75b09 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 22 Mar 2023 14:15:16 +0100 Subject: [PATCH 1/4] Implement scanning compatibilitytools.d --- src/data/compat/Proton.vala | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/data/compat/Proton.vala b/src/data/compat/Proton.vala index ab9d0c7c..8654b9c6 100644 --- a/src/data/compat/Proton.vala +++ b/src/data/compat/Proton.vala @@ -88,7 +88,14 @@ namespace GameHub.Data.Compat else { File? proton_dir = null; - if(Steam.find_app_install_dir(appid, out proton_dir)) + if(appid.has_prefix("custom")) { + proton_dir = File.new_for_path(Environment.get_home_dir ()).get_child (".steam").get_child ("steam").get_child ("compatibilitytools.d").get_child (appname); + name = appname; + executable = proton_dir.get_child("proton"); + installed = executable.query_exists(); + wine_binary = proton_dir.get_child("dist").query_exists() ? proton_dir.get_child("dist/bin/wine") : proton_dir.get_child("files/bin/wine"); + } + else if(Steam.find_app_install_dir(appid, out proton_dir)) { if(proton_dir != null) { @@ -358,6 +365,20 @@ namespace GameHub.Data.Compat } } + //Scan for custom Proton + var compattools_dir = File.new_for_path(Environment.get_home_dir ()).get_child (".steam").get_child ("steam").get_child ("compatibilitytools.d"); + if (compattools_dir.query_file_type (0) == FileType.DIRECTORY) { + stdout.printf("%s\n", "found compatibilitytools.d directory"); + var enumerator = compattools_dir.enumerate_children (FileAttribute.STANDARD_NAME, 0); + FileInfo file_info; + while ((file_info = enumerator.next_file ()) != null) { + var name = file_info.get_name (); + if (name.down().contains("proton")) { + versions.add(new Proton("custom", name)); + } + } + } + if(versions.size > 0) { versions.sort((first, second) => { From cba250102908ea4d2842112058fea1dedb830ae6 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 22 Mar 2023 14:26:55 +0100 Subject: [PATCH 2/4] fix proton detection --- src/data/compat/Proton.vala | 1 - src/utils/BinaryVDF.vala | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/data/compat/Proton.vala b/src/data/compat/Proton.vala index 8654b9c6..36049994 100644 --- a/src/data/compat/Proton.vala +++ b/src/data/compat/Proton.vala @@ -368,7 +368,6 @@ namespace GameHub.Data.Compat //Scan for custom Proton var compattools_dir = File.new_for_path(Environment.get_home_dir ()).get_child (".steam").get_child ("steam").get_child ("compatibilitytools.d"); if (compattools_dir.query_file_type (0) == FileType.DIRECTORY) { - stdout.printf("%s\n", "found compatibilitytools.d directory"); var enumerator = compattools_dir.enumerate_children (FileAttribute.STANDARD_NAME, 0); FileInfo file_info; while ((file_info = enumerator.next_file ()) != null) { diff --git a/src/utils/BinaryVDF.vala b/src/utils/BinaryVDF.vala index 4bc885e3..0f20beb0 100644 --- a/src/utils/BinaryVDF.vala +++ b/src/utils/BinaryVDF.vala @@ -301,7 +301,7 @@ namespace GameHub.Utils var appid = stream.read_uint32(); if(appid == 0) break; - stream.seek(44, SeekType.CUR); + stream.seek(64, SeekType.CUR); var app = BinaryVDF.Node.read(stream, appid.to_string()); if(app != null) From ffbf109dcc408ebfcd39ec26000f394fb59b3c27 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 22 Mar 2023 14:42:32 +0100 Subject: [PATCH 3/4] Properly get steam home --- src/data/compat/Proton.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/compat/Proton.vala b/src/data/compat/Proton.vala index 36049994..9a221d65 100644 --- a/src/data/compat/Proton.vala +++ b/src/data/compat/Proton.vala @@ -366,7 +366,7 @@ namespace GameHub.Data.Compat } //Scan for custom Proton - var compattools_dir = File.new_for_path(Environment.get_home_dir ()).get_child (".steam").get_child ("steam").get_child ("compatibilitytools.d"); + var compattools_dir = FSUtils.file(FSUtils.Paths.Steam.Home).get_child ("steam").get_child ("compatibilitytools.d"); if (compattools_dir.query_file_type (0) == FileType.DIRECTORY) { var enumerator = compattools_dir.enumerate_children (FileAttribute.STANDARD_NAME, 0); FileInfo file_info; From d576bd13fbf52f47b16e6edc2307ac0131f76b0a Mon Sep 17 00:00:00 2001 From: Jakob Date: Thu, 13 Apr 2023 13:17:13 +0200 Subject: [PATCH 4/4] add check suggested by @ergoithz --- src/data/compat/Proton.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/compat/Proton.vala b/src/data/compat/Proton.vala index 9a221d65..1a2d2ff7 100644 --- a/src/data/compat/Proton.vala +++ b/src/data/compat/Proton.vala @@ -102,7 +102,7 @@ namespace GameHub.Data.Compat name = appname ?? proton_dir.get_basename(); executable = proton_dir.get_child("proton"); installed = executable.query_exists(); - wine_binary = proton_dir.get_child("dist/bin/wine"); + wine_binary = proton_dir.get_child("dist").query_exists() ? proton_dir.get_child("dist/bin/wine") : proton_dir.get_child("files/bin/wine"); } } else