From e2d4ea76b860ea6f5b46de4a31fdfec6235c710a Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 23 Oct 2025 11:21:47 +0100 Subject: [PATCH] Add support for negative and overflow sectors in image creation --- Aaru.CommonTypes/Enums/Images.cs | 6 +- .../Interfaces/IBaseWritableImage.cs | 5 +- Aaru.Core/Devices/Dumping/ATA.cs | 3 +- Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs | 18 ++++-- Aaru.Core/Devices/Dumping/MiniDisc.cs | 2 +- .../PlayStationPortable/MemoryStick.cs | 2 +- .../Dumping/PlayStationPortable/UMD.cs | 4 +- Aaru.Core/Devices/Dumping/SSC.cs | 12 ++-- Aaru.Core/Devices/Dumping/Sbc/Dump.cs | 55 ++++++++++++++++--- Aaru.Core/Devices/Dumping/SecureDigital.cs | 2 + Aaru.Core/Devices/Dumping/XGD.cs | 7 ++- .../Windows/ImageConvertViewModel.cs | 3 + Aaru.Images/A2R/Write.cs | 4 +- Aaru.Images/AaruFormat/Write.cs | 14 ++--- Aaru.Images/Alcohol120/Write.cs | 4 +- Aaru.Images/Anex86/Write.cs | 4 +- Aaru.Images/Apple2MG/Write.cs | 4 +- Aaru.Images/AppleDOS/Write.cs | 4 +- Aaru.Images/Apridisk/Write.cs | 4 +- Aaru.Images/BLU/Write.cs | 4 +- Aaru.Images/ByteAddressable/AtariLynx.cs | 5 +- Aaru.Images/ByteAddressable/GameBoy.cs | 5 +- Aaru.Images/ByteAddressable/GameBoyAdvance.cs | 5 +- Aaru.Images/ByteAddressable/MasterSystem.cs | 8 +-- Aaru.Images/ByteAddressable/NES.cs | 35 ++++++------ Aaru.Images/ByteAddressable/Nintendo64.cs | 5 +- Aaru.Images/ByteAddressable/SegaMegaDrive.cs | 5 +- Aaru.Images/ByteAddressable/SuperNintendo.cs | 25 +++++---- Aaru.Images/CDRDAO/Write.cs | 9 ++- Aaru.Images/CDRWin/Write.cs | 9 ++- Aaru.Images/CisCopy/Write.cs | 4 +- Aaru.Images/CloneCD/Write.cs | 4 +- Aaru.Images/CopyTape/Write.cs | 4 +- Aaru.Images/DiskCopy42/Write.cs | 4 +- Aaru.Images/DriDiskCopy/Write.cs | 4 +- Aaru.Images/MaxiDisk/Write.cs | 4 +- Aaru.Images/NHDr0/Write.cs | 4 +- Aaru.Images/Parallels/Write.cs | 4 +- Aaru.Images/QCOW/Write.cs | 4 +- Aaru.Images/QCOW2/Write.cs | 4 +- Aaru.Images/QED/Write.cs | 4 +- Aaru.Images/RayDIM/Write.cs | 4 +- Aaru.Images/RsIde/Write.cs | 4 +- Aaru.Images/SaveDskF/Write.cs | 4 +- Aaru.Images/SuperCardPro/Write.cs | 4 +- Aaru.Images/T98/Write.cs | 4 +- Aaru.Images/UDIF/Write.cs | 4 +- Aaru.Images/VDI/Write.cs | 4 +- Aaru.Images/VHD/Write.cs | 4 +- Aaru.Images/VMware/Write.cs | 4 +- Aaru.Images/Virtual98/Write.cs | 4 +- Aaru.Images/ZZZRawImage/Write.cs | 4 +- .../Issues/OpticalImageConvertIssueTest.cs | 4 ++ .../WritableOpticalMediaImageTest.cs | 4 ++ Aaru/Commands/Image/Convert.cs | 5 ++ 55 files changed, 223 insertions(+), 150 deletions(-) diff --git a/Aaru.CommonTypes/Enums/Images.cs b/Aaru.CommonTypes/Enums/Images.cs index 75142d0a4..bbdf9d190 100644 --- a/Aaru.CommonTypes/Enums/Images.cs +++ b/Aaru.CommonTypes/Enums/Images.cs @@ -407,7 +407,11 @@ public enum OpticalImageCapabilities : ulong /// Can store more than 1 track in media that is not CD based (DVD et al)? CanStoreNotCdTracks = 0x8000, /// Can store hidden tracks with a type different from track 1? - CanStoreHiddenTracks = 0x10000 + CanStoreHiddenTracks = 0x10000, + /// Can store negative sectors (sectors before LBA 0)? + CanStoreNegativeSectors = 0x20000, + /// Can store overflow sectors (sectors after media reported size)? + CanStoreOverflowSectors = 0x40000 } /// Enumeration of linear memory device types diff --git a/Aaru.CommonTypes/Interfaces/IBaseWritableImage.cs b/Aaru.CommonTypes/Interfaces/IBaseWritableImage.cs index 8381cf2e5..f15441c0b 100644 --- a/Aaru.CommonTypes/Interfaces/IBaseWritableImage.cs +++ b/Aaru.CommonTypes/Interfaces/IBaseWritableImage.cs @@ -77,9 +77,12 @@ public interface IBaseWritableImage : IBaseImage /// that will be written in the image /// Options to be used when creating new image /// How many sectors the media has. + /// How many negative sectors the image is prepared to store. + /// How many overflow sectors the image is prepared to store. /// Size of each sector in bytes. /// true if operating completed successfully, false otherwise - bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize); + bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize); /// Closes the image and flushes all data to disk /// Error number diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs index 6da7bf35b..7d526f72c 100644 --- a/Aaru.Core/Devices/Dumping/ATA.cs +++ b/Aaru.Core/Devices/Dumping/ATA.cs @@ -240,7 +240,8 @@ public partial class Dump _dev.IsPcmcia, blocks); - ret = outputFormat.Create(_outputPath, mediaType, _formatOptions, blocks, blockSize); + // TODO: HPA + ret = outputFormat.Create(_outputPath, mediaType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs index 1f46eed2c..642ebbc6c 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -955,6 +955,14 @@ sealed partial class Dump dskType, _formatOptions, blocks, + (uint)(outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities + .CanStoreNegativeSectors) + ? 2750 + : 0), + (uint)(outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities + .CanStoreOverflowSectors) + ? 2750 + : 0), supportsLongSectors ? blockSize : 2048); // Cannot create image @@ -1082,9 +1090,8 @@ sealed partial class Dump foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub); if(_resume.NextBlock < blocks) - { - for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i); - } + for(ulong i = _resume.NextBlock; i < blocks; i++) + subchannelExtents.Add((int)i); } if(_resume.NextBlock > 0) @@ -1499,9 +1506,8 @@ sealed partial class Dump supportsLongSectors); foreach(Tuple leadoutExtent in leadOutExtents.ToArray()) - { - for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e); - } + for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) + subchannelExtents.Remove((int)e); if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel) { diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs index cac8cfb11..17233dfa2 100644 --- a/Aaru.Core/Devices/Dumping/MiniDisc.cs +++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs @@ -213,7 +213,7 @@ partial class Dump _dimensions); var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs index 40e5e1d38..2bc5428cd 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs @@ -132,7 +132,7 @@ public partial class Dump _dimensions); var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs index 285f85ca0..b4dee4314 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs @@ -157,7 +157,9 @@ public partial class Dump _dimensions); var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); - ret = outputOptical.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + + // TODO: Get the PFI from the UMD + ret = outputOptical.Create(_outputPath, dskType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) diff --git a/Aaru.Core/Devices/Dumping/SSC.cs b/Aaru.Core/Devices/Dumping/SSC.cs index d624d2267..f226e200c 100644 --- a/Aaru.Core/Devices/Dumping/SSC.cs +++ b/Aaru.Core/Devices/Dumping/SSC.cs @@ -285,9 +285,8 @@ partial class Dump Modes.DecodedMode? decMode = null; if(!sense && !_dev.Error) - { - if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType); - } + if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) + decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType); UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6); @@ -315,9 +314,8 @@ partial class Dump if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration); if(!sense && !_dev.Error) - { - if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); - } + if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) + decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); // TODO: Check partitions page if(decMode.HasValue) @@ -826,7 +824,7 @@ partial class Dump return; } - ret = outputTape.Create(_outputPath, dskType, _formatOptions, 0, 0); + ret = outputTape.Create(_outputPath, dskType, _formatOptions, 0, 0, 0, 0); // Cannot create image if(!ret) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index c0f33b4f3..4ed4f69be 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -78,7 +78,7 @@ partial class Dump bool sense; byte scsiMediumType = 0; byte scsiDensityCode = 0; - bool containsFloppyPage = false; + var containsFloppyPage = false; const ushort sbcProfile = 0x0001; double totalDuration = 0; double currentSpeed = 0; @@ -366,12 +366,12 @@ partial class Dump _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); - bool imageCreated = false; + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + var imageCreated = false; if(!opticalDisc) { - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) @@ -388,12 +388,23 @@ partial class Dump _dumpStopwatch.Restart(); double imageWriteDuration = 0; - bool writeSingleOpticalTrack = true; + var writeSingleOpticalTrack = true; + uint nominalNegativeSectors = 0; if(opticalDisc) { if(outputFormat is IWritableOpticalImage opticalPlugin) { + mediaTags.TryGetValue(MediaTagType.DVD_PFI, out byte[] pfi); + PFI.PhysicalFormatInformation? decodedPfi = PFI.Decode(pfi, dskType); + + if(decodedPfi.HasValue) nominalNegativeSectors = decodedPfi.Value.DataAreaStartPSN; + + mediaTags.TryGetValue(MediaTagType.BD_DI, out byte[] di); + DI.DiscInformation? decodedDi = DI.Decode(di); + + if(decodedDi.HasValue) nominalNegativeSectors = decodedDi.Value.Units[0].FirstAun; + sense = _dev.ReadDiscInformation(out byte[] readBuffer, out _, MmcDiscInformationDataTypes.DiscInformation, @@ -515,7 +526,19 @@ partial class Dump else tracks = tracks.OrderBy(t => t.Sequence).ToList(); - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, + dskType, + _formatOptions, + blocks, + (outputFormat as IWritableOpticalImage).OpticalCapabilities + .HasFlag(OpticalImageCapabilities.CanStoreNegativeSectors) + ? nominalNegativeSectors + : 0, + (outputFormat as IWritableOpticalImage).OpticalCapabilities + .HasFlag(OpticalImageCapabilities.CanStoreOverflowSectors) + ? 15000u + : 0, + blockSize); // Cannot create image if(!ret) @@ -582,7 +605,7 @@ partial class Dump } else if(decMode?.Pages != null) { - bool setGeometry = false; + var setGeometry = false; foreach(Modes.ModePage page in decMode.Value.Pages) { @@ -636,7 +659,21 @@ partial class Dump if(!imageCreated) { - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, + dskType, + _formatOptions, + blocks, + (outputFormat as IWritableOpticalImage).OpticalCapabilities + .HasFlag(OpticalImageCapabilities + .CanStoreNegativeSectors) + ? nominalNegativeSectors + : 0, + (outputFormat as IWritableOpticalImage).OpticalCapabilities + .HasFlag(OpticalImageCapabilities + .CanStoreOverflowSectors) + ? 15000u + : 0, + blockSize); // Cannot create image if(!ret) @@ -736,7 +773,7 @@ partial class Dump if(_resume?.BlankExtents != null) blankExtents = ExtentsConverter.FromMetadata(_resume.BlankExtents); - bool newTrim = false; + var newTrim = false; if(mediaTags.TryGetValue(MediaTagType.DVD_CMI, out byte[] cmi) && Settings.Settings.Current.EnableDecryption && diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs index fe4c2e3d0..ea5a8c252 100644 --- a/Aaru.Core/Devices/Dumping/SecureDigital.cs +++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs @@ -446,6 +446,8 @@ public partial class Dump _dev.Type == DeviceType.SecureDigital ? MediaType.SecureDigital : MediaType.MMC, _formatOptions, blocks, + 0, + 0, blockSize); // Cannot create image diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs index 4213ef2dd..3e2f896a8 100644 --- a/Aaru.Core/Devices/Dumping/XGD.cs +++ b/Aaru.Core/Devices/Dumping/XGD.cs @@ -506,7 +506,7 @@ partial class Dump _dimensions); var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); - ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); + ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, 0, 0, blockSize); // Cannot create image if(!ret) @@ -1086,8 +1086,9 @@ partial class Dump List tmpList = []; foreach(ulong ur in _resume.BadBlocks) - for(ulong i = ur; i < ur + blocksToRead; i++) - tmpList.Add(i); + { + for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i); + } tmpList.Sort(); diff --git a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs index 1720812b6..68713400f 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs @@ -519,10 +519,13 @@ public sealed partial class ImageConvertViewModel : ViewModelBase Progress2Indeterminate = true; }); + // TODO: Get the source image number of negative and overflow sectors to convert them too if(!outputFormat.Create(DestinationText, _inputFormat.Info.MediaType, parsedOptions, _inputFormat.Info.Sectors, + 0, + 0, _inputFormat.Info.SectorSize)) { await Dispatcher.UIThread.InvokeAsync(async () => await MessageBoxManager diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs index 2d4d47b5a..4ed0458f5 100644 --- a/Aaru.Images/A2R/Write.cs +++ b/Aaru.Images/A2R/Write.cs @@ -125,8 +125,8 @@ public sealed partial class A2R uint captureIndex) => ErrorNumber.NoError; /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { try { diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index 670376508..0072d69fe 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -185,8 +185,8 @@ public sealed partial class AaruFormat } /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { // Convert options dictionary to string format string optionsString = options is { Count: > 0 } @@ -288,9 +288,8 @@ public sealed partial class AaruFormat // Convert array of booleans to List of enums for(nuint i = 0; i < sizet_length; i++) - { - if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i); - } + if(sectorTagsBuffer[i] != 0) + _imageInfo.ReadableSectorTags.Add((SectorTagType)i); sizet_length = 0; ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length); @@ -314,9 +313,8 @@ public sealed partial class AaruFormat // Convert array of booleans to List of enums for(nuint i = 0; i < sizet_length; i++) - { - if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i); - } + if(mediaTagsBuffer[i] != 0) + _imageInfo.ReadableMediaTags.Add((MediaTagType)i); ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence); diff --git a/Aaru.Images/Alcohol120/Write.cs b/Aaru.Images/Alcohol120/Write.cs index 9c33e59f9..aca9feee8 100644 --- a/Aaru.Images/Alcohol120/Write.cs +++ b/Aaru.Images/Alcohol120/Write.cs @@ -51,8 +51,8 @@ public sealed partial class Alcohol120 #region IWritableOpticalImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { diff --git a/Aaru.Images/Anex86/Write.cs b/Aaru.Images/Anex86/Write.cs index 7f15e38b7..cc7d95d32 100644 --- a/Aaru.Images/Anex86/Write.cs +++ b/Aaru.Images/Anex86/Write.cs @@ -48,8 +48,8 @@ public sealed partial class Anex86 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize == 0) { diff --git a/Aaru.Images/Apple2MG/Write.cs b/Aaru.Images/Apple2MG/Write.cs index 6a7643fb6..4ba8cfafa 100644 --- a/Aaru.Images/Apple2MG/Write.cs +++ b/Aaru.Images/Apple2MG/Write.cs @@ -48,8 +48,8 @@ public sealed partial class Apple2Mg #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/AppleDOS/Write.cs b/Aaru.Images/AppleDOS/Write.cs index cded671d8..4992b8f21 100644 --- a/Aaru.Images/AppleDOS/Write.cs +++ b/Aaru.Images/AppleDOS/Write.cs @@ -46,8 +46,8 @@ public sealed partial class AppleDos #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 256) { diff --git a/Aaru.Images/Apridisk/Write.cs b/Aaru.Images/Apridisk/Write.cs index b1702d786..c19c6ea39 100644 --- a/Aaru.Images/Apridisk/Write.cs +++ b/Aaru.Images/Apridisk/Write.cs @@ -49,8 +49,8 @@ public sealed partial class Apridisk #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { diff --git a/Aaru.Images/BLU/Write.cs b/Aaru.Images/BLU/Write.cs index 0565b76d1..5027086f2 100644 --- a/Aaru.Images/BLU/Write.cs +++ b/Aaru.Images/BLU/Write.cs @@ -53,8 +53,8 @@ public sealed partial class Blu #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/ByteAddressable/AtariLynx.cs b/Aaru.Images/ByteAddressable/AtariLynx.cs index 17051b207..bf3bd70a2 100644 --- a/Aaru.Images/ByteAddressable/AtariLynx.cs +++ b/Aaru.Images/ByteAddressable/AtariLynx.cs @@ -158,8 +158,9 @@ public partial class AtariLynx : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/GameBoy.cs b/Aaru.Images/ByteAddressable/GameBoy.cs index 3487cfc49..7cdc063c7 100644 --- a/Aaru.Images/ByteAddressable/GameBoy.cs +++ b/Aaru.Images/ByteAddressable/GameBoy.cs @@ -168,8 +168,9 @@ public partial class GameBoy : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/GameBoyAdvance.cs b/Aaru.Images/ByteAddressable/GameBoyAdvance.cs index bff8dd7d9..c702d11be 100644 --- a/Aaru.Images/ByteAddressable/GameBoyAdvance.cs +++ b/Aaru.Images/ByteAddressable/GameBoyAdvance.cs @@ -148,8 +148,9 @@ public partial class GameBoyAdvance : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/MasterSystem.cs b/Aaru.Images/ByteAddressable/MasterSystem.cs index a432f88d0..8f6f4dbff 100644 --- a/Aaru.Images/ByteAddressable/MasterSystem.cs +++ b/Aaru.Images/ByteAddressable/MasterSystem.cs @@ -139,8 +139,7 @@ public partial class MasterSystem : IByteAddressableImage MetadataMediaType = MetadataMediaType.LinearMedia }; - Header header = - Marshal.ByteArrayToStructureBigEndian
(_data, headerPosition, Marshal.SizeOf
()); + Header header = Marshal.ByteArrayToStructureBigEndian
(_data, headerPosition, Marshal.SizeOf
()); var sb = new StringBuilder(); @@ -252,8 +251,9 @@ public partial class MasterSystem : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/NES.cs b/Aaru.Images/ByteAddressable/NES.cs index 878449b45..db2c27811 100644 --- a/Aaru.Images/ByteAddressable/NES.cs +++ b/Aaru.Images/ByteAddressable/NES.cs @@ -75,9 +75,9 @@ public class Nes : IByteAddressableImage if(stream.Length < 16) return false; stream.Position = 0; - byte[] magicBytes = new byte[4]; + var magicBytes = new byte[4]; stream.EnsureRead(magicBytes, 0, 8); - uint magic = BitConverter.ToUInt32(magicBytes, 0); + var magic = BitConverter.ToUInt32(magicBytes, 0); return magic == 0x1A53454E; } @@ -93,9 +93,9 @@ public class Nes : IByteAddressableImage if(stream.Length < 16) return ErrorNumber.InvalidArgument; stream.Position = 0; - byte[] header = new byte[16]; + var header = new byte[16]; stream.EnsureRead(header, 0, 8); - uint magic = BitConverter.ToUInt32(header, 0); + var magic = BitConverter.ToUInt32(header, 0); if(magic != 0x1A53454E) return ErrorNumber.InvalidArgument; @@ -294,8 +294,9 @@ public class Nes : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() @@ -314,7 +315,7 @@ public class Nes : IByteAddressableImage return false; } - byte[] header = new byte[16]; + var header = new byte[16]; if(_nesHeaderInfo is null) { @@ -682,16 +683,16 @@ public class Nes : IByteAddressableImage return ErrorNumber.ReadOnly; } - bool foundRom = false; - bool foundChrRom = false; - bool foundInstRom = false; - bool foundProm = false; - bool foundRam = false; - bool foundChrRam = false; - bool foundNvram = false; - bool foundChrNvram = false; - bool foundMapper = false; - bool foundSubMapper = false; + var foundRom = false; + var foundChrRom = false; + var foundInstRom = false; + var foundProm = false; + var foundRam = false; + var foundChrRam = false; + var foundNvram = false; + var foundChrNvram = false; + var foundMapper = false; + var foundSubMapper = false; // Sanitize foreach(LinearMemoryDevice map in mappings.Devices) diff --git a/Aaru.Images/ByteAddressable/Nintendo64.cs b/Aaru.Images/ByteAddressable/Nintendo64.cs index 6dce1d0c8..d8bc93010 100644 --- a/Aaru.Images/ByteAddressable/Nintendo64.cs +++ b/Aaru.Images/ByteAddressable/Nintendo64.cs @@ -819,8 +819,9 @@ public partial class Nintendo64 : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/SegaMegaDrive.cs b/Aaru.Images/ByteAddressable/SegaMegaDrive.cs index 22420de00..f7e70a969 100644 --- a/Aaru.Images/ByteAddressable/SegaMegaDrive.cs +++ b/Aaru.Images/ByteAddressable/SegaMegaDrive.cs @@ -383,8 +383,9 @@ public partial class SegaMegaDrive : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() diff --git a/Aaru.Images/ByteAddressable/SuperNintendo.cs b/Aaru.Images/ByteAddressable/SuperNintendo.cs index 98a8757df..9123b216b 100644 --- a/Aaru.Images/ByteAddressable/SuperNintendo.cs +++ b/Aaru.Images/ByteAddressable/SuperNintendo.cs @@ -62,7 +62,7 @@ public class SuperNintendo : IByteAddressableImage return false; Header header; - byte[] headerBytes = new byte[48]; + var headerBytes = new byte[48]; switch(stream.Length) { @@ -110,8 +110,8 @@ public class SuperNintendo : IByteAddressableImage // Not sure but seems to be a multiple of at least this if(stream.Length % 32768 != 0) return ErrorNumber.InvalidArgument; - bool found = false; - byte[] headerBytes = new byte[48]; + var found = false; + var headerBytes = new byte[48]; switch(stream.Length) { @@ -271,8 +271,9 @@ public class SuperNintendo : IByteAddressableImage public IEnumerable SupportedSectorTags => Array.Empty(); /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) => Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) => + Create(path, mediaType, options, (long)sectors) == ErrorNumber.NoError; /// public bool Close() @@ -375,7 +376,7 @@ public class SuperNintendo : IByteAddressableImage bool hasFlash = _header is { OldMakerCode: 0x33, ExpansionFlashSize: > 0 }; bool hasBattery = chipset is 2 or 5 or 6 or 9 or 0xA; - int devices = 1; + var devices = 1; if(hasRam) devices++; @@ -398,8 +399,8 @@ public class SuperNintendo : IByteAddressableImage } }; - int pos = 1; - ulong addr = (ulong)_data.Length; + var pos = 1; + var addr = (ulong)_data.Length; if(hasRam) { @@ -539,10 +540,10 @@ public class SuperNintendo : IByteAddressableImage return ErrorNumber.ReadOnly; } - bool foundRom = false; - bool foundRam = false; - bool foundExtraRam = false; - bool foundFlash = false; + var foundRom = false; + var foundRam = false; + var foundExtraRam = false; + var foundFlash = false; // Sanitize foreach(LinearMemoryDevice map in mappings.Devices) diff --git a/Aaru.Images/CDRDAO/Write.cs b/Aaru.Images/CDRDAO/Write.cs index 88a54f212..543833db1 100644 --- a/Aaru.Images/CDRDAO/Write.cs +++ b/Aaru.Images/CDRDAO/Write.cs @@ -50,8 +50,8 @@ public sealed partial class Cdrdao #region IWritableOpticalImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(options != null) { @@ -487,9 +487,8 @@ public sealed partial class Cdrdao } if(_writingTracks != null && _writingStreams != null) - { - foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close(); - } + foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) + oldTrack.Close(); ulong currentOffset = 0; _writingTracks = []; diff --git a/Aaru.Images/CDRWin/Write.cs b/Aaru.Images/CDRWin/Write.cs index 1cac4b2a2..f11b70aec 100644 --- a/Aaru.Images/CDRWin/Write.cs +++ b/Aaru.Images/CDRWin/Write.cs @@ -49,8 +49,8 @@ public sealed partial class CdrWin #region IWritableOpticalImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(options != null) { @@ -422,9 +422,8 @@ public sealed partial class CdrWin } if(_writingTracks != null && _writingStreams != null) - { - foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close(); - } + foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) + oldTrack.Close(); _writingTracks = []; diff --git a/Aaru.Images/CisCopy/Write.cs b/Aaru.Images/CisCopy/Write.cs index 90f33ac5f..34e69bd3f 100644 --- a/Aaru.Images/CisCopy/Write.cs +++ b/Aaru.Images/CisCopy/Write.cs @@ -46,8 +46,8 @@ public sealed partial class CisCopy #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/CloneCD/Write.cs b/Aaru.Images/CloneCD/Write.cs index cdd510c85..8cb501831 100644 --- a/Aaru.Images/CloneCD/Write.cs +++ b/Aaru.Images/CloneCD/Write.cs @@ -52,8 +52,8 @@ public sealed partial class CloneCd #region IWritableOpticalImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { diff --git a/Aaru.Images/CopyTape/Write.cs b/Aaru.Images/CopyTape/Write.cs index 4232a7178..59ef96d9f 100644 --- a/Aaru.Images/CopyTape/Write.cs +++ b/Aaru.Images/CopyTape/Write.cs @@ -53,8 +53,8 @@ public sealed partial class CopyTape #region IWritableTapeImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { diff --git a/Aaru.Images/DiskCopy42/Write.cs b/Aaru.Images/DiskCopy42/Write.cs index 380ddf38b..e1a23fff6 100644 --- a/Aaru.Images/DiskCopy42/Write.cs +++ b/Aaru.Images/DiskCopy42/Write.cs @@ -47,8 +47,8 @@ public sealed partial class DiskCopy42 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { header = new Header(); var tags = false; diff --git a/Aaru.Images/DriDiskCopy/Write.cs b/Aaru.Images/DriDiskCopy/Write.cs index bca957fe0..1d540ba8f 100644 --- a/Aaru.Images/DriDiskCopy/Write.cs +++ b/Aaru.Images/DriDiskCopy/Write.cs @@ -48,8 +48,8 @@ public sealed partial class DriDiskCopy #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize == 0) { diff --git a/Aaru.Images/MaxiDisk/Write.cs b/Aaru.Images/MaxiDisk/Write.cs index a565487d8..e443bf944 100644 --- a/Aaru.Images/MaxiDisk/Write.cs +++ b/Aaru.Images/MaxiDisk/Write.cs @@ -47,8 +47,8 @@ public sealed partial class MaxiDisk #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(CountBits.Count(sectorSize) != 1 || sectorSize > 16384) { diff --git a/Aaru.Images/NHDr0/Write.cs b/Aaru.Images/NHDr0/Write.cs index 980af351e..87dc3fbe2 100644 --- a/Aaru.Images/NHDr0/Write.cs +++ b/Aaru.Images/NHDr0/Write.cs @@ -49,8 +49,8 @@ public sealed partial class Nhdr0 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 0) { diff --git a/Aaru.Images/Parallels/Write.cs b/Aaru.Images/Parallels/Write.cs index a92dfd613..d242cbfbf 100644 --- a/Aaru.Images/Parallels/Write.cs +++ b/Aaru.Images/Parallels/Write.cs @@ -49,8 +49,8 @@ public sealed partial class Parallels // TODO: Support extended /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/QCOW/Write.cs b/Aaru.Images/QCOW/Write.cs index f3d4034bd..bbc53cb90 100644 --- a/Aaru.Images/QCOW/Write.cs +++ b/Aaru.Images/QCOW/Write.cs @@ -50,8 +50,8 @@ public sealed partial class Qcow #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/QCOW2/Write.cs b/Aaru.Images/QCOW2/Write.cs index 6fb0d8c36..be9f1e1a5 100644 --- a/Aaru.Images/QCOW2/Write.cs +++ b/Aaru.Images/QCOW2/Write.cs @@ -50,8 +50,8 @@ public sealed partial class Qcow2 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/QED/Write.cs b/Aaru.Images/QED/Write.cs index 9612783ba..762f3010a 100644 --- a/Aaru.Images/QED/Write.cs +++ b/Aaru.Images/QED/Write.cs @@ -50,8 +50,8 @@ public sealed partial class Qed #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/RayDIM/Write.cs b/Aaru.Images/RayDIM/Write.cs index ef4f78ba6..9bfc4690d 100644 --- a/Aaru.Images/RayDIM/Write.cs +++ b/Aaru.Images/RayDIM/Write.cs @@ -49,8 +49,8 @@ public sealed partial class RayDim #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/RsIde/Write.cs b/Aaru.Images/RsIde/Write.cs index ea41ec448..f8ebf7283 100644 --- a/Aaru.Images/RsIde/Write.cs +++ b/Aaru.Images/RsIde/Write.cs @@ -50,8 +50,8 @@ public sealed partial class RsIde #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 256 && sectorSize != 512) { diff --git a/Aaru.Images/SaveDskF/Write.cs b/Aaru.Images/SaveDskF/Write.cs index c6044de3f..8c22aacbb 100644 --- a/Aaru.Images/SaveDskF/Write.cs +++ b/Aaru.Images/SaveDskF/Write.cs @@ -221,8 +221,8 @@ public sealed partial class SaveDskF } /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize == 0) { diff --git a/Aaru.Images/SuperCardPro/Write.cs b/Aaru.Images/SuperCardPro/Write.cs index 52ba39741..37bac3fae 100644 --- a/Aaru.Images/SuperCardPro/Write.cs +++ b/Aaru.Images/SuperCardPro/Write.cs @@ -124,8 +124,8 @@ public sealed partial class SuperCardPro public ErrorNumber WriteFluxDataCapture(ulong resolution, byte[] data, uint head, ushort track, byte subTrack, uint captureIndex) => ErrorNumber.NotImplemented; - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { try { diff --git a/Aaru.Images/T98/Write.cs b/Aaru.Images/T98/Write.cs index 72feafafa..323b1aec6 100644 --- a/Aaru.Images/T98/Write.cs +++ b/Aaru.Images/T98/Write.cs @@ -49,8 +49,8 @@ public sealed partial class T98 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 256) { diff --git a/Aaru.Images/UDIF/Write.cs b/Aaru.Images/UDIF/Write.cs index 8c4d91bcf..89a0ff095 100644 --- a/Aaru.Images/UDIF/Write.cs +++ b/Aaru.Images/UDIF/Write.cs @@ -51,8 +51,8 @@ public sealed partial class Udif #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/VDI/Write.cs b/Aaru.Images/VDI/Write.cs index ada1c56db..ba895030f 100644 --- a/Aaru.Images/VDI/Write.cs +++ b/Aaru.Images/VDI/Write.cs @@ -50,8 +50,8 @@ public sealed partial class Vdi #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/VHD/Write.cs b/Aaru.Images/VHD/Write.cs index c56a42ff7..5c6ee364b 100644 --- a/Aaru.Images/VHD/Write.cs +++ b/Aaru.Images/VHD/Write.cs @@ -173,8 +173,8 @@ public sealed partial class Vhd /// /// TODO: Resume writing - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(options != null) { diff --git a/Aaru.Images/VMware/Write.cs b/Aaru.Images/VMware/Write.cs index d10cf01fb..510fb807c 100644 --- a/Aaru.Images/VMware/Write.cs +++ b/Aaru.Images/VMware/Write.cs @@ -48,8 +48,8 @@ public sealed partial class VMware #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(options != null) { diff --git a/Aaru.Images/Virtual98/Write.cs b/Aaru.Images/Virtual98/Write.cs index 28f243ccb..750e4e429 100644 --- a/Aaru.Images/Virtual98/Write.cs +++ b/Aaru.Images/Virtual98/Write.cs @@ -49,8 +49,8 @@ public sealed partial class Virtual98 #region IWritableImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize != 512) { diff --git a/Aaru.Images/ZZZRawImage/Write.cs b/Aaru.Images/ZZZRawImage/Write.cs index 471459d5a..51c957f2d 100644 --- a/Aaru.Images/ZZZRawImage/Write.cs +++ b/Aaru.Images/ZZZRawImage/Write.cs @@ -47,8 +47,8 @@ public sealed partial class ZZZRawImage #region IWritableOpticalImage Members /// - public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, - uint sectorSize) + public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, + uint negativeSectors, uint overflowSectors, uint sectorSize) { if(sectorSize == 0) { diff --git a/Aaru.Tests/Issues/OpticalImageConvertIssueTest.cs b/Aaru.Tests/Issues/OpticalImageConvertIssueTest.cs index cfd2dae17..15d9c60b5 100644 --- a/Aaru.Tests/Issues/OpticalImageConvertIssueTest.cs +++ b/Aaru.Tests/Issues/OpticalImageConvertIssueTest.cs @@ -86,6 +86,8 @@ public abstract class OpticalImageConvertIssueTest inputFormat.Info.MediaType, ParsedOptions, inputFormat.Info.Sectors, + 0, + 0, inputFormat.Info.SectorSize), string.Format(Localization.Error_0_creating_output_image, outputOptical.ErrorMessage)); @@ -435,10 +437,12 @@ public abstract class OpticalImageConvertIssueTest } foreach(KeyValuePair isrc in isrcs) + { outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value), isrc.Key, false, SectorTagType.CdTrackIsrc); + } if(trackFlags.Count > 0) { diff --git a/Aaru.Tests/WritableImages/WritableOpticalMediaImageTest.cs b/Aaru.Tests/WritableImages/WritableOpticalMediaImageTest.cs index d34d39511..e443f5295 100644 --- a/Aaru.Tests/WritableImages/WritableOpticalMediaImageTest.cs +++ b/Aaru.Tests/WritableImages/WritableOpticalMediaImageTest.cs @@ -209,6 +209,8 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest inputFormat.Info.MediaType, new Dictionary(), inputFormat.Info.Sectors, + 0, + 0, inputFormat.Info.SectorSize), string.Format(Localization.Error_0_creating_output_image, outputFormat.ErrorMessage)); @@ -471,10 +473,12 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest result = true; } else + { result = outputFormat.WriteSectorTag(sector, doneSectors + track.StartSector, false, tag); + } } else { diff --git a/Aaru/Commands/Image/Convert.cs b/Aaru/Commands/Image/Convert.cs index 250495d64..7e6588ab4 100644 --- a/Aaru/Commands/Image/Convert.cs +++ b/Aaru/Commands/Image/Convert.cs @@ -550,10 +550,13 @@ sealed class ConvertImageCommand : Command { ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate(); + // TODO: Get the source image number of negative and overflow sectors to convert them too created = outputFormat.Create(settings.OutputPath, mediaType, parsedOptions, inputFormat.Info.Sectors, + 0, + 0, inputFormat.Info.SectorSize); }); @@ -1339,10 +1342,12 @@ sealed class ConvertImageCommand : Command } foreach(KeyValuePair isrc in isrcs) + { outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value), isrc.Key, false, SectorTagType.CdTrackIsrc); + } if(trackFlags.Count > 0) {