mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-21 21:54:13 +00:00
Pretty print uses StringBuildernow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -82,135 +83,140 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("AACS Media Key Block Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintRecords();
|
||||
builder.AppendLine("AACS Media Key Block Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintRecords(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print records information
|
||||
/// </summary>
|
||||
private void PrintRecords()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintRecords(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Records Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Records Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Records == null || Records.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No records");
|
||||
builder.AppendLine(" No records");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Records.Length; i++)
|
||||
{
|
||||
var record = Records[i];
|
||||
Console.WriteLine($" Record Entry {i}");
|
||||
Console.WriteLine($" Record type: {record.RecordType} (0x{record.RecordType:X})");
|
||||
Console.WriteLine($" Record length: {record.RecordLength} (0x{record.RecordLength:X})");
|
||||
builder.AppendLine($" Record Entry {i}");
|
||||
builder.AppendLine($" Record type: {record.RecordType} (0x{record.RecordType:X})");
|
||||
builder.AppendLine($" Record length: {record.RecordLength} (0x{record.RecordLength:X})");
|
||||
|
||||
switch (record.RecordType)
|
||||
{
|
||||
case Models.AACS.RecordType.EndOfMediaKeyBlock:
|
||||
var eomkb = record as Models.AACS.EndOfMediaKeyBlockRecord;
|
||||
Console.WriteLine($" Signature data: {BitConverter.ToString(eomkb.SignatureData ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Signature data: {BitConverter.ToString(eomkb.SignatureData ?? new byte[0]).Replace('-', ' ')}");
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.ExplicitSubsetDifference:
|
||||
var esd = record as Models.AACS.ExplicitSubsetDifferenceRecord;
|
||||
Console.WriteLine($" Subset Differences:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Subset Differences:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (esd.SubsetDifferences == null || esd.SubsetDifferences.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No subset differences");
|
||||
builder.AppendLine($" No subset differences");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < esd.SubsetDifferences.Length; j++)
|
||||
{
|
||||
var sd = esd.SubsetDifferences[j];
|
||||
Console.WriteLine($" Subset Difference {j}");
|
||||
Console.WriteLine($" Mask: {sd.Mask} (0x{sd.Mask:X})");
|
||||
Console.WriteLine($" Number: {sd.Number} (0x{sd.Number:X})");
|
||||
builder.AppendLine($" Subset Difference {j}");
|
||||
builder.AppendLine($" Mask: {sd.Mask} (0x{sd.Mask:X})");
|
||||
builder.AppendLine($" Number: {sd.Number} (0x{sd.Number:X})");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.MediaKeyData:
|
||||
var mkd = record as Models.AACS.MediaKeyDataRecord;
|
||||
Console.WriteLine($" Media Keys:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Media Keys:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (mkd.MediaKeyData == null || mkd.MediaKeyData.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No media keys");
|
||||
builder.AppendLine($" No media keys");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < mkd.MediaKeyData.Length; j++)
|
||||
{
|
||||
var mk = mkd.MediaKeyData[j];
|
||||
Console.WriteLine($" Media key {j}: {BitConverter.ToString(mk ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Media key {j}: {BitConverter.ToString(mk ?? new byte[0]).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.SubsetDifferenceIndex:
|
||||
var sdi = record as Models.AACS.SubsetDifferenceIndexRecord;
|
||||
Console.WriteLine($" Span: {sdi.Span} (0x{sdi.Span:X})");
|
||||
Console.WriteLine($" Offsets:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Span: {sdi.Span} (0x{sdi.Span:X})");
|
||||
builder.AppendLine($" Offsets:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (sdi.Offsets == null || sdi.Offsets.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No offsets");
|
||||
builder.AppendLine($" No offsets");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < sdi.Offsets.Length; j++)
|
||||
{
|
||||
var offset = sdi.Offsets[j];
|
||||
Console.WriteLine($" Offset {j}: {offset} (0x{offset:X})");
|
||||
builder.AppendLine($" Offset {j}: {offset} (0x{offset:X})");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.TypeAndVersion:
|
||||
var tav = record as Models.AACS.TypeAndVersionRecord;
|
||||
Console.WriteLine($" Media key block type: {tav.MediaKeyBlockType} (0x{tav.MediaKeyBlockType:X})");
|
||||
Console.WriteLine($" Version number: {tav.VersionNumber} (0x{tav.VersionNumber:X})");
|
||||
builder.AppendLine($" Media key block type: {tav.MediaKeyBlockType} (0x{tav.MediaKeyBlockType:X})");
|
||||
builder.AppendLine($" Version number: {tav.VersionNumber} (0x{tav.VersionNumber:X})");
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.DriveRevocationList:
|
||||
var drl = record as Models.AACS.DriveRevocationListRecord;
|
||||
Console.WriteLine($" Total number of entries: {drl.TotalNumberOfEntries} (0x{drl.TotalNumberOfEntries:X})");
|
||||
Console.WriteLine($" Signature Blocks:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Total number of entries: {drl.TotalNumberOfEntries} (0x{drl.TotalNumberOfEntries:X})");
|
||||
builder.AppendLine($" Signature Blocks:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (drl.SignatureBlocks == null || drl.SignatureBlocks.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No signature blocks");
|
||||
builder.AppendLine($" No signature blocks");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < drl.SignatureBlocks.Length; j++)
|
||||
{
|
||||
var block = drl.SignatureBlocks[j];
|
||||
Console.WriteLine($" Signature Block {j}");
|
||||
Console.WriteLine($" Number of entries: {block.NumberOfEntries}");
|
||||
Console.WriteLine($" Entry Fields:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Signature Block {j}");
|
||||
builder.AppendLine($" Number of entries: {block.NumberOfEntries}");
|
||||
builder.AppendLine($" Entry Fields:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (block.EntryFields == null || block.EntryFields.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No entry fields");
|
||||
builder.AppendLine($" No entry fields");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < block.EntryFields.Length; k++)
|
||||
{
|
||||
var ef = block.EntryFields[k];
|
||||
Console.WriteLine($" Entry {k}");
|
||||
Console.WriteLine($" Range: {ef.Range} (0x{ef.Range:X})");
|
||||
Console.WriteLine($" Drive ID: {BitConverter.ToString(ef.DriveID ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Entry {k}");
|
||||
builder.AppendLine($" Range: {ef.Range} (0x{ef.Range:X})");
|
||||
builder.AppendLine($" Drive ID: {BitConverter.ToString(ef.DriveID ?? new byte[0]).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,34 +225,34 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
case Models.AACS.RecordType.HostRevocationList:
|
||||
var hrl = record as Models.AACS.HostRevocationListRecord;
|
||||
Console.WriteLine($" Total number of entries: {hrl.TotalNumberOfEntries} (0x{hrl.TotalNumberOfEntries:X})");
|
||||
Console.WriteLine($" Signature Blocks:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Total number of entries: {hrl.TotalNumberOfEntries} (0x{hrl.TotalNumberOfEntries:X})");
|
||||
builder.AppendLine($" Signature Blocks:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (hrl.SignatureBlocks == null || hrl.SignatureBlocks.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No signature blocks");
|
||||
builder.AppendLine($" No signature blocks");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < hrl.SignatureBlocks.Length; j++)
|
||||
{
|
||||
var block = hrl.SignatureBlocks[j];
|
||||
Console.WriteLine($" Signature Block {j}");
|
||||
Console.WriteLine($" Number of entries: {block.NumberOfEntries}");
|
||||
Console.WriteLine($" Entry Fields:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Signature Block {j}");
|
||||
builder.AppendLine($" Number of entries: {block.NumberOfEntries}");
|
||||
builder.AppendLine($" Entry Fields:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (block.EntryFields == null || block.EntryFields.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No entry fields");
|
||||
builder.AppendLine($" No entry fields");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < block.EntryFields.Length; k++)
|
||||
{
|
||||
var ef = block.EntryFields[k];
|
||||
Console.WriteLine($" Entry {k}");
|
||||
Console.WriteLine($" Range: {ef.Range} (0x{ef.Range:X})");
|
||||
Console.WriteLine($" Host ID: {BitConverter.ToString(ef.HostID ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Entry {k}");
|
||||
builder.AppendLine($" Range: {ef.Range} (0x{ef.Range:X})");
|
||||
builder.AppendLine($" Host ID: {BitConverter.ToString(ef.HostID ?? new byte[0]).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,17 +261,17 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
case Models.AACS.RecordType.VerifyMediaKey:
|
||||
var vmk = record as Models.AACS.VerifyMediaKeyRecord;
|
||||
Console.WriteLine($" Ciphertext value: {BitConverter.ToString(vmk.CiphertextValue ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Ciphertext value: {BitConverter.ToString(vmk.CiphertextValue ?? new byte[0]).Replace('-', ' ')}");
|
||||
break;
|
||||
|
||||
case Models.AACS.RecordType.Copyright:
|
||||
var c = record as Models.AACS.CopyrightRecord;
|
||||
Console.WriteLine($" Copyright: {c.Copyright ?? "[NULL]"}");
|
||||
builder.AppendLine($" Copyright: {c.Copyright ?? "[NULL]"}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -99,31 +100,36 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("BD+ Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("BD+ Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintSVM();
|
||||
PrintSVM(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print SVM information
|
||||
/// </summary>
|
||||
private void PrintSVM()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintSVM(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" SVM Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Unknown 1: {BitConverter.ToString(Unknown1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Year: {Year} (0x{Year:X})");
|
||||
Console.WriteLine($" Month: {Month} (0x{Month:X})");
|
||||
Console.WriteLine($" Day: {Day} (0x{Day:X})");
|
||||
Console.WriteLine($" Unknown 2: {BitConverter.ToString(Unknown2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Length: {Length} (0x{Length:X})");
|
||||
//Console.WriteLine($" Data: {BitConverter.ToString(Data ?? new byte[0]).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" SVM Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Unknown 1: {BitConverter.ToString(Unknown1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Year: {Year} (0x{Year:X})");
|
||||
builder.AppendLine($" Month: {Month} (0x{Month:X})");
|
||||
builder.AppendLine($" Day: {Day} (0x{Day:X})");
|
||||
builder.AppendLine($" Unknown 2: {BitConverter.ToString(Unknown2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Length: {Length} (0x{Length:X})");
|
||||
//builder.AppendLine($" Data: {BitConverter.ToString(Data ?? new byte[0]).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SharpCompress.Compressors;
|
||||
using SharpCompress.Compressors.Deflate;
|
||||
|
||||
@@ -185,54 +185,60 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("BFPK Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintFileTable();
|
||||
builder.AppendLine("BFPK Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintFileTable(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic: {Magic}");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine($" Files: {Files} (0x{Files:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic: {Magic}");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine($" Files: {Files} (0x{Files:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print file table information
|
||||
/// </summary>
|
||||
private void PrintFileTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFileTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" File Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" File Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Files == 0 || FileTable == null || FileTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No file table items");
|
||||
builder.AppendLine(" No file table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FileTable.Length; i++)
|
||||
{
|
||||
var entry = FileTable[i];
|
||||
Console.WriteLine($" File Table Entry {i}");
|
||||
Console.WriteLine($" Name size: {entry.NameSize} (0x{entry.NameSize:X})");
|
||||
Console.WriteLine($" Name: {entry.Name}");
|
||||
Console.WriteLine($" Uncompressed size: {entry.UncompressedSize} (0x{entry.UncompressedSize:X})");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
Console.WriteLine($" Compressed Size: {entry.CompressedSize} (0x{entry.CompressedSize:X})");
|
||||
builder.AppendLine($" File Table Entry {i}");
|
||||
builder.AppendLine($" Name size: {entry.NameSize} (0x{entry.NameSize:X})");
|
||||
builder.AppendLine($" Name: {entry.Name}");
|
||||
builder.AppendLine($" Uncompressed size: {entry.UncompressedSize} (0x{entry.UncompressedSize:X})");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
builder.AppendLine($" Compressed Size: {entry.CompressedSize} (0x{entry.CompressedSize:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using static BurnOutSharp.Models.BSP.Constants;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
@@ -108,39 +109,45 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("BSP Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("BSP Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader();
|
||||
PrintLumps();
|
||||
PrintTextureHeader();
|
||||
PrintTextures();
|
||||
PrintHeader(builder);
|
||||
PrintLumps(builder);
|
||||
PrintTextureHeader(builder);
|
||||
PrintTextures(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lumps information
|
||||
/// </summary>
|
||||
private void PrintLumps()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintLumps(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Lumps Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Lumps == null || Lumps.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No lumps");
|
||||
builder.AppendLine(" No lumps");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,61 +165,63 @@ namespace BurnOutSharp.Wrappers
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($" Lump {i}{specialLumpName}");
|
||||
Console.WriteLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
Console.WriteLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
builder.AppendLine($" Lump {i}{specialLumpName}");
|
||||
builder.AppendLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
builder.AppendLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print texture header information
|
||||
/// </summary>
|
||||
private void PrintTextureHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintTextureHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Texture Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Texture count: {TextureCount}");
|
||||
Console.WriteLine($" Offsets:");
|
||||
builder.AppendLine(" Texture Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Texture count: {TextureCount}");
|
||||
builder.AppendLine($" Offsets:");
|
||||
for (int i = 0; i < Offsets.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Offset {i}: {Offsets[i]} (0x{Offsets[i]:X})");
|
||||
builder.AppendLine($" Offset {i}: {Offsets[i]} (0x{Offsets[i]:X})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print textures information
|
||||
/// </summary>
|
||||
private void PrintTextures()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintTextures(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Textures Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Textures Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Textures == null || Textures.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No textures");
|
||||
builder.AppendLine(" No textures");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Textures.Length; i++)
|
||||
{
|
||||
var texture = Textures[i];
|
||||
Console.WriteLine($" Texture {i}");
|
||||
Console.WriteLine($" Name: {texture.Name}");
|
||||
Console.WriteLine($" Width: {texture.Width} (0x{texture.Width:X})");
|
||||
Console.WriteLine($" Height: {texture.Height} (0x{texture.Height:X})");
|
||||
Console.WriteLine($" Offsets:");
|
||||
builder.AppendLine($" Texture {i}");
|
||||
builder.AppendLine($" Name: {texture.Name}");
|
||||
builder.AppendLine($" Width: {texture.Width} (0x{texture.Width:X})");
|
||||
builder.AppendLine($" Height: {texture.Height} (0x{texture.Height:X})");
|
||||
builder.AppendLine($" Offsets:");
|
||||
for (int j = 0; j < texture.Offsets.Length; j++)
|
||||
{
|
||||
Console.WriteLine($" Offset {j}: {Offsets[i]} (0x{texture.Offsets[j]:X})");
|
||||
builder.AppendLine($" Offset {j}: {Offsets[i]} (0x{texture.Offsets[j]:X})");
|
||||
}
|
||||
// Skip texture data
|
||||
Console.WriteLine($" Palette size: {texture.PaletteSize} (0x{texture.PaletteSize:X})");
|
||||
builder.AppendLine($" Palette size: {texture.PaletteSize} (0x{texture.PaletteSize:X})");
|
||||
// Skip palette data
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -344,147 +345,156 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("Compound File Binary Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("Compound File Binary Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintFileHeader();
|
||||
PrintFATSectorNumbers();
|
||||
PrintMiniFATSectorNumbers();
|
||||
PrintDIFATSectorNumbers();
|
||||
PrintDirectoryEntries();
|
||||
PrintFileHeader(builder);
|
||||
PrintFATSectorNumbers(builder);
|
||||
PrintMiniFATSectorNumbers(builder);
|
||||
PrintDIFATSectorNumbers(builder);
|
||||
PrintDirectoryEntries(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintFileHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFileHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" File Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature} (0x{Signature:X})");
|
||||
Console.WriteLine($" CLSID: {CLSID}");
|
||||
Console.WriteLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
Console.WriteLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
Console.WriteLine($" Byte order: {ByteOrder} (0x{ByteOrder:X})");
|
||||
Console.WriteLine($" Sector shift: {SectorShift} (0x{SectorShift:X}) => {SectorSize}");
|
||||
Console.WriteLine($" Mini sector shift: {MiniSectorShift} (0x{MiniSectorShift:X}) => {MiniSectorSize}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(Reserved).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Number of directory sectors: {NumberOfDirectorySectors} (0x{NumberOfDirectorySectors:X})");
|
||||
Console.WriteLine($" Number of FAT sectors: {NumberOfFATSectors} (0x{NumberOfFATSectors:X})");
|
||||
Console.WriteLine($" First directory sector location: {FirstDirectorySectorLocation} (0x{FirstDirectorySectorLocation:X})");
|
||||
Console.WriteLine($" Transaction signature number: {TransactionSignatureNumber} (0x{TransactionSignatureNumber:X})");
|
||||
Console.WriteLine($" Mini stream cutoff size: {MiniStreamCutoffSize} (0x{MiniStreamCutoffSize:X})");
|
||||
Console.WriteLine($" First mini FAT sector location: {FirstMiniFATSectorLocation} (0x{FirstMiniFATSectorLocation:X})");
|
||||
Console.WriteLine($" Number of mini FAT sectors: {NumberOfMiniFATSectors} (0x{NumberOfMiniFATSectors:X})");
|
||||
Console.WriteLine($" First DIFAT sector location: {FirstDIFATSectorLocation} (0x{FirstDIFATSectorLocation:X})");
|
||||
Console.WriteLine($" Number of DIFAT sectors: {NumberOfDIFATSectors} (0x{NumberOfDIFATSectors:X})");
|
||||
Console.WriteLine($" DIFAT:");
|
||||
builder.AppendLine(" File Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature} (0x{Signature:X})");
|
||||
builder.AppendLine($" CLSID: {CLSID}");
|
||||
builder.AppendLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
builder.AppendLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
builder.AppendLine($" Byte order: {ByteOrder} (0x{ByteOrder:X})");
|
||||
builder.AppendLine($" Sector shift: {SectorShift} (0x{SectorShift:X}) => {SectorSize}");
|
||||
builder.AppendLine($" Mini sector shift: {MiniSectorShift} (0x{MiniSectorShift:X}) => {MiniSectorSize}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(Reserved).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Number of directory sectors: {NumberOfDirectorySectors} (0x{NumberOfDirectorySectors:X})");
|
||||
builder.AppendLine($" Number of FAT sectors: {NumberOfFATSectors} (0x{NumberOfFATSectors:X})");
|
||||
builder.AppendLine($" First directory sector location: {FirstDirectorySectorLocation} (0x{FirstDirectorySectorLocation:X})");
|
||||
builder.AppendLine($" Transaction signature number: {TransactionSignatureNumber} (0x{TransactionSignatureNumber:X})");
|
||||
builder.AppendLine($" Mini stream cutoff size: {MiniStreamCutoffSize} (0x{MiniStreamCutoffSize:X})");
|
||||
builder.AppendLine($" First mini FAT sector location: {FirstMiniFATSectorLocation} (0x{FirstMiniFATSectorLocation:X})");
|
||||
builder.AppendLine($" Number of mini FAT sectors: {NumberOfMiniFATSectors} (0x{NumberOfMiniFATSectors:X})");
|
||||
builder.AppendLine($" First DIFAT sector location: {FirstDIFATSectorLocation} (0x{FirstDIFATSectorLocation:X})");
|
||||
builder.AppendLine($" Number of DIFAT sectors: {NumberOfDIFATSectors} (0x{NumberOfDIFATSectors:X})");
|
||||
builder.AppendLine($" DIFAT:");
|
||||
for (int i = 0; i < DIFAT.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" DIFAT Entry {i}: {DIFAT[i]} (0x{DIFAT[i]:X})");
|
||||
builder.AppendLine($" DIFAT Entry {i}: {DIFAT[i]} (0x{DIFAT[i]:X})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print FAT sector numbers
|
||||
/// </summary>
|
||||
private void PrintFATSectorNumbers()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFATSectorNumbers(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" FAT Sectors Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" FAT Sectors Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FATSectorNumbers == null || FATSectorNumbers.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No FAT sectors");
|
||||
builder.AppendLine(" No FAT sectors");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FATSectorNumbers.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" FAT Sector Entry {i}: {FATSectorNumbers[i]} (0x{FATSectorNumbers[i]:X})");
|
||||
builder.AppendLine($" FAT Sector Entry {i}: {FATSectorNumbers[i]} (0x{FATSectorNumbers[i]:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print mini FAT sector numbers
|
||||
/// </summary>
|
||||
private void PrintMiniFATSectorNumbers()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintMiniFATSectorNumbers(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Mini FAT Sectors Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Mini FAT Sectors Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (MiniFATSectorNumbers == null || MiniFATSectorNumbers.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No mini FAT sectors");
|
||||
builder.AppendLine(" No mini FAT sectors");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < MiniFATSectorNumbers.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Mini FAT Sector Entry {i}: {MiniFATSectorNumbers[i]} (0x{MiniFATSectorNumbers[i]:X})");
|
||||
builder.AppendLine($" Mini FAT Sector Entry {i}: {MiniFATSectorNumbers[i]} (0x{MiniFATSectorNumbers[i]:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print DIFAT sector numbers
|
||||
/// </summary>
|
||||
private void PrintDIFATSectorNumbers()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDIFATSectorNumbers(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" DIFAT Sectors Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" DIFAT Sectors Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DIFATSectorNumbers == null || DIFATSectorNumbers.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No DIFAT sectors");
|
||||
builder.AppendLine(" No DIFAT sectors");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DIFATSectorNumbers.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" DIFAT Sector Entry {i}: {DIFATSectorNumbers[i]} (0x{DIFATSectorNumbers[i]:X})");
|
||||
builder.AppendLine($" DIFAT Sector Entry {i}: {DIFATSectorNumbers[i]} (0x{DIFATSectorNumbers[i]:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Print directory entries
|
||||
/// </summary>
|
||||
private void PrintDirectoryEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory entries");
|
||||
builder.AppendLine(" No directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = DirectoryEntries[i];
|
||||
Console.WriteLine($" Directory Entry {i}");
|
||||
Console.WriteLine($" Name: {directoryEntry.Name}");
|
||||
Console.WriteLine($" Name length: {directoryEntry.NameLength} (0x{directoryEntry.NameLength:X})");
|
||||
Console.WriteLine($" Object type: {directoryEntry.ObjectType} (0x{directoryEntry.ObjectType:X})");
|
||||
Console.WriteLine($" Color flag: {directoryEntry.ColorFlag} (0x{directoryEntry.ColorFlag:X})");
|
||||
Console.WriteLine($" Left sibling ID: {directoryEntry.LeftSiblingID} (0x{directoryEntry.LeftSiblingID:X})");
|
||||
Console.WriteLine($" Right sibling ID: {directoryEntry.RightSiblingID} (0x{directoryEntry.RightSiblingID:X})");
|
||||
Console.WriteLine($" Child ID: {directoryEntry.ChildID} (0x{directoryEntry.ChildID:X})");
|
||||
Console.WriteLine($" CLSID: {directoryEntry.CLSID}");
|
||||
Console.WriteLine($" State bits: {directoryEntry.StateBits} (0x{directoryEntry.StateBits:X})");
|
||||
Console.WriteLine($" Creation time: {directoryEntry.CreationTime} (0x{directoryEntry.CreationTime:X})");
|
||||
Console.WriteLine($" Modification time: {directoryEntry.ModifiedTime} (0x{directoryEntry.ModifiedTime:X})");
|
||||
Console.WriteLine($" Staring sector location: {directoryEntry.StartingSectorLocation} (0x{directoryEntry.StartingSectorLocation:X})");
|
||||
Console.WriteLine($" Stream size: {directoryEntry.StreamSize} (0x{directoryEntry.StreamSize:X})");
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine($" Name: {directoryEntry.Name}");
|
||||
builder.AppendLine($" Name length: {directoryEntry.NameLength} (0x{directoryEntry.NameLength:X})");
|
||||
builder.AppendLine($" Object type: {directoryEntry.ObjectType} (0x{directoryEntry.ObjectType:X})");
|
||||
builder.AppendLine($" Color flag: {directoryEntry.ColorFlag} (0x{directoryEntry.ColorFlag:X})");
|
||||
builder.AppendLine($" Left sibling ID: {directoryEntry.LeftSiblingID} (0x{directoryEntry.LeftSiblingID:X})");
|
||||
builder.AppendLine($" Right sibling ID: {directoryEntry.RightSiblingID} (0x{directoryEntry.RightSiblingID:X})");
|
||||
builder.AppendLine($" Child ID: {directoryEntry.ChildID} (0x{directoryEntry.ChildID:X})");
|
||||
builder.AppendLine($" CLSID: {directoryEntry.CLSID}");
|
||||
builder.AppendLine($" State bits: {directoryEntry.StateBits} (0x{directoryEntry.StateBits:X})");
|
||||
builder.AppendLine($" Creation time: {directoryEntry.CreationTime} (0x{directoryEntry.CreationTime:X})");
|
||||
builder.AppendLine($" Modification time: {directoryEntry.ModifiedTime} (0x{directoryEntry.ModifiedTime:X})");
|
||||
builder.AppendLine($" Staring sector location: {directoryEntry.StartingSectorLocation} (0x{directoryEntry.StartingSectorLocation:X})");
|
||||
builder.AppendLine($" Stream size: {directoryEntry.StreamSize} (0x{directoryEntry.StreamSize:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -318,49 +319,55 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("CIA Archive Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintCertificateChain();
|
||||
PrintTicket();
|
||||
PrintTitleMetadata();
|
||||
PrintPartitions();
|
||||
PrintMetaData();
|
||||
builder.AppendLine("CIA Archive Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintCertificateChain(builder);
|
||||
PrintTicket(builder);
|
||||
PrintTitleMetadata(builder);
|
||||
PrintPartitions(builder);
|
||||
PrintMetaData(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print CIA header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" CIA Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Header size: {HeaderSize} (0x{HeaderSize:X})");
|
||||
Console.WriteLine($" Type: {Type} (0x{Type:X})");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine($" Certificate chain size: {CertificateChainSize} (0x{CertificateChainSize:X})");
|
||||
Console.WriteLine($" Ticket size: {TicketSize} (0x{TicketSize:X})");
|
||||
Console.WriteLine($" TMD file size: {TMDFileSize} (0x{TMDFileSize:X})");
|
||||
Console.WriteLine($" Meta size: {MetaSize} (0x{MetaSize:X})");
|
||||
Console.WriteLine($" Content size: {ContentSize} (0x{ContentSize:X})");
|
||||
Console.WriteLine($" Content index: {BitConverter.ToString(ContentIndex).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" CIA Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Header size: {HeaderSize} (0x{HeaderSize:X})");
|
||||
builder.AppendLine($" Type: {Type} (0x{Type:X})");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine($" Certificate chain size: {CertificateChainSize} (0x{CertificateChainSize:X})");
|
||||
builder.AppendLine($" Ticket size: {TicketSize} (0x{TicketSize:X})");
|
||||
builder.AppendLine($" TMD file size: {TMDFileSize} (0x{TMDFileSize:X})");
|
||||
builder.AppendLine($" Meta size: {MetaSize} (0x{MetaSize:X})");
|
||||
builder.AppendLine($" Content size: {ContentSize} (0x{ContentSize:X})");
|
||||
builder.AppendLine($" Content index: {BitConverter.ToString(ContentIndex).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print NCCH partition header information
|
||||
/// </summary>
|
||||
private void PrintCertificateChain()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintCertificateChain(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Certificate Chain Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Certificate Chain Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (CertificateChain == null || CertificateChain.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No certificates, expected 3");
|
||||
builder.AppendLine(" No certificates, expected 3");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -376,80 +383,81 @@ namespace BurnOutSharp.Wrappers
|
||||
case 2: certificateName = " (TMD)"; break;
|
||||
}
|
||||
|
||||
Console.WriteLine($" Certificate {i}{certificateName}");
|
||||
Console.WriteLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
Console.WriteLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
Console.WriteLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
Console.WriteLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
Console.WriteLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
builder.AppendLine($" Certificate {i}{certificateName}");
|
||||
builder.AppendLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
builder.AppendLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
builder.AppendLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
builder.AppendLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
builder.AppendLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
switch (certificate.KeyType)
|
||||
{
|
||||
case Models.N3DS.PublicKeyType.RSA_4096:
|
||||
case Models.N3DS.PublicKeyType.RSA_2048:
|
||||
Console.WriteLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
case Models.N3DS.PublicKeyType.EllipticCurve:
|
||||
Console.WriteLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print ticket information
|
||||
/// </summary>
|
||||
private void PrintTicket()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintTicket(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Ticket Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature type: {T_SignatureType} (0x{T_SignatureType:X})");
|
||||
Console.WriteLine($" Signature size: {T_SignatureSize} (0x{T_SignatureSize:X})");
|
||||
Console.WriteLine($" Padding size: {T_PaddingSize} (0x{T_PaddingSize:X})");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(T_Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(T_Padding).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Issuer: {T_Issuer ?? "[NULL]"}");
|
||||
Console.WriteLine($" ECC public key: {BitConverter.ToString(T_ECCPublicKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Version: {T_Version} (0x{T_Version:X})");
|
||||
Console.WriteLine($" CaCrlVersion: {T_CaCrlVersion} (0x{T_CaCrlVersion:X})");
|
||||
Console.WriteLine($" SignerCrlVersion: {T_SignerCrlVersion} (0x{T_SignerCrlVersion:X})");
|
||||
Console.WriteLine($" Title key: {BitConverter.ToString(T_TitleKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 1: {T_Reserved1} (0x{T_Reserved1:X})");
|
||||
Console.WriteLine($" Ticket ID: {T_TicketID} (0x{T_TicketID:X})");
|
||||
Console.WriteLine($" Console ID: {T_ConsoleID} (0x{T_ConsoleID:X})");
|
||||
Console.WriteLine($" Title ID {T_TitleID} (0x{T_TitleID:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(T_Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Ticket title version: {T_TicketTitleVersion} (0x{T_TicketTitleVersion:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(T_Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" License type: {T_LicenseType} (0x{T_LicenseType:X})");
|
||||
Console.WriteLine($" Common keY index: {T_CommonKeyYIndex} (0x{T_CommonKeyYIndex:X})");
|
||||
Console.WriteLine($" Reserved 4: {BitConverter.ToString(T_Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine($" eShop Account ID?: {T_eShopAccountID} (0x{T_eShopAccountID:X})");
|
||||
Console.WriteLine($" Reserved 5: {T_Reserved5} (0x{T_Reserved5:X})");
|
||||
Console.WriteLine($" Audit: {T_Audit} (0x{T_Audit:X})");
|
||||
Console.WriteLine($" Reserved 6: {BitConverter.ToString(T_Reserved6).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Limits:");
|
||||
builder.AppendLine(" Ticket Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature type: {T_SignatureType} (0x{T_SignatureType:X})");
|
||||
builder.AppendLine($" Signature size: {T_SignatureSize} (0x{T_SignatureSize:X})");
|
||||
builder.AppendLine($" Padding size: {T_PaddingSize} (0x{T_PaddingSize:X})");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(T_Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(T_Padding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Issuer: {T_Issuer ?? "[NULL]"}");
|
||||
builder.AppendLine($" ECC public key: {BitConverter.ToString(T_ECCPublicKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Version: {T_Version} (0x{T_Version:X})");
|
||||
builder.AppendLine($" CaCrlVersion: {T_CaCrlVersion} (0x{T_CaCrlVersion:X})");
|
||||
builder.AppendLine($" SignerCrlVersion: {T_SignerCrlVersion} (0x{T_SignerCrlVersion:X})");
|
||||
builder.AppendLine($" Title key: {BitConverter.ToString(T_TitleKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 1: {T_Reserved1} (0x{T_Reserved1:X})");
|
||||
builder.AppendLine($" Ticket ID: {T_TicketID} (0x{T_TicketID:X})");
|
||||
builder.AppendLine($" Console ID: {T_ConsoleID} (0x{T_ConsoleID:X})");
|
||||
builder.AppendLine($" Title ID {T_TitleID} (0x{T_TitleID:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(T_Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Ticket title version: {T_TicketTitleVersion} (0x{T_TicketTitleVersion:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(T_Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" License type: {T_LicenseType} (0x{T_LicenseType:X})");
|
||||
builder.AppendLine($" Common keY index: {T_CommonKeyYIndex} (0x{T_CommonKeyYIndex:X})");
|
||||
builder.AppendLine($" Reserved 4: {BitConverter.ToString(T_Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine($" eShop Account ID?: {T_eShopAccountID} (0x{T_eShopAccountID:X})");
|
||||
builder.AppendLine($" Reserved 5: {T_Reserved5} (0x{T_Reserved5:X})");
|
||||
builder.AppendLine($" Audit: {T_Audit} (0x{T_Audit:X})");
|
||||
builder.AppendLine($" Reserved 6: {BitConverter.ToString(T_Reserved6).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Limits:");
|
||||
for (int i = 0; i < T_Limits.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Limit {i}: {T_Limits[i]} (0x{T_Limits[i]:X})");
|
||||
builder.AppendLine($" Limit {i}: {T_Limits[i]} (0x{T_Limits[i]:X})");
|
||||
}
|
||||
Console.WriteLine($" Content index size: {T_ContentIndexSize} (0x{T_ContentIndexSize:X})");
|
||||
Console.WriteLine($" Content index: {BitConverter.ToString(T_ContentIndex).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine($" Content index size: {T_ContentIndexSize} (0x{T_ContentIndexSize:X})");
|
||||
builder.AppendLine($" Content index: {BitConverter.ToString(T_ContentIndex).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Ticket Certificate Chain Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Ticket Certificate Chain Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (T_CertificateChain == null || T_CertificateChain.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No certificates, expected 2");
|
||||
builder.AppendLine(" No certificates, expected 2");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -464,113 +472,114 @@ namespace BurnOutSharp.Wrappers
|
||||
case 1: certificateName = " (CA)"; break;
|
||||
}
|
||||
|
||||
Console.WriteLine($" Certificate {i}{certificateName}");
|
||||
Console.WriteLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
Console.WriteLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
Console.WriteLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
Console.WriteLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
Console.WriteLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
builder.AppendLine($" Certificate {i}{certificateName}");
|
||||
builder.AppendLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
builder.AppendLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
builder.AppendLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
builder.AppendLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
builder.AppendLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
switch (certificate.KeyType)
|
||||
{
|
||||
case Models.N3DS.PublicKeyType.RSA_4096:
|
||||
case Models.N3DS.PublicKeyType.RSA_2048:
|
||||
Console.WriteLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
case Models.N3DS.PublicKeyType.EllipticCurve:
|
||||
Console.WriteLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print title metadata information
|
||||
/// </summary>
|
||||
private void PrintTitleMetadata()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintTitleMetadata(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Title Metadata Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature type: {TMD_SignatureType} (0x{TMD_SignatureType:X})");
|
||||
Console.WriteLine($" Signature size: {TMD_SignatureSize} (0x{TMD_SignatureSize:X})");
|
||||
Console.WriteLine($" Padding size: {TMD_PaddingSize} (0x{TMD_PaddingSize:X})");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(TMD_Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding 1: {BitConverter.ToString(TMD_Padding1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Issuer: {TMD_Issuer ?? "[NULL]"}");
|
||||
Console.WriteLine($" Version: {TMD_Version} (0x{TMD_Version:X})");
|
||||
Console.WriteLine($" CaCrlVersion: {TMD_CaCrlVersion} (0x{TMD_CaCrlVersion:X})");
|
||||
Console.WriteLine($" SignerCrlVersion: {TMD_SignerCrlVersion} (0x{TMD_SignerCrlVersion:X})");
|
||||
Console.WriteLine($" Reserved 1: {TMD_Reserved1} (0x{TMD_Reserved1:X})");
|
||||
Console.WriteLine($" System version: {TMD_SystemVersion} (0x{TMD_SystemVersion:X})");
|
||||
Console.WriteLine($" Title ID: {TMD_TitleID} (0x{TMD_TitleID:X})");
|
||||
Console.WriteLine($" Title type: {TMD_TitleType} (0x{TMD_TitleType:X})");
|
||||
Console.WriteLine($" Group ID: {TMD_GroupID} (0x{TMD_GroupID:X})");
|
||||
Console.WriteLine($" Save data size: {TMD_SaveDataSize} (0x{TMD_SaveDataSize:X})");
|
||||
Console.WriteLine($" SRL private save data size: {TMD_SRLPrivateSaveDataSize} (0x{TMD_SRLPrivateSaveDataSize:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(TMD_Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" SRL flag: {TMD_SRLFlag} (0x{TMD_SRLFlag:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(TMD_Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Access rights: {TMD_AccessRights} (0x{TMD_AccessRights:X})");
|
||||
Console.WriteLine($" Title version: {TMD_TitleVersion} (0x{TMD_TitleVersion:X})");
|
||||
Console.WriteLine($" Content count: {TMD_ContentCount} (0x{TMD_ContentCount:X})");
|
||||
Console.WriteLine($" Boot content: {TMD_BootContent} (0x{TMD_BootContent:X})");
|
||||
Console.WriteLine($" Padding 2: {BitConverter.ToString(TMD_Padding2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" SHA-256 hash of the content info records: {BitConverter.ToString(TMD_SHA256HashContentInfoRecords).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Title Metadata Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature type: {TMD_SignatureType} (0x{TMD_SignatureType:X})");
|
||||
builder.AppendLine($" Signature size: {TMD_SignatureSize} (0x{TMD_SignatureSize:X})");
|
||||
builder.AppendLine($" Padding size: {TMD_PaddingSize} (0x{TMD_PaddingSize:X})");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(TMD_Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding 1: {BitConverter.ToString(TMD_Padding1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Issuer: {TMD_Issuer ?? "[NULL]"}");
|
||||
builder.AppendLine($" Version: {TMD_Version} (0x{TMD_Version:X})");
|
||||
builder.AppendLine($" CaCrlVersion: {TMD_CaCrlVersion} (0x{TMD_CaCrlVersion:X})");
|
||||
builder.AppendLine($" SignerCrlVersion: {TMD_SignerCrlVersion} (0x{TMD_SignerCrlVersion:X})");
|
||||
builder.AppendLine($" Reserved 1: {TMD_Reserved1} (0x{TMD_Reserved1:X})");
|
||||
builder.AppendLine($" System version: {TMD_SystemVersion} (0x{TMD_SystemVersion:X})");
|
||||
builder.AppendLine($" Title ID: {TMD_TitleID} (0x{TMD_TitleID:X})");
|
||||
builder.AppendLine($" Title type: {TMD_TitleType} (0x{TMD_TitleType:X})");
|
||||
builder.AppendLine($" Group ID: {TMD_GroupID} (0x{TMD_GroupID:X})");
|
||||
builder.AppendLine($" Save data size: {TMD_SaveDataSize} (0x{TMD_SaveDataSize:X})");
|
||||
builder.AppendLine($" SRL private save data size: {TMD_SRLPrivateSaveDataSize} (0x{TMD_SRLPrivateSaveDataSize:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(TMD_Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" SRL flag: {TMD_SRLFlag} (0x{TMD_SRLFlag:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(TMD_Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Access rights: {TMD_AccessRights} (0x{TMD_AccessRights:X})");
|
||||
builder.AppendLine($" Title version: {TMD_TitleVersion} (0x{TMD_TitleVersion:X})");
|
||||
builder.AppendLine($" Content count: {TMD_ContentCount} (0x{TMD_ContentCount:X})");
|
||||
builder.AppendLine($" Boot content: {TMD_BootContent} (0x{TMD_BootContent:X})");
|
||||
builder.AppendLine($" Padding 2: {BitConverter.ToString(TMD_Padding2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" SHA-256 hash of the content info records: {BitConverter.ToString(TMD_SHA256HashContentInfoRecords).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Ticket Content Info Records Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Ticket Content Info Records Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (TMD_ContentInfoRecords == null || TMD_ContentInfoRecords.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No content info records, expected 64");
|
||||
builder.AppendLine(" No content info records, expected 64");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < TMD_ContentInfoRecords.Length; i++)
|
||||
{
|
||||
var contentInfoRecord = TMD_ContentInfoRecords[i];
|
||||
Console.WriteLine($" Content Info Record {i}");
|
||||
Console.WriteLine($" Content index offset: {contentInfoRecord.ContentIndexOffset} (0x{contentInfoRecord.ContentIndexOffset:X})");
|
||||
Console.WriteLine($" Content command count: {contentInfoRecord.ContentCommandCount} (0x{contentInfoRecord.ContentCommandCount:X})");
|
||||
Console.WriteLine($" SHA-256 hash of the next {contentInfoRecord.ContentCommandCount} records not hashed: {BitConverter.ToString(contentInfoRecord.UnhashedContentRecordsSHA256Hash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Content Info Record {i}");
|
||||
builder.AppendLine($" Content index offset: {contentInfoRecord.ContentIndexOffset} (0x{contentInfoRecord.ContentIndexOffset:X})");
|
||||
builder.AppendLine($" Content command count: {contentInfoRecord.ContentCommandCount} (0x{contentInfoRecord.ContentCommandCount:X})");
|
||||
builder.AppendLine($" SHA-256 hash of the next {contentInfoRecord.ContentCommandCount} records not hashed: {BitConverter.ToString(contentInfoRecord.UnhashedContentRecordsSHA256Hash).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Ticket Content Chunk Records Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Ticket Content Chunk Records Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (TMD_ContentChunkRecords == null || TMD_ContentChunkRecords.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No content chunk records, expected {TMD_ContentCount}");
|
||||
builder.AppendLine($" No content chunk records, expected {TMD_ContentCount}");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < TMD_ContentChunkRecords.Length; i++)
|
||||
{
|
||||
var contentChunkRecord = TMD_ContentChunkRecords[i];
|
||||
Console.WriteLine($" Content Chunk Record {i}");
|
||||
Console.WriteLine($" Content ID: {contentChunkRecord.ContentId} (0x{contentChunkRecord.ContentId:X})");
|
||||
Console.WriteLine($" Content index: {contentChunkRecord.ContentIndex} (0x{contentChunkRecord.ContentIndex:X})");
|
||||
Console.WriteLine($" Content type: {contentChunkRecord.ContentType} (0x{contentChunkRecord.ContentType:X})");
|
||||
Console.WriteLine($" Content size: {contentChunkRecord.ContentSize} (0x{contentChunkRecord.ContentSize:X})");
|
||||
Console.WriteLine($" SHA-256 hash: {BitConverter.ToString(contentChunkRecord.SHA256Hash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Content Chunk Record {i}");
|
||||
builder.AppendLine($" Content ID: {contentChunkRecord.ContentId} (0x{contentChunkRecord.ContentId:X})");
|
||||
builder.AppendLine($" Content index: {contentChunkRecord.ContentIndex} (0x{contentChunkRecord.ContentIndex:X})");
|
||||
builder.AppendLine($" Content type: {contentChunkRecord.ContentType} (0x{contentChunkRecord.ContentType:X})");
|
||||
builder.AppendLine($" Content size: {contentChunkRecord.ContentSize} (0x{contentChunkRecord.ContentSize:X})");
|
||||
builder.AppendLine($" SHA-256 hash: {BitConverter.ToString(contentChunkRecord.SHA256Hash).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Ticket Certificate Chain Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Ticket Certificate Chain Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (TMD_CertificateChain == null || TMD_CertificateChain.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No certificates, expected 2");
|
||||
builder.AppendLine(" No certificates, expected 2");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -585,124 +594,126 @@ namespace BurnOutSharp.Wrappers
|
||||
case 1: certificateName = " (CA)"; break;
|
||||
}
|
||||
|
||||
Console.WriteLine($" Certificate {i}{certificateName}");
|
||||
Console.WriteLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
Console.WriteLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
Console.WriteLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
Console.WriteLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
Console.WriteLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
builder.AppendLine($" Certificate {i}{certificateName}");
|
||||
builder.AppendLine($" Signature type: {certificate.SignatureType} (0x{certificate.SignatureType:X})");
|
||||
builder.AppendLine($" Signature size: {certificate.SignatureSize} (0x{certificate.SignatureSize:X})");
|
||||
builder.AppendLine($" Padding size: {certificate.PaddingSize} (0x{certificate.PaddingSize:X})");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(certificate.Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.Padding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Issuer: {certificate.Issuer ?? "[NULL]"}");
|
||||
builder.AppendLine($" Key type: {certificate.KeyType} (0x{certificate.KeyType:X})");
|
||||
builder.AppendLine($" Name: {certificate.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Expiration time: {certificate.ExpirationTime} (0x{certificate.ExpirationTime:X})");
|
||||
switch (certificate.KeyType)
|
||||
{
|
||||
case Models.N3DS.PublicKeyType.RSA_4096:
|
||||
case Models.N3DS.PublicKeyType.RSA_2048:
|
||||
Console.WriteLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Modulus: {BitConverter.ToString(certificate.RSAModulus).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public exponent: {certificate.RSAPublicExponent} (0x{certificate.RSAPublicExponent:X})");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.RSAPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
case Models.N3DS.PublicKeyType.EllipticCurve:
|
||||
Console.WriteLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Public key: {BitConverter.ToString(certificate.ECCPublicKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Padding: {BitConverter.ToString(certificate.ECCPadding).Replace('-', ' ')}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print NCCH partition header information
|
||||
/// </summary>
|
||||
private void PrintPartitions()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintPartitions(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" NCCH Partition Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Partitions == null || Partitions.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No NCCH partition headers");
|
||||
builder.AppendLine(" No NCCH partition headers");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Partitions.Length; i++)
|
||||
{
|
||||
var partitionHeader = Partitions[i];
|
||||
Console.WriteLine($" NCCH Partition Header {i}");
|
||||
builder.AppendLine($" NCCH Partition Header {i}");
|
||||
if (partitionHeader.MagicID == string.Empty)
|
||||
{
|
||||
Console.WriteLine($" Empty partition, no data can be parsed");
|
||||
builder.AppendLine($" Empty partition, no data can be parsed");
|
||||
}
|
||||
else if (partitionHeader.MagicID != Models.N3DS.Constants.NCCHMagicNumber)
|
||||
{
|
||||
Console.WriteLine($" Unrecognized partition data, no data can be parsed");
|
||||
builder.AppendLine($" Unrecognized partition data, no data can be parsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(partitionHeader.RSA2048Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Magic ID: {partitionHeader.MagicID} (0x{partitionHeader.MagicID:X})");
|
||||
Console.WriteLine($" Content size in media units: {partitionHeader.ContentSizeInMediaUnits} (0x{partitionHeader.ContentSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Partition ID: {partitionHeader.PartitionId} (0x{partitionHeader.PartitionId:X})");
|
||||
Console.WriteLine($" Maker code: {partitionHeader.MakerCode} (0x{partitionHeader.MakerCode:X})");
|
||||
Console.WriteLine($" Version: {partitionHeader.Version} (0x{partitionHeader.Version:X})");
|
||||
Console.WriteLine($" Verification hash: {partitionHeader.VerificationHash} (0x{partitionHeader.VerificationHash:X})");
|
||||
Console.WriteLine($" Program ID: {BitConverter.ToString(partitionHeader.ProgramId).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(partitionHeader.Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Logo region SHA-256 hash: {BitConverter.ToString(partitionHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Product code: {partitionHeader.ProductCode} (0x{partitionHeader.ProductCode:X})");
|
||||
Console.WriteLine($" Extended header SHA-256 hash: {BitConverter.ToString(partitionHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Extended header size in bytes: {partitionHeader.ExtendedHeaderSizeInBytes} (0x{partitionHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(partitionHeader.Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine(" Flags:");
|
||||
Console.WriteLine($" Reserved 0: {partitionHeader.Flags.Reserved0} (0x{partitionHeader.Flags.Reserved0:X})");
|
||||
Console.WriteLine($" Reserved 1: {partitionHeader.Flags.Reserved1} (0x{partitionHeader.Flags.Reserved1:X})");
|
||||
Console.WriteLine($" Reserved 2: {partitionHeader.Flags.Reserved2} (0x{partitionHeader.Flags.Reserved2:X})");
|
||||
Console.WriteLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
|
||||
Console.WriteLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
|
||||
Console.WriteLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
|
||||
Console.WriteLine($" Content unit size: {partitionHeader.Flags.ContentUnitSize} (0x{partitionHeader.Flags.ContentUnitSize:X})");
|
||||
Console.WriteLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
|
||||
Console.WriteLine($" Plain region offset, in media units: {partitionHeader.PlainRegionOffsetInMediaUnits} (0x{partitionHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Plain region size, in media units: {partitionHeader.PlainRegionSizeInMediaUnits} (0x{partitionHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region offset, in media units: {partitionHeader.LogoRegionOffsetInMediaUnits} (0x{partitionHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region size, in media units: {partitionHeader.LogoRegionSizeInMediaUnits} (0x{partitionHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS offset, in media units: {partitionHeader.ExeFSOffsetInMediaUnits} (0x{partitionHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS size, in media units: {partitionHeader.ExeFSSizeInMediaUnits} (0x{partitionHeader.ExeFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS hash region size, in media units: {partitionHeader.ExeFSHashRegionSizeInMediaUnits} (0x{partitionHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(partitionHeader.Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS offset, in media units: {partitionHeader.RomFSOffsetInMediaUnits} (0x{partitionHeader.RomFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS size, in media units: {partitionHeader.RomFSSizeInMediaUnits} (0x{partitionHeader.RomFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS hash region size, in media units: {partitionHeader.RomFSHashRegionSizeInMediaUnits} (0x{partitionHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 4: {BitConverter.ToString(partitionHeader.Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(partitionHeader.RSA2048Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Magic ID: {partitionHeader.MagicID} (0x{partitionHeader.MagicID:X})");
|
||||
builder.AppendLine($" Content size in media units: {partitionHeader.ContentSizeInMediaUnits} (0x{partitionHeader.ContentSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Partition ID: {partitionHeader.PartitionId} (0x{partitionHeader.PartitionId:X})");
|
||||
builder.AppendLine($" Maker code: {partitionHeader.MakerCode} (0x{partitionHeader.MakerCode:X})");
|
||||
builder.AppendLine($" Version: {partitionHeader.Version} (0x{partitionHeader.Version:X})");
|
||||
builder.AppendLine($" Verification hash: {partitionHeader.VerificationHash} (0x{partitionHeader.VerificationHash:X})");
|
||||
builder.AppendLine($" Program ID: {BitConverter.ToString(partitionHeader.ProgramId).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(partitionHeader.Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Logo region SHA-256 hash: {BitConverter.ToString(partitionHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Product code: {partitionHeader.ProductCode} (0x{partitionHeader.ProductCode:X})");
|
||||
builder.AppendLine($" Extended header SHA-256 hash: {BitConverter.ToString(partitionHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Extended header size in bytes: {partitionHeader.ExtendedHeaderSizeInBytes} (0x{partitionHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(partitionHeader.Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine(" Flags:");
|
||||
builder.AppendLine($" Reserved 0: {partitionHeader.Flags.Reserved0} (0x{partitionHeader.Flags.Reserved0:X})");
|
||||
builder.AppendLine($" Reserved 1: {partitionHeader.Flags.Reserved1} (0x{partitionHeader.Flags.Reserved1:X})");
|
||||
builder.AppendLine($" Reserved 2: {partitionHeader.Flags.Reserved2} (0x{partitionHeader.Flags.Reserved2:X})");
|
||||
builder.AppendLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
|
||||
builder.AppendLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
|
||||
builder.AppendLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
|
||||
builder.AppendLine($" Content unit size: {partitionHeader.Flags.ContentUnitSize} (0x{partitionHeader.Flags.ContentUnitSize:X})");
|
||||
builder.AppendLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
|
||||
builder.AppendLine($" Plain region offset, in media units: {partitionHeader.PlainRegionOffsetInMediaUnits} (0x{partitionHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Plain region size, in media units: {partitionHeader.PlainRegionSizeInMediaUnits} (0x{partitionHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region offset, in media units: {partitionHeader.LogoRegionOffsetInMediaUnits} (0x{partitionHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region size, in media units: {partitionHeader.LogoRegionSizeInMediaUnits} (0x{partitionHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS offset, in media units: {partitionHeader.ExeFSOffsetInMediaUnits} (0x{partitionHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS size, in media units: {partitionHeader.ExeFSSizeInMediaUnits} (0x{partitionHeader.ExeFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS hash region size, in media units: {partitionHeader.ExeFSHashRegionSizeInMediaUnits} (0x{partitionHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(partitionHeader.Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS offset, in media units: {partitionHeader.RomFSOffsetInMediaUnits} (0x{partitionHeader.RomFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS size, in media units: {partitionHeader.RomFSSizeInMediaUnits} (0x{partitionHeader.RomFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS hash region size, in media units: {partitionHeader.RomFSHashRegionSizeInMediaUnits} (0x{partitionHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 4: {BitConverter.ToString(partitionHeader.Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print metadata information
|
||||
/// </summary>
|
||||
private void PrintMetaData()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintMetaData(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Meta Data Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Meta Data Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_cia.MetaData == null || MetaSize == 0)
|
||||
{
|
||||
Console.WriteLine(value: " No meta file data");
|
||||
builder.AppendLine(value: " No meta file data");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(value: $" Title ID dependency list: {BitConverter.ToString(MD_TitleIDDependencyList).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(MD_Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Core version: {MD_CoreVersion} (0x{MD_CoreVersion:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(MD_Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Icon data: {BitConverter.ToString(MD_IconData).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Title ID dependency list: {BitConverter.ToString(MD_TitleIDDependencyList).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(MD_Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Core version: {MD_CoreVersion} (0x{MD_CoreVersion:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(MD_Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Icon data: {BitConverter.ToString(MD_IconData).Replace('-', ' ')}");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -469,474 +470,498 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("GCF Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("GCF Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Header
|
||||
PrintHeader();
|
||||
PrintHeader(builder);
|
||||
|
||||
// Block Entries
|
||||
PrintBlockEntryHeader();
|
||||
PrintBlockEntries();
|
||||
PrintBlockEntryHeader(builder);
|
||||
PrintBlockEntries(builder);
|
||||
|
||||
// Fragmentation Maps
|
||||
PrintFragmentationMapHeader();
|
||||
PrintFragmentationMaps();
|
||||
PrintFragmentationMapHeader(builder);
|
||||
PrintFragmentationMaps(builder);
|
||||
|
||||
// Block Entry Maps
|
||||
PrintBlockEntryMapHeader();
|
||||
PrintBlockEntryMaps();
|
||||
PrintBlockEntryMapHeader(builder);
|
||||
PrintBlockEntryMaps(builder);
|
||||
|
||||
// Directory and Directory Maps
|
||||
PrintDirectoryHeader();
|
||||
PrintDirectoryEntries();
|
||||
PrintDirectoryHeader(builder);
|
||||
PrintDirectoryEntries(builder);
|
||||
// TODO: Should we print out the entire string table?
|
||||
PrintDirectoryInfo1Entries();
|
||||
PrintDirectoryInfo2Entries();
|
||||
PrintDirectoryCopyEntries();
|
||||
PrintDirectoryLocalEntries();
|
||||
PrintDirectoryMapHeader();
|
||||
PrintDirectoryMapEntries();
|
||||
PrintDirectoryInfo1Entries(builder);
|
||||
PrintDirectoryInfo2Entries(builder);
|
||||
PrintDirectoryCopyEntries(builder);
|
||||
PrintDirectoryLocalEntries(builder);
|
||||
PrintDirectoryMapHeader(builder);
|
||||
PrintDirectoryMapEntries(builder);
|
||||
|
||||
// Checksums and Checksum Maps
|
||||
PrintChecksumHeader();
|
||||
PrintChecksumMapHeader();
|
||||
PrintChecksumMapEntries();
|
||||
PrintChecksumEntries();
|
||||
PrintChecksumHeader(builder);
|
||||
PrintChecksumMapHeader(builder);
|
||||
PrintChecksumMapEntries(builder);
|
||||
PrintChecksumEntries(builder);
|
||||
|
||||
// Data Blocks
|
||||
PrintDataBlockHeader();
|
||||
PrintDataBlockHeader(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
|
||||
Console.WriteLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
Console.WriteLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
Console.WriteLine($" Cache ID: {CacheID} (0x{CacheID:X})");
|
||||
Console.WriteLine($" Last version played: {LastVersionPlayed} (0x{LastVersionPlayed:X})");
|
||||
Console.WriteLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
|
||||
Console.WriteLine($" Dummy 2: {Dummy2} (0x{Dummy2:X})");
|
||||
Console.WriteLine($" File size: {FileSize} (0x{FileSize:X})");
|
||||
Console.WriteLine($" Block size: {BlockSize} (0x{BlockSize:X})");
|
||||
Console.WriteLine($" Block count: {BlockCount} (0x{BlockCount:X})");
|
||||
Console.WriteLine($" Dummy 3: {Dummy3} (0x{Dummy3:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print block entry header information
|
||||
/// </summary>
|
||||
private void PrintBlockEntryHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintBlockEntryHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Block Entry Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Block count: {BEH_BlockCount} (0x{BEH_BlockCount:X})");
|
||||
Console.WriteLine($" Blocks used: {BEH_BlocksUsed} (0x{BEH_BlocksUsed:X})");
|
||||
Console.WriteLine($" Dummy 0: {BEH_Dummy0} (0x{BEH_Dummy0:X})");
|
||||
Console.WriteLine($" Dummy 1: {BEH_Dummy1} (0x{BEH_Dummy1:X})");
|
||||
Console.WriteLine($" Dummy 2: {BEH_Dummy2} (0x{BEH_Dummy2:X})");
|
||||
Console.WriteLine($" Dummy 3: {BEH_Dummy3} (0x{BEH_Dummy3:X})");
|
||||
Console.WriteLine($" Dummy 4: {BEH_Dummy4} (0x{BEH_Dummy4:X})");
|
||||
Console.WriteLine($" Checksum: {BEH_Checksum} (0x{BEH_Checksum:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print block entries information
|
||||
/// </summary>
|
||||
private void PrintBlockEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintBlockEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Block Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Block Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (BlockEntries == null || BlockEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No block entries");
|
||||
builder.AppendLine(" No block entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < BlockEntries.Length; i++)
|
||||
{
|
||||
var blockEntry = BlockEntries[i];
|
||||
Console.WriteLine($" Block Entry {i}");
|
||||
Console.WriteLine($" Entry flags: {blockEntry.EntryFlags} (0x{blockEntry.EntryFlags:X})");
|
||||
Console.WriteLine($" File data offset: {blockEntry.FileDataOffset} (0x{blockEntry.FileDataOffset:X})");
|
||||
Console.WriteLine($" File data size: {blockEntry.FileDataSize} (0x{blockEntry.FileDataSize:X})");
|
||||
Console.WriteLine($" First data block index: {blockEntry.FirstDataBlockIndex} (0x{blockEntry.FirstDataBlockIndex:X})");
|
||||
Console.WriteLine($" Next block entry index: {blockEntry.NextBlockEntryIndex} (0x{blockEntry.NextBlockEntryIndex:X})");
|
||||
Console.WriteLine($" Previous block entry index: {blockEntry.PreviousBlockEntryIndex} (0x{blockEntry.PreviousBlockEntryIndex:X})");
|
||||
Console.WriteLine($" Directory index: {blockEntry.DirectoryIndex} (0x{blockEntry.DirectoryIndex:X})");
|
||||
builder.AppendLine($" Block Entry {i}");
|
||||
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})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print fragmentation map header information
|
||||
/// </summary>
|
||||
private void PrintFragmentationMapHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFragmentationMapHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Fragmentation Map Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Block count: {FMH_BlockCount} (0x{FMH_BlockCount:X})");
|
||||
Console.WriteLine($" First unused entry: {FMH_FirstUnusedEntry} (0x{FMH_FirstUnusedEntry:X})");
|
||||
Console.WriteLine($" Terminator: {FMH_Terminator} (0x{FMH_Terminator:X})");
|
||||
Console.WriteLine($" Checksum: {FMH_Checksum} (0x{FMH_Checksum:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print fragmentation maps information
|
||||
/// </summary>
|
||||
private void PrintFragmentationMaps()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFragmentationMaps(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Fragmentation Maps Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Fragmentation Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FragmentationMaps == null || FragmentationMaps.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No fragmentation maps");
|
||||
builder.AppendLine(" No fragmentation maps");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FragmentationMaps.Length; i++)
|
||||
{
|
||||
var fragmentationMap = FragmentationMaps[i];
|
||||
Console.WriteLine($" Fragmentation Map {i}");
|
||||
Console.WriteLine($" Next data block index: {fragmentationMap.NextDataBlockIndex} (0x{fragmentationMap.NextDataBlockIndex:X})");
|
||||
builder.AppendLine($" Fragmentation Map {i}");
|
||||
builder.AppendLine($" Next data block index: {fragmentationMap.NextDataBlockIndex} (0x{fragmentationMap.NextDataBlockIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print block entry map header information
|
||||
/// </summary>
|
||||
private void PrintBlockEntryMapHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintBlockEntryMapHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Block Entry Map Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Block Entry Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_file.BlockEntryMapHeader == null)
|
||||
{
|
||||
Console.WriteLine($" No block entry map header");
|
||||
builder.AppendLine($" No block entry map header");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Block count: {BEMH_BlockCount} (0x{BEMH_BlockCount:X})");
|
||||
Console.WriteLine($" First block entry index: {BEMH_FirstBlockEntryIndex} (0x{BEMH_FirstBlockEntryIndex:X})");
|
||||
Console.WriteLine($" Last block entry index: {BEMH_LastBlockEntryIndex} (0x{BEMH_LastBlockEntryIndex:X})");
|
||||
Console.WriteLine($" Dummy 0: {BEMH_Dummy0} (0x{BEMH_Dummy0:X})");
|
||||
Console.WriteLine($" Checksum: {BEMH_Checksum} (0x{BEMH_Checksum:X})");
|
||||
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})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print block entry maps information
|
||||
/// </summary>
|
||||
private void PrintBlockEntryMaps()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintBlockEntryMaps(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Block Entry Maps Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Block Entry Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (BlockEntryMaps == null || BlockEntryMaps.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No block entry maps");
|
||||
builder.AppendLine(" No block entry maps");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < BlockEntryMaps.Length; i++)
|
||||
{
|
||||
var blockEntryMap = BlockEntryMaps[i];
|
||||
Console.WriteLine($" Block Entry Map {i}");
|
||||
Console.WriteLine($" Previous data block index: {blockEntryMap.PreviousBlockEntryIndex} (0x{blockEntryMap.PreviousBlockEntryIndex:X})");
|
||||
Console.WriteLine($" Next data block index: {blockEntryMap.NextBlockEntryIndex} (0x{blockEntryMap.NextBlockEntryIndex:X})");
|
||||
builder.AppendLine($" Block Entry Map {i}");
|
||||
builder.AppendLine($" Previous data block index: {blockEntryMap.PreviousBlockEntryIndex} (0x{blockEntryMap.PreviousBlockEntryIndex:X})");
|
||||
builder.AppendLine($" Next data block index: {blockEntryMap.NextBlockEntryIndex} (0x{blockEntryMap.NextBlockEntryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory header information
|
||||
/// </summary>
|
||||
private void PrintDirectoryHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {DH_Dummy0} (0x{DH_Dummy0:X})");
|
||||
Console.WriteLine($" Cache ID: {DH_CacheID} (0x{DH_CacheID:X})");
|
||||
Console.WriteLine($" Last version played: {DH_LastVersionPlayed} (0x{DH_LastVersionPlayed:X})");
|
||||
Console.WriteLine($" Item count: {DH_ItemCount} (0x{DH_ItemCount:X})");
|
||||
Console.WriteLine($" File count: {DH_FileCount} (0x{DH_FileCount:X})");
|
||||
Console.WriteLine($" Dummy 1: {DH_Dummy1} (0x{DH_Dummy1:X})");
|
||||
Console.WriteLine($" Directory size: {DH_DirectorySize} (0x{DH_DirectorySize:X})");
|
||||
Console.WriteLine($" Name size: {DH_NameSize} (0x{DH_NameSize:X})");
|
||||
Console.WriteLine($" Info 1 count: {DH_Info1Count} (0x{DH_Info1Count:X})");
|
||||
Console.WriteLine($" Copy count: {DH_CopyCount} (0x{DH_CopyCount:X})");
|
||||
Console.WriteLine($" Local count: {DH_LocalCount} (0x{DH_LocalCount:X})");
|
||||
Console.WriteLine($" Dummy 2: {DH_Dummy2} (0x{DH_Dummy2:X})");
|
||||
Console.WriteLine($" Dummy 3: {DH_Dummy3} (0x{DH_Dummy3:X})");
|
||||
Console.WriteLine($" Checksum: {DH_Checksum} (0x{DH_Checksum:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory entries");
|
||||
builder.AppendLine(" No directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = DirectoryEntries[i];
|
||||
Console.WriteLine($" Directory Entry {i}");
|
||||
Console.WriteLine($" Name offset: {directoryEntry.NameOffset} (0x{directoryEntry.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {directoryEntry.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Item size: {directoryEntry.ItemSize} (0x{directoryEntry.ItemSize:X})");
|
||||
Console.WriteLine($" Checksum index: {directoryEntry.ChecksumIndex} (0x{directoryEntry.ChecksumIndex:X})");
|
||||
Console.WriteLine($" Directory flags: {directoryEntry.DirectoryFlags} (0x{directoryEntry.DirectoryFlags:X})");
|
||||
Console.WriteLine($" Parent index: {directoryEntry.ParentIndex} (0x{directoryEntry.ParentIndex:X})");
|
||||
Console.WriteLine($" Next index: {directoryEntry.NextIndex} (0x{directoryEntry.NextIndex:X})");
|
||||
Console.WriteLine($" First index: {directoryEntry.FirstIndex} (0x{directoryEntry.FirstIndex:X})");
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
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})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 1 entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryInfo1Entries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo1Entries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Info 1 Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo1Entries == null || DirectoryInfo1Entries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory info 1 entries");
|
||||
builder.AppendLine(" No directory info 1 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo1Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo1Entries[i];
|
||||
Console.WriteLine($" Directory Info 1 Entry {i}");
|
||||
Console.WriteLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 2 entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryInfo2Entries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo2Entries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Info 2 Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo2Entries == null || DirectoryInfo2Entries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory info 2 entries");
|
||||
builder.AppendLine(" No directory info 2 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo2Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo2Entries[i];
|
||||
Console.WriteLine($" Directory Info 2 Entry {i}");
|
||||
Console.WriteLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory copy entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryCopyEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryCopyEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Copy Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (DirectoryCopyEntries == null || DirectoryCopyEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory copy entries");
|
||||
builder.AppendLine(" No directory copy entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryCopyEntries.Length; i++)
|
||||
{
|
||||
var directoryCopyEntry = DirectoryCopyEntries[i];
|
||||
Console.WriteLine($" Directory Copy Entry {i}");
|
||||
Console.WriteLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
builder.AppendLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory local entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryLocalEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryLocalEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Local Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (DirectoryLocalEntries == null || DirectoryLocalEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory local entries");
|
||||
builder.AppendLine(" No directory local entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryLocalEntries.Length; i++)
|
||||
{
|
||||
var directoryLocalEntry = DirectoryLocalEntries[i];
|
||||
Console.WriteLine($" Directory Local Entry {i}");
|
||||
Console.WriteLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
builder.AppendLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory map header information
|
||||
/// </summary>
|
||||
private void PrintDirectoryMapHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryMapHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Map Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_file.DirectoryMapHeader == null)
|
||||
{
|
||||
Console.WriteLine($" No directory map header");
|
||||
builder.AppendLine($" No directory map header");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Dummy 0: {DMH_Dummy0} (0x{DMH_Dummy0:X})");
|
||||
Console.WriteLine($" Dummy 1: {DMH_Dummy1} (0x{DMH_Dummy1:X})");
|
||||
builder.AppendLine($" Dummy 0: {DMH_Dummy0} (0x{DMH_Dummy0:X})");
|
||||
builder.AppendLine($" Dummy 1: {DMH_Dummy1} (0x{DMH_Dummy1:X})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory map entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryMapEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryMapEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Map Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Directory Map Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (DirectoryMapEntries == null || DirectoryMapEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory map entries");
|
||||
builder.AppendLine(" No directory map entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryMapEntries.Length; i++)
|
||||
{
|
||||
var directoryMapEntry = DirectoryMapEntries[i];
|
||||
Console.WriteLine($" Directory Map Entry {i}");
|
||||
Console.WriteLine($" First block index: {directoryMapEntry.FirstBlockIndex} (0x{directoryMapEntry.FirstBlockIndex:X})");
|
||||
builder.AppendLine($" Directory Map Entry {i}");
|
||||
builder.AppendLine($" First block index: {directoryMapEntry.FirstBlockIndex} (0x{directoryMapEntry.FirstBlockIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum header information
|
||||
/// </summary>
|
||||
private void PrintChecksumHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {CH_Dummy0} (0x{CH_Dummy0:X})");
|
||||
Console.WriteLine($" Checksum size: {CH_ChecksumSize} (0x{CH_ChecksumSize:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map header information
|
||||
/// </summary>
|
||||
private void PrintChecksumMapHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Map Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {CMH_Dummy0} (0x{CMH_Dummy0:X})");
|
||||
Console.WriteLine($" Dummy 1: {CMH_Dummy1} (0x{CMH_Dummy1:X})");
|
||||
Console.WriteLine($" Item count: {CMH_ItemCount} (0x{CMH_ItemCount:X})");
|
||||
Console.WriteLine($" Checksum count: {CMH_ChecksumCount} (0x{CMH_ChecksumCount:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map entries information
|
||||
/// </summary>
|
||||
private void PrintChecksumMapEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Map Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (ChecksumMapEntries == null || ChecksumMapEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No checksum map entries");
|
||||
builder.AppendLine(" No checksum map entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumMapEntries.Length; i++)
|
||||
{
|
||||
var checksumMapEntry = ChecksumMapEntries[i];
|
||||
Console.WriteLine($" Checksum Map Entry {i}");
|
||||
Console.WriteLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
|
||||
Console.WriteLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
builder.AppendLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
|
||||
builder.AppendLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum entries information
|
||||
/// </summary>
|
||||
private void PrintChecksumEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (ChecksumEntries == null || ChecksumEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No checksum entries");
|
||||
builder.AppendLine(" No checksum entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumEntries.Length; i++)
|
||||
{
|
||||
var checksumEntry = ChecksumEntries[i];
|
||||
Console.WriteLine($" Checksum Entry {i}");
|
||||
Console.WriteLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
builder.AppendLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print data block header information
|
||||
/// </summary>
|
||||
private void PrintDataBlockHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDataBlockHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Data Block Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Last version played: {DBH_LastVersionPlayed} (0x{DBH_LastVersionPlayed:X})");
|
||||
Console.WriteLine($" Block count: {DBH_BlockCount} (0x{DBH_BlockCount:X})");
|
||||
Console.WriteLine($" Block size: {DBH_BlockSize} (0x{DBH_BlockSize:X})");
|
||||
Console.WriteLine($" First block offset: {DBH_FirstBlockOffset} (0x{DBH_FirstBlockOffset:X})");
|
||||
Console.WriteLine($" Blocks used: {DBH_BlocksUsed} (0x{DBH_BlocksUsed:X})");
|
||||
Console.WriteLine($" Checksum: {DBH_Checksum} (0x{DBH_Checksum:X})");
|
||||
Console.WriteLine();
|
||||
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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -348,431 +349,447 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("New Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("New Executable Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Stub
|
||||
PrintStubHeader();
|
||||
PrintStubExtendedHeader();
|
||||
PrintStubHeader(builder);
|
||||
PrintStubExtendedHeader(builder);
|
||||
|
||||
// Information Block
|
||||
PrintInformationBlock();
|
||||
PrintInformationBlock(builder);
|
||||
|
||||
// Tables
|
||||
PrintObjectTable();
|
||||
PrintObjectPageMap();
|
||||
PrintResourceTable();
|
||||
PrintResidentNamesTable();
|
||||
PrintEntryTable();
|
||||
PrintModuleFormatDirectivesTable();
|
||||
PrintVerifyRecordDirectiveTable();
|
||||
PrintFixupPageTable();
|
||||
PrintFixupRecordTable();
|
||||
PrintImportModuleNameTable();
|
||||
PrintImportModuleProcedureNameTable();
|
||||
PrintPerPageChecksumTable();
|
||||
PrintNonResidentNamesTable();
|
||||
PrintObjectTable(builder);
|
||||
PrintObjectPageMap(builder);
|
||||
PrintResourceTable(builder);
|
||||
PrintResidentNamesTable(builder);
|
||||
PrintEntryTable(builder);
|
||||
PrintModuleFormatDirectivesTable(builder);
|
||||
PrintVerifyRecordDirectiveTable(builder);
|
||||
PrintFixupPageTable(builder);
|
||||
PrintFixupRecordTable(builder);
|
||||
PrintImportModuleNameTable(builder);
|
||||
PrintImportModuleProcedureNameTable(builder);
|
||||
PrintPerPageChecksumTable(builder);
|
||||
PrintNonResidentNamesTable(builder);
|
||||
|
||||
// Debug
|
||||
PrintDebugInformation();
|
||||
PrintDebugInformation(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub header information
|
||||
/// </summary>
|
||||
private void PrintStubHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintStubHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {Stub_Magic}");
|
||||
Console.WriteLine($" Last page bytes: {Stub_LastPageBytes} (0x{Stub_LastPageBytes:X})");
|
||||
Console.WriteLine($" Pages: {Stub_Pages} (0x{Stub_Pages:X})");
|
||||
Console.WriteLine($" Relocation items: {Stub_RelocationItems} (0x{Stub_RelocationItems:X})");
|
||||
Console.WriteLine($" Header paragraph size: {Stub_HeaderParagraphSize} (0x{Stub_HeaderParagraphSize:X})");
|
||||
Console.WriteLine($" Minimum extra paragraphs: {Stub_MinimumExtraParagraphs} (0x{Stub_MinimumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Maximum extra paragraphs: {Stub_MaximumExtraParagraphs} (0x{Stub_MaximumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Initial SS value: {Stub_InitialSSValue} (0x{Stub_InitialSSValue:X})");
|
||||
Console.WriteLine($" Initial SP value: {Stub_InitialSPValue} (0x{Stub_InitialSPValue:X})");
|
||||
Console.WriteLine($" Checksum: {Stub_Checksum} (0x{Stub_Checksum:X})");
|
||||
Console.WriteLine($" Initial IP value: {Stub_InitialIPValue} (0x{Stub_InitialIPValue:X})");
|
||||
Console.WriteLine($" Initial CS value: {Stub_InitialCSValue} (0x{Stub_InitialCSValue:X})");
|
||||
Console.WriteLine($" Relocation table address: {Stub_RelocationTableAddr} (0x{Stub_RelocationTableAddr:X})");
|
||||
Console.WriteLine($" Overlay number: {Stub_OverlayNumber} (0x{Stub_OverlayNumber:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic number: {Stub_Magic}");
|
||||
builder.AppendLine($" Last page bytes: {Stub_LastPageBytes} (0x{Stub_LastPageBytes:X})");
|
||||
builder.AppendLine($" Pages: {Stub_Pages} (0x{Stub_Pages:X})");
|
||||
builder.AppendLine($" Relocation items: {Stub_RelocationItems} (0x{Stub_RelocationItems:X})");
|
||||
builder.AppendLine($" Header paragraph size: {Stub_HeaderParagraphSize} (0x{Stub_HeaderParagraphSize:X})");
|
||||
builder.AppendLine($" Minimum extra paragraphs: {Stub_MinimumExtraParagraphs} (0x{Stub_MinimumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Maximum extra paragraphs: {Stub_MaximumExtraParagraphs} (0x{Stub_MaximumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Initial SS value: {Stub_InitialSSValue} (0x{Stub_InitialSSValue:X})");
|
||||
builder.AppendLine($" Initial SP value: {Stub_InitialSPValue} (0x{Stub_InitialSPValue:X})");
|
||||
builder.AppendLine($" Checksum: {Stub_Checksum} (0x{Stub_Checksum:X})");
|
||||
builder.AppendLine($" Initial IP value: {Stub_InitialIPValue} (0x{Stub_InitialIPValue:X})");
|
||||
builder.AppendLine($" Initial CS value: {Stub_InitialCSValue} (0x{Stub_InitialCSValue:X})");
|
||||
builder.AppendLine($" Relocation table address: {Stub_RelocationTableAddr} (0x{Stub_RelocationTableAddr:X})");
|
||||
builder.AppendLine($" Overlay number: {Stub_OverlayNumber} (0x{Stub_OverlayNumber:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub extended header information
|
||||
/// </summary>
|
||||
private void PrintStubExtendedHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintStubExtendedHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", Stub_Reserved1)}");
|
||||
Console.WriteLine($" OEM identifier: {Stub_OEMIdentifier} (0x{Stub_OEMIdentifier:X})");
|
||||
Console.WriteLine($" OEM information: {Stub_OEMInformation} (0x{Stub_OEMInformation:X})");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", Stub_Reserved2)}");
|
||||
Console.WriteLine($" New EXE header address: {Stub_NewExeHeaderAddr} (0x{Stub_NewExeHeaderAddr:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" MS-DOS Stub Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Reserved words: {string.Join(", ", Stub_Reserved1)}");
|
||||
builder.AppendLine($" OEM identifier: {Stub_OEMIdentifier} (0x{Stub_OEMIdentifier:X})");
|
||||
builder.AppendLine($" OEM information: {Stub_OEMInformation} (0x{Stub_OEMInformation:X})");
|
||||
builder.AppendLine($" Reserved words: {string.Join(", ", Stub_Reserved2)}");
|
||||
builder.AppendLine($" New EXE header address: {Stub_NewExeHeaderAddr} (0x{Stub_NewExeHeaderAddr:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print information block information
|
||||
/// </summary>
|
||||
private void PrintInformationBlock()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintInformationBlock(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Information Block Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Byte order: {ByteOrder} (0x{ByteOrder:X})");
|
||||
Console.WriteLine($" Word order: {WordOrder} (0x{WordOrder:X})");
|
||||
Console.WriteLine($" Executable format level: {ExecutableFormatLevel} (0x{ExecutableFormatLevel:X})");
|
||||
Console.WriteLine($" CPU type: {CPUType} (0x{CPUType:X})");
|
||||
Console.WriteLine($" Module OS: {ModuleOS} (0x{ModuleOS:X})");
|
||||
Console.WriteLine($" Module version: {ModuleVersion} (0x{ModuleVersion:X})");
|
||||
Console.WriteLine($" Module type flags: {ModuleTypeFlags} (0x{ModuleTypeFlags:X})");
|
||||
Console.WriteLine($" Module number pages: {ModuleNumberPages} (0x{ModuleNumberPages:X})");
|
||||
Console.WriteLine($" Initial object CS: {InitialObjectCS} (0x{InitialObjectCS:X})");
|
||||
Console.WriteLine($" Initial EIP: {InitialEIP} (0x{InitialEIP:X})");
|
||||
Console.WriteLine($" Initial object SS: {InitialObjectSS} (0x{InitialObjectSS:X})");
|
||||
Console.WriteLine($" Initial ESP: {InitialESP} (0x{InitialESP:X})");
|
||||
Console.WriteLine($" Memory page size: {MemoryPageSize} (0x{MemoryPageSize:X})");
|
||||
Console.WriteLine($" Bytes on last page: {BytesOnLastPage} (0x{BytesOnLastPage:X})");
|
||||
Console.WriteLine($" Fix-up section size: {FixupSectionSize} (0x{FixupSectionSize:X})");
|
||||
Console.WriteLine($" Fix-up section checksum: {FixupSectionChecksum} (0x{FixupSectionChecksum:X})");
|
||||
Console.WriteLine($" Loader section size: {LoaderSectionSize} (0x{LoaderSectionSize:X})");
|
||||
Console.WriteLine($" Loader section checksum: {LoaderSectionChecksum} (0x{LoaderSectionChecksum:X})");
|
||||
Console.WriteLine($" Object table offset: {ObjectTableOffset} (0x{ObjectTableOffset:X})");
|
||||
Console.WriteLine($" Object table count: {ObjectTableCount} (0x{ObjectTableCount:X})");
|
||||
Console.WriteLine($" Object page map offset: {ObjectPageMapOffset} (0x{ObjectPageMapOffset:X})");
|
||||
Console.WriteLine($" Object iterate data map offset: {ObjectIterateDataMapOffset} (0x{ObjectIterateDataMapOffset:X})");
|
||||
Console.WriteLine($" Resource table offset: {ResourceTableOffset} (0x{ResourceTableOffset:X})");
|
||||
Console.WriteLine($" Resource table count: {ResourceTableCount} (0x{ResourceTableCount:X})");
|
||||
Console.WriteLine($" Resident names table offset: {ResidentNamesTableOffset} (0x{ResidentNamesTableOffset:X})");
|
||||
Console.WriteLine($" Entry table offset: {EntryTableOffset} (0x{EntryTableOffset:X})");
|
||||
Console.WriteLine($" Module directives table offset: {ModuleDirectivesTableOffset} (0x{ModuleDirectivesTableOffset:X})");
|
||||
Console.WriteLine($" Module directives table count: {ModuleDirectivesCount} (0x{ModuleDirectivesCount:X})");
|
||||
Console.WriteLine($" Fix-up page table offset: {FixupPageTableOffset} (0x{FixupPageTableOffset:X})");
|
||||
Console.WriteLine($" Fix-up record table offset: {FixupRecordTableOffset} (0x{FixupRecordTableOffset:X})");
|
||||
Console.WriteLine($" Imported modules name table offset: {ImportedModulesNameTableOffset} (0x{ImportedModulesNameTableOffset:X})");
|
||||
Console.WriteLine($" Imported modules count: {ImportedModulesCount} (0x{ImportedModulesCount:X})");
|
||||
Console.WriteLine($" Imported procedure name table count: {ImportProcedureNameTableOffset} (0x{ImportProcedureNameTableOffset:X})");
|
||||
Console.WriteLine($" Per-page checksum table offset: {PerPageChecksumTableOffset} (0x{PerPageChecksumTableOffset:X})");
|
||||
Console.WriteLine($" Data pages offset: {DataPagesOffset} (0x{DataPagesOffset:X})");
|
||||
Console.WriteLine($" Preload page count: {PreloadPageCount} (0x{PreloadPageCount:X})");
|
||||
Console.WriteLine($" Non-resident names table offset: {NonResidentNamesTableOffset} (0x{NonResidentNamesTableOffset:X})");
|
||||
Console.WriteLine($" Non-resident names table length: {NonResidentNamesTableLength} (0x{NonResidentNamesTableLength:X})");
|
||||
Console.WriteLine($" Non-resident names table checksum: {NonResidentNamesTableChecksum} (0x{NonResidentNamesTableChecksum:X})");
|
||||
Console.WriteLine($" Automatic data object: {AutomaticDataObject} (0x{AutomaticDataObject:X})");
|
||||
Console.WriteLine($" Debug information offset: {DebugInformationOffset} (0x{DebugInformationOffset:X})");
|
||||
Console.WriteLine($" Debug information length: {DebugInformationLength} (0x{DebugInformationLength:X})");
|
||||
Console.WriteLine($" Preload instance pages number: {PreloadInstancePagesNumber} (0x{PreloadInstancePagesNumber:X})");
|
||||
Console.WriteLine($" Demand instance pages number: {DemandInstancePagesNumber} (0x{DemandInstancePagesNumber:X})");
|
||||
Console.WriteLine($" Extra heap allocation: {ExtraHeapAllocation} (0x{ExtraHeapAllocation:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Information Block Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Byte order: {ByteOrder} (0x{ByteOrder:X})");
|
||||
builder.AppendLine($" Word order: {WordOrder} (0x{WordOrder:X})");
|
||||
builder.AppendLine($" Executable format level: {ExecutableFormatLevel} (0x{ExecutableFormatLevel:X})");
|
||||
builder.AppendLine($" CPU type: {CPUType} (0x{CPUType:X})");
|
||||
builder.AppendLine($" Module OS: {ModuleOS} (0x{ModuleOS:X})");
|
||||
builder.AppendLine($" Module version: {ModuleVersion} (0x{ModuleVersion:X})");
|
||||
builder.AppendLine($" Module type flags: {ModuleTypeFlags} (0x{ModuleTypeFlags:X})");
|
||||
builder.AppendLine($" Module number pages: {ModuleNumberPages} (0x{ModuleNumberPages:X})");
|
||||
builder.AppendLine($" Initial object CS: {InitialObjectCS} (0x{InitialObjectCS:X})");
|
||||
builder.AppendLine($" Initial EIP: {InitialEIP} (0x{InitialEIP:X})");
|
||||
builder.AppendLine($" Initial object SS: {InitialObjectSS} (0x{InitialObjectSS:X})");
|
||||
builder.AppendLine($" Initial ESP: {InitialESP} (0x{InitialESP:X})");
|
||||
builder.AppendLine($" Memory page size: {MemoryPageSize} (0x{MemoryPageSize:X})");
|
||||
builder.AppendLine($" Bytes on last page: {BytesOnLastPage} (0x{BytesOnLastPage:X})");
|
||||
builder.AppendLine($" Fix-up section size: {FixupSectionSize} (0x{FixupSectionSize:X})");
|
||||
builder.AppendLine($" Fix-up section checksum: {FixupSectionChecksum} (0x{FixupSectionChecksum:X})");
|
||||
builder.AppendLine($" Loader section size: {LoaderSectionSize} (0x{LoaderSectionSize:X})");
|
||||
builder.AppendLine($" Loader section checksum: {LoaderSectionChecksum} (0x{LoaderSectionChecksum:X})");
|
||||
builder.AppendLine($" Object table offset: {ObjectTableOffset} (0x{ObjectTableOffset:X})");
|
||||
builder.AppendLine($" Object table count: {ObjectTableCount} (0x{ObjectTableCount:X})");
|
||||
builder.AppendLine($" Object page map offset: {ObjectPageMapOffset} (0x{ObjectPageMapOffset:X})");
|
||||
builder.AppendLine($" Object iterate data map offset: {ObjectIterateDataMapOffset} (0x{ObjectIterateDataMapOffset:X})");
|
||||
builder.AppendLine($" Resource table offset: {ResourceTableOffset} (0x{ResourceTableOffset:X})");
|
||||
builder.AppendLine($" Resource table count: {ResourceTableCount} (0x{ResourceTableCount:X})");
|
||||
builder.AppendLine($" Resident names table offset: {ResidentNamesTableOffset} (0x{ResidentNamesTableOffset:X})");
|
||||
builder.AppendLine($" Entry table offset: {EntryTableOffset} (0x{EntryTableOffset:X})");
|
||||
builder.AppendLine($" Module directives table offset: {ModuleDirectivesTableOffset} (0x{ModuleDirectivesTableOffset:X})");
|
||||
builder.AppendLine($" Module directives table count: {ModuleDirectivesCount} (0x{ModuleDirectivesCount:X})");
|
||||
builder.AppendLine($" Fix-up page table offset: {FixupPageTableOffset} (0x{FixupPageTableOffset:X})");
|
||||
builder.AppendLine($" Fix-up record table offset: {FixupRecordTableOffset} (0x{FixupRecordTableOffset:X})");
|
||||
builder.AppendLine($" Imported modules name table offset: {ImportedModulesNameTableOffset} (0x{ImportedModulesNameTableOffset:X})");
|
||||
builder.AppendLine($" Imported modules count: {ImportedModulesCount} (0x{ImportedModulesCount:X})");
|
||||
builder.AppendLine($" Imported procedure name table count: {ImportProcedureNameTableOffset} (0x{ImportProcedureNameTableOffset:X})");
|
||||
builder.AppendLine($" Per-page checksum table offset: {PerPageChecksumTableOffset} (0x{PerPageChecksumTableOffset:X})");
|
||||
builder.AppendLine($" Data pages offset: {DataPagesOffset} (0x{DataPagesOffset:X})");
|
||||
builder.AppendLine($" Preload page count: {PreloadPageCount} (0x{PreloadPageCount:X})");
|
||||
builder.AppendLine($" Non-resident names table offset: {NonResidentNamesTableOffset} (0x{NonResidentNamesTableOffset:X})");
|
||||
builder.AppendLine($" Non-resident names table length: {NonResidentNamesTableLength} (0x{NonResidentNamesTableLength:X})");
|
||||
builder.AppendLine($" Non-resident names table checksum: {NonResidentNamesTableChecksum} (0x{NonResidentNamesTableChecksum:X})");
|
||||
builder.AppendLine($" Automatic data object: {AutomaticDataObject} (0x{AutomaticDataObject:X})");
|
||||
builder.AppendLine($" Debug information offset: {DebugInformationOffset} (0x{DebugInformationOffset:X})");
|
||||
builder.AppendLine($" Debug information length: {DebugInformationLength} (0x{DebugInformationLength:X})");
|
||||
builder.AppendLine($" Preload instance pages number: {PreloadInstancePagesNumber} (0x{PreloadInstancePagesNumber:X})");
|
||||
builder.AppendLine($" Demand instance pages number: {DemandInstancePagesNumber} (0x{DemandInstancePagesNumber:X})");
|
||||
builder.AppendLine($" Extra heap allocation: {ExtraHeapAllocation} (0x{ExtraHeapAllocation:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print object table information
|
||||
/// </summary>
|
||||
private void PrintObjectTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintObjectTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Object Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Object Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ObjectTable == null || ObjectTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No object table entries");
|
||||
builder.AppendLine(" No object table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ObjectTable.Length; i++)
|
||||
{
|
||||
var entry = ObjectTable[i];
|
||||
Console.WriteLine($" Object Table Entry {i}");
|
||||
Console.WriteLine($" Virtual segment size: {entry.VirtualSegmentSize} (0x{entry.VirtualSegmentSize:X})");
|
||||
Console.WriteLine($" Relocation base address: {entry.RelocationBaseAddress} (0x{entry.RelocationBaseAddress:X})");
|
||||
Console.WriteLine($" Object flags: {entry.ObjectFlags} (0x{entry.ObjectFlags:X})");
|
||||
Console.WriteLine($" Page table index: {entry.PageTableIndex} (0x{entry.PageTableIndex:X})");
|
||||
Console.WriteLine($" Page table entries: {entry.PageTableEntries} (0x{entry.PageTableEntries:X})");
|
||||
Console.WriteLine($" Reserved: {entry.Reserved} (0x{entry.Reserved:X})");
|
||||
builder.AppendLine($" Object Table Entry {i}");
|
||||
builder.AppendLine($" Virtual segment size: {entry.VirtualSegmentSize} (0x{entry.VirtualSegmentSize:X})");
|
||||
builder.AppendLine($" Relocation base address: {entry.RelocationBaseAddress} (0x{entry.RelocationBaseAddress:X})");
|
||||
builder.AppendLine($" Object flags: {entry.ObjectFlags} (0x{entry.ObjectFlags:X})");
|
||||
builder.AppendLine($" Page table index: {entry.PageTableIndex} (0x{entry.PageTableIndex:X})");
|
||||
builder.AppendLine($" Page table entries: {entry.PageTableEntries} (0x{entry.PageTableEntries:X})");
|
||||
builder.AppendLine($" Reserved: {entry.Reserved} (0x{entry.Reserved:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print object page map information
|
||||
/// </summary>
|
||||
private void PrintObjectPageMap()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintObjectPageMap(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Object Page Map Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Object Page Map Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ObjectPageMap == null || ObjectPageMap.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No object page map entries");
|
||||
builder.AppendLine(" No object page map entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ObjectPageMap.Length; i++)
|
||||
{
|
||||
var entry = ObjectPageMap[i];
|
||||
Console.WriteLine($" Object Page Map Entry {i}");
|
||||
Console.WriteLine($" Page data offset: {entry.PageDataOffset} (0x{entry.PageDataOffset:X})");
|
||||
Console.WriteLine($" Data size: {entry.DataSize} (0x{entry.DataSize:X})");
|
||||
Console.WriteLine($" Flags: {entry.Flags} (0x{entry.Flags:X})");
|
||||
builder.AppendLine($" Object Page Map Entry {i}");
|
||||
builder.AppendLine($" Page data offset: {entry.PageDataOffset} (0x{entry.PageDataOffset:X})");
|
||||
builder.AppendLine($" Data size: {entry.DataSize} (0x{entry.DataSize:X})");
|
||||
builder.AppendLine($" Flags: {entry.Flags} (0x{entry.Flags:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resource table information
|
||||
/// </summary>
|
||||
private void PrintResourceTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintResourceTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Resource Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Resource Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ResourceTable == null || ResourceTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No resource table entries");
|
||||
builder.AppendLine(" No resource table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ResourceTable.Length; i++)
|
||||
{
|
||||
var entry = ResourceTable[i];
|
||||
Console.WriteLine($" Resource Table Entry {i}");
|
||||
Console.WriteLine($" Type ID: {entry.TypeID} (0x{entry.TypeID:X})");
|
||||
Console.WriteLine($" Name ID: {entry.NameID} (0x{entry.NameID:X})");
|
||||
Console.WriteLine($" Resource size: {entry.ResourceSize} (0x{entry.ResourceSize:X})");
|
||||
Console.WriteLine($" Object number: {entry.ObjectNumber} (0x{entry.ObjectNumber:X})");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
builder.AppendLine($" Type ID: {entry.TypeID} (0x{entry.TypeID:X})");
|
||||
builder.AppendLine($" Name ID: {entry.NameID} (0x{entry.NameID:X})");
|
||||
builder.AppendLine($" Resource size: {entry.ResourceSize} (0x{entry.ResourceSize:X})");
|
||||
builder.AppendLine($" Object number: {entry.ObjectNumber} (0x{entry.ObjectNumber:X})");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resident names table information
|
||||
/// </summary>
|
||||
private void PrintResidentNamesTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintResidentNamesTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Resident Names Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ResidentNamesTable == null || ResidentNamesTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No resident names table entries");
|
||||
builder.AppendLine(" No resident names table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ResidentNamesTable.Length; i++)
|
||||
{
|
||||
var entry = ResidentNamesTable[i];
|
||||
Console.WriteLine($" Resident Names Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
builder.AppendLine($" Resident Names Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print entry table information
|
||||
/// </summary>
|
||||
private void PrintEntryTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintEntryTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Entry Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (EntryTable == null || EntryTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No entry table bundles");
|
||||
builder.AppendLine(" No entry table bundles");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < EntryTable.Length; i++)
|
||||
{
|
||||
var bundle = EntryTable[i];
|
||||
Console.WriteLine($" Entry Table Bundle {i}");
|
||||
Console.WriteLine($" Entries: {bundle.Entries} (0x{bundle.Entries:X})");
|
||||
Console.WriteLine($" Bundle type: {bundle.BundleType} (0x{bundle.BundleType:X})");
|
||||
builder.AppendLine($" Entry Table Bundle {i}");
|
||||
builder.AppendLine($" Entries: {bundle.Entries} (0x{bundle.Entries:X})");
|
||||
builder.AppendLine($" Bundle type: {bundle.BundleType} (0x{bundle.BundleType:X})");
|
||||
if (bundle.TableEntries != null && bundle.TableEntries.Length != 0)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($" Entry Table Entries:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine();
|
||||
builder.AppendLine($" Entry Table Entries:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
for (int j = 0; j < bundle.TableEntries.Length; j++)
|
||||
{
|
||||
var entry = bundle.TableEntries[j];
|
||||
Console.WriteLine($" Entry Table Entry {j}");
|
||||
builder.AppendLine($" Entry Table Entry {j}");
|
||||
switch (bundle.BundleType & ~Models.LinearExecutable.BundleType.ParameterTypingInformationPresent)
|
||||
{
|
||||
case Models.LinearExecutable.BundleType.UnusedEntry:
|
||||
Console.WriteLine($" Unused, empty entry");
|
||||
builder.AppendLine($" Unused, empty entry");
|
||||
break;
|
||||
|
||||
case Models.LinearExecutable.BundleType.SixteenBitEntry:
|
||||
Console.WriteLine($" Object number: {entry.SixteenBitObjectNumber} (0x{entry.SixteenBitObjectNumber:X})");
|
||||
Console.WriteLine($" Entry flags: {entry.SixteenBitEntryFlags} (0x{entry.SixteenBitEntryFlags:X})");
|
||||
Console.WriteLine($" Offset: {entry.SixteenBitOffset} (0x{entry.SixteenBitOffset:X})");
|
||||
builder.AppendLine($" Object number: {entry.SixteenBitObjectNumber} (0x{entry.SixteenBitObjectNumber:X})");
|
||||
builder.AppendLine($" Entry flags: {entry.SixteenBitEntryFlags} (0x{entry.SixteenBitEntryFlags:X})");
|
||||
builder.AppendLine($" Offset: {entry.SixteenBitOffset} (0x{entry.SixteenBitOffset:X})");
|
||||
break;
|
||||
|
||||
case Models.LinearExecutable.BundleType.TwoEightySixCallGateEntry:
|
||||
Console.WriteLine($" Object number: {entry.TwoEightySixObjectNumber} (0x{entry.TwoEightySixObjectNumber:X})");
|
||||
Console.WriteLine($" Entry flags: {entry.TwoEightySixEntryFlags} (0x{entry.TwoEightySixEntryFlags:X})");
|
||||
Console.WriteLine($" Offset: {entry.TwoEightySixOffset} (0x{entry.TwoEightySixOffset:X})");
|
||||
Console.WriteLine($" Callgate: {entry.TwoEightySixCallgate} (0x{entry.TwoEightySixCallgate:X})");
|
||||
builder.AppendLine($" Object number: {entry.TwoEightySixObjectNumber} (0x{entry.TwoEightySixObjectNumber:X})");
|
||||
builder.AppendLine($" Entry flags: {entry.TwoEightySixEntryFlags} (0x{entry.TwoEightySixEntryFlags:X})");
|
||||
builder.AppendLine($" Offset: {entry.TwoEightySixOffset} (0x{entry.TwoEightySixOffset:X})");
|
||||
builder.AppendLine($" Callgate: {entry.TwoEightySixCallgate} (0x{entry.TwoEightySixCallgate:X})");
|
||||
break;
|
||||
|
||||
case Models.LinearExecutable.BundleType.ThirtyTwoBitEntry:
|
||||
Console.WriteLine($" Object number: {entry.ThirtyTwoBitObjectNumber} (0x{entry.ThirtyTwoBitObjectNumber:X})");
|
||||
Console.WriteLine($" Entry flags: {entry.ThirtyTwoBitEntryFlags} (0x{entry.ThirtyTwoBitEntryFlags:X})");
|
||||
Console.WriteLine($" Offset: {entry.ThirtyTwoBitOffset} (0x{entry.ThirtyTwoBitOffset:X})");
|
||||
builder.AppendLine($" Object number: {entry.ThirtyTwoBitObjectNumber} (0x{entry.ThirtyTwoBitObjectNumber:X})");
|
||||
builder.AppendLine($" Entry flags: {entry.ThirtyTwoBitEntryFlags} (0x{entry.ThirtyTwoBitEntryFlags:X})");
|
||||
builder.AppendLine($" Offset: {entry.ThirtyTwoBitOffset} (0x{entry.ThirtyTwoBitOffset:X})");
|
||||
break;
|
||||
|
||||
case Models.LinearExecutable.BundleType.ForwarderEntry:
|
||||
Console.WriteLine($" Reserved: {entry.ForwarderReserved} (0x{entry.ForwarderReserved:X})");
|
||||
Console.WriteLine($" Forwarder flags: {entry.ForwarderFlags} (0x{entry.ForwarderFlags:X})");
|
||||
Console.WriteLine($" Module ordinal number: {entry.ForwarderModuleOrdinalNumber} (0x{entry.ForwarderModuleOrdinalNumber:X})");
|
||||
Console.WriteLine($" Procedure name offset: {entry.ProcedureNameOffset} (0x{entry.ProcedureNameOffset:X})");
|
||||
Console.WriteLine($" Import ordinal number: {entry.ImportOrdinalNumber} (0x{entry.ImportOrdinalNumber:X})");
|
||||
builder.AppendLine($" Reserved: {entry.ForwarderReserved} (0x{entry.ForwarderReserved:X})");
|
||||
builder.AppendLine($" Forwarder flags: {entry.ForwarderFlags} (0x{entry.ForwarderFlags:X})");
|
||||
builder.AppendLine($" Module ordinal number: {entry.ForwarderModuleOrdinalNumber} (0x{entry.ForwarderModuleOrdinalNumber:X})");
|
||||
builder.AppendLine($" Procedure name offset: {entry.ProcedureNameOffset} (0x{entry.ProcedureNameOffset:X})");
|
||||
builder.AppendLine($" Import ordinal number: {entry.ImportOrdinalNumber} (0x{entry.ImportOrdinalNumber:X})");
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.WriteLine($" Unknown entry type {bundle.BundleType}");
|
||||
builder.AppendLine($" Unknown entry type {bundle.BundleType}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print module format directives table information
|
||||
/// </summary>
|
||||
private void PrintModuleFormatDirectivesTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintModuleFormatDirectivesTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Module Format Directives Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Module Format Directives Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ModuleFormatDirectivesTable == null || ModuleFormatDirectivesTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No module format directives table entries");
|
||||
builder.AppendLine(" No module format directives table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ModuleFormatDirectivesTable.Length; i++)
|
||||
{
|
||||
var entry = ModuleFormatDirectivesTable[i];
|
||||
Console.WriteLine($" Moduile Format Directives Table Entry {i}");
|
||||
Console.WriteLine($" Directive number: {entry.DirectiveNumber} (0x{entry.DirectiveNumber:X})");
|
||||
Console.WriteLine($" Directive data length: {entry.DirectiveDataLength} (0x{entry.DirectiveDataLength:X})");
|
||||
Console.WriteLine($" Directive data offset: {entry.DirectiveDataOffset} (0x{entry.DirectiveDataOffset:X})");
|
||||
builder.AppendLine($" Moduile Format Directives Table Entry {i}");
|
||||
builder.AppendLine($" Directive number: {entry.DirectiveNumber} (0x{entry.DirectiveNumber:X})");
|
||||
builder.AppendLine($" Directive data length: {entry.DirectiveDataLength} (0x{entry.DirectiveDataLength:X})");
|
||||
builder.AppendLine($" Directive data offset: {entry.DirectiveDataOffset} (0x{entry.DirectiveDataOffset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print verify record directive table information
|
||||
/// </summary>
|
||||
private void PrintVerifyRecordDirectiveTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintVerifyRecordDirectiveTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Verify Record Directive Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Verify Record Directive Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (VerifyRecordDirectiveTable == null || VerifyRecordDirectiveTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No verify record directive table entries");
|
||||
builder.AppendLine(" No verify record directive table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < VerifyRecordDirectiveTable.Length; i++)
|
||||
{
|
||||
var entry = VerifyRecordDirectiveTable[i];
|
||||
Console.WriteLine($" Verify Record Directive Table Entry {i}");
|
||||
Console.WriteLine($" Entry count: {entry.EntryCount} (0x{entry.EntryCount:X})");
|
||||
Console.WriteLine($" Ordinal index: {entry.OrdinalIndex} (0x{entry.OrdinalIndex:X})");
|
||||
Console.WriteLine($" Version: {entry.Version} (0x{entry.Version:X})");
|
||||
Console.WriteLine($" Object entries count: {entry.ObjectEntriesCount} (0x{entry.ObjectEntriesCount:X})");
|
||||
Console.WriteLine($" Object number in module: {entry.ObjectNumberInModule} (0x{entry.ObjectNumberInModule:X})");
|
||||
Console.WriteLine($" Object load base address: {entry.ObjectLoadBaseAddress} (0x{entry.ObjectLoadBaseAddress:X})");
|
||||
Console.WriteLine($" Object virtual address size: {entry.ObjectVirtualAddressSize} (0x{entry.ObjectVirtualAddressSize:X})");
|
||||
builder.AppendLine($" Verify Record Directive Table Entry {i}");
|
||||
builder.AppendLine($" Entry count: {entry.EntryCount} (0x{entry.EntryCount:X})");
|
||||
builder.AppendLine($" Ordinal index: {entry.OrdinalIndex} (0x{entry.OrdinalIndex:X})");
|
||||
builder.AppendLine($" Version: {entry.Version} (0x{entry.Version:X})");
|
||||
builder.AppendLine($" Object entries count: {entry.ObjectEntriesCount} (0x{entry.ObjectEntriesCount:X})");
|
||||
builder.AppendLine($" Object number in module: {entry.ObjectNumberInModule} (0x{entry.ObjectNumberInModule:X})");
|
||||
builder.AppendLine($" Object load base address: {entry.ObjectLoadBaseAddress} (0x{entry.ObjectLoadBaseAddress:X})");
|
||||
builder.AppendLine($" Object virtual address size: {entry.ObjectVirtualAddressSize} (0x{entry.ObjectVirtualAddressSize:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print fix-up page table information
|
||||
/// </summary>
|
||||
private void PrintFixupPageTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFixupPageTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Fix-up Page Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Fix-up Page Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FixupPageTable == null || FixupPageTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No fix-up page table entries");
|
||||
builder.AppendLine(" No fix-up page table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FixupPageTable.Length; i++)
|
||||
{
|
||||
var entry = FixupPageTable[i];
|
||||
Console.WriteLine($" Fix-up Page Table Entry {i}");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
builder.AppendLine($" Fix-up Page Table Entry {i}");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print fix-up record table information
|
||||
/// </summary>
|
||||
private void PrintFixupRecordTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFixupRecordTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Fix-up Record Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Fix-up Record Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FixupRecordTable == null || FixupRecordTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No fix-up record table entries");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" No fix-up record table entries");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FixupRecordTable.Length; i++)
|
||||
{
|
||||
var entry = FixupRecordTable[i];
|
||||
Console.WriteLine($" Fix-up Record Table Entry {i}");
|
||||
Console.WriteLine($" Source type: {entry.SourceType} (0x{entry.SourceType:X})");
|
||||
Console.WriteLine($" Target flags: {entry.TargetFlags} (0x{entry.TargetFlags:X})");
|
||||
builder.AppendLine($" Fix-up Record Table Entry {i}");
|
||||
builder.AppendLine($" Source type: {entry.SourceType} (0x{entry.SourceType:X})");
|
||||
builder.AppendLine($" Target flags: {entry.TargetFlags} (0x{entry.TargetFlags:X})");
|
||||
|
||||
// Source list flag
|
||||
if (entry.SourceType.HasFlag(Models.LinearExecutable.FixupRecordSourceType.SourceListFlag))
|
||||
Console.WriteLine($" Source offset list count: {entry.SourceOffsetListCount} (0x{entry.SourceOffsetListCount:X})");
|
||||
builder.AppendLine($" Source offset list count: {entry.SourceOffsetListCount} (0x{entry.SourceOffsetListCount:X})");
|
||||
else
|
||||
Console.WriteLine($" Source offset: {entry.SourceOffset} (0x{entry.SourceOffset:X})");
|
||||
builder.AppendLine($" Source offset: {entry.SourceOffset} (0x{entry.SourceOffset:X})");
|
||||
|
||||
// OBJECT / TRGOFF
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.InternalReference))
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
Console.WriteLine($" Target object number: {entry.TargetObjectNumberWORD} (0x{entry.TargetObjectNumberWORD:X})");
|
||||
builder.AppendLine($" Target object number: {entry.TargetObjectNumberWORD} (0x{entry.TargetObjectNumberWORD:X})");
|
||||
else
|
||||
Console.WriteLine($" Target object number: {entry.TargetObjectNumberByte} (0x{entry.TargetObjectNumberByte:X})");
|
||||
builder.AppendLine($" Target object number: {entry.TargetObjectNumberByte} (0x{entry.TargetObjectNumberByte:X})");
|
||||
|
||||
// 16-bit Selector fixup
|
||||
if (!entry.SourceType.HasFlag(Models.LinearExecutable.FixupRecordSourceType.SixteenBitSelectorFixup))
|
||||
{
|
||||
// 32-bit Target Offset Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
Console.WriteLine($" Target offset: {entry.TargetOffsetDWORD} (0x{entry.TargetOffsetDWORD:X})");
|
||||
builder.AppendLine($" Target offset: {entry.TargetOffsetDWORD} (0x{entry.TargetOffsetDWORD:X})");
|
||||
else
|
||||
Console.WriteLine($" Target offset: {entry.TargetOffsetWORD} (0x{entry.TargetOffsetWORD:X})");
|
||||
builder.AppendLine($" Target offset: {entry.TargetOffsetWORD} (0x{entry.TargetOffsetWORD:X})");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,26 +798,26 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
Console.WriteLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableWORD} (0x{entry.OrdinalIndexImportModuleNameTableWORD:X})");
|
||||
builder.AppendLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableWORD} (0x{entry.OrdinalIndexImportModuleNameTableWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableByte} (0x{entry.OrdinalIndexImportModuleNameTableByte:X})");
|
||||
builder.AppendLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableByte} (0x{entry.OrdinalIndexImportModuleNameTableByte:X})");
|
||||
|
||||
// 8-bit Ordinal Flag & 32-bit Target Offset Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.EightBitOrdinalFlag))
|
||||
Console.WriteLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberByte} (0x{entry.ImportedOrdinalNumberByte:X})");
|
||||
builder.AppendLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberByte} (0x{entry.ImportedOrdinalNumberByte:X})");
|
||||
else if (entry.TargetFlags.HasFlag(flag: Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
Console.WriteLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberDWORD} (0x{entry.ImportedOrdinalNumberDWORD:X})");
|
||||
builder.AppendLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberDWORD} (0x{entry.ImportedOrdinalNumberDWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberWORD} (0x{entry.ImportedOrdinalNumberWORD:X})");
|
||||
builder.AppendLine(value: $" Imported ordinal number: {entry.ImportedOrdinalNumberWORD} (0x{entry.ImportedOrdinalNumberWORD:X})");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,24 +826,24 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
Console.WriteLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableWORD} (0x{entry.OrdinalIndexImportModuleNameTableWORD:X})");
|
||||
builder.AppendLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableWORD} (0x{entry.OrdinalIndexImportModuleNameTableWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableByte} (0x{entry.OrdinalIndexImportModuleNameTableByte:X})");
|
||||
builder.AppendLine(value: $" Ordinal index import module name table: {entry.OrdinalIndexImportModuleNameTableByte} (0x{entry.OrdinalIndexImportModuleNameTableByte:X})");
|
||||
|
||||
// 32-bit Target Offset Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
Console.WriteLine(value: $" Offset import procedure name table: {entry.OffsetImportProcedureNameTableDWORD} (0x{entry.OffsetImportProcedureNameTableDWORD:X})");
|
||||
builder.AppendLine(value: $" Offset import procedure name table: {entry.OffsetImportProcedureNameTableDWORD} (0x{entry.OffsetImportProcedureNameTableDWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Offset import procedure name table: {entry.OffsetImportProcedureNameTableWORD} (0x{entry.OffsetImportProcedureNameTableWORD:X})");
|
||||
builder.AppendLine(value: $" Offset import procedure name table: {entry.OffsetImportProcedureNameTableWORD} (0x{entry.OffsetImportProcedureNameTableWORD:X})");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,42 +852,42 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
Console.WriteLine($" Target object number: {entry.TargetObjectNumberWORD} (0x{entry.TargetObjectNumberWORD:X})");
|
||||
builder.AppendLine($" Target object number: {entry.TargetObjectNumberWORD} (0x{entry.TargetObjectNumberWORD:X})");
|
||||
else
|
||||
Console.WriteLine($" Target object number: {entry.TargetObjectNumberByte} (0x{entry.TargetObjectNumberByte:X})");
|
||||
builder.AppendLine($" Target object number: {entry.TargetObjectNumberByte} (0x{entry.TargetObjectNumberByte:X})");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(Models.LinearExecutable.FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueDWORD} (0x{entry.AdditiveFixupValueDWORD:X})");
|
||||
else
|
||||
Console.WriteLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
builder.AppendLine(value: $" Additive fixup value: {entry.AdditiveFixupValueWORD} (0x{entry.AdditiveFixupValueWORD:X})");
|
||||
}
|
||||
}
|
||||
|
||||
// No other top-level flags recognized
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Unknown entry format");
|
||||
builder.AppendLine($" Unknown entry format");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($" Source Offset List:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine();
|
||||
builder.AppendLine($" Source Offset List:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entry.SourceOffsetList == null || entry.SourceOffsetList.Length == 0)
|
||||
{
|
||||
Console.WriteLine($" No source offset list entries");
|
||||
builder.AppendLine($" No source offset list entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < entry.SourceOffsetList.Length; j++)
|
||||
{
|
||||
Console.WriteLine($" Source Offset List Entry {j}: {entry.SourceOffsetList[j]} (0x{entry.SourceOffsetList[j]:X})");
|
||||
builder.AppendLine($" Source Offset List Entry {j}: {entry.SourceOffsetList[j]} (0x{entry.SourceOffsetList[j]:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -878,117 +895,122 @@ namespace BurnOutSharp.Wrappers
|
||||
/// <summary>
|
||||
/// Print import module name table information
|
||||
/// </summary>
|
||||
private void PrintImportModuleNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintImportModuleNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Import Module Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Import Module Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ImportModuleNameTable == null || ImportModuleNameTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No import module name table entries");
|
||||
builder.AppendLine(" No import module name table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ImportModuleNameTable.Length; i++)
|
||||
{
|
||||
var entry = ImportModuleNameTable[i];
|
||||
Console.WriteLine($" Import Module Name Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Import Module Name Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print import module procedure name table information
|
||||
/// </summary>
|
||||
private void PrintImportModuleProcedureNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintImportModuleProcedureNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Import Module Procedure Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Import Module Procedure Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ImportModuleProcedureNameTable == null || ImportModuleProcedureNameTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No import module procedure name table entries");
|
||||
builder.AppendLine(" No import module procedure name table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ImportModuleProcedureNameTable.Length; i++)
|
||||
{
|
||||
var entry = ImportModuleProcedureNameTable[i];
|
||||
Console.WriteLine($" Import Module Procedure Name Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Import Module Procedure Name Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print per-page checksum table information
|
||||
/// </summary>
|
||||
private void PrintPerPageChecksumTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintPerPageChecksumTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Per-Page Checksum Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Per-Page Checksum Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (PerPageChecksumTable == null || PerPageChecksumTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No per-page checksum table entries");
|
||||
builder.AppendLine(" No per-page checksum table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < PerPageChecksumTable.Length; i++)
|
||||
{
|
||||
var entry = PerPageChecksumTable[i];
|
||||
Console.WriteLine($" Per-Page Checksum Table Entry {i}");
|
||||
Console.WriteLine($" Checksum: {entry.Checksum} (0x{entry.Checksum:X})");
|
||||
builder.AppendLine($" Per-Page Checksum Table Entry {i}");
|
||||
builder.AppendLine($" Checksum: {entry.Checksum} (0x{entry.Checksum:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print non-resident names table information
|
||||
/// </summary>
|
||||
private void PrintNonResidentNamesTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintNonResidentNamesTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Non-Resident Names Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Non-Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (NonResidentNamesTable == null || NonResidentNamesTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No non-resident names table entries");
|
||||
builder.AppendLine(" No non-resident names table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < NonResidentNamesTable.Length; i++)
|
||||
{
|
||||
var entry = NonResidentNamesTable[i];
|
||||
Console.WriteLine($" Non-Resident Names Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
builder.AppendLine($" Non-Resident Names Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print debug information
|
||||
/// </summary>
|
||||
private void PrintDebugInformation()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDebugInformation(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Debug Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Debug Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_executable.DebugInformation == null)
|
||||
{
|
||||
Console.WriteLine(" No debug information");
|
||||
builder.AppendLine(" No debug information");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Signature: {DI_Signature ?? "[NULL]"}");
|
||||
Console.WriteLine($" Format type: {DI_FormatType} (0x{DI_FormatType:X})");
|
||||
builder.AppendLine($" Signature: {DI_Signature ?? "[NULL]"}");
|
||||
builder.AppendLine($" Format type: {DI_FormatType} (0x{DI_FormatType:X})");
|
||||
// Debugger data
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -147,61 +147,67 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("MS-DOS Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintRelocationTable();
|
||||
builder.AppendLine("MS-DOS Executable Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintRelocationTable(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {Magic}");
|
||||
Console.WriteLine($" Last page bytes: {LastPageBytes} (0x{LastPageBytes:X})");
|
||||
Console.WriteLine($" Pages: {Pages} (0x{Pages:X})");
|
||||
Console.WriteLine($" Relocation items: {RelocationItems} (0x{RelocationItems:X})");
|
||||
Console.WriteLine($" Header paragraph size: {HeaderParagraphSize} (0x{HeaderParagraphSize:X})");
|
||||
Console.WriteLine($" Minimum extra paragraphs: {MinimumExtraParagraphs} (0x{MinimumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Maximum extra paragraphs: {MaximumExtraParagraphs} (0x{MaximumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Initial SS value: {InitialSSValue} (0x{InitialSSValue:X})");
|
||||
Console.WriteLine($" Initial SP value: {InitialSPValue} (0x{InitialSPValue:X})");
|
||||
Console.WriteLine($" Checksum: {Checksum} (0x{Checksum:X})");
|
||||
Console.WriteLine($" Initial IP value: {InitialIPValue} (0x{InitialIPValue:X})");
|
||||
Console.WriteLine($" Initial CS value: {InitialCSValue} (0x{InitialCSValue:X})");
|
||||
Console.WriteLine($" Relocation table address: {RelocationTableAddr} (0x{RelocationTableAddr:X})");
|
||||
Console.WriteLine($" Overlay number: {OverlayNumber} (0x{OverlayNumber:X})");
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic number: {Magic}");
|
||||
builder.AppendLine($" Last page bytes: {LastPageBytes} (0x{LastPageBytes:X})");
|
||||
builder.AppendLine($" Pages: {Pages} (0x{Pages:X})");
|
||||
builder.AppendLine($" Relocation items: {RelocationItems} (0x{RelocationItems:X})");
|
||||
builder.AppendLine($" Header paragraph size: {HeaderParagraphSize} (0x{HeaderParagraphSize:X})");
|
||||
builder.AppendLine($" Minimum extra paragraphs: {MinimumExtraParagraphs} (0x{MinimumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Maximum extra paragraphs: {MaximumExtraParagraphs} (0x{MaximumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Initial SS value: {InitialSSValue} (0x{InitialSSValue:X})");
|
||||
builder.AppendLine($" Initial SP value: {InitialSPValue} (0x{InitialSPValue:X})");
|
||||
builder.AppendLine($" Checksum: {Checksum} (0x{Checksum:X})");
|
||||
builder.AppendLine($" Initial IP value: {InitialIPValue} (0x{InitialIPValue:X})");
|
||||
builder.AppendLine($" Initial CS value: {InitialCSValue} (0x{InitialCSValue:X})");
|
||||
builder.AppendLine($" Relocation table address: {RelocationTableAddr} (0x{RelocationTableAddr:X})");
|
||||
builder.AppendLine($" Overlay number: {OverlayNumber} (0x{OverlayNumber:X})");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print relocation table information
|
||||
/// </summary>
|
||||
private void PrintRelocationTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintRelocationTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Relocation Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Relocation Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (RelocationItems == 0 || RelocationTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No relocation table items");
|
||||
builder.AppendLine(" No relocation table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < RelocationTable.Length; i++)
|
||||
{
|
||||
var entry = RelocationTable[i];
|
||||
Console.WriteLine($" Relocation Table Entry {i}");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
Console.WriteLine($" Segment: {entry.Segment} (0x{entry.Segment:X})");
|
||||
builder.AppendLine($" Relocation Table Entry {i}");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
builder.AppendLine($" Segment: {entry.Segment} (0x{entry.Segment:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -396,145 +397,152 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("Microsoft Cabinet Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintFolders();
|
||||
PrintFiles();
|
||||
builder.AppendLine("Microsoft Cabinet Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintFolders(builder);
|
||||
PrintFiles(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Reserved 1: {Reserved1} (0x{Reserved1:X})");
|
||||
Console.WriteLine($" Cabinet size: {CabinetSize} (0x{CabinetSize:X})");
|
||||
Console.WriteLine($" Reserved 2: {Reserved2} (0x{Reserved2:X})");
|
||||
Console.WriteLine($" Files offset: {FilesOffset} (0x{FilesOffset:X})");
|
||||
Console.WriteLine($" Reserved 3: {Reserved3} (0x{Reserved3:X})");
|
||||
Console.WriteLine($" Minor version: {VersionMinor} (0x{VersionMinor:X})");
|
||||
Console.WriteLine($" Major version: {VersionMajor} (0x{VersionMajor:X})");
|
||||
Console.WriteLine($" Folder count: {FolderCount} (0x{FolderCount:X})");
|
||||
Console.WriteLine($" File count: {FileCount} (0x{FileCount:X})");
|
||||
Console.WriteLine($" Flags: {Flags} (0x{Flags:X})");
|
||||
Console.WriteLine($" Set ID: {SetID} (0x{SetID:X})");
|
||||
Console.WriteLine($" Cabinet index: {CabinetIndex} (0x{CabinetIndex:X})");
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Reserved 1: {Reserved1} (0x{Reserved1:X})");
|
||||
builder.AppendLine($" Cabinet size: {CabinetSize} (0x{CabinetSize:X})");
|
||||
builder.AppendLine($" Reserved 2: {Reserved2} (0x{Reserved2:X})");
|
||||
builder.AppendLine($" Files offset: {FilesOffset} (0x{FilesOffset:X})");
|
||||
builder.AppendLine($" Reserved 3: {Reserved3} (0x{Reserved3:X})");
|
||||
builder.AppendLine($" Minor version: {VersionMinor} (0x{VersionMinor:X})");
|
||||
builder.AppendLine($" Major version: {VersionMajor} (0x{VersionMajor:X})");
|
||||
builder.AppendLine($" Folder count: {FolderCount} (0x{FolderCount:X})");
|
||||
builder.AppendLine($" File count: {FileCount} (0x{FileCount:X})");
|
||||
builder.AppendLine($" Flags: {Flags} (0x{Flags:X})");
|
||||
builder.AppendLine($" Set ID: {SetID} (0x{SetID:X})");
|
||||
builder.AppendLine($" Cabinet index: {CabinetIndex} (0x{CabinetIndex:X})");
|
||||
|
||||
if (Flags.HasFlag(Models.MicrosoftCabinet.HeaderFlags.RESERVE_PRESENT))
|
||||
{
|
||||
Console.WriteLine($" Header reserved size: {HeaderReservedSize} (0x{HeaderReservedSize:X})");
|
||||
Console.WriteLine($" Folder reserved size: {FolderReservedSize} (0x{FolderReservedSize:X})");
|
||||
Console.WriteLine($" Data reserved size: {DataReservedSize} (0x{DataReservedSize:X})");
|
||||
builder.AppendLine($" Header reserved size: {HeaderReservedSize} (0x{HeaderReservedSize:X})");
|
||||
builder.AppendLine($" Folder reserved size: {FolderReservedSize} (0x{FolderReservedSize:X})");
|
||||
builder.AppendLine($" Data reserved size: {DataReservedSize} (0x{DataReservedSize:X})");
|
||||
if (ReservedData == null)
|
||||
Console.WriteLine($" Reserved data = [NULL]");
|
||||
builder.AppendLine($" Reserved data = [NULL]");
|
||||
else
|
||||
Console.WriteLine($" Reserved data = {BitConverter.ToString(ReservedData).Replace("-", " ")}");
|
||||
builder.AppendLine($" Reserved data = {BitConverter.ToString(ReservedData).Replace("-", " ")}");
|
||||
}
|
||||
|
||||
if (Flags.HasFlag(Models.MicrosoftCabinet.HeaderFlags.PREV_CABINET))
|
||||
{
|
||||
Console.WriteLine($" Previous cabinet: {CabinetPrev}");
|
||||
Console.WriteLine($" Previous disk: {DiskPrev}");
|
||||
builder.AppendLine($" Previous cabinet: {CabinetPrev}");
|
||||
builder.AppendLine($" Previous disk: {DiskPrev}");
|
||||
}
|
||||
|
||||
if (Flags.HasFlag(Models.MicrosoftCabinet.HeaderFlags.NEXT_CABINET))
|
||||
{
|
||||
Console.WriteLine($" Next cabinet: {CabinetNext}");
|
||||
Console.WriteLine($" Next disk: {DiskNext}");
|
||||
builder.AppendLine($" Next cabinet: {CabinetNext}");
|
||||
builder.AppendLine($" Next disk: {DiskNext}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print folders information
|
||||
/// </summary>
|
||||
private void PrintFolders()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFolders(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Folders:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Folders:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FolderCount == 0 || Folders == null || Folders.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No folders");
|
||||
builder.AppendLine(" No folders");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Folders.Length; i++)
|
||||
{
|
||||
var entry = Folders[i];
|
||||
Console.WriteLine($" Folder {i}");
|
||||
Console.WriteLine($" Cab start offset = {entry.CabStartOffset} (0x{entry.CabStartOffset:X})");
|
||||
Console.WriteLine($" Data count = {entry.DataCount} (0x{entry.DataCount:X})");
|
||||
Console.WriteLine($" Compression type = {entry.CompressionType} (0x{entry.CompressionType:X})");
|
||||
Console.WriteLine($" Masked compression type = {entry.CompressionType & Models.MicrosoftCabinet.CompressionType.MASK_TYPE}");
|
||||
builder.AppendLine($" Folder {i}");
|
||||
builder.AppendLine($" Cab start offset = {entry.CabStartOffset} (0x{entry.CabStartOffset:X})");
|
||||
builder.AppendLine($" Data count = {entry.DataCount} (0x{entry.DataCount:X})");
|
||||
builder.AppendLine($" Compression type = {entry.CompressionType} (0x{entry.CompressionType:X})");
|
||||
builder.AppendLine($" Masked compression type = {entry.CompressionType & Models.MicrosoftCabinet.CompressionType.MASK_TYPE}");
|
||||
if (entry.ReservedData == null)
|
||||
Console.WriteLine($" Reserved data = [NULL]");
|
||||
builder.AppendLine($" Reserved data = [NULL]");
|
||||
else
|
||||
Console.WriteLine($" Reserved data = {BitConverter.ToString(entry.ReservedData).Replace("-", " ")}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine($" Reserved data = {BitConverter.ToString(entry.ReservedData).Replace("-", " ")}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Data Blocks");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Data Blocks");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entry.DataBlocks == null || entry.DataBlocks.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No data blocks");
|
||||
builder.AppendLine(" No data blocks");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < entry.DataBlocks.Length; j++)
|
||||
{
|
||||
Models.MicrosoftCabinet.CFDATA dataBlock = entry.DataBlocks[j];
|
||||
Console.WriteLine($" Data Block {j}");
|
||||
Console.WriteLine($" Checksum = {dataBlock.Checksum} (0x{dataBlock.Checksum:X})");
|
||||
Console.WriteLine($" Compressed size = {dataBlock.CompressedSize} (0x{dataBlock.CompressedSize:X})");
|
||||
Console.WriteLine($" Uncompressed size = {dataBlock.UncompressedSize} (0x{dataBlock.UncompressedSize:X})");
|
||||
builder.AppendLine($" Data Block {j}");
|
||||
builder.AppendLine($" Checksum = {dataBlock.Checksum} (0x{dataBlock.Checksum:X})");
|
||||
builder.AppendLine($" Compressed size = {dataBlock.CompressedSize} (0x{dataBlock.CompressedSize:X})");
|
||||
builder.AppendLine($" Uncompressed size = {dataBlock.UncompressedSize} (0x{dataBlock.UncompressedSize:X})");
|
||||
if (dataBlock.ReservedData == null)
|
||||
Console.WriteLine($" Reserved data = [NULL]");
|
||||
builder.AppendLine($" Reserved data = [NULL]");
|
||||
else
|
||||
Console.WriteLine($" Reserved data = {BitConverter.ToString(dataBlock.ReservedData).Replace("-", " ")}");
|
||||
//Console.WriteLine($" Compressed data = {BitConverter.ToString(dataBlock.CompressedData).Replace("-", " ")}");
|
||||
builder.AppendLine($" Reserved data = {BitConverter.ToString(dataBlock.ReservedData).Replace("-", " ")}");
|
||||
//builder.AppendLine($" Compressed data = {BitConverter.ToString(dataBlock.CompressedData).Replace("-", " ")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print files information
|
||||
/// </summary>
|
||||
private void PrintFiles()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFiles(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Files:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Files:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FileCount == 0 || Files == null || Files.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No files");
|
||||
builder.AppendLine(" No files");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Files.Length; i++)
|
||||
{
|
||||
var entry = Files[i];
|
||||
Console.WriteLine($" File {i}");
|
||||
Console.WriteLine($" File size = {entry.FileSize} (0x{entry.FileSize:X})");
|
||||
Console.WriteLine($" Folder start offset = {entry.FolderStartOffset} (0x{entry.FolderStartOffset:X})");
|
||||
Console.WriteLine($" Folder index = {entry.FolderIndex} (0x{entry.FolderIndex:X})");
|
||||
Console.WriteLine($" Date = {entry.Date} (0x{entry.Date:X})");
|
||||
Console.WriteLine($" Time = {entry.Time} (0x{entry.Time:X})");
|
||||
Console.WriteLine($" Attributes = {entry.Attributes} (0x{entry.Attributes:X})");
|
||||
Console.WriteLine($" Name = {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" File {i}");
|
||||
builder.AppendLine($" File size = {entry.FileSize} (0x{entry.FileSize:X})");
|
||||
builder.AppendLine($" Folder start offset = {entry.FolderStartOffset} (0x{entry.FolderStartOffset:X})");
|
||||
builder.AppendLine($" Folder index = {entry.FolderIndex} (0x{entry.FolderIndex:X})");
|
||||
builder.AppendLine($" Date = {entry.Date} (0x{entry.Date:X})");
|
||||
builder.AppendLine($" Time = {entry.Time} (0x{entry.Time:X})");
|
||||
builder.AppendLine($" Attributes = {entry.Attributes} (0x{entry.Attributes:X})");
|
||||
builder.AppendLine($" Name = {entry.Name ?? "[NULL]"}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -279,465 +280,476 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("3DS Cart Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintNCSDHeader();
|
||||
PrintCardInfoHeader();
|
||||
PrintDevelopmentCardInfoHeader();
|
||||
PrintPartitions();
|
||||
PrintExtendedHeaders();
|
||||
PrintExeFSHeaders();
|
||||
PrintRomFSHeaders();
|
||||
builder.AppendLine("3DS Cart Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintNCSDHeader(builder);
|
||||
PrintCardInfoHeader(builder);
|
||||
PrintDevelopmentCardInfoHeader(builder);
|
||||
PrintPartitions(builder);
|
||||
PrintExtendedHeaders(builder);
|
||||
PrintExeFSHeaders(builder);
|
||||
PrintRomFSHeaders(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print NCSD header information
|
||||
/// </summary>
|
||||
private void PrintNCSDHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintNCSDHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" NCSD Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(RSA2048Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Magic number: {MagicNumber} (0x{MagicNumber:X})");
|
||||
Console.WriteLine($" Image size in media units: {ImageSizeInMediaUnits} (0x{ImageSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Media ID: {BitConverter.ToString(MediaId).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Partitions filesystem type: {PartitionsFSType} (0x{PartitionsFSType:X})");
|
||||
Console.WriteLine($" Partitions crypt type: {BitConverter.ToString(PartitionsCryptType).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" NCSD Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(RSA2048Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Magic number: {MagicNumber} (0x{MagicNumber:X})");
|
||||
builder.AppendLine($" Image size in media units: {ImageSizeInMediaUnits} (0x{ImageSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Media ID: {BitConverter.ToString(MediaId).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Partitions filesystem type: {PartitionsFSType} (0x{PartitionsFSType:X})");
|
||||
builder.AppendLine($" Partitions crypt type: {BitConverter.ToString(PartitionsCryptType).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine($" Partition table:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Partition table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
for (int i = 0; i < PartitionsTable.Length; i++)
|
||||
{
|
||||
var partitionTableEntry = PartitionsTable[i];
|
||||
Console.WriteLine($" Partition table entry {i}");
|
||||
Console.WriteLine($" Offset: {partitionTableEntry.Offset} (0x{partitionTableEntry.Offset:X})");
|
||||
Console.WriteLine($" Length: {partitionTableEntry.Length} (0x{partitionTableEntry.Length:X})");
|
||||
builder.AppendLine($" Partition table entry {i}");
|
||||
builder.AppendLine($" Offset: {partitionTableEntry.Offset} (0x{partitionTableEntry.Offset:X})");
|
||||
builder.AppendLine($" Length: {partitionTableEntry.Length} (0x{partitionTableEntry.Length:X})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
|
||||
// If we have a cart image
|
||||
if (PartitionsFSType == Models.N3DS.FilesystemType.Normal || PartitionsFSType == Models.N3DS.FilesystemType.None)
|
||||
{
|
||||
Console.WriteLine($" Exheader SHA-256 hash: {BitConverter.ToString(ExheaderHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Additional header size: {AdditionalHeaderSize} (0x{AdditionalHeaderSize:X})");
|
||||
Console.WriteLine($" Sector zero offset: {SectorZeroOffset} (0x{SectorZeroOffset:X})");
|
||||
Console.WriteLine($" Partition flags: {BitConverter.ToString(PartitionFlags).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine($" Exheader SHA-256 hash: {BitConverter.ToString(ExheaderHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Additional header size: {AdditionalHeaderSize} (0x{AdditionalHeaderSize:X})");
|
||||
builder.AppendLine($" Sector zero offset: {SectorZeroOffset} (0x{SectorZeroOffset:X})");
|
||||
builder.AppendLine($" Partition flags: {BitConverter.ToString(PartitionFlags).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine($" Partition ID table:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Partition ID table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
for (int i = 0; i < PartitionIdTable.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Partition {i} ID: {PartitionIdTable[i]} (0x{PartitionIdTable[i]:X})");
|
||||
builder.AppendLine($" Partition {i} ID: {PartitionIdTable[i]} (0x{PartitionIdTable[i]:X})");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Firmware update byte 1: {FirmUpdateByte1} (0x{FirmUpdateByte1:X})");
|
||||
Console.WriteLine($" Firmware update byte 2: {FirmUpdateByte2} (0x{FirmUpdateByte2:X})");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Firmware update byte 1: {FirmUpdateByte1} (0x{FirmUpdateByte1:X})");
|
||||
builder.AppendLine($" Firmware update byte 2: {FirmUpdateByte2} (0x{FirmUpdateByte2:X})");
|
||||
}
|
||||
|
||||
// If we have a firmware image
|
||||
else if (PartitionsFSType == Models.N3DS.FilesystemType.FIRM)
|
||||
{
|
||||
Console.WriteLine($" Unknown: {BitConverter.ToString(Unknown).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Encrypted MBR: {BitConverter.ToString(EncryptedMBR).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Unknown: {BitConverter.ToString(Unknown).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Encrypted MBR: {BitConverter.ToString(EncryptedMBR).Replace('-', ' ')}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print card info header information
|
||||
/// </summary>
|
||||
private void PrintCardInfoHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintCardInfoHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Card Info Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Writable address in media units: {CIH_WritableAddressMediaUnits} (0x{CIH_WritableAddressMediaUnits:X})");
|
||||
Console.WriteLine($" Card info bitmask: {CIH_CardInfoBitmask} (0x{CIH_CardInfoBitmask:X})");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(CIH_Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled size of cartridge: {CIH_FilledSize} (0x{CIH_FilledSize:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(CIH_Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Title version: {CIH_TitleVersion} (0x{CIH_TitleVersion:X})");
|
||||
Console.WriteLine($" Card revision: {CIH_CardRevision} (0x{CIH_CardRevision:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(CIH_Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Title ID of CVer in included update partition: {BitConverter.ToString(CIH_CVerTitleID).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Version number of CVer in included update partition: {CIH_CVerVersionNumber} (0x{CIH_CVerVersionNumber:X})");
|
||||
Console.WriteLine($" Reserved 4: {BitConverter.ToString(CIH_Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Card Info Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Writable address in media units: {CIH_WritableAddressMediaUnits} (0x{CIH_WritableAddressMediaUnits:X})");
|
||||
builder.AppendLine($" Card info bitmask: {CIH_CardInfoBitmask} (0x{CIH_CardInfoBitmask:X})");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(CIH_Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled size of cartridge: {CIH_FilledSize} (0x{CIH_FilledSize:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(CIH_Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Title version: {CIH_TitleVersion} (0x{CIH_TitleVersion:X})");
|
||||
builder.AppendLine($" Card revision: {CIH_CardRevision} (0x{CIH_CardRevision:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(CIH_Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Title ID of CVer in included update partition: {BitConverter.ToString(CIH_CVerTitleID).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Version number of CVer in included update partition: {CIH_CVerVersionNumber} (0x{CIH_CVerVersionNumber:X})");
|
||||
builder.AppendLine($" Reserved 4: {BitConverter.ToString(CIH_Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print development card info header information
|
||||
/// </summary>
|
||||
private void PrintDevelopmentCardInfoHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDevelopmentCardInfoHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Development Card Info Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Development Card Info Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_cart.DevelopmentCardInfoHeader == null)
|
||||
{
|
||||
Console.WriteLine(" No development card info header");
|
||||
builder.AppendLine(" No development card info header");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" Initial Data:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Card seed keyY: {BitConverter.ToString(DCIH_ID_CardSeedKeyY).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Encrypted card seed: {BitConverter.ToString(DCIH_ID_EncryptedCardSeed).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Card seed AES-MAC: {BitConverter.ToString(DCIH_ID_CardSeedAESMAC).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Card seed nonce: {BitConverter.ToString(DCIH_ID_CardSeedNonce).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(DCIH_ID_Reserved).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
builder.AppendLine(" Initial Data:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Card seed keyY: {BitConverter.ToString(DCIH_ID_CardSeedKeyY).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Encrypted card seed: {BitConverter.ToString(DCIH_ID_EncryptedCardSeed).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Card seed AES-MAC: {BitConverter.ToString(DCIH_ID_CardSeedAESMAC).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Card seed nonce: {BitConverter.ToString(DCIH_ID_CardSeedNonce).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(DCIH_ID_Reserved).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Backup Header:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic ID: {DCIH_ID_BackupHeader.MagicID} (0x{DCIH_ID_BackupHeader.MagicID:X})");
|
||||
Console.WriteLine($" Content size in media units: {DCIH_ID_BackupHeader.ContentSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ContentSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Partition ID: {DCIH_ID_BackupHeader.PartitionId} (0x{DCIH_ID_BackupHeader.PartitionId:X})");
|
||||
Console.WriteLine($" Maker code: {DCIH_ID_BackupHeader.MakerCode} (0x{DCIH_ID_BackupHeader.MakerCode:X})");
|
||||
Console.WriteLine($" Version: {DCIH_ID_BackupHeader.Version} (0x{DCIH_ID_BackupHeader.Version:X})");
|
||||
Console.WriteLine($" Verification hash: {DCIH_ID_BackupHeader.VerificationHash} (0x{DCIH_ID_BackupHeader.VerificationHash:X})");
|
||||
Console.WriteLine($" Program ID: {BitConverter.ToString(DCIH_ID_BackupHeader.ProgramId).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Logo region SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Product code: {DCIH_ID_BackupHeader.ProductCode} (0x{DCIH_ID_BackupHeader.ProductCode:X})");
|
||||
Console.WriteLine($" Extended header SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Extended header size in bytes: {DCIH_ID_BackupHeader.ExtendedHeaderSizeInBytes} (0x{DCIH_ID_BackupHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Flags: {DCIH_ID_BackupHeader.Flags} (0x{DCIH_ID_BackupHeader.Flags:X})");
|
||||
Console.WriteLine($" Plain region offset, in media units: {DCIH_ID_BackupHeader.PlainRegionOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Plain region size, in media units: {DCIH_ID_BackupHeader.PlainRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region offset, in media units: {DCIH_ID_BackupHeader.LogoRegionOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region size, in media units: {DCIH_ID_BackupHeader.LogoRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS offset, in media units: {DCIH_ID_BackupHeader.ExeFSOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS size, in media units: {DCIH_ID_BackupHeader.ExeFSSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS hash region size, in media units: {DCIH_ID_BackupHeader.ExeFSHashRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS offset, in media units: {DCIH_ID_BackupHeader.RomFSOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS size, in media units: {DCIH_ID_BackupHeader.RomFSSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS hash region size, in media units: {DCIH_ID_BackupHeader.RomFSHashRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 4: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Backup Header:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic ID: {DCIH_ID_BackupHeader.MagicID} (0x{DCIH_ID_BackupHeader.MagicID:X})");
|
||||
builder.AppendLine($" Content size in media units: {DCIH_ID_BackupHeader.ContentSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ContentSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Partition ID: {DCIH_ID_BackupHeader.PartitionId} (0x{DCIH_ID_BackupHeader.PartitionId:X})");
|
||||
builder.AppendLine($" Maker code: {DCIH_ID_BackupHeader.MakerCode} (0x{DCIH_ID_BackupHeader.MakerCode:X})");
|
||||
builder.AppendLine($" Version: {DCIH_ID_BackupHeader.Version} (0x{DCIH_ID_BackupHeader.Version:X})");
|
||||
builder.AppendLine($" Verification hash: {DCIH_ID_BackupHeader.VerificationHash} (0x{DCIH_ID_BackupHeader.VerificationHash:X})");
|
||||
builder.AppendLine($" Program ID: {BitConverter.ToString(DCIH_ID_BackupHeader.ProgramId).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Logo region SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Product code: {DCIH_ID_BackupHeader.ProductCode} (0x{DCIH_ID_BackupHeader.ProductCode:X})");
|
||||
builder.AppendLine($" Extended header SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Extended header size in bytes: {DCIH_ID_BackupHeader.ExtendedHeaderSizeInBytes} (0x{DCIH_ID_BackupHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Flags: {DCIH_ID_BackupHeader.Flags} (0x{DCIH_ID_BackupHeader.Flags:X})");
|
||||
builder.AppendLine($" Plain region offset, in media units: {DCIH_ID_BackupHeader.PlainRegionOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Plain region size, in media units: {DCIH_ID_BackupHeader.PlainRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region offset, in media units: {DCIH_ID_BackupHeader.LogoRegionOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region size, in media units: {DCIH_ID_BackupHeader.LogoRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS offset, in media units: {DCIH_ID_BackupHeader.ExeFSOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS size, in media units: {DCIH_ID_BackupHeader.ExeFSSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS hash region size, in media units: {DCIH_ID_BackupHeader.ExeFSHashRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS offset, in media units: {DCIH_ID_BackupHeader.RomFSOffsetInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS size, in media units: {DCIH_ID_BackupHeader.RomFSSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS hash region size, in media units: {DCIH_ID_BackupHeader.RomFSHashRegionSizeInMediaUnits} (0x{DCIH_ID_BackupHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 4: {BitConverter.ToString(DCIH_ID_BackupHeader.Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(DCIH_ID_BackupHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine($" Card device reserved 1: {BitConverter.ToString(DCIH_CardDeviceReserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Title key: {BitConverter.ToString(DCIH_TitleKey).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Card device reserved 2: {BitConverter.ToString(DCIH_CardDeviceReserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine($" Card device reserved 1: {BitConverter.ToString(DCIH_CardDeviceReserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Title key: {BitConverter.ToString(DCIH_TitleKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Card device reserved 2: {BitConverter.ToString(DCIH_CardDeviceReserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
|
||||
Console.WriteLine(" Test Data:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {BitConverter.ToString(DCIH_TD_Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Ascending byte sequence: {BitConverter.ToString(DCIH_TD_AscendingByteSequence).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Descending byte sequence: {BitConverter.ToString(DCIH_TD_DescendingByteSequence).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with 00: {BitConverter.ToString(DCIH_TD_Filled00).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with FF: {BitConverter.ToString(DCIH_TD_FilledFF).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with 0F: {BitConverter.ToString(DCIH_TD_Filled0F).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with F0: {BitConverter.ToString(DCIH_TD_FilledF0).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with 55: {BitConverter.ToString(DCIH_TD_Filled55).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Filled with AA: {BitConverter.ToString(DCIH_TD_FilledAA).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Final byte: {DCIH_TD_FinalByte}");
|
||||
builder.AppendLine(" Test Data:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {BitConverter.ToString(DCIH_TD_Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Ascending byte sequence: {BitConverter.ToString(DCIH_TD_AscendingByteSequence).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Descending byte sequence: {BitConverter.ToString(DCIH_TD_DescendingByteSequence).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with 00: {BitConverter.ToString(DCIH_TD_Filled00).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with FF: {BitConverter.ToString(DCIH_TD_FilledFF).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with 0F: {BitConverter.ToString(DCIH_TD_Filled0F).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with F0: {BitConverter.ToString(DCIH_TD_FilledF0).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with 55: {BitConverter.ToString(DCIH_TD_Filled55).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Filled with AA: {BitConverter.ToString(DCIH_TD_FilledAA).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Final byte: {DCIH_TD_FinalByte}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print NCCH partition header information
|
||||
/// </summary>
|
||||
private void PrintPartitions()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintPartitions(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" NCCH Partition Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Partitions == null || Partitions.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No NCCH partition headers");
|
||||
builder.AppendLine(" No NCCH partition headers");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Partitions.Length; i++)
|
||||
{
|
||||
var partitionHeader = Partitions[i];
|
||||
Console.WriteLine($" NCCH Partition Header {i}");
|
||||
builder.AppendLine($" NCCH Partition Header {i}");
|
||||
if (partitionHeader.MagicID == string.Empty)
|
||||
{
|
||||
Console.WriteLine($" Empty partition, no data can be parsed");
|
||||
builder.AppendLine($" Empty partition, no data can be parsed");
|
||||
}
|
||||
else if (partitionHeader.MagicID != Models.N3DS.Constants.NCCHMagicNumber)
|
||||
{
|
||||
Console.WriteLine($" Unrecognized partition data, no data can be parsed");
|
||||
builder.AppendLine($" Unrecognized partition data, no data can be parsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(partitionHeader.RSA2048Signature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Magic ID: {partitionHeader.MagicID} (0x{partitionHeader.MagicID:X})");
|
||||
Console.WriteLine($" Content size in media units: {partitionHeader.ContentSizeInMediaUnits} (0x{partitionHeader.ContentSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Partition ID: {partitionHeader.PartitionId} (0x{partitionHeader.PartitionId:X})");
|
||||
Console.WriteLine($" Maker code: {partitionHeader.MakerCode} (0x{partitionHeader.MakerCode:X})");
|
||||
Console.WriteLine($" Version: {partitionHeader.Version} (0x{partitionHeader.Version:X})");
|
||||
Console.WriteLine($" Verification hash: {partitionHeader.VerificationHash} (0x{partitionHeader.VerificationHash:X})");
|
||||
Console.WriteLine($" Program ID: {BitConverter.ToString(partitionHeader.ProgramId).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(partitionHeader.Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Logo region SHA-256 hash: {BitConverter.ToString(partitionHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Product code: {partitionHeader.ProductCode} (0x{partitionHeader.ProductCode:X})");
|
||||
Console.WriteLine($" Extended header SHA-256 hash: {BitConverter.ToString(partitionHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Extended header size in bytes: {partitionHeader.ExtendedHeaderSizeInBytes} (0x{partitionHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(partitionHeader.Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine(" Flags:");
|
||||
Console.WriteLine($" Reserved 0: {partitionHeader.Flags.Reserved0} (0x{partitionHeader.Flags.Reserved0:X})");
|
||||
Console.WriteLine($" Reserved 1: {partitionHeader.Flags.Reserved1} (0x{partitionHeader.Flags.Reserved1:X})");
|
||||
Console.WriteLine($" Reserved 2: {partitionHeader.Flags.Reserved2} (0x{partitionHeader.Flags.Reserved2:X})");
|
||||
Console.WriteLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
|
||||
Console.WriteLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
|
||||
Console.WriteLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
|
||||
Console.WriteLine($" Content unit size: {partitionHeader.Flags.ContentUnitSize} (0x{partitionHeader.Flags.ContentUnitSize:X})");
|
||||
Console.WriteLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
|
||||
Console.WriteLine($" Plain region offset, in media units: {partitionHeader.PlainRegionOffsetInMediaUnits} (0x{partitionHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Plain region size, in media units: {partitionHeader.PlainRegionSizeInMediaUnits} (0x{partitionHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region offset, in media units: {partitionHeader.LogoRegionOffsetInMediaUnits} (0x{partitionHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" Logo region size, in media units: {partitionHeader.LogoRegionSizeInMediaUnits} (0x{partitionHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS offset, in media units: {partitionHeader.ExeFSOffsetInMediaUnits} (0x{partitionHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS size, in media units: {partitionHeader.ExeFSSizeInMediaUnits} (0x{partitionHeader.ExeFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" ExeFS hash region size, in media units: {partitionHeader.ExeFSHashRegionSizeInMediaUnits} (0x{partitionHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 3: {BitConverter.ToString(partitionHeader.Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS offset, in media units: {partitionHeader.RomFSOffsetInMediaUnits} (0x{partitionHeader.RomFSOffsetInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS size, in media units: {partitionHeader.RomFSSizeInMediaUnits} (0x{partitionHeader.RomFSSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" RomFS hash region size, in media units: {partitionHeader.RomFSHashRegionSizeInMediaUnits} (0x{partitionHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
Console.WriteLine($" Reserved 4: {BitConverter.ToString(partitionHeader.Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RSA-2048 SHA-256 signature: {BitConverter.ToString(partitionHeader.RSA2048Signature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Magic ID: {partitionHeader.MagicID} (0x{partitionHeader.MagicID:X})");
|
||||
builder.AppendLine($" Content size in media units: {partitionHeader.ContentSizeInMediaUnits} (0x{partitionHeader.ContentSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Partition ID: {partitionHeader.PartitionId} (0x{partitionHeader.PartitionId:X})");
|
||||
builder.AppendLine($" Maker code: {partitionHeader.MakerCode} (0x{partitionHeader.MakerCode:X})");
|
||||
builder.AppendLine($" Version: {partitionHeader.Version} (0x{partitionHeader.Version:X})");
|
||||
builder.AppendLine($" Verification hash: {partitionHeader.VerificationHash} (0x{partitionHeader.VerificationHash:X})");
|
||||
builder.AppendLine($" Program ID: {BitConverter.ToString(partitionHeader.ProgramId).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(partitionHeader.Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Logo region SHA-256 hash: {BitConverter.ToString(partitionHeader.LogoRegionHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Product code: {partitionHeader.ProductCode} (0x{partitionHeader.ProductCode:X})");
|
||||
builder.AppendLine($" Extended header SHA-256 hash: {BitConverter.ToString(partitionHeader.ExtendedHeaderHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Extended header size in bytes: {partitionHeader.ExtendedHeaderSizeInBytes} (0x{partitionHeader.ExtendedHeaderSizeInBytes:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(partitionHeader.Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine(" Flags:");
|
||||
builder.AppendLine($" Reserved 0: {partitionHeader.Flags.Reserved0} (0x{partitionHeader.Flags.Reserved0:X})");
|
||||
builder.AppendLine($" Reserved 1: {partitionHeader.Flags.Reserved1} (0x{partitionHeader.Flags.Reserved1:X})");
|
||||
builder.AppendLine($" Reserved 2: {partitionHeader.Flags.Reserved2} (0x{partitionHeader.Flags.Reserved2:X})");
|
||||
builder.AppendLine($" Crypto method: {partitionHeader.Flags.CryptoMethod} (0x{partitionHeader.Flags.CryptoMethod:X})");
|
||||
builder.AppendLine($" Content platform: {partitionHeader.Flags.ContentPlatform} (0x{partitionHeader.Flags.ContentPlatform:X})");
|
||||
builder.AppendLine($" Content type: {partitionHeader.Flags.MediaPlatformIndex} (0x{partitionHeader.Flags.MediaPlatformIndex:X})");
|
||||
builder.AppendLine($" Content unit size: {partitionHeader.Flags.ContentUnitSize} (0x{partitionHeader.Flags.ContentUnitSize:X})");
|
||||
builder.AppendLine($" Bitmasks: {partitionHeader.Flags.BitMasks} (0x{partitionHeader.Flags.BitMasks:X})");
|
||||
builder.AppendLine($" Plain region offset, in media units: {partitionHeader.PlainRegionOffsetInMediaUnits} (0x{partitionHeader.PlainRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Plain region size, in media units: {partitionHeader.PlainRegionSizeInMediaUnits} (0x{partitionHeader.PlainRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region offset, in media units: {partitionHeader.LogoRegionOffsetInMediaUnits} (0x{partitionHeader.LogoRegionOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" Logo region size, in media units: {partitionHeader.LogoRegionSizeInMediaUnits} (0x{partitionHeader.LogoRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS offset, in media units: {partitionHeader.ExeFSOffsetInMediaUnits} (0x{partitionHeader.ExeFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS size, in media units: {partitionHeader.ExeFSSizeInMediaUnits} (0x{partitionHeader.ExeFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" ExeFS hash region size, in media units: {partitionHeader.ExeFSHashRegionSizeInMediaUnits} (0x{partitionHeader.ExeFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 3: {BitConverter.ToString(partitionHeader.Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS offset, in media units: {partitionHeader.RomFSOffsetInMediaUnits} (0x{partitionHeader.RomFSOffsetInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS size, in media units: {partitionHeader.RomFSSizeInMediaUnits} (0x{partitionHeader.RomFSSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" RomFS hash region size, in media units: {partitionHeader.RomFSHashRegionSizeInMediaUnits} (0x{partitionHeader.RomFSHashRegionSizeInMediaUnits:X})");
|
||||
builder.AppendLine($" Reserved 4: {BitConverter.ToString(partitionHeader.Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ExeFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.ExeFSSuperblockHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RomFS superblock SHA-256 hash: {BitConverter.ToString(partitionHeader.RomFSSuperblockHash).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print NCCH extended header information
|
||||
/// </summary>
|
||||
private void PrintExtendedHeaders()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintExtendedHeaders(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" NCCH Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" NCCH Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ExtendedHeaders == null || ExtendedHeaders.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No NCCH extended headers");
|
||||
builder.AppendLine(" No NCCH extended headers");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ExtendedHeaders.Length; i++)
|
||||
{
|
||||
var extendedHeader = ExtendedHeaders[i];
|
||||
Console.WriteLine($" NCCH Extended Header {i}");
|
||||
builder.AppendLine($" NCCH Extended Header {i}");
|
||||
if (extendedHeader == null)
|
||||
{
|
||||
Console.WriteLine($" Unrecognized partition data, no data can be parsed");
|
||||
builder.AppendLine($" Unrecognized partition data, no data can be parsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" System control info:");
|
||||
Console.WriteLine($" Application title: {extendedHeader.SCI.ApplicationTitle}");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(extendedHeader.SCI.Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Flag: {extendedHeader.SCI.Flag} (0x{extendedHeader.SCI.Flag:X})");
|
||||
Console.WriteLine($" Remaster version: {extendedHeader.SCI.RemasterVersion} (0x{extendedHeader.SCI.RemasterVersion:X})");
|
||||
builder.AppendLine($" System control info:");
|
||||
builder.AppendLine($" Application title: {extendedHeader.SCI.ApplicationTitle}");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(extendedHeader.SCI.Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Flag: {extendedHeader.SCI.Flag} (0x{extendedHeader.SCI.Flag:X})");
|
||||
builder.AppendLine($" Remaster version: {extendedHeader.SCI.RemasterVersion} (0x{extendedHeader.SCI.RemasterVersion:X})");
|
||||
|
||||
Console.WriteLine($" Text code set info:");
|
||||
Console.WriteLine($" Address: {extendedHeader.SCI.TextCodeSetInfo.Address} (0x{extendedHeader.SCI.TextCodeSetInfo.Address:X})");
|
||||
Console.WriteLine($" Physical region size (in page-multiples): {extendedHeader.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
Console.WriteLine($" Size (in bytes): {extendedHeader.SCI.TextCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.TextCodeSetInfo.SizeInBytes:X})");
|
||||
builder.AppendLine($" Text code set info:");
|
||||
builder.AppendLine($" Address: {extendedHeader.SCI.TextCodeSetInfo.Address} (0x{extendedHeader.SCI.TextCodeSetInfo.Address:X})");
|
||||
builder.AppendLine($" Physical region size (in page-multiples): {extendedHeader.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.TextCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
builder.AppendLine($" Size (in bytes): {extendedHeader.SCI.TextCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.TextCodeSetInfo.SizeInBytes:X})");
|
||||
|
||||
Console.WriteLine($" Stack size: {extendedHeader.SCI.StackSize} (0x{extendedHeader.SCI.StackSize:X})");
|
||||
builder.AppendLine($" Stack size: {extendedHeader.SCI.StackSize} (0x{extendedHeader.SCI.StackSize:X})");
|
||||
|
||||
Console.WriteLine($" Read-only code set info:");
|
||||
Console.WriteLine($" Address: {extendedHeader.SCI.ReadOnlyCodeSetInfo.Address} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.Address:X})");
|
||||
Console.WriteLine($" Physical region size (in page-multiples): {extendedHeader.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
Console.WriteLine($" Size (in bytes): {extendedHeader.SCI.ReadOnlyCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.SizeInBytes:X})");
|
||||
builder.AppendLine($" Read-only code set info:");
|
||||
builder.AppendLine($" Address: {extendedHeader.SCI.ReadOnlyCodeSetInfo.Address} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.Address:X})");
|
||||
builder.AppendLine($" Physical region size (in page-multiples): {extendedHeader.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
builder.AppendLine($" Size (in bytes): {extendedHeader.SCI.ReadOnlyCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.ReadOnlyCodeSetInfo.SizeInBytes:X})");
|
||||
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(extendedHeader.SCI.Reserved2).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(extendedHeader.SCI.Reserved2).Replace('-', newChar: ' ')}");
|
||||
|
||||
Console.WriteLine($" Data code set info:");
|
||||
Console.WriteLine($" Address: {extendedHeader.SCI.DataCodeSetInfo.Address} (0x{extendedHeader.SCI.DataCodeSetInfo.Address:X})");
|
||||
Console.WriteLine($" Physical region size (in page-multiples): {extendedHeader.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
Console.WriteLine($" Size (in bytes): {extendedHeader.SCI.DataCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.DataCodeSetInfo.SizeInBytes:X})");
|
||||
builder.AppendLine($" Data code set info:");
|
||||
builder.AppendLine($" Address: {extendedHeader.SCI.DataCodeSetInfo.Address} (0x{extendedHeader.SCI.DataCodeSetInfo.Address:X})");
|
||||
builder.AppendLine($" Physical region size (in page-multiples): {extendedHeader.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages} (0x{extendedHeader.SCI.DataCodeSetInfo.PhysicalRegionSizeInPages:X})");
|
||||
builder.AppendLine($" Size (in bytes): {extendedHeader.SCI.DataCodeSetInfo.SizeInBytes} (0x{extendedHeader.SCI.DataCodeSetInfo.SizeInBytes:X})");
|
||||
|
||||
Console.WriteLine($" BSS size: {extendedHeader.SCI.BSSSize} (0x{extendedHeader.SCI.BSSSize:X})");
|
||||
Console.WriteLine($" Dependency module list: {string.Join(", ", extendedHeader.SCI.DependencyModuleList)}");
|
||||
builder.AppendLine($" BSS size: {extendedHeader.SCI.BSSSize} (0x{extendedHeader.SCI.BSSSize:X})");
|
||||
builder.AppendLine($" Dependency module list: {string.Join(", ", extendedHeader.SCI.DependencyModuleList)}");
|
||||
|
||||
Console.WriteLine($" System info:");
|
||||
Console.WriteLine($" SaveData size: {extendedHeader.SCI.SystemInfo.SaveDataSize} (0x{extendedHeader.SCI.SystemInfo.SaveDataSize:X})");
|
||||
Console.WriteLine($" Jump ID: {extendedHeader.SCI.SystemInfo.JumpID} (0x{extendedHeader.SCI.SystemInfo.JumpID:X})");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(extendedHeader.SCI.SystemInfo.Reserved).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" System info:");
|
||||
builder.AppendLine($" SaveData size: {extendedHeader.SCI.SystemInfo.SaveDataSize} (0x{extendedHeader.SCI.SystemInfo.SaveDataSize:X})");
|
||||
builder.AppendLine($" Jump ID: {extendedHeader.SCI.SystemInfo.JumpID} (0x{extendedHeader.SCI.SystemInfo.JumpID:X})");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(extendedHeader.SCI.SystemInfo.Reserved).Replace('-', newChar: ' ')}");
|
||||
|
||||
Console.WriteLine($" Access control info:");
|
||||
Console.WriteLine($" ARM11 local system capabilities:");
|
||||
Console.WriteLine($" Program ID: {extendedHeader.ACI.ARM11LocalSystemCapabilities.ProgramID} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.ProgramID:X})");
|
||||
Console.WriteLine($" Core version: {extendedHeader.ACI.ARM11LocalSystemCapabilities.CoreVersion} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.CoreVersion:X})");
|
||||
Console.WriteLine($" Flag 1: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag1} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag1:X})");
|
||||
Console.WriteLine($" Flag 2: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag2} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag2:X})");
|
||||
Console.WriteLine($" Flag 0: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag0} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag0:X})");
|
||||
Console.WriteLine($" Priority: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Priority} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Priority:X})");
|
||||
Console.WriteLine($" Resource limit descriptors: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitDescriptors)}");
|
||||
builder.AppendLine($" Access control info:");
|
||||
builder.AppendLine($" ARM11 local system capabilities:");
|
||||
builder.AppendLine($" Program ID: {extendedHeader.ACI.ARM11LocalSystemCapabilities.ProgramID} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.ProgramID:X})");
|
||||
builder.AppendLine($" Core version: {extendedHeader.ACI.ARM11LocalSystemCapabilities.CoreVersion} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.CoreVersion:X})");
|
||||
builder.AppendLine($" Flag 1: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag1} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag1:X})");
|
||||
builder.AppendLine($" Flag 2: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag2} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag2:X})");
|
||||
builder.AppendLine($" Flag 0: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag0} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Flag0:X})");
|
||||
builder.AppendLine($" Priority: {extendedHeader.ACI.ARM11LocalSystemCapabilities.Priority} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.Priority:X})");
|
||||
builder.AppendLine($" Resource limit descriptors: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitDescriptors)}");
|
||||
|
||||
Console.WriteLine($" Storage info:");
|
||||
Console.WriteLine($" Extdata ID: {extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID:X})");
|
||||
Console.WriteLine($" System savedata IDs: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Storage accessible unique IDs: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" File system access info: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Other attributes: {extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
|
||||
builder.AppendLine($" Storage info:");
|
||||
builder.AppendLine($" Extdata ID: {extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID:X})");
|
||||
builder.AppendLine($" System savedata IDs: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Storage accessible unique IDs: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" File system access info: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Other attributes: {extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
|
||||
|
||||
Console.WriteLine($" Service access control: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ServiceAccessControl)}");
|
||||
Console.WriteLine($" Extended service access control: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl)}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Resource limit cateogry: {extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
|
||||
builder.AppendLine($" Service access control: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ServiceAccessControl)}");
|
||||
builder.AppendLine($" Extended service access control: {string.Join(", ", extendedHeader.ACI.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl)}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(extendedHeader.ACI.ARM11LocalSystemCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Resource limit cateogry: {extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{extendedHeader.ACI.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
|
||||
|
||||
Console.WriteLine($" ARM11 kernel capabilities:");
|
||||
Console.WriteLine($" Descriptors: {string.Join(", ", extendedHeader.ACI.ARM11KernelCapabilities.Descriptors)}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(extendedHeader.ACI.ARM11KernelCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" ARM11 kernel capabilities:");
|
||||
builder.AppendLine($" Descriptors: {string.Join(", ", extendedHeader.ACI.ARM11KernelCapabilities.Descriptors)}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(extendedHeader.ACI.ARM11KernelCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
|
||||
Console.WriteLine($" ARM9 access control:");
|
||||
Console.WriteLine($" Descriptors: {BitConverter.ToString(extendedHeader.ACI.ARM9AccessControl.Descriptors).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Descriptor version: {extendedHeader.ACI.ARM9AccessControl.DescriptorVersion} (0x{extendedHeader.ACI.ARM9AccessControl.DescriptorVersion:X})");
|
||||
builder.AppendLine($" ARM9 access control:");
|
||||
builder.AppendLine($" Descriptors: {BitConverter.ToString(extendedHeader.ACI.ARM9AccessControl.Descriptors).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Descriptor version: {extendedHeader.ACI.ARM9AccessControl.DescriptorVersion} (0x{extendedHeader.ACI.ARM9AccessControl.DescriptorVersion:X})");
|
||||
|
||||
Console.WriteLine($" AccessDec signature (RSA-2048-SHA256): {BitConverter.ToString(extendedHeader.AccessDescSignature).Replace('-', ' ')}");
|
||||
Console.WriteLine($" NCCH HDR RSA-2048 public key: {BitConverter.ToString(extendedHeader.NCCHHDRPublicKey).Replace('-', ' ')}");
|
||||
builder.AppendLine($" AccessDec signature (RSA-2048-SHA256): {BitConverter.ToString(extendedHeader.AccessDescSignature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" NCCH HDR RSA-2048 public key: {BitConverter.ToString(extendedHeader.NCCHHDRPublicKey).Replace('-', ' ')}");
|
||||
|
||||
|
||||
Console.WriteLine($" Access control info (for limitations of first ACI):");
|
||||
Console.WriteLine($" ARM11 local system capabilities:");
|
||||
Console.WriteLine($" Program ID: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID:X})");
|
||||
Console.WriteLine($" Core version: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion:X})");
|
||||
Console.WriteLine($" Flag 1: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1:X})");
|
||||
Console.WriteLine($" Flag 2: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2:X})");
|
||||
Console.WriteLine($" Flag 0: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0:X})");
|
||||
Console.WriteLine($" Priority: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Priority} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Priority:X})");
|
||||
Console.WriteLine($" Resource limit descriptors: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitDescriptors)}");
|
||||
builder.AppendLine($" Access control info (for limitations of first ACI):");
|
||||
builder.AppendLine($" ARM11 local system capabilities:");
|
||||
builder.AppendLine($" Program ID: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ProgramID:X})");
|
||||
builder.AppendLine($" Core version: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.CoreVersion:X})");
|
||||
builder.AppendLine($" Flag 1: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag1:X})");
|
||||
builder.AppendLine($" Flag 2: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag2:X})");
|
||||
builder.AppendLine($" Flag 0: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Flag0:X})");
|
||||
builder.AppendLine($" Priority: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Priority} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Priority:X})");
|
||||
builder.AppendLine($" Resource limit descriptors: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitDescriptors)}");
|
||||
|
||||
Console.WriteLine($" Storage info:");
|
||||
Console.WriteLine($" Extdata ID: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID:X})");
|
||||
Console.WriteLine($" System savedata IDs: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Storage accessible unique IDs: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" File system access info: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Other attributes: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
|
||||
builder.AppendLine($" Storage info:");
|
||||
builder.AppendLine($" Extdata ID: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.ExtdataID:X})");
|
||||
builder.AppendLine($" System savedata IDs: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.SystemSavedataIDs).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Storage accessible unique IDs: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.StorageAccessibleUniqueIDs).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" File system access info: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.FileSystemAccessInfo).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Other attributes: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.StorageInfo.OtherAttributes:X})");
|
||||
|
||||
Console.WriteLine($" Service access control: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ServiceAccessControl)}");
|
||||
Console.WriteLine($" Extended service access control: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl)}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Resource limit cateogry: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
|
||||
builder.AppendLine($" Service access control: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ServiceAccessControl)}");
|
||||
builder.AppendLine($" Extended service access control: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ExtendedServiceAccessControl)}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Resource limit cateogry: {extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory} (0x{extendedHeader.ACIForLimitations.ARM11LocalSystemCapabilities.ResourceLimitCategory:X})");
|
||||
|
||||
Console.WriteLine($" ARM11 kernel capabilities:");
|
||||
Console.WriteLine($" Descriptors: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11KernelCapabilities.Descriptors)}");
|
||||
Console.WriteLine($" Reserved: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11KernelCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" ARM11 kernel capabilities:");
|
||||
builder.AppendLine($" Descriptors: {string.Join(", ", extendedHeader.ACIForLimitations.ARM11KernelCapabilities.Descriptors)}");
|
||||
builder.AppendLine($" Reserved: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM11KernelCapabilities.Reserved).Replace('-', newChar: ' ')}");
|
||||
|
||||
Console.WriteLine($" ARM9 access control:");
|
||||
Console.WriteLine($" Descriptors: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM9AccessControl.Descriptors).Replace('-', newChar: ' ')}");
|
||||
Console.WriteLine($" Descriptor version: {extendedHeader.ACIForLimitations.ARM9AccessControl.DescriptorVersion} (0x{extendedHeader.ACIForLimitations.ARM9AccessControl.DescriptorVersion:X})");
|
||||
builder.AppendLine($" ARM9 access control:");
|
||||
builder.AppendLine($" Descriptors: {BitConverter.ToString(extendedHeader.ACIForLimitations.ARM9AccessControl.Descriptors).Replace('-', newChar: ' ')}");
|
||||
builder.AppendLine($" Descriptor version: {extendedHeader.ACIForLimitations.ARM9AccessControl.DescriptorVersion} (0x{extendedHeader.ACIForLimitations.ARM9AccessControl.DescriptorVersion:X})");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print ExeFS header information
|
||||
/// </summary>
|
||||
private void PrintExeFSHeaders()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintExeFSHeaders(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" ExeFS Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" ExeFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ExeFSHeaders == null || ExeFSHeaders.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No ExeFS headers");
|
||||
builder.AppendLine(" No ExeFS headers");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ExeFSHeaders.Length; i++)
|
||||
{
|
||||
var exeFSHeader = ExeFSHeaders[i];
|
||||
Console.WriteLine($" ExeFS Header {i}");
|
||||
builder.AppendLine($" ExeFS Header {i}");
|
||||
if (exeFSHeader == null)
|
||||
{
|
||||
Console.WriteLine($" Unrecognized partition data, no data can be parsed");
|
||||
builder.AppendLine($" Unrecognized partition data, no data can be parsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" File headers:");
|
||||
builder.AppendLine($" File headers:");
|
||||
for (int j = 0; j < exeFSHeader.FileHeaders.Length; j++)
|
||||
{
|
||||
var fileHeader = exeFSHeader.FileHeaders[j];
|
||||
Console.WriteLine(value: $" File Header {j}");
|
||||
Console.WriteLine(value: $" File name: {fileHeader.FileName}");
|
||||
Console.WriteLine(value: $" File offset: {fileHeader.FileOffset} (0x{fileHeader.FileOffset:X})");
|
||||
Console.WriteLine(value: $" File size: {fileHeader.FileSize} (0x{fileHeader.FileSize:X})");
|
||||
builder.AppendLine(value: $" File Header {j}");
|
||||
builder.AppendLine(value: $" File name: {fileHeader.FileName}");
|
||||
builder.AppendLine(value: $" File offset: {fileHeader.FileOffset} (0x{fileHeader.FileOffset:X})");
|
||||
builder.AppendLine(value: $" File size: {fileHeader.FileSize} (0x{fileHeader.FileSize:X})");
|
||||
}
|
||||
|
||||
Console.WriteLine(value: $" Reserved: {BitConverter.ToString(exeFSHeader.Reserved).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Reserved: {BitConverter.ToString(exeFSHeader.Reserved).Replace('-', ' ')}");
|
||||
|
||||
Console.WriteLine($" File hashes:");
|
||||
builder.AppendLine($" File hashes:");
|
||||
for (int j = 0; j < exeFSHeader.FileHashes.Length; j++)
|
||||
{
|
||||
var fileHash = exeFSHeader.FileHashes[j];
|
||||
Console.WriteLine(value: $" File Hash {j}");
|
||||
Console.WriteLine(value: $" SHA-256: {BitConverter.ToString(fileHash).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" File Hash {j}");
|
||||
builder.AppendLine(value: $" SHA-256: {BitConverter.ToString(fileHash).Replace('-', ' ')}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print RomFS header information
|
||||
/// </summary>
|
||||
private void PrintRomFSHeaders()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintRomFSHeaders(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" RomFS Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" RomFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (RomFSHeaders == null || RomFSHeaders.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No RomFS headers");
|
||||
builder.AppendLine(" No RomFS headers");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < RomFSHeaders.Length; i++)
|
||||
{
|
||||
var romFSHeader = RomFSHeaders[i];
|
||||
Console.WriteLine($" RomFS Header {i}");
|
||||
builder.AppendLine($" RomFS Header {i}");
|
||||
if (romFSHeader == null)
|
||||
{
|
||||
Console.WriteLine($" Unrecognized RomFS data, no data can be parsed");
|
||||
builder.AppendLine($" Unrecognized RomFS data, no data can be parsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(value: $" Magic string: {romFSHeader.MagicString}");
|
||||
Console.WriteLine(value: $" Magic number: {romFSHeader.MagicNumber} (0x{romFSHeader.MagicNumber:X})");
|
||||
Console.WriteLine(value: $" Master hash size: {romFSHeader.MasterHashSize} (0x{romFSHeader.MasterHashSize:X})");
|
||||
Console.WriteLine(value: $" Level 1 logical offset: {romFSHeader.Level1LogicalOffset} (0x{romFSHeader.Level1LogicalOffset:X})");
|
||||
Console.WriteLine(value: $" Level 1 hashdata size: {romFSHeader.Level1HashdataSize} (0x{romFSHeader.Level1HashdataSize:X})");
|
||||
Console.WriteLine(value: $" Level 1 block size: {romFSHeader.Level1BlockSizeLog2} (0x{romFSHeader.Level1BlockSizeLog2:X})");
|
||||
Console.WriteLine(value: $" Reserved 1: {BitConverter.ToString(romFSHeader.Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine(value: $" Level 2 logical offset: {romFSHeader.Level2LogicalOffset} (0x{romFSHeader.Level2LogicalOffset:X})");
|
||||
Console.WriteLine(value: $" Level 2 hashdata size: {romFSHeader.Level2HashdataSize} (0x{romFSHeader.Level2HashdataSize:X})");
|
||||
Console.WriteLine(value: $" Level 2 block size: {romFSHeader.Level2BlockSizeLog2} (0x{romFSHeader.Level2BlockSizeLog2:X})");
|
||||
Console.WriteLine(value: $" Reserved 2: {BitConverter.ToString(romFSHeader.Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine(value: $" Level 3 logical offset: {romFSHeader.Level3LogicalOffset} (0x{romFSHeader.Level3LogicalOffset:X})");
|
||||
Console.WriteLine(value: $" Level 3 hashdata size: {romFSHeader.Level3HashdataSize} (0x{romFSHeader.Level3HashdataSize:X})");
|
||||
Console.WriteLine(value: $" Level 3 block size: {romFSHeader.Level3BlockSizeLog2} (0x{romFSHeader.Level3BlockSizeLog2:X})");
|
||||
Console.WriteLine(value: $" Reserved 3: {BitConverter.ToString(romFSHeader.Reserved3).Replace('-', ' ')}");
|
||||
Console.WriteLine(value: $" Reserved 4: {BitConverter.ToString(romFSHeader.Reserved4).Replace('-', ' ')}");
|
||||
Console.WriteLine(value: $" Optional info size: {romFSHeader.OptionalInfoSize} (0x{romFSHeader.OptionalInfoSize:X})");
|
||||
builder.AppendLine(value: $" Magic string: {romFSHeader.MagicString}");
|
||||
builder.AppendLine(value: $" Magic number: {romFSHeader.MagicNumber} (0x{romFSHeader.MagicNumber:X})");
|
||||
builder.AppendLine(value: $" Master hash size: {romFSHeader.MasterHashSize} (0x{romFSHeader.MasterHashSize:X})");
|
||||
builder.AppendLine(value: $" Level 1 logical offset: {romFSHeader.Level1LogicalOffset} (0x{romFSHeader.Level1LogicalOffset:X})");
|
||||
builder.AppendLine(value: $" Level 1 hashdata size: {romFSHeader.Level1HashdataSize} (0x{romFSHeader.Level1HashdataSize:X})");
|
||||
builder.AppendLine(value: $" Level 1 block size: {romFSHeader.Level1BlockSizeLog2} (0x{romFSHeader.Level1BlockSizeLog2:X})");
|
||||
builder.AppendLine(value: $" Reserved 1: {BitConverter.ToString(romFSHeader.Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Level 2 logical offset: {romFSHeader.Level2LogicalOffset} (0x{romFSHeader.Level2LogicalOffset:X})");
|
||||
builder.AppendLine(value: $" Level 2 hashdata size: {romFSHeader.Level2HashdataSize} (0x{romFSHeader.Level2HashdataSize:X})");
|
||||
builder.AppendLine(value: $" Level 2 block size: {romFSHeader.Level2BlockSizeLog2} (0x{romFSHeader.Level2BlockSizeLog2:X})");
|
||||
builder.AppendLine(value: $" Reserved 2: {BitConverter.ToString(romFSHeader.Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Level 3 logical offset: {romFSHeader.Level3LogicalOffset} (0x{romFSHeader.Level3LogicalOffset:X})");
|
||||
builder.AppendLine(value: $" Level 3 hashdata size: {romFSHeader.Level3HashdataSize} (0x{romFSHeader.Level3HashdataSize:X})");
|
||||
builder.AppendLine(value: $" Level 3 block size: {romFSHeader.Level3BlockSizeLog2} (0x{romFSHeader.Level3BlockSizeLog2:X})");
|
||||
builder.AppendLine(value: $" Reserved 3: {BitConverter.ToString(romFSHeader.Reserved3).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Reserved 4: {BitConverter.ToString(romFSHeader.Reserved4).Replace('-', ' ')}");
|
||||
builder.AppendLine(value: $" Optional info size: {romFSHeader.OptionalInfoSize} (0x{romFSHeader.OptionalInfoSize:X})");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -257,306 +257,323 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("NCF Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("NCF Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Header
|
||||
PrintHeader();
|
||||
PrintHeader(builder);
|
||||
|
||||
// Directory and Directory Maps
|
||||
PrintDirectoryHeader();
|
||||
PrintDirectoryEntries();
|
||||
PrintDirectoryHeader(builder);
|
||||
PrintDirectoryEntries(builder);
|
||||
// TODO: Should we print out the entire string table?
|
||||
PrintDirectoryInfo1Entries();
|
||||
PrintDirectoryInfo2Entries();
|
||||
PrintDirectoryCopyEntries();
|
||||
PrintDirectoryLocalEntries();
|
||||
PrintUnknownHeader();
|
||||
PrintUnknownEntries();
|
||||
PrintDirectoryInfo1Entries(builder);
|
||||
PrintDirectoryInfo2Entries(builder);
|
||||
PrintDirectoryCopyEntries(builder);
|
||||
PrintDirectoryLocalEntries(builder);
|
||||
PrintUnknownHeader(builder);
|
||||
PrintUnknownEntries(builder);
|
||||
|
||||
// Checksums and Checksum Maps
|
||||
PrintChecksumHeader();
|
||||
PrintChecksumMapHeader();
|
||||
PrintChecksumMapEntries();
|
||||
PrintChecksumEntries();
|
||||
PrintChecksumHeader(builder);
|
||||
PrintChecksumMapHeader(builder);
|
||||
PrintChecksumMapEntries(builder);
|
||||
PrintChecksumEntries(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
|
||||
Console.WriteLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
Console.WriteLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
Console.WriteLine($" Cache ID: {CacheID} (0x{CacheID:X})");
|
||||
Console.WriteLine($" Last version played: {LastVersionPlayed} (0x{LastVersionPlayed:X})");
|
||||
Console.WriteLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
|
||||
Console.WriteLine($" Dummy 2: {Dummy2} (0x{Dummy2:X})");
|
||||
Console.WriteLine($" File size: {FileSize} (0x{FileSize:X})");
|
||||
Console.WriteLine($" Block size: {BlockSize} (0x{BlockSize:X})");
|
||||
Console.WriteLine($" Block count: {BlockCount} (0x{BlockCount:X})");
|
||||
Console.WriteLine($" Dummy 3: {Dummy3} (0x{Dummy3:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory header information
|
||||
/// </summary>
|
||||
private void PrintDirectoryHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {DH_Dummy0} (0x{DH_Dummy0:X})");
|
||||
Console.WriteLine($" Cache ID: {DH_CacheID} (0x{DH_CacheID:X})");
|
||||
Console.WriteLine($" Last version played: {DH_LastVersionPlayed} (0x{DH_LastVersionPlayed:X})");
|
||||
Console.WriteLine($" Item count: {DH_ItemCount} (0x{DH_ItemCount:X})");
|
||||
Console.WriteLine($" File count: {DH_FileCount} (0x{DH_FileCount:X})");
|
||||
Console.WriteLine($" Checksum data length: {DH_ChecksumDataLength} (0x{DH_ChecksumDataLength:X})");
|
||||
Console.WriteLine($" Directory size: {DH_DirectorySize} (0x{DH_DirectorySize:X})");
|
||||
Console.WriteLine($" Name size: {DH_NameSize} (0x{DH_NameSize:X})");
|
||||
Console.WriteLine($" Info 1 count: {DH_Info1Count} (0x{DH_Info1Count:X})");
|
||||
Console.WriteLine($" Copy count: {DH_CopyCount} (0x{DH_CopyCount:X})");
|
||||
Console.WriteLine($" Local count: {DH_LocalCount} (0x{DH_LocalCount:X})");
|
||||
Console.WriteLine($" Dummy 1: {DH_Dummy1} (0x{DH_Dummy1:X})");
|
||||
Console.WriteLine($" Dummy 2: {DH_Dummy2} (0x{DH_Dummy2:X})");
|
||||
Console.WriteLine($" Checksum: {DH_Checksum} (0x{DH_Checksum:X})");
|
||||
Console.WriteLine();
|
||||
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($" Checksum data length: {DH_ChecksumDataLength} (0x{DH_ChecksumDataLength: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 1: {DH_Dummy1} (0x{DH_Dummy1:X})");
|
||||
builder.AppendLine($" Dummy 2: {DH_Dummy2} (0x{DH_Dummy2:X})");
|
||||
builder.AppendLine($" Checksum: {DH_Checksum} (0x{DH_Checksum:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory entries");
|
||||
builder.AppendLine(" No directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = DirectoryEntries[i];
|
||||
Console.WriteLine($" Directory Entry {i}");
|
||||
Console.WriteLine($" Name offset: {directoryEntry.NameOffset} (0x{directoryEntry.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {directoryEntry.Name}");
|
||||
Console.WriteLine($" Item size: {directoryEntry.ItemSize} (0x{directoryEntry.ItemSize:X})");
|
||||
Console.WriteLine($" Checksum index: {directoryEntry.ChecksumIndex} (0x{directoryEntry.ChecksumIndex:X})");
|
||||
Console.WriteLine($" Directory flags: {directoryEntry.DirectoryFlags} (0x{directoryEntry.DirectoryFlags:X})");
|
||||
Console.WriteLine($" Parent index: {directoryEntry.ParentIndex} (0x{directoryEntry.ParentIndex:X})");
|
||||
Console.WriteLine($" Next index: {directoryEntry.NextIndex} (0x{directoryEntry.NextIndex:X})");
|
||||
Console.WriteLine($" First index: {directoryEntry.FirstIndex} (0x{directoryEntry.FirstIndex:X})");
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine($" Name offset: {directoryEntry.NameOffset} (0x{directoryEntry.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {directoryEntry.Name}");
|
||||
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})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 1 entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryInfo1Entries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo1Entries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Info 1 Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo1Entries == null || DirectoryInfo1Entries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory info 1 entries");
|
||||
builder.AppendLine(" No directory info 1 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo1Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo1Entries[i];
|
||||
Console.WriteLine($" Directory Info 1 Entry {i}");
|
||||
Console.WriteLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 2 entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryInfo2Entries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo2Entries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Info 2 Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo2Entries == null || DirectoryInfo2Entries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory info 2 entries");
|
||||
builder.AppendLine(" No directory info 2 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo2Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo2Entries[i];
|
||||
Console.WriteLine($" Directory Info 2 Entry {i}");
|
||||
Console.WriteLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory copy entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryCopyEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryCopyEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Copy Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (DirectoryCopyEntries == null || DirectoryCopyEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory copy entries");
|
||||
builder.AppendLine(" No directory copy entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryCopyEntries.Length; i++)
|
||||
{
|
||||
var directoryCopyEntry = DirectoryCopyEntries[i];
|
||||
Console.WriteLine($" Directory Copy Entry {i}");
|
||||
Console.WriteLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
builder.AppendLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory local entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryLocalEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryLocalEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Local Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (DirectoryLocalEntries == null || DirectoryLocalEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory local entries");
|
||||
builder.AppendLine(" No directory local entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryLocalEntries.Length; i++)
|
||||
{
|
||||
var directoryLocalEntry = DirectoryLocalEntries[i];
|
||||
Console.WriteLine($" Directory Local Entry {i}");
|
||||
Console.WriteLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
builder.AppendLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown header information
|
||||
/// </summary>
|
||||
private void PrintUnknownHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Unknown Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {UH_Dummy0} (0x{UH_Dummy0:X})");
|
||||
Console.WriteLine($" Dummy 1: {UH_Dummy1} (0x{UH_Dummy1:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Unknown Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Dummy 0: {UH_Dummy0} (0x{UH_Dummy0:X})");
|
||||
builder.AppendLine($" Dummy 1: {UH_Dummy1} (0x{UH_Dummy1:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown entries information
|
||||
/// </summary>
|
||||
private void PrintUnknownEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Unknown Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Unknown Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (UnknownEntries == null || UnknownEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No unknown entries");
|
||||
builder.AppendLine(" No unknown entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < UnknownEntries.Length; i++)
|
||||
{
|
||||
var unknownEntry = UnknownEntries[i];
|
||||
Console.WriteLine($" Unknown Entry {i}");
|
||||
Console.WriteLine($" Dummy 0: {unknownEntry.Dummy0} (0x{unknownEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Unknown Entry {i}");
|
||||
builder.AppendLine($" Dummy 0: {unknownEntry.Dummy0} (0x{unknownEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum header information
|
||||
/// </summary>
|
||||
private void PrintChecksumHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {CH_Dummy0} (0x{CH_Dummy0:X})");
|
||||
Console.WriteLine($" Checksum size: {CH_ChecksumSize} (0x{CH_ChecksumSize:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map header information
|
||||
/// </summary>
|
||||
private void PrintChecksumMapHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Map Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Dummy 0: {CMH_Dummy0} (0x{CMH_Dummy0:X})");
|
||||
Console.WriteLine($" Dummy 1: {CMH_Dummy1} (0x{CMH_Dummy1:X})");
|
||||
Console.WriteLine($" Item count: {CMH_ItemCount} (0x{CMH_ItemCount:X})");
|
||||
Console.WriteLine($" Checksum count: {CMH_ChecksumCount} (0x{CMH_ChecksumCount:X})");
|
||||
Console.WriteLine();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map entries information
|
||||
/// </summary>
|
||||
private void PrintChecksumMapEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Map Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (ChecksumMapEntries == null || ChecksumMapEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No checksum map entries");
|
||||
builder.AppendLine(" No checksum map entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumMapEntries.Length; i++)
|
||||
{
|
||||
var checksumMapEntry = ChecksumMapEntries[i];
|
||||
Console.WriteLine($" Checksum Map Entry {i}");
|
||||
Console.WriteLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
|
||||
Console.WriteLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
builder.AppendLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
|
||||
builder.AppendLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum entries information
|
||||
/// </summary>
|
||||
private void PrintChecksumEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Checksum Entries Information:");
|
||||
Console.WriteLine(value: " -------------------------");
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(value: " -------------------------");
|
||||
if (ChecksumEntries == null || ChecksumEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No checksum entries");
|
||||
builder.AppendLine(" No checksum entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumEntries.Length; i++)
|
||||
{
|
||||
var checksumEntry = ChecksumEntries[i];
|
||||
Console.WriteLine($" Checksum Entry {i}");
|
||||
Console.WriteLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
builder.AppendLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -275,146 +275,155 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("New Executable Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("New Executable Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Stub
|
||||
PrintStubHeader();
|
||||
PrintStubExtendedHeader();
|
||||
PrintStubHeader(builder);
|
||||
PrintStubExtendedHeader(builder);
|
||||
|
||||
// Header
|
||||
PrintHeader();
|
||||
PrintHeader(builder);
|
||||
|
||||
// Tables
|
||||
PrintSegmentTable();
|
||||
PrintResourceTable();
|
||||
PrintResidentNameTable();
|
||||
PrintModuleReferenceTable();
|
||||
PrintImportedNameTable();
|
||||
PrintEntryTable();
|
||||
PrintNonresidentNameTable();
|
||||
PrintSegmentTable(builder);
|
||||
PrintResourceTable(builder);
|
||||
PrintResidentNameTable(builder);
|
||||
PrintModuleReferenceTable(builder);
|
||||
PrintImportedNameTable(builder);
|
||||
PrintEntryTable(builder);
|
||||
PrintNonresidentNameTable(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub header information
|
||||
/// </summary>
|
||||
private void PrintStubHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintStubHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {Stub_Magic}");
|
||||
Console.WriteLine($" Last page bytes: {Stub_LastPageBytes} (0x{Stub_LastPageBytes:X})");
|
||||
Console.WriteLine($" Pages: {Stub_Pages} (0x{Stub_Pages:X})");
|
||||
Console.WriteLine($" Relocation items: {Stub_RelocationItems} (0x{Stub_RelocationItems:X})");
|
||||
Console.WriteLine($" Header paragraph size: {Stub_HeaderParagraphSize} (0x{Stub_HeaderParagraphSize:X})");
|
||||
Console.WriteLine($" Minimum extra paragraphs: {Stub_MinimumExtraParagraphs} (0x{Stub_MinimumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Maximum extra paragraphs: {Stub_MaximumExtraParagraphs} (0x{Stub_MaximumExtraParagraphs:X})");
|
||||
Console.WriteLine($" Initial SS value: {Stub_InitialSSValue} (0x{Stub_InitialSSValue:X})");
|
||||
Console.WriteLine($" Initial SP value: {Stub_InitialSPValue} (0x{Stub_InitialSPValue:X})");
|
||||
Console.WriteLine($" Checksum: {Stub_Checksum} (0x{Stub_Checksum:X})");
|
||||
Console.WriteLine($" Initial IP value: {Stub_InitialIPValue} (0x{Stub_InitialIPValue:X})");
|
||||
Console.WriteLine($" Initial CS value: {Stub_InitialCSValue} (0x{Stub_InitialCSValue:X})");
|
||||
Console.WriteLine($" Relocation table address: {Stub_RelocationTableAddr} (0x{Stub_RelocationTableAddr:X})");
|
||||
Console.WriteLine($" Overlay number: {Stub_OverlayNumber} (0x{Stub_OverlayNumber:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic number: {Stub_Magic}");
|
||||
builder.AppendLine($" Last page bytes: {Stub_LastPageBytes} (0x{Stub_LastPageBytes:X})");
|
||||
builder.AppendLine($" Pages: {Stub_Pages} (0x{Stub_Pages:X})");
|
||||
builder.AppendLine($" Relocation items: {Stub_RelocationItems} (0x{Stub_RelocationItems:X})");
|
||||
builder.AppendLine($" Header paragraph size: {Stub_HeaderParagraphSize} (0x{Stub_HeaderParagraphSize:X})");
|
||||
builder.AppendLine($" Minimum extra paragraphs: {Stub_MinimumExtraParagraphs} (0x{Stub_MinimumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Maximum extra paragraphs: {Stub_MaximumExtraParagraphs} (0x{Stub_MaximumExtraParagraphs:X})");
|
||||
builder.AppendLine($" Initial SS value: {Stub_InitialSSValue} (0x{Stub_InitialSSValue:X})");
|
||||
builder.AppendLine($" Initial SP value: {Stub_InitialSPValue} (0x{Stub_InitialSPValue:X})");
|
||||
builder.AppendLine($" Checksum: {Stub_Checksum} (0x{Stub_Checksum:X})");
|
||||
builder.AppendLine($" Initial IP value: {Stub_InitialIPValue} (0x{Stub_InitialIPValue:X})");
|
||||
builder.AppendLine($" Initial CS value: {Stub_InitialCSValue} (0x{Stub_InitialCSValue:X})");
|
||||
builder.AppendLine($" Relocation table address: {Stub_RelocationTableAddr} (0x{Stub_RelocationTableAddr:X})");
|
||||
builder.AppendLine($" Overlay number: {Stub_OverlayNumber} (0x{Stub_OverlayNumber:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print stub extended header information
|
||||
/// </summary>
|
||||
private void PrintStubExtendedHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintStubExtendedHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" MS-DOS Stub Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", Stub_Reserved1)}");
|
||||
Console.WriteLine($" OEM identifier: {Stub_OEMIdentifier} (0x{Stub_OEMIdentifier:X})");
|
||||
Console.WriteLine($" OEM information: {Stub_OEMInformation} (0x{Stub_OEMInformation:X})");
|
||||
Console.WriteLine($" Reserved words: {string.Join(", ", Stub_Reserved2)}");
|
||||
Console.WriteLine($" New EXE header address: {Stub_NewExeHeaderAddr} (0x{Stub_NewExeHeaderAddr:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" MS-DOS Stub Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Reserved words: {string.Join(", ", Stub_Reserved1)}");
|
||||
builder.AppendLine($" OEM identifier: {Stub_OEMIdentifier} (0x{Stub_OEMIdentifier:X})");
|
||||
builder.AppendLine($" OEM information: {Stub_OEMInformation} (0x{Stub_OEMInformation:X})");
|
||||
builder.AppendLine($" Reserved words: {string.Join(", ", Stub_Reserved2)}");
|
||||
builder.AppendLine($" New EXE header address: {Stub_NewExeHeaderAddr} (0x{Stub_NewExeHeaderAddr:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Magic number: {Magic}");
|
||||
Console.WriteLine($" Linker version: {LinkerVersion} (0x{LinkerVersion:X})");
|
||||
Console.WriteLine($" Linker revision: {LinkerRevision} (0x{LinkerRevision:X})");
|
||||
Console.WriteLine($" Entry table offset: {EntryTableOffset} (0x{EntryTableOffset:X})");
|
||||
Console.WriteLine($" Entry table size: {EntryTableSize} (0x{EntryTableSize:X})");
|
||||
Console.WriteLine($" CRC checksum: {CrcChecksum} (0x{CrcChecksum:X})");
|
||||
Console.WriteLine($" Flag word: {FlagWord} (0x{FlagWord:X})");
|
||||
Console.WriteLine($" Automatic data segment number: {AutomaticDataSegmentNumber} (0x{AutomaticDataSegmentNumber:X})");
|
||||
Console.WriteLine($" Initial heap allocation: {InitialHeapAlloc} (0x{InitialHeapAlloc:X})");
|
||||
Console.WriteLine($" Initial stack allocation: {InitialStackAlloc} (0x{InitialStackAlloc:X})");
|
||||
Console.WriteLine($" Initial CS:IP setting: {InitialCSIPSetting} (0x{InitialCSIPSetting:X})");
|
||||
Console.WriteLine($" Initial SS:SP setting: {InitialSSSPSetting} (0x{InitialSSSPSetting:X})");
|
||||
Console.WriteLine($" File segment count: {FileSegmentCount} (0x{FileSegmentCount:X})");
|
||||
Console.WriteLine($" Module reference table size: {ModuleReferenceTableSize} (0x{ModuleReferenceTableSize:X})");
|
||||
Console.WriteLine($" Non-resident name table size: {NonResidentNameTableSize} (0x{NonResidentNameTableSize:X})");
|
||||
Console.WriteLine($" Segment table offset: {SegmentTableOffset} (0x{SegmentTableOffset:X})");
|
||||
Console.WriteLine($" Resource table offset: {ResourceTableOffset} (0x{ResourceTableOffset:X})");
|
||||
Console.WriteLine($" Resident name table offset: {ResidentNameTableOffset} (0x{ResidentNameTableOffset:X})");
|
||||
Console.WriteLine($" Module reference table offset: {ModuleReferenceTableOffset} (0x{ModuleReferenceTableOffset:X})");
|
||||
Console.WriteLine($" Imported names table offset: {ImportedNamesTableOffset} (0x{ImportedNamesTableOffset:X})");
|
||||
Console.WriteLine($" Non-resident name table offset: {NonResidentNamesTableOffset} (0x{NonResidentNamesTableOffset:X})");
|
||||
Console.WriteLine($" Moveable entries count: {MovableEntriesCount} (0x{MovableEntriesCount:X})");
|
||||
Console.WriteLine($" Segment alignment shift count: {SegmentAlignmentShiftCount} (0x{SegmentAlignmentShiftCount:X})");
|
||||
Console.WriteLine($" Resource entries count: {ResourceEntriesCount} (0x{ResourceEntriesCount:X})");
|
||||
Console.WriteLine($" Target operating system: {TargetOperatingSystem} (0x{TargetOperatingSystem:X})");
|
||||
Console.WriteLine($" Additional flags: {AdditionalFlags} (0x{AdditionalFlags:X})");
|
||||
Console.WriteLine($" Return thunk offset: {ReturnThunkOffset} (0x{ReturnThunkOffset:X})");
|
||||
Console.WriteLine($" Segment reference thunk offset: {SegmentReferenceThunkOffset} (0x{SegmentReferenceThunkOffset:X})");
|
||||
Console.WriteLine($" Minimum code swap area size: {MinCodeSwapAreaSize} (0x{MinCodeSwapAreaSize:X})");
|
||||
Console.WriteLine($" Windows SDK revision: {WindowsSDKRevision} (0x{WindowsSDKRevision:X})");
|
||||
Console.WriteLine($" Windows SDK version: {WindowsSDKVersion} (0x{WindowsSDKVersion:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Magic number: {Magic}");
|
||||
builder.AppendLine($" Linker version: {LinkerVersion} (0x{LinkerVersion:X})");
|
||||
builder.AppendLine($" Linker revision: {LinkerRevision} (0x{LinkerRevision:X})");
|
||||
builder.AppendLine($" Entry table offset: {EntryTableOffset} (0x{EntryTableOffset:X})");
|
||||
builder.AppendLine($" Entry table size: {EntryTableSize} (0x{EntryTableSize:X})");
|
||||
builder.AppendLine($" CRC checksum: {CrcChecksum} (0x{CrcChecksum:X})");
|
||||
builder.AppendLine($" Flag word: {FlagWord} (0x{FlagWord:X})");
|
||||
builder.AppendLine($" Automatic data segment number: {AutomaticDataSegmentNumber} (0x{AutomaticDataSegmentNumber:X})");
|
||||
builder.AppendLine($" Initial heap allocation: {InitialHeapAlloc} (0x{InitialHeapAlloc:X})");
|
||||
builder.AppendLine($" Initial stack allocation: {InitialStackAlloc} (0x{InitialStackAlloc:X})");
|
||||
builder.AppendLine($" Initial CS:IP setting: {InitialCSIPSetting} (0x{InitialCSIPSetting:X})");
|
||||
builder.AppendLine($" Initial SS:SP setting: {InitialSSSPSetting} (0x{InitialSSSPSetting:X})");
|
||||
builder.AppendLine($" File segment count: {FileSegmentCount} (0x{FileSegmentCount:X})");
|
||||
builder.AppendLine($" Module reference table size: {ModuleReferenceTableSize} (0x{ModuleReferenceTableSize:X})");
|
||||
builder.AppendLine($" Non-resident name table size: {NonResidentNameTableSize} (0x{NonResidentNameTableSize:X})");
|
||||
builder.AppendLine($" Segment table offset: {SegmentTableOffset} (0x{SegmentTableOffset:X})");
|
||||
builder.AppendLine($" Resource table offset: {ResourceTableOffset} (0x{ResourceTableOffset:X})");
|
||||
builder.AppendLine($" Resident name table offset: {ResidentNameTableOffset} (0x{ResidentNameTableOffset:X})");
|
||||
builder.AppendLine($" Module reference table offset: {ModuleReferenceTableOffset} (0x{ModuleReferenceTableOffset:X})");
|
||||
builder.AppendLine($" Imported names table offset: {ImportedNamesTableOffset} (0x{ImportedNamesTableOffset:X})");
|
||||
builder.AppendLine($" Non-resident name table offset: {NonResidentNamesTableOffset} (0x{NonResidentNamesTableOffset:X})");
|
||||
builder.AppendLine($" Moveable entries count: {MovableEntriesCount} (0x{MovableEntriesCount:X})");
|
||||
builder.AppendLine($" Segment alignment shift count: {SegmentAlignmentShiftCount} (0x{SegmentAlignmentShiftCount:X})");
|
||||
builder.AppendLine($" Resource entries count: {ResourceEntriesCount} (0x{ResourceEntriesCount:X})");
|
||||
builder.AppendLine($" Target operating system: {TargetOperatingSystem} (0x{TargetOperatingSystem:X})");
|
||||
builder.AppendLine($" Additional flags: {AdditionalFlags} (0x{AdditionalFlags:X})");
|
||||
builder.AppendLine($" Return thunk offset: {ReturnThunkOffset} (0x{ReturnThunkOffset:X})");
|
||||
builder.AppendLine($" Segment reference thunk offset: {SegmentReferenceThunkOffset} (0x{SegmentReferenceThunkOffset:X})");
|
||||
builder.AppendLine($" Minimum code swap area size: {MinCodeSwapAreaSize} (0x{MinCodeSwapAreaSize:X})");
|
||||
builder.AppendLine($" Windows SDK revision: {WindowsSDKRevision} (0x{WindowsSDKRevision:X})");
|
||||
builder.AppendLine($" Windows SDK version: {WindowsSDKVersion} (0x{WindowsSDKVersion:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print segment table information
|
||||
/// </summary>
|
||||
private void PrintSegmentTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintSegmentTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Segment Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Segment Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FileSegmentCount == 0 || SegmentTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No segment table items");
|
||||
builder.AppendLine(" No segment table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < SegmentTable.Length; i++)
|
||||
{
|
||||
var entry = SegmentTable[i];
|
||||
Console.WriteLine($" Segment Table Entry {i}");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Flag word: {entry.FlagWord} (0x{entry.FlagWord:X})");
|
||||
Console.WriteLine($" Minimum allocation size: {entry.MinimumAllocationSize} (0x{entry.MinimumAllocationSize:X})");
|
||||
builder.AppendLine($" Segment Table Entry {i}");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (0x{entry.Offset:X})");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Flag word: {entry.FlagWord} (0x{entry.FlagWord:X})");
|
||||
builder.AppendLine($" Minimum allocation size: {entry.MinimumAllocationSize} (0x{entry.MinimumAllocationSize:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resource table information
|
||||
/// </summary>
|
||||
private void PrintResourceTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintResourceTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Resource Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Alignment shift count: {ResourceTable.AlignmentShiftCount} (0x{ResourceTable.AlignmentShiftCount:X})");
|
||||
builder.AppendLine(" Resource Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Alignment shift count: {ResourceTable.AlignmentShiftCount} (0x{ResourceTable.AlignmentShiftCount:X})");
|
||||
if (ResourceEntriesCount == 0 || ResourceTable.ResourceTypes.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No resource table items");
|
||||
builder.AppendLine(" No resource table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -422,14 +431,14 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// TODO: If not integer type, print out name
|
||||
var entry = ResourceTable.ResourceTypes[i];
|
||||
Console.WriteLine($" Resource Table Entry {i}");
|
||||
Console.WriteLine($" Type ID: {entry.TypeID} (0x{entry.TypeID:X}) (Is Integer Type: {entry.IsIntegerType()})");
|
||||
Console.WriteLine($" Resource count: {entry.ResourceCount} (0x{entry.ResourceCount:X})");
|
||||
Console.WriteLine($" Reserved: {entry.Reserved} (0x{entry.Reserved:X})");
|
||||
Console.WriteLine($" Resources = ");
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
builder.AppendLine($" Type ID: {entry.TypeID} (0x{entry.TypeID:X}) (Is Integer Type: {entry.IsIntegerType()})");
|
||||
builder.AppendLine($" Resource count: {entry.ResourceCount} (0x{entry.ResourceCount:X})");
|
||||
builder.AppendLine($" Reserved: {entry.Reserved} (0x{entry.Reserved:X})");
|
||||
builder.AppendLine($" Resources = ");
|
||||
if (entry.ResourceCount == 0 || entry.Resources.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No resource items");
|
||||
builder.AppendLine(" No resource items");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -437,12 +446,12 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// TODO: If not integer type, print out name
|
||||
var resource = entry.Resources[j];
|
||||
Console.WriteLine($" Resource Entry {i}");
|
||||
Console.WriteLine($" Offset: {resource.Offset} (0x{resource.Offset:X})");
|
||||
Console.WriteLine($" Length: {resource.Length} (0x{resource.Length:X})");
|
||||
Console.WriteLine($" Flag word: {resource.FlagWord} (0x{resource.FlagWord:X})");
|
||||
Console.WriteLine($" Resource ID: {resource.ResourceID} (0x{resource.ResourceID:X}) (Is Integer Type: {resource.IsIntegerType()})");
|
||||
Console.WriteLine($" Reserved: {resource.Reserved} (0x{resource.Reserved:X})");
|
||||
builder.AppendLine($" Resource Entry {i}");
|
||||
builder.AppendLine($" Offset: {resource.Offset} (0x{resource.Offset:X})");
|
||||
builder.AppendLine($" Length: {resource.Length} (0x{resource.Length:X})");
|
||||
builder.AppendLine($" Flag word: {resource.FlagWord} (0x{resource.FlagWord:X})");
|
||||
builder.AppendLine($" Resource ID: {resource.ResourceID} (0x{resource.ResourceID:X}) (Is Integer Type: {resource.IsIntegerType()})");
|
||||
builder.AppendLine($" Reserved: {resource.Reserved} (0x{resource.Reserved:X})");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,55 +459,57 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
if (ResourceTable.TypeAndNameStrings.Count == 0)
|
||||
{
|
||||
Console.WriteLine(" No resource table type/name strings");
|
||||
builder.AppendLine(" No resource table type/name strings");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var typeAndNameString in ResourceTable.TypeAndNameStrings)
|
||||
{
|
||||
Console.WriteLine($" Resource Type/Name Offset {typeAndNameString.Key}");
|
||||
Console.WriteLine($" Length: {typeAndNameString.Value.Length} (0x{typeAndNameString.Value.Length:X})");
|
||||
Console.WriteLine($" Text: {(typeAndNameString.Value.Text != null ? Encoding.ASCII.GetString(typeAndNameString.Value.Text).TrimEnd('\0') : "[EMPTY]")}");
|
||||
builder.AppendLine($" Resource Type/Name Offset {typeAndNameString.Key}");
|
||||
builder.AppendLine($" Length: {typeAndNameString.Value.Length} (0x{typeAndNameString.Value.Length:X})");
|
||||
builder.AppendLine($" Text: {(typeAndNameString.Value.Text != null ? Encoding.ASCII.GetString(typeAndNameString.Value.Text).TrimEnd('\0') : "[EMPTY]")}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print resident-name table information
|
||||
/// </summary>
|
||||
private void PrintResidentNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintResidentNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Resident-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Resident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ResidentNameTableOffset == 0 || ResidentNameTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No resident-name table items");
|
||||
builder.AppendLine(" No resident-name table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ResidentNameTable.Length; i++)
|
||||
{
|
||||
var entry = ResidentNameTable[i];
|
||||
Console.WriteLine($" Resident-Name Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name string: {(entry.NameString != null ? Encoding.ASCII.GetString(entry.NameString).TrimEnd('\0') : "[EMPTY]")}");
|
||||
Console.WriteLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
builder.AppendLine($" Resident-Name Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name string: {(entry.NameString != null ? Encoding.ASCII.GetString(entry.NameString).TrimEnd('\0') : "[EMPTY]")}");
|
||||
builder.AppendLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print module-reference table information
|
||||
/// </summary>
|
||||
private void PrintModuleReferenceTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintModuleReferenceTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Module-Reference Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Module-Reference Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ModuleReferenceTableSize == 0 || ModuleReferenceTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No module-reference table items");
|
||||
builder.AppendLine(" No module-reference table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -506,96 +517,99 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
// TODO: Read the imported names table and print value here
|
||||
var entry = ModuleReferenceTable[i];
|
||||
Console.WriteLine($" Module-Reference Table Entry {i}");
|
||||
Console.WriteLine($" Offset: {entry.Offset} (adjusted to be {entry.Offset + Stub_NewExeHeaderAddr + ImportedNamesTableOffset})");
|
||||
builder.AppendLine($" Module-Reference Table Entry {i}");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (adjusted to be {entry.Offset + Stub_NewExeHeaderAddr + ImportedNamesTableOffset})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print imported-name table information
|
||||
/// </summary>
|
||||
private void PrintImportedNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintImportedNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Imported-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Imported-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ImportedNamesTableOffset == 0 || ImportedNameTable.Count == 0)
|
||||
{
|
||||
Console.WriteLine(" No imported-name table items");
|
||||
builder.AppendLine(" No imported-name table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var entry in ImportedNameTable)
|
||||
{
|
||||
Console.WriteLine($" Imported-Name Table at Offset {entry.Key}");
|
||||
Console.WriteLine($" Length: {entry.Value.Length} (0x{entry.Value.Length:X})");
|
||||
Console.WriteLine($" Name string: {(entry.Value.NameString != null ? Encoding.ASCII.GetString(entry.Value.NameString) : "[EMPTY]")}");
|
||||
builder.AppendLine($" Imported-Name Table at Offset {entry.Key}");
|
||||
builder.AppendLine($" Length: {entry.Value.Length} (0x{entry.Value.Length:X})");
|
||||
builder.AppendLine($" Name string: {(entry.Value.NameString != null ? Encoding.ASCII.GetString(entry.Value.NameString) : "[EMPTY]")}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print entry table information
|
||||
/// </summary>
|
||||
private void PrintEntryTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintEntryTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Entry Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (EntryTableSize == 0 || EntryTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No entry table items");
|
||||
builder.AppendLine(" No entry table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < EntryTable.Length; i++)
|
||||
{
|
||||
var entry = EntryTable[i];
|
||||
Console.WriteLine($" Entry Table Entry {i}");
|
||||
Console.WriteLine($" Entry count: {entry.EntryCount} (0x{entry.EntryCount:X})");
|
||||
Console.WriteLine($" Segment indicator: {entry.SegmentIndicator} (0x{entry.SegmentIndicator:X}) ({entry.GetEntryType()})");
|
||||
builder.AppendLine($" Entry Table Entry {i}");
|
||||
builder.AppendLine($" Entry count: {entry.EntryCount} (0x{entry.EntryCount:X})");
|
||||
builder.AppendLine($" Segment indicator: {entry.SegmentIndicator} (0x{entry.SegmentIndicator:X}) ({entry.GetEntryType()})");
|
||||
switch (entry.GetEntryType())
|
||||
{
|
||||
case BurnOutSharp.Models.NewExecutable.SegmentEntryType.FixedSegment:
|
||||
Console.WriteLine($" Flag word: {entry.FixedFlagWord} (0x{entry.FixedFlagWord:X})");
|
||||
Console.WriteLine($" Offset: {entry.FixedOffset} (0x{entry.FixedOffset:X})");
|
||||
builder.AppendLine($" Flag word: {entry.FixedFlagWord} (0x{entry.FixedFlagWord:X})");
|
||||
builder.AppendLine($" Offset: {entry.FixedOffset} (0x{entry.FixedOffset:X})");
|
||||
break;
|
||||
case BurnOutSharp.Models.NewExecutable.SegmentEntryType.MoveableSegment:
|
||||
Console.WriteLine($" Flag word: {entry.MoveableFlagWord} (0x{entry.MoveableFlagWord:X})");
|
||||
Console.WriteLine($" Reserved: {entry.MoveableReserved} (0x{entry.MoveableReserved:X})");
|
||||
Console.WriteLine($" Segment number: {entry.MoveableSegmentNumber} (0x{entry.MoveableSegmentNumber:X})");
|
||||
Console.WriteLine($" Offset: {entry.MoveableOffset} (0x{entry.MoveableOffset:X})");
|
||||
builder.AppendLine($" Flag word: {entry.MoveableFlagWord} (0x{entry.MoveableFlagWord:X})");
|
||||
builder.AppendLine($" Reserved: {entry.MoveableReserved} (0x{entry.MoveableReserved:X})");
|
||||
builder.AppendLine($" Segment number: {entry.MoveableSegmentNumber} (0x{entry.MoveableSegmentNumber:X})");
|
||||
builder.AppendLine($" Offset: {entry.MoveableOffset} (0x{entry.MoveableOffset:X})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print nonresident-name table information
|
||||
/// </summary>
|
||||
private void PrintNonresidentNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintNonresidentNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Nonresident-Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Nonresident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (NonResidentNameTableSize == 0 || NonResidentNameTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No nonresident-name table items");
|
||||
builder.AppendLine(" No nonresident-name table items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < NonResidentNameTable.Length; i++)
|
||||
{
|
||||
var entry = NonResidentNameTable[i];
|
||||
Console.WriteLine($" Nonresident-Name Table Entry {i}");
|
||||
Console.WriteLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
Console.WriteLine($" Name string: {(entry.NameString != null ? Encoding.ASCII.GetString(entry.NameString) : "[EMPTY]")}");
|
||||
Console.WriteLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
builder.AppendLine($" Nonresident-Name Table Entry {i}");
|
||||
builder.AppendLine($" Length: {entry.Length} (0x{entry.Length:X})");
|
||||
builder.AppendLine($" Name string: {(entry.NameString != null ? Encoding.ASCII.GetString(entry.NameString) : "[EMPTY]")}");
|
||||
builder.AppendLine($" Ordinal number: {entry.OrdinalNumber} (0x{entry.OrdinalNumber:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -299,7 +300,7 @@ namespace BurnOutSharp.Wrappers
|
||||
|
||||
#endregion
|
||||
|
||||
#region Name Table
|
||||
#region File Allocation Table
|
||||
|
||||
/// <inheritdoc cref="Models.Nitro.Cart.FileAllocationTable"/>
|
||||
public Models.Nitro.FileAllocationTableEntry[] FileAllocationTable => _cart.FileAllocationTable;
|
||||
@@ -374,240 +375,251 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("NDS Cart Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintCommonHeader();
|
||||
PrintExtendedDSiHeader();
|
||||
PrintSecureArea();
|
||||
PrintNameTable();
|
||||
PrintFileAllocationTable();
|
||||
builder.AppendLine("NDS Cart Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintCommonHeader(builder);
|
||||
PrintExtendedDSiHeader(builder);
|
||||
PrintSecureArea(builder);
|
||||
PrintNameTable(builder);
|
||||
PrintFileAllocationTable(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print common header information
|
||||
/// </summary>
|
||||
private void PrintCommonHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintCommonHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Common Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Game title: {GameTitle ?? "[NULL]"}");
|
||||
Console.WriteLine($" Game code: {GameCode} (0x{GameCode:X})");
|
||||
Console.WriteLine($" Maker code: {MakerCode ?? "[NULL]"}");
|
||||
Console.WriteLine($" Unit code: {UnitCode} (0x{UnitCode:X})");
|
||||
Console.WriteLine($" Encryption seed select: {EncryptionSeedSelect} (0x{EncryptionSeedSelect:X})");
|
||||
Console.WriteLine($" Device capacity: {DeviceCapacity} (0x{DeviceCapacity:X})");
|
||||
Console.WriteLine($" Reserved 1: {BitConverter.ToString(Reserved1).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Game revision: {GameRevision} (0x{GameRevision:X})");
|
||||
Console.WriteLine($" Rom version: {RomVersion} (0x{RomVersion:X})");
|
||||
Console.WriteLine($" ARM9 rom offset: {ARM9RomOffset} (0x{ARM9RomOffset:X})");
|
||||
Console.WriteLine($" ARM9 entry address: {ARM9EntryAddress} (0x{ARM9EntryAddress:X})");
|
||||
Console.WriteLine($" ARM9 load address: {ARM9LoadAddress} (0x{ARM9LoadAddress:X})");
|
||||
Console.WriteLine($" ARM9 size: {ARM9Size} (0x{ARM9Size:X})");
|
||||
Console.WriteLine($" ARM7 rom offset: {ARM7RomOffset} (0x{ARM7RomOffset:X})");
|
||||
Console.WriteLine($" ARM7 entry address: {ARM7EntryAddress} (0x{ARM7EntryAddress:X})");
|
||||
Console.WriteLine($" ARM7 load address: {ARM7LoadAddress} (0x{ARM7LoadAddress:X})");
|
||||
Console.WriteLine($" ARM7 size: {ARM7Size} (0x{ARM7Size:X})");
|
||||
Console.WriteLine($" File name table offset: {FileNameTableOffset} (0x{FileNameTableOffset:X})");
|
||||
Console.WriteLine($" File name table length: {FileNameTableLength} (0x{FileNameTableLength:X})");
|
||||
Console.WriteLine($" File allocation table offset: {FileAllocationTableOffset} (0x{FileAllocationTableOffset:X})");
|
||||
Console.WriteLine($" File allocation table length: {FileAllocationTableLength} (0x{FileAllocationTableLength:X})");
|
||||
Console.WriteLine($" ARM9 overlay offset: {ARM9OverlayOffset} (0x{ARM9OverlayOffset:X})");
|
||||
Console.WriteLine($" ARM9 overlay length: {ARM9OverlayLength} (0x{ARM9OverlayLength:X})");
|
||||
Console.WriteLine($" ARM7 overlay offset: {ARM7OverlayOffset} (0x{ARM7OverlayOffset:X})");
|
||||
Console.WriteLine($" ARM7 overlay length: {ARM7OverlayLength} (0x{ARM7OverlayLength:X})");
|
||||
Console.WriteLine($" Normal card control register settings: {NormalCardControlRegisterSettings} (0x{NormalCardControlRegisterSettings:X})");
|
||||
Console.WriteLine($" Secure card control register settings: {SecureCardControlRegisterSettings} (0x{SecureCardControlRegisterSettings:X})");
|
||||
Console.WriteLine($" Icon banner offset: {IconBannerOffset} (0x{IconBannerOffset:X})");
|
||||
Console.WriteLine($" Secure area CRC: {SecureAreaCRC} (0x{SecureAreaCRC:X})");
|
||||
Console.WriteLine($" Secure transfer timeout: {SecureTransferTimeout} (0x{SecureTransferTimeout:X})");
|
||||
Console.WriteLine($" ARM9 autoload: {ARM9Autoload} (0x{ARM9Autoload:X})");
|
||||
Console.WriteLine($" ARM7 autoload: {ARM7Autoload} (0x{ARM7Autoload:X})");
|
||||
Console.WriteLine($" Secure disable: {SecureDisable} (0x{SecureDisable:X})");
|
||||
Console.WriteLine($" NTR region rom size: {NTRRegionRomSize} (0x{NTRRegionRomSize:X})");
|
||||
Console.WriteLine($" Header size: {HeaderSize} (0x{HeaderSize:X})");
|
||||
Console.WriteLine($" Reserved 2: {BitConverter.ToString(Reserved2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Nintendo logo: {BitConverter.ToString(NintendoLogo).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Nintendo logo CRC: {NintendoLogoCRC} (0x{NintendoLogoCRC:X})");
|
||||
Console.WriteLine($" Header CRC: {HeaderCRC} (0x{HeaderCRC:X})");
|
||||
Console.WriteLine($" Debugger reserved: {BitConverter.ToString(DebuggerReserved).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Common Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Game title: {GameTitle ?? "[NULL]"}");
|
||||
builder.AppendLine($" Game code: {GameCode} (0x{GameCode:X})");
|
||||
builder.AppendLine($" Maker code: {MakerCode ?? "[NULL]"}");
|
||||
builder.AppendLine($" Unit code: {UnitCode} (0x{UnitCode:X})");
|
||||
builder.AppendLine($" Encryption seed select: {EncryptionSeedSelect} (0x{EncryptionSeedSelect:X})");
|
||||
builder.AppendLine($" Device capacity: {DeviceCapacity} (0x{DeviceCapacity:X})");
|
||||
builder.AppendLine($" Reserved 1: {BitConverter.ToString(Reserved1).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Game revision: {GameRevision} (0x{GameRevision:X})");
|
||||
builder.AppendLine($" Rom version: {RomVersion} (0x{RomVersion:X})");
|
||||
builder.AppendLine($" ARM9 rom offset: {ARM9RomOffset} (0x{ARM9RomOffset:X})");
|
||||
builder.AppendLine($" ARM9 entry address: {ARM9EntryAddress} (0x{ARM9EntryAddress:X})");
|
||||
builder.AppendLine($" ARM9 load address: {ARM9LoadAddress} (0x{ARM9LoadAddress:X})");
|
||||
builder.AppendLine($" ARM9 size: {ARM9Size} (0x{ARM9Size:X})");
|
||||
builder.AppendLine($" ARM7 rom offset: {ARM7RomOffset} (0x{ARM7RomOffset:X})");
|
||||
builder.AppendLine($" ARM7 entry address: {ARM7EntryAddress} (0x{ARM7EntryAddress:X})");
|
||||
builder.AppendLine($" ARM7 load address: {ARM7LoadAddress} (0x{ARM7LoadAddress:X})");
|
||||
builder.AppendLine($" ARM7 size: {ARM7Size} (0x{ARM7Size:X})");
|
||||
builder.AppendLine($" File name table offset: {FileNameTableOffset} (0x{FileNameTableOffset:X})");
|
||||
builder.AppendLine($" File name table length: {FileNameTableLength} (0x{FileNameTableLength:X})");
|
||||
builder.AppendLine($" File allocation table offset: {FileAllocationTableOffset} (0x{FileAllocationTableOffset:X})");
|
||||
builder.AppendLine($" File allocation table length: {FileAllocationTableLength} (0x{FileAllocationTableLength:X})");
|
||||
builder.AppendLine($" ARM9 overlay offset: {ARM9OverlayOffset} (0x{ARM9OverlayOffset:X})");
|
||||
builder.AppendLine($" ARM9 overlay length: {ARM9OverlayLength} (0x{ARM9OverlayLength:X})");
|
||||
builder.AppendLine($" ARM7 overlay offset: {ARM7OverlayOffset} (0x{ARM7OverlayOffset:X})");
|
||||
builder.AppendLine($" ARM7 overlay length: {ARM7OverlayLength} (0x{ARM7OverlayLength:X})");
|
||||
builder.AppendLine($" Normal card control register settings: {NormalCardControlRegisterSettings} (0x{NormalCardControlRegisterSettings:X})");
|
||||
builder.AppendLine($" Secure card control register settings: {SecureCardControlRegisterSettings} (0x{SecureCardControlRegisterSettings:X})");
|
||||
builder.AppendLine($" Icon banner offset: {IconBannerOffset} (0x{IconBannerOffset:X})");
|
||||
builder.AppendLine($" Secure area CRC: {SecureAreaCRC} (0x{SecureAreaCRC:X})");
|
||||
builder.AppendLine($" Secure transfer timeout: {SecureTransferTimeout} (0x{SecureTransferTimeout:X})");
|
||||
builder.AppendLine($" ARM9 autoload: {ARM9Autoload} (0x{ARM9Autoload:X})");
|
||||
builder.AppendLine($" ARM7 autoload: {ARM7Autoload} (0x{ARM7Autoload:X})");
|
||||
builder.AppendLine($" Secure disable: {SecureDisable} (0x{SecureDisable:X})");
|
||||
builder.AppendLine($" NTR region rom size: {NTRRegionRomSize} (0x{NTRRegionRomSize:X})");
|
||||
builder.AppendLine($" Header size: {HeaderSize} (0x{HeaderSize:X})");
|
||||
builder.AppendLine($" Reserved 2: {BitConverter.ToString(Reserved2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Nintendo logo: {BitConverter.ToString(NintendoLogo).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Nintendo logo CRC: {NintendoLogoCRC} (0x{NintendoLogoCRC:X})");
|
||||
builder.AppendLine($" Header CRC: {HeaderCRC} (0x{HeaderCRC:X})");
|
||||
builder.AppendLine($" Debugger reserved: {BitConverter.ToString(DebuggerReserved).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print extended DSi header information
|
||||
/// </summary>
|
||||
private void PrintExtendedDSiHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintExtendedDSiHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Extended DSi Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Extended DSi Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_cart.ExtendedDSiHeader == null)
|
||||
{
|
||||
Console.WriteLine(" No extended DSi header");
|
||||
builder.AppendLine(" No extended DSi header");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Global MBK1..MBK5 settings: {string.Join(", ", GlobalMBK15Settings)}");
|
||||
Console.WriteLine($" Local MBK6..MBK8 settings for ARM9: {string.Join(", ", LocalMBK68SettingsARM9)}");
|
||||
Console.WriteLine($" Local MBK6..MBK8 settings for ARM7: {string.Join(", ", LocalMBK68SettingsARM7)}");
|
||||
Console.WriteLine($" Global MBK9 setting: {GlobalMBK9Setting} (0x{GlobalMBK9Setting:X})");
|
||||
Console.WriteLine($" Region flags: {RegionFlags} (0x{RegionFlags:X})");
|
||||
Console.WriteLine($" Access control: {AccessControl} (0x{AccessControl:X})");
|
||||
Console.WriteLine($" ARM7 SCFG EXT mask: {ARM7SCFGEXTMask} (0x{ARM7SCFGEXTMask:X})");
|
||||
Console.WriteLine($" Reserved/flags?: {ReservedFlags} (0x{ReservedFlags:X})");
|
||||
Console.WriteLine($" ARM9i rom offset: {ARM9iRomOffset} (0x{ARM9iRomOffset:X})");
|
||||
Console.WriteLine($" Reserved 3: {Reserved3} (0x{Reserved3:X})");
|
||||
Console.WriteLine($" ARM9i load address: {ARM9iLoadAddress} (0x{ARM9iLoadAddress:X})");
|
||||
Console.WriteLine($" ARM9i size: {ARM9iSize} (0x{ARM9iSize:X})");
|
||||
Console.WriteLine($" ARM7i rom offset: {ARM7iRomOffset} (0x{ARM7iRomOffset:X})");
|
||||
Console.WriteLine($" Reserved 4: {Reserved4} (0x{Reserved4:X})");
|
||||
Console.WriteLine($" ARM7i load address: {ARM7iLoadAddress} (0x{ARM7iLoadAddress:X})");
|
||||
Console.WriteLine($" ARM7i size: {ARM7iSize} (0x{ARM7iSize:X})");
|
||||
Console.WriteLine($" Digest NTR region offset: {DigestNTRRegionOffset} (0x{DigestNTRRegionOffset:X})");
|
||||
Console.WriteLine($" Digest NTR region length: {DigestNTRRegionLength} (0x{DigestNTRRegionLength:X})");
|
||||
Console.WriteLine($" Digest TWL region offset: {DigestTWLRegionOffset} (0x{DigestTWLRegionOffset:X})");
|
||||
Console.WriteLine($" Digest TWL region length: {DigestTWLRegionLength} (0x{DigestTWLRegionLength:X})");
|
||||
Console.WriteLine($" Digest sector hashtable region offset: {DigestSectorHashtableRegionOffset} (0x{DigestSectorHashtableRegionOffset:X})");
|
||||
Console.WriteLine($" Digest sector hashtable region length: {DigestSectorHashtableRegionLength} (0x{DigestSectorHashtableRegionLength:X})");
|
||||
Console.WriteLine($" Digest block hashtable region offset: {DigestBlockHashtableRegionOffset} (0x{DigestBlockHashtableRegionOffset:X})");
|
||||
Console.WriteLine($" Digest block hashtable region length: {DigestBlockHashtableRegionLength} (0x{DigestBlockHashtableRegionLength:X})");
|
||||
Console.WriteLine($" Digest sector size: {DigestSectorSize} (0x{DigestSectorSize:X})");
|
||||
Console.WriteLine($" Digest block sector count: {DigestBlockSectorCount} (0x{DigestBlockSectorCount:X})");
|
||||
Console.WriteLine($" Icon banner size: {IconBannerSize} (0x{IconBannerSize:X})");
|
||||
Console.WriteLine($" Unknown 1: {Unknown1} (0x{Unknown1:X})");
|
||||
Console.WriteLine($" Modcrypt area 1 offset: {ModcryptArea1Offset} (0x{ModcryptArea1Offset:X})");
|
||||
Console.WriteLine($" Modcrypt area 1 size: {ModcryptArea1Size} (0x{ModcryptArea1Size:X})");
|
||||
Console.WriteLine($" Modcrypt area 2 offset: {ModcryptArea2Offset} (0x{ModcryptArea2Offset:X})");
|
||||
Console.WriteLine($" Modcrypt area 2 size: {ModcryptArea2Size} (0x{ModcryptArea2Size:X})");
|
||||
Console.WriteLine($" Title ID: {BitConverter.ToString(TitleID).Replace('-', ' ')}");
|
||||
Console.WriteLine($" DSiWare 'public.sav' size: {DSiWarePublicSavSize} (0x{DSiWarePublicSavSize:X})");
|
||||
Console.WriteLine($" DSiWare 'private.sav' size: {DSiWarePrivateSavSize} (0x{DSiWarePrivateSavSize:X})");
|
||||
Console.WriteLine($" Reserved (zero): {BitConverter.ToString(ReservedZero).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Unknown 2: {BitConverter.ToString(Unknown2).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ARM9 (with encrypted secure area) SHA1 HMAC hash: {BitConverter.ToString(ARM9WithSecureAreaSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ARM7 SHA1 HMAC hash: {BitConverter.ToString(ARM7SHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Digest master SHA1 HMAC hash: {BitConverter.ToString(DigestMasterSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Banner SHA1 HMAC hash: {BitConverter.ToString(BannerSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ARM9i (decrypted) SHA1 HMAC hash: {BitConverter.ToString(ARM9iDecryptedSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ARM7i (decrypted) SHA1 HMAC hash: {BitConverter.ToString(ARM7iDecryptedSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 5: {BitConverter.ToString(Reserved5).Replace('-', ' ')}");
|
||||
Console.WriteLine($" ARM9 (without secure area) SHA1 HMAC hash: {BitConverter.ToString(ARM9NoSecureAreaSHA1HMACHash).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved 6: {BitConverter.ToString(Reserved6).Replace('-', ' ')}");
|
||||
Console.WriteLine($" Reserved and unchecked region: {BitConverter.ToString(ReservedAndUnchecked).Replace('-', ' ')}");
|
||||
Console.WriteLine($" RSA signature: {BitConverter.ToString(RSASignature).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Global MBK1..MBK5 settings: {string.Join(", ", GlobalMBK15Settings)}");
|
||||
builder.AppendLine($" Local MBK6..MBK8 settings for ARM9: {string.Join(", ", LocalMBK68SettingsARM9)}");
|
||||
builder.AppendLine($" Local MBK6..MBK8 settings for ARM7: {string.Join(", ", LocalMBK68SettingsARM7)}");
|
||||
builder.AppendLine($" Global MBK9 setting: {GlobalMBK9Setting} (0x{GlobalMBK9Setting:X})");
|
||||
builder.AppendLine($" Region flags: {RegionFlags} (0x{RegionFlags:X})");
|
||||
builder.AppendLine($" Access control: {AccessControl} (0x{AccessControl:X})");
|
||||
builder.AppendLine($" ARM7 SCFG EXT mask: {ARM7SCFGEXTMask} (0x{ARM7SCFGEXTMask:X})");
|
||||
builder.AppendLine($" Reserved/flags?: {ReservedFlags} (0x{ReservedFlags:X})");
|
||||
builder.AppendLine($" ARM9i rom offset: {ARM9iRomOffset} (0x{ARM9iRomOffset:X})");
|
||||
builder.AppendLine($" Reserved 3: {Reserved3} (0x{Reserved3:X})");
|
||||
builder.AppendLine($" ARM9i load address: {ARM9iLoadAddress} (0x{ARM9iLoadAddress:X})");
|
||||
builder.AppendLine($" ARM9i size: {ARM9iSize} (0x{ARM9iSize:X})");
|
||||
builder.AppendLine($" ARM7i rom offset: {ARM7iRomOffset} (0x{ARM7iRomOffset:X})");
|
||||
builder.AppendLine($" Reserved 4: {Reserved4} (0x{Reserved4:X})");
|
||||
builder.AppendLine($" ARM7i load address: {ARM7iLoadAddress} (0x{ARM7iLoadAddress:X})");
|
||||
builder.AppendLine($" ARM7i size: {ARM7iSize} (0x{ARM7iSize:X})");
|
||||
builder.AppendLine($" Digest NTR region offset: {DigestNTRRegionOffset} (0x{DigestNTRRegionOffset:X})");
|
||||
builder.AppendLine($" Digest NTR region length: {DigestNTRRegionLength} (0x{DigestNTRRegionLength:X})");
|
||||
builder.AppendLine($" Digest TWL region offset: {DigestTWLRegionOffset} (0x{DigestTWLRegionOffset:X})");
|
||||
builder.AppendLine($" Digest TWL region length: {DigestTWLRegionLength} (0x{DigestTWLRegionLength:X})");
|
||||
builder.AppendLine($" Digest sector hashtable region offset: {DigestSectorHashtableRegionOffset} (0x{DigestSectorHashtableRegionOffset:X})");
|
||||
builder.AppendLine($" Digest sector hashtable region length: {DigestSectorHashtableRegionLength} (0x{DigestSectorHashtableRegionLength:X})");
|
||||
builder.AppendLine($" Digest block hashtable region offset: {DigestBlockHashtableRegionOffset} (0x{DigestBlockHashtableRegionOffset:X})");
|
||||
builder.AppendLine($" Digest block hashtable region length: {DigestBlockHashtableRegionLength} (0x{DigestBlockHashtableRegionLength:X})");
|
||||
builder.AppendLine($" Digest sector size: {DigestSectorSize} (0x{DigestSectorSize:X})");
|
||||
builder.AppendLine($" Digest block sector count: {DigestBlockSectorCount} (0x{DigestBlockSectorCount:X})");
|
||||
builder.AppendLine($" Icon banner size: {IconBannerSize} (0x{IconBannerSize:X})");
|
||||
builder.AppendLine($" Unknown 1: {Unknown1} (0x{Unknown1:X})");
|
||||
builder.AppendLine($" Modcrypt area 1 offset: {ModcryptArea1Offset} (0x{ModcryptArea1Offset:X})");
|
||||
builder.AppendLine($" Modcrypt area 1 size: {ModcryptArea1Size} (0x{ModcryptArea1Size:X})");
|
||||
builder.AppendLine($" Modcrypt area 2 offset: {ModcryptArea2Offset} (0x{ModcryptArea2Offset:X})");
|
||||
builder.AppendLine($" Modcrypt area 2 size: {ModcryptArea2Size} (0x{ModcryptArea2Size:X})");
|
||||
builder.AppendLine($" Title ID: {BitConverter.ToString(TitleID).Replace('-', ' ')}");
|
||||
builder.AppendLine($" DSiWare 'public.sav' size: {DSiWarePublicSavSize} (0x{DSiWarePublicSavSize:X})");
|
||||
builder.AppendLine($" DSiWare 'private.sav' size: {DSiWarePrivateSavSize} (0x{DSiWarePrivateSavSize:X})");
|
||||
builder.AppendLine($" Reserved (zero): {BitConverter.ToString(ReservedZero).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Unknown 2: {BitConverter.ToString(Unknown2).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ARM9 (with encrypted secure area) SHA1 HMAC hash: {BitConverter.ToString(ARM9WithSecureAreaSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ARM7 SHA1 HMAC hash: {BitConverter.ToString(ARM7SHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Digest master SHA1 HMAC hash: {BitConverter.ToString(DigestMasterSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Banner SHA1 HMAC hash: {BitConverter.ToString(BannerSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ARM9i (decrypted) SHA1 HMAC hash: {BitConverter.ToString(ARM9iDecryptedSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ARM7i (decrypted) SHA1 HMAC hash: {BitConverter.ToString(ARM7iDecryptedSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 5: {BitConverter.ToString(Reserved5).Replace('-', ' ')}");
|
||||
builder.AppendLine($" ARM9 (without secure area) SHA1 HMAC hash: {BitConverter.ToString(ARM9NoSecureAreaSHA1HMACHash).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved 6: {BitConverter.ToString(Reserved6).Replace('-', ' ')}");
|
||||
builder.AppendLine($" Reserved and unchecked region: {BitConverter.ToString(ReservedAndUnchecked).Replace('-', ' ')}");
|
||||
builder.AppendLine($" RSA signature: {BitConverter.ToString(RSASignature).Replace('-', ' ')}");
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print secure area information
|
||||
/// </summary>
|
||||
private void PrintSecureArea()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintSecureArea(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Secure Area Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" {BitConverter.ToString(SecureArea).Replace('-', ' ')}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Secure Area Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" {BitConverter.ToString(SecureArea).Replace('-', ' ')}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print name table information
|
||||
/// </summary>
|
||||
private void PrintNameTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintNameTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Name Table Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintFolderAllocationTable();
|
||||
PrintNameList();
|
||||
PrintFolderAllocationTable(builder);
|
||||
PrintNameList(builder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print folder allocation table information
|
||||
/// </summary>
|
||||
private void PrintFolderAllocationTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFolderAllocationTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine($" Folder Allocation Table:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Folder Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FolderAllocationTable == null || FolderAllocationTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No folder allocation table entries");
|
||||
builder.AppendLine(" No folder allocation table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FolderAllocationTable.Length; i++)
|
||||
{
|
||||
var entry = FolderAllocationTable[i];
|
||||
Console.WriteLine($" Folder Allocation Table Entry {i}");
|
||||
Console.WriteLine($" Start offset: {entry.StartOffset} (0x{entry.StartOffset:X})");
|
||||
Console.WriteLine($" First file index: {entry.FirstFileIndex} (0x{entry.FirstFileIndex:X})");
|
||||
builder.AppendLine($" Folder Allocation Table Entry {i}");
|
||||
builder.AppendLine($" Start offset: {entry.StartOffset} (0x{entry.StartOffset:X})");
|
||||
builder.AppendLine($" First file index: {entry.FirstFileIndex} (0x{entry.FirstFileIndex:X})");
|
||||
if (entry.Unknown == 0xF0)
|
||||
{
|
||||
Console.WriteLine($" Parent folder index: {entry.ParentFolderIndex} (0x{entry.ParentFolderIndex:X})");
|
||||
Console.WriteLine($" Unknown: {entry.Unknown} (0x{entry.Unknown:X})");
|
||||
builder.AppendLine($" Parent folder index: {entry.ParentFolderIndex} (0x{entry.ParentFolderIndex:X})");
|
||||
builder.AppendLine($" Unknown: {entry.Unknown} (0x{entry.Unknown:X})");
|
||||
}
|
||||
else
|
||||
{
|
||||
ushort totalEntries = (ushort)((entry.Unknown << 8) | entry.ParentFolderIndex);
|
||||
Console.WriteLine($" Total entries: {totalEntries} (0x{totalEntries:X})");
|
||||
builder.AppendLine($" Total entries: {totalEntries} (0x{totalEntries:X})");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print folder allocation table information
|
||||
/// </summary>
|
||||
private void PrintNameList()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintNameList(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine($" Name List:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" Name List:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (NameList == null || NameList.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No name list entries");
|
||||
builder.AppendLine(" No name list entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < NameList.Length; i++)
|
||||
{
|
||||
var entry = NameList[i];
|
||||
Console.WriteLine($" Name List Entry {i}");
|
||||
Console.WriteLine($" Folder: {entry.Folder} (0x{entry.Folder:X})");
|
||||
Console.WriteLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Name List Entry {i}");
|
||||
builder.AppendLine($" Folder: {entry.Folder} (0x{entry.Folder:X})");
|
||||
builder.AppendLine($" Name: {entry.Name ?? "[NULL]"}");
|
||||
if (entry.Folder)
|
||||
Console.WriteLine($" Index: {entry.Index} (0x{entry.Index:X})");
|
||||
builder.AppendLine($" Index: {entry.Index} (0x{entry.Index:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print file allocation table information
|
||||
/// </summary>
|
||||
private void PrintFileAllocationTable()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFileAllocationTable(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine($" File Allocation Table:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine($" File Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FileAllocationTable == null || FileAllocationTable.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No file allocation table entries");
|
||||
builder.AppendLine(" No file allocation table entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FileAllocationTable.Length; i++)
|
||||
{
|
||||
var entry = FileAllocationTable[i];
|
||||
Console.WriteLine($" File Allocation Table Entry {i}");
|
||||
Console.WriteLine($" Start offset: {entry.StartOffset} (0x{entry.StartOffset:X})");
|
||||
Console.WriteLine($" End offset: {entry.EndOffset} (0x{entry.EndOffset:X})");
|
||||
builder.AppendLine($" File Allocation Table Entry {i}");
|
||||
builder.AppendLine($" Start offset: {entry.StartOffset} (0x{entry.StartOffset:X})");
|
||||
builder.AppendLine($" End offset: {entry.EndOffset} (0x{entry.EndOffset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -101,52 +101,58 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("PAK Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintDirectoryItems();
|
||||
builder.AppendLine("PAK Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintDirectoryItems(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Directory offset: {DirectoryOffset} (0x{DirectoryOffset:X})");
|
||||
Console.WriteLine($" Directory length: {DirectoryLength} (0x{DirectoryLength:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Directory offset: {DirectoryOffset} (0x{DirectoryOffset:X})");
|
||||
builder.AppendLine($" Directory length: {DirectoryLength} (0x{DirectoryLength:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory items information
|
||||
/// </summary>
|
||||
private void PrintDirectoryItems()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryItems(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Items Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryItems == null || DirectoryItems.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory items");
|
||||
builder.AppendLine(" No directory items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryItems.Length; i++)
|
||||
{
|
||||
var directoryItem = DirectoryItems[i];
|
||||
Console.WriteLine($" Directory Item {i}");
|
||||
Console.WriteLine($" Item name: {directoryItem.ItemName}");
|
||||
Console.WriteLine($" Item offset: {directoryItem.ItemOffset} (0x{directoryItem.ItemOffset:X})");
|
||||
Console.WriteLine($" Item length: {directoryItem.ItemLength} (0x{directoryItem.ItemLength:X})");
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine($" Item name: {directoryItem.ItemName}");
|
||||
builder.AppendLine($" Item offset: {directoryItem.ItemOffset} (0x{directoryItem.ItemOffset:X})");
|
||||
builder.AppendLine($" Item length: {directoryItem.ItemLength} (0x{directoryItem.ItemLength:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BurnOutSharp.Compression.Quantum;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -221,63 +219,69 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("Quantum Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintFileList();
|
||||
Console.WriteLine($" Compressed data offset: {CompressedDataOffset} (0x{CompressedDataOffset:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine("Quantum Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintFileList(builder);
|
||||
builder.AppendLine($" Compressed data offset: {CompressedDataOffset} (0x{CompressedDataOffset:X})");
|
||||
builder.AppendLine();
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
Console.WriteLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
Console.WriteLine($" File count: {FileCount} (0x{FileCount:X})");
|
||||
Console.WriteLine($" Table size: {TableSize} (0x{TableSize:X})");
|
||||
Console.WriteLine($" Compression flags: {CompressionFlags} (0x{CompressionFlags:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
builder.AppendLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
builder.AppendLine($" File count: {FileCount} (0x{FileCount:X})");
|
||||
builder.AppendLine($" Table size: {TableSize} (0x{TableSize:X})");
|
||||
builder.AppendLine($" Compression flags: {CompressionFlags} (0x{CompressionFlags:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print file list information
|
||||
/// </summary>
|
||||
private void PrintFileList()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFileList(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" File List Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" File List Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (FileCount == 0 || FileList == null || FileList.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No file list items");
|
||||
builder.AppendLine(" No file list items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < FileList.Length; i++)
|
||||
{
|
||||
var fileDescriptor = FileList[i];
|
||||
Console.WriteLine($" File Descriptor {i}");
|
||||
Console.WriteLine($" File name size: {fileDescriptor.FileNameSize} (0x{fileDescriptor.FileNameSize:X})");
|
||||
Console.WriteLine($" File name: {fileDescriptor.FileName ?? "[NULL]"}");
|
||||
Console.WriteLine($" Comment field size: {fileDescriptor.CommentFieldSize} (0x{fileDescriptor.CommentFieldSize:X})");
|
||||
Console.WriteLine($" Comment field: {fileDescriptor.CommentField ?? "[NULL]"}");
|
||||
Console.WriteLine($" Expanded file size: {fileDescriptor.ExpandedFileSize} (0x{fileDescriptor.ExpandedFileSize:X})");
|
||||
Console.WriteLine($" File time: {fileDescriptor.FileTime} (0x{fileDescriptor.FileTime:X})");
|
||||
Console.WriteLine($" File date: {fileDescriptor.FileDate} (0x{fileDescriptor.FileDate:X})");
|
||||
builder.AppendLine($" File Descriptor {i}");
|
||||
builder.AppendLine($" File name size: {fileDescriptor.FileNameSize} (0x{fileDescriptor.FileNameSize:X})");
|
||||
builder.AppendLine($" File name: {fileDescriptor.FileName ?? "[NULL]"}");
|
||||
builder.AppendLine($" Comment field size: {fileDescriptor.CommentFieldSize} (0x{fileDescriptor.CommentFieldSize:X})");
|
||||
builder.AppendLine($" Comment field: {fileDescriptor.CommentField ?? "[NULL]"}");
|
||||
builder.AppendLine($" Expanded file size: {fileDescriptor.ExpandedFileSize} (0x{fileDescriptor.ExpandedFileSize:X})");
|
||||
builder.AppendLine($" File time: {fileDescriptor.FileTime} (0x{fileDescriptor.FileTime:X})");
|
||||
builder.AppendLine($" File date: {fileDescriptor.FileDate} (0x{fileDescriptor.FileDate:X})");
|
||||
if (fileDescriptor.Unknown != null)
|
||||
Console.WriteLine($" Unknown (Checksum?): {fileDescriptor.Unknown} (0x{fileDescriptor.Unknown:X})");
|
||||
builder.AppendLine($" Unknown (Checksum?): {fileDescriptor.Unknown} (0x{fileDescriptor.Unknown:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
@@ -414,223 +415,232 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("SGA Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("SGA Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Header
|
||||
PrintHeader();
|
||||
PrintHeader(builder);
|
||||
|
||||
// Directory
|
||||
PrintDirectoryHeader();
|
||||
PrintSections();
|
||||
PrintFolders();
|
||||
PrintFiles();
|
||||
PrintDirectoryHeader(builder);
|
||||
PrintSections(builder);
|
||||
PrintFolders(builder);
|
||||
PrintFiles(builder);
|
||||
// TODO: Should we print the string table?
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
Console.WriteLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
Console.WriteLine($" File MD5: {(FileMD5 == null ? "[NULL]" : BitConverter.ToString(FileMD5).Replace("-", string.Empty))}");
|
||||
Console.WriteLine($" Name: {Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Header MD5: {(HeaderMD5 == null ? "[NULL]" : BitConverter.ToString(HeaderMD5).Replace("-", string.Empty))}");
|
||||
Console.WriteLine($" Header length: {HeaderLength?.ToString() ?? "[NULL]"} (0x{HeaderLength?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" File data offset: {FileDataOffset?.ToString() ?? "[NULL]"} (0x{FileDataOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Dummy 0: {Dummy0?.ToString() ?? "[NULL]"} (0x{Dummy0?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
builder.AppendLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
builder.AppendLine($" File MD5: {(FileMD5 == null ? "[NULL]" : BitConverter.ToString(FileMD5).Replace("-", string.Empty))}");
|
||||
builder.AppendLine($" Name: {Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Header MD5: {(HeaderMD5 == null ? "[NULL]" : BitConverter.ToString(HeaderMD5).Replace("-", string.Empty))}");
|
||||
builder.AppendLine($" Header length: {HeaderLength?.ToString() ?? "[NULL]"} (0x{HeaderLength?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" File data offset: {FileDataOffset?.ToString() ?? "[NULL]"} (0x{FileDataOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Dummy 0: {Dummy0?.ToString() ?? "[NULL]"} (0x{Dummy0?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory header information
|
||||
/// </summary>
|
||||
private void PrintDirectoryHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Section offset: {SectionOffset?.ToString() ?? "[NULL]"} (0x{SectionOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Section count: {SectionCount?.ToString() ?? "[NULL]"} (0x{SectionCount?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Folder offset: {FolderOffset?.ToString() ?? "[NULL]"} (0x{FolderOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Folder count: {FolderCount?.ToString() ?? "[NULL]"} (0x{FolderCount?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" File offset: {FileOffset?.ToString() ?? "[NULL]"} (0x{FileOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" File count: {FileCount?.ToString() ?? "[NULL]"} (0x{FileCount?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" String table offset: {StringTableOffset?.ToString() ?? "[NULL]"} (0x{StringTableOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" String table count: {StringTableCount?.ToString() ?? "[NULL]"} (0x{StringTableCount?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Hash table offset: {HashTableOffset?.ToString() ?? "[NULL]"} (0x{HashTableOffset?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine($" Block size: {BlockSize?.ToString() ?? "[NULL]"} (0x{BlockSize?.ToString("X") ?? "[NULL]"})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Section offset: {SectionOffset?.ToString() ?? "[NULL]"} (0x{SectionOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Section count: {SectionCount?.ToString() ?? "[NULL]"} (0x{SectionCount?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Folder offset: {FolderOffset?.ToString() ?? "[NULL]"} (0x{FolderOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Folder count: {FolderCount?.ToString() ?? "[NULL]"} (0x{FolderCount?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" File offset: {FileOffset?.ToString() ?? "[NULL]"} (0x{FileOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" File count: {FileCount?.ToString() ?? "[NULL]"} (0x{FileCount?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" String table offset: {StringTableOffset?.ToString() ?? "[NULL]"} (0x{StringTableOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" String table count: {StringTableCount?.ToString() ?? "[NULL]"} (0x{StringTableCount?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Hash table offset: {HashTableOffset?.ToString() ?? "[NULL]"} (0x{HashTableOffset?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine($" Block size: {BlockSize?.ToString() ?? "[NULL]"} (0x{BlockSize?.ToString("X") ?? "[NULL]"})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print sections information
|
||||
/// </summary>
|
||||
private void PrintSections()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintSections(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Sections Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Sections Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Sections == null || Sections.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No sections");
|
||||
builder.AppendLine(" No sections");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Sections.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Section {i}");
|
||||
builder.AppendLine($" Section {i}");
|
||||
switch (MajorVersion)
|
||||
{
|
||||
case 4:
|
||||
var section4 = Sections[i] as Models.SGA.Section4;
|
||||
Console.WriteLine($" Alias: {section4.Alias ?? "[NULL]"}");
|
||||
Console.WriteLine($" Name: {section4.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Folder start index: {section4.FolderStartIndex} (0x{section4.FolderStartIndex:X})");
|
||||
Console.WriteLine($" Folder end index: {section4.FolderEndIndex} (0x{section4.FolderEndIndex:X})");
|
||||
Console.WriteLine($" File start index: {section4.FileStartIndex} (0x{section4.FileStartIndex:X})");
|
||||
Console.WriteLine($" File end index: {section4.FileEndIndex} (0x{section4.FileEndIndex:X})");
|
||||
Console.WriteLine($" Folder root index: {section4.FolderRootIndex} (0x{section4.FolderRootIndex:X})");
|
||||
builder.AppendLine($" Alias: {section4.Alias ?? "[NULL]"}");
|
||||
builder.AppendLine($" Name: {section4.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Folder start index: {section4.FolderStartIndex} (0x{section4.FolderStartIndex:X})");
|
||||
builder.AppendLine($" Folder end index: {section4.FolderEndIndex} (0x{section4.FolderEndIndex:X})");
|
||||
builder.AppendLine($" File start index: {section4.FileStartIndex} (0x{section4.FileStartIndex:X})");
|
||||
builder.AppendLine($" File end index: {section4.FileEndIndex} (0x{section4.FileEndIndex:X})");
|
||||
builder.AppendLine($" Folder root index: {section4.FolderRootIndex} (0x{section4.FolderRootIndex:X})");
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
var section5 = Sections[i] as Models.SGA.Section5;
|
||||
Console.WriteLine($" Alias: {section5.Alias ?? "[NULL]"}");
|
||||
Console.WriteLine($" Name: {section5.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Folder start index: {section5.FolderStartIndex} (0x{section5.FolderStartIndex:X})");
|
||||
Console.WriteLine($" Folder end index: {section5.FolderEndIndex} (0x{section5.FolderEndIndex:X})");
|
||||
Console.WriteLine($" File start index: {section5.FileStartIndex} (0x{section5.FileStartIndex:X})");
|
||||
Console.WriteLine($" File end index: {section5.FileEndIndex} (0x{section5.FileEndIndex:X})");
|
||||
Console.WriteLine($" Folder root index: {section5.FolderRootIndex} (0x{section5.FolderRootIndex:X})");
|
||||
builder.AppendLine($" Alias: {section5.Alias ?? "[NULL]"}");
|
||||
builder.AppendLine($" Name: {section5.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Folder start index: {section5.FolderStartIndex} (0x{section5.FolderStartIndex:X})");
|
||||
builder.AppendLine($" Folder end index: {section5.FolderEndIndex} (0x{section5.FolderEndIndex:X})");
|
||||
builder.AppendLine($" File start index: {section5.FileStartIndex} (0x{section5.FileStartIndex:X})");
|
||||
builder.AppendLine($" File end index: {section5.FileEndIndex} (0x{section5.FileEndIndex:X})");
|
||||
builder.AppendLine($" Folder root index: {section5.FolderRootIndex} (0x{section5.FolderRootIndex:X})");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($" Unknown format for version {MajorVersion}");
|
||||
builder.AppendLine($" Unknown format for version {MajorVersion}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print folders information
|
||||
/// </summary>
|
||||
private void PrintFolders()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFolders(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Folders Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Folders Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Folders == null || Folders.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No folders");
|
||||
builder.AppendLine(" No folders");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Folders.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" Folder {i}");
|
||||
builder.AppendLine($" Folder {i}");
|
||||
switch (MajorVersion)
|
||||
{
|
||||
case 4:
|
||||
var folder4 = Folders[i] as Models.SGA.Folder4;
|
||||
Console.WriteLine($" Name offset: {folder4.NameOffset} (0x{folder4.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {folder4.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Folder start index: {folder4.FolderStartIndex} (0x{folder4.FolderStartIndex:X})");
|
||||
Console.WriteLine($" Folder end index: {folder4.FolderEndIndex} (0x{folder4.FolderEndIndex:X})");
|
||||
Console.WriteLine($" File start index: {folder4.FileStartIndex} (0x{folder4.FileStartIndex:X})");
|
||||
Console.WriteLine($" File end index: {folder4.FileEndIndex} (0x{folder4.FileEndIndex:X})");
|
||||
builder.AppendLine($" Name offset: {folder4.NameOffset} (0x{folder4.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {folder4.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Folder start index: {folder4.FolderStartIndex} (0x{folder4.FolderStartIndex:X})");
|
||||
builder.AppendLine($" Folder end index: {folder4.FolderEndIndex} (0x{folder4.FolderEndIndex:X})");
|
||||
builder.AppendLine($" File start index: {folder4.FileStartIndex} (0x{folder4.FileStartIndex:X})");
|
||||
builder.AppendLine($" File end index: {folder4.FileEndIndex} (0x{folder4.FileEndIndex:X})");
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
var folder5 = Folders[i] as Models.SGA.Folder5;
|
||||
Console.WriteLine($" Name offset: {folder5.NameOffset} (0x{folder5.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {folder5.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Folder start index: {folder5.FolderStartIndex} (0x{folder5.FolderStartIndex:X})");
|
||||
Console.WriteLine($" Folder end index: {folder5.FolderEndIndex} (0x{folder5.FolderEndIndex:X})");
|
||||
Console.WriteLine($" File start index: {folder5.FileStartIndex} (0x{folder5.FileStartIndex:X})");
|
||||
Console.WriteLine($" File end index: {folder5.FileEndIndex} (0x{folder5.FileEndIndex:X})");
|
||||
builder.AppendLine($" Name offset: {folder5.NameOffset} (0x{folder5.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {folder5.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Folder start index: {folder5.FolderStartIndex} (0x{folder5.FolderStartIndex:X})");
|
||||
builder.AppendLine($" Folder end index: {folder5.FolderEndIndex} (0x{folder5.FolderEndIndex:X})");
|
||||
builder.AppendLine($" File start index: {folder5.FileStartIndex} (0x{folder5.FileStartIndex:X})");
|
||||
builder.AppendLine($" File end index: {folder5.FileEndIndex} (0x{folder5.FileEndIndex:X})");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($" Unknown format for version {MajorVersion}");
|
||||
builder.AppendLine($" Unknown format for version {MajorVersion}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print files information
|
||||
/// </summary>
|
||||
private void PrintFiles()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFiles(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Files Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Files == null || Files.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No files");
|
||||
builder.AppendLine(" No files");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Files.Length; i++)
|
||||
{
|
||||
Console.WriteLine($" File {i}");
|
||||
builder.AppendLine($" File {i}");
|
||||
switch (MajorVersion)
|
||||
{
|
||||
case 4:
|
||||
case 5:
|
||||
var file4 = Files[i] as Models.SGA.File4;
|
||||
Console.WriteLine($" Name offset: {file4.NameOffset} (0x{file4.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {file4.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Offset: {file4.Offset} (0x{file4.Offset:X})");
|
||||
Console.WriteLine($" Size on disk: {file4.SizeOnDisk} (0x{file4.SizeOnDisk:X})");
|
||||
Console.WriteLine($" Size: {file4.Size} (0x{file4.Size:X})");
|
||||
Console.WriteLine($" Time modified: {file4.TimeModified} (0x{file4.TimeModified:X})");
|
||||
Console.WriteLine($" Dummy 0: {file4.Dummy0} (0x{file4.Dummy0:X})");
|
||||
Console.WriteLine($" Type: {file4.Type} (0x{file4.Type:X})");
|
||||
builder.AppendLine($" Name offset: {file4.NameOffset} (0x{file4.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {file4.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Offset: {file4.Offset} (0x{file4.Offset:X})");
|
||||
builder.AppendLine($" Size on disk: {file4.SizeOnDisk} (0x{file4.SizeOnDisk:X})");
|
||||
builder.AppendLine($" Size: {file4.Size} (0x{file4.Size:X})");
|
||||
builder.AppendLine($" Time modified: {file4.TimeModified} (0x{file4.TimeModified:X})");
|
||||
builder.AppendLine($" Dummy 0: {file4.Dummy0} (0x{file4.Dummy0:X})");
|
||||
builder.AppendLine($" Type: {file4.Type} (0x{file4.Type:X})");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
var file6 = Files[i] as Models.SGA.File6;
|
||||
Console.WriteLine($" Name offset: {file6.NameOffset} (0x{file6.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {file6.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Offset: {file6.Offset} (0x{file6.Offset:X})");
|
||||
Console.WriteLine($" Size on disk: {file6.SizeOnDisk} (0x{file6.SizeOnDisk:X})");
|
||||
Console.WriteLine($" Size: {file6.Size} (0x{file6.Size:X})");
|
||||
Console.WriteLine($" Time modified: {file6.TimeModified} (0x{file6.TimeModified:X})");
|
||||
Console.WriteLine($" Dummy 0: {file6.Dummy0} (0x{file6.Dummy0:X})");
|
||||
Console.WriteLine($" Type: {file6.Type} (0x{file6.Type:X})");
|
||||
Console.WriteLine($" CRC32: {file6.CRC32} (0x{file6.CRC32:X})");
|
||||
builder.AppendLine($" Name offset: {file6.NameOffset} (0x{file6.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {file6.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Offset: {file6.Offset} (0x{file6.Offset:X})");
|
||||
builder.AppendLine($" Size on disk: {file6.SizeOnDisk} (0x{file6.SizeOnDisk:X})");
|
||||
builder.AppendLine($" Size: {file6.Size} (0x{file6.Size:X})");
|
||||
builder.AppendLine($" Time modified: {file6.TimeModified} (0x{file6.TimeModified:X})");
|
||||
builder.AppendLine($" Dummy 0: {file6.Dummy0} (0x{file6.Dummy0:X})");
|
||||
builder.AppendLine($" Type: {file6.Type} (0x{file6.Type:X})");
|
||||
builder.AppendLine($" CRC32: {file6.CRC32} (0x{file6.CRC32:X})");
|
||||
break;
|
||||
case 7:
|
||||
var file7 = Files[i] as Models.SGA.File7;
|
||||
Console.WriteLine($" Name offset: {file7.NameOffset} (0x{file7.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {file7.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Offset: {file7.Offset} (0x{file7.Offset:X})");
|
||||
Console.WriteLine($" Size on disk: {file7.SizeOnDisk} (0x{file7.SizeOnDisk:X})");
|
||||
Console.WriteLine($" Size: {file7.Size} (0x{file7.Size:X})");
|
||||
Console.WriteLine($" Time modified: {file7.TimeModified} (0x{file7.TimeModified:X})");
|
||||
Console.WriteLine($" Dummy 0: {file7.Dummy0} (0x{file7.Dummy0:X})");
|
||||
Console.WriteLine($" Type: {file7.Type} (0x{file7.Type:X})");
|
||||
Console.WriteLine($" CRC32: {file7.CRC32} (0x{file7.CRC32:X})");
|
||||
Console.WriteLine($" Hash offset: {file7.HashOffset} (0x{file7.HashOffset:X})");
|
||||
builder.AppendLine($" Name offset: {file7.NameOffset} (0x{file7.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {file7.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Offset: {file7.Offset} (0x{file7.Offset:X})");
|
||||
builder.AppendLine($" Size on disk: {file7.SizeOnDisk} (0x{file7.SizeOnDisk:X})");
|
||||
builder.AppendLine($" Size: {file7.Size} (0x{file7.Size:X})");
|
||||
builder.AppendLine($" Time modified: {file7.TimeModified} (0x{file7.TimeModified:X})");
|
||||
builder.AppendLine($" Dummy 0: {file7.Dummy0} (0x{file7.Dummy0:X})");
|
||||
builder.AppendLine($" Type: {file7.Type} (0x{file7.Type:X})");
|
||||
builder.AppendLine($" CRC32: {file7.CRC32} (0x{file7.CRC32:X})");
|
||||
builder.AppendLine($" Hash offset: {file7.HashOffset} (0x{file7.HashOffset:X})");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($" Unknown format for version {MajorVersion}");
|
||||
builder.AppendLine($" Unknown format for version {MajorVersion}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using static BurnOutSharp.Models.VBSP.Constants;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
@@ -94,41 +94,47 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("VBSP Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintLumps();
|
||||
builder.AppendLine("VBSP Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintLumps(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
/// <remarks>Slightly out of order due to the lumps</remarks>
|
||||
private void PrintHeader()
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine($" Map revision: {MapRevision} (0x{MapRevision:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine($" Map revision: {MapRevision} (0x{MapRevision:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lumps information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
/// <remarks>Technically part of the header</remarks>
|
||||
private void PrintLumps()
|
||||
private void PrintLumps(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Lumps Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Lumps == null || Lumps.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No lumps");
|
||||
builder.AppendLine(" No lumps");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -146,14 +152,14 @@ namespace BurnOutSharp.Wrappers
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($" Lump {i}{specialLumpName}");
|
||||
Console.WriteLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
Console.WriteLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
Console.WriteLine($" Version: {lump.Version} (0x{lump.Version:X})");
|
||||
Console.WriteLine($" 4CC: {string.Join(", ", lump.FourCC)}");
|
||||
builder.AppendLine($" Lump {i}{specialLumpName}");
|
||||
builder.AppendLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
builder.AppendLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
builder.AppendLine($" Version: {lump.Version} (0x{lump.Version:X})");
|
||||
builder.AppendLine($" 4CC: {string.Join(", ", lump.FourCC)}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BurnOutSharp.Utilities;
|
||||
using static BurnOutSharp.Models.VPK.Constants;
|
||||
|
||||
@@ -176,122 +177,131 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("VPK Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintExtendedHeader();
|
||||
PrintArchiveHashes();
|
||||
PrintDirectoryItems();
|
||||
builder.AppendLine("VPK Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintExtendedHeader(builder);
|
||||
PrintArchiveHashes(builder);
|
||||
PrintDirectoryItems(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature} (0x{Signature:X})");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine($" Directory length: {DirectoryLength} (0x{DirectoryLength:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature} (0x{Signature:X})");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine($" Directory length: {DirectoryLength} (0x{DirectoryLength:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print extended header information
|
||||
/// </summary>
|
||||
private void PrintExtendedHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintExtendedHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Extended Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (_file.ExtendedHeader == null)
|
||||
{
|
||||
Console.WriteLine(" No extended header");
|
||||
builder.AppendLine(" No extended header");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
|
||||
Console.WriteLine($" Archive hash length: {ArchiveHashLength} (0x{ArchiveHashLength:X})");
|
||||
Console.WriteLine($" Extra length: {ExtraLength} (0x{ExtraLength:X})");
|
||||
Console.WriteLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
|
||||
builder.AppendLine($" Archive hash length: {ArchiveHashLength} (0x{ArchiveHashLength:X})");
|
||||
builder.AppendLine($" Extra length: {ExtraLength} (0x{ExtraLength:X})");
|
||||
builder.AppendLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print archive hashes information
|
||||
/// </summary>
|
||||
private void PrintArchiveHashes()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintArchiveHashes(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Archive Hashes Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Archive Hashes Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ArchiveHashes == null || ArchiveHashes.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No archive hashes");
|
||||
builder.AppendLine(" No archive hashes");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ArchiveHashes.Length; i++)
|
||||
{
|
||||
var archiveHash = ArchiveHashes[i];
|
||||
Console.WriteLine($" Archive Hash {i}");
|
||||
Console.WriteLine($" Archive index: {archiveHash.ArchiveIndex} (0x{archiveHash.ArchiveIndex:X})");
|
||||
Console.WriteLine($" Archive offset: {archiveHash.ArchiveOffset} (0x{archiveHash.ArchiveOffset:X})");
|
||||
Console.WriteLine($" Length: {archiveHash.Length} (0x{archiveHash.Length:X})");
|
||||
Console.WriteLine($" Hash: {BitConverter.ToString(archiveHash.Hash).Replace("-", string.Empty)}");
|
||||
builder.AppendLine($" Archive Hash {i}");
|
||||
builder.AppendLine($" Archive index: {archiveHash.ArchiveIndex} (0x{archiveHash.ArchiveIndex:X})");
|
||||
builder.AppendLine($" Archive offset: {archiveHash.ArchiveOffset} (0x{archiveHash.ArchiveOffset:X})");
|
||||
builder.AppendLine($" Length: {archiveHash.Length} (0x{archiveHash.Length:X})");
|
||||
builder.AppendLine($" Hash: {BitConverter.ToString(archiveHash.Hash).Replace("-", string.Empty)}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory items information
|
||||
/// </summary>
|
||||
private void PrintDirectoryItems()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryItems(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Items Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryItems == null || DirectoryItems.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory items");
|
||||
builder.AppendLine(" No directory items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryItems.Length; i++)
|
||||
{
|
||||
var directoryItem = DirectoryItems[i];
|
||||
Console.WriteLine($" Directory Item {i}");
|
||||
Console.WriteLine($" Extension: {directoryItem.Extension}");
|
||||
Console.WriteLine($" Path: {directoryItem.Path}");
|
||||
Console.WriteLine($" Name: {directoryItem.Name}");
|
||||
PrintDirectoryEntry(directoryItem.DirectoryEntry);
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine($" Extension: {directoryItem.Extension}");
|
||||
builder.AppendLine($" Path: {directoryItem.Path}");
|
||||
builder.AppendLine($" Name: {directoryItem.Name}");
|
||||
PrintDirectoryEntry(directoryItem.DirectoryEntry, builder);
|
||||
// TODO: Print out preload data?
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory entry information
|
||||
/// </summary>
|
||||
private void PrintDirectoryEntry(Models.VPK.DirectoryEntry directoryEntry)
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntry(Models.VPK.DirectoryEntry directoryEntry, StringBuilder builder)
|
||||
{
|
||||
if (directoryEntry == null)
|
||||
{
|
||||
Console.WriteLine(" Directory entry: [NULL]");
|
||||
builder.AppendLine(" Directory entry: [NULL]");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Directory entry CRC: {directoryEntry.CRC} (0x{directoryEntry.CRC:X})");
|
||||
Console.WriteLine($" Directory entry preload bytes: {directoryEntry.PreloadBytes} (0x{directoryEntry.PreloadBytes:X})");
|
||||
Console.WriteLine($" Directory entry archive index: {directoryEntry.ArchiveIndex} (0x{directoryEntry.ArchiveIndex:X})");
|
||||
Console.WriteLine($" Directory entry entry offset: {directoryEntry.EntryOffset} (0x{directoryEntry.EntryOffset:X})");
|
||||
Console.WriteLine($" Directory entry entry length: {directoryEntry.EntryLength} (0x{directoryEntry.EntryLength:X})");
|
||||
Console.WriteLine($" Directory entry dummy 0: {directoryEntry.Dummy0} (0x{directoryEntry.Dummy0:X})");
|
||||
builder.AppendLine($" Directory entry CRC: {directoryEntry.CRC} (0x{directoryEntry.CRC:X})");
|
||||
builder.AppendLine($" Directory entry preload bytes: {directoryEntry.PreloadBytes} (0x{directoryEntry.PreloadBytes:X})");
|
||||
builder.AppendLine($" Directory entry archive index: {directoryEntry.ArchiveIndex} (0x{directoryEntry.ArchiveIndex:X})");
|
||||
builder.AppendLine($" Directory entry entry offset: {directoryEntry.EntryOffset} (0x{directoryEntry.EntryOffset:X})");
|
||||
builder.AppendLine($" Directory entry entry length: {directoryEntry.EntryLength} (0x{directoryEntry.EntryLength:X})");
|
||||
builder.AppendLine($" Directory entry dummy 0: {directoryEntry.Dummy0} (0x{directoryEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -108,95 +108,102 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("WAD Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintLumps();
|
||||
PrintLumpInfos();
|
||||
builder.AppendLine("WAD Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintLumps(builder);
|
||||
PrintLumpInfos(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Lump count: {LumpCount} (0x{LumpCount:X})");
|
||||
Console.WriteLine($" Lump offset: {LumpOffset} (0x{LumpOffset:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Lump count: {LumpCount} (0x{LumpCount:X})");
|
||||
builder.AppendLine($" Lump offset: {LumpOffset} (0x{LumpOffset:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lumps information
|
||||
/// </summary>
|
||||
private void PrintLumps()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintLumps(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Lumps Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Lumps == null || Lumps.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No lumps");
|
||||
builder.AppendLine(" No lumps");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Lumps.Length; i++)
|
||||
{
|
||||
var lump = Lumps[i];
|
||||
Console.WriteLine($" Lump {i}");
|
||||
Console.WriteLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
Console.WriteLine($" Disk length: {lump.DiskLength} (0x{lump.DiskLength:X})");
|
||||
Console.WriteLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
Console.WriteLine($" Type: {lump.Type} (0x{lump.Type:X})");
|
||||
Console.WriteLine($" Compression: {lump.Compression} (0x{lump.Compression:X})");
|
||||
Console.WriteLine($" Padding 0: {lump.Padding0} (0x{lump.Padding0:X})");
|
||||
Console.WriteLine($" Padding 1: {lump.Padding1} (0x{lump.Padding1:X})");
|
||||
Console.WriteLine($" Name: {lump.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Lump {i}");
|
||||
builder.AppendLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
builder.AppendLine($" Disk length: {lump.DiskLength} (0x{lump.DiskLength:X})");
|
||||
builder.AppendLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
builder.AppendLine($" Type: {lump.Type} (0x{lump.Type:X})");
|
||||
builder.AppendLine($" Compression: {lump.Compression} (0x{lump.Compression:X})");
|
||||
builder.AppendLine($" Padding 0: {lump.Padding0} (0x{lump.Padding0:X})");
|
||||
builder.AppendLine($" Padding 1: {lump.Padding1} (0x{lump.Padding1:X})");
|
||||
builder.AppendLine($" Name: {lump.Name ?? "[NULL]"}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lump infos information
|
||||
/// </summary>
|
||||
private void PrintLumpInfos()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintLumpInfos(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Lump Infos Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Lump Infos Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (LumpInfos == null || LumpInfos.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No lump infos");
|
||||
builder.AppendLine(" No lump infos");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < LumpInfos.Length; i++)
|
||||
{
|
||||
var lumpInfo = LumpInfos[i];
|
||||
Console.WriteLine($" Lump Info {i}");
|
||||
builder.AppendLine($" Lump Info {i}");
|
||||
if (lumpInfo == null)
|
||||
{
|
||||
Console.WriteLine(" Lump is compressed");
|
||||
builder.AppendLine(" Lump is compressed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Name: {lumpInfo.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Width: {lumpInfo.Width} (0x{lumpInfo.Width:X})");
|
||||
Console.WriteLine($" Height: {lumpInfo.Height} (0x{lumpInfo.Height:X})");
|
||||
Console.WriteLine($" Pixel offset: {lumpInfo.PixelOffset} (0x{lumpInfo.PixelOffset:X})");
|
||||
builder.AppendLine($" Name: {lumpInfo.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Width: {lumpInfo.Width} (0x{lumpInfo.Width:X})");
|
||||
builder.AppendLine($" Height: {lumpInfo.Height} (0x{lumpInfo.Height:X})");
|
||||
builder.AppendLine($" Pixel offset: {lumpInfo.PixelOffset} (0x{lumpInfo.PixelOffset:X})");
|
||||
// TODO: Print unknown data?
|
||||
// TODO: Print pixel data?
|
||||
Console.WriteLine($" Palette size: {lumpInfo.PaletteSize} (0x{lumpInfo.PaletteSize:X})");
|
||||
builder.AppendLine($" Palette size: {lumpInfo.PaletteSize} (0x{lumpInfo.PaletteSize:X})");
|
||||
// TODO: Print palette data?
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -283,9 +283,9 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <summary>
|
||||
/// Pretty print the item information
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
public abstract void PrettyPrint();
|
||||
public abstract StringBuilder PrettyPrint();
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -151,148 +151,158 @@ namespace BurnOutSharp.Wrappers
|
||||
#region Printing
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void PrettyPrint()
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
Console.WriteLine("XZP Information:");
|
||||
Console.WriteLine("-------------------------");
|
||||
Console.WriteLine();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
PrintHeader();
|
||||
PrintDirectoryEntries();
|
||||
PrintPreloadDirectoryEntries();
|
||||
PrintPreloadDirectoryMappings();
|
||||
PrintDirectoryItems();
|
||||
PrintFooter();
|
||||
builder.AppendLine("XZP Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintDirectoryEntries(builder);
|
||||
PrintPreloadDirectoryEntries(builder);
|
||||
PrintPreloadDirectoryMappings(builder);
|
||||
PrintDirectoryItems(builder);
|
||||
PrintFooter(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
private void PrintHeader()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Header Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" Signature: {Signature}");
|
||||
Console.WriteLine($" Version: {Version} (0x{Version:X})");
|
||||
Console.WriteLine($" Preload directory entry count: {PreloadDirectoryEntryCount} (0x{PreloadDirectoryEntryCount:X})");
|
||||
Console.WriteLine($" Directory entry count: {DirectoryEntryCount} (0x{DirectoryEntryCount:X})");
|
||||
Console.WriteLine($" Preload bytes: {PreloadBytes} (0x{PreloadBytes:X})");
|
||||
Console.WriteLine($" Header length: {HeaderLength} (0x{HeaderLength:X})");
|
||||
Console.WriteLine($" Directory item count: {DirectoryItemCount} (0x{DirectoryItemCount:X})");
|
||||
Console.WriteLine($" Directory item offset: {DirectoryItemOffset} (0x{DirectoryItemOffset:X})");
|
||||
Console.WriteLine($" Directory item length: {DirectoryItemLength} (0x{DirectoryItemLength:X})");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
builder.AppendLine($" Preload directory entry count: {PreloadDirectoryEntryCount} (0x{PreloadDirectoryEntryCount:X})");
|
||||
builder.AppendLine($" Directory entry count: {DirectoryEntryCount} (0x{DirectoryEntryCount:X})");
|
||||
builder.AppendLine($" Preload bytes: {PreloadBytes} (0x{PreloadBytes:X})");
|
||||
builder.AppendLine($" Header length: {HeaderLength} (0x{HeaderLength:X})");
|
||||
builder.AppendLine($" Directory item count: {DirectoryItemCount} (0x{DirectoryItemCount:X})");
|
||||
builder.AppendLine($" Directory item offset: {DirectoryItemOffset} (0x{DirectoryItemOffset:X})");
|
||||
builder.AppendLine($" Directory item length: {DirectoryItemLength} (0x{DirectoryItemLength:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory entries information
|
||||
/// </summary>
|
||||
private void PrintDirectoryEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory entries");
|
||||
builder.AppendLine(" No directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = DirectoryEntries[i];
|
||||
Console.WriteLine($" Directory Entry {i}");
|
||||
Console.WriteLine($" File name CRC: {directoryEntry.FileNameCRC} (0x{directoryEntry.FileNameCRC:X})");
|
||||
Console.WriteLine($" Entry length: {directoryEntry.EntryLength} (0x{directoryEntry.EntryLength:X})");
|
||||
Console.WriteLine($" Entry offset: {directoryEntry.EntryOffset} (0x{directoryEntry.EntryOffset:X})");
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine($" File name CRC: {directoryEntry.FileNameCRC} (0x{directoryEntry.FileNameCRC:X})");
|
||||
builder.AppendLine($" Entry length: {directoryEntry.EntryLength} (0x{directoryEntry.EntryLength:X})");
|
||||
builder.AppendLine($" Entry offset: {directoryEntry.EntryOffset} (0x{directoryEntry.EntryOffset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print preload directory entries information
|
||||
/// </summary>
|
||||
private void PrintPreloadDirectoryEntries()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintPreloadDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Preload Directory Entries Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Preload Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (PreloadDirectoryEntries == null || PreloadDirectoryEntries.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No preload directory entries");
|
||||
builder.AppendLine(" No preload directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < PreloadDirectoryEntries.Length; i++)
|
||||
{
|
||||
var preloadDirectoryEntry = PreloadDirectoryEntries[i];
|
||||
Console.WriteLine($" Directory Entry {i}");
|
||||
Console.WriteLine($" File name CRC: {preloadDirectoryEntry.FileNameCRC} (0x{preloadDirectoryEntry.FileNameCRC:X})");
|
||||
Console.WriteLine($" Entry length: {preloadDirectoryEntry.EntryLength} (0x{preloadDirectoryEntry.EntryLength:X})");
|
||||
Console.WriteLine($" Entry offset: {preloadDirectoryEntry.EntryOffset} (0x{preloadDirectoryEntry.EntryOffset:X})");
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine($" File name CRC: {preloadDirectoryEntry.FileNameCRC} (0x{preloadDirectoryEntry.FileNameCRC:X})");
|
||||
builder.AppendLine($" Entry length: {preloadDirectoryEntry.EntryLength} (0x{preloadDirectoryEntry.EntryLength:X})");
|
||||
builder.AppendLine($" Entry offset: {preloadDirectoryEntry.EntryOffset} (0x{preloadDirectoryEntry.EntryOffset:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print preload directory mappings information
|
||||
/// </summary>
|
||||
private void PrintPreloadDirectoryMappings()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintPreloadDirectoryMappings(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Preload Directory Mappings Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Preload Directory Mappings Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (PreloadDirectoryMappings == null || PreloadDirectoryMappings.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No preload directory mappings");
|
||||
builder.AppendLine(" No preload directory mappings");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < PreloadDirectoryMappings.Length; i++)
|
||||
{
|
||||
var preloadDirectoryMapping = PreloadDirectoryMappings[i];
|
||||
Console.WriteLine($" Directory Mapping {i}");
|
||||
Console.WriteLine($" Preload directory entry index: {preloadDirectoryMapping.PreloadDirectoryEntryIndex} (0x{preloadDirectoryMapping.PreloadDirectoryEntryIndex:X})");
|
||||
builder.AppendLine($" Directory Mapping {i}");
|
||||
builder.AppendLine($" Preload directory entry index: {preloadDirectoryMapping.PreloadDirectoryEntryIndex} (0x{preloadDirectoryMapping.PreloadDirectoryEntryIndex:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory items information
|
||||
/// </summary>
|
||||
private void PrintDirectoryItems()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryItems(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Directory Items Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryItems == null || DirectoryItems.Length == 0)
|
||||
{
|
||||
Console.WriteLine(" No directory items");
|
||||
builder.AppendLine(" No directory items");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryItems.Length; i++)
|
||||
{
|
||||
var directoryItem = DirectoryItems[i];
|
||||
Console.WriteLine($" Directory Item {i}");
|
||||
Console.WriteLine($" File name CRC: {directoryItem.FileNameCRC} (0x{directoryItem.FileNameCRC:X})");
|
||||
Console.WriteLine($" Name offset: {directoryItem.NameOffset} (0x{directoryItem.NameOffset:X})");
|
||||
Console.WriteLine($" Name: {directoryItem.Name ?? "[NULL]"}");
|
||||
Console.WriteLine($" Time created: {directoryItem.TimeCreated} (0x{directoryItem.TimeCreated:X})");
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine($" File name CRC: {directoryItem.FileNameCRC} (0x{directoryItem.FileNameCRC:X})");
|
||||
builder.AppendLine($" Name offset: {directoryItem.NameOffset} (0x{directoryItem.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {directoryItem.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Time created: {directoryItem.TimeCreated} (0x{directoryItem.TimeCreated:X})");
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print footer information
|
||||
/// </summary>
|
||||
private void PrintFooter()
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintFooter(StringBuilder builder)
|
||||
{
|
||||
Console.WriteLine(" Footer Information:");
|
||||
Console.WriteLine(" -------------------------");
|
||||
Console.WriteLine($" File length: {F_FileLength} (0x{F_FileLength:X})");
|
||||
Console.WriteLine($" Signature: {F_Signature}");
|
||||
Console.WriteLine();
|
||||
builder.AppendLine(" Footer Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" File length: {F_FileLength} (0x{F_FileLength:X})");
|
||||
builder.AppendLine($" Signature: {F_Signature}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using BurnOutSharp;
|
||||
using BurnOutSharp.Matching;
|
||||
using BurnOutSharp.Utilities;
|
||||
@@ -257,7 +258,10 @@ namespace Test
|
||||
#endif
|
||||
// If we don't have the JSON flag
|
||||
if (!json)
|
||||
wrapper.PrettyPrint();
|
||||
{
|
||||
StringBuilder builder = wrapper.PrettyPrint();
|
||||
Console.WriteLine(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user