mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Try to solve pregaps when drive+disc combination returns wrong Q positioning and report this has been the case.
This commit is contained in:
@@ -344,7 +344,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
if(tracks is null)
|
if(tracks is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SolveTrackPregaps(_dev, _dumpLog, UpdateStatus, tracks, supportsPqSubchannel, supportsRwSubchannel, _dbDev);
|
SolveTrackPregaps(_dev, _dumpLog, UpdateStatus, tracks, supportsPqSubchannel, supportsRwSubchannel, _dbDev,
|
||||||
|
out bool inexactPositioning);
|
||||||
|
|
||||||
|
if(inexactPositioning)
|
||||||
|
{
|
||||||
|
_dumpLog.WriteLine("WARNING: The drive has returned incorrect Q positioning when calculating pregaps. A best effort has been tried but they may be incorrect.");
|
||||||
|
|
||||||
|
UpdateStatus?.
|
||||||
|
Invoke("WARNING: The drive has returned incorrect Q positioning when calculating pregaps. A best effort has been tried but they may be incorrect.");
|
||||||
|
}
|
||||||
|
|
||||||
for(int t = 1; t < tracks.Length; t++)
|
for(int t = 1; t < tracks.Length; t++)
|
||||||
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
|
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
|
||||||
|
|||||||
@@ -123,16 +123,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
public static void SolveTrackPregaps(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus,
|
public static void SolveTrackPregaps(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus,
|
||||||
Track[] tracks, bool supportsPqSubchannel, bool supportsRwSubchannel,
|
Track[] tracks, bool supportsPqSubchannel, bool supportsRwSubchannel,
|
||||||
Database.Models.Device dbDev)
|
Database.Models.Device dbDev, out bool inexactPositioning)
|
||||||
{
|
{
|
||||||
bool sense; // Sense indicator
|
bool sense; // Sense indicator
|
||||||
byte[] cmdBuf; // Data buffer
|
|
||||||
byte[] subBuf;
|
byte[] subBuf;
|
||||||
int posQ;
|
int posQ;
|
||||||
uint retries;
|
uint retries;
|
||||||
bool? bcd = null;
|
bool? bcd = null;
|
||||||
byte[] crc;
|
byte[] crc;
|
||||||
Dictionary<uint, int> pregaps = new Dictionary<uint, int>();
|
Dictionary<uint, int> pregaps = new Dictionary<uint, int>();
|
||||||
|
inexactPositioning = false;
|
||||||
|
|
||||||
if(!supportsPqSubchannel &&
|
if(!supportsPqSubchannel &&
|
||||||
!supportsRwSubchannel)
|
!supportsRwSubchannel)
|
||||||
@@ -296,6 +296,14 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
// Pregap according to Q position
|
// Pregap according to Q position
|
||||||
int pregapQ = (subBuf[3] * 60 * 75) + (subBuf[4] * 75) + subBuf[5] + 1;
|
int pregapQ = (subBuf[3] * 60 * 75) + (subBuf[4] * 75) + subBuf[5] + 1;
|
||||||
|
posQ = ((subBuf[7] * 60 * 75) + (subBuf[8] * 75) + subBuf[9]) - 150;
|
||||||
|
int diff = posQ - lba;
|
||||||
|
|
||||||
|
if(diff != 0)
|
||||||
|
{
|
||||||
|
inexactPositioning = true;
|
||||||
|
pregapQ += diff;
|
||||||
|
}
|
||||||
|
|
||||||
// Bigger than known change, otherwise we found it
|
// Bigger than known change, otherwise we found it
|
||||||
if(pregapQ > pregaps[track.TrackSequence])
|
if(pregapQ > pregaps[track.TrackSequence])
|
||||||
|
|||||||
@@ -559,7 +559,8 @@ namespace DiscImageChef.Commands.Media
|
|||||||
ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model &&
|
ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model &&
|
||||||
d.Revision == dev.Revision);
|
d.Revision == dev.Revision);
|
||||||
|
|
||||||
Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev);
|
Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev,
|
||||||
|
out bool inexactPositioning);
|
||||||
|
|
||||||
for(int t = 1; t < tracks.Length; t++)
|
for(int t = 1; t < tracks.Length; t++)
|
||||||
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
|
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
|
||||||
@@ -569,6 +570,10 @@ namespace DiscImageChef.Commands.Media
|
|||||||
DicConsole.WriteLine();
|
DicConsole.WriteLine();
|
||||||
DicConsole.WriteLine("Track calculations:");
|
DicConsole.WriteLine("Track calculations:");
|
||||||
|
|
||||||
|
if(inexactPositioning)
|
||||||
|
DicConsole.
|
||||||
|
WriteLine("WARNING: The drive has returned incorrect Q positioning when calculating pregaps. A best effort has been tried but they may be incorrect.");
|
||||||
|
|
||||||
foreach(Track track in tracks)
|
foreach(Track track in tracks)
|
||||||
DicConsole.
|
DicConsole.
|
||||||
WriteLine("Track {0} starts at LBA {1}, ends at LBA {2}, has a pregap of {3} sectors and is of type {4}",
|
WriteLine("Track {0} starts at LBA {1}, ends at LBA {2}, has a pregap of {3} sectors and is of type {4}",
|
||||||
|
|||||||
Reference in New Issue
Block a user