mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added correct metadata for XGD structures.
This commit is contained in:
Submodule CICMMetadata updated: 8efa10e1e4...07d2e66e29
@@ -105,12 +105,21 @@ namespace DiscImageChef.Core
|
|||||||
WriteTo(who, outputPrefix + outputSuffix, data, what);
|
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(!string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
if(!File.Exists(filename))
|
if(File.Exists(filename))
|
||||||
{
|
{
|
||||||
|
if(overwrite)
|
||||||
|
File.Delete(filename);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
|
DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
|
||||||
@@ -123,9 +132,6 @@ namespace DiscImageChef.Core
|
|||||||
DicConsole.ErrorWriteLine("Unable to write file {0}", filename);
|
DicConsole.ErrorWriteLine("Unable to write file {0}", filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,12 +91,25 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Correct metadata
|
byte[] tmpBuf = new byte[ssBuf.Length - 4];
|
||||||
/*sidecar.OpticalDisc[0].XboxSecuritySectors = new DumpType();
|
Array.Copy(ssBuf, 4, tmpBuf, 0, ssBuf.Length - 4);
|
||||||
sidecar.OpticalDisc[0].XboxSecuritySectors.Image = outputPrefix + ".bca.bin";
|
sidecar.OpticalDisc[0].Xbox = new XboxType()
|
||||||
sidecar.OpticalDisc[0].XboxSecuritySectors.Size = cmdBuf.Length;
|
{
|
||||||
sidecar.OpticalDisc[0].XboxSecuritySectors.Checksums = Checksum.GetChecksums(cmbBuf).ToArray();
|
SecuritySectors = new XboxSecuritySectorsType[]
|
||||||
DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].XboxSecuritySectors.Image, tmpBuf);*/
|
{
|
||||||
|
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);
|
DataFile.WriteTo("SCSI Dump", outputPrefix + ".ss.bin", ssBuf);
|
||||||
|
|
||||||
ulong l0Video, l1Video, middleZone, gameSize, totalSize, layerBreak;
|
ulong l0Video, l1Video, middleZone, gameSize, totalSize, layerBreak;
|
||||||
@@ -122,9 +135,33 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
DicConsole.ErrorWriteLine("Cannot get PFI.");
|
DicConsole.ErrorWriteLine("Cannot get PFI.");
|
||||||
return;
|
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);
|
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;
|
l0Video = Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1;
|
||||||
l1Video = totalSize - l0Video + 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
|
// Get game partition size
|
||||||
DicConsole.DebugWriteLine("Dump-media command", "Getting game partition size");
|
DicConsole.DebugWriteLine("Dump-media command", "Getting game partition size");
|
||||||
@@ -168,6 +205,33 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
blocks = totalSize + 1;
|
blocks = totalSize + 1;
|
||||||
middleZone = totalSize - (Decoders.DVD.PFI.Decode(readBuffer).Value.Layer0EndPSN - Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1) - gameSize + 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;
|
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||||
layerBreak = l0Video + middleZone + gameSize / 2;
|
layerBreak = l0Video + middleZone + gameSize / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace DiscImageChef.Devices
|
|||||||
/// <param name="timeout">Timeout.</param>
|
/// <param name="timeout">Timeout.</param>
|
||||||
/// <param name="duration">Duration.</param>
|
/// <param name="duration">Duration.</param>
|
||||||
/// <param name="buffer">The SS sector.</param>
|
/// <param name="buffer">The SS sector.</param>
|
||||||
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];
|
buffer = new byte[2048];
|
||||||
byte[] cdb = new byte[12];
|
byte[] cdb = new byte[12];
|
||||||
@@ -232,8 +232,7 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[7] = 0x00;
|
cdb[7] = 0x00;
|
||||||
cdb[8] = 0x08;
|
cdb[8] = 0x08;
|
||||||
cdb[9] = 0x00;
|
cdb[9] = 0x00;
|
||||||
// TODO: Documentation puts this as xx but doesn't say what is the meaning.
|
cdb[10] = requestNumber;
|
||||||
cdb[10] = 0x00;
|
|
||||||
cdb[11] = 0xC0;
|
cdb[11] = 0xC0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||||
|
|||||||
Reference in New Issue
Block a user