Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions BinaryObjectScanner/FileType/GCF.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;

namespace BinaryObjectScanner.FileType
Expand All @@ -16,19 +17,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;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated terminology in code slightly; calling a steam2 version a manifest is possibly inaccurate.


// At the moment, all samples of GCF files on redump are unencrypted. Combined with being uncertain about

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was wrong, there are plenty of encrypted GCFs on redump already.

// 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 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 = Array.Exists(_wrapper.Files, fileInfo => fileInfo.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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel otherwise, let me know, but it seems redundant to put a string saying it's unencrypted, imo it's better to just only note it when it's encrypted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really have a good enough grasp on the file type to know if stating that it is unencrypted is valuable or not. At the very least, it can be tweaked here if necessary.

string encryptedString = encrypted ? ", encrypted" : "";
string returnString = $"{fileName} - {depotId} (v{depotVersion}{encryptedString})";
return returnString;
}
}
Expand Down