From 8871e7a10b1766209c99d3e391f7c211aeb51452 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 30 Sep 2021 02:03:29 +0100 Subject: [PATCH] Fix decoding disc information smaller than 34 bytes. Fixes #675 --- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 48 +++++++++++++-------------- Aaru.Decoders | 2 +- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index ffe8f9a1d..c300c8d26 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -367,7 +367,8 @@ namespace Aaru.Core.Devices.Dumping } start = DateTime.UtcNow; - double imageWriteDuration = 0; + double imageWriteDuration = 0; + bool writeSingleOpticalTrack = true; if(opticalDisc) { @@ -376,8 +377,6 @@ namespace Aaru.Core.Devices.Dumping sense = _dev.ReadDiscInformation(out readBuffer, out _, MmcDiscInformationDataTypes.DiscInformation, _dev.Timeout, out _); - bool writeSingleOpticalTrack = true; - if(!sense) { DiscInformation.StandardDiscInformation? discInformation = @@ -560,28 +559,6 @@ namespace Aaru.Core.Devices.Dumping }); } } - - if(writeSingleOpticalTrack) - { - _dumpLog.WriteLine("Creating single track as could not retrieve track list from drive."); - - StoppingErrorMessage?. - Invoke("Creating single track as could not retrieve track list from drive."); - - opticalPlugin.SetTracks(new List - { - new Track - { - TrackBytesPerSector = (int)blockSize, - TrackEndSector = blocks - 1, - TrackSequence = 1, - TrackRawBytesPerSector = (int)blockSize, - TrackSubchannelType = TrackSubchannelType.None, - TrackSession = 1, - TrackType = TrackType.Data - } - }); - } } else { @@ -653,6 +630,27 @@ namespace Aaru.Core.Devices.Dumping return; } + + if(writeSingleOpticalTrack) + { + _dumpLog.WriteLine("Creating single track as could not retrieve track list from drive."); + + StoppingErrorMessage?.Invoke("Creating single track as could not retrieve track list from drive."); + + (_outputPlugin as IWritableOpticalImage)?.SetTracks(new List + { + new Track + { + TrackBytesPerSector = (int)blockSize, + TrackEndSector = blocks - 1, + TrackSequence = 1, + TrackRawBytesPerSector = (int)blockSize, + TrackSubchannelType = TrackSubchannelType.None, + TrackSession = 1, + TrackType = TrackType.Data + } + }); + } } DumpHardwareType currentTry = null; diff --git a/Aaru.Decoders b/Aaru.Decoders index 0c1bc2464..ae375b36f 160000 --- a/Aaru.Decoders +++ b/Aaru.Decoders @@ -1 +1 @@ -Subproject commit 0c1bc246466f7d3567886617e70874bd5295e609 +Subproject commit ae375b36f560ea3885e588318e642331013d611e