Files
Aaru/DiscImageChef.Partitions/RDB.cs

1502 lines
69 KiB
C#
Raw Normal View History

* LICENSE.MIT: * LICENSE.LGPL: Added LICENSE files for LGPL and MIT licenses. * DiscImageChef.Devices/Enums.cs: * DiscImageChef.Partitions/MBR.cs: * DiscImageChef.Partitions/RDB.cs: * DiscImageChef.DiscImages/GDI.cs: * DiscImageChef.Partitions/Sun.cs: * DiscImageChef.DiscImages/VHD.cs: * DiscImageChef.Partitions/GPT.cs: * DiscImageChef.Filesystems/FFS.cs: * DiscImageChef.Filesystems/FAT.cs: * DiscImageChef.Partitions/NeXT.cs: * DiscImageChef.Devices/Command.cs: * DiscImageChef.DiscImages/Nero.cs: * DiscImageChef.Decoders/CD/PMA.cs: * DiscImageChef.Decoders/CD/TOC.cs: * DiscImageChef.Filesystems/BFS.cs: * DiscImageChef.Filesystems/ODS.cs: * DiscImageChef.Helpers/PrintHex.cs: * DiscImageChef.Helpers/Swapping.cs: * DiscImageChef.Decoders/DVD/PRI.cs: * DiscImageChef.Decoders/DVD/DMI.cs: * DiscImageChef.Decoders/DVD/DDS.cs: * DiscImageChef.Decoders/DVD/RMD.cs: * DiscImageChef.Decoders/DVD/UDI.cs: * DiscImageChef.Partitions/Atari.cs: * DiscImageChef.Decoders/DVD/BCA.cs: * DiscImageChef.Filesystems/SysV.cs: * DiscImageChef.Filesystems/HPFS.cs: * DiscImageChef.Filesystems/NTFS.cs: * DiscImageChef.Filesystems/APFS.cs: * DiscImageChef.Decoders/DVD/PFI.cs: * DiscImageChef.Decoders/CD/ATIP.cs: * DiscImageChef.Filesystems/Acorn.cs: * DiscImageChef.DiscImages/CDRWin.cs: * DiscImageChef.DiscImages/CDRDAO.cs: * DiscImageChef.Filesystems/BTRFS.cs: * DiscImageChef.Decoders/Xbox/DMI.cs: * DiscImageChef.Helpers/ArrayFill.cs: * DiscImageChef.Settings/Settings.cs: * DiscImageChef.Filesystems/Opera.cs: * DiscImageChef.Filesystems/extFS.cs: * DiscImageChef.Decoders/DVD/CPRM.cs: * DiscImageChef.Decoders/DVD/ADIP.cs: * DiscImageChef.Decoders/CD/Enums.cs: * DiscImageChef.Decoders/DVD/AACS.cs: * DiscImageChef.Decoders/SCSI/EVPD.cs: * DiscImageChef.Filesystems/ProDOS.cs: * DiscImageChef.Metadata/MediaType.cs: * DiscImageChef.Console/DicConsole.cs: * DiscImageChef.Decoders/DVD/Spare.cs: * DiscImageChef.Filesystems/ext2FS.cs: * DiscImageChef.Decoders/DVD/Enums.cs: * DiscImageChef.Filesystems/Symbian.cs: * DiscImageChef.Decoders/SCSI/Types.cs: * DiscImageChef.Filesystems/UNIXBFS.cs: * DiscImageChef.DiscImages/TeleDisk.cs: * DiscImageChef.Decoders/SCSI/Sense.cs: * DiscImageChef.Decoders/CD/FullTOC.cs: * DiscImageChef.Decoders/Blu-ray/DI.cs: * DiscImageChef.Decoders/ATA/Errors.cs: * DiscImageChef.Filesystems/ISO9660.cs: * DiscImageChef.Filesystems/MinixFS.cs: * DiscImageChef.Devices/Linux/Enums.cs: * DiscImageChef.Filesystems/SolarFS.cs: * DiscImageChef.Filesystems/Structs.cs: * DiscImageChef.DiscImages/Apple2MG.cs: * DiscImageChef.Decoders/SCSI/Modes.cs: * DiscImageChef.Metadata/Dimensions.cs: * DiscImageChef.Partitions/AppleMap.cs: * DiscImageChef.Decoders/Floppy/ISO.cs: * DiscImageChef.Decoders/DVD/Layers.cs: * DiscImageChef.Decoders/CD/Session.cs: * DiscImageChef.Decoders/SCSI/Enums.cs: * DiscImageChef.Filesystems/Nintendo.cs: * DiscImageChef.Helpers/DateHandlers.cs: * DiscImageChef.Filesystems/AmigaDOS.cs: * DiscImageChef.DiscImages/ImageInfo.cs: * DiscImageChef.Checksums/MD5Context.cs: * DiscImageChef.Devices/Linux/Extern.cs: * DiscImageChef.Filesystems/AppleHFS.cs: * DiscImageChef.Filesystems/AppleMFS.cs: * DiscImageChef.Helpers/ArrayIsEmpty.cs: * DiscImageChef.Decoders/Blu-ray/BCA.cs: * DiscImageChef.Decoders/Blu-ray/DDS.cs: * DiscImageChef.Filesystems/PCEngine.cs: * DiscImageChef.Decoders/ATA/Identify.cs: * DiscImageChef.Devices/Linux/Command.cs: * DiscImageChef.Devices/FreeBSD/Enums.cs: * DiscImageChef.Decoders/SCSI/Inquiry.cs: * DiscImageChef.Metadata/DeviceReport.cs: * DiscImageChef.Decoders/Floppy/Amiga.cs: * DiscImageChef.Devices/Linux/Structs.cs: * DiscImageChef.Devices/Windows/Enums.cs: * DiscImageChef.Decoders/DVD/CSS&CPRM.cs: * DiscImageChef.Checksums/SHA1Context.cs: * DiscImageChef.DiscImages/DiskCopy42.cs: * DiscImageChef.Partitions/PartPlugin.cs: * DiscImageChef.CommonTypes/Partition.cs: * DiscImageChef.Decoders/Floppy/Enums.cs: * DiscImageChef.CommonTypes/MediaType.cs: * DiscImageChef.Decoders/Floppy/Apple2.cs: * DiscImageChef.Devices/Windows/Extern.cs: * DiscImageChef.Decoders/SCSI/MMC/CPRM.cs: * DiscImageChef.Helpers/StringHandlers.cs: * DiscImageChef.DiscImages/ImagePlugin.cs: * DiscImageChef.Checksums/CRC64Context.cs: * DiscImageChef.Checksums/CRC32Context.cs: * DiscImageChef.DiscImages/ZZZRawImage.cs: * DiscImageChef.Checksums/CRC16Context.cs: * DiscImageChef.Filesystems/LisaFS/Dir.cs: * DiscImageChef.Decoders/DVD/Cartridge.cs: * DiscImageChef.Decoders/Blu-ray/Spare.cs: * DiscImageChef.Filesystems/Filesystem.cs: * DiscImageChef.Decoders/SCSI/MMC/AACS.cs: * DiscImageChef.Devices/FreeBSD/Extern.cs: * DiscImageChef.Devices/Device/Commands.cs: * DiscImageChef.Checksums/SHA384Context.cs: * DiscImageChef.Devices/FreeBSD/Command.cs: * DiscImageChef.Checksums/SHA512Context.cs: * DiscImageChef.Decoders/SCSI/MMC/Enums.cs: * DiscImageChef.Devices/Windows/Command.cs: * DiscImageChef.Devices/FreeBSD/Structs.cs: * DiscImageChef.Devices/Windows/Structs.cs: * DiscImageChef.Filesystems/LisaFS/Info.cs: * DiscImageChef.Checksums/SHA256Context.cs: * DiscImageChef.Filesystems/LisaFS/File.cs: * DiscImageChef.Filesystems/AppleHFSPlus.cs: * DiscImageChef.Filesystems/LisaFS/Super.cs: * DiscImageChef.Filesystems/LisaFS/Xattr.cs: * DiscImageChef.Checksums/Adler32Context.cs: * DiscImageChef.Decoders/Floppy/System34.cs: * DiscImageChef.Checksums/SpamSumContext.cs: * DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs: * DiscImageChef.Devices/Device/Variables.cs: * DiscImageChef.Filesystems/LisaFS/Consts.cs: * DiscImageChef.Filesystems/LisaFS/LisaFS.cs: * DiscImageChef.Decoders/Floppy/Commodore.cs: * DiscImageChef.Checksums/FletcherContext.cs: * DiscImageChef.Filesystems/LisaFS/Extent.cs: * DiscImageChef.Devices/Device/Destructor.cs: * DiscImageChef.Decoders/Floppy/AppleSony.cs: * DiscImageChef.Filesystems/LisaFS/Structs.cs: * DiscImageChef.Decoders/SCSI/VendorString.cs: * DiscImageChef.Decoders/SCSI/MMC/Features.cs: * DiscImageChef.Devices/Device/Constructor.cs: * DiscImageChef.Checksums/RIPEMD160Context.cs: * DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs: * DiscImageChef.Decoders/Blu-ray/Cartridge.cs: * DiscImageChef.Decoders/Floppy/System3740.cs: * DiscImageChef.Filesystems/LisaFS/Encoding.cs: * DiscImageChef.Decoders/SCSI/ModesEncoders.cs: * DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs: * DiscImageChef.Helpers/BigEndianBitConverter.cs: * DiscImageChef.Decoders/Floppy/Perpendicular.cs: * DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs: * DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs: * DiscImageChef.Devices/Device/ScsiCommands/HP.cs: * DiscImageChef.Devices/Device/AtaCommands/Cfa.cs: * DiscImageChef.Devices/Device/ScsiCommands/NEC.cs: * DiscImageChef.Helpers/EndianAwareBinaryReader.cs: * DiscImageChef.Devices/Device/ScsiCommands/MMC.cs: * DiscImageChef.Devices/Device/AtaCommands/MCPT.cs: * DiscImageChef.Devices/Device/ScsiCommands/SSC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SPC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SMC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SBC.cs: * DiscImageChef.Metadata/Properties/AssemblyInfo.cs: * DiscImageChef.Devices/Device/AtaCommands/Atapi.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata28.cs: * DiscImageChef.Devices/Device/AtaCommands/Smart.cs: * DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata48.cs: * DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs: * DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs: * DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs: * DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs: * DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs: * DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs: * DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs: * DiscImageChef.Devices/Device/ScsiCommands/Certance.cs: * DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs: * DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs: Relicensed as LGPL. Updated standard header. * DiscImageChef/Main.cs: * DiscImageChef/Plugins.cs: * DiscImageChef/Options.cs: * DiscImageChef/Commands/Ls.cs: * DiscImageChef/Core/IBGLog.cs: * DiscImageChef/Core/MHDDLog.cs: * DiscImageChef/AssemblyInfo.cs: * DiscImageChef/Core/Checksum.cs: * DiscImageChef/Commands/Decode.cs: * DiscImageChef/Core/Statistics.cs: * DiscImageChef/Commands/Verify.cs: * DiscImageChef/Commands/Formats.cs: * DiscImageChef/Commands/Entropy.cs: * DiscImageChef/Commands/Compare.cs: * DiscImageChef.Interop/DetectOS.cs: * DiscImageChef/Commands/Analyze.cs: * DiscImageChef/Commands/Commands.cs: * DiscImageChef/Commands/PrintHex.cs: * DiscImageChef/Commands/Checksum.cs: * DiscImageChef/DetectImageFormat.cs: * DiscImageChef/Commands/DumpMedia.cs: * DiscImageChef/Commands/Benchmark.cs: * DiscImageChef/Commands/Configure.cs: * DiscImageChef/Commands/MediaInfo.cs: * DiscImageChef.Interop/PlatformID.cs: * DiscImageChef/Commands/MediaScan.cs: * DiscImageChef/Commands/Statistics.cs: * DiscImageChef/Commands/DeviceInfo.cs: * DiscImageChef.Checksums/ReedSolomon.cs: * DiscImageChef/Commands/DeviceReport.cs: * DiscImageChef/Commands/ExtractFiles.cs: * DiscImageChef.Checksums/CDChecksums.cs: * DiscImageChef/Commands/CreateSidecar.cs: Updated standard header. * DiscImageChef.Checksums/DiscImageChef.Checksums.csproj: Relicensed project as LGPL. Updated standard header. Embed license as resource. * DiscImageChef.Console/DiscImageChef.Console.csproj: * DiscImageChef.Devices/DiscImageChef.Devices.csproj: * DiscImageChef.Helpers/DiscImageChef.Helpers.csproj: * DiscImageChef.Settings/DiscImageChef.Settings.csproj: * DiscImageChef.Decoders/DiscImageChef.Decoders.csproj: * DiscImageChef.Metadata/DiscImageChef.Metadata.csproj: * DiscImageChef.Partitions/DiscImageChef.Partitions.csproj: * DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj: * DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj: * DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj: Relicensed as LGPL. Updated standard header. Embed license as resource. * DiscImageChef/DiscImageChef.csproj: * DiscImageChef.Interop/DiscImageChef.Interop.csproj: Updated standard header. Embed license as resource.
2016-07-28 18:13:49 +01:00
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : RDB.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Partitioning scheme plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Manages Amiga Rigid Disk Block.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2016 Natalia Portillo
// ****************************************************************************/
2015-04-20 04:29:23 +01:00
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.Console;
2015-04-20 04:29:23 +01:00
namespace DiscImageChef.PartPlugins
{
public class AmigaRigidDiskBlock : PartPlugin
{
/// <summary>
/// RDB magic number "RDSK"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint RigidDiskBlockMagic = 0x5244534B;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Bad block list magic number "BADB"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint BadBlockListMagic = 0x42414442;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition entry magic number "PART"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint PartitionBlockMagic = 0x50415254;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Filesystem header magic number "FSHD"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FilesystemHeaderMagic = 0x46534844;
2015-04-20 04:29:23 +01:00
/// <summary>
/// LoadSeg block magic number "LSEG"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint LoadSegMagic = 0x4C534547;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System, "DOS\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOFS = 0x444F5300;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System, "DOS\1"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDFFS = 0x444F5301;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with international characters, "DOS\2"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOFSi = 0x444F5302;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with international characters, "DOS\3"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDFFSi = 0x444F5303;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with directory cache, "DOS\4"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOFSc = 0x444F5304;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with directory cache, "DOS\5"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDFFSc = 0x444F5305;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with long filenames, "DOS\6"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOFS2 = 0x444F5306;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with long filenames, "DOS\7"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDFFS2 = 0x444F5307;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga UNIX System V filesystem
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDAMIXSysV = 0x554E4900;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga UNIX boot filesystem
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDAMIXBoot = 0x554E4901;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga UNIX BSD filesystem
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDAMIXFFS = 0x554E4902;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga UNIX Reserved partition (swap)
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDAMIXReserved = 0x72657376;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for ProfessionalFileSystem, "PFS\1"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDPFS = 0x50465301;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for ProfessionalFileSystem, "PFS\2"
/// </summary>
const uint TypeIDPFS2 = 0x50465302;
/// <summary>
2015-04-20 04:29:23 +01:00
/// Type ID for ProfessionalFileSystem, "muAF"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDPFSm = 0x6D754146;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for ProfessionalFileSystem, "AFS\1"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDAFS = 0x41465301;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for SmartFileSystem v1, "SFS\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDSFS = 0x53465300;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for SmartFileSystem v2, "SFS\2"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDSFS2 = 0x53465302;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for JXFS, "JXF\4"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDJXFS = 0x4A584604;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for FAT, as set by CrossDOS, "MSD\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDCrossDOS = 0x4D534400;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for HFS, as set by CrossMac, "MAC\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDCrossMac = 0x4D414300;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for 4.2UFS, for BFFS, "BFFS"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDBFFS = 0x42464653;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with multi-user patches, "muF\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuOFS = 0x6D754600;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with multi-user patches, "muF\1"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuFFS = 0x6D754601;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with international characters and multi-user patches, "muF\2"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuOFSi = 0x6D754602;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with international characters and multi-user patches, "muF\3"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuFFSi = 0x6D754603;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Original File System with directory cache and multi-user patches, "muF\4"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuOFSc = 0x6D754604;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Amiga Fast File System with directory cache and multi-user patches, "muF\5"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDmuFFSc = 0x6D754605;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for BSD unused, "BSD\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOldBSDUnused = 0x42534400;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for BSD swap, "BSD\1"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOldBSDSwap = 0x42534401;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for BSD 4.2 FFS, "BSD\7"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOldBSD42FFS = 0x42534407;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for BSD 4.4 LFS, "BSD\9"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDOldBSD44LFS = 0x42534409;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD unused root partition, "NBR\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDRootUnused = 0x4E425200;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD 4.2 FFS root partition, "NBR\7"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDRoot42FFS = 0x4E425207;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD 4.4 LFS root partition, "NBR\9"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDRoot44LFS = 0x4E425209;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD unused user partition, "NBR\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDUserUnused = 0x4E425500;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD 4.2 FFS user partition, "NBR\7"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDUser42FFS = 0x4E425507;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD 4.4 LFS user partition, "NBR\9"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDUser44LFS = 0x4E425509;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for NetBSD swap partition
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDNetBSDSwap = 0x4E425300;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Linux filesystem partition, "LNX\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDLinux = 0x4C4E5800;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for Linux swap partition, "SWP\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDLinuxSwap = 0x53575000;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for RaidFrame partition, "RAID"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDRaidFrame = 0x52414944;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type ID for RaidFrame partition, "RAI\0"
/// </summary>
2016-07-28 22:25:26 +01:00
const uint TypeIDRaidFrame0 = 0x52414900;
2015-04-20 04:29:23 +01:00
/// <summary>
/// No disks to be configured after this one
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsNoDisks = 0x00000001;
2015-04-20 04:29:23 +01:00
/// <summary>
/// No LUNs to be configured after this one
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsNoLUNs = 0x00000002;
2015-04-20 04:29:23 +01:00
/// <summary>
/// No target IDs to be configured after this one
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsNoTargets = 0x00000004;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Don't try to perform reselection with this drive
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsNoReselection = 0x00000008;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Disk identification is valid
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsValidDiskID = 0x00000010;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Controller identification is valid
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsValidControllerID = 0x00000020;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Drive supports synchronous SCSI mode
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsSynchSCSI = 0x00000040;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition is bootable
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsBootable = 0x00000001;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition should not be mounted automatically
/// </summary>
2016-07-28 22:25:26 +01:00
const uint FlagsNoAutomount = 0x00000002;
2015-04-20 04:29:23 +01:00
public AmigaRigidDiskBlock()
2015-04-20 04:29:23 +01:00
{
Name = "Amiga Rigid Disk Block";
PluginUUID = new Guid("8D72ED97-1854-4170-9CE4-6E8446FD9863");
}
/// <summary>
/// Amiga Rigid Disk Block, header for partitioning scheme
/// Can be in any sector from 0 to 15, inclusive
/// </summary>
struct RigidDiskBlock
{
/// <summary>
/// "RDSK"
/// </summary>
2016-07-28 22:25:26 +01:00
public uint magic;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Size in longs
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Checksum
/// </summary>
2016-07-28 22:25:26 +01:00
public int checksum;
2015-04-20 04:29:23 +01:00
/// <summary>
/// SCSI target ID, 7 for non-SCSI
/// </summary>
2016-07-28 22:25:26 +01:00
public uint targetID;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Block size in bytes
/// </summary>
2016-07-28 22:25:26 +01:00
public uint block_size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Flags
/// </summary>
2016-07-28 22:25:26 +01:00
public uint flags;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to first BadBlockList, 0xFFFFFFFF means last block in device
/// </summary>
2016-07-28 22:25:26 +01:00
public uint badblock_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to first PartitionEntry, 0xFFFFFFFF means last block in device
/// </summary>
2016-07-28 22:25:26 +01:00
public uint partition_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to first FileSystemHeader, 0xFFFFFFFF means last block in device
/// </summary>
2016-07-28 22:25:26 +01:00
public uint fsheader_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Optional drive specific init code
/// </summary>
2016-07-28 22:25:26 +01:00
public uint driveinitcode;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved1;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved2;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved3;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved4;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved5;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be 0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved6;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Cylinders in drive
/// </summary>
2016-07-28 22:25:26 +01:00
public uint cylinders;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Sectors per track
/// </summary>
2016-07-28 22:25:26 +01:00
public uint spt;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Heads in drive
/// </summary>
2016-07-28 22:25:26 +01:00
public uint heads;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Drive interleave
/// </summary>
2016-07-28 22:25:26 +01:00
public uint interleave;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Cylinder for parking heads
/// </summary>
2016-07-28 22:25:26 +01:00
public uint parking;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved7;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved8;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved9;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Starting cylinder for write precompensation
/// </summary>
2016-07-28 22:25:26 +01:00
public uint writeprecomp;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Starting cylinder for reduced write current
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reducedwrite;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Drive step rate
/// </summary>
2016-07-28 22:25:26 +01:00
public uint steprate;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved10;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved11;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved12;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved13;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved14;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Low block of RDB reserved blocks
/// </summary>
2016-07-28 22:25:26 +01:00
public uint RDBBlockLow;
2015-04-20 04:29:23 +01:00
/// <summary>
/// High block of RDB reserved blocks
/// </summary>
2016-07-28 22:25:26 +01:00
public uint RDBBlockHigh;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Low cylinder for partitionable area
/// </summary>
2016-07-28 22:25:26 +01:00
public uint LowCylinder;
2015-04-20 04:29:23 +01:00
/// <summary>
/// High cylinder for partitionable area
/// </summary>
2016-07-28 22:25:26 +01:00
public uint HighCylinder;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Blocks per cylinder
/// </summary>
2016-07-28 22:25:26 +01:00
public uint CylBlocks;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Seconds for head autoparking
/// </summary>
2016-07-28 22:25:26 +01:00
public uint AutoParkSeconds;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Highest block used by RDB
/// </summary>
2016-07-28 22:25:26 +01:00
public uint HighRDSKBlock;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved15;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Disk vendor, 8 bytes
/// </summary>
public string diskVendor;
/// <summary>
/// Disk product, 16 bytes
/// </summary>
public string diskProduct;
/// <summary>
/// Disk revision, 4 bytes
/// </summary>
public string diskRevision;
/// <summary>
/// Controller vendor, 8 bytes
/// </summary>
public string controllerVendor;
/// <summary>
/// Controller product, 16 bytes
/// </summary>
public string controllerProduct;
/// <summary>
/// Controller revision, 4 bytes
/// </summary>
public string controllerRevision;
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved16;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved17;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved18;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved19;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved20;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved21;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved22;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved23;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved24;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved, should be zero
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved25;
2015-04-20 04:29:23 +01:00
}
/// <summary>
/// Pair for spare blocks
/// </summary>
struct BadBlockEntry
{
/// <summary>
/// Bad block pointer
/// </summary>
2016-07-28 22:25:26 +01:00
public uint badBlock;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Replacement block pointer
/// </summary>
2016-07-28 22:25:26 +01:00
public uint goodBlock;
2015-04-20 04:29:23 +01:00
}
/// <summary>
/// List of bad blocks and spares
/// </summary>
struct BadBlockList
{
/// <summary>
/// "BADB"
/// </summary>
2016-07-28 22:25:26 +01:00
public uint magic;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Size in longs
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Checksum
/// </summary>
2016-07-28 22:25:26 +01:00
public int checksum;
2015-04-20 04:29:23 +01:00
/// <summary>
/// SCSI target ID, 7 for non-SCSI
/// </summary>
2016-07-28 22:25:26 +01:00
public uint targetID;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer for next BadBlockList
/// </summary>
2016-07-28 22:25:26 +01:00
public uint next_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Bad block entries, up to block filling, 8 bytes each
/// </summary>
public BadBlockEntry[] blockPairs;
}
/// <summary>
/// DOSEnvVec, used by AmigaDOS
/// </summary>
struct DOSEnvironmentVector
{
/// <summary>
/// Size in longs, should be 16, minimum 11
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Block size in longs
/// </summary>
2016-07-28 22:25:26 +01:00
public uint block_size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Unknown, 0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint sec_org;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Heads in drive
/// </summary>
2016-07-28 22:25:26 +01:00
public uint surfaces;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Sectors per block
/// </summary>
2016-07-28 22:25:26 +01:00
public uint spb;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Blocks per track
/// </summary>
2016-07-28 22:25:26 +01:00
public uint bpt;
2015-04-20 04:29:23 +01:00
/// <summary>
/// DOS reserved blocks at start of partition
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reservedblocks;
2015-04-20 04:29:23 +01:00
/// <summary>
/// DOS reserved blocks at end of partition
/// </summary>
2016-07-28 22:25:26 +01:00
public uint prealloc;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Interleave
/// </summary>
2016-07-28 22:25:26 +01:00
public uint interleave;
2015-04-20 04:29:23 +01:00
/// <summary>
/// First cylinder of a partition, inclusive
/// </summary>
2016-07-28 22:25:26 +01:00
public uint lowCylinder;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Last cylinder of a partition, inclusive
/// </summary>
2016-07-28 22:25:26 +01:00
public uint highCylinder;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Buffers, usually 30
/// </summary>
2016-07-28 22:25:26 +01:00
public uint numBuffer;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Type of memory to allocate for buffers
/// </summary>
2016-07-28 22:25:26 +01:00
public uint bufMemType;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Maximum transfer, usually 0x7FFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint maxTransfer;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Address mask to block out certain memory, usually 0xFFFFFFFE
/// </summary>
2016-07-28 22:25:26 +01:00
public uint Mask;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Boot priority
/// </summary>
2016-07-28 22:25:26 +01:00
public uint bootPriority;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition type, and filesystem driver identification for AmigaDOS
/// </summary>
2016-07-28 22:25:26 +01:00
public uint dosType;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Default baud rate for SER and AUX handlers
/// </summary>
2016-07-28 22:25:26 +01:00
public uint baud;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Flow control values for SER and AUX handlers
/// </summary>
2016-07-28 22:25:26 +01:00
public uint control;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Since Kickstart 2, how many boot blocks are to be loaded
/// </summary>
2016-07-28 22:25:26 +01:00
public uint bootBlocks;
2015-04-20 04:29:23 +01:00
}
struct PartitionEntry
{
/// <summary>
/// "PART"
/// </summary>
2016-07-28 22:25:26 +01:00
public uint magic;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Size in longs
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Checksum
/// </summary>
2016-07-28 22:25:26 +01:00
public int checksum;
2015-04-20 04:29:23 +01:00
/// <summary>
/// SCSI target ID, 7 for non-SCSI
/// </summary>
2016-07-28 22:25:26 +01:00
public uint targetID;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to next PartitionEntry
/// </summary>
2016-07-28 22:25:26 +01:00
public uint next_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition flags
/// </summary>
2016-07-28 22:25:26 +01:00
public uint flags;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved1;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved2;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Preferred flags for OpenDevice()
/// </summary>
2016-07-28 22:25:26 +01:00
public uint devFlags;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Length of drive name
/// </summary>
2016-07-28 22:25:26 +01:00
public uint driveNameLen;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Drive name, 31 bytes
/// </summary>
public string driveName;
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved3;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved4;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved5;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved6;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved7;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved8;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved9;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved10;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved11;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved12;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved13;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved14;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved15;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved16;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved17;
2015-04-20 04:29:23 +01:00
/// <summary>
/// DOSEnvVec, more information about partition
/// </summary>
public DOSEnvironmentVector dosEnvVec;
}
/// <summary>
/// Device node, mostly useless, except for pointer to first LoadSegment block
/// </summary>
struct DeviceNode
{
/// <summary>
/// Device node type, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint type;
2015-04-20 04:29:23 +01:00
/// <summary>
/// DOS task field, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint task;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Unused, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint locked;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Filename handler to LoadSegment, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint handler;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Stack size when starting task, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint stackSize;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Task priority, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint priority;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Startup message, =0
/// </summary>
2016-07-28 22:25:26 +01:00
public uint startup;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to first LoadSegment block
/// </summary>
2016-07-28 22:25:26 +01:00
public uint seglist_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// BCPL globabl vector when starting task, =0xFFFFFFFF
/// </summary>
2016-07-28 22:25:26 +01:00
public uint global_vec;
2015-04-20 04:29:23 +01:00
}
/// <summary>
/// File system header
/// </summary>
struct FileSystemHeader
{
/// <summary>
/// "FSHD"
/// </summary>
2016-07-28 22:25:26 +01:00
public uint magic;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Size in longs, 64
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Checksum
/// </summary>
2016-07-28 22:25:26 +01:00
public int checksum;
2015-04-20 04:29:23 +01:00
/// <summary>
/// SCSI target ID, 7 for non-SCSI
/// </summary>
2016-07-28 22:25:26 +01:00
public uint targetID;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to next FileSystemHeader block
/// </summary>
2016-07-28 22:25:26 +01:00
public uint next_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Flags, unknown
/// </summary>
2016-07-28 22:25:26 +01:00
public uint flags;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved1;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Reserved
/// </summary>
2016-07-28 22:25:26 +01:00
public uint reserved2;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Partition type, and filesystem driver identification for AmigaDOS
/// </summary>
2016-07-28 22:25:26 +01:00
public uint dosType;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Filesystem version
/// Mask 0xFFFF0000, >>16, major version
/// Mask 0x0000FFFF, minor version
/// </summary>
2016-07-28 22:25:26 +01:00
public uint version;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Bits for DeviceNode fields that should be substituted into a standard device node
/// </summary>
2016-07-28 22:25:26 +01:00
public uint patchFlags;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Device node
/// </summary>
public DeviceNode dnode;
}
/// <summary>
/// Filesystem code
/// </summary>
struct LoadSegment
{
/// <summary>
/// "LSEG"
/// </summary>
2016-07-28 22:25:26 +01:00
public uint magic;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Size in longs
/// </summary>
2016-07-28 22:25:26 +01:00
public uint size;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Checksum
/// </summary>
2016-07-28 22:25:26 +01:00
public int checksum;
2015-04-20 04:29:23 +01:00
/// <summary>
/// SCSI target ID, 7 for non-SCSI
/// </summary>
2016-07-28 22:25:26 +01:00
public uint targetID;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Pointer to next LoadSegment
/// </summary>
2016-07-28 22:25:26 +01:00
public uint next_ptr;
2015-04-20 04:29:23 +01:00
/// <summary>
/// Executable code, with relocation hunks, til end of sector
/// </summary>
public byte[] loadData;
}
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
2015-04-20 04:29:23 +01:00
{
partitions = new List<CommonTypes.Partition>();
2015-04-20 04:29:23 +01:00
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ulong RDBBlock = 0;
bool foundRDB = false;
2016-04-19 02:11:47 +01:00
while(RDBBlock < 16 && !foundRDB)
2015-04-20 04:29:23 +01:00
{
2016-04-19 02:11:47 +01:00
if(imagePlugin.GetSectors() <= RDBBlock)
2015-04-20 04:29:23 +01:00
return false;
byte[] tmpSector = imagePlugin.ReadSector(RDBBlock);
2016-07-28 22:25:26 +01:00
uint magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
2015-04-20 04:29:23 +01:00
DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if(magic == RigidDiskBlockMagic)
2015-04-20 04:29:23 +01:00
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found RDB magic at block {0}", RDBBlock);
2016-04-19 02:11:47 +01:00
2015-04-20 04:29:23 +01:00
foundRDB = true;
break;
}
2016-04-19 02:11:47 +01:00
RDBBlock++;
2015-04-20 04:29:23 +01:00
}
2016-04-19 02:11:47 +01:00
if(!foundRDB)
2015-04-20 04:29:23 +01:00
return false;
byte[] sector;
byte[] tmpString;
RigidDiskBlock RDB = new RigidDiskBlock();
sector = imagePlugin.ReadSector(RDBBlock);
RDB.magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
RDB.size = BigEndianBitConverter.ToUInt32(sector, 0x04);
RDB.checksum = BigEndianBitConverter.ToInt32(sector, 0x08);
RDB.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C);
RDB.block_size = BigEndianBitConverter.ToUInt32(sector, 0x10);
RDB.flags = BigEndianBitConverter.ToUInt32(sector, 0x04);
RDB.badblock_ptr = BigEndianBitConverter.ToUInt32(sector, 0x18);
RDB.partition_ptr = BigEndianBitConverter.ToUInt32(sector, 0x1C);
RDB.fsheader_ptr = BigEndianBitConverter.ToUInt32(sector, 0x20);
RDB.driveinitcode = BigEndianBitConverter.ToUInt32(sector, 0x24);
RDB.reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x28);
RDB.reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x2C);
RDB.reserved3 = BigEndianBitConverter.ToUInt32(sector, 0x30);
RDB.reserved4 = BigEndianBitConverter.ToUInt32(sector, 0x34);
RDB.reserved5 = BigEndianBitConverter.ToUInt32(sector, 0x38);
RDB.reserved6 = BigEndianBitConverter.ToUInt32(sector, 0x3C);
RDB.cylinders = BigEndianBitConverter.ToUInt32(sector, 0x40);
RDB.spt = BigEndianBitConverter.ToUInt32(sector, 0x44);
RDB.heads = BigEndianBitConverter.ToUInt32(sector, 0x48);
RDB.interleave = BigEndianBitConverter.ToUInt32(sector, 0x4C);
RDB.parking = BigEndianBitConverter.ToUInt32(sector, 0x50);
RDB.reserved7 = BigEndianBitConverter.ToUInt32(sector, 0x54);
RDB.reserved8 = BigEndianBitConverter.ToUInt32(sector, 0x58);
RDB.reserved9 = BigEndianBitConverter.ToUInt32(sector, 0x5C);
RDB.writeprecomp = BigEndianBitConverter.ToUInt32(sector, 0x60);
RDB.reducedwrite = BigEndianBitConverter.ToUInt32(sector, 0x64);
RDB.steprate = BigEndianBitConverter.ToUInt32(sector, 0x68);
RDB.reserved10 = BigEndianBitConverter.ToUInt32(sector, 0x6C);
RDB.reserved11 = BigEndianBitConverter.ToUInt32(sector, 0x70);
RDB.reserved12 = BigEndianBitConverter.ToUInt32(sector, 0x74);
RDB.reserved13 = BigEndianBitConverter.ToUInt32(sector, 0x78);
RDB.reserved14 = BigEndianBitConverter.ToUInt32(sector, 0x7C);
RDB.RDBBlockLow = BigEndianBitConverter.ToUInt32(sector, 0x80);
RDB.RDBBlockHigh = BigEndianBitConverter.ToUInt32(sector, 0x84);
RDB.LowCylinder = BigEndianBitConverter.ToUInt32(sector, 0x88);
RDB.HighCylinder = BigEndianBitConverter.ToUInt32(sector, 0x8C);
RDB.CylBlocks = BigEndianBitConverter.ToUInt32(sector, 0x90);
RDB.AutoParkSeconds = BigEndianBitConverter.ToUInt32(sector, 0x94);
RDB.HighCylinder = BigEndianBitConverter.ToUInt32(sector, 0x98);
RDB.reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
tmpString = new byte[8];
Array.Copy(sector, 0xA0, tmpString, 0, 8);
RDB.diskVendor = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[16];
Array.Copy(sector, 0xA8, tmpString, 0, 16);
RDB.diskProduct = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[4];
Array.Copy(sector, 0xB8, tmpString, 0, 4);
RDB.diskRevision = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[8];
Array.Copy(sector, 0xBC, tmpString, 0, 8);
RDB.controllerVendor = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[16];
Array.Copy(sector, 0xC4, tmpString, 0, 16);
RDB.controllerProduct = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[4];
Array.Copy(sector, 0xD4, tmpString, 0, 4);
RDB.controllerRevision = StringHandlers.SpacePaddedToString(tmpString);
RDB.reserved16 = BigEndianBitConverter.ToUInt32(sector, 0xD8);
RDB.reserved17 = BigEndianBitConverter.ToUInt32(sector, 0xDC);
RDB.reserved18 = BigEndianBitConverter.ToUInt32(sector, 0xE0);
RDB.reserved19 = BigEndianBitConverter.ToUInt32(sector, 0xE4);
RDB.reserved20 = BigEndianBitConverter.ToUInt32(sector, 0xE8);
RDB.reserved21 = BigEndianBitConverter.ToUInt32(sector, 0xEC);
RDB.reserved22 = BigEndianBitConverter.ToUInt32(sector, 0xF0);
RDB.reserved23 = BigEndianBitConverter.ToUInt32(sector, 0xF4);
RDB.reserved24 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
RDB.reserved25 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.magic = 0x{0:X8}", RDB.magic);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.size = {0} longs, {1} bytes", RDB.size, RDB.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.checksum = 0x{0:X8}", RDB.checksum);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.targetID = {0}", RDB.targetID);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.block_size = {0}", RDB.block_size);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.badblock_ptr = {0}", RDB.badblock_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.partition_ptr = {0}", RDB.partition_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.fsheader_ptr = {0}", RDB.fsheader_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.driveinitcode = {0}", RDB.driveinitcode);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved1 = 0x{0:X8}", RDB.reserved1);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved2 = 0x{0:X8}", RDB.reserved2);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved3 = 0x{0:X8}", RDB.reserved3);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved4 = 0x{0:X8}", RDB.reserved4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved5 = 0x{0:X8}", RDB.reserved5);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved6 = 0x{0:X8}", RDB.reserved6);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.cylinders = {0}", RDB.cylinders);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.spt = {0}", RDB.spt);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.heads = {0}", RDB.heads);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.interleave = {0}", RDB.interleave);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.parking = {0}", RDB.parking);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved7 = 0x{0:X8}", RDB.reserved7);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved8 = 0x{0:X8}", RDB.reserved8);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved9 = 0x{0:X8}", RDB.reserved9);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.writeprecomp = {0}", RDB.writeprecomp);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reducedwrite = {0}", RDB.reducedwrite);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.steprate = {0}", RDB.steprate);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved10 = 0x{0:X8}", RDB.reserved10);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved11 = 0x{0:X8}", RDB.reserved11);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved12 = 0x{0:X8}", RDB.reserved12);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved13 = 0x{0:X8}", RDB.reserved13);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved14 = 0x{0:X8}", RDB.reserved14);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.RDBBlockLow = {0}", RDB.RDBBlockLow);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.RDBBlockHigh = {0}", RDB.RDBBlockHigh);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.LowCylinder = {0}", RDB.LowCylinder);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.HighCylinder = {0}", RDB.HighCylinder);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.CylBlocks = {0}", RDB.CylBlocks);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.AutoParkSeconds = {0}", RDB.AutoParkSeconds);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.HighCylinder = {0}", RDB.HighCylinder);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved15 = 0x{0:X8}", RDB.reserved15);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.diskVendor = \"{0}\"", RDB.diskVendor);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.diskProduct = \"{0}\"", RDB.diskProduct);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.diskRevision = \"{0}\"", RDB.diskRevision);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.controllerVendor = \"{0}\"", RDB.controllerVendor);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.controllerProduct = \"{0}\"", RDB.controllerProduct);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.controllerRevision = \"{0}\"", RDB.controllerRevision);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved16 = 0x{0:X8}", RDB.reserved16);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved17 = 0x{0:X8}", RDB.reserved17);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved18 = 0x{0:X8}", RDB.reserved18);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved19 = 0x{0:X8}", RDB.reserved19);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved20 = 0x{0:X8}", RDB.reserved20);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved21 = 0x{0:X8}", RDB.reserved21);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved22 = 0x{0:X8}", RDB.reserved22);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved23 = 0x{0:X8}", RDB.reserved23);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved24 = 0x{0:X8}", RDB.reserved24);
DicConsole.DebugWriteLine("Amiga RDB plugin", "RDB.reserved25 = 0x{0:X8}", RDB.reserved25);
2015-04-20 04:29:23 +01:00
ulong nextBlock;
// Reading BadBlock list
List<BadBlockList> BadBlockChain = new List<BadBlockList>();
nextBlock = RDB.badblock_ptr;
2016-04-19 02:11:47 +01:00
while(nextBlock != 0xFFFFFFFF)
2015-04-20 04:29:23 +01:00
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", nextBlock);
2015-04-20 04:29:23 +01:00
sector = imagePlugin.ReadSector(nextBlock);
2016-07-28 22:25:26 +01:00
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if(magic != BadBlockListMagic)
2015-04-20 04:29:23 +01:00
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found BadBlock block");
2015-04-20 04:29:23 +01:00
BadBlockList chainEntry = new BadBlockList();
chainEntry.magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
chainEntry.size = BigEndianBitConverter.ToUInt32(sector, 0x04);
chainEntry.checksum = BigEndianBitConverter.ToInt32(sector, 0x08);
chainEntry.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C);
chainEntry.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10);
chainEntry.reserved = BigEndianBitConverter.ToUInt32(sector, 0x14);
ulong entries = (chainEntry.size - 6) / 2;
chainEntry.blockPairs = new BadBlockEntry[entries];
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.magic = 0x{0:X8}", chainEntry.magic);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.size = {0} longs, {1} bytes", chainEntry.size, chainEntry.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.checksum = 0x{0:X8}", chainEntry.checksum);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.targetID = {0}", chainEntry.targetID);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.next_ptr = {0}", chainEntry.next_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.reserved = 0x{0:X8}", chainEntry.reserved);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
for(ulong i = 0; i < entries; i++)
2015-04-20 04:29:23 +01:00
{
chainEntry.blockPairs[i].badBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0));
chainEntry.blockPairs[i].goodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4));
DicConsole.DebugWriteLine("Amiga RDB plugin", "Bad block at {0} replaced with good block at {1}",
chainEntry.blockPairs[i].badBlock, chainEntry.blockPairs[i].goodBlock);
2015-04-20 04:29:23 +01:00
}
BadBlockChain.Add(chainEntry);
nextBlock = chainEntry.next_ptr;
}
// Reading BadBlock list
List<PartitionEntry> PartitionEntries = new List<PartitionEntry>();
nextBlock = RDB.partition_ptr;
2016-04-19 02:11:47 +01:00
while(nextBlock != 0xFFFFFFFF)
2015-04-20 04:29:23 +01:00
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock);
2015-04-20 04:29:23 +01:00
sector = imagePlugin.ReadSector(nextBlock);
2016-07-28 22:25:26 +01:00
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if(magic != PartitionBlockMagic)
2015-04-20 04:29:23 +01:00
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found PartitionEntry block");
2015-04-20 04:29:23 +01:00
PartitionEntry partEntry = new PartitionEntry();
partEntry.dosEnvVec = new DOSEnvironmentVector();
byte[] driveName = new byte[32];
partEntry.magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
partEntry.size = BigEndianBitConverter.ToUInt32(sector, 0x04);
partEntry.checksum = BigEndianBitConverter.ToInt32(sector, 0x08);
partEntry.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C);
partEntry.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10);
partEntry.flags = BigEndianBitConverter.ToUInt32(sector, 0x14);
partEntry.reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18);
partEntry.reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C);
partEntry.devFlags = BigEndianBitConverter.ToUInt32(sector, 0x20);
partEntry.driveNameLen = sector[0x24];
Array.Copy(sector, 0x24, driveName, 0, 32);
partEntry.driveName = StringHandlers.PascalToString(driveName);
partEntry.reserved3 = BigEndianBitConverter.ToUInt32(sector, 0x44);
partEntry.reserved4 = BigEndianBitConverter.ToUInt32(sector, 0x48);
partEntry.reserved5 = BigEndianBitConverter.ToUInt32(sector, 0x4C);
partEntry.reserved6 = BigEndianBitConverter.ToUInt32(sector, 0x50);
partEntry.reserved7 = BigEndianBitConverter.ToUInt32(sector, 0x54);
partEntry.reserved8 = BigEndianBitConverter.ToUInt32(sector, 0x58);
partEntry.reserved9 = BigEndianBitConverter.ToUInt32(sector, 0x5C);
partEntry.reserved10 = BigEndianBitConverter.ToUInt32(sector, 0x60);
partEntry.reserved11 = BigEndianBitConverter.ToUInt32(sector, 0x64);
partEntry.reserved12 = BigEndianBitConverter.ToUInt32(sector, 0x68);
partEntry.reserved13 = BigEndianBitConverter.ToUInt32(sector, 0x6C);
partEntry.reserved14 = BigEndianBitConverter.ToUInt32(sector, 0x70);
partEntry.reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x74);
partEntry.reserved16 = BigEndianBitConverter.ToUInt32(sector, 0x78);
partEntry.reserved17 = BigEndianBitConverter.ToUInt32(sector, 0x7C);
partEntry.dosEnvVec.size = BigEndianBitConverter.ToUInt32(sector, 0x80);
partEntry.dosEnvVec.block_size = BigEndianBitConverter.ToUInt32(sector, 0x84);
partEntry.dosEnvVec.sec_org = BigEndianBitConverter.ToUInt32(sector, 0x88);
partEntry.dosEnvVec.surfaces = BigEndianBitConverter.ToUInt32(sector, 0x8C);
partEntry.dosEnvVec.spb = BigEndianBitConverter.ToUInt32(sector, 0x90);
partEntry.dosEnvVec.bpt = BigEndianBitConverter.ToUInt32(sector, 0x94);
partEntry.dosEnvVec.reservedblocks = BigEndianBitConverter.ToUInt32(sector, 0x98);
partEntry.dosEnvVec.prealloc = BigEndianBitConverter.ToUInt32(sector, 0x9C);
partEntry.dosEnvVec.interleave = BigEndianBitConverter.ToUInt32(sector, 0xA0);
partEntry.dosEnvVec.lowCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA4);
partEntry.dosEnvVec.highCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA8);
partEntry.dosEnvVec.numBuffer = BigEndianBitConverter.ToUInt32(sector, 0xAC);
partEntry.dosEnvVec.bufMemType = BigEndianBitConverter.ToUInt32(sector, 0xB0);
partEntry.dosEnvVec.maxTransfer = BigEndianBitConverter.ToUInt32(sector, 0xB4);
partEntry.dosEnvVec.Mask = BigEndianBitConverter.ToUInt32(sector, 0xB8);
partEntry.dosEnvVec.bootPriority = BigEndianBitConverter.ToUInt32(sector, 0xBC);
partEntry.dosEnvVec.dosType = BigEndianBitConverter.ToUInt32(sector, 0xC0);
partEntry.dosEnvVec.baud = BigEndianBitConverter.ToUInt32(sector, 0xC4);
partEntry.dosEnvVec.control = BigEndianBitConverter.ToUInt32(sector, 0xC8);
partEntry.dosEnvVec.bootBlocks = BigEndianBitConverter.ToUInt32(sector, 0xCC);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.magic = 0x{0:X8}", partEntry.magic);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.size = {0} longs, {1} bytes", partEntry.size, partEntry.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.checksum = 0x{0:X8}", partEntry.checksum);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.targetID = {0}", partEntry.targetID);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.next_ptr = {0}", partEntry.next_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.flags = 0x{0:X8}", partEntry.flags);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved1 = 0x{0:X8}", partEntry.reserved1);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved2 = 0x{0:X8}", partEntry.reserved2);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.devFlags = 0x{0:X8}", partEntry.devFlags);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.driveNameLen = {0}", partEntry.driveNameLen);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.driveName = \"{0}\"", partEntry.driveName);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved3 = 0x{0:X8}", partEntry.reserved3);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved4 = 0x{0:X8}", partEntry.reserved4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved5 = 0x{0:X8}", partEntry.reserved5);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved6 = 0x{0:X8}", partEntry.reserved6);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved7 = 0x{0:X8}", partEntry.reserved7);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved8 = 0x{0:X8}", partEntry.reserved8);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved9 = 0x{0:X8}", partEntry.reserved9);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved10 = 0x{0:X8}", partEntry.reserved10);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved11 = 0x{0:X8}", partEntry.reserved11);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved12 = 0x{0:X8}", partEntry.reserved12);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved13 = 0x{0:X8}", partEntry.reserved13);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved14 = 0x{0:X8}", partEntry.reserved14);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved15 = 0x{0:X8}", partEntry.reserved15);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved16 = 0x{0:X8}", partEntry.reserved16);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.reserved17 = 0x{0:X8}", partEntry.reserved17);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.size = {0} longs, {1} bytes", partEntry.dosEnvVec.size, partEntry.dosEnvVec.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.block_size = {0} longs, {1} bytes", partEntry.dosEnvVec.block_size, partEntry.dosEnvVec.block_size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.sec_org = 0x{0:X8}", partEntry.dosEnvVec.sec_org);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.surfaces = {0}", partEntry.dosEnvVec.surfaces);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.spb = {0}", partEntry.dosEnvVec.spb);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bpt = {0}", partEntry.dosEnvVec.bpt);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.reservedblocks = {0}", partEntry.dosEnvVec.reservedblocks);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.prealloc = {0}", partEntry.dosEnvVec.prealloc);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.interleave = {0}", partEntry.dosEnvVec.interleave);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.lowCylinder = {0}", partEntry.dosEnvVec.lowCylinder);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.highCylinder = {0}", partEntry.dosEnvVec.highCylinder);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.numBuffer = {0}", partEntry.dosEnvVec.numBuffer);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bufMemType = {0}", partEntry.dosEnvVec.bufMemType);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.maxTransfer = {0}", partEntry.dosEnvVec.maxTransfer);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.Mask = 0x{0:X8}", partEntry.dosEnvVec.Mask);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootPriority = {0}", partEntry.dosEnvVec.bootPriority);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.dosType = {0}", AmigaDOSTypeToString(partEntry.dosEnvVec.dosType, true));
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.baud = {0}", partEntry.dosEnvVec.baud);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.control = 0x{0:X8}", partEntry.dosEnvVec.control);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootBlocks = {0}", partEntry.dosEnvVec.bootBlocks);
2015-04-20 04:29:23 +01:00
PartitionEntries.Add(partEntry);
nextBlock = partEntry.next_ptr;
}
// Reading BadBlock list
List<FileSystemHeader> FSHDEntries = new List<FileSystemHeader>();
List<LoadSegment> SegmentEntries = new List<LoadSegment>();
nextBlock = RDB.fsheader_ptr;
2016-04-19 02:11:47 +01:00
while(nextBlock != 0xFFFFFFFF)
2015-04-20 04:29:23 +01:00
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a FileSystemHeader block", nextBlock);
2015-04-20 04:29:23 +01:00
sector = imagePlugin.ReadSector(nextBlock);
2016-07-28 22:25:26 +01:00
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if(magic != FilesystemHeaderMagic)
2015-04-20 04:29:23 +01:00
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found FileSystemHeader block");
2015-04-20 04:29:23 +01:00
FileSystemHeader FSHD = new FileSystemHeader();
FSHD.dnode = new DeviceNode();
FSHD.magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
FSHD.size = BigEndianBitConverter.ToUInt32(sector, 0x04);
FSHD.checksum = BigEndianBitConverter.ToInt32(sector, 0x08);
FSHD.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C);
FSHD.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10);
FSHD.flags = BigEndianBitConverter.ToUInt32(sector, 0x14);
FSHD.reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18);
FSHD.reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C);
FSHD.dosType = BigEndianBitConverter.ToUInt32(sector, 0x20);
FSHD.version = BigEndianBitConverter.ToUInt32(sector, 0x24);
FSHD.patchFlags = BigEndianBitConverter.ToUInt32(sector, 0x28);
FSHD.dnode.type = BigEndianBitConverter.ToUInt32(sector, 0x2C);
FSHD.dnode.task = BigEndianBitConverter.ToUInt32(sector, 0x30);
FSHD.dnode.locked = BigEndianBitConverter.ToUInt32(sector, 0x34);
FSHD.dnode.handler = BigEndianBitConverter.ToUInt32(sector, 0x38);
FSHD.dnode.stackSize = BigEndianBitConverter.ToUInt32(sector, 0x3C);
FSHD.dnode.priority = BigEndianBitConverter.ToUInt32(sector, 0x40);
FSHD.dnode.startup = BigEndianBitConverter.ToUInt32(sector, 0x44);
FSHD.dnode.seglist_ptr = BigEndianBitConverter.ToUInt32(sector, 0x48);
FSHD.dnode.global_vec = BigEndianBitConverter.ToUInt32(sector, 0x4C);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.magic = 0x{0:X8}", FSHD.magic);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.size = {0} longs, {1} bytes", FSHD.size, FSHD.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.checksum = 0x{0:X8}", FSHD.checksum);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.targetID = {0}", FSHD.targetID);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.next_ptr = {0}", FSHD.next_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.flags = 0x{0:X8}", FSHD.flags);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved1 = 0x{0:X8}", FSHD.reserved1);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.reserved2 = 0x{0:X8}", FSHD.reserved2);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dosType = {0}", AmigaDOSTypeToString(FSHD.dosType));
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.version = {0:D2}.{1:D2} (0x{2:X8})", (FSHD.version & 0xFFFF0000) >> 16, FSHD.version & 0xFFFF, FSHD.version);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.patchFlags = 0x{0:X8}", FSHD.patchFlags);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.type = {0}", FSHD.dnode.type);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.task = {0}", FSHD.dnode.task);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.locked = {0}", FSHD.dnode.locked);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.handler = {0}", FSHD.dnode.handler);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.stackSize = {0}", FSHD.dnode.stackSize);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.priority = {0}", FSHD.dnode.priority);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.startup = {0}", FSHD.dnode.startup);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.seglist_ptr = {0}", FSHD.dnode.seglist_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.dnode.global_vec = 0x{0:X8}", FSHD.dnode.global_vec);
2015-04-20 04:29:23 +01:00
nextBlock = FSHD.dnode.seglist_ptr;
bool thereAreLoadSegments = false;
Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context();
sha1Ctx.Init();
2016-04-19 02:11:47 +01:00
while(nextBlock != 0xFFFFFFFF)
2015-04-20 04:29:23 +01:00
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", nextBlock);
2015-04-20 04:29:23 +01:00
sector = imagePlugin.ReadSector(nextBlock);
2016-07-28 22:25:26 +01:00
uint magicSeg = BigEndianBitConverter.ToUInt32(sector, 0);
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if(magicSeg != LoadSegMagic)
2015-04-20 04:29:23 +01:00
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found LoadSegment block");
2015-04-20 04:29:23 +01:00
thereAreLoadSegments = true;
LoadSegment loadSeg = new LoadSegment();
loadSeg.magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
loadSeg.size = BigEndianBitConverter.ToUInt32(sector, 0x04);
loadSeg.checksum = BigEndianBitConverter.ToInt32(sector, 0x08);
loadSeg.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C);
loadSeg.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10);
loadSeg.loadData = new byte[(loadSeg.size - 5) * 4];
Array.Copy(sector, 0x14, loadSeg.loadData, 0, (loadSeg.size - 5) * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.magic = 0x{0:X8}", loadSeg.magic);
DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.size = {0} longs, {1} bytes", loadSeg.size, loadSeg.size * 4);
DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.checksum = 0x{0:X8}", loadSeg.checksum);
DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.targetID = {0}", loadSeg.targetID);
DicConsole.DebugWriteLine("Amiga RDB plugin", "loadSeg.next_ptr = {0}", loadSeg.next_ptr);
2015-04-20 04:29:23 +01:00
SegmentEntries.Add(loadSeg);
nextBlock = loadSeg.next_ptr;
sha1Ctx.Update(loadSeg.loadData);
}
2016-04-19 02:11:47 +01:00
if(thereAreLoadSegments)
2015-04-20 04:29:23 +01:00
{
string loadSegSHA1 = sha1Ctx.End();
DicConsole.DebugWriteLine("Amiga RDB plugin", "LoadSegment data SHA1: {0}", loadSegSHA1);
2015-04-20 04:29:23 +01:00
}
FSHDEntries.Add(FSHD);
nextBlock = FSHD.next_ptr;
}
ulong sequence = 0;
2016-04-19 02:11:47 +01:00
foreach(PartitionEntry RDBEntry in PartitionEntries)
2015-04-20 04:29:23 +01:00
{
CommonTypes.Partition entry = new CommonTypes.Partition();
2015-04-20 04:29:23 +01:00
entry.PartitionDescription = AmigaDOSTypeToDescriptionString(RDBEntry.dosEnvVec.dosType);
entry.PartitionName = RDBEntry.driveName;
entry.PartitionSequence = sequence;
entry.PartitionSectors = (RDBEntry.dosEnvVec.highCylinder + 1 - RDBEntry.dosEnvVec.lowCylinder) * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt;
entry.PartitionStartSector = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt;
entry.PartitionStart = entry.PartitionStartSector * RDB.block_size;
entry.PartitionLength = entry.PartitionSectors * RDB.block_size;
entry.PartitionType = AmigaDOSTypeToString(RDBEntry.dosEnvVec.dosType);
partitions.Add(entry);
sequence++;
}
return true;
}
2016-07-28 22:25:26 +01:00
static string AmigaDOSTypeToDescriptionString(uint AmigaDOSType)
2015-04-20 04:29:23 +01:00
{
2016-04-19 02:11:47 +01:00
switch(AmigaDOSType)
2015-04-20 04:29:23 +01:00
{
case TypeIDOFS:
return "Amiga Original File System";
case TypeIDFFS:
return "Amiga Fast File System";
case TypeIDOFSi:
return "Amiga Original File System with international characters";
case TypeIDFFSi:
return "Amiga Fast File System with international characters";
case TypeIDOFSc:
return "Amiga Original File System with directory cache";
case TypeIDFFSc:
return "Amiga Fast File System with directory cache";
case TypeIDOFS2:
return "Amiga Original File System with long filenames";
case TypeIDFFS2:
return "Amiga Fast File System with long filenames";
case TypeIDAMIXSysV:
return "Amiga UNIX System V filesystem";
case TypeIDAMIXBoot:
return "Amiga UNIX boot filesystem";
case TypeIDAMIXFFS:
return "Amiga UNIX BSD filesystem";
case TypeIDAMIXReserved:
return "Amiga UNIX Reserved partition (swap)";
case TypeIDPFS:
case TypeIDPFS2:
2015-04-20 04:29:23 +01:00
case TypeIDPFSm:
case TypeIDAFS:
return "ProfessionalFileSystem";
case TypeIDSFS:
return "SmartFileSystem v1";
case TypeIDSFS2:
return "SmartFileSystem v2";
case TypeIDJXFS:
return "JXFS";
case TypeIDCrossDOS:
return "FAT, as set by CrossDOS";
case TypeIDCrossMac:
return "HFS, as set by CrossMac";
case TypeIDBFFS:
return "4.2UFS, for BFFS";
case TypeIDmuOFS:
return "Amiga Original File System with multi-user patches";
case TypeIDmuFFS:
return "Amiga Fast File System with multi-user patches";
case TypeIDmuOFSi:
return "Amiga Original File System with international characters and multi-user patches";
case TypeIDmuFFSi:
return "Amiga Fast File System with international characters and multi-user patches";
case TypeIDmuOFSc:
return "Amiga Original File System with directory cache and multi-user patches";
case TypeIDmuFFSc:
return "Amiga Fast File System with directory cache and multi-user patches";
case TypeIDOldBSDUnused:
return "BSD unused";
case TypeIDOldBSDSwap:
return "BSD swap";
case TypeIDOldBSD42FFS:
return "BSD 4.2 FFS";
case TypeIDOldBSD44LFS:
return "BSD 4.4 LFS";
case TypeIDNetBSDRootUnused:
return "NetBSD unused root partition";
case TypeIDNetBSDRoot42FFS:
return "NetBSD 4.2 FFS root partition";
case TypeIDNetBSDRoot44LFS:
return "NetBSD 4.4 LFS root partition";
case TypeIDNetBSDUserUnused:
return "NetBSD unused user partition";
case TypeIDNetBSDUser42FFS:
return "NetBSD 4.2 FFS user partition";
case TypeIDNetBSDUser44LFS:
return "NetBSD 4.4 LFS user partition";
case TypeIDNetBSDSwap:
return "NetBSD swap partition";
case TypeIDLinux:
return "Linux filesystem partition";
case TypeIDLinuxSwap:
return "Linux swap partition";
case TypeIDRaidFrame:
case TypeIDRaidFrame0:
return "RaidFrame partition";
default:
{
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDOFS) == TypeIDOFS)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown Amiga DOS filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown Amiga UNIX filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & 0x50465300) == 0x50465300 ||
2015-04-20 04:29:23 +01:00
(AmigaDOSType & 0x41465300) == 0x41465300)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown ProfessionalFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDSFS) == TypeIDSFS)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown SmartFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown Amiga DOS multi-user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown BSD filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown NetBSD root filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown NetBSD user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown NetBSD swap filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2016-04-19 02:11:47 +01:00
if((AmigaDOSType & TypeIDLinux) == TypeIDLinux ||
2015-04-20 04:29:23 +01:00
(AmigaDOSType & TypeIDLinuxSwap) == TypeIDLinuxSwap)
2016-07-28 22:25:26 +01:00
return string.Format("Unknown Linux filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
2016-07-28 22:25:26 +01:00
return string.Format("Unknown partition type {0}", AmigaDOSTypeToString(AmigaDOSType));
2015-04-20 04:29:23 +01:00
}
}
}
2016-07-28 22:25:26 +01:00
static string AmigaDOSTypeToString(uint AmigaDOSType)
2015-04-20 04:29:23 +01:00
{
return AmigaDOSTypeToString(AmigaDOSType, true);
}
2016-07-28 22:25:26 +01:00
static string AmigaDOSTypeToString(uint AmigaDOSType, bool quoted)
2015-04-20 04:29:23 +01:00
{
byte[] textPart = new byte[3];
string textPartString;
textPart[0] = (byte)((AmigaDOSType & 0xFF000000) >> 24);
textPart[1] = (byte)((AmigaDOSType & 0x00FF0000) >> 16);
textPart[2] = (byte)((AmigaDOSType & 0x0000FF00) >> 8);
textPartString = Encoding.ASCII.GetString(textPart);
2016-07-28 22:25:26 +01:00
return quoted ? string.Format("\"{0}\\{1}\"", textPartString, AmigaDOSType & 0xFF) : string.Format("{0}\\{1}", textPartString, AmigaDOSType & 0xFF);
2015-04-20 04:29:23 +01:00
}
}
}