Check offset using HL-DT-ST bug command.

This commit is contained in:
2019-12-26 00:48:21 +00:00
parent 284b59bea6
commit 69dcbbd877
4 changed files with 35 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <summary>Implement dumping Compact Discs</summary>
// TODO: Barcode and pregaps
// TODO: Repetitive code
partial class Dump
{
/// <summary>Dumps a compact disc</summary>
@@ -1321,7 +1322,6 @@ namespace DiscImageChef.Core.Devices.Dumping
// Check offset
if(_fixOffset)
{
// TODO: HL-DT-ST raw reading
// TODO: VideoNow
if(tracks.All(t => t.TrackType != TrackType.Audio))
@@ -1403,6 +1403,34 @@ namespace DiscImageChef.Core.Devices.Dumping
}
}
}
if(_debug ||
dbDev?.ATAPI?.RemovableMedias?.Any(d => d.CanReadCdScrambled == true) == true ||
dbDev?.SCSI?.RemovableMedias?.Any(d => d.CanReadCdScrambled == true) == true ||
_dev.Manufacturer.ToLowerInvariant() == "hl-dt-st")
{
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(dataTrack.TrackEndSector - 2),
sectorSize, 3, MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false, MmcErrorField.None,
MmcSubchannel.None, _dev.Timeout, out _);
if(!sense &&
!_dev.Error)
{
for(int i = 0; i < cmdBuf.Length - sectorSync.Length; i++)
{
Array.Copy(cmdBuf, i, tmpBuf, 0, sectorSync.Length);
if(!tmpBuf.SequenceEqual(sectorSync))
continue;
offsetBytes = i - 2352;
offsetFound = true;
break;
}
}
}
}
}

View File

@@ -32,6 +32,7 @@ namespace DiscImageChef.Core.Devices.Dumping
readonly ushort _retryPasses;
readonly bool _stopOnError;
bool _aborted;
readonly bool _debug;
bool _dumpFirstTrackPregap;
bool _fixOffset;
Resume _resume;
@@ -63,7 +64,7 @@ namespace DiscImageChef.Core.Devices.Dumping
bool force, bool dumpRaw, bool persistent, bool stopOnError, Resume resume, DumpLog dumpLog,
Encoding encoding, string outputPrefix, string outputPath, Dictionary<string, string> formatOptions,
CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim, bool dumpFirstTrackPregap,
bool fixOffset)
bool fixOffset, bool debug)
{
_doResume = doResume;
_dev = dev;
@@ -87,6 +88,7 @@ namespace DiscImageChef.Core.Devices.Dumping
_dumpFirstTrackPregap = dumpFirstTrackPregap;
_aborted = false;
_fixOffset = fixOffset;
_debug = debug;
}
/// <summary>Starts dumping with the stablished fields and autodetecting the device type</summary>

View File

@@ -527,7 +527,7 @@ namespace DiscImageChef.Gui.Forms
chkStopOnError.Checked == true, _resume, dumpLog, encoding, _outputPrefix,
txtDestination.Text, parsedOptions, _sidecar, (uint)stpSkipped.Value,
chkExistingMetadata.Checked == false, chkTrim.Checked == false,
chkTrack1Pregap.Checked == true, true);
chkTrack1Pregap.Checked == true, true, false);
new Thread(DoWork).Start();
}

View File

@@ -343,7 +343,8 @@ namespace DiscImageChef.Commands
var dumper = new Dump(_doResume, dev, _devicePath, outputFormat, _retryPasses, _force, false, _persistent,
_stopOnError, resume, dumpLog, encoding, outputPrefix, _outputFile, parsedOptions,
sidecar, (uint)_skip, _noMetadata, _noTrim, _firstTrackPregap, _fixOffset);
sidecar, (uint)_skip, _noMetadata, _noTrim, _firstTrackPregap, _fixOffset,
MainClass.Debug);
dumper.UpdateStatus += Progress.UpdateStatus;
dumper.ErrorMessage += Progress.ErrorMessage;