// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Amiga Fast File System plugin. // // --[ License ] -------------------------------------------------------------- // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, see . // // ---------------------------------------------------------------------------- // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ using System.Runtime.InteropServices; using Aaru.CommonTypes.Attributes; namespace Aaru.Filesystems; /// /// Implements detection of Amiga Fast File System (AFFS) public sealed partial class AmigaDOSPlugin { #region Nested type: BootBlock /// Boot block, first 2 sectors [StructLayout(LayoutKind.Sequential, Pack = 1)] [SwapEndian] partial struct BootBlock { /// Offset 0x00, "DOSx" disk type public uint diskType; /// Offset 0x04, Checksum public uint checksum; /// Offset 0x08, Pointer to root block, mostly invalid public uint root_ptr; /// Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] bootCode; } #endregion #region Nested type: RootBlock [StructLayout(LayoutKind.Sequential, Pack = 1)] [SwapEndian] partial struct RootBlock { /// Offset 0x00, block type, value = T_HEADER (2) public uint type; /// Offset 0x04, unused public uint headerKey; /// Offset 0x08, unused public uint highSeq; /// Offset 0x0C, longs used by hash table public uint hashTableSize; /// Offset 0x10, unused public uint firstData; /// Offset 0x14, Rootblock checksum public uint checksum; /// /// Offset 0x18, Hashtable, size = (block size / 4) - 56 or size = hashTableSize. Size intentionally bad to allow /// marshalling to work. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] hashTable; /// Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid public uint bitmapFlag; /// Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public uint[] bitmapPages; /// Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block public uint bitmapExtensionBlock; /// Offset 0x18+hashTableSize*4+108, last root alteration days since 1978/01/01 public uint rDays; /// Offset 0x18+hashTableSize*4+112, last root alteration minutes past midnight public uint rMins; /// Offset 0x18+hashTableSize*4+116, last root alteration ticks (1/50 secs) public uint rTicks; /// Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public byte[] diskName; /// Offset 0x18+hashTableSize*4+151, unused public byte padding; /// Offset 0x18+hashTableSize*4+152, unused public uint reserved1; /// Offset 0x18+hashTableSize*4+156, unused public uint reserved2; /// Offset 0x18+hashTableSize*4+160, last disk alteration days since 1978/01/01 public uint vDays; /// Offset 0x18+hashTableSize*4+164, last disk alteration minutes past midnight public uint vMins; /// Offset 0x18+hashTableSize*4+168, last disk alteration ticks (1/50 secs) public uint vTicks; /// Offset 0x18+hashTableSize*4+172, filesystem creation days since 1978/01/01 public uint cDays; /// Offset 0x18+hashTableSize*4+176, filesystem creation minutes since 1978/01/01 public uint cMins; /// Offset 0x18+hashTableSize*4+180, filesystem creation ticks since 1978/01/01 public uint cTicks; /// Offset 0x18+hashTableSize*4+184, unused public uint nextHash; /// Offset 0x18+hashTableSize*4+188, unused public uint parentDir; /// Offset 0x18+hashTableSize*4+192, first directory cache block public uint extension; /// Offset 0x18+hashTableSize*4+196, block secondary type = ST_ROOT (1) public uint sec_type; } #endregion }