On drives that support D8h use it to read Audio CD sectors as some fail due to a firmware bug.

This commit is contained in:
2020-03-02 23:58:20 +00:00
parent 18db5ed8a5
commit f423d99b08
7 changed files with 123 additions and 21 deletions

View File

@@ -49,13 +49,38 @@ namespace Aaru.Core.Devices.Dumping
bool read16, bool readcd, int sectorsForOffset, uint subSize,
MmcSubchannel supportedSubchannel, bool supportsLongSectors, ref double totalDuration)
{
DateTime start;
DateTime end;
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
byte[] tmpBuf; // Temporary buffer
DateTime start;
DateTime end;
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
byte[] tmpBuf; // Temporary buffer
PlextorSubchannel supportedPlextorSubchannel;
switch(supportedSubchannel)
{
case MmcSubchannel.None:
supportedPlextorSubchannel = PlextorSubchannel.None;
break;
case MmcSubchannel.Raw:
supportedPlextorSubchannel = PlextorSubchannel.All;
break;
case MmcSubchannel.Q16:
supportedPlextorSubchannel = PlextorSubchannel.Q16;
break;
case MmcSubchannel.Rw:
supportedPlextorSubchannel = PlextorSubchannel.Pack;
break;
default:
supportedPlextorSubchannel = PlextorSubchannel.None;
break;
}
if(_resume.BadBlocks.Count <= 0 ||
_aborted ||
@@ -98,7 +123,14 @@ namespace Aaru.Core.Devices.Dumping
sectorsToTrim = (byte)(sectorsForOffset + 1);
}
if(readcd)
if(_supportsPlextorD8 && audioExtents.Contains(badSector))
{
sense = _dev.PlextorReadCdDa(out cmdBuf, out _, badSectorToRead, blockSize, sectorsToTrim,
supportedPlextorSubchannel, _dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
}
else if(readcd)
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToRead, blockSize, sectorsToTrim,
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
true, MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);