Skip to content

Commit ff02fdb

Browse files
Add BOS gcf output (#413)
1 parent 53d4757 commit ff02fdb

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.IO;
2+
3+
namespace BinaryObjectScanner.FileType
4+
{
5+
/// <summary>
6+
/// Game Cache File (GCF)
7+
/// </summary>
8+
public class GCF : DetectableBase<SabreTools.Serialization.Wrappers.GCF>
9+
{
10+
/// <inheritdoc/>
11+
public GCF(SabreTools.Serialization.Wrappers.GCF wrapper) : base(wrapper) { }
12+
13+
/// <inheritdoc/>
14+
public override string? Detect(Stream stream, string file, bool includeDebug)
15+
{
16+
// Filename is worth reporting, since it's descriptive and has to match the Steam2 CDN in order to work.
17+
string fileName = Path.GetFileName(file);
18+
uint depotId = _wrapper.Model.Header.CacheID;
19+
uint manifestVersion = _wrapper.Model.Header.LastVersionPlayed;
20+
21+
// At the moment, all samples of GCF files on redump are unencrypted. Combined with being uncertain about
22+
// whether this is the best way to check whether the GCF is encrypted, this block will be left commented
23+
// out until further research is done.
24+
/*bool encrypted = false;
25+
if (_wrapper.Files != null && _wrapper.Files.Length > 0)
26+
encrypted = _wrapper.Files[0].Encrypted;
27+
28+
string encryptedString = encrypted ? "encrypted" : "unencrypted";
29+
string returnString = $"{fileName} - {depotId} (v{manifestVersion}, {encryptedString})";*/
30+
string returnString = $"{fileName} - {depotId} (v{manifestVersion})";
31+
return returnString;
32+
}
33+
}
34+
}

BinaryObjectScanner/Scanner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ private static List<string> PerformPathCheck(IPathCheck impl, string? path, List
493493
{
494494
AACSMediaKeyBlock obj => new FileType.AACSMediaKeyBlock(obj),
495495
BDPlusSVM obj => new FileType.BDPlusSVM(obj),
496+
GCF obj => new FileType.GCF(obj),
496497
ISO9660 obj => new FileType.ISO9660(obj),
497498
LDSCRYPT obj => new FileType.LDSCRYPT(obj),
498499
LinearExecutable obj => new FileType.LinearExecutable(obj),

0 commit comments

Comments
 (0)