Always use raw subchannel internally.

This commit is contained in:
2020-05-05 15:46:32 +01:00
parent 9506e0fdcc
commit de890b3461
8 changed files with 71 additions and 21 deletions

View File

@@ -385,9 +385,13 @@ namespace Aaru.Core.Devices.Dumping
_outputPlugin.WriteSectorsLong(data, i + r, 1); _outputPlugin.WriteSectorsLong(data, i + r, 1);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorsTag(sub, i + r, 1, SectorTagType.CdSectorSubchannel); _outputPlugin.WriteSectorsTag(sub, i + r, 1, SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)(i + r), 1); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)(i + r), 1);
} }
@@ -502,9 +506,13 @@ namespace Aaru.Core.Devices.Dumping
_outputPlugin.WriteSectorsLong(data, i, blocksToRead); _outputPlugin.WriteSectorsLong(data, i, blocksToRead);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorsTag(sub, i, blocksToRead, SectorTagType.CdSectorSubchannel); _outputPlugin.WriteSectorsTag(sub, i, blocksToRead, SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)i, blocksToRead); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)i, blocksToRead);
} }

View File

@@ -755,7 +755,9 @@ namespace Aaru.Core.Devices.Dumping
tmpBuf = new byte[subSize]; tmpBuf = new byte[subSize];
Array.Copy(cmdBuf, sectorSize, tmpBuf, 0, subSize); Array.Copy(cmdBuf, sectorSize, tmpBuf, 0, subSize);
// TODO: Convert Q16 to RAW if(supportedSubchannel == MmcSubchannel.Q16)
tmpBuf = Subchannel.ConvertQToRaw(tmpBuf);
ret = _outputPlugin.WriteSectorTag(tmpBuf, 0, SectorTagType.CdSectorSubchannel); ret = _outputPlugin.WriteSectorTag(tmpBuf, 0, SectorTagType.CdSectorSubchannel);
if(!ret) if(!ret)

View File

@@ -37,6 +37,7 @@ using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console; using Aaru.Console;
using Aaru.Core.Logging; using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI;
using Aaru.Devices; using Aaru.Devices;
using Schemas; using Schemas;
@@ -280,9 +281,13 @@ 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);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel); _outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1);
} }
@@ -382,9 +387,13 @@ 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);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel); _outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1);
} }

View File

@@ -34,6 +34,7 @@ using System;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Extents;
using Aaru.Core.Logging; using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Devices; using Aaru.Devices;
using Schemas; using Schemas;
@@ -307,10 +308,14 @@ namespace Aaru.Core.Devices.Dumping
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable); _outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorsTag(sub, i, _maximumReadable, _outputPlugin.WriteSectorsTag(sub, i, _maximumReadable,
SectorTagType.CdSectorSubchannel); SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)i, subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)i,
_maximumReadable); _maximumReadable);

View File

@@ -34,6 +34,7 @@ using System;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Extents;
using Aaru.Core.Logging; using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Devices; using Aaru.Devices;
using Schemas; using Schemas;
@@ -179,9 +180,13 @@ 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);
// TODO: Convert Q16 to RAW
if(desiredSubchannel != MmcSubchannel.None) if(desiredSubchannel != MmcSubchannel.None)
{
if(supportedSubchannel == MmcSubchannel.Q16)
sub = Subchannel.ConvertQToRaw(sub);
_outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel); _outputPlugin.WriteSectorTag(sub, badSector, SectorTagType.CdSectorSubchannel);
}
subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1); subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)badSector, 1);
} }

View File

@@ -1670,6 +1670,10 @@ namespace Aaru.DiscImages
Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize); Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize);
} }
if(tag == SectorTagType.CdSectorSubchannel &&
chars.Subchannel == TrackSubchannelType.Q16Interleaved)
return Subchannel.ConvertQToRaw(buffer);
return buffer; return buffer;
} }

View File

