-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAlcohol.bt
188 lines (171 loc) · 3.84 KB
/
Alcohol.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
//------------------------------------------------
//--- 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;
}
}