mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Read ATIP.
This commit is contained in:
@@ -73,14 +73,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
||||||
internal void CompactDisc(ref MediaType dskType)
|
internal void CompactDisc(ref MediaType dskType)
|
||||||
{
|
{
|
||||||
DicContext
|
DicContext ctx; // Master database context
|
||||||
ctx; // Master database context
|
Device dbDev; // Device database entry
|
||||||
|
CdOffset cdOffset; // Read offset from database
|
||||||
Device
|
|
||||||
dbDev; // Device database entry
|
|
||||||
|
|
||||||
CdOffset
|
|
||||||
cdOffset; // Read offset from database
|
|
||||||
|
|
||||||
bool sense; // Sense indicator
|
bool sense; // Sense indicator
|
||||||
byte[] cmdBuf; // Data buffer
|
byte[] cmdBuf; // Data buffer
|
||||||
@@ -89,6 +84,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
FullTOC.CDFullTOC? toc = null; // Full CD TOC
|
FullTOC.CDFullTOC? toc = null; // Full CD TOC
|
||||||
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
|
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
|
||||||
|
|
||||||
|
dskType = MediaType.CD;
|
||||||
|
|
||||||
if(dumpRaw)
|
if(dumpRaw)
|
||||||
{
|
{
|
||||||
dumpLog.WriteLine("Raw CD dumping not yet implemented");
|
dumpLog.WriteLine("Raw CD dumping not yet implemented");
|
||||||
@@ -148,6 +145,26 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
mediaTags.Add(MediaTagType.CD_FullTOC, tmpBuf);
|
mediaTags.Add(MediaTagType.CD_FullTOC, tmpBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ATIP exists on blank CDs
|
||||||
|
dumpLog.WriteLine("Reading ATIP");
|
||||||
|
UpdateStatus?.Invoke("Reading ATIP");
|
||||||
|
sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out _);
|
||||||
|
|
||||||
|
if(!sense)
|
||||||
|
{
|
||||||
|
ATIP.CDATIP? atip = ATIP.Decode(cmdBuf);
|
||||||
|
|
||||||
|
if(atip.HasValue)
|
||||||
|
{
|
||||||
|
// Only CD-R and CD-RW have ATIP
|
||||||
|
dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR;
|
||||||
|
|
||||||
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
||||||
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
||||||
|
mediaTags.Add(MediaTagType.CD_ATIP, tmpBuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Dumps a compact disc</summary>
|
/// <summary>Dumps a compact disc</summary>
|
||||||
@@ -172,29 +189,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
byte[] tmpBuf;
|
byte[] tmpBuf;
|
||||||
|
|
||||||
dskType = MediaType.CD;
|
|
||||||
int sessions = 1;
|
int sessions = 1;
|
||||||
|
|
||||||
// ATIP exists on blank CDs
|
|
||||||
dumpLog.WriteLine("Reading ATIP");
|
|
||||||
UpdateStatus?.Invoke("Reading ATIP");
|
|
||||||
sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out _);
|
|
||||||
|
|
||||||
if(!sense)
|
|
||||||
{
|
|
||||||
ATIP.CDATIP? atip = ATIP.Decode(cmdBuf);
|
|
||||||
|
|
||||||
if(atip.HasValue)
|
|
||||||
{
|
|
||||||
// Only CD-R and CD-RW have ATIP
|
|
||||||
dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR;
|
|
||||||
|
|
||||||
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
||||||
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
||||||
mediaTags.Add(MediaTagType.CD_ATIP, tmpBuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dumpLog.WriteLine("Reading Disc Information");
|
dumpLog.WriteLine("Reading Disc Information");
|
||||||
UpdateStatus?.Invoke("Reading Disc Information");
|
UpdateStatus?.Invoke("Reading Disc Information");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user