* DiscImageChef.DiscImages/CDRDAO.cs:

Corrected typo on audio track matching.

	* DiscImageChef.DiscImages/CDRWin.cs:
	  Corrected detection of images with CD-Text.
	Do not output partitions for index 0.

	* DiscImageChef.DiscImages/CopyQM.cs:
	  Do not create debug image output.

	* DiscImageChef.DiscImages/Nero.cs:
	  Added type for any dvd seen on old Nero version.
	Corrected handling of images where pregap is not indicated
	  (nonetheless, Nero stores them).
	Corrected handling of track 1 (Lead-In is stored there).
	Corrected session count in discs with 1 session.
	Do not add partitions of index 0.
	Corrected partition start offset of disc start.
	Guess disc type for old Nero discs.
	Corrected output of Mode2 sectors stored in RAW mode.
	Do not throw exceptions on values that should be returned
	  empty or null if not supported by image format.

	* DiscImageChef.Filesystems/FFS.cs:
	* DiscImageChef.Filesystems/BFS.cs:
	* DiscImageChef.Filesystems/ODS.cs:
	* DiscImageChef.Filesystems/FAT.cs:
	* DiscImageChef.Filesystems/APFS.cs:
	* DiscImageChef.Filesystems/NTFS.cs:
	* DiscImageChef.Filesystems/SysV.cs:
	* DiscImageChef.Filesystems/HPFS.cs:
	* DiscImageChef.Filesystems/Opera.cs:
	* DiscImageChef.Filesystems/Acorn.cs:
	* DiscImageChef.Filesystems/extFS.cs:
	* DiscImageChef.Filesystems/BTRFS.cs:
	* DiscImageChef.Filesystems/ext2FS.cs:
	* DiscImageChef.Filesystems/ProDOS.cs:
	* DiscImageChef.Filesystems/SolarFS.cs:
	* DiscImageChef.Filesystems/UNIXBFS.cs:
	* DiscImageChef.Filesystems/ISO9660.cs:
	* DiscImageChef.Filesystems/MinixFS.cs:
	* DiscImageChef.Filesystems/AmigaDOS.cs:
	* DiscImageChef.Filesystems/PCEngine.cs:
	* DiscImageChef.Filesystems/AppleHFS.cs:
	* DiscImageChef.Filesystems/AppleHFSPlus.cs:
	* DiscImageChef.Filesystems/AppleMFS/Info.cs:
	  Do not try to read past partition end.

	* DiscImageChef/Commands/CreateSidecar.cs:
	  Added points for skipping whole image checksum on debugging.
	Track starts at index 0.
This commit is contained in:
2016-08-08 18:44:08 +01:00
parent f5209500d8
commit 0de296b512
31 changed files with 225 additions and 82 deletions

View File

@@ -571,7 +571,7 @@ namespace DiscImageChef.ImagePlugins
ulong startSectors = 0;
if(MatchFile.Groups["start"].Value != "")
if(MatchAudioFile.Groups["start"].Value != "")
{
string[] startString = MatchAudioFile.Groups["start"].Value.Split(new char[] { ':' });
startSectors = ulong.Parse(startString[0]) * 60 * 75 + ulong.Parse(startString[1]) * 75 + ulong.Parse(startString[2]);
@@ -579,7 +579,7 @@ namespace DiscImageChef.ImagePlugins
currenttrack.trackfile.offset += (startSectors * currenttrack.bps);
if(MatchFile.Groups["length"].Value != "")
if(MatchAudioFile.Groups["length"].Value != "")
{
string[] lengthString = MatchAudioFile.Groups["length"].Value.Split(new char[] { ':' });
currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]);

View File

