mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Remove now-unneeded guards in printers
This commit is contained in:
@@ -37,26 +37,21 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileEntry[]? files)
|
||||
private static void Print(StringBuilder builder, FileEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (files == null || files.Length == 0)
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No file table items");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = files[i];
|
||||
builder.AppendLine($" File Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
var entry = entries[i];
|
||||
|
||||
builder.AppendLine($" File Table Entry {i}");
|
||||
builder.AppendLine(entry.NameSize, " Name size");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.UncompressedSize, " Uncompressed size");
|
||||
|
||||
@@ -98,13 +98,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < directoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = directoryEntries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (directoryEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(directoryEntry.Name, " Name");
|
||||
builder.AppendLine(directoryEntry.NameLength, " Name length");
|
||||
builder.AppendLine($" Object type: {directoryEntry.ObjectType} (0x{directoryEntry.ObjectType:X})");
|
||||
@@ -119,6 +114,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(directoryEntry.StartingSectorLocation, " Staring sector location");
|
||||
builder.AppendLine(directoryEntry.StreamSize, " Stream size");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,13 +114,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Block Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Block Entry {i}");
|
||||
builder.AppendLine(entry.EntryFlags, " Entry flags");
|
||||
builder.AppendLine(entry.FileDataOffset, " File data offset");
|
||||
builder.AppendLine(entry.FileDataSize, " File data size");
|
||||
@@ -129,6 +124,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.PreviousBlockEntryIndex, " Previous block entry index");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -164,15 +160,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Fragmentation Map {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Fragmentation Map {i}");
|
||||
builder.AppendLine(entry.NextDataBlockIndex, " Next data block index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -209,16 +201,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Block Entry Map {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Block Entry Map {i}");
|
||||
builder.AppendLine(entry.PreviousBlockEntryIndex, " Previous data block index");
|
||||
builder.AppendLine(entry.NextBlockEntryIndex, " Next data block index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -264,13 +252,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(entry.NameOffset, " Name offset");
|
||||
builder.AppendLine(entryNames![entry.NameOffset], " Name");
|
||||
builder.AppendLine(entry.ItemSize, " Item size");
|
||||
@@ -280,6 +263,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.NextIndex, " Next index");
|
||||
builder.AppendLine(entry.FirstIndex, " First index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -297,15 +281,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -323,15 +303,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -349,15 +325,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -375,15 +347,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -417,15 +385,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Map Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Map Entry {i}");
|
||||
builder.AppendLine(entry.FirstBlockIndex, " First block index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -477,16 +441,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
builder.AppendLine(entry.ChecksumCount, " Checksum count");
|
||||
builder.AppendLine(entry.FirstChecksumIndex, " First checksum index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -504,15 +464,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
builder.AppendLine(entry.Checksum, " Checksum");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -237,13 +237,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" File Descriptor {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" File Descriptor {i}:");
|
||||
builder.AppendLine(entry.NameOffset, " Name offset");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
@@ -257,6 +252,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.LinkNext, " Link next");
|
||||
builder.AppendLine($" Link flags: {entry.LinkFlags} (0x{entry.LinkFlags:X})");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,13 +152,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Object Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Object Table Entry {i}");
|
||||
builder.AppendLine(entry.VirtualSegmentSize, " Virtual segment size");
|
||||
builder.AppendLine(entry.RelocationBaseAddress, " Relocation base address");
|
||||
builder.AppendLine($" Object flags: {entry.ObjectFlags} (0x{entry.ObjectFlags:X})");
|
||||
@@ -166,6 +161,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.PageTableEntries, " Page table entries");
|
||||
builder.AppendLine(entry.Reserved, " Reserved");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -183,17 +179,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Object Page Map Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Object Page Map Entry {i}");
|
||||
builder.AppendLine(entry.PageDataOffset, " Page data offset");
|
||||
builder.AppendLine(entry.DataSize, " Data size");
|
||||
builder.AppendLine($" Flags: {entry.Flags} (0x{entry.Flags:X})");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -211,19 +203,15 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
builder.AppendLine($" Type ID: {entry.TypeID} (0x{entry.TypeID:X})");
|
||||
builder.AppendLine(entry.NameID, " Name ID");
|
||||
builder.AppendLine(entry.ResourceSize, " Resource size");
|
||||
builder.AppendLine(entry.ObjectNumber, " Object number");
|
||||
builder.AppendLine(entry.Offset, " Offset");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -241,17 +229,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Resident Names Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Resident Names Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.OrdinalNumber, " Ordinal number");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -269,76 +253,71 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < bundles.Length; i++)
|
||||
{
|
||||
var bundle = bundles[i];
|
||||
builder.AppendLine($" Entry Table Bundle {i}");
|
||||
if (bundle == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Entry Table Bundle {i}");
|
||||
builder.AppendLine(bundle.Entries, " Entries");
|
||||
builder.AppendLine($" Bundle type: {bundle.BundleType} (0x{bundle.BundleType:X})");
|
||||
builder.AppendLine();
|
||||
Print(builder, bundle.TableEntries, bundle.BundleType);
|
||||
}
|
||||
|
||||
builder.AppendLine(" Entry Table Entries:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (bundle.TableEntries == null || bundle.TableEntries.Length == 0)
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, EntryTableEntry[]? entries, BundleType type)
|
||||
{
|
||||
builder.AppendLine(" Entry Table Entries:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No entry table entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int j = 0; j < entries.Length; j++)
|
||||
{
|
||||
var entry = entries[j];
|
||||
|
||||
builder.AppendLine($" Entry Table Entry {j}");
|
||||
switch (type & ~BundleType.ParameterTypingInformationPresent)
|
||||
{
|
||||
builder.AppendLine(" No entry table entries");
|
||||
builder.AppendLine();
|
||||
continue;
|
||||
}
|
||||
case BundleType.UnusedEntry:
|
||||
builder.AppendLine(" Unused, empty entry");
|
||||
break;
|
||||
|
||||
for (int j = 0; j < bundle.TableEntries.Length; j++)
|
||||
{
|
||||
var entry = bundle.TableEntries[j];
|
||||
builder.AppendLine($" Entry Table Entry {j}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
case BundleType.SixteenBitEntry:
|
||||
builder.AppendLine(entry.SixteenBitObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.SixteenBitEntryFlags} (0x{entry.SixteenBitEntryFlags:X})");
|
||||
builder.AppendLine(entry.SixteenBitOffset, " Offset");
|
||||
break;
|
||||
|
||||
switch (bundle.BundleType & ~BundleType.ParameterTypingInformationPresent)
|
||||
{
|
||||
case BundleType.UnusedEntry:
|
||||
builder.AppendLine(" Unused, empty entry");
|
||||
break;
|
||||
case BundleType.TwoEightySixCallGateEntry:
|
||||
builder.AppendLine(entry.TwoEightySixObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.TwoEightySixEntryFlags} (0x{entry.TwoEightySixEntryFlags:X})");
|
||||
builder.AppendLine(entry.TwoEightySixOffset, " Offset");
|
||||
builder.AppendLine(entry.TwoEightySixCallgate, " Callgate");
|
||||
break;
|
||||
|
||||
case BundleType.SixteenBitEntry:
|
||||
builder.AppendLine(entry.SixteenBitObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.SixteenBitEntryFlags} (0x{entry.SixteenBitEntryFlags:X})");
|
||||
builder.AppendLine(entry.SixteenBitOffset, " Offset");
|
||||
break;
|
||||
case BundleType.ThirtyTwoBitEntry:
|
||||
builder.AppendLine(entry.ThirtyTwoBitObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.ThirtyTwoBitEntryFlags} (0x{entry.ThirtyTwoBitEntryFlags:X})");
|
||||
builder.AppendLine(entry.ThirtyTwoBitOffset, " Offset");
|
||||
break;
|
||||
|
||||
case BundleType.TwoEightySixCallGateEntry:
|
||||
builder.AppendLine(entry.TwoEightySixObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.TwoEightySixEntryFlags} (0x{entry.TwoEightySixEntryFlags:X})");
|
||||
builder.AppendLine(entry.TwoEightySixOffset, " Offset");
|
||||
builder.AppendLine(entry.TwoEightySixCallgate, " Callgate");
|
||||
break;
|
||||
case BundleType.ForwarderEntry:
|
||||
builder.AppendLine(entry.ForwarderReserved, " Reserved");
|
||||
builder.AppendLine($" Forwarder flags: {entry.ForwarderFlags} (0x{entry.ForwarderFlags:X})");
|
||||
builder.AppendLine(entry.ForwarderModuleOrdinalNumber, " Module ordinal number");
|
||||
builder.AppendLine(entry.ProcedureNameOffset, " Procedure name offset");
|
||||
builder.AppendLine(entry.ImportOrdinalNumber, " Import ordinal number");
|
||||
break;
|
||||
|
||||
case BundleType.ThirtyTwoBitEntry:
|
||||
builder.AppendLine(entry.ThirtyTwoBitObjectNumber, " Object number");
|
||||
builder.AppendLine($" Entry flags: {entry.ThirtyTwoBitEntryFlags} (0x{entry.ThirtyTwoBitEntryFlags:X})");
|
||||
builder.AppendLine(entry.ThirtyTwoBitOffset, " Offset");
|
||||
break;
|
||||
|
||||
case BundleType.ForwarderEntry:
|
||||
builder.AppendLine(entry.ForwarderReserved, " Reserved");
|
||||
builder.AppendLine($" Forwarder flags: {entry.ForwarderFlags} (0x{entry.ForwarderFlags:X})");
|
||||
builder.AppendLine(entry.ForwarderModuleOrdinalNumber, " Module ordinal number");
|
||||
builder.AppendLine(entry.ProcedureNameOffset, " Procedure name offset");
|
||||
builder.AppendLine(entry.ImportOrdinalNumber, " Import ordinal number");
|
||||
break;
|
||||
|
||||
default:
|
||||
builder.AppendLine($" Unknown entry type {bundle.BundleType}");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
builder.AppendLine($" Unknown entry type {type}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ModuleFormatDirectivesTableEntry[]? entries)
|
||||
@@ -355,17 +334,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Moduile Format Directives Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Moduile Format Directives Table Entry {i}");
|
||||
builder.AppendLine($" Directive number: {entry.DirectiveNumber} (0x{entry.DirectiveNumber:X})");
|
||||
builder.AppendLine(entry.DirectiveDataLength, " Directive data length");
|
||||
builder.AppendLine(entry.DirectiveDataOffset, " Directive data offset");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -383,13 +358,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Verify Record Directive Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Verify Record Directive Table Entry {i}");
|
||||
builder.AppendLine(entry.EntryCount, " Entry count");
|
||||
builder.AppendLine(entry.OrdinalIndex, " Ordinal index");
|
||||
builder.AppendLine(entry.Version, " Version");
|
||||
@@ -398,6 +368,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.ObjectLoadBaseAddress, " Object load base address");
|
||||
builder.AppendLine(entry.ObjectVirtualAddressSize, " Object virtual address size");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -415,15 +386,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Fix-up Page Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Fix-up Page Table Entry {i}");
|
||||
builder.AppendLine(entry.Offset, " Offset");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -441,13 +408,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Fix-up Record Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
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})");
|
||||
|
||||
@@ -669,16 +631,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Import Module Name Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Import Module Name Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -696,16 +654,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Import Module Procedure Name Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Import Module Procedure Name Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -723,15 +677,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Per-Page Checksum Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Per-Page Checksum Table Entry {i}");
|
||||
builder.AppendLine(entry.Checksum, " Checksum");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -749,17 +699,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Non-Resident Names Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Non-Resident Names Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.OrdinalNumber, " Ordinal number");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,16 +62,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Relocation Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Relocation Table Entry {i}");
|
||||
builder.AppendLine(entry.Offset, " Offset");
|
||||
builder.AppendLine(entry.Segment, " Segment");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,13 +95,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Folder {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Folder {i}");
|
||||
builder.AppendLine(entry.CabStartOffset, " Cab start offset");
|
||||
builder.AppendLine(entry.DataCount, " Data count");
|
||||
builder.AppendLine($" Compression type: {entry.CompressionType} (0x{entry.CompressionType:X})");
|
||||
@@ -120,13 +115,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int j = 0; j < entry.DataBlocks.Length; j++)
|
||||
{
|
||||
var dataBlock = entry.DataBlocks[j];
|
||||
builder.AppendLine($" Data Block {j}");
|
||||
if (dataBlock == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Data Block {j}");
|
||||
builder.AppendLine(dataBlock.Checksum, " Checksum");
|
||||
builder.AppendLine(dataBlock.CompressedSize, " Compressed size");
|
||||
builder.AppendLine(dataBlock.UncompressedSize, " Uncompressed size");
|
||||
@@ -134,6 +124,7 @@ namespace SabreTools.Serialization.Printers
|
||||
//builder.AppendLine(dataBlock.CompressedData, " Compressed data");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -151,13 +142,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" File {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" File {i}");
|
||||
builder.AppendLine(entry.FileSize, " File size");
|
||||
builder.AppendLine(entry.FolderStartOffset, " Folder start offset");
|
||||
builder.AppendLine($" Folder index: {entry.FolderIndex} (0x{entry.FolderIndex:X})");
|
||||
@@ -166,6 +152,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine($" Attributes: {entry.Attributes} (0x{entry.Attributes:X})");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,19 +176,15 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Hash Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Hash Table Entry {i}");
|
||||
builder.AppendLine(entry.NameHashPartA, " Name hash, part A");
|
||||
builder.AppendLine(entry.NameHashPartB, " Name hash, part B");
|
||||
builder.AppendLine($" Locale: {entry.Locale} (0x{entry.Locale:X})");
|
||||
builder.AppendLine(entry.Platform, " Platform");
|
||||
builder.AppendLine(entry.BlockIndex, " BlockIndex");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -206,18 +202,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Block Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Block Table Entry {i}");
|
||||
builder.AppendLine(entry.FilePosition, " File position");
|
||||
builder.AppendLine(entry.CompressedSize, " Compressed size");
|
||||
builder.AppendLine(entry.UncompressedSize, " Uncompressed size");
|
||||
builder.AppendLine($" Flags: {entry.Flags} (0x{entry.Flags:X})");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -237,6 +229,7 @@ namespace SabreTools.Serialization.Printers
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Hi-block Table Entry {i}: {entry}");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,17 +56,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < header.PartitionsTable.Length; i++)
|
||||
{
|
||||
var partitionTableEntry = header.PartitionsTable[i];
|
||||
builder.AppendLine($" Partition table entry {i}");
|
||||
if (partitionTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Partition table entry {i}");
|
||||
builder.AppendLine(partitionTableEntry.Offset, " Offset");
|
||||
builder.AppendLine(partitionTableEntry.Length, " Length");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
|
||||
// If we have a cart image
|
||||
@@ -91,6 +87,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(header.PartitionIdTable[i], $" Partition {i} ID");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
|
||||
builder.AppendLine(header.Reserved1, " Reserved 1");
|
||||
@@ -278,69 +275,67 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" NCCH Partition Header {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" NCCH Partition Header {i}");
|
||||
if (entry.MagicID == string.Empty)
|
||||
{
|
||||
builder.AppendLine(" Empty partition, no data can be parsed");
|
||||
continue;
|
||||
}
|
||||
else if (entry.MagicID != Constants.NCCHMagicNumber)
|
||||
|
||||
if (entry.MagicID != Constants.NCCHMagicNumber)
|
||||
{
|
||||
builder.AppendLine(" Unrecognized partition data, no data can be parsed");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.RSA2048Signature, " RSA-2048 SHA-256 signature");
|
||||
builder.AppendLine(entry.MagicID, " Magic ID");
|
||||
builder.AppendLine(entry.ContentSizeInMediaUnits, " Content size in media units");
|
||||
builder.AppendLine(entry.PartitionId, " Partition ID");
|
||||
builder.AppendLine(entry.MakerCode, " Maker code");
|
||||
builder.AppendLine(entry.Version, " Version");
|
||||
builder.AppendLine(entry.VerificationHash, " Verification hash");
|
||||
builder.AppendLine(entry.ProgramId, " Program ID");
|
||||
builder.AppendLine(entry.Reserved1, " Reserved 1");
|
||||
builder.AppendLine(entry.LogoRegionHash, " Logo region SHA-256 hash");
|
||||
builder.AppendLine(entry.ProductCode, " Product code");
|
||||
builder.AppendLine(entry.ExtendedHeaderHash, " Extended header SHA-256 hash");
|
||||
builder.AppendLine(entry.ExtendedHeaderSizeInBytes, " Extended header size in bytes");
|
||||
builder.AppendLine(entry.Reserved2, " Reserved 2");
|
||||
builder.AppendLine(" Flags:");
|
||||
if (entry.Flags == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine(entry.RSA2048Signature, " RSA-2048 SHA-256 signature");
|
||||
builder.AppendLine(entry.MagicID, " Magic ID");
|
||||
builder.AppendLine(entry.ContentSizeInMediaUnits, " Content size in media units");
|
||||
builder.AppendLine(entry.PartitionId, " Partition ID");
|
||||
builder.AppendLine(entry.MakerCode, " Maker code");
|
||||
builder.AppendLine(entry.Version, " Version");
|
||||
builder.AppendLine(entry.VerificationHash, " Verification hash");
|
||||
builder.AppendLine(entry.ProgramId, " Program ID");
|
||||
builder.AppendLine(entry.Reserved1, " Reserved 1");
|
||||
builder.AppendLine(entry.LogoRegionHash, " Logo region SHA-256 hash");
|
||||
builder.AppendLine(entry.ProductCode, " Product code");
|
||||
builder.AppendLine(entry.ExtendedHeaderHash, " Extended header SHA-256 hash");
|
||||
builder.AppendLine(entry.ExtendedHeaderSizeInBytes, " Extended header size in bytes");
|
||||
builder.AppendLine(entry.Reserved2, " Reserved 2");
|
||||
builder.AppendLine(" Flags:");
|
||||
if (entry.Flags == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine(entry.Flags.Reserved0, " Reserved 0");
|
||||
builder.AppendLine(entry.Flags.Reserved1, " Reserved 1");
|
||||
builder.AppendLine(entry.Flags.Reserved2, " Reserved 2");
|
||||
builder.AppendLine($" Crypto method: {entry.Flags.CryptoMethod} (0x{entry.Flags.CryptoMethod:X})");
|
||||
builder.AppendLine($" Content platform: {entry.Flags.ContentPlatform} (0x{entry.Flags.ContentPlatform:X})");
|
||||
builder.AppendLine($" Content type: {entry.Flags.MediaPlatformIndex} (0x{entry.Flags.MediaPlatformIndex:X})");
|
||||
builder.AppendLine(entry.Flags.ContentUnitSize, " Content unit size");
|
||||
builder.AppendLine($" Bitmasks: {entry.Flags.BitMasks} (0x{entry.Flags.BitMasks:X})");
|
||||
}
|
||||
builder.AppendLine(entry.PlainRegionOffsetInMediaUnits, " Plain region offset, in media units");
|
||||
builder.AppendLine(entry.PlainRegionSizeInMediaUnits, " Plain region size, in media units");
|
||||
builder.AppendLine(entry.LogoRegionOffsetInMediaUnits, " Logo region offset, in media units");
|
||||
builder.AppendLine(entry.LogoRegionSizeInMediaUnits, " Logo region size, in media units");
|
||||
builder.AppendLine(entry.ExeFSOffsetInMediaUnits, " ExeFS offset, in media units");
|
||||
builder.AppendLine(entry.ExeFSSizeInMediaUnits, " ExeFS size, in media units");
|
||||
builder.AppendLine(entry.ExeFSHashRegionSizeInMediaUnits, " ExeFS hash region size, in media units");
|
||||
builder.AppendLine(entry.Reserved3, " Reserved 3");
|
||||
builder.AppendLine(entry.RomFSOffsetInMediaUnits, " RomFS offset, in media units");
|
||||
builder.AppendLine(entry.RomFSSizeInMediaUnits, " RomFS size, in media units");
|
||||
builder.AppendLine(entry.RomFSHashRegionSizeInMediaUnits, " RomFS hash region size, in media units");
|
||||
builder.AppendLine(entry.Reserved4, " Reserved 4");
|
||||
builder.AppendLine(entry.ExeFSSuperblockHash, " ExeFS superblock SHA-256 hash");
|
||||
builder.AppendLine(entry.RomFSSuperblockHash, " RomFS superblock SHA-256 hash");
|
||||
builder.AppendLine(entry.Flags.Reserved0, " Reserved 0");
|
||||
builder.AppendLine(entry.Flags.Reserved1, " Reserved 1");
|
||||
builder.AppendLine(entry.Flags.Reserved2, " Reserved 2");
|
||||
builder.AppendLine($" Crypto method: {entry.Flags.CryptoMethod} (0x{entry.Flags.CryptoMethod:X})");
|
||||
builder.AppendLine($" Content platform: {entry.Flags.ContentPlatform} (0x{entry.Flags.ContentPlatform:X})");
|
||||
builder.AppendLine($" Content type: {entry.Flags.MediaPlatformIndex} (0x{entry.Flags.MediaPlatformIndex:X})");
|
||||
builder.AppendLine(entry.Flags.ContentUnitSize, " Content unit size");
|
||||
builder.AppendLine($" Bitmasks: {entry.Flags.BitMasks} (0x{entry.Flags.BitMasks:X})");
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.PlainRegionOffsetInMediaUnits, " Plain region offset, in media units");
|
||||
builder.AppendLine(entry.PlainRegionSizeInMediaUnits, " Plain region size, in media units");
|
||||
builder.AppendLine(entry.LogoRegionOffsetInMediaUnits, " Logo region offset, in media units");
|
||||
builder.AppendLine(entry.LogoRegionSizeInMediaUnits, " Logo region size, in media units");
|
||||
builder.AppendLine(entry.ExeFSOffsetInMediaUnits, " ExeFS offset, in media units");
|
||||
builder.AppendLine(entry.ExeFSSizeInMediaUnits, " ExeFS size, in media units");
|
||||
builder.AppendLine(entry.ExeFSHashRegionSizeInMediaUnits, " ExeFS hash region size, in media units");
|
||||
builder.AppendLine(entry.Reserved3, " Reserved 3");
|
||||
builder.AppendLine(entry.RomFSOffsetInMediaUnits, " RomFS offset, in media units");
|
||||
builder.AppendLine(entry.RomFSSizeInMediaUnits, " RomFS size, in media units");
|
||||
builder.AppendLine(entry.RomFSHashRegionSizeInMediaUnits, " RomFS hash region size, in media units");
|
||||
builder.AppendLine(entry.Reserved4, " Reserved 4");
|
||||
builder.AppendLine(entry.ExeFSSuperblockHash, " ExeFS superblock SHA-256 hash");
|
||||
builder.AppendLine(entry.RomFSSuperblockHash, " RomFS superblock SHA-256 hash");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -358,13 +353,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" NCCH Extended Header {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" Unrecognized partition data, no data can be parsed");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" NCCH Extended Header {i}");
|
||||
builder.AppendLine(" System control info:");
|
||||
if (entry.SCI == null)
|
||||
{
|
||||
@@ -594,13 +584,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" ExeFS Header {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" Unrecognized partition data, no data can be parsed");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" ExeFS Header {i}");
|
||||
builder.AppendLine(" File headers:");
|
||||
if (entry.FileHeaders == null || entry.FileHeaders.Length == 0)
|
||||
{
|
||||
|
||||
@@ -105,13 +105,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(entry.NameOffset, " Name offset");
|
||||
builder.AppendLine(entryNames![entry.NameOffset], " Name");
|
||||
builder.AppendLine(entry.ItemSize, " Item size");
|
||||
@@ -121,6 +116,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.NextIndex, " Next index");
|
||||
builder.AppendLine(entry.FirstIndex, " First index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -138,15 +134,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -164,15 +156,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -190,15 +178,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -216,15 +200,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -258,15 +238,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Unknown Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Unknown Entry {i}");
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -318,16 +294,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
builder.AppendLine(entry.ChecksumCount, " Checksum count");
|
||||
builder.AppendLine(entry.FirstChecksumIndex, " First checksum index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -345,15 +317,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
builder.AppendLine(entry.Checksum, " Checksum");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,18 +129,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Segment Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Segment Table Entry {i}");
|
||||
builder.AppendLine(entry.Offset, " Offset");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine($" Flag word: {entry.FlagWord} (0x{entry.FlagWord:X})");
|
||||
builder.AppendLine(entry.MinimumAllocationSize, " Minimum allocation size");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -166,13 +162,8 @@ namespace SabreTools.Serialization.Printers
|
||||
{
|
||||
// TODO: If not integer type, print out name
|
||||
var entry = table.ResourceTypes[i];
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Resource Table Entry {i}");
|
||||
builder.AppendLine(entry.TypeID, " Type ID");
|
||||
builder.AppendLine(entry.ResourceCount, " Resource count");
|
||||
builder.AppendLine(entry.Reserved, " Reserved");
|
||||
@@ -240,17 +231,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Resident-Name Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Resident-Name Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.NameString, " Name string", Encoding.ASCII);
|
||||
builder.AppendLine(entry.OrdinalNumber, " Ordinal number");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -269,15 +256,11 @@ namespace SabreTools.Serialization.Printers
|
||||
{
|
||||
// TODO: Read the imported names table and print value here
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Module-Reference Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Module-Reference Table Entry {i}");
|
||||
builder.AppendLine($" Offset: {entry.Offset} (adjusted to be {entry.Offset + (stub?.NewExeHeaderAddr ?? 0) + (header?.ImportedNamesTableOffset ?? 0)})");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -321,13 +304,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Entry Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Entry Table Entry {i}");
|
||||
builder.AppendLine(entry.EntryCount, " Entry count");
|
||||
builder.AppendLine(entry.SegmentIndicator, " Segment indicator");
|
||||
switch (entry.GetEntryType())
|
||||
@@ -344,6 +322,7 @@ namespace SabreTools.Serialization.Printers
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -361,17 +340,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Nonresident-Name Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Nonresident-Name Table Entry {i}");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.NameString, " Name string", Encoding.ASCII);
|
||||
builder.AppendLine(entry.OrdinalNumber, " Ordinal number");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,13 +177,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Folder Allocation Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Folder Allocation Table Entry {i}");
|
||||
builder.AppendLine(entry.StartOffset, " Start offset");
|
||||
builder.AppendLine(entry.FirstFileIndex, " First file index");
|
||||
if (entry.Unknown == 0xF0)
|
||||
@@ -197,6 +192,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(totalEntries, " Total entries");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -214,18 +210,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Name List Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Name List Entry {i}");
|
||||
builder.AppendLine(entry.Folder, " Folder");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
if (entry.Folder)
|
||||
builder.AppendLine(entry.Index, " Index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -243,16 +235,12 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" File Allocation Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" File Allocation Table Entry {i}");
|
||||
builder.AppendLine(entry.StartOffset, " Start offset");
|
||||
builder.AppendLine(entry.EndOffset, " End offset");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,17 +51,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine(entry.ItemName, " Item name");
|
||||
builder.AppendLine(entry.ItemOffset, " Item offset");
|
||||
builder.AppendLine(entry.ItemLength, " Item length");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Disc Information Unit {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Disc Information Unit {i}");
|
||||
if (entry.Header == null)
|
||||
{
|
||||
builder.AppendLine(" No header");
|
||||
@@ -81,6 +76,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(trailer.ProductRevisionNumber, " Product revision number");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,18 +165,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
builder.AppendLine(entry.FileNameLength, " File name length");
|
||||
builder.AppendLine(entry.FileName, " File name");
|
||||
builder.AppendLine(entry.DataLength, " Data length");
|
||||
builder.AppendLine(entry.Data, " Data");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Audio File {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Audio File {i}:");
|
||||
Print(builder, entry.Header);
|
||||
Print(builder, entry.UnknownBlock1);
|
||||
|
||||
@@ -70,6 +65,7 @@ namespace SabreTools.Serialization.Printers
|
||||
Print(builder, entry.DataFilesCount, entry.DataFiles);
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -208,18 +204,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
builder.AppendLine(entry.FileNameLength, " File name length");
|
||||
builder.AppendLine(entry.FileName, " File name");
|
||||
builder.AppendLine(entry.DataLength, " Data length");
|
||||
builder.AppendLine(entry.Data, " Data");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,20 +274,20 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SectionHeader[]? table)
|
||||
private static void Print(StringBuilder builder, SectionHeader[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Section Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (table == null || table.Length == 0)
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No section table items");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < table!.Length; i++)
|
||||
for (int i = 0; i < entries!.Length; i++)
|
||||
{
|
||||
var entry = table[i];
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Section Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
@@ -298,7 +298,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.Name, " Name", Encoding.ASCII);
|
||||
builder.AppendLine(entry.VirtualSize, " Virtual size");
|
||||
builder.AppendLine(entry.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(entry.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(entry.VirtualAddress.ConvertVirtualAddress(entries), " Physical address");
|
||||
builder.AppendLine(entry.SizeOfRawData, " Size of raw data");
|
||||
builder.AppendLine(entry.PointerToRawData, " Pointer to raw data");
|
||||
builder.AppendLine(entry.PointerToRelocations, " Pointer to relocations");
|
||||
@@ -312,11 +312,11 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry[]? symbolTable)
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" COFF Symbol Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (symbolTable == null || symbolTable.Length == 0)
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No COFF symbol table items");
|
||||
builder.AppendLine();
|
||||
@@ -326,9 +326,9 @@ namespace SabreTools.Serialization.Printers
|
||||
int auxSymbolsRemaining = 0;
|
||||
int currentSymbolType = 0;
|
||||
|
||||
for (int i = 0; i < symbolTable.Length; i++)
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = symbolTable[i];
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" COFF Symbol Table Entry {i} (Subtype {currentSymbolType})");
|
||||
if (entry == null)
|
||||
{
|
||||
@@ -466,6 +466,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine($" COFF String Table Entry {i})");
|
||||
builder.AppendLine(entry, " Value");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -574,13 +575,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var baseRelocationTableEntry = entries[i];
|
||||
builder.AppendLine($" Base Relocation Table Entry {i}");
|
||||
if (baseRelocationTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Base Relocation Table Entry {i}");
|
||||
builder.AppendLine(baseRelocationTableEntry.PageRVA, " Page RVA");
|
||||
builder.AppendLine(baseRelocationTableEntry.PageRVA.ConvertVirtualAddress(table), " Page physical address");
|
||||
builder.AppendLine(baseRelocationTableEntry.BlockSize, " Block size");
|
||||
@@ -596,13 +592,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int j = 0; j < baseRelocationTableEntry.TypeOffsetFieldEntries.Length; j++)
|
||||
{
|
||||
var typeOffsetFieldEntry = baseRelocationTableEntry.TypeOffsetFieldEntries[j];
|
||||
builder.AppendLine($" Type and Offset Entry {j}");
|
||||
if (typeOffsetFieldEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Type and Offset Entry {j}");
|
||||
builder.AppendLine($" Type: {typeOffsetFieldEntry.BaseRelocationType} (0x{typeOffsetFieldEntry.BaseRelocationType:X})");
|
||||
builder.AppendLine(typeOffsetFieldEntry.Offset, " Offset");
|
||||
}
|
||||
@@ -689,13 +680,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < table.ExportAddressTable.Length; i++)
|
||||
{
|
||||
var exportAddressTableEntry = table.ExportAddressTable[i];
|
||||
builder.AppendLine($" Export Address Table Entry {i}");
|
||||
if (exportAddressTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Export Address Table Entry {i}");
|
||||
builder.AppendLine(exportAddressTableEntry.ExportRVA, " Export RVA / Forwarder RVA");
|
||||
}
|
||||
}
|
||||
@@ -776,13 +762,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < table.ImportDirectoryTable.Length; i++)
|
||||
{
|
||||
var importDirectoryTableEntry = table.ImportDirectoryTable[i];
|
||||
builder.AppendLine($" Import Directory Table Entry {i}");
|
||||
if (importDirectoryTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Import Directory Table Entry {i}");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportLookupTableRVA, " Import lookup table RVA");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportLookupTableRVA.ConvertVirtualAddress(sectionTable), " Import lookup table Physical Address");
|
||||
builder.AppendLine(importDirectoryTableEntry.TimeDateStamp, " Time/Date stamp");
|
||||
@@ -793,6 +774,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportAddressTableRVA.ConvertVirtualAddress(sectionTable), " Import address table Physical Address");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
|
||||
builder.AppendLine(" Import Lookup Tables Information:");
|
||||
@@ -820,13 +802,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < importLookupTable.Length; i++)
|
||||
{
|
||||
var importLookupTableEntry = importLookupTable[i];
|
||||
builder.AppendLine($" Import Lookup Table {index} Entry {i}");
|
||||
if (importLookupTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Import Lookup Table {index} Entry {i}");
|
||||
builder.AppendLine(importLookupTableEntry.OrdinalNameFlag, " Ordinal/Name flag");
|
||||
if (importLookupTableEntry.OrdinalNameFlag)
|
||||
{
|
||||
@@ -867,13 +844,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < importAddressTable.Length; i++)
|
||||
{
|
||||
var importAddressTableEntry = importAddressTable[i];
|
||||
builder.AppendLine($" Import Address Table {index} Entry {i}");
|
||||
if (importAddressTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Import Address Table {index} Entry {i}");
|
||||
builder.AppendLine(importAddressTableEntry.OrdinalNameFlag, " Ordinal/Name flag");
|
||||
if (importAddressTableEntry.OrdinalNameFlag)
|
||||
{
|
||||
@@ -900,13 +872,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < table.HintNameTable.Length; i++)
|
||||
{
|
||||
var hintNameTableEntry = table.HintNameTable[i];
|
||||
builder.AppendLine($" Hint/Name Table Entry {i}");
|
||||
if (hintNameTableEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Hint/Name Table Entry {i}");
|
||||
builder.AppendLine(hintNameTableEntry.Hint, " Hint");
|
||||
builder.AppendLine(hintNameTableEntry.Name, " Name");
|
||||
}
|
||||
|
||||
@@ -71,18 +71,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Archive Hash {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Archive Hash {i}");
|
||||
builder.AppendLine(entry.ArchiveIndex, " Archive index");
|
||||
builder.AppendLine(entry.ArchiveOffset, " Archive offset");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
builder.AppendLine(entry.Hash, " Hash");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -100,14 +96,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
builder.AppendLine();
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine(entry.Extension, " Extension");
|
||||
builder.AppendLine(entry.Path, " Path");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
@@ -116,6 +106,7 @@ namespace SabreTools.Serialization.Printers
|
||||
Print(builder, entry.DirectoryEntry);
|
||||
// TODO: Print out preload data?
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,13 +52,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(entry.Offset, " Offset");
|
||||
builder.AppendLine(entry.DiskLength, " Disk length");
|
||||
builder.AppendLine(entry.Length, " Length");
|
||||
@@ -67,6 +62,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(entry.Padding, " Padding");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -84,13 +80,8 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
|
||||
builder.AppendLine($" File Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry is MipTex mipTex)
|
||||
{
|
||||
builder.AppendLine(mipTex.Name, " Name");
|
||||
@@ -125,6 +116,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine(" Unrecognized entry type");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,17 +61,13 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
builder.AppendLine(entry.FileNameCRC, " File name CRC");
|
||||
builder.AppendLine(entry.EntryLength, " Entry length");
|
||||
builder.AppendLine(entry.EntryOffset, " Entry offset");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -89,15 +85,11 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Mapping {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Mapping {i}");
|
||||
builder.AppendLine(entry.PreloadDirectoryEntryIndex, " Preload directory entry index");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
@@ -115,18 +107,14 @@ namespace SabreTools.Serialization.Printers
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory Item {i}");
|
||||
builder.AppendLine(entry.FileNameCRC, " File name CRC");
|
||||
builder.AppendLine(entry.NameOffset, " Name offset");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.TimeCreated, " Time created");
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ namespace SabreTools.Serialization.Wrappers
|
||||
// Get the directory entry
|
||||
var directoryEntry = Model.DirectoryEntries[i];
|
||||
var directoryMapEntry = Model.DirectoryMapEntries[i];
|
||||
if (directoryEntry == null || directoryMapEntry == null)
|
||||
continue;
|
||||
|
||||
// If we have a directory, skip for now
|
||||
#if NET20 || NET35
|
||||
@@ -59,16 +57,13 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#endif
|
||||
};
|
||||
var pathParts = new List<string> { Model.DirectoryNames![directoryEntry.NameOffset] ?? string.Empty };
|
||||
var blockEntries = new List<Models.GCF.BlockEntry?>();
|
||||
var blockEntries = new List<Models.GCF.BlockEntry>();
|
||||
|
||||
// Traverse the parent tree
|
||||
uint index = directoryEntry.ParentIndex;
|
||||
while (index != 0xFFFFFFFF)
|
||||
{
|
||||
var parentDirectoryEntry = Model.DirectoryEntries[index];
|
||||
if (parentDirectoryEntry == null)
|
||||
break;
|
||||
|
||||
pathParts.Add(Model.DirectoryNames![parentDirectoryEntry.NameOffset] ?? string.Empty);
|
||||
index = parentDirectoryEntry.ParentIndex;
|
||||
}
|
||||
@@ -284,8 +279,6 @@ namespace SabreTools.Serialization.Wrappers
|
||||
for (int i = 0; i < file.BlockEntries.Length; i++)
|
||||
{
|
||||
var blockEntry = file.BlockEntries[i];
|
||||
if (blockEntry == null)
|
||||
continue;
|
||||
|
||||
uint dataBlockIndex = blockEntry.FirstDataBlockIndex;
|
||||
long blockEntrySize = blockEntry.FileDataSize;
|
||||
|
||||
@@ -420,12 +420,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (index < 0 || index >= Partitions.Length)
|
||||
return 0;
|
||||
|
||||
// Invalid partition table entry means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
if (entry == null)
|
||||
return 0;
|
||||
|
||||
// Invalid partition means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
var header = Partitions[index];
|
||||
if (header == null || header.MagicID != NCCHMagicNumber)
|
||||
return 0;
|
||||
@@ -452,12 +448,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (index < 0 || index >= Partitions.Length)
|
||||
return 0;
|
||||
|
||||
// Invalid partition table entry means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
if (entry == null)
|
||||
return 0;
|
||||
|
||||
// Invalid partition means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
var header = Partitions[index];
|
||||
if (header == null || header.MagicID != NCCHMagicNumber)
|
||||
return 0;
|
||||
@@ -484,12 +476,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (index < 0 || index >= PartitionsTable.Length)
|
||||
return 0;
|
||||
|
||||
// Invalid partition table entry means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
if (entry == null)
|
||||
return 0;
|
||||
|
||||
// Return the adjusted offset
|
||||
var entry = PartitionsTable[index];
|
||||
uint partitionOffsetMU = entry.Offset;
|
||||
if (entry.Offset == 0)
|
||||
return 0;
|
||||
@@ -510,12 +498,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (index < 0 || index >= Partitions.Length)
|
||||
return 0;
|
||||
|
||||
// Invalid partition table entry means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
if (entry == null)
|
||||
return 0;
|
||||
|
||||
// Invalid partition means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
var header = Partitions[index];
|
||||
if (header == null || header.MagicID != NCCHMagicNumber)
|
||||
return 0;
|
||||
@@ -542,12 +526,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (index < 0 || index >= Partitions.Length)
|
||||
return 0;
|
||||
|
||||
// Invalid partition table entry means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
if (entry == null)
|
||||
return 0;
|
||||
|
||||
// Invalid partition means no size is available
|
||||
var entry = PartitionsTable[index];
|
||||
var header = Partitions[index];
|
||||
if (header == null || header.MagicID != NCCHMagicNumber)
|
||||
return 0;
|
||||
|
||||
@@ -1007,9 +1007,6 @@ namespace SabreTools.Serialization.Wrappers
|
||||
for (int i = 0; i < Model.DebugTable.DebugDirectoryTable.Length; i++)
|
||||
{
|
||||
var entry = Model.DebugTable.DebugDirectoryTable[i];
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
uint address = entry.PointerToRawData;
|
||||
uint size = entry.SizeOfData;
|
||||
|
||||
@@ -1277,9 +1274,6 @@ namespace SabreTools.Serialization.Wrappers
|
||||
for (int i = 0; i < table.Entries.Length; i++)
|
||||
{
|
||||
var entry = table.Entries[i];
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
var newTypes = new List<object>(types ?? []);
|
||||
|
||||
if (entry.Name?.UnicodeString != null)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
ushort archiveCount = 0;
|
||||
foreach (var di in Model.DirectoryItems ?? [])
|
||||
{
|
||||
if (di?.DirectoryEntry == null)
|
||||
if (di.DirectoryEntry == null)
|
||||
continue;
|
||||
if (di.DirectoryEntry.ArchiveIndex == HL_VPK_NO_ARCHIVE)
|
||||
continue;
|
||||
@@ -187,7 +187,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
// Get the directory item
|
||||
var directoryItem = Model.DirectoryItems[index];
|
||||
if (directoryItem?.DirectoryEntry == null)
|
||||
if (directoryItem.DirectoryEntry == null)
|
||||
return false;
|
||||
|
||||
// If we have an item with no archive
|
||||
|
||||
@@ -121,8 +121,6 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
// Get the directory entry
|
||||
var directoryEntry = Model.DirectoryEntries[index];
|
||||
if (directoryEntry == null)
|
||||
return false;
|
||||
|
||||
// Get the associated directory item
|
||||
var directoryItem = Array.Find(Model.DirectoryItems, di => di?.FileNameCRC == directoryEntry.FileNameCRC);
|
||||
|
||||
Reference in New Issue
Block a user