Add PIC models from MPF

This commit is contained in:
Matt Nadareski
2023-09-13 12:20:01 -04:00
parent 5a055a98c7
commit afb20e00be
8 changed files with 212 additions and 2 deletions

15
PIC/Constants.cs Normal file
View File

@@ -0,0 +1,15 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class Constants
{
public const string DiscTypeIdentifierROM = "BDO";
public const string DiscTypeIdentifierROMUltra = "BDU";
public const string DiscTypeIdentifierReWritable = "BDW";
public const string DiscTypeIdentifierRecordable = "BDR";
}
}

38
PIC/DiscInformation.cs Normal file
View File

@@ -0,0 +1,38 @@
namespace SabreTools.Models.PIC
{
/// <summary>
/// Disc Information and Emergency Brake data shall be read from the PIC zone. DI units that
/// contain physical information shall be returned.Emergency Brake data shall be returned.The
/// information shall be collected from the layer specified in the Layer field of the CDB. If any data
/// can be returned, 4 100 bytes shall be returned.
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformation
{
/// <summary>
/// 2048 bytes for BD-ROM, 3584 bytes for BD-R/RE
/// </summary>
/// <remarks>Big-endian format</remarks>
public ushort DataStructureLength { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
/// <summary>
/// Disc information and emergency brake units
/// </summary>
#if NET48
public DiscInformationUnit[] Units { get; set; }
#else
public DiscInformationUnit?[]? Units { get; set; }
#endif
}
}

View File

@@ -0,0 +1,34 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnit
{
/// <summary>
/// Unit header
/// </summary>
#if NET48
public DiscInformationUnitHeader Header { get; set; }
#else
public DiscInformationUnitHeader? Header { get; set; }
#endif
/// <summary>
/// Unit body
/// </summary>
#if NET48
public DiscInformationUnitBody Body { get; set; }
#else
public DiscInformationUnitBody? Body { get; set; }
#endif
/// <summary>
/// Unit trailer (BD-R/RE only)
/// </summary>
#if NET48
public DiscInformationUnitTrailer Trailer { get; set; }
#else
public DiscInformationUnitTrailer? Trailer { get; set; }
#endif
}
}

View File

@@ -0,0 +1,36 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
/// TODO: Write models for the dependent contents, if possible
public class DiscInformationUnitBody
{
/// <summary>
/// Disc Type Identifier
/// = "BDO" for BD-ROM
/// = "BDU" for BD-ROM Ultra
/// = "BDW" for BD-RE
/// = "BDR" for BD-R
/// </summary>
#if NET48
public string DiscTypeIdentifier { get; set; }
#else
public string? DiscTypeIdentifier { get; set; }
#endif
/// <summary>
/// Disc Size/Class/Version
/// </summary>
public byte DiscSizeClassVersion { get; set; }
/// <summary>
/// DI Unit Format dependent contents
/// </summary>
/// <remarks>52 bytes for BD-ROM, 100 bytes for BD-R/RE</remarks>
#if NET48
public byte[] FormatDependentContents { get; set; }
#else
public byte[]? FormatDependentContents { get; set; }
#endif
}
}

View File

@@ -0,0 +1,47 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnitHeader
{
/// <summary>
/// Disc Information Identifier "DI"
/// Emergency Brake Identifier "EB"
/// </summary>
#if NET48
public string DiscInformationIdentifier { get; set; }
#else
public string? DiscInformationIdentifier { get; set; }
#endif
/// <summary>
/// Disc Information Format
/// </summary>
public byte DiscInformationFormat { get; set; }
/// <summary>
/// Number of DI units in each DI block
/// </summary>
public byte NumberOfUnitsInBlock { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
/// <summary>
/// DI unit Sequence Number
/// </summary>
public byte SequenceNumber { get; set; }
/// <summary>
/// Number of bytes in use in this DI unit
/// </summary>
public byte BytesInUse { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
namespace SabreTools.Models.PIC
{
/// <summary>
/// BD-R/RE only
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnitTrailer
{
/// <summary>
/// Disc Manufacturer ID
/// </summary>
/// <remarks>6 bytes</remarks>
#if NET48
public byte[] DiscManufacturerID { get; set; } = new byte[6];
#else
public byte[]? DiscManufacturerID { get; set; } = new byte[6];
#endif
/// <summary>
/// Media Type ID
/// </summary>
/// <remarks>3 bytes</remarks>
#if NET48
public byte[] MediaTypeID { get; set; } = new byte[3];
#else
public byte[]? MediaTypeID { get; set; } = new byte[3];
#endif
/// <summary>
/// Time Stamp
/// </summary>
public ushort TimeStamp { get; set; }
/// <summary>
/// Product Revision Number
/// </summary>
public byte ProductRevisionNumber { get; set; }
}
}

View File

@@ -20,7 +20,7 @@ namespace SabreTools.Models.Xbox
#if NET48
public string PublisherIdentifier { get; set; }
#else
public string PublisherIdentifier { get; set; }
public string? PublisherIdentifier { get; set; }
#endif
/// <summary>

View File

@@ -25,7 +25,7 @@ namespace SabreTools.Models.Xbox
#if NET48
public string PublisherIdentifier { get; set; }
#else
public string PublisherIdentifier { get; set; }
public string? PublisherIdentifier { get; set; }
#endif
/// <summary>