diff --git a/CD/ATIP.cs b/CD/ATIP.cs index 32bbb6d..d9bd5c6 100644 --- a/CD/ATIP.cs +++ b/CD/ATIP.cs @@ -231,7 +231,7 @@ namespace DiscImageChef.Decoders.CD BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - if (CDATIPResponse.Length != 32) + if (CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28) { DicConsole.DebugWriteLine("CD ATIP decoder", "Expected CD ATIP size (32 bytes) is not received size ({0} bytes), not decoding", CDATIPResponse.Length); return null; @@ -267,17 +267,21 @@ namespace DiscImageChef.Decoders.CD decoded.A1Values = new byte[3]; decoded.A2Values = new byte[3]; decoded.A3Values = new byte[3]; - decoded.S4Values = new byte[3]; Array.Copy(CDATIPResponse, 16, decoded.A1Values, 0, 3); - Array.Copy(CDATIPResponse, 20, decoded.A1Values, 0, 3); - Array.Copy(CDATIPResponse, 24, decoded.A1Values, 0, 3); - Array.Copy(CDATIPResponse, 28, decoded.A1Values, 0, 3); + Array.Copy(CDATIPResponse, 20, decoded.A2Values, 0, 3); + Array.Copy(CDATIPResponse, 24, decoded.A3Values, 0, 3); decoded.Reserved7 = CDATIPResponse[19]; decoded.Reserved8 = CDATIPResponse[23]; decoded.Reserved9 = CDATIPResponse[27]; - decoded.Reserved10 = CDATIPResponse[31]; + + if (CDATIPResponse.Length >= 32) + { + decoded.S4Values = new byte[3]; + Array.Copy(CDATIPResponse, 28, decoded.S4Values, 0, 3); + decoded.Reserved10 = CDATIPResponse[31]; + } return decoded; } @@ -365,7 +369,8 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("A2 value: 0x{0:X6}", (response.A2Values[0] << 16) + (response.A2Values[1] << 8) + response.A2Values[2]).AppendLine(); if(response.A3Valid) sb.AppendFormat("A3 value: 0x{0:X6}", (response.A3Values[0] << 16) + (response.A3Values[1] << 8) + response.A3Values[2]).AppendLine(); - sb.AppendFormat("S4 value: 0x{0:X6}", (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]).AppendLine(); + if(response.S4Values != null) + sb.AppendFormat("S4 value: 0x{0:X6}", (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]).AppendLine(); } return sb.ToString(); diff --git a/CD/Session.cs b/CD/Session.cs index 24b00ec..cf6f9c4 100644 --- a/CD/Session.cs +++ b/CD/Session.cs @@ -158,11 +158,11 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); foreach (TrackDataDescriptor descriptor in response.TrackDescriptors) { - sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber); + sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber).AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, (descriptor.TrackStartAddress & 0x0000FF00) >> 8, (descriptor.TrackStartAddress & 0x00FF0000) >> 16, - (descriptor.TrackStartAddress & 0xFF000000) >> 24); + (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); switch ((TOC_ADR)descriptor.ADR) { diff --git a/CD/TOC.cs b/CD/TOC.cs index 08d9ad1..7ff0ebe 100644 --- a/CD/TOC.cs +++ b/CD/TOC.cs @@ -158,11 +158,14 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Last track number in last complete session: {0}", response.LastTrack).AppendLine(); foreach (CDTOCTrackDataDescriptor descriptor in response.TrackDescriptors) { - sb.AppendFormat("Track number: {0}", descriptor.TrackNumber); + if (descriptor.TrackNumber == 0xAA) + sb.AppendLine("Track number: Lead-Out"); + else + sb.AppendFormat("Track number: {0}", descriptor.TrackNumber).AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, (descriptor.TrackStartAddress & 0x0000FF00) >> 8, (descriptor.TrackStartAddress & 0x00FF0000) >> 16, - (descriptor.TrackStartAddress & 0xFF000000) >> 24); + (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); switch ((TOC_ADR)descriptor.ADR) { diff --git a/ChangeLog b/ChangeLog index 146cdee..fbd295f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2015-11-24 Natalia Portillo + + * CD/ATIP.cs: + ATIP not always contain S4. + Corrected typo. + + * CD/Session.cs: + Added missing newlines. + + * CD/TOC.cs: + Added missing newlines. + Recognize Lead-Out track. + + * SCSI/MMC/DiscInformation.cs: + Added structures for Disc Informations 001b and 010b. + 2015-11-23 Natalia Portillo * SCSI/Sense.cs: diff --git a/SCSI/MMC/DiscInformation.cs b/SCSI/MMC/DiscInformation.cs index 9e0ec88..f223f2c 100644 --- a/SCSI/MMC/DiscInformation.cs +++ b/SCSI/MMC/DiscInformation.cs @@ -56,7 +56,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC /// public static class DiscInformation { - public struct DiscInformationResponse + public struct StandardDiscInformation { /// /// Bytes 0 to 1 @@ -193,6 +193,89 @@ namespace DiscImageChef.Decoders.SCSI.MMC /// public byte[] OPCValues; } + + public struct TrackResourcesInformation + { + /// + /// Bytes 0 to 1 + /// 10 + /// + public UInt16 DataLength; + /// + /// Byte 2, bits 7 to 5 + /// 001b + /// + public byte DataType; + /// + /// Byte 2, bits 4 to 0 + /// Reserved + /// + public byte Reserved1; + /// + /// Byte 3 + /// Reserved + /// + public byte Reserved2; + /// + /// Bytes 4 to 5 + /// Maximum possible number of the tracks on the disc + /// + public UInt16 MaxTracks; + /// + /// Bytes 6 to 7 + /// Number of the assigned tracks on the disc + /// + public UInt16 AssignedTracks; + /// + /// Bytes 8 to 9 + /// Maximum possible number of appendable tracks on the disc + /// + public UInt16 MaxAppendableTracks; + /// + /// Bytes 10 to 11 + /// Current number of appendable tracks on the disc + /// + public UInt16 AppendableTracks; + } + + public struct POWResourcesInformation + { + /// + /// Bytes 0 to 1 + /// 14 + /// + public UInt16 DataLength; + /// + /// Byte 2, bits 7 to 5 + /// 010b + /// + public byte DataType; + /// + /// Byte 2, bits 4 to 0 + /// Reserved + /// + public byte Reserved1; + /// + /// Byte 3 + /// Reserved + /// + public byte Reserved2; + /// + /// Bytes 4 to 7 + /// Remaining POW replacements + /// + public UInt32 RemainingPOWReplacements; + /// + /// Bytes 8 to 11 + /// Remaining POW reallocation map entries + /// + public UInt32 RemainingPOWReallocation; + /// + /// Bytes 12 to 15 + /// Number of remaining POW updates + /// + public UInt32 RemainingPOWUpdates; + } } }