2017-05-19 20:28:49 +01:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2016-10-07 00:41:59 +01:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : Structs.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Apple DOS filesystem plugin.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Apple DOS filesystem structures.
|
|
|
|
|
//
|
|
|
|
|
// --[ 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2020-01-03 17:51:30 +00:00
|
|
|
// Copyright © 2011-2020 Natalia Portillo
|
2016-10-07 00:41:59 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
namespace Aaru.Filesystems.AppleDOS
|
2016-10-07 00:41:59 +01:00
|
|
|
{
|
2017-12-21 16:27:09 +00:00
|
|
|
public partial class AppleDOS
|
2016-10-07 00:41:59 +01:00
|
|
|
{
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2017-12-20 17:15:26 +00:00
|
|
|
struct Vtoc
|
2016-10-07 00:41:59 +01:00
|
|
|
{
|
|
|
|
|
public byte unused1;
|
|
|
|
|
public byte catalogTrack;
|
|
|
|
|
public byte catalogSector;
|
|
|
|
|
public byte dosRelease;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
|
|
|
|
public byte[] unused2;
|
2016-10-07 00:41:59 +01:00
|
|
|
public byte volumeNumber;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
|
|
|
|
public byte[] unused3;
|
2016-10-07 00:41:59 +01:00
|
|
|
public byte maxTrackSectorPairsPerSector;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public byte[] unused4;
|
|
|
|
|
public byte lastAllocatedSector;
|
2016-10-07 00:41:59 +01:00
|
|
|
public sbyte allocationDirection;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
|
|
|
|
public byte[] unused5;
|
|
|
|
|
public byte tracks;
|
|
|
|
|
public byte sectorsPerTrack;
|
2016-10-07 00:41:59 +01:00
|
|
|
public ushort bytesPerSector;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)]
|
|
|
|
|
public byte[] bitmap;
|
2016-10-07 00:41:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct CatalogSector
|
|
|
|
|
{
|
|
|
|
|
public byte unused1;
|
|
|
|
|
public byte trackOfNext;
|
|
|
|
|
public byte sectorOfNext;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public byte[] unused2;
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
|
|
|
|
public FileEntry[] entries;
|
2016-10-07 00:41:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct FileEntry
|
|
|
|
|
{
|
|
|
|
|
public byte extentTrack;
|
|
|
|
|
public byte extentSector;
|
|
|
|
|
public byte typeAndFlags;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)]
|
|
|
|
|
public byte[] filename;
|
2016-10-07 00:41:59 +01:00
|
|
|
public ushort length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct TrackSectorList
|
|
|
|
|
{
|
|
|
|
|
public byte unused1;
|
|
|
|
|
public byte nextListTrack;
|
|
|
|
|
public byte nextListSector;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
|
|
|
|
public byte[] unused2;
|
2016-10-07 00:41:59 +01:00
|
|
|
public ushort sectorOffset;
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
|
|
|
|
public byte[] unused3;
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 122)]
|
|
|
|
|
public TrackSectorListEntry[] entries;
|
2016-10-07 00:41:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct TrackSectorListEntry
|
|
|
|
|
{
|
|
|
|
|
public byte track;
|
|
|
|
|
public byte sector;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
}
|