From a727af7fac602e3497f221c5b5b26f3b908ff7b7 Mon Sep 17 00:00:00 2001 From: HeroponRikiBestest Date: Fri, 26 Jun 2026 08:39:42 -0700 Subject: [PATCH 1/2] Update GCF output string for encrypted GCFs --- BinaryObjectScanner/FileType/GCF.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/BinaryObjectScanner/FileType/GCF.cs b/BinaryObjectScanner/FileType/GCF.cs index a48b8750..bddf0cde 100644 --- a/BinaryObjectScanner/FileType/GCF.cs +++ b/BinaryObjectScanner/FileType/GCF.cs @@ -16,19 +16,19 @@ public GCF(SabreTools.Wrappers.GCF wrapper) : base(wrapper) { } // Filename is worth reporting, since it's descriptive and has to match the Steam2 CDN in order to work. string fileName = Path.GetFileName(file); uint depotId = _wrapper.Model.Header.CacheID; - uint manifestVersion = _wrapper.Model.Header.LastVersionPlayed; + uint depotVersion = _wrapper.Model.Header.LastVersionPlayed; - // At the moment, all samples of GCF files on redump are unencrypted. Combined with being uncertain about - // whether this is the best way to check whether the GCF is encrypted, this block will be left commented - // out until further research is done. - // bool encrypted = false; - // if (_wrapper.Files != null && _wrapper.Files.Length > 0) - // encrypted = _wrapper.Files[0].Encrypted; + // While there is a depot-level encrypted flag on the GCF, it's unfortunately completely unreliable. + // Technically speaking, there are some known GCFs that only have some files encrypted. HL2 discs from + // 2004 have a base_source_engine.gcf (depot 200) like this. However, currently unsure of the performance + // impacts of looping the entirety of _wrapper.Files[] just to cover a fairly niche edge case + bool encrypted = false; + if (_wrapper.Files != null && _wrapper.Files.Length > 0) + encrypted = _wrapper.Files[0].Encrypted; - // string encryptedString = encrypted ? "encrypted" : "unencrypted"; - // string returnString = $"{fileName} - {depotId} (v{manifestVersion}, {encryptedString})"; - - string returnString = $"{fileName} - {depotId} (v{manifestVersion})"; + // Only note encryption status if the GCF is encrypted + string encryptedString = encrypted ? ", encrypted" : ""; + string returnString = $"{fileName} - {depotId} (v{depotVersion}{encryptedString})"; return returnString; } } From 58c4aec13b518f3c42b6b353bfba3c2517062be3 Mon Sep 17 00:00:00 2001 From: HeroponRikiBestest Date: Fri, 26 Jun 2026 17:42:09 -0700 Subject: [PATCH 2/2] Use Array.Exists since some early GCFs have only some files encrypted --- BinaryObjectScanner/FileType/GCF.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BinaryObjectScanner/FileType/GCF.cs b/BinaryObjectScanner/FileType/GCF.cs index bddf0cde..f4d8911b 100644 --- a/BinaryObjectScanner/FileType/GCF.cs +++ b/BinaryObjectScanner/FileType/GCF.cs @@ -1,3 +1,4 @@ +using System; using System.IO; namespace BinaryObjectScanner.FileType @@ -20,11 +21,11 @@ public GCF(SabreTools.Wrappers.GCF wrapper) : base(wrapper) { } // While there is a depot-level encrypted flag on the GCF, it's unfortunately completely unreliable. // Technically speaking, there are some known GCFs that only have some files encrypted. HL2 discs from - // 2004 have a base_source_engine.gcf (depot 200) like this. However, currently unsure of the performance - // impacts of looping the entirety of _wrapper.Files[] just to cover a fairly niche edge case + // 2004 have several GCFs like this, one being base_source_engine.gcf (depot 200). Thus, it's necessary + // to iterate all file info to check if any files are encrypted bool encrypted = false; if (_wrapper.Files != null && _wrapper.Files.Length > 0) - encrypted = _wrapper.Files[0].Encrypted; + encrypted = Array.Exists(_wrapper.Files, fileInfo => fileInfo.Encrypted); // Only note encryption status if the GCF is encrypted string encryptedString = encrypted ? ", encrypted" : "";