mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AppleCommon] Use new source generator based big endian marshaller
This commit is contained in:
@@ -39,7 +39,7 @@ static partial class AppleCommon
|
|||||||
{
|
{
|
||||||
if(bbSector is null || bbSector.Length < 0x100) return null;
|
if(bbSector is null || bbSector.Length < 0x100) return null;
|
||||||
|
|
||||||
BootBlock bb = Marshal.ByteArrayToStructureBigEndian<BootBlock>(bbSector);
|
BootBlock bb = Marshal.ByteArrayToStructureBigEndianGenerated<BootBlock>(bbSector);
|
||||||
|
|
||||||
if(bb.bbID != BB_MAGIC) return null;
|
if(bb.bbID != BB_MAGIC) return null;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Aaru.CommonTypes.Attributes;
|
||||||
|
|
||||||
namespace Aaru.Filesystems;
|
namespace Aaru.Filesystems;
|
||||||
|
|
||||||
@@ -40,53 +41,54 @@ static partial class AppleCommon
|
|||||||
|
|
||||||
/// <summary>Should be sectors 0 and 1 in volume, followed by boot code</summary>
|
/// <summary>Should be sectors 0 and 1 in volume, followed by boot code</summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[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
|
||||||
{
|
{
|
||||||
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
|
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
|
||||||
public readonly ushort bbID;
|
public ushort bbID;
|
||||||
/// <summary>0x002, Branch</summary>
|
/// <summary>0x002, Branch</summary>
|
||||||
public readonly uint bbEntry;
|
public uint bbEntry;
|
||||||
/// <summary>0x007, Boot block version and flags</summary>
|
/// <summary>0x007, Boot block version and flags</summary>
|
||||||
public readonly ushort bbVersion;
|
public ushort bbVersion;
|
||||||
/// <summary>0x006, Boot block page flags</summary>
|
/// <summary>0x006, Boot block page flags</summary>
|
||||||
public readonly short bbPageFlags;
|
public short bbPageFlags;
|
||||||
/// <summary>0x00A, System file name (16 bytes)</summary>
|
/// <summary>0x00A, System file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbSysName;
|
public byte[] bbSysName;
|
||||||
/// <summary>0x01A, Finder file name (16 bytes)</summary>
|
/// <summary>0x01A, Finder file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbShellName;
|
public byte[] bbShellName;
|
||||||
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
|
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbDbg1Name;
|
public byte[] bbDbg1Name;
|
||||||
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
|
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbDbg2Name;
|
public byte[] bbDbg2Name;
|
||||||
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
|
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbScreenName;
|
public byte[] bbScreenName;
|
||||||
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
|
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbHelloName;
|
public byte[] bbHelloName;
|
||||||
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
|
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly byte[] bbScrapName;
|
public byte[] bbScrapName;
|
||||||
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
|
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
|
||||||
public readonly ushort bbCntFCBs;
|
public ushort bbCntFCBs;
|
||||||
/// <summary>0x07C, Event queue size</summary>
|
/// <summary>0x07C, Event queue size</summary>
|
||||||
public readonly ushort bbCntEvts;
|
public ushort bbCntEvts;
|
||||||
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
|
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
|
||||||
public readonly uint bb128KSHeap;
|
public uint bb128KSHeap;
|
||||||
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
|
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
|
||||||
public readonly uint bb256KSHeap;
|
public uint bb256KSHeap;
|
||||||
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
|
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
|
||||||
public readonly uint bbSysHeapSize;
|
public uint bbSysHeapSize;
|
||||||
/// <summary>0x08A, Padding</summary>
|
/// <summary>0x08A, Padding</summary>
|
||||||
public readonly ushort filler;
|
public ushort filler;
|
||||||
/// <summary>0x08C, Additional system heap space</summary>
|
/// <summary>0x08C, Additional system heap space</summary>
|
||||||
public readonly uint bbSysHeapExtra;
|
public uint bbSysHeapExtra;
|
||||||
/// <summary>0x090, Fraction of RAM for system heap</summary>
|
/// <summary>0x090, Fraction of RAM for system heap</summary>
|
||||||
public readonly uint bbSysHeapFract;
|
public uint bbSysHeapFract;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user