diff --git a/DiscImageChef.DiscImages/ChangeLog b/DiscImageChef.DiscImages/ChangeLog index 8c9b89da0..2a899e6d8 100644 --- a/DiscImageChef.DiscImages/ChangeLog +++ b/DiscImageChef.DiscImages/ChangeLog @@ -1,3 +1,9 @@ +2016-09-07 Natalia Portillo + + * NDIF.cs: + * UDIF.cs: Added new possible compression algorithms and field + names from DiskImages.framework. + 2016-09-06 Natalia Portillo * NDIF.cs: diff --git a/DiscImageChef.DiscImages/NDIF.cs b/DiscImageChef.DiscImages/NDIF.cs index 4077d404b..7730fa20e 100644 --- a/DiscImageChef.DiscImages/NDIF.cs +++ b/DiscImageChef.DiscImages/NDIF.cs @@ -42,12 +42,10 @@ using DiscImageChef.ImagePlugins; namespace DiscImageChef.DiscImages { - // TODO: Detect ShrinkWrap encrypted images // TODO: Detect OS X encrypted images // TODO: Check checksum // TODO: Implement segments // TODO: Implement compression - // TODO: Get application version from "vers" resource public class NDIF : ImagePlugin { #region Internal constants @@ -66,11 +64,11 @@ namespace DiscImageChef.DiscImages struct ChunkHeader { /// - /// Type? All OS X generated ones are 12, all DiskCopy 6.3.3 RdWr are 10 but rest are 12 + /// Version /// public short version; /// - /// Driver? Changes with driver + /// Filesystem ID /// public short driver; /// @@ -83,13 +81,13 @@ namespace DiscImageChef.DiscImages /// public uint sectors; /// - /// Size of buffer, in sectors, for compression/decompression + /// Maximum number of sectors per chunk /// - public uint bufferSize; + public uint maxSectorsPerChunk; /// /// Always 0? /// - public uint zero; + public uint zeroOffset; /// /// CRC28 of whole image /// @@ -99,9 +97,17 @@ namespace DiscImageChef.DiscImages /// public uint segmented; /// + /// Unknown + /// + public uint p1; + /// + /// Unknown + /// + public uint p2; + /// /// Unknown, spare? /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] unknown; /// /// Set to 1 by ShrinkWrap if image is encrypted @@ -166,6 +172,8 @@ namespace DiscImageChef.DiscImages const byte ChunkType_NoCopy = 0; const byte ChunkType_Copy = 2; const byte ChunkType_KenCode = 0x80; + const byte ChunkType_RLE = 0x81; + const byte ChunkType_LZH = 0x82; const byte ChunkType_ADC = 0x83; /// /// Created by ShrinkWrap 3.5, dunno which version of the StuffIt algorithm it is using @@ -276,17 +284,17 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("NDIF plugin", "footer.driver = {0}", header.driver); DicConsole.DebugWriteLine("NDIF plugin", "footer.name = {0}", StringHandlers.PascalToString(header.name)); DicConsole.DebugWriteLine("NDIF plugin", "footer.sectors = {0}", header.sectors); - DicConsole.DebugWriteLine("NDIF plugin", "footer.bufferSize = {0}", header.bufferSize); - DicConsole.DebugWriteLine("NDIF plugin", "footer.zero = {0}", header.zero); + DicConsole.DebugWriteLine("NDIF plugin", "footer.maxSectorsPerChunk = {0}", header.maxSectorsPerChunk); + DicConsole.DebugWriteLine("NDIF plugin", "footer.zeroOffset = {0}", header.zeroOffset); DicConsole.DebugWriteLine("NDIF plugin", "footer.crc = 0x{0:X7}", header.crc); DicConsole.DebugWriteLine("NDIF plugin", "footer.segmented = {0}", header.segmented); + DicConsole.DebugWriteLine("NDIF plugin", "footer.p1 = 0x{0:X8}", header.p1); + DicConsole.DebugWriteLine("NDIF plugin", "footer.p2 = 0x{0:X8}", header.p2); DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[0] = 0x{0:X8}", header.unknown[0]); DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[1] = 0x{0:X8}", header.unknown[1]); DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[2] = 0x{0:X8}", header.unknown[2]); DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[3] = 0x{0:X8}", header.unknown[3]); DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[4] = 0x{0:X8}", header.unknown[4]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[5] = 0x{0:X8}", header.unknown[5]); - DicConsole.DebugWriteLine("NDIF plugin", "footer.unknown[6] = 0x{0:X8}", header.unknown[6]); DicConsole.DebugWriteLine("NDIF plugin", "footer.encrypted = {0}", header.encrypted); DicConsole.DebugWriteLine("NDIF plugin", "footer.hash = 0x{0:X8}", header.hash); DicConsole.DebugWriteLine("NDIF plugin", "footer.chunks = {0}", header.chunks); diff --git a/DiscImageChef.DiscImages/UDIF.cs b/DiscImageChef.DiscImages/UDIF.cs index 2568b830e..fd4ab0e24 100644 --- a/DiscImageChef.DiscImages/UDIF.cs +++ b/DiscImageChef.DiscImages/UDIF.cs @@ -52,15 +52,18 @@ namespace DiscImageChef.DiscImages // All chunk types with this mask are compressed const uint ChunkType_CompressedMask = 0x80000000; - const uint ChunkType_Zero = 0x00000000; - const uint ChunkType_Copy = 0x00000001; - const uint ChunkType_NoCopy = 0x00000002; - const uint ChunkType_ADC = 0x80000004; - const uint ChunkType_Zlib = 0x80000005; - const uint ChunkType_Bzip = 0x80000006; - const uint ChunkType_LZFSE = 0x80000007; - const uint ChunkType_Commnt = 0x7FFFFFFF; - const uint ChunkType_End = 0xFFFFFFFF; + const uint ChunkType_Zero = 0x00000000; + const uint ChunkType_Copy = 0x00000001; + const uint ChunkType_NoCopy = 0x00000002; + const uint ChunkType_KenCode = 0x80000001; + const uint ChunkType_RLE = 0x80000002; + const uint ChunkType_LZH = 0x80000003; + const uint ChunkType_ADC = 0x80000004; + const uint ChunkType_Zlib = 0x80000005; + const uint ChunkType_Bzip = 0x80000006; + const uint ChunkType_LZFSE = 0x80000007; + const uint ChunkType_Commnt = 0x7FFFFFFF; + const uint ChunkType_End = 0xFFFFFFFF; const string ResourceForkKey = "resource-fork"; const string BlockKey = "blkx"; @@ -518,10 +521,7 @@ namespace DiscImageChef.DiscImages if(!chunkFound) throw new ArgumentOutOfRangeException(nameof(sectorAddress), string.Format("Sector address {0} not found", sectorAddress)); - if(currentChunk.type == ChunkType_Zero) - throw new ImageNotSupportedException("Dunno how to handle ZERO chunk type, please fill issue and send image."); - - if(currentChunk.type == ChunkType_NoCopy) + if(currentChunk.type == ChunkType_NoCopy || currentChunk.type == ChunkType_Zero) { sector = new byte[sectorSize];