mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[FAT] Use new source generator based big endian marshaller
This commit is contained in:
@@ -49,7 +49,7 @@ public sealed partial class FAT
|
||||
andosOemCorrect = false;
|
||||
bootable = false;
|
||||
|
||||
humanBpb = Marshal.ByteArrayToStructureBigEndian<HumanParameterBlock>(bpbSector);
|
||||
humanBpb = Marshal.ByteArrayToStructureBigEndianGenerated<HumanParameterBlock>(bpbSector);
|
||||
atariBpb = Marshal.ByteArrayToStructureLittleEndian<AtariParameterBlock>(bpbSector);
|
||||
|
||||
ulong expectedClusters = humanBpb.bpc > 0 ? partition.Size / humanBpb.bpc : 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ public sealed partial class FAT
|
||||
|
||||
if(errno != ErrorNumber.NoError) return false;
|
||||
|
||||
HumanParameterBlock humanBpb = Marshal.ByteArrayToStructureBigEndian<HumanParameterBlock>(bpbSector);
|
||||
HumanParameterBlock humanBpb = Marshal.ByteArrayToStructureBigEndianGenerated<HumanParameterBlock>(bpbSector);
|
||||
|
||||
ulong expectedClusters = humanBpb.bpc > 0 ? partition.Size / humanBpb.bpc : 0;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -942,35 +943,36 @@ public sealed partial class FAT
|
||||
|
||||
/// <summary>Human68k Parameter Block, big endian, 512 bytes even on 256 bytes/sector.</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct HumanParameterBlock
|
||||
[SwapEndian]
|
||||
partial struct HumanParameterBlock
|
||||
{
|
||||
/// <summary>68k bra.S</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public readonly byte[] jump;
|
||||
public byte[] jump;
|
||||
/// <summary>OEM Name, 16 bytes, space-padded</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] oem_name;
|
||||
public byte[] oem_name;
|
||||
/// <summary>Bytes per cluster</summary>
|
||||
public readonly ushort bpc;
|
||||
public ushort bpc;
|
||||
/// <summary>Unknown, seen 1, 2 and 16</summary>
|
||||
public readonly byte unknown1;
|
||||
public byte unknown1;
|
||||
/// <summary>Unknown, always 512?</summary>
|
||||
public readonly ushort unknown2;
|
||||
public ushort unknown2;
|
||||
/// <summary>Unknown, always 1?</summary>
|
||||
public readonly byte unknown3;
|
||||
public byte unknown3;
|
||||
/// <summary>Number of entries on root directory</summary>
|
||||
public readonly ushort root_ent;
|
||||
public ushort root_ent;
|
||||
/// <summary>Clusters, set to 0 if more than 65536</summary>
|
||||
public readonly ushort clusters;
|
||||
public ushort clusters;
|
||||
/// <summary>Media descriptor</summary>
|
||||
public readonly byte media;
|
||||
public byte media;
|
||||
/// <summary>Clusters per FAT, set to 0</summary>
|
||||
public readonly byte cpfat;
|
||||
public byte cpfat;
|
||||
/// <summary>Clustersin volume</summary>
|
||||
public readonly uint big_clusters;
|
||||
public uint big_clusters;
|
||||
/// <summary>Boot code.</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)]
|
||||
public readonly byte[] boot_code;
|
||||
public byte[] boot_code;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user