mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Handle run-out sectors in CD-R(W) discs. Fixes #620
This commit is contained in:
@@ -54,100 +54,101 @@
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\CdiReady.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Data.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Dump.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Error.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\LeadOuts.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Offset.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Plextor.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Pregap.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Subchannel.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Tags.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Tracks.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Trim.cs"/>
|
||||
<Compile Include="Devices\Dumping\Dump.cs"/>
|
||||
<Compile Include="Devices\Dumping\LinearMemory\Retrode.cs"/>
|
||||
<Compile Include="Devices\Dumping\Metadata.cs"/>
|
||||
<Compile Include="Devices\Dumping\MiniDisc.cs"/>
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\MemoryStick.cs"/>
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\PlayStationPortable.cs"/>
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\UMD.cs"/>
|
||||
<Compile Include="Devices\Dumping\Sbc\Data.cs"/>
|
||||
<Compile Include="Devices\Dumping\Sbc\Error.cs"/>
|
||||
<Compile Include="Devices\Dumping\Sbc\Dump.cs"/>
|
||||
<Compile Include="Devices\Dumping\Sbc\Optical.cs"/>
|
||||
<Compile Include="Devices\Dumping\Sbc\Trim.cs"/>
|
||||
<Compile Include="Devices\Info\DeviceInfo.cs"/>
|
||||
<Compile Include="Devices\Info\Plextor.cs"/>
|
||||
<Compile Include="Devices\Info\Properties.cs"/>
|
||||
<Compile Include="Devices\Report\DeviceReport.cs"/>
|
||||
<Compile Include="Devices\Report\GdRomSwapTrick.cs"/>
|
||||
<Compile Include="Devices\Report\Scsi.cs"/>
|
||||
<Compile Include="Devices\Report\MMC.cs"/>
|
||||
<Compile Include="Devices\Report\SSC.cs"/>
|
||||
<Compile Include="Devices\Scanning\MediaScan.cs"/>
|
||||
<Compile Include="Entropy.cs"/>
|
||||
<Compile Include="GetPluginBase.cs"/>
|
||||
<Compile Include="ImageInfo.cs"/>
|
||||
<Compile Include="Logging\ErrorLog.cs"/>
|
||||
<Compile Include="Logging\SubchannelLog.cs"/>
|
||||
<Compile Include="Media\CompactDisc.cs"/>
|
||||
<Compile Include="Media\Detection\MMC.cs"/>
|
||||
<Compile Include="Media\Info\CompactDisc.cs"/>
|
||||
<Compile Include="Media\Info\ScsiInfo.cs"/>
|
||||
<Compile Include="Media\Info\XgdInfo.cs"/>
|
||||
<Compile Include="Options.cs"/>
|
||||
<Compile Include="ImageFormat.cs"/>
|
||||
<Compile Include="Error.cs"/>
|
||||
<Compile Include="PrintScsiModePages.cs"/>
|
||||
<Compile Include="Sidecar\Files.cs"/>
|
||||
<Compile Include="Spectre.cs"/>
|
||||
<Compile Include="Statistics.cs"/>
|
||||
<Compile Include="Checksum.cs"/>
|
||||
<Compile Include="Logging\IBGLog.cs"/>
|
||||
<Compile Include="Logging\MHDDLog.cs"/>
|
||||
<Compile Include="Devices\Scanning\ATA.cs"/>
|
||||
<Compile Include="Devices\Scanning\SecureDigital.cs"/>
|
||||
<Compile Include="Devices\Scanning\NVMe.cs"/>
|
||||
<Compile Include="Devices\Scanning\SCSI.cs"/>
|
||||
<Compile Include="Devices\Dumping\ATA.cs"/>
|
||||
<Compile Include="Devices\Dumping\NVMe.cs"/>
|
||||
<Compile Include="Devices\Dumping\SCSI.cs"/>
|
||||
<Compile Include="Devices\Dumping\SecureDigital.cs"/>
|
||||
<Compile Include="DataFile.cs"/>
|
||||
<Compile Include="Filesystems.cs"/>
|
||||
<Compile Include="Devices\Scanning\ScanResults.cs"/>
|
||||
<Compile Include="Devices\Report\ATA.cs"/>
|
||||
<Compile Include="Devices\Report\FireWire.cs"/>
|
||||
<Compile Include="Devices\Report\USB.cs"/>
|
||||
<Compile Include="Devices\Report\SecureDigital.cs"/>
|
||||
<Compile Include="Remote.cs"/>
|
||||
<Compile Include="Devices\Report\PCMCIA.cs"/>
|
||||
<Compile Include="Devices\Reader.cs"/>
|
||||
<Compile Include="Devices\ReaderATA.cs"/>
|
||||
<Compile Include="Devices\ReaderSCSI.cs"/>
|
||||
<Compile Include="Devices\Dumping\SSC.cs"/>
|
||||
<Compile Include="Devices\Dumping\MMC.cs"/>
|
||||
<Compile Include="Devices\Dumping\XGD.cs"/>
|
||||
<Compile Include="Devices\Dumping\ResumeSupport.cs"/>
|
||||
<Compile Include="Partitions.cs"/>
|
||||
<Compile Include="Sidecar\Events.cs"/>
|
||||
<Compile Include="Sidecar\Helpers.cs"/>
|
||||
<Compile Include="Sidecar\Sidecar.cs"/>
|
||||
<Compile Include="Sidecar\OpticalDisc.cs"/>
|
||||
<Compile Include="Sidecar\BlockMedia.cs"/>
|
||||
<Compile Include="Sidecar\LinearMedia.cs"/>
|
||||
<Compile Include="Sidecar\AudioMedia.cs"/>
|
||||
<Compile Include="Sidecar\BlockTape.cs"/>
|
||||
<Compile Include="Logging\DumpLog.cs"/>
|
||||
<Compile Include="Devices\Dumping\CompactDisc\CdiReady.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Data.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Dump.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Error.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\LeadOuts.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Offset.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Plextor.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Pregap.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Recordable.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Subchannel.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Tags.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Tracks.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc\Trim.cs" />
|
||||
<Compile Include="Devices\Dumping\Dump.cs" />
|
||||
<Compile Include="Devices\Dumping\LinearMemory\Retrode.cs" />
|
||||
<Compile Include="Devices\Dumping\Metadata.cs" />
|
||||
<Compile Include="Devices\Dumping\MiniDisc.cs" />
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\MemoryStick.cs" />
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\PlayStationPortable.cs" />
|
||||
<Compile Include="Devices\Dumping\PlayStationPortable\UMD.cs" />
|
||||
<Compile Include="Devices\Dumping\Sbc\Data.cs" />
|
||||
<Compile Include="Devices\Dumping\Sbc\Error.cs" />
|
||||
<Compile Include="Devices\Dumping\Sbc\Dump.cs" />
|
||||
<Compile Include="Devices\Dumping\Sbc\Optical.cs" />
|
||||
<Compile Include="Devices\Dumping\Sbc\Trim.cs" />
|
||||
<Compile Include="Devices\Info\DeviceInfo.cs" />
|
||||
<Compile Include="Devices\Info\Plextor.cs" />
|
||||
<Compile Include="Devices\Info\Properties.cs" />
|
||||
<Compile Include="Devices\Report\DeviceReport.cs" />
|
||||
<Compile Include="Devices\Report\GdRomSwapTrick.cs" />
|
||||
<Compile Include="Devices\Report\Scsi.cs" />
|
||||
<Compile Include="Devices\Report\MMC.cs" />
|
||||
<Compile Include="Devices\Report\SSC.cs" />
|
||||
<Compile Include="Devices\Scanning\MediaScan.cs" />
|
||||
<Compile Include="Entropy.cs" />
|
||||
<Compile Include="GetPluginBase.cs" />
|
||||
<Compile Include="ImageInfo.cs" />
|
||||
<Compile Include="Logging\ErrorLog.cs" />
|
||||
<Compile Include="Logging\SubchannelLog.cs" />
|
||||
<Compile Include="Media\CompactDisc.cs" />
|
||||
<Compile Include="Media\Detection\MMC.cs" />
|
||||
<Compile Include="Media\Info\CompactDisc.cs" />
|
||||
<Compile Include="Media\Info\ScsiInfo.cs" />
|
||||
<Compile Include="Media\Info\XgdInfo.cs" />
|
||||
<Compile Include="Options.cs" />
|
||||
<Compile Include="ImageFormat.cs" />
|
||||
<Compile Include="Error.cs" />
|
||||
<Compile Include="PrintScsiModePages.cs" />
|
||||
<Compile Include="Sidecar\Files.cs" />
|
||||
<Compile Include="Spectre.cs" />
|
||||
<Compile Include="Statistics.cs" />
|
||||
<Compile Include="Checksum.cs" />
|
||||
<Compile Include="Logging\IBGLog.cs" />
|
||||
<Compile Include="Logging\MHDDLog.cs" />
|
||||
<Compile Include="Devices\Scanning\ATA.cs" />
|
||||
<Compile Include="Devices\Scanning\SecureDigital.cs" />
|
||||
<Compile Include="Devices\Scanning\NVMe.cs" />
|
||||
<Compile Include="Devices\Scanning\SCSI.cs" />
|
||||
<Compile Include="Devices\Dumping\ATA.cs" />
|
||||
<Compile Include="Devices\Dumping\NVMe.cs" />
|
||||
<Compile Include="Devices\Dumping\SCSI.cs" />
|
||||
<Compile Include="Devices\Dumping\SecureDigital.cs" />
|
||||
<Compile Include="DataFile.cs" />
|
||||
<Compile Include="Filesystems.cs" />
|
||||
<Compile Include="Devices\Scanning\ScanResults.cs" />
|
||||
<Compile Include="Devices\Report\ATA.cs" />
|
||||
<Compile Include="Devices\Report\FireWire.cs" />
|
||||
<Compile Include="Devices\Report\USB.cs" />
|
||||
<Compile Include="Devices\Report\SecureDigital.cs" />
|
||||
<Compile Include="Remote.cs" />
|
||||
<Compile Include="Devices\Report\PCMCIA.cs" />
|
||||
<Compile Include="Devices\Reader.cs" />
|
||||
<Compile Include="Devices\ReaderATA.cs" />
|
||||
<Compile Include="Devices\ReaderSCSI.cs" />
|
||||
<Compile Include="Devices\Dumping\SSC.cs" />
|
||||
<Compile Include="Devices\Dumping\MMC.cs" />
|
||||
<Compile Include="Devices\Dumping\XGD.cs" />
|
||||
<Compile Include="Devices\Dumping\ResumeSupport.cs" />
|
||||
<Compile Include="Partitions.cs" />
|
||||
<Compile Include="Sidecar\Events.cs" />
|
||||
<Compile Include="Sidecar\Helpers.cs" />
|
||||
<Compile Include="Sidecar\Sidecar.cs" />
|
||||
<Compile Include="Sidecar\OpticalDisc.cs" />
|
||||
<Compile Include="Sidecar\BlockMedia.cs" />
|
||||
<Compile Include="Sidecar\LinearMedia.cs" />
|
||||
<Compile Include="Sidecar\AudioMedia.cs" />
|
||||
<Compile Include="Sidecar\BlockTape.cs" />
|
||||
<Compile Include="Logging\DumpLog.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Aaru.Archives\Aaru.Archives.csproj"/>
|
||||
<ProjectReference Include="..\Aaru.Archives\Aaru.Archives.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"></ProjectReference>
|
||||
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj"/>
|
||||
<ProjectReference Include="..\Aaru.Decryption\Aaru.Decryption.csproj"/>
|
||||
<ProjectReference Include="..\Aaru.Dto\Aaru.Dto.csproj"/>
|
||||
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Decryption\Aaru.Decryption.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Dto\Aaru.Dto.csproj" />
|
||||
<ProjectReference Include="..\Aaru.Filesystems\Aaru.Filesystems.csproj"></ProjectReference>
|
||||
<ProjectReference Include="..\Aaru.Partitions\Aaru.Partitions.csproj"></ProjectReference>
|
||||
<ProjectReference Include="..\Aaru.Images\Aaru.Images.csproj"></ProjectReference>
|
||||
@@ -160,12 +161,12 @@
|
||||
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"></ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Logging\"/>
|
||||
<Folder Include="Devices\"/>
|
||||
<Folder Include="Devices\Scanning\"/>
|
||||
<Folder Include="Devices\Dumping\"/>
|
||||
<Folder Include="Devices\Report\"/>
|
||||
<Folder Include="Sidecar\"/>
|
||||
<Folder Include="Logging\" />
|
||||
<Folder Include="Devices\" />
|
||||
<Folder Include="Devices\Scanning\" />
|
||||
<Folder Include="Devices\Dumping\" />
|
||||
<Folder Include="Devices\Report\" />
|
||||
<Folder Include="Sidecar\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup></ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -174,23 +175,23 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Spectre.Console" Version="0.43.0"/>
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2" PrivateAssets="all"/>
|
||||
<PackageReference Include="System.Collections" Version="4.3.0"/>
|
||||
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
|
||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
|
||||
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1"/>
|
||||
<PackageReference Include="System.Runtime.Handles" Version="4.3.0"/>
|
||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
|
||||
<PackageReference Include="Spectre.Console" Version="0.43.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2" PrivateAssets="all" />
|
||||
<PackageReference Include="System.Collections" Version="4.3.0" />
|
||||
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
|
||||
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp"/>
|
||||
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" NewLineForMembersInObjectInit="False" NewLineForMembersInAnonymousTypes="False" NewLineForClausesInQuery="False" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp"/>
|
||||
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild"/>
|
||||
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" NewLineForMembersInObjectInit="False" NewLineForMembersInAnonymousTypes="False" NewLineForClausesInQuery="False" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp" />
|
||||
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
|
||||
@@ -1234,6 +1234,12 @@ sealed partial class Dump
|
||||
ref totalDuration, subLog, desiredSubchannel, tracks, isrcs, ref mcn, subchannelExtents,
|
||||
smallestPregapLbaPerTrack);
|
||||
|
||||
if(dskType is MediaType.CDR or MediaType.CDRW &&
|
||||
_resume.BadBlocks.Count > 0 &&
|
||||
_ignoreCdrRunOuts > 0)
|
||||
HandleCdrRunOutSectors(blocks, desiredSubchannel, extents, subchannelExtents, subLog, supportsLongSectors,
|
||||
trackFlags, tracks);
|
||||
|
||||
RetryCdUserData(audioExtents, blockSize, currentTry, extents, offsetBytes, readcd, sectorsForOffset, subSize,
|
||||
supportedSubchannel, ref totalDuration, subLog, desiredSubchannel, tracks, isrcs, ref mcn,
|
||||
subchannelExtents, smallestPregapLbaPerTrack, supportsLongSectors);
|
||||
|
||||
153
Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs
Normal file
153
Aaru.Core/Devices/Dumping/CompactDisc/Recordable.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Recordable.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : CompactDisc dumping.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Handles run-out sectors at end of CD-R(W) discs.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
|
||||
partial class Dump
|
||||
{
|
||||
void HandleCdrRunOutSectors(ulong blocks, MmcSubchannel desiredSubchannel, ExtentsULong extents,
|
||||
HashSet<int> subchannelExtents, SubchannelLog subLog, bool supportsLongSectors,
|
||||
Dictionary<byte, byte> trackFlags, Track[] tracks)
|
||||
{
|
||||
List<ulong> runOutSectors = new();
|
||||
|
||||
if(_outputPlugin is not IWritableOpticalImage outputOptical)
|
||||
return;
|
||||
|
||||
// Count how many run end sectors are detected as bad blocks
|
||||
for(ulong i = blocks - 1; i > blocks - 1 - _ignoreCdrRunOuts; i--)
|
||||
if(_resume.BadBlocks.Contains(i))
|
||||
runOutSectors.Add(i);
|
||||
else
|
||||
break;
|
||||
|
||||
if(runOutSectors.Count == 0)
|
||||
return;
|
||||
|
||||
_dumpLog.WriteLine($"{runOutSectors.Count} sectors at the end of the disc are unreadable. This is normal in CD-R(W) discs as these sectors are created by burning software as part of the recording process. Empty ones will be generated and stored in the image.");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke($"{runOutSectors.Count} sectors at the end of the disc are unreadable. This is normal in CD-R(W) discs as these sectors are created by burning software as part of the recording process. Empty ones will be generated and stored in the image.");
|
||||
|
||||
foreach(ulong s in runOutSectors)
|
||||
{
|
||||
Track track = tracks.FirstOrDefault(t => t.StartSector <= s && t.EndSector >= s);
|
||||
|
||||
if(track is null)
|
||||
continue;
|
||||
|
||||
var sector = new byte[2352];
|
||||
|
||||
switch(track.Type)
|
||||
{
|
||||
case TrackType.Audio: break;
|
||||
case TrackType.Data:
|
||||
sector = new byte[2048];
|
||||
|
||||
break;
|
||||
case TrackType.CdMode1: break;
|
||||
case TrackType.CdMode2Formless: break;
|
||||
case TrackType.CdMode2Form1: break;
|
||||
case TrackType.CdMode2Form2: break;
|
||||
default: continue;
|
||||
}
|
||||
|
||||
if(track.Type != TrackType.Audio &&
|
||||
track.Type != TrackType.Data)
|
||||
{
|
||||
SectorBuilder sb = new();
|
||||
sb.ReconstructPrefix(ref sector, track.Type, (long)s);
|
||||
sb.ReconstructEcc(ref sector, track.Type);
|
||||
}
|
||||
|
||||
if(supportsLongSectors)
|
||||
outputOptical.WriteSectorLong(sector, s);
|
||||
else
|
||||
outputOptical.WriteSector(Sector.GetUserData(sector), s);
|
||||
|
||||
_resume.BadBlocks.Remove(s);
|
||||
extents.Add(s);
|
||||
|
||||
if(desiredSubchannel == MmcSubchannel.None)
|
||||
continue;
|
||||
|
||||
// Hidden track
|
||||
ulong trackStart;
|
||||
|
||||
ulong pregap;
|
||||
|
||||
if(track.Sequence == 0)
|
||||
{
|
||||
track = tracks.FirstOrDefault(t => (int)t.Sequence == 1);
|
||||
trackStart = 0;
|
||||
pregap = track?.StartSector ?? 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
trackStart = track.StartSector;
|
||||
pregap = track.Pregap;
|
||||
}
|
||||
|
||||
byte flags;
|
||||
|
||||
if(!trackFlags.TryGetValue((byte)(track?.Sequence ?? 0), out byte trkFlags) &&
|
||||
track?.Type != TrackType.Audio)
|
||||
flags = (byte)CdFlags.DataTrack;
|
||||
else
|
||||
flags = trkFlags;
|
||||
|
||||
byte index;
|
||||
|
||||
if(track?.Indexes?.Count > 0)
|
||||
index = (byte)track.Indexes.LastOrDefault(i => i.Value >= (int)s).Key;
|
||||
else
|
||||
index = 0;
|
||||
|
||||
byte[] sub = Subchannel.Generate((int)s, track?.Sequence ?? 0, (int)pregap, (int)trackStart, flags, index);
|
||||
|
||||
outputOptical.WriteSectorsTag(sub, s, 1, SectorTagType.CdSectorSubchannel);
|
||||
|
||||
subLog?.WriteEntry(sub, true, (long)s, 1, true, false);
|
||||
subchannelExtents.Remove((int)s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ public partial class Dump
|
||||
Database.Models.Device _dbDev; // Device database entry
|
||||
bool _dumpFirstTrackPregap;
|
||||
bool _fixOffset;
|
||||
readonly uint _ignoreCdrRunOuts;
|
||||
uint _maximumReadable; // Maximum number of sectors drive can read at once
|
||||
Resume _resume;
|
||||
Sidecar _sidecarClass;
|
||||
@@ -149,6 +150,7 @@ public partial class Dump
|
||||
/// </param>
|
||||
/// <param name="storeEncrypted">Store encrypted data as is</param>
|
||||
/// <param name="titleKeys">Dump DVD CSS title keys</param>
|
||||
/// <param name="ignoreCdrRunOuts">How many CD-R(W) run end sectors to ignore and regenerate</param>
|
||||
public Dump(bool doResume, Device dev, string devicePath, IBaseWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError, Resume resume, DumpLog dumpLog,
|
||||
Encoding encoding, string outputPrefix, string outputPath, Dictionary<string, string> formatOptions,
|
||||
@@ -156,7 +158,7 @@ public partial class Dump
|
||||
bool fixOffset, bool debug, DumpSubchannel subchannel, int speed, bool @private,
|
||||
bool fixSubchannelPosition, bool retrySubchannel, bool fixSubchannel, bool fixSubchannelCrc,
|
||||
bool skipCdireadyHole, ErrorLog errorLog, bool generateSubchannels, uint maximumReadable,
|
||||
bool useBufferedReads, bool storeEncrypted, bool titleKeys)
|
||||
bool useBufferedReads, bool storeEncrypted, bool titleKeys, uint ignoreCdrRunOuts)
|
||||
{
|
||||
_doResume = doResume;
|
||||
_dev = dev;
|
||||
@@ -196,6 +198,7 @@ public partial class Dump
|
||||
_useBufferedReads = useBufferedReads;
|
||||
_storeEncrypted = storeEncrypted;
|
||||
_titleKeys = titleKeys;
|
||||
_ignoreCdrRunOuts = ignoreCdrRunOuts;
|
||||
}
|
||||
|
||||
/// <summary>Starts dumping with the established fields and autodetecting the device type</summary>
|
||||
|
||||
@@ -812,7 +812,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
|
||||
StopOnError, _resume, dumpLog, encoding, _outputPrefix, Destination, parsedOptions, _sidecar,
|
||||
(uint)Skipped, ExistingMetadata == false, Trim == false, Track1Pregap, true, false,
|
||||
DumpSubchannel.Any, 0, false, false, false, false, false, true, errorLog, false, 64, true,
|
||||
true, false);
|
||||
true, false, 10);
|
||||
|
||||
new Thread(DoWork).Start();
|
||||
}
|
||||
|
||||
@@ -201,6 +201,11 @@ sealed class DumpMediaCommand : Command
|
||||
"--title-keys"
|
||||
}, () => true, "Try to read the title keys from CSS encrypted DVDs (very slow)."));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--ignore-cdr-runouts"
|
||||
}, () => 10, "How many CD-R(W) run-out sectors to ignore and regenerate (0 for none)."));
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
@@ -210,7 +215,8 @@ sealed class DumpMediaCommand : Command
|
||||
bool stopOnError, string format, string subchannel, bool @private,
|
||||
bool fixSubchannelPosition, bool retrySubchannel, bool fixSubchannel,
|
||||
bool fixSubchannelCrc, bool generateSubchannels, bool skipCdiReadyHole, bool eject,
|
||||
uint maxBlocks, bool useBufferedReads, bool storeEncrypted, bool titleKeys)
|
||||
uint maxBlocks, bool useBufferedReads, bool storeEncrypted, bool titleKeys,
|
||||
uint ignoreCdrRunOuts)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
|
||||
@@ -278,6 +284,7 @@ sealed class DumpMediaCommand : Command
|
||||
AaruConsole.DebugWriteLine("Dump-Media command", "--use-buffered-reads={0}", useBufferedReads);
|
||||
AaruConsole.DebugWriteLine("Dump-Media command", "--store-encrypted={0}", storeEncrypted);
|
||||
AaruConsole.DebugWriteLine("Dump-Media command", "--title-keys={0}", titleKeys);
|
||||
AaruConsole.DebugWriteLine("Dump-Media command", "--ignore-cdr-runouts={0}", ignoreCdrRunOuts);
|
||||
|
||||
// TODO: Disabled temporarily
|
||||
//AaruConsole.DebugWriteLine("Dump-Media command", "--raw={0}", raw);
|
||||
@@ -570,7 +577,8 @@ sealed class DumpMediaCommand : Command
|
||||
outputPrefix + extension, parsedOptions, sidecar, skip, metadata, trim, firstPregap,
|
||||
fixOffset, debug, wantedSubchannel, speed, @private, fixSubchannelPosition,
|
||||
retrySubchannel, fixSubchannel, fixSubchannelCrc, skipCdiReadyHole, errorLog,
|
||||
generateSubchannels, maxBlocks, useBufferedReads, storeEncrypted, titleKeys);
|
||||
generateSubchannels, maxBlocks, useBufferedReads, storeEncrypted, titleKeys,
|
||||
ignoreCdrRunOuts);
|
||||
|
||||
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
|
||||
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
|
||||
|
||||
Reference in New Issue
Block a user