@@ -326,19 +326,22 @@ namespace DiscImageChef.ImagePlugins
Regex Rr = new Regex(CommentRegEx);
Regex Cr = new Regex(MCNRegEx);
Regex Fr = new Regex(FileRegEx);
Regex Tr = new Regex(CDTextRegEx);
Match Sm;
Match Rm;
Match Cm;
Match Fm;
Match Tm;
// First line must be SESSION, REM, CATALOG or FILE.
// First line must be SESSION, REM, CATALOG, FILE or CDTEXTFILE.
Sm = Sr.Match(_line);
Rm = Rr.Match(_line);
Cm = Cr.Match(_line);
Fm = Fr.Match(_line);
Tm = Tr.Match(_line);
if(!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success)
if(!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success && !Tm.Success)
return false;
return true;
}
@@ -1062,7 +1065,7 @@ namespace DiscImageChef.ImagePlugins
Partition partition = new Partition();
if(discimage.tracks[i].pregap > 0)
/*if(discimage.tracks[i].pregap > 0)
{
partition.PartitionDescription = string.Format("Track {0} pregap.", discimage.tracks[i].sequence);
partition.PartitionName = discimage.tracks[i].title;
@@ -1093,14 +1096,14 @@ namespace DiscImageChef.ImagePlugins
partitions.Add(partition);
partition = new Partition();
}
}*/
index_zero |= discimage.tracks[i].indexes.TryGetValue(0, out index_zero_offset);
if(!discimage.tracks[i].indexes.TryGetValue(1, out index_one_offset))
throw new ImageNotSupportedException(string.Format("Track {0} lacks index 01", discimage.tracks[i].sequence));
if(index_zero && index_one_offset > index_zero_offset)
/*if(index_zero && index_one_offset > index_zero_offset)
{
partition.PartitionDescription = string.Format("Track {0} index 00.", discimage.tracks[i].sequence);
partition.PartitionName = discimage.tracks[i].title;
@@ -1132,7 +1135,7 @@ namespace DiscImageChef.ImagePlugins
partitions.Add(partition);
partition = new Partition();
}
}*/
// Index 01
partition.PartitionDescription = string.Format("Track {0}.", discimage.tracks[i].sequence);

View File

@@ -1,3 +1,25 @@
2016-08-08 Natalia Portillo <claunia@claunia.com>
* CDRDAO.cs: Corrected typo on audio track matching.
* CDRWin.cs: Corrected detection of images with CD-Text.
Do not output partitions for index 0.
* CopyQM.cs: Do not create debug image output.
* Nero.cs: Added type for any dvd seen on old Nero version.
Corrected handling of images where pregap is not indicated
(nonetheless, Nero stores them).
Corrected handling of track 1 (Lead-In is stored there).
Corrected session count in discs with 1 session.
Do not add partitions of index 0.
Corrected partition start offset of disc start.
Guess disc type for old Nero discs.
Corrected output of Mode2 sectors stored in RAW mode.
Do not throw exceptions on values that should be returned
empty or null if not supported by image format.
2016-08-07 Natalia Portillo <claunia@claunia.com>
* DiscImageChef.DiscImages.csproj: Public beta release

View File

@@ -300,9 +300,9 @@ namespace DiscImageChef.ImagePlugins
decodedImage.Write(filling, 0, filling.Length);
}
/*FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite);
FileStream debugStream = new FileStream("debug.img", FileMode.CreateNew, FileAccess.ReadWrite);
debugStream.Write(decodedImage.ToArray(), 0, (int)decodedImage.Length);
debugStream.Close();*/
debugStream.Close();
int sum = 0;
for(int i = 0; i < hdr.Length - 1; i++)

View File

