mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Save disc offset in metadata.
This commit is contained in:
@@ -71,6 +71,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
byte[] cmdBuf; // Data buffer
|
||||
DumpHardwareType currentTry = null; // Current dump hardware try
|
||||
double currentSpeed = 0; // Current read speed
|
||||
int? discOffset = null; // Disc write offset
|
||||
DateTime dumpStart = DateTime.UtcNow; // Time of dump start
|
||||
DateTime end; // Time of operation end
|
||||
ExtentsULong extents = null; // Extents
|
||||
@@ -919,7 +920,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
_dumpLog.WriteLine($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples).");
|
||||
UpdateStatus?.Invoke($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples).");
|
||||
|
||||
int? discOffset = offsetBytes - driveOffset;
|
||||
discOffset = offsetBytes - driveOffset;
|
||||
|
||||
_dumpLog.WriteLine($"Disc offsets is {discOffset} bytes ({discOffset / 4} samples)");
|
||||
|
||||
@@ -1057,7 +1058,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
double totalChkDuration = 0;
|
||||
|
||||
if(_metadata)
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, null, mediaTags, sessions, out totalChkDuration);
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, null, mediaTags, sessions, out totalChkDuration,
|
||||
discOffset);
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
@@ -54,8 +54,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="mediaTags">Media tags</param>
|
||||
/// <param name="sessions">Disc sessions</param>
|
||||
/// <param name="totalChkDuration">Total time spent doing checksums</param>
|
||||
/// <param name="discOffset">Disc write offset</param>
|
||||
void WriteOpticalSidecar(uint blockSize, ulong blocks, MediaType mediaType, LayersType layers,
|
||||
Dictionary<MediaTagType, byte[]> mediaTags, int sessions, out double totalChkDuration)
|
||||
Dictionary<MediaTagType, byte[]> mediaTags, int sessions, out double totalChkDuration,
|
||||
int? discOffset)
|
||||
{
|
||||
_dumpLog.WriteLine("Creating sidecar.");
|
||||
var filters = new FiltersList();
|
||||
@@ -120,6 +122,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
sidecar.OpticalDisc[0].Sessions = (uint)sessions;
|
||||
sidecar.OpticalDisc[0].Layers = layers;
|
||||
|
||||
if(discOffset.HasValue)
|
||||
{
|
||||
sidecar.OpticalDisc[0].Offset = (int)(discOffset / 4);
|
||||
sidecar.OpticalDisc[0].OffsetSpecified = true;
|
||||
}
|
||||
|
||||
if(mediaTags != null)
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> tag in mediaTags.Where(tag => _outputPlugin.
|
||||
SupportedMediaTags.
|
||||
|
||||
@@ -652,9 +652,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
double totalChkDuration = 0;
|
||||
|
||||
if(_metadata)
|
||||
{
|
||||
WriteOpticalSidecar(BLOCK_SIZE, blocks, DSK_TYPE, null, null, 1, out totalChkDuration);
|
||||
}
|
||||
WriteOpticalSidecar(BLOCK_SIZE, blocks, DSK_TYPE, null, null, 1, out totalChkDuration, null);
|
||||
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
|
||||
@@ -990,7 +990,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
// TODO: Layers
|
||||
if(opticalDisc)
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, null, mediaTags, 1, out totalChkDuration);
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, null, mediaTags, 1, out totalChkDuration, null);
|
||||
else
|
||||
{
|
||||
UpdateStatus?.Invoke("Creating sidecar.");
|
||||
|
||||
@@ -1179,7 +1179,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Value = layerBreak
|
||||
};
|
||||
|
||||
WriteOpticalSidecar(BLOCK_SIZE, blocks, dskType, layers, mediaTags, 1, out totalChkDuration);
|
||||
WriteOpticalSidecar(BLOCK_SIZE, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
Reference in New Issue
Block a user