@@ -535,8 +535,7 @@ namespace Aaru.DiscImages
var partition = new Partition var partition = new Partition
{ {
Description = track.TrackDescription, Size = (ulong)(trackLen * track.TrackBytesPerSector), Description = track.TrackDescription, Size = (ulong)(trackLen * track.TrackBytesPerSector),
Length = trackLen, Sequence = track.TrackSequence, Length = trackLen, Sequence = track.TrackSequence, Offset = track.TrackFileOffset,
Offset = track.TrackFileOffset,
Start = track.TrackStartSector, Type = track.TrackType.ToString() Start = track.TrackStartSector, Type = track.TrackType.ToString()
}; };
@@ -705,10 +704,9 @@ namespace Aaru.DiscImages
public byte[] ReadSectors(ulong sectorAddress, uint length) public byte[] ReadSectors(ulong sectorAddress, uint length)
{ {
foreach(KeyValuePair<uint, ulong> kvp in from kvp in offsetmap where sectorAddress >= kvp.Value foreach(KeyValuePair<uint, ulong> kvp in from kvp in offsetmap where sectorAddress >= kvp.Value
from track in Tracks where track.TrackSequence == kvp.Key from track in Tracks where track.TrackSequence == kvp.Key
where sectorAddress < where sectorAddress < track.TrackEndSector select kvp)
track.TrackEndSector select kvp)
return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key);
throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found");
@@ -720,8 +718,7 @@ namespace Aaru.DiscImages
Where(kvp => sectorAddress >= kvp.Value). Where(kvp => sectorAddress >= kvp.Value).
Where(kvp => Tracks. Where(kvp => Tracks.
Where(track => track.TrackSequence == kvp.Key). Where(track => track.TrackSequence == kvp.Key).
Any(track => sectorAddress < Any(track => sectorAddress < track.TrackEndSector)))
track.TrackEndSector)))
return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag);
throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found");
@@ -959,11 +956,17 @@ namespace Aaru.DiscImages
throw new ArgumentException("Unsupported tag requested for this track", throw new ArgumentException("Unsupported tag requested for this track",
nameof(tag)); nameof(tag));
case TrackSubchannelType.Q16Interleaved: case TrackSubchannelType.Q16Interleaved:
throw new ArgumentException("Q16 subchannel not yet supported");
sectorSize = 16;
break;
default:
sectorSize = 96;
break;
} }
sectorOffset = 2352; sectorOffset = 2352;
sectorSize = 96;
sectorSkip = 0; sectorSkip = 0;
break; break;
@@ -1007,11 +1010,16 @@ namespace Aaru.DiscImages
throw new ArgumentException("Unsupported tag requested for this track", throw new ArgumentException("Unsupported tag requested for this track",
nameof(tag)); nameof(tag));
case TrackSubchannelType.Q16Interleaved: case TrackSubchannelType.Q16Interleaved:
throw new ArgumentException("Q16 subchannel not yet supported"); sectorSize = 16;
break;
default:
sectorSize = 96;
break;
} }
sectorOffset = 2352; sectorOffset = 2352;
sectorSize = 96;
sectorSkip = 0; sectorSkip = 0;
break; break;
@@ -1031,11 +1039,16 @@ namespace Aaru.DiscImages
throw new ArgumentException("Unsupported tag requested for this track", throw new ArgumentException("Unsupported tag requested for this track",
nameof(tag)); nameof(tag));
case TrackSubchannelType.Q16Interleaved: case TrackSubchannelType.Q16Interleaved:
throw new ArgumentException("Q16 subchannel not yet supported"); sectorSize = 16;
break;
default:
sectorSize = 96;
break;
} }
sectorOffset = 2352; sectorOffset = 2352;
sectorSize = 96;
sectorSkip = 0; sectorSkip = 0;
break; break;
@@ -1083,6 +1096,10 @@ namespace Aaru.DiscImages
Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize); Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize);
} }
if(aaruTrack.TrackSubchannelType == TrackSubchannelType.Q16Interleaved &&
tag == SectorTagType.CdSectorSubchannel)
return Subchannel.ConvertQToRaw(buffer);
return buffer; return buffer;
} }