diff --git a/CICMMetadata b/CICMMetadata
index 8efa10e1..07d2e66e 160000
--- a/CICMMetadata
+++ b/CICMMetadata
@@ -1 +1 @@
-Subproject commit 8efa10e1e4efacf6e174e155d18faea213f5fe64
+Subproject commit 07d2e66e295ffbc036a5a3a16df6a8ebe810bd91
diff --git a/DiscImageChef.Core/DataFile.cs b/DiscImageChef.Core/DataFile.cs
index c7122f68..18bbe410 100644
--- a/DiscImageChef.Core/DataFile.cs
+++ b/DiscImageChef.Core/DataFile.cs
@@ -105,26 +105,32 @@ namespace DiscImageChef.Core
WriteTo(who, outputPrefix + outputSuffix, data, what);
}
- public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null)
+ public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null, bool overwrite = false)
{
if(!string.IsNullOrEmpty(filename))
{
- if(!File.Exists(filename))
+ if(File.Exists(filename))
{
- try
+ if(overwrite)
+ File.Delete(filename);
+ else
{
- DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
- FileStream outputFs = new FileStream(filename, FileMode.CreateNew);
- outputFs.Write(data, 0, data.Length);
- outputFs.Close();
- }
- catch
- {
- DicConsole.ErrorWriteLine("Unable to write file {0}", filename);
+ DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
+ return;
}
}
- else
- DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
+
+ try
+ {
+ DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
+ FileStream outputFs = new FileStream(filename, FileMode.CreateNew);
+ outputFs.Write(data, 0, data.Length);
+ outputFs.Close();
+ }
+ catch
+ {
+ DicConsole.ErrorWriteLine("Unable to write file {0}", filename);
+ }
}
}
}
diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs
index 474c4d6f..9acdaabc 100644
--- a/DiscImageChef.Core/Devices/Dumping/XGD.cs
+++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs
@@ -91,12 +91,25 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- // TODO: Correct metadata
- /*sidecar.OpticalDisc[0].XboxSecuritySectors = new DumpType();
- sidecar.OpticalDisc[0].XboxSecuritySectors.Image = outputPrefix + ".bca.bin";
- sidecar.OpticalDisc[0].XboxSecuritySectors.Size = cmdBuf.Length;
- sidecar.OpticalDisc[0].XboxSecuritySectors.Checksums = Checksum.GetChecksums(cmbBuf).ToArray();
- DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].XboxSecuritySectors.Image, tmpBuf);*/
+ byte[] tmpBuf = new byte[ssBuf.Length - 4];
+ Array.Copy(ssBuf, 4, tmpBuf, 0, ssBuf.Length - 4);
+ sidecar.OpticalDisc[0].Xbox = new XboxType()
+ {
+ SecuritySectors = new XboxSecuritySectorsType[]
+ {
+ new XboxSecuritySectorsType()
+ {
+ RequestNumber = 0,
+ RequestVersion = 1,
+ SecuritySectors = new DumpType()
+ {
+ Image = outputPrefix + ".ss.bin",
+ Size = tmpBuf.Length,
+ Checksums = Checksum.GetChecksums(tmpBuf).ToArray()
+ }
+ }
+ }
+ };
DataFile.WriteTo("SCSI Dump", outputPrefix + ".ss.bin", ssBuf);
ulong l0Video, l1Video, middleZone, gameSize, totalSize, layerBreak;
@@ -122,9 +135,33 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.ErrorWriteLine("Cannot get PFI.");
return;
}
+ tmpBuf = new byte[readBuffer.Length - 4];
+ Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
+ sidecar.OpticalDisc[0].PFI = new DumpType
+ {
+ Image = outputPrefix + ".pfi.bin",
+ Size = tmpBuf.Length,
+ Checksums = Checksum.GetChecksums(tmpBuf).ToArray()
+ };
+ DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].PFI.Image, tmpBuf, "Locked PFI", true);
DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize);
l0Video = Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1;
l1Video = totalSize - l0Video + 1;
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration);
+ if(sense)
+ {
+ DicConsole.ErrorWriteLine("Cannot get DMI.");
+ return;
+ }
+ tmpBuf = new byte[readBuffer.Length - 4];
+ Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
+ sidecar.OpticalDisc[0].DMI = new DumpType
+ {
+ Image = outputPrefix + ".dmi.bin",
+ Size = tmpBuf.Length,
+ Checksums = Checksum.GetChecksums(tmpBuf).ToArray()
+ };
+ DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].DMI.Image, tmpBuf, "Locked DMI", true);
// Get game partition size
DicConsole.DebugWriteLine("Dump-media command", "Getting game partition size");
@@ -168,6 +205,33 @@ namespace DiscImageChef.Core.Devices.Dumping
blocks = totalSize + 1;
middleZone = totalSize - (Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1) - gameSize + 1;
+ tmpBuf = new byte[readBuffer.Length - 4];
+ Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
+ sidecar.OpticalDisc[0].Xbox.PFI = new DumpType
+ {
+ Image = outputPrefix + ".xboxpfi.bin",
+ Size = tmpBuf.Length,
+ Checksums = Checksum.GetChecksums(tmpBuf).ToArray()
+ };
+ DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].Xbox.PFI.Image, tmpBuf, "Unlocked PFI", true);
+
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration);
+ if(sense)
+ {
+ DicConsole.ErrorWriteLine("Cannot get DMI.");
+ return;
+ }
+ tmpBuf = new byte[readBuffer.Length - 4];
+ Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
+ sidecar.OpticalDisc[0].Xbox.DMI = new DumpType
+ {
+ Image = outputPrefix + ".xboxdmi.bin",
+ Size = tmpBuf.Length,
+ Checksums = Checksum.GetChecksums(tmpBuf).ToArray()
+ };
+ DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].Xbox.DMI.Image, tmpBuf, "Unlocked DMI", true);
+
+
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
layerBreak = l0Video + middleZone + gameSize / 2;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
index 0b118928..bd621b68 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
@@ -215,7 +215,7 @@ namespace DiscImageChef.Devices
/// Timeout.
/// Duration.
/// The SS sector.
- public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
+ public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, byte requestNumber = 0x00)
{
buffer = new byte[2048];
byte[] cdb = new byte[12];
@@ -232,8 +232,7 @@ namespace DiscImageChef.Devices
cdb[7] = 0x00;
cdb[8] = 0x08;
cdb[9] = 0x00;
- // TODO: Documentation puts this as xx but doesn't say what is the meaning.
- cdb[10] = 0x00;
+ cdb[10] = requestNumber;
cdb[11] = 0xC0;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);