diff --git a/aaruformat.bt b/aaruformat.bt index c7ce458..69cdbce 100644 --- a/aaruformat.bt +++ b/aaruformat.bt @@ -3,7 +3,7 @@ // // File: aaruformat.bt // Authors: Natalia Portillo -// Version: 1.1 +// Version: 1.2 // Purpose: Aaru format // Category: Misc // File Mask: *.dicf @@ -11,6 +11,7 @@ // History: // 1.0 2018-01-26 Natalia Portillo: Initial release // 1.1 2020-02-29 Natalia Portillo: Rebranding +// 1.2 2020-03-04 Natalia Portillo: Add version 2 index //------------------------------------------------ #define DIC_MAGIC 0x544D52464D434944 @@ -677,14 +678,22 @@ enum DataType CdSectorPrefixCorrected = 76, CdSectorSuffixCorrected = 77, CompactDiscMode2Subheader = 78, - CompactDiscLeadIn = 79 + CompactDiscLeadIn = 79, + DecryptedDVDDiscKey = 80, + DVD_CPI_MAI = 81, + DecryptedDVDTitleKey = 82, + FluxData = 83, + BitstreamData = 84 }; enum BlockType { DataBlock = 0x4B4C4244, DeDuplicationTable = 0X2A544444, + DeDuplicationTable2 = 0x32454444, Index = 0X58444E49, + Index2 = 0x32584449, + IndexContinuation = 0x43584449, GeometryBlock = 0x4D4F4547, MetadataBlock = 0x4154454D, TracksBlock = 0x534B5254, @@ -694,7 +703,12 @@ enum BlockType SnapshotBlock = 0x50414E53, ParentBlock = 0x50524E54, DumpHardwareBlock = 0x2A504D44, - TapeFileBlock = 0x454C4654 + TapeFileBlock = 0x454C4654, + TwinSectorTable = 0x42545754, + CompactDiscIndexesBlock = 0x58494443, + FluxDataBlock = 0x58554C46, + BitstreamDataBlock = 0x53544942, + TrackLayoutBlock = 0x594C4B54 }; enum TrackType @@ -728,7 +742,12 @@ typedef struct uint64 indexOffset; FILETIME creationTime; FILETIME lastWrittenTime; -} DicHeader; + if(imageMajorVersion >= 3) + { + uint32 mediaType2; + GUID imageIdentifier; + } +} AaruHeader; typedef struct { @@ -743,6 +762,27 @@ typedef struct uint64 crc64 ; } DdtHeader; +typedef struct +{ + BlockType identifier; + DataType type; + CompressionType compression; + byte shift; + byte levels; + byte tableLevel; + uint64 previousLevel; + uint16 negative; + uint64 start; + byte alignment; + byte shift; + byte sizeType; + uint64 entries; + uint64 cmpLength; + uint64 length; + uint64 cmpCrc64 ; + uint64 crc64 ; +} Ddt2Header; + typedef struct { BlockType blockType; @@ -758,6 +798,23 @@ typedef struct IndexEntry items[entries]; } Index; +typedef struct +{ + BlockType identifier; + uint64 entries; + uint64 crc64 ; + IndexEntry items[entries]; +} Index2; + +typedef struct +{ + BlockType identifier; + uint64 entries; + uint64 crc64 ; + uint64 previous; + IndexEntry items[entries]; +} IndexContinuation; + typedef struct { BlockType identifier; @@ -881,7 +938,7 @@ typedef struct if(type == 4) char checksum[length] ; else - byte checksum[length]; + byte checksum[length] ; } ChecksumEntry ; typedef struct @@ -905,7 +962,7 @@ typedef struct BlockType identifier; uint entries; uint64 length; - uint64 crc64; + uint64 crc64 ; TapeFileEntry files[entries]; } TapeFileHeader; @@ -921,20 +978,128 @@ typedef struct BlockType identifier; byte entries; uint64 length; - uint64 crc64; + uint64 crc64 ; TapePartitionEntry partitions[entries]; } TapePartitionHeader; +typedef struct +{ + BlockType identifier; + byte alignment; + byte shift; + uint64 entries; + uint64 length; + uint64 crc64 ; + uint64 pointers[entries]; +} TwinSectorTable; + +typedef struct +{ + BlockType identifier; + uint64 length; + GUID parentId; + uint16 parentClueLength; + char parentClue[parentClueLength]; +} ParentFileBlock; + +typedef struct +{ + BlockType identifier; + uint64 length; + uint16 generation; + uint64 indexOffset; + FILETIME creationTime; +} SnapshotBlock; + +typedef struct +{ + uint16 track; + uint16 index; + uint32 lba; +} CompactDiscIndexEntry; + +typedef struct +{ + BlockType identifier; + uint16 entries; + uint64 length; + uint64 crc64 ; + CompactDiscIndexEntry indexes[entries]; +} CompactDiscIndexesBlock; + +typedef struct +{ + uint32 head; + uint16 track; + byte subtrack; + uint64 resolution; + uint64 tableEntry; +} FluxDataEntry; + +typedef struct +{ + BlockType identifier; + uint16 entries; + uint64 crc64 ; + FluxDataEntry fluxes[entries]; +} FluxDataBlock; + +typedef struct +{ + uint32 head; + uint16 track; + byte subtrack; + uint64 tableEntry; +} BitstreamDataEntry; + +typedef struct +{ + BlockType identifier; + uint16 entries; + uint64 crc64 ; + BitstreamDataEntry bitstreams[entries]; +} BitstreamDataBlock; + +typedef struct +{ + uint16 sector; + uint64 block; +} SectorMapEntry; + +typedef struct +{ + BlockType identifier; + uint64 crc64 ; + uint32 head; + uint16 track; + byte subtrack; + uint16 sectors; + uint64 flux; + uint64 bitstream; + SectorMapEntry mappings[sectors]; +} TrackLayoutBlock; + LittleEndian(); local int i; -Assert(ReadUInt64() == DIC_MAGIC && ReadUInt64() == AARU_MAGIC, "Incorrect signature!"); +Assert(ReadUInt64() == DIC_MAGIC || ReadUInt64() == AARU_MAGIC, "Incorrect signature!"); -DicHeader header; +AaruHeader header; FSeek(header.indexOffset); -Index index; +local uint idxid = ReadUInt(); +FSeek(header.indexOffset); + +if(idxid == 0x32584449) +{ + Index2 index; +} +else +{ + Index index; +} + for(i = 0; i < index.entries; i++) { FSeek(index.items[i].offset); @@ -1030,5 +1195,34 @@ for(i = 0; i < index.entries; i++) case 0x454C4654: TapeFileHeader files; break; + case 0x32454444: + Ddt2Header deduplicationTable2; + break; + case 0x43584449: // TODO: Index Continuation + IndexContinuation indexContinuation; + break; + case 0x2A4D5044: // TODO: Data Position Measurement + break; + case 0x50414E53: + SnapshotBlock snapshot; + break; + case 0x50524E54: + ParentFileBlock parent; + break; + case 0x42545754: + TwinSectorTable twinSector; + break; + case 0x58494443: + CompactDiscIndexesBlock compactDiscIndexes; + break; + case 0x58554C46: + FluxDataBlock fluxData; + break; + case 0x53544942: + BitstreamDataBlock bitstreamData; + break; + case 0x594C4B54: + TrackLayoutBlock trackLayout; + break; } } \ No newline at end of file