From 23c05a6f5903eada9601f879fe3ce5b92d693b5e Mon Sep 17 00:00:00 2001 From: HeroponRikiBestest Date: Tue, 17 Mar 2026 12:20:56 -0600 Subject: [PATCH] Add BOS gcf output --- BinaryObjectScanner/FileType/GCF.cs | 34 +++++++++++++++++++++++++++++ BinaryObjectScanner/Scanner.cs | 1 + 2 files changed, 35 insertions(+) create mode 100644 BinaryObjectScanner/FileType/GCF.cs diff --git a/BinaryObjectScanner/FileType/GCF.cs b/BinaryObjectScanner/FileType/GCF.cs new file mode 100644 index 00000000..e58a9204 --- /dev/null +++ b/BinaryObjectScanner/FileType/GCF.cs @@ -0,0 +1,34 @@ +using System.IO; + +namespace BinaryObjectScanner.FileType +{ + /// + /// Game Cache File (GCF) + /// + public class GCF : DetectableBase + { + /// + public GCF(SabreTools.Serialization.Wrappers.GCF wrapper) : base(wrapper) { } + + /// + public override string? Detect(Stream stream, string file, bool includeDebug) + { + // 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; + + // 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; + + string encryptedString = encrypted ? "encrypted" : "unencrypted"; + string returnString = $"{fileName} - {depotId} (v{manifestVersion}, {encryptedString})";*/ + string returnString = $"{fileName} - {depotId} (v{manifestVersion})"; + return returnString; + } + } +} diff --git a/BinaryObjectScanner/Scanner.cs b/BinaryObjectScanner/Scanner.cs index ef8a6991..503442ca 100644 --- a/BinaryObjectScanner/Scanner.cs +++ b/BinaryObjectScanner/Scanner.cs @@ -493,6 +493,7 @@ private static List PerformPathCheck(IPathCheck impl, string? path, List { AACSMediaKeyBlock obj => new FileType.AACSMediaKeyBlock(obj), BDPlusSVM obj => new FileType.BDPlusSVM(obj), + GCF obj => new FileType.GCF(obj), ISO9660 obj => new FileType.ISO9660(obj), LDSCRYPT obj => new FileType.LDSCRYPT(obj), LinearExecutable obj => new FileType.LinearExecutable(obj),