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">
|
<component name="ContentModelStore">
|
||||||
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
||||||
<e p="$APPLICATION_PLUGINS_DIR$/puppet/lib/stubs" 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/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$/.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="$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="$PROJECT_DIR$" t="IncludeFlat">
|
||||||
<e p=".git/info/exclude" t="IncludeRecursive" />
|
<e p=".git/info/exclude" t="IncludeRecursive" />
|
||||||
|
|||||||
@@ -97,6 +97,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
InitProgress?.Invoke();
|
InitProgress?.Invoke();
|
||||||
|
|
||||||
|
bool crossingLeadOut = false;
|
||||||
|
bool failedCrossingLeadOut = false;
|
||||||
|
|
||||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||||
{
|
{
|
||||||
if(_aborted)
|
if(_aborted)
|
||||||
@@ -118,8 +121,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
uint firstSectorToRead = (uint)i;
|
uint firstSectorToRead = (uint)i;
|
||||||
|
|
||||||
Track track =
|
Track track = tracks.OrderBy(t => t.TrackStartSector).LastOrDefault(t => i >= t.TrackStartSector);
|
||||||
tracks.OrderBy(t => t.TrackStartSector).LastOrDefault(t => i >= t.TrackStartSector);
|
|
||||||
|
|
||||||
blocksToRead = 0;
|
blocksToRead = 0;
|
||||||
bool inData = nextData;
|
bool inData = nextData;
|
||||||
@@ -128,7 +130,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
{
|
{
|
||||||
if(j > (ulong)lastSector)
|
if(j > (ulong)lastSector)
|
||||||
{
|
{
|
||||||
blocksToRead += (uint)sectorsForOffset;
|
if(!failedCrossingLeadOut)
|
||||||
|
blocksToRead += (uint)sectorsForOffset;
|
||||||
|
|
||||||
|
if(sectorsForOffset > 0)
|
||||||
|
crossingLeadOut = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +248,18 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
Array.Copy(cmdBuf, (int)(sectorSize + (b * blockSize)), sub, subSize * b, subSize);
|
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)];
|
tmpBuf = new byte[sectorSize * (blocksToRead - sectorsForOffset)];
|
||||||
Array.Copy(data, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
Array.Copy(data, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
||||||
data = tmpBuf;
|
data = tmpBuf;
|
||||||
@@ -258,6 +277,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
else
|
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)];
|
tmpBuf = new byte[blockSize * (blocksToRead - sectorsForOffset)];
|
||||||
Array.Copy(cmdBuf, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
Array.Copy(cmdBuf, offsetFix, tmpBuf, 0, tmpBuf.Length);
|
||||||
cmdBuf = tmpBuf;
|
cmdBuf = tmpBuf;
|
||||||
@@ -316,6 +344,14 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(crossingLeadOut && Sense.DecodeFixed(senseBuf)?.Information == lastSector + 1)
|
||||||
|
{
|
||||||
|
failedCrossingLeadOut = true;
|
||||||
|
blocksToRead = 0;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Reset device after X errors
|
// TODO: Reset device after X errors
|
||||||
if(_stopOnError)
|
if(_stopOnError)
|
||||||
return; // TODO: Return more cleanly
|
return; // TODO: Return more cleanly
|
||||||
@@ -377,6 +413,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
|
|
||||||
EndProgress?.Invoke();
|
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