mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Update the pregap while dumping if found to be bigger than known one.
This commit is contained in:
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Extents;
|
using Aaru.CommonTypes.Extents;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
using Aaru.Core.Logging;
|
using Aaru.Core.Logging;
|
||||||
@@ -387,8 +388,18 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
|
|
||||||
_outputPlugin.WriteSectorsLong(data, i + r, 1);
|
_outputPlugin.WriteSectorsLong(data, i + r, 1);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i + r, 1, subLog,
|
bool indexesChanged =
|
||||||
isrcs, (byte)track.TrackSequence, ref mcn);
|
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i + r, 1,
|
||||||
|
subLog, isrcs, (byte)track.TrackSequence, ref mcn, tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i -= blocksToRead;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -501,8 +512,18 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
|
|
||||||
_outputPlugin.WriteSectorsLong(data, i, blocksToRead);
|
_outputPlugin.WriteSectorsLong(data, i, blocksToRead);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i, blocksToRead, subLog,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i,
|
||||||
isrcs, (byte)track.TrackSequence, ref mcn);
|
blocksToRead, subLog, isrcs,
|
||||||
|
(byte)track.TrackSequence, ref mcn, tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i -= blocksToRead;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -376,6 +376,9 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
if(tracks is null)
|
if(tracks is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_dumpLog.WriteLine("Calculating pregaps, can take some time...");
|
||||||
|
UpdateStatus?.Invoke("Calculating pregaps, can take some time...");
|
||||||
|
|
||||||
SolveTrackPregaps(_dev, _dumpLog, UpdateStatus, tracks, supportsPqSubchannel, supportsRwSubchannel, _dbDev,
|
SolveTrackPregaps(_dev, _dumpLog, UpdateStatus, tracks, supportsPqSubchannel, supportsRwSubchannel, _dbDev,
|
||||||
out bool inexactPositioning);
|
out bool inexactPositioning);
|
||||||
|
|
||||||
@@ -532,29 +535,19 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
_dumpLog.WriteLine("Checking mode for track {0}...", tracks[t].TrackSequence);
|
_dumpLog.WriteLine("Checking mode for track {0}...", tracks[t].TrackSequence);
|
||||||
UpdateStatus?.Invoke($"Checking mode for track {tracks[t].TrackSequence}...");
|
UpdateStatus?.Invoke($"Checking mode for track {tracks[t].TrackSequence}...");
|
||||||
|
|
||||||
sense = _dev.ReadCd(out cmdBuf, out _, (uint)tracks[t].TrackStartSector, blockSize, 1,
|
sense = _dev.ReadCd(out cmdBuf, out _, (uint)(tracks[t].TrackStartSector + tracks[t].TrackPregap),
|
||||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
|
blockSize, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||||
MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _);
|
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel,
|
||||||
|
_dev.Timeout, out _);
|
||||||
|
|
||||||
if(sense)
|
if(sense)
|
||||||
{
|
{
|
||||||
if(tracks[t].TrackPregap != 0)
|
_dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...", tracks[t].TrackSequence);
|
||||||
sense = _dev.ReadCd(out cmdBuf, out _,
|
|
||||||
(uint)(tracks[t].TrackStartSector + tracks[t].TrackPregap), blockSize, 1,
|
|
||||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
|
||||||
true, true, MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _);
|
|
||||||
|
|
||||||
if(sense)
|
UpdateStatus?.Invoke($"Unable to guess mode for track {tracks[t].TrackSequence}, continuing...");
|
||||||
{
|
|
||||||
_dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...",
|
|
||||||
tracks[t].TrackSequence);
|
|
||||||
|
|
||||||
UpdateStatus?.
|
|
||||||
Invoke($"Unable to guess mode for track {tracks[t].TrackSequence}, continuing...");
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch(cmdBuf[15])
|
switch(cmdBuf[15])
|
||||||
{
|
{
|
||||||
@@ -1028,7 +1021,7 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
/*
|
/*
|
||||||
DumpCdLeadOuts(blocks, blockSize, ref currentSpeed, currentTry, extents, ibgLog, ref imageWriteDuration,
|
DumpCdLeadOuts(blocks, blockSize, ref currentSpeed, currentTry, extents, ibgLog, ref imageWriteDuration,
|
||||||
leadOutExtents, ref maxSpeed, mhddLog, ref minSpeed, read6, read10, read12, read16, readcd,
|
leadOutExtents, ref maxSpeed, mhddLog, ref minSpeed, read6, read10, read12, read16, readcd,
|
||||||
supportedSubchannel, subSize, ref totalDuration, subLog, desiredSubchannel, isrcs, ref mcn);
|
supportedSubchannel, subSize, ref totalDuration, subLog, desiredSubchannel, isrcs, ref mcn, tracks);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
end = DateTime.UtcNow;
|
end = DateTime.UtcNow;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes.Extents;
|
using Aaru.CommonTypes.Extents;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
@@ -194,8 +195,10 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||||
List<ulong> sectorsNotEvenPartial = new List<ulong>();
|
List<ulong> sectorsNotEvenPartial = new List<ulong>();
|
||||||
|
|
||||||
foreach(ulong badSector in tmpArray)
|
for(int i = 0; i < tmpArray.Length; i++)
|
||||||
{
|
{
|
||||||
|
ulong badSector = tmpArray[i];
|
||||||
|
|
||||||
if(_aborted)
|
if(_aborted)
|
||||||
{
|
{
|
||||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||||
@@ -285,8 +288,16 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
||||||
_outputPlugin.WriteSectorLong(data, badSector);
|
_outputPlugin.WriteSectorLong(data, badSector);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, badSector, 1, subLog, isrcs,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, badSector,
|
||||||
(byte)track.TrackSequence, ref mcn);
|
1, subLog, isrcs, (byte)track.TrackSequence, ref mcn,
|
||||||
|
tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -349,8 +360,10 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
|
|
||||||
InitProgress?.Invoke();
|
InitProgress?.Invoke();
|
||||||
|
|
||||||
foreach(ulong badSector in sectorsNotEvenPartial)
|
for(int i = 0; i < sectorsNotEvenPartial.Count; i++)
|
||||||
{
|
{
|
||||||
|
ulong badSector = sectorsNotEvenPartial[i];
|
||||||
|
|
||||||
if(_aborted)
|
if(_aborted)
|
||||||
{
|
{
|
||||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||||
@@ -387,8 +400,16 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
||||||
_outputPlugin.WriteSectorLong(data, badSector);
|
_outputPlugin.WriteSectorLong(data, badSector);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, badSector, 1, subLog,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub,
|
||||||
isrcs, (byte)track.TrackSequence, ref mcn);
|
badSector, 1, subLog, isrcs,
|
||||||
|
(byte)track.TrackSequence, ref mcn, tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,11 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Extents;
|
using Aaru.CommonTypes.Extents;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.Core.Logging;
|
using Aaru.Core.Logging;
|
||||||
using Aaru.Devices;
|
using Aaru.Devices;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
@@ -72,7 +75,7 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
bool read6, bool read10, bool read12, bool read16, bool readcd,
|
bool read6, bool read10, bool read12, bool read16, bool readcd,
|
||||||
MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
||||||
SubchannelLog subLog, MmcSubchannel desiredSubchannel, Dictionary<byte, string> isrcs,
|
SubchannelLog subLog, MmcSubchannel desiredSubchannel, Dictionary<byte, string> isrcs,
|
||||||
ref string mcn)
|
ref string mcn, Track[] tracks)
|
||||||
{
|
{
|
||||||
byte[] cmdBuf = null; // Data buffer
|
byte[] cmdBuf = null; // Data buffer
|
||||||
const uint sectorSize = 2352; // Full sector size
|
const uint sectorSize = 2352; // Full sector size
|
||||||
@@ -155,8 +158,18 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
|
|
||||||
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i, _maximumReadable,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i,
|
||||||
subLog, isrcs, 0xAA, ref mcn);
|
_maximumReadable, subLog, isrcs, 0xAA, ref mcn,
|
||||||
|
tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i--;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_outputPlugin.WriteSectors(cmdBuf, i, _maximumReadable);
|
_outputPlugin.WriteSectors(cmdBuf, i, _maximumReadable);
|
||||||
@@ -226,7 +239,7 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
bool read6, bool read10, bool read12, bool read16, bool readcd,
|
bool read6, bool read10, bool read12, bool read16, bool readcd,
|
||||||
MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
||||||
SubchannelLog subLog, MmcSubchannel desiredSubchannel, Dictionary<byte, string> isrcs,
|
SubchannelLog subLog, MmcSubchannel desiredSubchannel, Dictionary<byte, string> isrcs,
|
||||||
ref string mcn)
|
ref string mcn, Track[] tracks)
|
||||||
{
|
{
|
||||||
byte[] cmdBuf = null; // Data buffer
|
byte[] cmdBuf = null; // Data buffer
|
||||||
const uint sectorSize = 2352; // Full sector size
|
const uint sectorSize = 2352; // Full sector size
|
||||||
@@ -309,8 +322,18 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
|
|
||||||
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i, _maximumReadable,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, i,
|
||||||
subLog, isrcs, 0xAA, ref mcn);
|
_maximumReadable, subLog, isrcs, 0xAA, ref mcn,
|
||||||
|
tracks);
|
||||||
|
|
||||||
|
// Set tracks and go back
|
||||||
|
if(indexesChanged)
|
||||||
|
{
|
||||||
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
i--;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_outputPlugin.WriteSectors(cmdBuf, i, _maximumReadable);
|
_outputPlugin.WriteSectors(cmdBuf, i, _maximumReadable);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Aaru.Checksums;
|
using Aaru.Checksums;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.Core.Logging;
|
using Aaru.Core.Logging;
|
||||||
using Aaru.Decoders.CD;
|
using Aaru.Decoders.CD;
|
||||||
using Aaru.Devices;
|
using Aaru.Devices;
|
||||||
@@ -66,9 +67,10 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
dev.Timeout, out _);
|
dev.Timeout, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteSubchannelToImage(MmcSubchannel supportedSubchannel, MmcSubchannel desiredSubchannel, byte[] sub,
|
// Return true if indexes have changed
|
||||||
|
bool WriteSubchannelToImage(MmcSubchannel supportedSubchannel, MmcSubchannel desiredSubchannel, byte[] sub,
|
||||||
ulong sectorAddress, uint length, SubchannelLog subLog,
|
ulong sectorAddress, uint length, SubchannelLog subLog,
|
||||||
Dictionary<byte, string> isrcs, byte currentTrack, ref string mcn)
|
Dictionary<byte, string> isrcs, byte currentTrack, ref string mcn, Track[] tracks)
|
||||||
{
|
{
|
||||||
if(supportedSubchannel == MmcSubchannel.Q16)
|
if(supportedSubchannel == MmcSubchannel.Q16)
|
||||||
sub = Subchannel.ConvertQToRaw(sub);
|
sub = Subchannel.ConvertQToRaw(sub);
|
||||||
@@ -86,6 +88,9 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
byte[] q = new byte[12];
|
byte[] q = new byte[12];
|
||||||
Array.Copy(deSub, subPos + 12, q, 0, 12);
|
Array.Copy(deSub, subPos + 12, q, 0, 12);
|
||||||
|
|
||||||
|
CRC16CCITTContext.Data(q, 10, out byte[] crc);
|
||||||
|
bool crcOk = crc[0] == q[10] && crc[1] == q[11];
|
||||||
|
|
||||||
// ISRC
|
// ISRC
|
||||||
if((q[0] & 0x3) == 3)
|
if((q[0] & 0x3) == 3)
|
||||||
{
|
{
|
||||||
@@ -95,6 +100,9 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
isrc == "000000000000")
|
isrc == "000000000000")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(!crcOk)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(!isrcs.ContainsKey(currentTrack))
|
if(!isrcs.ContainsKey(currentTrack))
|
||||||
{
|
{
|
||||||
_dumpLog?.WriteLine($"Found new ISRC {isrc} for track {currentTrack}.");
|
_dumpLog?.WriteLine($"Found new ISRC {isrc} for track {currentTrack}.");
|
||||||
@@ -102,14 +110,6 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
else if(isrcs[currentTrack] != isrc)
|
else if(isrcs[currentTrack] != isrc)
|
||||||
{
|
{
|
||||||
CRC16CCITTContext.Data(q, 10, out byte[] crc);
|
|
||||||
|
|
||||||
if(crc[0] != q[10] ||
|
|
||||||
crc[1] != q[11])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dumpLog?.
|
_dumpLog?.
|
||||||
WriteLine($"ISRC for track {currentTrack} changed from {isrcs[currentTrack]} to {isrc}.");
|
WriteLine($"ISRC for track {currentTrack} changed from {isrcs[currentTrack]} to {isrc}.");
|
||||||
|
|
||||||
@@ -127,6 +127,9 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
newMcn == "0000000000000")
|
newMcn == "0000000000000")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(!crcOk)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(mcn is null)
|
if(mcn is null)
|
||||||
{
|
{
|
||||||
_dumpLog?.WriteLine($"Found new MCN {newMcn}.");
|
_dumpLog?.WriteLine($"Found new MCN {newMcn}.");
|
||||||
@@ -134,22 +137,56 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
else if(mcn != newMcn)
|
else if(mcn != newMcn)
|
||||||
{
|
{
|
||||||
CRC16CCITTContext.Data(q, 10, out byte[] crc);
|
|
||||||
|
|
||||||
if(crc[0] != q[10] ||
|
|
||||||
crc[1] != q[11])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dumpLog?.WriteLine($"MCN changed from {mcn} to {newMcn}.");
|
_dumpLog?.WriteLine($"MCN changed from {mcn} to {newMcn}.");
|
||||||
|
|
||||||
UpdateStatus?.Invoke($"MCN changed from {mcn} to {newMcn}.");
|
UpdateStatus?.Invoke($"MCN changed from {mcn} to {newMcn}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
mcn = newMcn;
|
mcn = newMcn;
|
||||||
}
|
}
|
||||||
|
else if((q[0] & 0x3) == 1)
|
||||||
|
{
|
||||||
|
// TODO: Indexes
|
||||||
|
|
||||||
|
// Pregap
|
||||||
|
if(q[2] != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(!crcOk)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
byte trackNo = (byte)(((q[1] / 16) * 10) + (q[1] & 0x0F));
|
||||||
|
|
||||||
|
for(int i = 0; i < tracks.Length; i++)
|
||||||
|
{
|
||||||
|
if(tracks[i].TrackSequence != trackNo ||
|
||||||
|
trackNo == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte pmin = (byte)(((q[3] / 16) * 10) + (q[3] & 0x0F));
|
||||||
|
byte psec = (byte)(((q[4] / 16) * 10) + (q[4] & 0x0F));
|
||||||
|
byte pframe = (byte)(((q[5] / 16) * 10) + (q[5] & 0x0F));
|
||||||
|
int qPos = (pmin * 60 * 75) + (psec * 75) + pframe;
|
||||||
|
|
||||||
|
if(tracks[i].TrackPregap >= (ulong)(qPos + 1))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tracks[i].TrackPregap = (ulong)(qPos + 1);
|
||||||
|
tracks[i].TrackStartSector -= tracks[i].TrackPregap;
|
||||||
|
|
||||||
|
if(i > 0)
|
||||||
|
tracks[i - 1].TrackEndSector = tracks[i].TrackStartSector - 1;
|
||||||
|
|
||||||
|
_dumpLog?.WriteLine($"Pregap for track {trackNo} set to {tracks[i].TrackPregap} sectors.");
|
||||||
|
UpdateStatus?.Invoke($"Pregap for track {trackNo} set to {tracks[i].TrackPregap} sectors.");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,11 +33,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aaru.CommonTypes.Enums;
|
|
||||||
using Aaru.CommonTypes.Extents;
|
using Aaru.CommonTypes.Extents;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.Core.Logging;
|
using Aaru.Core.Logging;
|
||||||
using Aaru.Decoders.CD;
|
|
||||||
using Aaru.Devices;
|
using Aaru.Devices;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
|
|
||||||
@@ -101,8 +100,10 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||||
InitProgress?.Invoke();
|
InitProgress?.Invoke();
|
||||||
|
|
||||||
foreach(ulong badSector in tmpArray)
|
for(int b = 0; b < tmpArray.Length; b++)
|
||||||
{
|
{
|
||||||
|
ulong badSector = tmpArray[b];
|
||||||
|
|
||||||
if(_aborted)
|
if(_aborted)
|
||||||
{
|
{
|
||||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||||
@@ -187,21 +188,20 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
||||||
_outputPlugin.WriteSectorLong(data, badSector);
|
_outputPlugin.WriteSectorLong(data, badSector);
|
||||||
|
|
||||||
WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, badSector, 1, subLog, isrcs,
|
bool indexesChanged = WriteSubchannelToImage(supportedSubchannel, desiredSubchannel, sub, badSector,
|
||||||
(byte)track.TrackSequence, ref mcn);
|
1, subLog, isrcs, (byte)track.TrackSequence, ref mcn,
|
||||||
|
tracks);
|
||||||
|
|
||||||
if(desiredSubchannel != MmcSubchannel.None)
|
// Set tracks and go back
|
||||||
{
|
if(!indexesChanged)
|
||||||
if(supportedSubchannel == MmcSubchannel.Q16)
|
continue;
|
||||||
sub = Subchannel.ConvertQToRaw(sub);
|
|
||||||
|
|
||||||
_outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel);
|
(_outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
|
b--;
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(supportsLongSectors)
|
if(supportsLongSectors)
|
||||||
_outputPlugin.WriteSectorLong(cmdBuf, badSector);
|
_outputPlugin.WriteSectorLong(cmdBuf, badSector);
|
||||||
else
|
else
|
||||||
@@ -217,7 +217,6 @@ namespace Aaru.Core.Devices.Dumping
|
|||||||
_outputPlugin.WriteSectorLong(cmdBuf, badSector);
|
_outputPlugin.WriteSectorLong(cmdBuf, badSector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EndProgress?.Invoke();
|
EndProgress?.Invoke();
|
||||||
end = DateTime.UtcNow;
|
end = DateTime.UtcNow;
|
||||||
|
|||||||
Reference in New Issue
Block a user