mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add option to fix CD audio track offsets.
This commit is contained in:
@@ -1311,6 +1311,48 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Invoke("There will be thousand of errors between track 0 and track 1, that is normal and you can ignore them.");
|
||||
}
|
||||
|
||||
// Check offset
|
||||
if(_fixOffset)
|
||||
{
|
||||
// TODO: Plextor raw reading
|
||||
// TODO: HL-DT-ST raw reading
|
||||
// TODO: VideoNow
|
||||
|
||||
if(tracks.All(t => t.TrackType != TrackType.Audio))
|
||||
{
|
||||
// No audio tracks so no need to fix offset
|
||||
_dumpLog.WriteLine("No audio tracks, disabling offset fix.");
|
||||
UpdateStatus?.Invoke("No audio tracks, disabling offset fix.");
|
||||
|
||||
_fixOffset = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cdOffset is null)
|
||||
{
|
||||
_dumpLog.
|
||||
WriteLine("Drive read offset is unknown, disabling offset fix. Dump may not be correct.");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke("Drive read offset is unknown, disabling offset fix. Dump may not be correct.");
|
||||
|
||||
_fixOffset = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Calculate offset in bytes
|
||||
|
||||
_dumpLog.WriteLine("Disc write offset is unknown, dump may not be correct.");
|
||||
UpdateStatus?.Invoke("Disc write offset is unknown, dump may not be correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(tracks.Any(t => t.TrackType == TrackType.Audio))
|
||||
{
|
||||
_dumpLog.WriteLine("There are audio tracks and offset fixing is disabled, dump may not be correct.");
|
||||
UpdateStatus?.Invoke("There are audio tracks and offset fixing is disabled, dump may not be correct.");
|
||||
}
|
||||
|
||||
mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0008);
|
||||
|
||||
@@ -1321,6 +1363,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
// TODO: Apply offset
|
||||
for(long i = (long)_resume.NextBlock; i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
if(_aborted)
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
readonly bool _stopOnError;
|
||||
bool _aborted;
|
||||
bool _dumpFirstTrackPregap;
|
||||
bool _fixOffset;
|
||||
Resume _resume;
|
||||
Sidecar _sidecarClass;
|
||||
uint _skip;
|
||||
@@ -61,7 +62,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
public Dump(bool doResume, Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
||||
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)
|
||||
CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim, bool dumpFirstTrackPregap,
|
||||
bool fixOffset)
|
||||
{
|
||||
_doResume = doResume;
|
||||
_dev = dev;
|
||||
@@ -84,6 +86,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
_notrim = notrim;
|
||||
_dumpFirstTrackPregap = dumpFirstTrackPregap;
|
||||
_aborted = false;
|
||||
_fixOffset = fixOffset;
|
||||
}
|
||||
|
||||
/// <summary>Starts dumping with the stablished fields and autodetecting the device type</summary>
|
||||
|
||||
@@ -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);
|
||||
chkTrack1Pregap.Checked == true, true);
|
||||
|
||||
new Thread(DoWork).Start();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace DiscImageChef.Commands
|
||||
bool _doResume = true;
|
||||
string _encodingName;
|
||||
bool _firstTrackPregap;
|
||||
bool _fixOffset;
|
||||
bool _force;
|
||||
bool _noMetadata;
|
||||
bool _noTrim;
|
||||
@@ -91,6 +92,9 @@ namespace DiscImageChef.Commands
|
||||
Options.Add("first-pregap", "Try to read first track pregap. Only applicable to CD/DDCD/GD.",
|
||||
b => _firstTrackPregap = b != null);
|
||||
|
||||
Options.Add("fix-offset", "Fix audio tracks offset. Only applicable to CD/GD.",
|
||||
b => _fixOffset = b != null);
|
||||
|
||||
Options.Add("force|f", "Continue dump whatever happens.", b => _force = b != null);
|
||||
|
||||
Options.Add("format|t=",
|
||||
@@ -339,7 +343,7 @@ 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);
|
||||
sidecar, (uint)_skip, _noMetadata, _noTrim, _firstTrackPregap, _fixOffset);
|
||||
|
||||
dumper.UpdateStatus += Progress.UpdateStatus;
|
||||
dumper.ErrorMessage += Progress.ErrorMessage;
|
||||
|
||||
Reference in New Issue
Block a user