From f5ce818e8501de9d20b85a6669e7a9dde0235e50 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 5 Jan 2018 23:58:03 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BCorrect=20ProDOS=20filesystem=20det?= =?UTF-8?q?ection=20on=20Apple=20II=20disks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 4b359e71f8056c30904a386720410011225c456e) --- DiscImageChef.Filesystems/ProDOS.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/DiscImageChef.Filesystems/ProDOS.cs b/DiscImageChef.Filesystems/ProDOS.cs index f6a2d525d..0a7d58a6e 100644 --- a/DiscImageChef.Filesystems/ProDOS.cs +++ b/DiscImageChef.Filesystems/ProDOS.cs @@ -111,9 +111,11 @@ namespace DiscImageChef.Filesystems { if(partition.Length < 3) return false; + uint multiplier = (uint)(imagePlugin.ImageInfo.SectorSize == 256 ? 2 : 1); + // Blocks 0 and 1 are boot code - byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partition.Start); - bool APMFromHDDOnCD = false; + byte[] rootDirectoryKeyBlock = imagePlugin.ReadSectors(2 * multiplier + partition.Start, multiplier); + bool APMFromHDDOnCD = false; if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) @@ -172,9 +174,10 @@ namespace DiscImageChef.Filesystems public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information) { StringBuilder sbInformation = new StringBuilder(); + uint multiplier = (uint)(imagePlugin.ImageInfo.SectorSize == 256 ? 2 : 1); // Blocks 0 and 1 are boot code - byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSector(2 + partition.Start); + byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSectors(2 * multiplier + partition.Start, multiplier); bool APMFromHDDOnCD = false; @@ -204,11 +207,13 @@ namespace DiscImageChef.Filesystems } } - ProDOSRootDirectoryKeyBlock rootDirectoryKeyBlock = - new ProDOSRootDirectoryKeyBlock {header = new ProDOSRootDirectoryHeader()}; + ProDOSRootDirectoryKeyBlock rootDirectoryKeyBlock = new ProDOSRootDirectoryKeyBlock + { + header = new ProDOSRootDirectoryHeader(), + zero = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x00), + next_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x02) + }; - rootDirectoryKeyBlock.zero = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x00); - rootDirectoryKeyBlock.next_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x02); rootDirectoryKeyBlock.header.storage_type = (byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> 4); rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK);