diff --git a/Aaru.Filesystems/AppleCommon/Info.cs b/Aaru.Filesystems/AppleCommon/Info.cs index a2c0d1154..13433fbab 100644 --- a/Aaru.Filesystems/AppleCommon/Info.cs +++ b/Aaru.Filesystems/AppleCommon/Info.cs @@ -39,7 +39,7 @@ static partial class AppleCommon { if(bbSector is null || bbSector.Length < 0x100) return null; - BootBlock bb = Marshal.ByteArrayToStructureBigEndian(bbSector); + BootBlock bb = Marshal.ByteArrayToStructureBigEndianGenerated(bbSector); if(bb.bbID != BB_MAGIC) return null; diff --git a/Aaru.Filesystems/AppleCommon/Structs.cs b/Aaru.Filesystems/AppleCommon/Structs.cs index f9ac07373..e2a92076f 100644 --- a/Aaru.Filesystems/AppleCommon/Structs.cs +++ b/Aaru.Filesystems/AppleCommon/Structs.cs @@ -29,6 +29,7 @@ // ReSharper disable InconsistentNaming using System.Runtime.InteropServices; +using Aaru.CommonTypes.Attributes; namespace Aaru.Filesystems; @@ -40,53 +41,54 @@ static partial class AppleCommon /// Should be sectors 0 and 1 in volume, followed by boot code [StructLayout(LayoutKind.Sequential, Pack = 1)] - readonly struct BootBlock // Should be sectors 0 and 1 in volume + [SwapEndian] + partial struct BootBlock // Should be sectors 0 and 1 in volume { /// 0x000, Signature, 0x4C4B if bootable - public readonly ushort bbID; + public ushort bbID; /// 0x002, Branch - public readonly uint bbEntry; + public uint bbEntry; /// 0x007, Boot block version and flags - public readonly ushort bbVersion; + public ushort bbVersion; /// 0x006, Boot block page flags - public readonly short bbPageFlags; + public short bbPageFlags; /// 0x00A, System file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbSysName; + public byte[] bbSysName; /// 0x01A, Finder file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbShellName; + public byte[] bbShellName; /// 0x02A, Debugger file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbDbg1Name; + public byte[] bbDbg1Name; /// 0x03A, Disassembler file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbDbg2Name; + public byte[] bbDbg2Name; /// 0x04A, Startup screen file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbScreenName; + public byte[] bbScreenName; /// 0x05A, First program to execute on boot (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbHelloName; + public byte[] bbHelloName; /// 0x06A, Clipboard file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public readonly byte[] bbScrapName; + public byte[] bbScrapName; /// 0x07A, 1/4 of maximum opened at a time files - public readonly ushort bbCntFCBs; + public ushort bbCntFCBs; /// 0x07C, Event queue size - public readonly ushort bbCntEvts; + public ushort bbCntEvts; /// 0x07E, Heap size on a Mac with 128KiB of RAM - public readonly uint bb128KSHeap; + public uint bb128KSHeap; /// 0x082, Heap size on a Mac with 256KiB of RAM - public readonly uint bb256KSHeap; + public uint bb256KSHeap; /// 0x086, Heap size on a Mac with 512KiB of RAM or more - public readonly uint bbSysHeapSize; + public uint bbSysHeapSize; /// 0x08A, Padding - public readonly ushort filler; + public ushort filler; /// 0x08C, Additional system heap space - public readonly uint bbSysHeapExtra; + public uint bbSysHeapExtra; /// 0x090, Fraction of RAM for system heap - public readonly uint bbSysHeapFract; + public uint bbSysHeapFract; } #endregion