Move common Apple boot block information and structs to its own class.

This commit is contained in:
2020-02-19 00:12:15 +00:00
parent 80a38c860d
commit 7ac5e40965
12 changed files with 309 additions and 228 deletions

View File

@@ -38,57 +38,6 @@ namespace DiscImageChef.Filesystems
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
public partial class AppleHFS
{
/// <summary>Should be sectors 0 and 1 in volume, followed by boot code</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HfsBootBlock // Should be sectors 0 and 1 in volume
{
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
public readonly ushort bbID;
/// <summary>0x002, Branch</summary>
public readonly uint bbEntry;
/// <summary>0x007, Boot block version</summary>
public readonly ushort bbVersion;
/// <summary>0x006, Boot block flags</summary>
public readonly short bbPageFlags;
/// <summary>0x00A, System file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbSysName;
/// <summary>0x01A, Finder file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbShellName;
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbDbg1Name;
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbDbg2Name;
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbScreenName;
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbHelloName;
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] bbScrapName;
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
public readonly ushort bbCntFCBs;
/// <summary>0x07C, Event queue size</summary>
public readonly ushort bbCntEvts;
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
public readonly uint bb128KSHeap;
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
public readonly uint bb256KSHeap;
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
public readonly uint bbSysHeapSize;
/// <summary>Padding</summary>
public readonly ushort filler;
/// <summary>Additional system heap space</summary>
public readonly uint bbSysHeapExtra;
/// <summary>Fraction of RAM for system heap</summary>
public readonly uint bbSysHeapFract;
}
/// <summary>Master Directory Block, should be sector 2 in volume</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HfsMasterDirectoryBlock // Should be sector 2 in volume