mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Check if offset fixing could not cross into Lead-Out.
This commit is contained in:
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -3,10 +3,8 @@
|
||||
<component name="ContentModelStore">
|
||||
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
||||
<e p="$APPLICATION_PLUGINS_DIR$/puppet/lib/stubs" t="IncludeRecursive" />
|
||||
<e p="$APPLICATION_CONFIG_DIR$/scratches" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.Rider2019.3/system/extResources" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.Rider2019.3/system/resharper-host/local/Transient/ReSharperHost/v193/SolutionCaches/_DiscImageChef.-1491758497.00" t="ExcludeRecursive" />
|
||||
<e p="$USER_HOME$/.config/git/ignore" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.nuget/packages/sqlitepclraw.lib.e_sqlite3.linux/1.1.12/runtimes/linux-x64/native/libe_sqlite3.so" t="Include" />
|
||||
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
||||
<e p=".git/info/exclude" t="IncludeRecursive" />
|
||||
|
||||
@@ -97,6 +97,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
bool crossingLeadOut = false;
|
||||
bool failedCrossingLeadOut = false;
|
||||
|
||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
if(_aborted)
|
||||
@@ -118,8 +121,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
uint firstSectorToRead = (uint)i;
|
||||
|
||||
Track track =
|
||||
tracks.OrderBy(t => t.TrackStartSector).LastOrDefault(t => i >= t.TrackStartSector);
|
||||
Track track = tracks.OrderBy(t => t.TrackStartSector).LastOrDefault(t => i >= t.TrackStartSector);
|
||||
|
||||
blocksToRead = 0;
|
||||
bool inData = nextData;
|
||||
@@ -128,7 +130,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
if(j > (ulong)lastSector)
|
||||
{
|
||||
if(!failedCrossingLeadOut)
|
||||
blocksToRead += (uint)sectorsForOffset;
|
||||
|
||||
if(sectorsForOffset > 0)
|
||||
crossingLeadOut = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -241,6 +248,18 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Array.Copy(cmdBuf, (int)(sectorSize + (b * blockSize)), sub, subSize * b, subSize);
|
||||
}
|
||||
|
||||
if(failedCrossingLeadOut)
|
||||
{
|
||||
blocksToRead += (uint)sectorsForOffset;
|
||||
|
||||
tmpBuf = new byte[sectorSize * blocksToRead];
|
||||
Array.Copy(data, 0, tmpBuf, 0, data.Length);
|
||||
data = tmpBuf;
|
||||
tmpBuf = new byte[subSize * blocksToRead];
|
||||
Array.Copy(sub, 0, tmpBuf, 0, sub.Length);
|
||||
sub = tmpBuf;
|
||||
}
|
||||
|
||||
tmpBuf = new byte[sectorSize * (blocksToRead - sectorsForOffset)];
|
||||
Array.Copy(data, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
||||
data = tmpBuf;
|
||||
@@ -258,6 +277,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
else
|
||||
{
|
||||
if(failedCrossingLeadOut)
|
||||
{
|
||||
blocksToRead += (uint)sectorsForOffset;
|
||||
|
||||
tmpBuf = new byte[blockSize * blocksToRead];
|
||||
Array.Copy(cmdBuf, 0, tmpBuf, 0, cmdBuf.Length);
|
||||
cmdBuf = tmpBuf;
|
||||
}
|
||||
|
||||
tmpBuf = new byte[blockSize * (blocksToRead - sectorsForOffset)];
|
||||
Array.Copy(cmdBuf, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
||||
cmdBuf = tmpBuf;
|
||||
@@ -316,6 +344,14 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
else
|
||||
{
|
||||
if(crossingLeadOut && Sense.DecodeFixed(senseBuf)?.Information == lastSector + 1)
|
||||
{
|
||||
failedCrossingLeadOut = true;
|
||||
blocksToRead = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Reset device after X errors
|
||||
if(_stopOnError)
|
||||
return; // TODO: Return more cleanly
|
||||
@@ -377,6 +413,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
|
||||
if(!failedCrossingLeadOut)
|
||||
return;
|
||||
|
||||
_dumpLog.WriteLine("Failed crossing into Lead-Out, dump may not be correct.");
|
||||
UpdateStatus?.Invoke("Failed crossing into Lead-Out, dump may not be correct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user