@@ -824,6 +824,10 @@ namespace DiscImageChef.ImagePlugins
/// Any HD DVD
/// </summary>
NERO_MTYP_HD_DVD_ANY = NERO_MTYP_HD_DVD | NERO_MTYP_HD_DVD_ROM,
/// <summary>
/// Any DVD, old
/// </summary>
NERO_MTYP_DVD_ANY_OLD = NERO_MTYP_DVD_M | NERO_MTYP_DVD_P | NERO_MTYP_DVD_RAM,
}
#endregion
@@ -1119,6 +1123,8 @@ namespace DiscImageChef.ImagePlugins
ImageInfo.sectorSize = _entry.SectorSize;
TrackISRCs.Add(currenttrack, _entry.ISRC);
if(currenttrack == 1)
_entry.Index0 = _entry.Index1;
NeroTrack _neroTrack = new NeroTrack();
_neroTrack.EndOfTrack = _entry.EndOfTrack;
@@ -1203,6 +1209,9 @@ namespace DiscImageChef.ImagePlugins
TrackISRCs.Add(currenttrack, _entry.ISRC);
if(currenttrack == 1)
_entry.Index0 = _entry.Index1;
NeroTrack _neroTrack = new NeroTrack();
_neroTrack.EndOfTrack = _entry.EndOfTrack;
_neroTrack.ISRC = _entry.ISRC;
@@ -1507,6 +1516,7 @@ namespace DiscImageChef.ImagePlugins
uint currentsessioncurrenttrack = 1;
Session currentsessionstruct = new Session();
ulong PartitionSequence = 0;
ulong partitionStartByte = 0;
for(uint i = 1; i <= neroTracks.Count; i++)
{
NeroTrack _neroTrack;
@@ -1517,19 +1527,21 @@ namespace DiscImageChef.ImagePlugins
DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessioncurrenttrack = {0}", currentsessioncurrenttrack);
Track _track = new Track();
if(_neroTrack.Sequence == 1)
_neroTrack.Index0 = _neroTrack.Index1;
_track.Indexes = new Dictionary<int, ulong>();
if(_neroTrack.Index0 < _neroTrack.Index1)
_track.Indexes.Add(0, _neroTrack.Index0 / _neroTrack.SectorSize);
_track.Indexes.Add(1, _neroTrack.Index1 / _neroTrack.SectorSize);
_track.TrackDescription = StringHandlers.CToString(_neroTrack.ISRC);
_track.TrackEndSector = (_neroTrack.EndOfTrack / _neroTrack.SectorSize) - 1;
_track.TrackEndSector = (_neroTrack.Length / _neroTrack.SectorSize) + _neroTrack.StartLBA - 1;
_track.TrackPregap = (_neroTrack.Index1 - _neroTrack.Index0) / _neroTrack.SectorSize;
_track.TrackSequence = _neroTrack.Sequence;
_track.TrackSession = currentsession;
_track.TrackStartSector = _neroTrack.StartLBA;
_track.TrackType = NeroTrackModeToTrackType((DAOMode)_neroTrack.Mode);
imageTracks.Add(_track);
_track.TrackFile = _imagePath;
_track.TrackFile = imagePath;
_track.TrackFileOffset = _neroTrack.Offset;
_track.TrackFileType = "BINARY";
_track.TrackSubchannelType = TrackSubchannelType.None;
@@ -1579,6 +1591,8 @@ namespace DiscImageChef.ImagePlugins
_track.TrackSubchannelOffset = _neroTrack.Offset;
}
imageTracks.Add(_track);
DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackDescription = {0}", _track.TrackDescription);
DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackEndSector = {0}", _track.TrackEndSector);
DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackPregap = {0}", _track.TrackPregap);
@@ -1605,12 +1619,21 @@ namespace DiscImageChef.ImagePlugins
imageSessions.Add(currentsessionstruct);
}
if(i == neroTracks.Count)
{
neroSessions.TryGetValue(currentsession, out currentsessionmaxtrack);
currentsessioncurrenttrack = 1;
currentsessionstruct.EndTrack = _track.TrackSequence;
currentsessionstruct.EndSector = _track.TrackEndSector;
imageSessions.Add(currentsessionstruct);
}
offsetmap.Add(_track.TrackSequence, _track.TrackStartSector);
DicConsole.DebugWriteLine("Nero plugin", "\t\t Offset[{0}]: {1}", _track.TrackSequence, _track.TrackStartSector);
Partition partition;
if(_neroTrack.Index0 < _neroTrack.Index1)
/*if(_neroTrack.Index0 < _neroTrack.Index1)
{
partition = new Partition();
partition.PartitionDescription = string.Format("Track {0} Index 0", _track.TrackSequence);
@@ -1623,7 +1646,7 @@ namespace DiscImageChef.ImagePlugins
partition.PartitionType = NeroTrackModeToTrackType((DAOMode)_neroTrack.Mode).ToString();
ImagePartitions.Add(partition);
PartitionSequence++;
}
}*/
partition = new Partition();
partition.PartitionDescription = string.Format("Track {0} Index 1", _track.TrackSequence);
@@ -1631,17 +1654,64 @@ namespace DiscImageChef.ImagePlugins
partition.PartitionName = StringHandlers.CToString(_neroTrack.ISRC);
partition.PartitionSectors = partition.PartitionLength / _neroTrack.SectorSize;
partition.PartitionSequence = PartitionSequence;
partition.PartitionStart = _neroTrack.Index1;
partition.PartitionStart = partitionStartByte;
partition.PartitionStartSector = _neroTrack.StartLBA + ((_neroTrack.Index1 - _neroTrack.Index0) / _neroTrack.SectorSize);
partition.PartitionType = NeroTrackModeToTrackType((DAOMode)_neroTrack.Mode).ToString();
ImagePartitions.Add(partition);
PartitionSequence++;
partitionStartByte += partition.PartitionLength;
}
}
_imagePath = imagePath;
imageStream.Close();
if(ImageInfo.mediaType == MediaType.Unknown || ImageInfo.mediaType == MediaType.CD)
{
bool data = false;
bool mode2 = false;
bool firstaudio = false;
bool firstdata = false;
bool audio = false;
for(uint i = 0; i < neroTracks.Count; i++)
{
// First track is audio
firstaudio |= i == 0 && ((DAOMode)neroTracks[i].Mode == DAOMode.Audio || (DAOMode)neroTracks[i].Mode == DAOMode.AudioSub);
// First track is data
firstdata |= i == 0 && ((DAOMode)neroTracks[i].Mode != DAOMode.Audio && (DAOMode)neroTracks[i].Mode != DAOMode.AudioSub);
// Any non first track is data
data |= i != 0 && ((DAOMode)neroTracks[i].Mode != DAOMode.Audio && (DAOMode)neroTracks[i].Mode != DAOMode.AudioSub);
// Any non first track is audio
audio |= i != 0 && ((DAOMode)neroTracks[i].Mode == DAOMode.Audio || (DAOMode)neroTracks[i].Mode == DAOMode.AudioSub);
switch((DAOMode)neroTracks[i].Mode)
{
case DAOMode.DataM2F1:
case DAOMode.DataM2F2:
case DAOMode.DataM2Raw:
case DAOMode.DataM2RawSub:
mode2 = true;
break;
}
}
if(!data && !firstdata)
ImageInfo.mediaType = MediaType.CDDA;
else if(firstaudio && data && imageSessions.Count > 1 && mode2)
ImageInfo.mediaType = MediaType.CDPLUS;
else if((firstdata && audio) || mode2)
ImageInfo.mediaType = MediaType.CDROMXA;
else if(!audio)
ImageInfo.mediaType = MediaType.CDROM;
else
ImageInfo.mediaType = MediaType.CD;
}
ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc;
return true;
@@ -1754,7 +1824,7 @@ namespace DiscImageChef.ImagePlugins
throw new ArgumentOutOfRangeException(nameof(track), "Track not found");
if(length > _track.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks");
throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors));
uint sector_offset;
uint sector_size;
@@ -1793,9 +1863,9 @@ namespace DiscImageChef.ImagePlugins
}
case DAOMode.DataM2Raw:
{
sector_offset = 24;
sector_size = 2324;
sector_skip = 4;
sector_offset = 16;
sector_size = 2336;
sector_skip = 0;
break;
}
// TODO: Supposing Nero suffixes the subchannel to the channel
@@ -1808,9 +1878,9 @@ namespace DiscImageChef.ImagePlugins
}
case DAOMode.DataM2RawSub:
{
sector_offset = 24;
sector_size = 2324;
sector_skip = 4 + 96;
sector_offset = 16;
sector_size = 2336;
sector_skip = 96;
break;
}
case DAOMode.AudioSub:
@@ -1857,7 +1927,7 @@ namespace DiscImageChef.ImagePlugins
throw new ArgumentOutOfRangeException(nameof(track), "Track not found");
if(length > _track.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks");
throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors));
uint sector_offset;
uint sector_size;
@@ -2123,7 +2193,7 @@ namespace DiscImageChef.ImagePlugins
throw new ArgumentOutOfRangeException(nameof(track), "Track not found");
if(length > _track.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than present in track, won't cross tracks");
throw new ArgumentOutOfRangeException(nameof(length), string.Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", length, _track.Sectors));
uint sector_offset;
uint sector_size;
@@ -2368,6 +2438,9 @@ namespace DiscImageChef.ImagePlugins
case NeroMediaTypes.NERO_MTYP_CDR:
return MediaType.CDR;
case NeroMediaTypes.NERO_MTYP_DVD_ROM:
case NeroMediaTypes.NERO_MTYP_DVD_ANY:
case NeroMediaTypes.NERO_MTYP_DVD_ANY_R9:
case NeroMediaTypes.NERO_MTYP_DVD_ANY_OLD:
return MediaType.DVDROM;
case NeroMediaTypes.NERO_MTYP_CDROM:
return MediaType.CDROM;
@@ -2451,62 +2524,62 @@ namespace DiscImageChef.ImagePlugins
public override int GetMediaSequence()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.mediaSequence;
}
public override int GetLastDiskSequence()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.lastMediaSequence;
}
public override string GetDriveManufacturer()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.driveManufacturer;
}
public override string GetDriveModel()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.driveModel;
}
public override string GetDriveSerialNumber()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.driveSerialNumber;
}
public override string GetMediaPartNumber()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.mediaPartNumber;
}
public override string GetMediaManufacturer()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.mediaManufacturer;
}
public override string GetMediaModel()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.mediaModel;
}
public override string GetImageName()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.imageName;
}
public override string GetImageCreator()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.imageCreator;
}
public override string GetImageComments()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.imageComments;
}
public override string GetMediaSerialNumber()
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
return ImageInfo.mediaSerialNumber;
}
#endregion