diff --git a/BinaryObjectScanner.Printing/CIA.cs b/BinaryObjectScanner.Printing/CIA.cs
index 77b6a2e8..fae3bd41 100644
--- a/BinaryObjectScanner.Printing/CIA.cs
+++ b/BinaryObjectScanner.Printing/CIA.cs
@@ -366,7 +366,7 @@ namespace BinaryObjectScanner.Printing
#if NET48
private static void Print(StringBuilder builder, NCCHHeader[] partitions)
#else
- private static void Print(StringBuilder builder, NCCHHeader[] partitions)
+ private static void Print(StringBuilder builder, NCCHHeader?[]? partitions)
#endif
{
builder.AppendLine(" NCCH Partition Header Information:");
diff --git a/BinaryObjectScanner.Printing/GCF.cs b/BinaryObjectScanner.Printing/GCF.cs
new file mode 100644
index 00000000..0570ed7b
--- /dev/null
+++ b/BinaryObjectScanner.Printing/GCF.cs
@@ -0,0 +1,613 @@
+using System.Text;
+using SabreTools.Models.GCF;
+
+namespace BinaryObjectScanner.Printing
+{
+ public static class GCF
+ {
+ public static void Print(StringBuilder builder, File file)
+ {
+ builder.AppendLine("GCF Information:");
+ builder.AppendLine("-------------------------");
+ builder.AppendLine();
+
+ // Header
+ Print(builder, file.Header);
+
+ // Block Entries
+ Print(builder, file.BlockEntryHeader);
+ Print(builder, file.BlockEntries);
+
+ // Fragmentation Maps
+ Print(builder, file.FragmentationMapHeader);
+ Print(builder, file.FragmentationMaps);
+
+ // Block Entry Maps
+ Print(builder, file.BlockEntryMapHeader);
+ Print(builder, file.BlockEntryMaps);
+
+ // Directory and Directory Maps
+ Print(builder, file.DirectoryHeader);
+ Print(builder, file.DirectoryEntries);
+ // TODO: Should we print out the entire string table?
+ Print(builder, file.DirectoryInfo1Entries);
+ Print(builder, file.DirectoryInfo2Entries);
+ Print(builder, file.DirectoryCopyEntries);
+ Print(builder, file.DirectoryLocalEntries);
+ Print(builder, file.DirectoryMapHeader);
+ Print(builder, file.DirectoryMapEntries);
+
+ // Checksums and Checksum Maps
+ Print(builder, file.ChecksumHeader);
+ Print(builder, file.ChecksumMapHeader);
+ Print(builder, file.ChecksumMapEntries);
+ Print(builder, file.ChecksumEntries);
+
+ // Data Blocks
+ Print(builder, file.DataBlockHeader);
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, Header header)
+#else
+ private static void Print(StringBuilder builder, Header? header)
+#endif
+ {
+ builder.AppendLine(" Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Major version: {header.MajorVersion} (0x{header.MajorVersion:X})");
+ builder.AppendLine($" Minor version: {header.MinorVersion} (0x{header.MinorVersion:X})");
+ builder.AppendLine($" Cache ID: {header.CacheID} (0x{header.CacheID:X})");
+ builder.AppendLine($" Last version played: {header.LastVersionPlayed} (0x{header.LastVersionPlayed:X})");
+ builder.AppendLine($" Dummy 1: {header.Dummy1} (0x{header.Dummy1:X})");
+ builder.AppendLine($" Dummy 2: {header.Dummy2} (0x{header.Dummy2:X})");
+ builder.AppendLine($" File size: {header.FileSize} (0x{header.FileSize:X})");
+ builder.AppendLine($" Block size: {header.BlockSize} (0x{header.BlockSize:X})");
+ builder.AppendLine($" Block count: {header.BlockCount} (0x{header.BlockCount:X})");
+ builder.AppendLine($" Dummy 3: {header.Dummy3} (0x{header.Dummy3:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, BlockEntryHeader header)
+#else
+ private static void Print(StringBuilder builder, BlockEntryHeader? header)
+#endif
+ {
+ builder.AppendLine(" Block Entry Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No block entry header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Block count: {header.BlockCount} (0x{header.BlockCount:X})");
+ builder.AppendLine($" Blocks used: {header.BlocksUsed} (0x{header.BlocksUsed:X})");
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Dummy 1: {header.Dummy1} (0x{header.Dummy1:X})");
+ builder.AppendLine($" Dummy 2: {header.Dummy2} (0x{header.Dummy2:X})");
+ builder.AppendLine($" Dummy 3: {header.Dummy3} (0x{header.Dummy3:X})");
+ builder.AppendLine($" Dummy 4: {header.Dummy4} (0x{header.Dummy4:X})");
+ builder.AppendLine($" Checksum: {header.Checksum} (0x{header.Checksum:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, BlockEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, BlockEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Block Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No block entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Block Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Entry flags: {entry.EntryFlags} (0x{entry.EntryFlags:X})");
+ builder.AppendLine($" File data offset: {entry.FileDataOffset} (0x{entry.FileDataOffset:X})");
+ builder.AppendLine($" File data size: {entry.FileDataSize} (0x{entry.FileDataSize:X})");
+ builder.AppendLine($" First data block index: {entry.FirstDataBlockIndex} (0x{entry.FirstDataBlockIndex:X})");
+ builder.AppendLine($" Next block entry index: {entry.NextBlockEntryIndex} (0x{entry.NextBlockEntryIndex:X})");
+ builder.AppendLine($" Previous block entry index: {entry.PreviousBlockEntryIndex} (0x{entry.PreviousBlockEntryIndex:X})");
+ builder.AppendLine($" Directory index: {entry.DirectoryIndex} (0x{entry.DirectoryIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, FragmentationMapHeader header)
+#else
+ private static void Print(StringBuilder builder, FragmentationMapHeader? header)
+#endif
+ {
+ builder.AppendLine(" Fragmentation Map Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No fragmentation map header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Block count: {header.BlockCount} (0x{header.BlockCount:X})");
+ builder.AppendLine($" First unused entry: {header.FirstUnusedEntry} (0x{header.FirstUnusedEntry:X})");
+ builder.AppendLine($" Terminator: {header.Terminator} (0x{header.Terminator:X})");
+ builder.AppendLine($" Checksum: {header.Checksum} (0x{header.Checksum:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, FragmentationMap[] entries)
+#else
+ private static void Print(StringBuilder builder, FragmentationMap?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Fragmentation Maps Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No fragmentation maps");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Fragmentation Map {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Next data block index: {entry.NextDataBlockIndex} (0x{entry.NextDataBlockIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, BlockEntryMapHeader header)
+#else
+ private static void Print(StringBuilder builder, BlockEntryMapHeader? header)
+#endif
+ {
+ builder.AppendLine(" Block Entry Map Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine($" No block entry map header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Block count: {header.BlockCount} (0x{header.BlockCount:X})");
+ builder.AppendLine($" First block entry index: {header.FirstBlockEntryIndex} (0x{header.FirstBlockEntryIndex:X})");
+ builder.AppendLine($" Last block entry index: {header.LastBlockEntryIndex} (0x{header.LastBlockEntryIndex:X})");
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Checksum: {header.Checksum} (0x{header.Checksum:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, BlockEntryMap[] entries)
+#else
+ private static void Print(StringBuilder builder, BlockEntryMap?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Block Entry Maps Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No block entry maps");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Block Entry Map {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Previous data block index: {entry.PreviousBlockEntryIndex} (0x{entry.PreviousBlockEntryIndex:X})");
+ builder.AppendLine($" Next data block index: {entry.NextBlockEntryIndex} (0x{entry.NextBlockEntryIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryHeader header)
+#else
+ private static void Print(StringBuilder builder, DirectoryHeader? header)
+#endif
+ {
+ builder.AppendLine(" Directory Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No directory header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Cache ID: {header.CacheID} (0x{header.CacheID:X})");
+ builder.AppendLine($" Last version played: {header.LastVersionPlayed} (0x{header.LastVersionPlayed:X})");
+ builder.AppendLine($" Item count: {header.ItemCount} (0x{header.ItemCount:X})");
+ builder.AppendLine($" File count: {header.FileCount} (0x{header.FileCount:X})");
+ builder.AppendLine($" Dummy 1: {header.Dummy1} (0x{header.Dummy1:X})");
+ builder.AppendLine($" Directory size: {header.DirectorySize} (0x{header.DirectorySize:X})");
+ builder.AppendLine($" Name size: {header.NameSize} (0x{header.NameSize:X})");
+ builder.AppendLine($" Info 1 count: {header.Info1Count} (0x{header.Info1Count:X})");
+ builder.AppendLine($" Copy count: {header.CopyCount} (0x{header.CopyCount:X})");
+ builder.AppendLine($" Local count: {header.LocalCount} (0x{header.LocalCount:X})");
+ builder.AppendLine($" Dummy 2: {header.Dummy2} (0x{header.Dummy2:X})");
+ builder.AppendLine($" Dummy 3: {header.Dummy3} (0x{header.Dummy3:X})");
+ builder.AppendLine($" Checksum: {header.Checksum} (0x{header.Checksum:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Name offset: {entry.NameOffset} (0x{entry.NameOffset:X})");
+ builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
+ builder.AppendLine($" Item size: {entry.ItemSize} (0x{entry.ItemSize:X})");
+ builder.AppendLine($" Checksum index: {entry.ChecksumIndex} (0x{entry.ChecksumIndex:X})");
+ builder.AppendLine($" Directory flags: {entry.DirectoryFlags} (0x{entry.DirectoryFlags:X})");
+ builder.AppendLine($" Parent index: {entry.ParentIndex} (0x{entry.ParentIndex:X})");
+ builder.AppendLine($" Next index: {entry.NextIndex} (0x{entry.NextIndex:X})");
+ builder.AppendLine($" First index: {entry.FirstIndex} (0x{entry.FirstIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryInfo1Entry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Info 1 Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory info 1 entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Info 1 Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Dummy 0: {entry.Dummy0} (0x{entry.Dummy0:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryInfo2Entry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Info 2 Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory info 2 entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Info 2 Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Dummy 0: {entry.Dummy0} (0x{entry.Dummy0:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryCopyEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Copy Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory copy entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Copy Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Directory index: {entry.DirectoryIndex} (0x{entry.DirectoryIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryLocalEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Local Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory local entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Local Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Directory index: {entry.DirectoryIndex} (0x{entry.DirectoryIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryMapHeader header)
+#else
+ private static void Print(StringBuilder builder, DirectoryMapHeader? header)
+#endif
+ {
+ builder.AppendLine(" Directory Map Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine($" No directory map header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Dummy 1: {header.Dummy1} (0x{header.Dummy1:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DirectoryMapEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, DirectoryMapEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Directory Map Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No directory map entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Directory Map Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" First block index: {entry.FirstBlockIndex} (0x{entry.FirstBlockIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, ChecksumHeader header)
+#else
+ private static void Print(StringBuilder builder, ChecksumHeader? header)
+#endif
+ {
+ builder.AppendLine(" Checksum Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No checksum header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Checksum size: {header.ChecksumSize} (0x{header.ChecksumSize:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, ChecksumMapHeader header)
+#else
+ private static void Print(StringBuilder builder, ChecksumMapHeader? header)
+#endif
+ {
+ builder.AppendLine(" Checksum Map Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No checksum map header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Dummy 0: {header.Dummy0} (0x{header.Dummy0:X})");
+ builder.AppendLine($" Dummy 1: {header.Dummy1} (0x{header.Dummy1:X})");
+ builder.AppendLine($" Item count: {header.ItemCount} (0x{header.ItemCount:X})");
+ builder.AppendLine($" Checksum count: {header.ChecksumCount} (0x{header.ChecksumCount:X})");
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, ChecksumMapEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, ChecksumMapEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Checksum Map Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No checksum map entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Checksum Map Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Checksum count: {entry.ChecksumCount} (0x{entry.ChecksumCount:X})");
+ builder.AppendLine($" First checksum index: {entry.FirstChecksumIndex} (0x{entry.FirstChecksumIndex:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, ChecksumEntry[] entries)
+#else
+ private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
+#endif
+ {
+ builder.AppendLine(" Checksum Entries Information:");
+ builder.AppendLine(" -------------------------");
+ if (entries == null || entries.Length == 0)
+ {
+ builder.AppendLine(" No checksum entries");
+ builder.AppendLine();
+ return;
+ }
+
+ for (int i = 0; i < entries.Length; i++)
+ {
+ var entry = entries[i];
+ builder.AppendLine($" Checksum Entry {i}");
+ if (entry == null)
+ {
+ builder.AppendLine(" [NULL]");
+ continue;
+ }
+
+ builder.AppendLine($" Checksum: {entry.Checksum} (0x{entry.Checksum:X})");
+ }
+ builder.AppendLine();
+ }
+
+#if NET48
+ private static void Print(StringBuilder builder, DataBlockHeader header)
+#else
+ private static void Print(StringBuilder builder, DataBlockHeader? header)
+#endif
+ {
+ builder.AppendLine(" Data Block Header Information:");
+ builder.AppendLine(" -------------------------");
+ if (header == null)
+ {
+ builder.AppendLine(" No data block header");
+ builder.AppendLine();
+ return;
+ }
+
+ builder.AppendLine($" Last version played: {header.LastVersionPlayed} (0x{header.LastVersionPlayed:X})");
+ builder.AppendLine($" Block count: {header.BlockCount} (0x{header.BlockCount:X})");
+ builder.AppendLine($" Block size: {header.BlockSize} (0x{header.BlockSize:X})");
+ builder.AppendLine($" First block offset: {header.FirstBlockOffset} (0x{header.FirstBlockOffset:X})");
+ builder.AppendLine($" Blocks used: {header.BlocksUsed} (0x{header.BlocksUsed:X})");
+ builder.AppendLine($" Checksum: {header.Checksum} (0x{header.Checksum:X})");
+ builder.AppendLine();
+ }
+ }
+}
\ No newline at end of file
diff --git a/BinaryObjectScanner.Wrappers/GCF.cs b/BinaryObjectScanner.Wrappers/GCF.cs
index 0f4aa636..7b9108b4 100644
--- a/BinaryObjectScanner.Wrappers/GCF.cs
+++ b/BinaryObjectScanner.Wrappers/GCF.cs
@@ -791,563 +791,10 @@ namespace BinaryObjectScanner.Wrappers
public override StringBuilder PrettyPrint()
{
StringBuilder builder = new StringBuilder();
-
- builder.AppendLine("GCF Information:");
- builder.AppendLine("-------------------------");
- builder.AppendLine();
-
- // Header
- PrintHeader(builder);
-
- // Block Entries
- PrintBlockEntryHeader(builder);
- PrintBlockEntries(builder);
-
- // Fragmentation Maps
- PrintFragmentationMapHeader(builder);
- PrintFragmentationMaps(builder);
-
- // Block Entry Maps
- PrintBlockEntryMapHeader(builder);
- PrintBlockEntryMaps(builder);
-
- // Directory and Directory Maps
- PrintDirectoryHeader(builder);
- PrintDirectoryEntries(builder);
- // TODO: Should we print out the entire string table?
- PrintDirectoryInfo1Entries(builder);
- PrintDirectoryInfo2Entries(builder);
- PrintDirectoryCopyEntries(builder);
- PrintDirectoryLocalEntries(builder);
- PrintDirectoryMapHeader(builder);
- PrintDirectoryMapEntries(builder);
-
- // Checksums and Checksum Maps
- PrintChecksumHeader(builder);
- PrintChecksumMapHeader(builder);
- PrintChecksumMapEntries(builder);
- PrintChecksumEntries(builder);
-
- // Data Blocks
- PrintDataBlockHeader(builder);
-
+ Printing.GCF.Print(builder, _model);
return builder;
}
- ///
- /// Print header information
- ///
- /// StringBuilder to append information to
- private void PrintHeader(StringBuilder builder)
- {
- builder.AppendLine(" Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
- builder.AppendLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
- builder.AppendLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
- builder.AppendLine($" Cache ID: {CacheID} (0x{CacheID:X})");
- builder.AppendLine($" Last version played: {LastVersionPlayed} (0x{LastVersionPlayed:X})");
- builder.AppendLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
- builder.AppendLine($" Dummy 2: {Dummy2} (0x{Dummy2:X})");
- builder.AppendLine($" File size: {FileSize} (0x{FileSize:X})");
- builder.AppendLine($" Block size: {BlockSize} (0x{BlockSize:X})");
- builder.AppendLine($" Block count: {BlockCount} (0x{BlockCount:X})");
- builder.AppendLine($" Dummy 3: {Dummy3} (0x{Dummy3:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print block entry header information
- ///
- /// StringBuilder to append information to
- private void PrintBlockEntryHeader(StringBuilder builder)
- {
- builder.AppendLine(" Block Entry Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Block count: {BEH_BlockCount} (0x{BEH_BlockCount:X})");
- builder.AppendLine($" Blocks used: {BEH_BlocksUsed} (0x{BEH_BlocksUsed:X})");
- builder.AppendLine($" Dummy 0: {BEH_Dummy0} (0x{BEH_Dummy0:X})");
- builder.AppendLine($" Dummy 1: {BEH_Dummy1} (0x{BEH_Dummy1:X})");
- builder.AppendLine($" Dummy 2: {BEH_Dummy2} (0x{BEH_Dummy2:X})");
- builder.AppendLine($" Dummy 3: {BEH_Dummy3} (0x{BEH_Dummy3:X})");
- builder.AppendLine($" Dummy 4: {BEH_Dummy4} (0x{BEH_Dummy4:X})");
- builder.AppendLine($" Checksum: {BEH_Checksum} (0x{BEH_Checksum:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print block entries information
- ///
- /// StringBuilder to append information to
- private void PrintBlockEntries(StringBuilder builder)
- {
- builder.AppendLine(" Block Entries Information:");
- builder.AppendLine(" -------------------------");
- if (BlockEntries == null || BlockEntries.Length == 0)
- {
- builder.AppendLine(" No block entries");
- }
- else
- {
- for (int i = 0; i < BlockEntries.Length; i++)
- {
- var blockEntry = BlockEntries[i];
- builder.AppendLine($" Block Entry {i}");
- if (blockEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Entry flags: {blockEntry.EntryFlags} (0x{blockEntry.EntryFlags:X})");
- builder.AppendLine($" File data offset: {blockEntry.FileDataOffset} (0x{blockEntry.FileDataOffset:X})");
- builder.AppendLine($" File data size: {blockEntry.FileDataSize} (0x{blockEntry.FileDataSize:X})");
- builder.AppendLine($" First data block index: {blockEntry.FirstDataBlockIndex} (0x{blockEntry.FirstDataBlockIndex:X})");
- builder.AppendLine($" Next block entry index: {blockEntry.NextBlockEntryIndex} (0x{blockEntry.NextBlockEntryIndex:X})");
- builder.AppendLine($" Previous block entry index: {blockEntry.PreviousBlockEntryIndex} (0x{blockEntry.PreviousBlockEntryIndex:X})");
- builder.AppendLine($" Directory index: {blockEntry.DirectoryIndex} (0x{blockEntry.DirectoryIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print fragmentation map header information
- ///
- /// StringBuilder to append information to
- private void PrintFragmentationMapHeader(StringBuilder builder)
- {
- builder.AppendLine(" Fragmentation Map Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Block count: {FMH_BlockCount} (0x{FMH_BlockCount:X})");
- builder.AppendLine($" First unused entry: {FMH_FirstUnusedEntry} (0x{FMH_FirstUnusedEntry:X})");
- builder.AppendLine($" Terminator: {FMH_Terminator} (0x{FMH_Terminator:X})");
- builder.AppendLine($" Checksum: {FMH_Checksum} (0x{FMH_Checksum:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print fragmentation maps information
- ///
- /// StringBuilder to append information to
- private void PrintFragmentationMaps(StringBuilder builder)
- {
- builder.AppendLine(" Fragmentation Maps Information:");
- builder.AppendLine(" -------------------------");
- if (FragmentationMaps == null || FragmentationMaps.Length == 0)
- {
- builder.AppendLine(" No fragmentation maps");
- }
- else
- {
- for (int i = 0; i < FragmentationMaps.Length; i++)
- {
- var fragmentationMap = FragmentationMaps[i];
- builder.AppendLine($" Fragmentation Map {i}");
- if (fragmentationMap == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Next data block index: {fragmentationMap.NextDataBlockIndex} (0x{fragmentationMap.NextDataBlockIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print block entry map header information
- ///
- /// StringBuilder to append information to
- private void PrintBlockEntryMapHeader(StringBuilder builder)
- {
- builder.AppendLine(" Block Entry Map Header Information:");
- builder.AppendLine(" -------------------------");
- if (_model.BlockEntryMapHeader == null)
- {
- builder.AppendLine($" No block entry map header");
- }
- else
- {
- builder.AppendLine($" Block count: {BEMH_BlockCount} (0x{BEMH_BlockCount:X})");
- builder.AppendLine($" First block entry index: {BEMH_FirstBlockEntryIndex} (0x{BEMH_FirstBlockEntryIndex:X})");
- builder.AppendLine($" Last block entry index: {BEMH_LastBlockEntryIndex} (0x{BEMH_LastBlockEntryIndex:X})");
- builder.AppendLine($" Dummy 0: {BEMH_Dummy0} (0x{BEMH_Dummy0:X})");
- builder.AppendLine($" Checksum: {BEMH_Checksum} (0x{BEMH_Checksum:X})");
- }
- builder.AppendLine();
- }
-
- ///
- /// Print block entry maps information
- ///
- /// StringBuilder to append information to
- private void PrintBlockEntryMaps(StringBuilder builder)
- {
- builder.AppendLine(" Block Entry Maps Information:");
- builder.AppendLine(" -------------------------");
- if (BlockEntryMaps == null || BlockEntryMaps.Length == 0)
- {
- builder.AppendLine(" No block entry maps");
- }
- else
- {
- for (int i = 0; i < BlockEntryMaps.Length; i++)
- {
- var blockEntryMap = BlockEntryMaps[i];
- builder.AppendLine($" Block Entry Map {i}");
- if (blockEntryMap == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Previous data block index: {blockEntryMap.PreviousBlockEntryIndex} (0x{blockEntryMap.PreviousBlockEntryIndex:X})");
- builder.AppendLine($" Next data block index: {blockEntryMap.NextBlockEntryIndex} (0x{blockEntryMap.NextBlockEntryIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory header information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryHeader(StringBuilder builder)
- {
- builder.AppendLine(" Directory Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Dummy 0: {DH_Dummy0} (0x{DH_Dummy0:X})");
- builder.AppendLine($" Cache ID: {DH_CacheID} (0x{DH_CacheID:X})");
- builder.AppendLine($" Last version played: {DH_LastVersionPlayed} (0x{DH_LastVersionPlayed:X})");
- builder.AppendLine($" Item count: {DH_ItemCount} (0x{DH_ItemCount:X})");
- builder.AppendLine($" File count: {DH_FileCount} (0x{DH_FileCount:X})");
- builder.AppendLine($" Dummy 1: {DH_Dummy1} (0x{DH_Dummy1:X})");
- builder.AppendLine($" Directory size: {DH_DirectorySize} (0x{DH_DirectorySize:X})");
- builder.AppendLine($" Name size: {DH_NameSize} (0x{DH_NameSize:X})");
- builder.AppendLine($" Info 1 count: {DH_Info1Count} (0x{DH_Info1Count:X})");
- builder.AppendLine($" Copy count: {DH_CopyCount} (0x{DH_CopyCount:X})");
- builder.AppendLine($" Local count: {DH_LocalCount} (0x{DH_LocalCount:X})");
- builder.AppendLine($" Dummy 2: {DH_Dummy2} (0x{DH_Dummy2:X})");
- builder.AppendLine($" Dummy 3: {DH_Dummy3} (0x{DH_Dummy3:X})");
- builder.AppendLine($" Checksum: {DH_Checksum} (0x{DH_Checksum:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print directory entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryEntries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryEntries == null || DirectoryEntries.Length == 0)
- {
- builder.AppendLine(" No directory entries");
- }
- else
- {
- for (int i = 0; i < DirectoryEntries.Length; i++)
- {
- var directoryEntry = DirectoryEntries[i];
- builder.AppendLine($" Directory Entry {i}");
- if (directoryEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Name offset: {directoryEntry.NameOffset} (0x{directoryEntry.NameOffset:X})");
- builder.AppendLine($" Name: {directoryEntry.Name ?? "[NULL]"}");
- builder.AppendLine($" Item size: {directoryEntry.ItemSize} (0x{directoryEntry.ItemSize:X})");
- builder.AppendLine($" Checksum index: {directoryEntry.ChecksumIndex} (0x{directoryEntry.ChecksumIndex:X})");
- builder.AppendLine($" Directory flags: {directoryEntry.DirectoryFlags} (0x{directoryEntry.DirectoryFlags:X})");
- builder.AppendLine($" Parent index: {directoryEntry.ParentIndex} (0x{directoryEntry.ParentIndex:X})");
- builder.AppendLine($" Next index: {directoryEntry.NextIndex} (0x{directoryEntry.NextIndex:X})");
- builder.AppendLine($" First index: {directoryEntry.FirstIndex} (0x{directoryEntry.FirstIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory info 1 entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryInfo1Entries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Info 1 Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryInfo1Entries == null || DirectoryInfo1Entries.Length == 0)
- {
- builder.AppendLine(" No directory info 1 entries");
- }
- else
- {
- for (int i = 0; i < DirectoryInfo1Entries.Length; i++)
- {
- var directoryInfoEntry = DirectoryInfo1Entries[i];
- builder.AppendLine($" Directory Info 1 Entry {i}");
- if (directoryInfoEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory info 2 entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryInfo2Entries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Info 2 Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryInfo2Entries == null || DirectoryInfo2Entries.Length == 0)
- {
- builder.AppendLine(" No directory info 2 entries");
- }
- else
- {
- for (int i = 0; i < DirectoryInfo2Entries.Length; i++)
- {
- var directoryInfoEntry = DirectoryInfo2Entries[i];
- builder.AppendLine($" Directory Info 2 Entry {i}");
- if (directoryInfoEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory copy entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryCopyEntries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Copy Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryCopyEntries == null || DirectoryCopyEntries.Length == 0)
- {
- builder.AppendLine(" No directory copy entries");
- }
- else
- {
- for (int i = 0; i < DirectoryCopyEntries.Length; i++)
- {
- var directoryCopyEntry = DirectoryCopyEntries[i];
- builder.AppendLine($" Directory Copy Entry {i}");
- if (directoryCopyEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory local entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryLocalEntries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Local Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryLocalEntries == null || DirectoryLocalEntries.Length == 0)
- {
- builder.AppendLine(" No directory local entries");
- }
- else
- {
- for (int i = 0; i < DirectoryLocalEntries.Length; i++)
- {
- var directoryLocalEntry = DirectoryLocalEntries[i];
- builder.AppendLine($" Directory Local Entry {i}");
- if (directoryLocalEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory map header information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryMapHeader(StringBuilder builder)
- {
- builder.AppendLine(" Directory Map Header Information:");
- builder.AppendLine(" -------------------------");
- if (_model.DirectoryMapHeader == null)
- {
- builder.AppendLine($" No directory map header");
- }
- else
- {
- builder.AppendLine($" Dummy 0: {DMH_Dummy0} (0x{DMH_Dummy0:X})");
- builder.AppendLine($" Dummy 1: {DMH_Dummy1} (0x{DMH_Dummy1:X})");
- }
- builder.AppendLine();
- }
-
- ///
- /// Print directory map entries information
- ///
- /// StringBuilder to append information to
- private void PrintDirectoryMapEntries(StringBuilder builder)
- {
- builder.AppendLine(" Directory Map Entries Information:");
- builder.AppendLine(" -------------------------");
- if (DirectoryMapEntries == null || DirectoryMapEntries.Length == 0)
- {
- builder.AppendLine(" No directory map entries");
- }
- else
- {
- for (int i = 0; i < DirectoryMapEntries.Length; i++)
- {
- var directoryMapEntry = DirectoryMapEntries[i];
- builder.AppendLine($" Directory Map Entry {i}");
- if (directoryMapEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" First block index: {directoryMapEntry.FirstBlockIndex} (0x{directoryMapEntry.FirstBlockIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print checksum header information
- ///
- /// StringBuilder to append information to
- private void PrintChecksumHeader(StringBuilder builder)
- {
- builder.AppendLine(" Checksum Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Dummy 0: {CH_Dummy0} (0x{CH_Dummy0:X})");
- builder.AppendLine($" Checksum size: {CH_ChecksumSize} (0x{CH_ChecksumSize:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print checksum map header information
- ///
- /// StringBuilder to append information to
- private void PrintChecksumMapHeader(StringBuilder builder)
- {
- builder.AppendLine(" Checksum Map Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Dummy 0: {CMH_Dummy0} (0x{CMH_Dummy0:X})");
- builder.AppendLine($" Dummy 1: {CMH_Dummy1} (0x{CMH_Dummy1:X})");
- builder.AppendLine($" Item count: {CMH_ItemCount} (0x{CMH_ItemCount:X})");
- builder.AppendLine($" Checksum count: {CMH_ChecksumCount} (0x{CMH_ChecksumCount:X})");
- builder.AppendLine();
- }
-
- ///
- /// Print checksum map entries information
- ///
- /// StringBuilder to append information to
- private void PrintChecksumMapEntries(StringBuilder builder)
- {
- builder.AppendLine(" Checksum Map Entries Information:");
- builder.AppendLine(" -------------------------");
- if (ChecksumMapEntries == null || ChecksumMapEntries.Length == 0)
- {
- builder.AppendLine(" No checksum map entries");
- }
- else
- {
- for (int i = 0; i < ChecksumMapEntries.Length; i++)
- {
- var checksumMapEntry = ChecksumMapEntries[i];
- builder.AppendLine($" Checksum Map Entry {i}");
- if (checksumMapEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
- builder.AppendLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print checksum entries information
- ///
- /// StringBuilder to append information to
- private void PrintChecksumEntries(StringBuilder builder)
- {
- builder.AppendLine(" Checksum Entries Information:");
- builder.AppendLine(" -------------------------");
- if (ChecksumEntries == null || ChecksumEntries.Length == 0)
- {
- builder.AppendLine(" No checksum entries");
- }
- else
- {
- for (int i = 0; i < ChecksumEntries.Length; i++)
- {
- var checksumEntry = ChecksumEntries[i];
- builder.AppendLine($" Checksum Entry {i}");
- if (checksumEntry == null)
- {
- builder.AppendLine(" [NULL]");
- continue;
- }
-
- builder.AppendLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
- }
- }
- builder.AppendLine();
- }
-
- ///
- /// Print data block header information
- ///
- /// StringBuilder to append information to
- private void PrintDataBlockHeader(StringBuilder builder)
- {
- builder.AppendLine(" Data Block Header Information:");
- builder.AppendLine(" -------------------------");
- builder.AppendLine($" Last version played: {DBH_LastVersionPlayed} (0x{DBH_LastVersionPlayed:X})");
- builder.AppendLine($" Block count: {DBH_BlockCount} (0x{DBH_BlockCount:X})");
- builder.AppendLine($" Block size: {DBH_BlockSize} (0x{DBH_BlockSize:X})");
- builder.AppendLine($" First block offset: {DBH_FirstBlockOffset} (0x{DBH_FirstBlockOffset:X})");
- builder.AppendLine($" Blocks used: {DBH_BlocksUsed} (0x{DBH_BlocksUsed:X})");
- builder.AppendLine($" Checksum: {DBH_Checksum} (0x{DBH_Checksum:X})");
- builder.AppendLine();
- }
-
#if NET6_0_OR_GREATER
///