Fix setting first track type.

This commit is contained in:
2019-12-31 01:35:49 +00:00
parent d1e78b69f9
commit d6ddb3c46a

View File

@@ -83,13 +83,13 @@ namespace DiscImageChef.Core.Devices.Dumping
double currentSpeed = 0; // Current read speed double currentSpeed = 0; // Current read speed
DateTime dumpStart = DateTime.UtcNow; // Time of dump start DateTime dumpStart = DateTime.UtcNow; // Time of dump start
DateTime end; // Time of operation end DateTime end; // Time of operation end
ExtentsULong extents = null; // Extents ExtentsULong extents = null; // Extents
TrackType firstTrackType = TrackType.Audio; // Type of first track
IbgLog ibgLog; // IMGBurn log IbgLog ibgLog; // IMGBurn log
double imageWriteDuration = 0; // Duration of image write double imageWriteDuration = 0; // Duration of image write
long lastSector = 0; // Last sector number long lastSector = 0; // Last sector number
var leadOutExtents = new ExtentsULong(); // Lead-out extents var leadOutExtents = new ExtentsULong(); // Lead-out extents
Dictionary<int, long> leadOutStarts = new Dictionary<int, long>(); // Lead-out starts Dictionary<int, long> leadOutStarts = new Dictionary<int, long>(); // Lead-out starts
TrackType leadoutTrackType = TrackType.Audio; // Type of lead-out
double maxSpeed = double.MinValue; // Maximum speed double maxSpeed = double.MinValue; // Maximum speed
MhddLog mhddLog; // MHDD log MhddLog mhddLog; // MHDD log
double minSpeed = double.MaxValue; // Minimum speed double minSpeed = double.MaxValue; // Minimum speed
@@ -455,7 +455,7 @@ namespace DiscImageChef.Core.Devices.Dumping
break; break;
} }
firstTrackType = leadoutTrackType =
(TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data
: TrackType.Audio; : TrackType.Audio;
@@ -500,7 +500,7 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
else if(trk.TrackNumber == 0xAA) else if(trk.TrackNumber == 0xAA)
{ {
firstTrackType = leadoutTrackType =
(TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data
: TrackType.Audio; : TrackType.Audio;
@@ -516,13 +516,13 @@ namespace DiscImageChef.Core.Devices.Dumping
trackList.Add(new Track trackList.Add(new Track
{ {
TrackSequence = 1, TrackSession = 1, TrackType = firstTrackType, TrackSequence = 1, TrackSession = 1, TrackType = leadoutTrackType,
TrackStartSector = 0, TrackStartSector = 0,
TrackBytesPerSector = (int)sectorSize, TrackRawBytesPerSector = (int)sectorSize, TrackBytesPerSector = (int)sectorSize, TrackRawBytesPerSector = (int)sectorSize,
TrackSubchannelType = subType TrackSubchannelType = subType
}); });
trackFlags.Add(1, (byte)(firstTrackType == TrackType.Audio ? 0 : 4)); trackFlags.Add(1, (byte)(leadoutTrackType == TrackType.Audio ? 0 : 4));
} }
if(lastSector == 0) if(lastSector == 0)
@@ -1533,7 +1533,7 @@ namespace DiscImageChef.Core.Devices.Dumping
ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0008); ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0008);
audioExtents = new ExtentsULong(); audioExtents = new ExtentsULong();
nextData = firstTrackType != TrackType.Audio; nextData = tracks[0].TrackType != TrackType.Audio;
foreach(Track audioTrack in tracks.Where(t => t.TrackType == TrackType.Audio)) foreach(Track audioTrack in tracks.Where(t => t.TrackType == TrackType.Audio))
{ {