mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Dump] Use new speed calculation algorithm.
This commit is contained in:
@@ -195,7 +195,6 @@ public partial class Dump
|
||||
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
double duration;
|
||||
|
||||
var ret = true;
|
||||
|
||||
@@ -301,6 +300,7 @@ public partial class Dump
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -327,15 +327,16 @@ public partial class Dump
|
||||
(long)i,
|
||||
(long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
|
||||
_speedStopwatch.Restart();
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out _, out _, out _);
|
||||
_speedStopwatch.Stop();
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!error)
|
||||
{
|
||||
mhddLog.Write(i, duration, blocksToRead);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
|
||||
outputFormat.WriteSectors(cmdBuf,
|
||||
@@ -355,7 +356,11 @@ public partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, duration < 500 ? 65535 : duration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
|
||||
@@ -381,12 +386,12 @@ public partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -397,6 +402,7 @@ public partial class Dump
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
|
||||
ibgLog.Close(_dev,
|
||||
blocks,
|
||||
@@ -442,8 +448,11 @@ public partial class Dump
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Trimming_sector_0, badSector));
|
||||
|
||||
bool error =
|
||||
ataReader.ReadBlock(out cmdBuf, badSector, out duration, out recoveredError, out _);
|
||||
bool error = ataReader.ReadBlock(out cmdBuf,
|
||||
badSector,
|
||||
out double duration,
|
||||
out recoveredError,
|
||||
out _);
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
@@ -510,8 +519,11 @@ public partial class Dump
|
||||
pass));
|
||||
}
|
||||
|
||||
bool error =
|
||||
ataReader.ReadBlock(out cmdBuf, badSector, out duration, out recoveredError, out _);
|
||||
bool error = ataReader.ReadBlock(out cmdBuf,
|
||||
badSector,
|
||||
out double duration,
|
||||
out recoveredError,
|
||||
out _);
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
@@ -585,6 +597,7 @@ public partial class Dump
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ushort cy = 0; cy < cylinders; cy++)
|
||||
{
|
||||
@@ -613,21 +626,19 @@ public partial class Dump
|
||||
.Per(_oneSecond)
|
||||
.Humanize()));
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
bool error =
|
||||
ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out recoveredError);
|
||||
bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out _, out recoveredError);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += duration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!error || recoveredError)
|
||||
{
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
mhddLog.Write(currentBlock, _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
|
||||
outputFormat.WriteSector(cmdBuf,
|
||||
(ulong)((cy * heads + hd) * sectors + (sc - 1)),
|
||||
@@ -641,9 +652,11 @@ public partial class Dump
|
||||
else
|
||||
{
|
||||
_resume.BadBlocks.Add(currentBlock);
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
mhddLog.Write(currentBlock,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
|
||||
outputFormat.WriteSector(new byte[blockSize],
|
||||
(ulong)((cy * heads + hd) * sectors + (sc - 1)),
|
||||
@@ -658,12 +671,12 @@ public partial class Dump
|
||||
sectorSpeedStart++;
|
||||
currentBlock++;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +103,10 @@ partial class Dump
|
||||
{
|
||||
ulong sectorSpeedStart = 0; // Used to calculate correct speed
|
||||
uint blocksToRead; // How many sectors to read at once
|
||||
var sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
ReadOnlySpan<byte> senseBuf = null; // Sense buffer
|
||||
double cmdDuration = 0; // Command execution time
|
||||
const uint sectorSize = 2352; // Full sector size
|
||||
var sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
ReadOnlySpan<byte> senseBuf = null; // Sense buffer
|
||||
const uint sectorSize = 2352; // Full sector size
|
||||
newTrim = false;
|
||||
PlextorSubchannel supportedPlextorSubchannel;
|
||||
var outputFormat = _outputPlugin as IWritableImage;
|
||||
@@ -122,13 +121,16 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
int currentReadSpeed = _speed;
|
||||
var crossingLeadOut = false;
|
||||
var failedCrossingLeadOut = false;
|
||||
var skippingLead = false;
|
||||
int currentReadSpeed = _speed;
|
||||
var crossingLeadOut = false;
|
||||
var failedCrossingLeadOut = false;
|
||||
var skippingLead = false;
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
_speedStopwatch.Reset();
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||
@@ -273,10 +275,11 @@ partial class Dump
|
||||
blockSize,
|
||||
blocksToRead,
|
||||
supportedPlextorSubchannel,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(readcd)
|
||||
{
|
||||
@@ -299,7 +302,7 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -332,12 +335,10 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration2);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
cmdDuration += cmdDuration2;
|
||||
|
||||
if(!sense &&
|
||||
cmdBuf[0] == 0x00 &&
|
||||
cmdBuf[1] == 0xFF &&
|
||||
@@ -391,7 +392,7 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -418,7 +419,7 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -451,7 +452,7 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -479,16 +480,14 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration2);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
cmdDuration += cmdDuration2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(read16)
|
||||
{
|
||||
@@ -506,7 +505,7 @@ partial class Dump
|
||||
blocksToRead,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
@@ -527,7 +526,7 @@ partial class Dump
|
||||
blocksToRead,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
@@ -547,7 +546,7 @@ partial class Dump
|
||||
0,
|
||||
(ushort)blocksToRead,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
@@ -561,13 +560,11 @@ partial class Dump
|
||||
blockSize,
|
||||
(byte)blocksToRead,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
|
||||
double elapsed;
|
||||
|
||||
// Overcome the track mode change drive error
|
||||
if(inData && !nextData && sense)
|
||||
{
|
||||
@@ -596,11 +593,11 @@ partial class Dump
|
||||
blockSize,
|
||||
(uint)sectorsForOffset + 1,
|
||||
supportedPlextorSubchannel,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -677,11 +674,11 @@ partial class Dump
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(read16)
|
||||
{
|
||||
@@ -699,9 +696,11 @@ partial class Dump
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(read12)
|
||||
{
|
||||
@@ -720,9 +719,11 @@ partial class Dump
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(read10)
|
||||
{
|
||||
@@ -740,29 +741,26 @@ partial class Dump
|
||||
0,
|
||||
1,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
else if(read6)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
|
||||
sense = _dev.Read6(out cmdBuf,
|
||||
out senseBuf,
|
||||
(uint)(i + r),
|
||||
blockSize,
|
||||
1,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, 1, _dev.Timeout, out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
}
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
mhddLog.Write(i + r, _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
extents.Add(i + r, 1, true);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
@@ -901,11 +899,13 @@ partial class Dump
|
||||
else
|
||||
{
|
||||
if(supportsLongSectors)
|
||||
{
|
||||
outputFormat.WriteSectorsLong(new byte[blockSize],
|
||||
i + r,
|
||||
false,
|
||||
1,
|
||||
[SectorStatus.Errored]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cmdBuf.Length % sectorSize == 0)
|
||||
@@ -929,9 +929,11 @@ partial class Dump
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Core.READ_error_0, Sense.PrettifySense(senseBuf));
|
||||
|
||||
mhddLog.Write(i + r, cmdDuration < 500 ? 65535 : cmdDuration);
|
||||
mhddLog.Write(i + r,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
|
||||
ibgLog.Write(i + r, 0);
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, 1, i + r);
|
||||
newTrim = true;
|
||||
}
|
||||
@@ -942,13 +944,16 @@ partial class Dump
|
||||
|
||||
_resume.NextBlock = i + r;
|
||||
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
_speedStopwatch.Reset();
|
||||
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -976,7 +981,7 @@ partial class Dump
|
||||
failedCrossingLeadOut);
|
||||
}
|
||||
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_writeStopwatch.Restart();
|
||||
@@ -1172,9 +1177,13 @@ partial class Dump
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Core.READ_error_0, Sense.PrettifySense(senseBuf));
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
@@ -1186,13 +1195,14 @@ partial class Dump
|
||||
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
_speedStopwatch.Reset();
|
||||
elapsed = 0;
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -78,7 +78,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] tmp = new byte[8];
|
||||
var tmp = new byte[8];
|
||||
|
||||
Array.Copy(buffer, 0x36, tmp, 0, 8);
|
||||
|
||||
@@ -90,11 +90,11 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
ushort fatStart = (ushort)((buffer[0x0F] << 8) + buffer[0x0E]);
|
||||
ushort sectorsPerFat = (ushort)((buffer[0x17] << 8) + buffer[0x16]);
|
||||
ushort rootStart = (ushort)(sectorsPerFat * 2 + fatStart);
|
||||
ushort rootSize = (ushort)(((buffer[0x12] << 8) + buffer[0x11]) * 32 / 512);
|
||||
byte sectorsPerCluster = buffer[0x0D];
|
||||
var fatStart = (ushort)((buffer[0x0F] << 8) + buffer[0x0E]);
|
||||
var sectorsPerFat = (ushort)((buffer[0x17] << 8) + buffer[0x16]);
|
||||
var rootStart = (ushort)(sectorsPerFat * 2 + fatStart);
|
||||
var rootSize = (ushort)(((buffer[0x12] << 8) + buffer[0x11]) * 32 / 512);
|
||||
byte sectorsPerCluster = buffer[0x0D];
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_root_directory_in_sector_0, rootStart));
|
||||
|
||||
@@ -107,14 +107,14 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
int romPos;
|
||||
bool sfcFound = false;
|
||||
bool genesisFound = false;
|
||||
bool smsFound = false;
|
||||
bool n64Found = false;
|
||||
bool gbFound = false;
|
||||
bool gbcFound = false;
|
||||
bool gbaFound = false;
|
||||
int romPos;
|
||||
var sfcFound = false;
|
||||
var genesisFound = false;
|
||||
var smsFound = false;
|
||||
var n64Found = false;
|
||||
var gbFound = false;
|
||||
var gbcFound = false;
|
||||
var gbaFound = false;
|
||||
tmp = new byte[3];
|
||||
|
||||
for(romPos = 0; romPos < buffer.Length; romPos += 0x20)
|
||||
@@ -177,8 +177,8 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
ushort cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A);
|
||||
uint romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C);
|
||||
var cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A);
|
||||
var romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C);
|
||||
|
||||
MediaType mediaType = gbaFound
|
||||
? MediaType.GameBoyAdvanceGamePak
|
||||
@@ -228,7 +228,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
uint startSector = (uint)(rootStart + rootSize + (cluster - 2) * sectorsPerCluster);
|
||||
var startSector = (uint)(rootStart + rootSize + (cluster - 2) * sectorsPerCluster);
|
||||
uint romSectors = romSize / 512;
|
||||
uint romRemaining = romSize % 512;
|
||||
|
||||
@@ -281,7 +281,7 @@ public partial class Dump
|
||||
(long)i * 512,
|
||||
romSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read10(out readBuffer,
|
||||
out senseBuf,
|
||||
@@ -295,10 +295,10 @@ public partial class Dump
|
||||
0,
|
||||
(ushort)blocksToRead,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
totalDuration += cmdDuration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
|
||||
@@ -331,6 +331,7 @@ partial class Dump
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -355,24 +356,17 @@ partial class Dump
|
||||
(long)i,
|
||||
(long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read6(out readBuffer,
|
||||
out _,
|
||||
(uint)i,
|
||||
blockSize,
|
||||
(byte)blocksToRead,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration);
|
||||
sense = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout, out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(readBuffer,
|
||||
@@ -405,9 +399,12 @@ partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
@@ -417,12 +414,12 @@ partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -432,6 +429,7 @@ partial class Dump
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
|
||||
ibgLog.Close(_dev,
|
||||
blocks,
|
||||
|
||||
@@ -196,6 +196,7 @@ public partial class Dump
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -220,7 +221,7 @@ public partial class Dump
|
||||
(long)i,
|
||||
blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read12(out readBuffer,
|
||||
out senseBuf,
|
||||
@@ -235,16 +236,15 @@ public partial class Dump
|
||||
blocksToRead,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(readBuffer,
|
||||
@@ -279,9 +279,12 @@ public partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
@@ -291,12 +294,12 @@ public partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -306,6 +309,7 @@ public partial class Dump
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
|
||||
ibgLog.Close(_dev,
|
||||
blocks,
|
||||
|
||||
@@ -236,6 +236,7 @@ public partial class Dump
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -260,7 +261,7 @@ public partial class Dump
|
||||
(long)i,
|
||||
(long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read12(out readBuffer,
|
||||
out senseBuf,
|
||||
@@ -275,18 +276,17 @@ public partial class Dump
|
||||
blocksToRead * 4,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out double cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
|
||||
outputOptical.WriteSectors(readBuffer,
|
||||
i,
|
||||
@@ -318,9 +318,12 @@ public partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
AaruLogging.Information(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
@@ -330,12 +333,12 @@ public partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -344,6 +347,7 @@ public partial class Dump
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
|
||||
ibgLog.Close(_dev,
|
||||
blocks,
|
||||
|
||||
@@ -285,8 +285,9 @@ partial class Dump
|
||||
Modes.DecodedMode? decMode = null;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
|
||||
|
||||
@@ -314,8 +315,9 @@ partial class Dump
|
||||
if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
|
||||
// TODO: Check partitions page
|
||||
if(decMode.HasValue)
|
||||
@@ -871,7 +873,7 @@ partial class Dump
|
||||
|
||||
ulong currentSpeedSize = 0;
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
double elapsed = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
_speedStopwatch.Reset();
|
||||
@@ -932,19 +934,13 @@ partial class Dump
|
||||
currentBlock,
|
||||
ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()));
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read6(out cmdBuf,
|
||||
out senseBuf,
|
||||
false,
|
||||
fixedLen,
|
||||
transferLen,
|
||||
blockSize,
|
||||
_dev.Timeout,
|
||||
out duration);
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, _dev.Timeout, out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
totalDuration += duration;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(sense && !senseBuf.IsEmpty)
|
||||
{
|
||||
@@ -1093,14 +1089,16 @@ partial class Dump
|
||||
outputTape.WriteSector(new byte[blockSize], currentBlock, false, SectorStatus.NotDumped);
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
mhddLog.Write(currentBlock,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
|
||||
_resume.BadBlocks.Add(currentBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
mhddLog.Write(currentBlock, _speedStopwatch.Elapsed.TotalMilliseconds);
|
||||
_writeStopwatch.Restart();
|
||||
outputTape.WriteSector(cmdBuf, currentBlock, false, SectorStatus.Dumped);
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
@@ -1112,12 +1110,12 @@ partial class Dump
|
||||
_resume.NextBlock++;
|
||||
currentSpeedSize += blockSize;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || currentSpeedSize < 524288) continue;
|
||||
|
||||
currentSpeed = currentSpeedSize / (1048576 * elapsed);
|
||||
currentSpeed = currentSpeedSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
currentSpeedSize = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
_speedStopwatch.Reset();
|
||||
double elapsed = 0;
|
||||
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -102,9 +103,10 @@ partial class Dump
|
||||
(long)i,
|
||||
(long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
|
||||
totalDuration += cmdDuration;
|
||||
_speedStopwatch.Restart();
|
||||
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out _, out _, out _);
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
@@ -194,8 +196,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(buffer,
|
||||
@@ -242,9 +243,12 @@ partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
@@ -254,12 +258,12 @@ partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,8 @@ public partial class Dump
|
||||
}
|
||||
|
||||
bool sense;
|
||||
const ushort sdProfile = 0x0001;
|
||||
const uint timeout = 5;
|
||||
double duration;
|
||||
const ushort sdProfile = 0x0001;
|
||||
const uint timeout = 5;
|
||||
ushort blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
ulong blocks = 0;
|
||||
@@ -99,7 +98,7 @@ public partial class Dump
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_CSD);
|
||||
sense = _dev.ReadCsd(out csd, out response, timeout, out duration);
|
||||
sense = _dev.ReadCsd(out csd, out response, timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -115,7 +114,7 @@ public partial class Dump
|
||||
if(csdDecoded.Size == 0xFFF)
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_Extended_CSD);
|
||||
sense = _dev.ReadExtendedCsd(out ecsd, out response, timeout, out duration);
|
||||
sense = _dev.ReadExtendedCsd(out ecsd, out response, timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -152,7 +151,7 @@ public partial class Dump
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_OCR);
|
||||
sense = _dev.ReadOcr(out ocr, out response, timeout, out duration);
|
||||
sense = _dev.ReadOcr(out ocr, out response, timeout, out _);
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -168,7 +167,7 @@ public partial class Dump
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_CSD);
|
||||
sense = _dev.ReadCsd(out csd, out response, timeout, out duration);
|
||||
sense = _dev.ReadCsd(out csd, out response, timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -200,7 +199,7 @@ public partial class Dump
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_OCR);
|
||||
sense = _dev.ReadSdocr(out ocr, out response, timeout, out duration);
|
||||
sense = _dev.ReadSdocr(out ocr, out response, timeout, out _);
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -211,7 +210,7 @@ public partial class Dump
|
||||
mediaTags.Add(MediaTagType.SD_OCR, null);
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_SCR);
|
||||
sense = _dev.ReadScr(out scr, out response, timeout, out duration);
|
||||
sense = _dev.ReadScr(out scr, out response, timeout, out _);
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -232,7 +231,7 @@ public partial class Dump
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_CID);
|
||||
sense = _dev.ReadCid(out byte[] cid, out response, timeout, out duration);
|
||||
sense = _dev.ReadCid(out byte[] cid, out response, timeout, out _);
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -263,7 +262,7 @@ public partial class Dump
|
||||
|
||||
if(supportsCmd23 && blocksToRead > 1)
|
||||
{
|
||||
sense = _dev.ReadWithBlockCount(out cmdBuf, out _, 0, blockSize, 1, byteAddressed, timeout, out duration);
|
||||
sense = _dev.ReadWithBlockCount(out cmdBuf, out _, 0, blockSize, 1, byteAddressed, timeout, out _);
|
||||
|
||||
if(sense || _dev.Error) supportsCmd23 = false;
|
||||
|
||||
@@ -289,7 +288,7 @@ public partial class Dump
|
||||
blocksToRead,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out _);
|
||||
|
||||
if(error) blocksToRead /= 2;
|
||||
|
||||
@@ -310,7 +309,7 @@ public partial class Dump
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
error = _dev.BufferedOsRead(out cmdBuf, 0, blockSize * blocksToRead, out duration);
|
||||
error = _dev.BufferedOsRead(out cmdBuf, 0, blockSize * blocksToRead, out _);
|
||||
|
||||
if(error) blocksToRead /= 2;
|
||||
|
||||
@@ -339,7 +338,7 @@ public partial class Dump
|
||||
blocksToRead,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out _);
|
||||
|
||||
if(error) blocksToRead /= 2;
|
||||
|
||||
@@ -361,7 +360,7 @@ public partial class Dump
|
||||
|
||||
if(blocksToRead == 1)
|
||||
{
|
||||
error = _dev.ReadSingleBlock(out cmdBuf, out _, 0, blockSize, byteAddressed, timeout, out duration);
|
||||
error = _dev.ReadSingleBlock(out cmdBuf, out _, 0, blockSize, byteAddressed, timeout, out _);
|
||||
|
||||
if(error)
|
||||
{
|
||||
@@ -596,6 +595,7 @@ public partial class Dump
|
||||
double imageWriteDuration = 0;
|
||||
var newTrim = false;
|
||||
ulong sectorSpeedStart = 0;
|
||||
double elapsed = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -622,17 +622,11 @@ public partial class Dump
|
||||
(long)i,
|
||||
(long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
if(blocksToRead == 1)
|
||||
{
|
||||
error = _dev.ReadSingleBlock(out cmdBuf,
|
||||
out _,
|
||||
(uint)i,
|
||||
blockSize,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
error = _dev.ReadSingleBlock(out cmdBuf, out _, (uint)i, blockSize, byteAddressed, timeout, out _);
|
||||
}
|
||||
else if(supportsCmd23)
|
||||
{
|
||||
@@ -643,10 +637,10 @@ public partial class Dump
|
||||
blocksToRead,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out _);
|
||||
}
|
||||
else if(_useBufferedReads)
|
||||
error = _dev.BufferedOsRead(out cmdBuf, (long)(i * blockSize), blockSize * blocksToRead, out duration);
|
||||
error = _dev.BufferedOsRead(out cmdBuf, (long)(i * blockSize), blockSize * blocksToRead, out _);
|
||||
else
|
||||
{
|
||||
error = _dev.ReadMultipleUsingSingle(out cmdBuf,
|
||||
@@ -656,15 +650,15 @@ public partial class Dump
|
||||
blocksToRead,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out _);
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(!error)
|
||||
{
|
||||
mhddLog.Write(i, duration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(cmdBuf,
|
||||
@@ -685,7 +679,11 @@ public partial class Dump
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
|
||||
|
||||
mhddLog.Write(i, duration < 500 ? 65535 : duration, _skip);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
_writeStopwatch.Restart();
|
||||
@@ -706,12 +704,12 @@ public partial class Dump
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -721,6 +719,7 @@ public partial class Dump
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
|
||||
ibgLog.Close(_dev,
|
||||
blocks,
|
||||
@@ -772,7 +771,7 @@ public partial class Dump
|
||||
blockSize,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out double duration);
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
@@ -833,7 +832,7 @@ public partial class Dump
|
||||
blockSize,
|
||||
byteAddressed,
|
||||
timeout,
|
||||
out duration);
|
||||
out double duration);
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
|
||||
@@ -521,7 +521,6 @@ partial class Dump
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
double cmdDuration = 0;
|
||||
uint saveBlocksToRead = blocksToRead;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
@@ -585,6 +584,7 @@ partial class Dump
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
double elapsed = 0;
|
||||
|
||||
for(var e = 0; e <= 16; e++)
|
||||
{
|
||||
@@ -657,7 +657,7 @@ partial class Dump
|
||||
(long)i,
|
||||
(long)totalSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read12(out readBuffer,
|
||||
out senseBuf,
|
||||
@@ -672,16 +672,15 @@ partial class Dump
|
||||
blocksToRead,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(readBuffer,
|
||||
@@ -718,9 +717,11 @@ partial class Dump
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Core.READ_error_0, Sense.PrettifySense(senseBuf));
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
mhddLog.Write(i,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
@@ -739,12 +740,12 @@ partial class Dump
|
||||
_resume.NextBlock = currentSector;
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -764,7 +765,7 @@ partial class Dump
|
||||
|
||||
if(extentEnd - i < blocksToRead) blocksToRead = (uint)(extentEnd - i) + 1;
|
||||
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
|
||||
// Write empty data
|
||||
@@ -815,7 +816,7 @@ partial class Dump
|
||||
(long)(middle + currentSector),
|
||||
(long)totalSize);
|
||||
|
||||
mhddLog.Write(middle + currentSector, cmdDuration, blocksToRead);
|
||||
mhddLog.Write(middle + currentSector, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
ibgLog.Write(middle + currentSector, currentSpeed * 1024);
|
||||
|
||||
// Write empty data
|
||||
@@ -861,6 +862,7 @@ partial class Dump
|
||||
// Video Layer 1
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_Video_Layer_1);
|
||||
InitProgress?.Invoke();
|
||||
elapsed = 0;
|
||||
|
||||
for(ulong l1 = currentSector - blocks - middleZone + l0Video; l1 < l0Video + l1Video; l1 += blocksToRead)
|
||||
{
|
||||
@@ -885,7 +887,7 @@ partial class Dump
|
||||
(long)currentSector,
|
||||
(long)totalSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
sense = _dev.Read12(out readBuffer,
|
||||
out senseBuf,
|
||||
@@ -900,16 +902,15 @@ partial class Dump
|
||||
blocksToRead,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out _);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
elapsed += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(currentSector, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(currentSector, currentSpeed * 1024);
|
||||
mhddLog.Write(currentSector, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
outputFormat.WriteSectors(readBuffer,
|
||||
@@ -944,9 +945,13 @@ partial class Dump
|
||||
//errored += blocksToRead;
|
||||
//resume.BadBlocks.Add(l1);
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Core.READ_error_0, Sense.PrettifySense(senseBuf));
|
||||
mhddLog.Write(l1, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
|
||||
ibgLog.Write(l1, 0);
|
||||
mhddLog.Write(l1,
|
||||
_speedStopwatch.Elapsed.TotalMilliseconds < 500
|
||||
? 65535
|
||||
: _speedStopwatch.Elapsed.TotalMilliseconds,
|
||||
_skip);
|
||||
|
||||
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, l1);
|
||||
l1 += _skip - blocksToRead;
|
||||
|
||||
@@ -962,12 +967,12 @@ partial class Dump
|
||||
_resume.NextBlock = currentSector;
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
if(elapsed < 100) continue;
|
||||
|
||||
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
|
||||
ibgLog.Write(currentSector, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
elapsed = 0;
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
@@ -1053,7 +1058,7 @@ partial class Dump
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out double cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -1086,9 +1091,8 @@ partial class Dump
|
||||
List<ulong> tmpList = [];
|
||||
|
||||
foreach(ulong ur in _resume.BadBlocks)
|
||||
{
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i);
|
||||
}
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++)
|
||||
tmpList.Add(i);
|
||||
|
||||
tmpList.Sort();
|
||||
|
||||
@@ -1256,7 +1260,7 @@ partial class Dump
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out cmdDuration);
|
||||
out double cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user