mirror of
https://github.com/aaru-dps/010templates.git
synced 2025-12-16 19:24:28 +00:00
189 lines
3.8 KiB
Plaintext
189 lines
3.8 KiB
Plaintext
//------------------------------------------------
|
|
//--- 010 Editor v8.0.1 Binary Template
|
|
//
|
|
// File: Alcohol.bt
|
|
// Authors: Natalia Portillo, RibShark
|
|
// Version: 0.2
|
|
// Purpose: Alcohol 120% media descriptor.
|
|
// Category: Misc
|
|
// File Mask: *.mds
|
|
// ID Bytes: 4D 45 44 49 41 20 44 45 53 43 52 49 50 54 4F 52 // MEDIA DESCRIPTOR
|
|
// History:
|
|
// 0.1 2018-01-08 Natalia Portillo: Initial release
|
|
// 0.2 2020-07-15 RibShark: Added DPM structures
|
|
// 0.3 2023-12-23 RibShark: Fixed DPM structures and added error sector structures
|
|
//------------------------------------------------
|
|
|
|
enum <unsigned short> AlcoholMediumType
|
|
{
|
|
CD = 0x00,
|
|
CDR = 0x01,
|
|
CDRW = 0x02,
|
|
DVD = 0x10,
|
|
DVDR = 0x12
|
|
};
|
|
|
|
enum <byte> AlcoholTrackMode
|
|
{
|
|
NoData = 0x00,
|
|
Data = 0x02,
|
|
Audio = 0xA9,
|
|
Mode1 = 0xAA,
|
|
Mode2 = 0xAB,
|
|
Mode2F1 = 0xEC,
|
|
Mode2F2 = 0xED,
|
|
Mode2F1Alt = 0xAC,
|
|
Mode2F2Alt = 0xAD
|
|
};
|
|
|
|
enum <byte> AlcoholSubchannelMode
|
|
{
|
|
None = 0x00,
|
|
Interleaved = 0x08
|
|
};
|
|
|
|
enum <uint> AlcoholPhysicalBlockType
|
|
{
|
|
DPM = 0x01,
|
|
ErrorSectors = 0x02
|
|
};
|
|
|
|
typedef struct
|
|
{
|
|
char signature[16];
|
|
unsigned byte majorVersion;
|
|
unsigned byte minorVersion;
|
|
AlcoholMediumType type;
|
|
unsigned short sessions;
|
|
unsigned short unknown1[2];
|
|
unsigned short bcaLength;
|
|
unsigned int unknown2[2];
|
|
unsigned int bcaOffset;
|
|
unsigned int unknown3[6];
|
|
unsigned int structuresOffset;
|
|
unsigned int unknown4[3];
|
|
unsigned int sessionOffset;
|
|
unsigned int physicalHeaderOffset;
|
|
} AlcoholHeader;
|
|
|
|
typedef struct
|
|
{
|
|
uint pregap;
|
|
uint sectors;
|
|
} AlcoholTrackExtra <optimize=false>;
|
|
|
|
typedef struct
|
|
{
|
|
AlcoholTrackMode mode;
|
|
AlcoholSubchannelMode subMode;
|
|
byte adrCtl;
|
|
byte tno;
|
|
byte point <format=hex>;
|
|
byte min;
|
|
byte sec;
|
|
byte frame;
|
|
byte zero;
|
|
byte pmin;
|
|
byte psec;
|
|
byte pframe;
|
|
uint extraOffset;
|
|
ushort sectorSize;
|
|
byte unknown[18];
|
|
uint startLba;
|
|
uint64 startOffset;
|
|
uint files;
|
|
uint footerOffset;
|
|
byte unknown2[24];
|
|
|
|
if(extraOffset > 0)
|
|
{
|
|
local uint64 old_pos = FTell();
|
|
FSeek(extraOffset);
|
|
AlcoholTrackExtra extra;
|
|
FSeek(old_pos);
|
|
}
|
|
} AlcoholTrack <optimize=false>;
|
|
|
|
typedef struct
|
|
{
|
|
int sessionStart;
|
|
int sessionEnd;
|
|
ushort sessionSequence;
|
|
byte allBlocks;
|
|
byte nonTrackBlocks;
|
|
ushort firstTrack;
|
|
ushort lastTrack;
|
|
uint unknown;
|
|
uint trackOffset;
|
|
FSeek(this.trackOffset);
|
|
AlcoholTrack tracks[this.allBlocks];
|
|
} AlcoholSession <optimize=false>;
|
|
|
|
typedef struct
|
|
{
|
|
uint filenameOffset;
|
|
uint widechar;
|
|
uint unknown1;
|
|
uint unknown2;
|
|
} AlcoholFooter;
|
|
|
|
typedef struct
|
|
{
|
|
uint blockCount;
|
|
uint blockOffsets[this.blockCount];
|
|
} AlcoholPhysicalHeader;
|
|
|
|
typedef struct
|
|
{
|
|
uint dpmStartSector; // 0x00
|
|
uint dpmResolution;
|
|
uint dpmEntryCount;
|
|
uint dpmEntries[this.dpmEntryCount];
|
|
} AlcoholDPM;
|
|
|
|
typedef struct
|
|
{
|
|
uint unknown1; // 0x04
|
|
uint unknown2; // 0x01
|
|
uint errorCount;
|
|
uint errorSectors[this.errorCount];
|
|
} AlcoholErrorSectors;
|
|
|
|
LittleEndian();
|
|
AlcoholHeader header;
|
|
FSeek(header.sessionOffset);
|
|
AlcoholSession sessions[header.sessions];
|
|
FSeek(sessions[0].tracks[3].footerOffset);
|
|
if(FTell() > 0)
|
|
{
|
|
AlcoholFooter footer;
|
|
if(footer.filenameOffset > 0)
|
|
{
|
|
FSeek(footer.filenameOffset);
|
|
if(footer.widechar)
|
|
wstring Filename;
|
|
else
|
|
string Filename;
|
|
}
|
|
}
|
|
|
|
FSeek(header.physicalHeaderOffset);
|
|
AlcoholPhysicalHeader physicalHeader;
|
|
|
|
local int i;
|
|
for (i = 0; i < physicalHeader.blockCount; i++) {
|
|
FSeek(physicalHeader.blockOffsets[i]);
|
|
AlcoholPhysicalBlockType physicalBlockType;
|
|
|
|
switch (physicalBlockType) {
|
|
case DPM:
|
|
AlcoholDPM dpm;
|
|
break;
|
|
case ErrorSectors:
|
|
AlcoholErrorSectors errorSectors;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|