mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add option to select dump speed for MMC devices. Fixes #218
This commit is contained in:
@@ -1540,6 +1540,21 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
audioExtents.Add(audioTrack.TrackStartSector, audioTrack.TrackEndSector);
|
||||
}
|
||||
|
||||
// Set speed
|
||||
if(_speedMultiplier >= 0)
|
||||
{
|
||||
_dumpLog.WriteLine($"Setting speed to {_speed}x.");
|
||||
UpdateStatus?.Invoke($"Setting speed to {_speed}x.");
|
||||
|
||||
_speed *= _speedMultiplier;
|
||||
|
||||
if(_speed == 0 ||
|
||||
_speed > 0xFFFF)
|
||||
_speed = 0xFFFF;
|
||||
|
||||
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _);
|
||||
}
|
||||
|
||||
// Start reading
|
||||
start = DateTime.UtcNow;
|
||||
currentSpeed = 0;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
readonly CICMMetadataType _preSidecar;
|
||||
readonly ushort _retryPasses;
|
||||
readonly bool _stopOnError;
|
||||
readonly DumpSubchannel _subchannel;
|
||||
bool _aborted;
|
||||
DicContext _ctx; // Master database context
|
||||
Database.Models.Device _dbDev; // Device database entry
|
||||
@@ -49,7 +50,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Resume _resume;
|
||||
Sidecar _sidecarClass;
|
||||
uint _skip;
|
||||
readonly DumpSubchannel _subchannel;
|
||||
int _speed;
|
||||
int _speedMultiplier;
|
||||
|
||||
/// <summary>Initializes dumpers</summary>
|
||||
/// <param name="doResume">Should resume?</param>
|
||||
@@ -76,7 +78,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError, Resume resume, DumpLog dumpLog,
|
||||
Encoding encoding, string outputPrefix, string outputPath, Dictionary<string, string> formatOptions,
|
||||
CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim, bool dumpFirstTrackPregap,
|
||||
bool fixOffset, bool debug, DumpSubchannel subchannel)
|
||||
bool fixOffset, bool debug, DumpSubchannel subchannel, int speed)
|
||||
{
|
||||
_doResume = doResume;
|
||||
_dev = dev;
|
||||
@@ -103,6 +105,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
_debug = debug;
|
||||
_maximumReadable = 64;
|
||||
_subchannel = subchannel;
|
||||
_speedMultiplier = -1;
|
||||
_speed = speed;
|
||||
}
|
||||
|
||||
/// <summary>Starts dumping with the stablished fields and autodetecting the device type</summary>
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
byte[] tmpBuf;
|
||||
bool compactDisc = true;
|
||||
bool isXbox = false;
|
||||
_speedMultiplier = 1;
|
||||
|
||||
// TODO: Log not only what is it reading, but if it was read correctly or not.
|
||||
sense = _dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, _dev.Timeout,
|
||||
@@ -69,10 +70,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
switch(ftr.CurrentProfile)
|
||||
{
|
||||
case 0x0001:
|
||||
dskType = MediaType.GENERIC_HDD;
|
||||
dskType = MediaType.GENERIC_HDD;
|
||||
_speedMultiplier = -1;
|
||||
goto default;
|
||||
case 0x0002:
|
||||
dskType = MediaType.PD650;
|
||||
dskType = MediaType.PD650;
|
||||
_speedMultiplier = -1;
|
||||
goto default;
|
||||
case 0x0005:
|
||||
dskType = MediaType.CDMO;
|
||||
@@ -91,33 +94,42 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
break;
|
||||
case 0x0010:
|
||||
dskType = MediaType.DVDROM;
|
||||
dskType = MediaType.DVDROM;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0011:
|
||||
dskType = MediaType.DVDR;
|
||||
dskType = MediaType.DVDR;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0012:
|
||||
dskType = MediaType.DVDRAM;
|
||||
dskType = MediaType.DVDRAM;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0013:
|
||||
case 0x0014:
|
||||
dskType = MediaType.DVDRW;
|
||||
dskType = MediaType.DVDRW;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0015:
|
||||
case 0x0016:
|
||||
dskType = MediaType.DVDRDL;
|
||||
dskType = MediaType.DVDRDL;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0017:
|
||||
dskType = MediaType.DVDRWDL;
|
||||
dskType = MediaType.DVDRWDL;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0018:
|
||||
dskType = MediaType.DVDDownload;
|
||||
dskType = MediaType.DVDDownload;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x001A:
|
||||
dskType = MediaType.DVDPRW;
|
||||
dskType = MediaType.DVDPRW;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x001B:
|
||||
dskType = MediaType.DVDPR;
|
||||
dskType = MediaType.DVDPR;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0020:
|
||||
dskType = MediaType.DDCD;
|
||||
@@ -129,38 +141,49 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
dskType = MediaType.DDCDRW;
|
||||
goto default;
|
||||
case 0x002A:
|
||||
dskType = MediaType.DVDPRWDL;
|
||||
dskType = MediaType.DVDPRWDL;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x002B:
|
||||
dskType = MediaType.DVDPRDL;
|
||||
dskType = MediaType.DVDPRDL;
|
||||
_speedMultiplier = 9;
|
||||
goto default;
|
||||
case 0x0040:
|
||||
dskType = MediaType.BDROM;
|
||||
dskType = MediaType.BDROM;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0041:
|
||||
case 0x0042:
|
||||
dskType = MediaType.BDR;
|
||||
dskType = MediaType.BDR;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0043:
|
||||
dskType = MediaType.BDRE;
|
||||
dskType = MediaType.BDRE;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0050:
|
||||
dskType = MediaType.HDDVDROM;
|
||||
dskType = MediaType.HDDVDROM;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0051:
|
||||
dskType = MediaType.HDDVDR;
|
||||
dskType = MediaType.HDDVDR;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0052:
|
||||
dskType = MediaType.HDDVDRAM;
|
||||
dskType = MediaType.HDDVDRAM;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0053:
|
||||
dskType = MediaType.HDDVDRW;
|
||||
dskType = MediaType.HDDVDRW;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x0058:
|
||||
dskType = MediaType.HDDVDRDL;
|
||||
dskType = MediaType.HDDVDRDL;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
case 0x005A:
|
||||
dskType = MediaType.HDDVDRWDL;
|
||||
dskType = MediaType.HDDVDRWDL;
|
||||
_speedMultiplier = 30;
|
||||
goto default;
|
||||
default:
|
||||
compactDisc = false;
|
||||
|
||||
@@ -405,6 +405,21 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
_dumpLog.WriteLine("Resuming from block {0}.", _resume.NextBlock);
|
||||
}
|
||||
|
||||
// Set speed
|
||||
if(_speedMultiplier >= 0)
|
||||
{
|
||||
_dumpLog.WriteLine($"Setting speed to {_speed}x.");
|
||||
UpdateStatus?.Invoke($"Setting speed to {_speed}x.");
|
||||
|
||||
_speed *= _speedMultiplier;
|
||||
|
||||
if(_speed == 0 ||
|
||||
_speed > 0xFFFF)
|
||||
_speed = 0xFFFF;
|
||||
|
||||
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _);
|
||||
}
|
||||
|
||||
bool newTrim = false;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
@@ -383,6 +383,21 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
_dumpLog.WriteLine("Using SCSI READ (12) command.");
|
||||
UpdateStatus?.Invoke("Using SCSI READ (12) command.");
|
||||
|
||||
// Set speed
|
||||
if(_speedMultiplier >= 0)
|
||||
{
|
||||
_dumpLog.WriteLine($"Setting speed to {_speed}x.");
|
||||
UpdateStatus?.Invoke($"Setting speed to {_speed}x.");
|
||||
|
||||
_speed *= _speedMultiplier;
|
||||
|
||||
if(_speed == 0 ||
|
||||
_speed > 0xFFFF)
|
||||
_speed = 0xFFFF;
|
||||
|
||||
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _);
|
||||
}
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(read12)
|
||||
|
||||
Reference in New Issue
Block a user