Fix pregap calculation in track mode changes when pregap ends in 0.

This commit is contained in:
2020-07-19 14:50:28 +01:00
parent d6b7d10b3f
commit b42963e398
3 changed files with 21 additions and 16 deletions

View File

@@ -16,16 +16,6 @@
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.api.dll" t="Include" />
<e p="$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.dll" t="Include" />
<e p="$PROJECT_DIR$" t="IncludeFlat">
<e p=".git/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.Checksums/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.CommonTypes/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.Console/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.Decoders/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.Dto/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/Aaru.Helpers/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/CICMMetadata/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/cuetools.net/info/exclude" t="IncludeRecursive" />
<e p=".git/modules/cuetoolsnet/info/exclude" t="IncludeRecursive" />
<e p=".github/CODE_OF_CONDUCT.md" t="Include" />
<e p=".github/ISSUE_TEMPLATE.md" t="Include" />
<e p=".github/PULL_REQUEST_TEMPLATE.md" t="Include" />

View File

@@ -396,7 +396,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Calculating pregaps, can take some time...");
SolveTrackPregaps(_dev, _dumpLog, UpdateStatus, tracks, supportsPqSubchannel, supportsRwSubchannel, _dbDev,
out bool inexactPositioning);
out bool inexactPositioning, true);
if(inexactPositioning)
{

View File

@@ -124,7 +124,7 @@ namespace Aaru.Core.Devices.Dumping
public static void SolveTrackPregaps(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus,
Track[] tracks, bool supportsPqSubchannel, bool supportsRwSubchannel,
Database.Models.Device dbDev, out bool inexactPositioning)
Database.Models.Device dbDev, out bool inexactPositioning, bool dumping)
{
bool sense = true; // Sense indicator
byte[] subBuf = null;
@@ -178,7 +178,7 @@ namespace Aaru.Core.Devices.Dumping
Track track = tracks[t];
int trackRetries = 0;
// First track of each session has at least 150 sectors of pregap and is not readable always
// First track of each session has at least 150 sectors of pregap and is not always readable
if(tracks.Where(t => t.TrackSession == track.TrackSession).OrderBy(t => t.TrackSequence).
FirstOrDefault().TrackSequence == track.TrackSequence)
{
@@ -190,8 +190,9 @@ namespace Aaru.Core.Devices.Dumping
continue;
}
if(t > 0 &&
tracks[t - 1].TrackType == tracks[t].TrackType)
if(t > 0 &&
tracks[t - 1].TrackType == tracks[t].TrackType &&
dumping)
{
AaruConsole.DebugWriteLine("Pregap calculator", "Skipping track {0}", track.TrackSequence);
@@ -562,7 +563,21 @@ namespace Aaru.Core.Devices.Dumping
for(int i = 0; i < tracks.Length; i++)
{
tracks[i].TrackPregap = (ulong)pregaps[tracks[i].TrackSequence];
tracks[i].TrackPregap = (ulong)pregaps[tracks[i].TrackSequence];
if(dumping)
{
// Minus five, to ensure dumping will fix if there is a pregap LBA 0
int red = 5;
while(tracks[i].TrackPregap > 0 &&
red > 0)
{
tracks[i].TrackPregap--;
red--;
}
}
tracks[i].TrackStartSector -= tracks[i].TrackPregap;
#if DEBUG