mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Rename Aaru.Console project to Aaru.Logging.
This commit is contained in:
@@ -43,11 +43,11 @@ using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Logging;
|
||||
using Humanizer;
|
||||
using Humanizer.Bytes;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
@@ -103,7 +103,7 @@ 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
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
byte[] senseBuf = null; // Sense buffer
|
||||
double cmdDuration = 0; // Command execution time
|
||||
@@ -122,10 +122,10 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
int currentReadSpeed = _speed;
|
||||
var crossingLeadOut = false;
|
||||
var failedCrossingLeadOut = false;
|
||||
var skippingLead = false;
|
||||
int currentReadSpeed = _speed;
|
||||
bool crossingLeadOut = false;
|
||||
bool failedCrossingLeadOut = false;
|
||||
bool skippingLead = false;
|
||||
|
||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ partial class Dump
|
||||
|
||||
if((long)i > lastSector) break;
|
||||
|
||||
var firstSectorToRead = (uint)i;
|
||||
uint firstSectorToRead = (uint)i;
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => i >= t.StartSector);
|
||||
|
||||
@@ -317,10 +317,10 @@ partial class Dump
|
||||
// Try to workaround firmware
|
||||
if(decSense?.ASC == 0x64)
|
||||
{
|
||||
var goBackTrackTypeChange = false;
|
||||
bool goBackTrackTypeChange = false;
|
||||
|
||||
// Go one for one as the drive does not tell us which one failed
|
||||
for(var bi = 0; bi < blocksToRead; bi++)
|
||||
for(int bi = 0; bi < blocksToRead; bi++)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
|
||||
@@ -591,7 +591,7 @@ partial class Dump
|
||||
|
||||
if(_supportsPlextorD8)
|
||||
{
|
||||
var adjustment = 0;
|
||||
int adjustment = 0;
|
||||
|
||||
if(offsetBytes < 0) adjustment = -sectorsForOffset;
|
||||
|
||||
@@ -611,7 +611,7 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
var sectorsForFix = (uint)(1 + sectorsForOffset);
|
||||
uint sectorsForFix = (uint)(1 + sectorsForOffset);
|
||||
|
||||
FixOffsetData(offsetBytes,
|
||||
sectorSize,
|
||||
@@ -637,7 +637,7 @@ partial class Dump
|
||||
{
|
||||
case 0:
|
||||
|
||||
for(var c = 16; c < 2352; c++)
|
||||
for(int c = 16; c < 2352; c++)
|
||||
{
|
||||
if(cmdBuf[c] == 0x00) continue;
|
||||
|
||||
@@ -775,8 +775,8 @@ partial class Dump
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
var data = new byte[sectorSize];
|
||||
var sub = new byte[subSize];
|
||||
byte[] data = new byte[sectorSize];
|
||||
byte[] sub = new byte[subSize];
|
||||
|
||||
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
|
||||
|
||||
@@ -786,10 +786,10 @@ partial class Dump
|
||||
outputFormat.WriteSectorsLong(data, i + r, 1);
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
var sector = new byte[sectorSize];
|
||||
var cooked = new MemoryStream();
|
||||
byte[] sector = new byte[sectorSize];
|
||||
|
||||
for(var b = 0; b < blocksToRead; b++)
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize);
|
||||
byte[] cookedSector = Sector.GetUserData(sector);
|
||||
@@ -847,10 +847,10 @@ partial class Dump
|
||||
outputFormat.WriteSectorsLong(cmdBuf, i + r, 1);
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
var sector = new byte[sectorSize];
|
||||
var cooked = new MemoryStream();
|
||||
byte[] sector = new byte[sectorSize];
|
||||
|
||||
for(var b = 0; b < blocksToRead; b++)
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize);
|
||||
byte[] cookedSector = Sector.GetUserData(sector);
|
||||
@@ -936,7 +936,7 @@ partial class Dump
|
||||
{
|
||||
if(crossingLeadOut && failedCrossingLeadOut)
|
||||
{
|
||||
var tmp = new byte[cmdBuf.Length + blockSize];
|
||||
byte[] tmp = new byte[cmdBuf.Length + blockSize];
|
||||
Array.Copy(cmdBuf, 0, tmp, 0, cmdBuf.Length);
|
||||
}
|
||||
|
||||
@@ -961,10 +961,10 @@ partial class Dump
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
var data = new byte[sectorSize * blocksToRead];
|
||||
var sub = new byte[subSize * blocksToRead];
|
||||
byte[] data = new byte[sectorSize * blocksToRead];
|
||||
byte[] sub = new byte[subSize * blocksToRead];
|
||||
|
||||
for(var b = 0; b < blocksToRead; b++)
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(0 + b * blockSize), data, sectorSize * b, sectorSize);
|
||||
|
||||
@@ -975,10 +975,10 @@ partial class Dump
|
||||
outputFormat.WriteSectorsLong(data, i, blocksToRead);
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
var sector = new byte[sectorSize];
|
||||
var cooked = new MemoryStream();
|
||||
byte[] sector = new byte[sectorSize];
|
||||
|
||||
for(var b = 0; b < blocksToRead; b++)
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize);
|
||||
byte[] cookedSector = Sector.GetUserData(sector);
|
||||
@@ -1035,10 +1035,10 @@ partial class Dump
|
||||
outputFormat.WriteSectorsLong(cmdBuf, i, blocksToRead);
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
var sector = new byte[sectorSize];
|
||||
var cooked = new MemoryStream();
|
||||
byte[] sector = new byte[sectorSize];
|
||||
|
||||
for(var b = 0; b < blocksToRead; b++)
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize);
|
||||
byte[] cookedSector = Sector.GetUserData(sector);
|
||||
|
||||
@@ -43,13 +43,13 @@ using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Logging;
|
||||
using Humanizer;
|
||||
using Humanizer.Bytes;
|
||||
using Humanizer.Localisation;
|
||||
@@ -86,21 +86,21 @@ sealed partial class Dump
|
||||
MhddLog mhddLog; // MHDD log
|
||||
double minSpeed = double.MaxValue; // Minimum speed
|
||||
bool newTrim; // Is trim a new one?
|
||||
var offsetBytes = 0; // Read offset
|
||||
var read6 = false; // Device supports READ(6)
|
||||
var read10 = false; // Device supports READ(10)
|
||||
var read12 = false; // Device supports READ(12)
|
||||
var read16 = false; // Device supports READ(16)
|
||||
var readcd = true; // Device supports READ CD
|
||||
int offsetBytes = 0; // Read offset
|
||||
bool read6 = false; // Device supports READ(6)
|
||||
bool read10 = false; // Device supports READ(10)
|
||||
bool read12 = false; // Device supports READ(12)
|
||||
bool read16 = false; // Device supports READ(16)
|
||||
bool readcd = true; // Device supports READ CD
|
||||
bool ret; // Image writing return status
|
||||
const uint sectorSize = 2352; // Full sector size
|
||||
var sectorsForOffset = 0; // Sectors needed to fix offset
|
||||
var sense = true; // Sense indicator
|
||||
int sectorsForOffset = 0; // Sectors needed to fix offset
|
||||
bool sense = true; // Sense indicator
|
||||
int sessions; // Number of sessions in disc
|
||||
SubchannelLog subLog = null; // Subchannel log
|
||||
uint subSize = 0; // Subchannel size in bytes
|
||||
TrackSubchannelType subType; // Track subchannel type
|
||||
var supportsLongSectors = true; // Supports reading EDC and ECC
|
||||
bool supportsLongSectors = true; // Supports reading EDC and ECC
|
||||
bool supportsPqSubchannel; // Supports reading PQ subchannel
|
||||
bool supportsRwSubchannel; // Supports reading RW subchannel
|
||||
byte[] tmpBuf; // Temporary buffer
|
||||
@@ -112,11 +112,11 @@ sealed partial class Dump
|
||||
bool hiddenTrack; // Disc has a hidden track before track 1
|
||||
MmcSubchannel supportedSubchannel; // Drive's maximum supported subchannel
|
||||
MmcSubchannel desiredSubchannel; // User requested subchannel
|
||||
var bcdSubchannel = false; // Subchannel positioning is in BCD
|
||||
bool bcdSubchannel = false; // Subchannel positioning is in BCD
|
||||
Dictionary<byte, string> isrcs = new();
|
||||
string mcn = null;
|
||||
HashSet<int> subchannelExtents = [];
|
||||
var cdiReadyReadAsAudio = false;
|
||||
bool cdiReadyReadAsAudio = false;
|
||||
uint firstLba;
|
||||
var outputOptical = _outputPlugin as IWritableOpticalImage;
|
||||
|
||||
@@ -152,11 +152,12 @@ sealed partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
firstLba = (uint) tracks.Min(t => t.StartSector);
|
||||
firstLba = (uint)tracks.Min(t => t.StartSector);
|
||||
|
||||
// Check subchannels support
|
||||
supportsPqSubchannel = SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) ||
|
||||
SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5);
|
||||
|
||||
supportsRwSubchannel = SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) ||
|
||||
SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5);
|
||||
|
||||
@@ -279,9 +280,22 @@ sealed partial class Dump
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out _) ||
|
||||
!_dev.ReadCd(out cmdBuf, out _, firstLba + 5, sectorSize, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
supportedSubchannel, _dev.Timeout, out _);
|
||||
!_dev.ReadCd(out cmdBuf,
|
||||
out _,
|
||||
firstLba + 5,
|
||||
sectorSize,
|
||||
1,
|
||||
MmcSectorTypes.AllTypes,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
MmcHeaderCodes.AllHeaders,
|
||||
true,
|
||||
true,
|
||||
MmcErrorField.None,
|
||||
supportedSubchannel,
|
||||
_dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!readcd)
|
||||
{
|
||||
@@ -291,32 +305,103 @@ sealed partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_6);
|
||||
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_6);
|
||||
|
||||
read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) ||
|
||||
read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) ||
|
||||
!_dev.Read6(out cmdBuf, out _, firstLba + 5, 2048, 1, _dev.Timeout, out _);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_10);
|
||||
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_10);
|
||||
|
||||
read10 = !_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1,
|
||||
_dev.Timeout, out _) ||
|
||||
!_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1,
|
||||
_dev.Timeout, out _);
|
||||
read10 =
|
||||
!_dev.Read10(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
firstLba,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
_dev.Timeout,
|
||||
out _) ||
|
||||
!_dev.Read10(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
firstLba + 5,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
_dev.Timeout,
|
||||
out _);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_12);
|
||||
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_12);
|
||||
|
||||
read12 = !_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1, false,
|
||||
_dev.Timeout, out _) ||
|
||||
!_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1,
|
||||
false, _dev.Timeout, out _);
|
||||
read12 =
|
||||
!_dev.Read12(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
firstLba,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out _) ||
|
||||
!_dev.Read12(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
firstLba + 5,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out _);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_16);
|
||||
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_16);
|
||||
|
||||
read16 = !_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba, 2048, 0, 1, false,
|
||||
_dev.Timeout, out _) ||
|
||||
!_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba + 5, 2048, 0, 1, false,
|
||||
_dev.Timeout, out _);
|
||||
read16 =
|
||||
!_dev.Read16(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
firstLba,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out _) ||
|
||||
!_dev.Read16(out cmdBuf,
|
||||
out _,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
firstLba + 5,
|
||||
2048,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
_dev.Timeout,
|
||||
out _);
|
||||
|
||||
switch(read6)
|
||||
{
|
||||
@@ -498,10 +583,10 @@ sealed partial class Dump
|
||||
ErrorMessage?.Invoke(Localization.Core.Output_format_does_not_support_pregaps_continuing);
|
||||
}
|
||||
|
||||
for(var t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1;
|
||||
for(int t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1;
|
||||
|
||||
tracks[^1].EndSector = (ulong) lastSector;
|
||||
blocks = (ulong) (lastSector + 1);
|
||||
tracks[^1].EndSector = (ulong)lastSector;
|
||||
blocks = (ulong)(lastSector + 1);
|
||||
|
||||
if(blocks == 0)
|
||||
{
|
||||
@@ -589,7 +674,7 @@ sealed partial class Dump
|
||||
|
||||
Tuple<ulong, ulong>[] dataExtentsArray = dataExtents.ToArray();
|
||||
|
||||
for(var i = 0; i < dataExtentsArray.Length - 1; i++)
|
||||
for(int i = 0; i < dataExtentsArray.Length - 1; i++)
|
||||
leadOutExtents.Add(dataExtentsArray[i].Item2 + 1, dataExtentsArray[i + 1].Item1 - 1);
|
||||
}
|
||||
|
||||
@@ -624,14 +709,14 @@ sealed partial class Dump
|
||||
|
||||
List<Track> trkList =
|
||||
[
|
||||
new Track
|
||||
new()
|
||||
{
|
||||
Sequence = (uint) (tracks.Any(t => t.Sequence == 1) ? 0 : 1),
|
||||
Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1),
|
||||
Session = 1,
|
||||
Type = hiddenData ? TrackType.Data : TrackType.Audio,
|
||||
StartSector = 0,
|
||||
BytesPerSector = (int) sectorSize,
|
||||
RawBytesPerSector = (int) sectorSize,
|
||||
BytesPerSector = (int)sectorSize,
|
||||
RawBytesPerSector = (int)sectorSize,
|
||||
SubchannelType = subType,
|
||||
EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1
|
||||
}
|
||||
@@ -688,7 +773,7 @@ sealed partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
var bufOffset = 0;
|
||||
int bufOffset = 0;
|
||||
|
||||
while(cmdBuf[0 + bufOffset] != 0x00 ||
|
||||
cmdBuf[1 + bufOffset] != 0xFF ||
|
||||
@@ -900,8 +985,7 @@ sealed partial class Dump
|
||||
}
|
||||
else if(read6)
|
||||
{
|
||||
sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte) _maximumReadable, _dev.Timeout,
|
||||
out _);
|
||||
sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte)_maximumReadable, _dev.Timeout, out _);
|
||||
|
||||
if(_dev.Error || sense) _maximumReadable /= 2;
|
||||
}
|
||||
@@ -918,7 +1002,7 @@ sealed partial class Dump
|
||||
_dev.LastError));
|
||||
}
|
||||
|
||||
var cdiWithHiddenTrack1 = false;
|
||||
bool cdiWithHiddenTrack1 = false;
|
||||
|
||||
if(dskType is MediaType.CDIREADY && tracks.Min(t => t.Sequence) == 1)
|
||||
{
|
||||
@@ -1066,11 +1150,11 @@ sealed partial class Dump
|
||||
{
|
||||
foreach(Track trk in tracks)
|
||||
{
|
||||
sense = _dev.ReadIsrc((byte) trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _);
|
||||
sense = _dev.ReadIsrc((byte)trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _);
|
||||
|
||||
if(sense || isrc is null or "000000000000") continue;
|
||||
|
||||
isrcs[(byte) trk.Sequence] = isrc;
|
||||
isrcs[(byte)trk.Sequence] = isrc;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc));
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc));
|
||||
@@ -1086,8 +1170,9 @@ sealed partial class Dump
|
||||
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
|
||||
|
||||
if(_resume.NextBlock < blocks)
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++)
|
||||
subchannelExtents.Add((int) i);
|
||||
{
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
|
||||
}
|
||||
}
|
||||
|
||||
if(_resume.NextBlock > 0)
|
||||
@@ -1191,7 +1276,7 @@ sealed partial class Dump
|
||||
|
||||
offsetBytes = driveOffset.Value;
|
||||
|
||||
sectorsForOffset = offsetBytes / (int) sectorSize;
|
||||
sectorsForOffset = offsetBytes / (int)sectorSize;
|
||||
|
||||
if(sectorsForOffset < 0) sectorsForOffset *= -1;
|
||||
|
||||
@@ -1201,7 +1286,7 @@ sealed partial class Dump
|
||||
else
|
||||
{
|
||||
offsetBytes = combinedOffset.Value;
|
||||
sectorsForOffset = offsetBytes / (int) sectorSize;
|
||||
sectorsForOffset = offsetBytes / (int)sectorSize;
|
||||
|
||||
if(sectorsForOffset < 0) sectorsForOffset *= -1;
|
||||
|
||||
@@ -1291,7 +1376,7 @@ sealed partial class Dump
|
||||
|
||||
if(_speed is 0 or > 0xFFFF) _speed = 0xFFFF;
|
||||
|
||||
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort) _speed, 0, _dev.Timeout, out _);
|
||||
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _);
|
||||
}
|
||||
|
||||
// Start reading
|
||||
@@ -1351,7 +1436,7 @@ sealed partial class Dump
|
||||
if(cdiReadyReadAsAudio)
|
||||
{
|
||||
offsetBytes = combinedOffset.Value;
|
||||
sectorsForOffset = offsetBytes / (int) sectorSize;
|
||||
sectorsForOffset = offsetBytes / (int)sectorSize;
|
||||
|
||||
if(sectorsForOffset < 0) sectorsForOffset *= -1;
|
||||
|
||||
@@ -1576,8 +1661,9 @@ sealed partial class Dump
|
||||
supportsLongSectors);
|
||||
|
||||
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++)
|
||||
subchannelExtents.Remove((int) e);
|
||||
{
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
|
||||
}
|
||||
|
||||
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
|
||||
{
|
||||
@@ -1686,7 +1772,7 @@ sealed partial class Dump
|
||||
if(trk.Sequence == 1) continue;
|
||||
|
||||
trk.StartSector -= trk.Pregap;
|
||||
trk.Indexes[0] = (int) trk.StartSector;
|
||||
trk.Indexes[0] = (int)trk.StartSector;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Logging;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
@@ -80,7 +80,7 @@ partial class Dump
|
||||
ref string mcn, HashSet<int> subchannelExtents,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool supportsLongSectors)
|
||||
{
|
||||
var sense = true; // Sense indicator
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
double cmdDuration; // Command execution time
|
||||
const uint sectorSize = 2352; // Full sector size
|
||||
@@ -98,9 +98,9 @@ partial class Dump
|
||||
|
||||
if(_resume.BadBlocks.Count <= 0 || _aborted || _retryPasses <= 0) return;
|
||||
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
var runningPersistent = false;
|
||||
int pass = 1;
|
||||
bool forward = true;
|
||||
bool runningPersistent = false;
|
||||
|
||||
Modes.ModePage? currentModePage = null;
|
||||
byte[] md6;
|
||||
@@ -221,7 +221,7 @@ partial class Dump
|
||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||
List<ulong> sectorsNotEvenPartial = [];
|
||||
|
||||
for(var i = 0; i < tmpArray.Length; i++)
|
||||
for(int i = 0; i < tmpArray.Length; i++)
|
||||
{
|
||||
ulong badSector = tmpArray[i];
|
||||
|
||||
@@ -259,7 +259,7 @@ partial class Dump
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
byte sectorsToReRead = 1;
|
||||
var badSectorToReRead = (uint)badSector;
|
||||
uint badSectorToReRead = (uint)badSector;
|
||||
|
||||
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
|
||||
{
|
||||
@@ -425,7 +425,7 @@ partial class Dump
|
||||
{
|
||||
case 0:
|
||||
|
||||
for(var c = 16; c < 2352; c++)
|
||||
for(int c = 16; c < 2352; c++)
|
||||
{
|
||||
if(cmdBuf[c] == 0x00) continue;
|
||||
|
||||
@@ -469,9 +469,8 @@ partial class Dump
|
||||
|
||||
// MEDIUM ERROR, retry with ignore error below
|
||||
if(decSense is { ASC: 0x11 })
|
||||
{
|
||||
if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
if(!sectorsNotEvenPartial.Contains(badSector))
|
||||
sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
@@ -508,8 +507,8 @@ partial class Dump
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
var data = new byte[sectorSize];
|
||||
var sub = new byte[subSize];
|
||||
byte[] data = new byte[sectorSize];
|
||||
byte[] sub = new byte[subSize];
|
||||
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
|
||||
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
||||
|
||||
@@ -612,7 +611,7 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(var i = 0; i < sectorsNotEvenPartial.Count; i++)
|
||||
for(int i = 0; i < sectorsNotEvenPartial.Count; i++)
|
||||
{
|
||||
ulong badSector = sectorsNotEvenPartial[i];
|
||||
|
||||
@@ -662,8 +661,8 @@ partial class Dump
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
var data = new byte[sectorSize];
|
||||
var sub = new byte[subSize];
|
||||
byte[] data = new byte[sectorSize];
|
||||
byte[] sub = new byte[subSize];
|
||||
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
|
||||
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
|
||||
|
||||
@@ -749,7 +748,7 @@ partial class Dump
|
||||
Dictionary<byte, string> isrcs, ref string mcn, HashSet<int> subchannelExtents,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
{
|
||||
var sense = true; // Sense indicator
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
double cmdDuration; // Command execution time
|
||||
byte[] senseBuf = null; // Sense buffer
|
||||
@@ -768,8 +767,8 @@ partial class Dump
|
||||
|
||||
if(_aborted) return;
|
||||
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
int pass = 1;
|
||||
bool forward = true;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -785,7 +784,7 @@ partial class Dump
|
||||
|
||||
foreach(int bs in tmpArray)
|
||||
{
|
||||
var badSector = (uint)bs;
|
||||
uint badSector = (uint)bs;
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Logging;
|
||||
using Humanizer;
|
||||
using Humanizer.Bytes;
|
||||
|
||||
@@ -66,8 +66,8 @@ partial class Dump
|
||||
byte[] cmdBuf; // Data buffer
|
||||
double cmdDuration; // Command execution time
|
||||
ulong sectorSpeedStart = 0; // Used to calculate correct speed
|
||||
var gotFirstTrackPregap = false;
|
||||
var firstTrackPregapSectorsGood = 0;
|
||||
bool gotFirstTrackPregap = false;
|
||||
int firstTrackPregapSectorsGood = 0;
|
||||
var firstTrackPregapMs = new MemoryStream();
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_first_track_pregap);
|
||||
@@ -164,7 +164,7 @@ partial class Dump
|
||||
bool supportsPqSubchannel, bool supportsRwSubchannel,
|
||||
Database.Models.Device dbDev, out bool inexactPositioning, bool dumping)
|
||||
{
|
||||
var sense = true; // Sense indicator
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] subBuf = null;
|
||||
int posQ;
|
||||
uint retries;
|
||||
@@ -211,10 +211,10 @@ partial class Dump
|
||||
// Initialize the dictionary
|
||||
foreach(Track t in tracks) pregaps[t.Sequence] = 0;
|
||||
|
||||
for(var t = 0; t < tracks.Length; t++)
|
||||
for(int t = 0; t < tracks.Length; t++)
|
||||
{
|
||||
Track track = tracks[t];
|
||||
var trackRetries = 0;
|
||||
int trackRetries = 0;
|
||||
|
||||
// First track of each session has at least 150 sectors of pregap and is not always readable
|
||||
if(tracks.Where(trk => trk.Session == track.Session).MinBy(trk => trk.Sequence).Sequence == track.Sequence)
|
||||
@@ -245,14 +245,14 @@ partial class Dump
|
||||
AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Track_0, track.Sequence);
|
||||
|
||||
int lba = (int)track.StartSector - 1;
|
||||
var pregapFound = false;
|
||||
bool pregapFound = false;
|
||||
Track previousTrack = tracks.FirstOrDefault(trk => trk.Sequence == track.Sequence - 1);
|
||||
|
||||
var goneBack = false;
|
||||
var goFront = false;
|
||||
var forward = false;
|
||||
var crcOk = false;
|
||||
var previousPregapIsPreviousTrack = false;
|
||||
bool goneBack = false;
|
||||
bool goFront = false;
|
||||
bool forward = false;
|
||||
bool crcOk = false;
|
||||
bool previousPregapIsPreviousTrack = false;
|
||||
|
||||
// Check if pregap is 0
|
||||
for(retries = 0; retries < 10 && !pregapFound; retries++)
|
||||
@@ -315,7 +315,7 @@ partial class Dump
|
||||
subBuf[6] = 0;
|
||||
|
||||
// Fix BCD numbering
|
||||
for(var i = 1; i < 10; i++)
|
||||
for(int i = 1; i < 10; i++)
|
||||
{
|
||||
if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F;
|
||||
|
||||
@@ -442,7 +442,7 @@ partial class Dump
|
||||
subBuf[6] = 0;
|
||||
|
||||
// Fix BCD numbering
|
||||
for(var i = 1; i < 10; i++)
|
||||
for(int i = 1; i < 10; i++)
|
||||
{
|
||||
if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F;
|
||||
|
||||
@@ -668,7 +668,7 @@ partial class Dump
|
||||
if(dumping)
|
||||
{
|
||||
// Minus five, to ensure dumping will fix if there is a pregap LBA 0
|
||||
var red = 5;
|
||||
int red = 5;
|
||||
|
||||
while(trk.Pregap > 0 && red > 0)
|
||||
{
|
||||
@@ -784,7 +784,7 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
var tmpBuf = new byte[96];
|
||||
byte[] tmpBuf = new byte[96];
|
||||
Array.Copy(cmdBuf, 2352, tmpBuf, 0, 96);
|
||||
subBuf = DeinterleaveQ(tmpBuf);
|
||||
}
|
||||
@@ -988,10 +988,10 @@ partial class Dump
|
||||
/// <returns>De-interleaved Q subchannel</returns>
|
||||
static byte[] DeinterleaveQ(byte[] subchannel)
|
||||
{
|
||||
var q = new int[subchannel.Length / 8];
|
||||
int[] q = new int[subchannel.Length / 8];
|
||||
|
||||
// De-interlace Q subchannel
|
||||
for(var iq = 0; iq < subchannel.Length; iq += 8)
|
||||
for(int iq = 0; iq < subchannel.Length; iq += 8)
|
||||
{
|
||||
q[iq / 8] = (subchannel[iq] & 0x40) << 1;
|
||||
q[iq / 8] += subchannel[iq + 1] & 0x40;
|
||||
@@ -1003,9 +1003,9 @@ partial class Dump
|
||||
q[iq / 8] += (subchannel[iq + 7] & 0x40) >> 6;
|
||||
}
|
||||
|
||||
var deQ = new byte[q.Length];
|
||||
byte[] deQ = new byte[q.Length];
|
||||
|
||||
for(var iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq];
|
||||
for(int iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq];
|
||||
|
||||
return deQ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user