📄 mbcdbc.pas
字号:
procedure TMCDBurner.WritePathTable(Start: Integer; Most: Boolean);
var
i, TotalLen, Len: Integer;
p: PDirEntry;
pt: TPathTableRecord;
begin
TotalLen := 10;
pt.Name[0] := #0;
pt.Name[1] := #0;
pt.ExtAttr := 0;
if Most then
begin
pt.Address := L2MDW(Start);
pt.ParentNumber := LTOMW(1);
end
else
begin
pt.Address := Start;
pt.ParentNumber := 1;
end;
pt.LenDI := 1;
ISOHeader.Write(pt, 10);
for i := 1 to DirCounter-1 do
begin
p := PathTable[i];
Len := Length(p.ShortName);
CopyToArray(p.ShortName, pt.Name, Len);
pt.LenDI := Len;
if len mod 2 <> 0 then
begin
Len := len + 1;
pt.Name[Len-1] := #0;
end;
Len := Len+8;
if Most then
begin
pt.Address := L2MDW(p.Address+Start);
pt.ParentNumber := LToMW(p.Parent.Number);
end
else
begin
pt.Address := p.Address+Start;
pt.ParentNumber := p.Parent.Number;
end;
ISOHeader.Write(pt, Len);
Totallen := TotalLen + Len;
end;
if TotalLen - DefaultSectorSize <> 0 then
ISOHeader.Write(ZEROS, DefaultSectorSize-(TotalLen mod DefaultSectorSize));
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.SetFileAddress;
var
i: Integer;
p: PFileEntry;
begin
fFilesSizeOnDisc := 0;
for i:=0 to FileCounter-1 do
begin
p := Files[i];
if not p.Imported then
begin
if (p.Attr and faDirectory <> faDirectory) then
begin
if p.FileSize = 0 then
begin
p.FileSizeJ := 0;
p.Address := 0;
p.AddressJ := 0;
end
else
begin
p.FileSizeJ := p.FileSize;
p.Address := fFilesSizeOnDisc;
p.AddressJ := fFilesSizeOnDisc;
end;
end
else
begin
p.Address := p.DirRec.Address;
p.AddressJ := p.DirRec.AddressJ;
p.FileSize := p.DirRec.Size;;
p.FileSizeJ := p.DirRec.SizeJ;
end;
if (p.Attr and faDirectory <> faDirectory) then
begin
if p.Prev then
begin
fFilesSizeOnDisc := fFilesSizeOnDisc + Sectors2(p);
end
else
fFilesSizeOnDisc := fFilesSizeOnDisc + Sectors(p.FileSize);
end;
end;
end;
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.WritePVD;
var
rd: PDirEntry;
PVD: TVolumeDescriptor;
begin
FillChar(PVD, SizeOf(PVD), 0);
with PVD do
begin
pdType := 1;
Identifier := 'CD001';
Version := 1;
VolumeFlag := 0;
rd := Dirs[0];
RootDirRec.LenDr := 34;
RootDirRec.Extended := 0;
RootDirRec.FileFlag := 2;
RootDirRec.Address := FileDirDescriptorLocation;
RootDirRec.AddressBE := L2MDW(FileDirDescriptorLocation);
RootDirRec.VolSeqnumber := 1;
RootDirRec.VolSeqnumberBE := 256;
RootDirRec.DataLength := rd.Size;
RootDirRec.DataLengthBE := L2MDW(rd.Size);
RootDirRec.LenOfFileIdentifier := 1;
NoOfSectors := TotalNoOfSectors;
NoOfSectorsBE := L2MDW(TotalNoOfSectors);
Type1PathTable := PathTableRecsLocationL;
TypeMPathTable := L2MDW(PathTableRecsLocationM);
TypeMPathTableBE := 0;
if fJoliet then
begin
PVD.EscapeChars[0] := '%'; PVD.EscapeChars[1] := '/'; PVD.EscapeChars[2] := '@';
end;
PathTableSize := iPathTableSize;
PathTableSizeBE := L2MDW(iPathTableSize);
CopyToArray(UpperCase(fIdVolume), IdVolume, SizeOf(PVD.IdVolume));
CopyToArray(UpperCase(fIdSystem), IdSystem, SizeOf(PVD.IdSystem));
CopyToArray(UpperCase(fIdVolumeSet), IdVolumeSet, SizeOf(PVD.IdVolumeSet));
CopyToArray(UpperCase(fIdPublisher), IdPublisher, SizeOf(PVD.IdPublisher));
CopyToArray(UpperCase(fIdPreparer), IdPreparer, SizeOf(PVD.IdPreparer));
CopyToArray(UpperCase(fIdApplication), IdApplication, SizeOf(PVD.IdApplication));
CopyToArray(UpperCase(fFileCopyright), FileCopyright, SizeOf(PVD.FileCopyright));
CopyToArray(UpperCase(fFileAbstract), FileAbstract, SizeOf(PVD.FileAbstract));
CopyToArray(UpperCase(fFileBibliographic), FileBibliographic, SizeOf(PVD.FileBibliographic));
CopyToArray(UpperCase(fFileBibliographic), FileBibliographic, SizeOf(PVD.FileBibliographic));
CopyToArray(FormatDateTime('yyyymmddhhnnsszz',Now), DateCreation,16);
CopyToArray(FormatDateTime('yyyymmddhhnnsszz',Now), DateModification,16);
CopyToArray(UpperCase(fApplicationData2), ApplicationData2, 8);
CopyToArray('0000000000000000', DateExpiration,16);
CopyToArray('0000000000000000', DateEffective,16);
PVD.SectorSize := DefaultSectorSize;
PVD.SectorSizeBE := LToMW(DefaultSectorSize);
VolSetSize := 1;
VolSetSizeBE := 256;
VolSeqNumber := 1;
VolSeqNumberBE := 256;
FileStructureVer := 1;
end;
ISOHeader.Write(PVD, SizeOf(PVD)); // First Copy
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.WriteJVD;
var
rd: PDirEntry;
JVD: TVolumeDescriptor;
begin
FillChar(JVD, SizeOf(JVD), 0);
with JVD do
begin
pdType := 2;
Identifier := 'CD001';
Version := 1;
VolumeFlag := 0;
rd := Dirs[0];
RootDirRec.LenDr := 34;
RootDirRec.Extended := 0;
RootDirRec.FileFlag := 2;
RootDirRec.Address := FileDirDescriptorLocationJ;
RootDirRec.AddressBE := L2MDW(FileDirDescriptorLocationJ);
RootDirRec.VolSeqnumber := 1; RootDirRec.VolSeqnumberBE := 256;
RootDirRec.DataLength := rd.SizeJ;
RootDirRec.DataLengthBE := L2MDW(rd.SizeJ);
RootDirRec.LenOfFileIdentifier := 1;
NoOfSectors := TotalNoOfSectors;
NoOfSectorsBE := L2MDW(TotalNoOfSectors);
Type1PathTable := PathTableRecsLocationJL;
TypeMPathTable := L2MDW(PathTableRecsLocationJM);
TypeMPathTableBE := 0;
PathTableSize := iPathTableSizeJ;
PathTableSizeBE := L2MDW(iPathTableSizeJ);
JVD.EscapeChars[0] := '%';JVD.EscapeChars[1] := '/';JVD.EscapeChars[2] := '@';
CopyToArrayW(fIdVolume, IdVolume, SizeOf(JVD.IdVolume));
CopyToArrayW(fIdSystem, IdSystem, SizeOf(JVD.IdSystem));
CopyToArrayW(fIdVolumeSet, IdVolumeSet, SizeOf(JVD.IdVolumeSet));
CopyToArrayW(fIdPublisher, IdPublisher, SizeOf(JVD.IdPublisher));
CopyToArrayW(fIdPreparer, IdPreparer, SizeOf(JVD.IdPreparer));
CopyToArrayW(fIdApplication, IdApplication, SizeOf(JVD.IdApplication));
CopyToArrayW(fFileCopyright, FileCopyright, SizeOf(JVD.FileCopyright)-1);
CopyToArrayW(fFileAbstract, FileAbstract, SizeOf(JVD.FileAbstract)-1);
CopyToArrayW(fFileBibliographic, FileBibliographic, SizeOf(JVD.FileBibliographic)-1);
CopyToArray(FormatDateTime('yyyymmddhhnnsszz',fDateCreation), DateCreation,16);
CopyToArray(FormatDateTime('yyyymmddhhnnsszz',fDateModification), DateModification,16);
CopyToArray(UpperCase(fApplicationData2), ApplicationData2, 8);
CopyToArray('0000000000000000', DateExpiration,16);
CopyToArray('0000000000000000', DateEffective,16);
JVD.SectorSize := DefaultSectorSize;
JVD.SectorSizeBE := LToMW(DefaultSectorSize);
VolSetSize := 1;
VolSetSizeBE := 256;
VolSeqNumber := 1;
VolSeqNumberBE := 256;
FileStructureVer := 1;
end;
ISOHeader.Write(JVD, SizeOf(JVD));
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.WriteTVD;
var
TVD: TVolumeDescriptor;
begin
FillChar(TVD, SizeOf(TVD), 0);
with TVD do
begin
pdType := 255;
Identifier := 'CD001';
Version := 1;
end;
ISOHeader.Write(TVD, SizeOf(TVD)); // Terminator
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.WriteBootCatalog;
var
BootCatalog: TBootCatalog;
tmp: array[0..$1f] of byte;
i: Integer;
w: Word;
t: Integer;
begin
t := 0;
FillChar(BootCatalog, sizeof(BootCatalog), 0);
with BootCatalog do
begin
Header := 1;
Developer := 'Magic CD/DVD Burner'#0#0#0#0#0;
KeyByte1 := $55;
KeyByte2 := $AA;
BootIndicator := $88;
SectorCount := 1;
if BootImageSize = 600.0 then
BootMediaType := 1
else if BootImageSize = 720.0 then
BootMediaType := 2
else if BootImageSize = 1440.0 then
BootMediaType := 3
else
BootMediaType := 4;
LoadRBA := BootImageLocation;
end;
move(BootCatalog, tmp, 32);
i := 0;
while i < 32 do
begin
move(tmp[i], w, 2);
t := t + w;
inc(i, 2);
end;
w := (MaxWord + 1) - Word(t);
BootCatalog.Checksum := w;
ISOHeader.Write(BootCatalog, SizeOf(BootCatalog));
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.WriteBVD;
var
BVD: TBootVolumeDescriptor;
begin
FillChar(BVD, SizeOf(BVD), 0);
with BVD do
begin
pdType := 00;
Identifier := 'CD001';
Version := 1;
Ident := 'EL TORITO SPECIFICATION'#0#0#0#0#0#0#0#0#0;
BootCatLocation := BootCatalogLocation;
end;
ISOHeader.Write(BVD, SizeOf(BVD)); // Terminator
end;
{******************************************************************************}
{ }
{******************************************************************************}
function spc(s: String; i: Integer): String;
begin
result := copy(s+' ', 1, i);
end;
procedure TMCDBurner.Print_Files(Files: PFileEntry);
var
i: Integer;
begin
i := 0;
while Files <> nil do
begin
inc(i);
if Files.Attr = faDirectory then
DebugMsg(IntToDec(i, 3, ' ')+' '+SPC(Files.LongName, 40)+' <<dir>> ', mtMessage)
else
DebugMsg(IntToDec(i, 3, ' ')+' '+SPC(Files.LongName, 40)+' '+IntToDec(Files.FileSize, 8, ' ')+' '+Files.Path, mtMessage);
Files := Files.Next;
end;
DebugMsg(' ', mtMessage);
end;
{******************************************************************************}
{ }
{******************************************************************************}
procedure TMCDBurner.Print_D1;
var
i: Integer;
P: PDirEntry;
begin
for i:=0 to DirCounter-1 do
begin
p := Dirs[i];
DebugMsg('('+IntToDec(i+1,2,' ')+') '+p.Path, mtMessage);
DebugMsg('------------------------------------------------------------------------------------------------------', mtMessage);
if p.Files <> nil then print_Files(p.Files)
end;
DebugMsg(' ', mtMessage);
end;
{******************************************************************************}
{ }
{******************************************************************************}
function TMCDBurner.Initialize;
begin
result := true;
ClearAll;
end;
{******************************************************************************}
{ }
{******************************************************************************}
function TMCDBurner.GetLastRecordedAddress;
var
i: Integer;
begin
for i:=32 downto 16 do
begin
fillchar(impvd, SizeOf(impvd), 0);
if Read10(i, 1, @impvd, DefaultSectorSize) then
with impvd do if (Identifier[1] = 'C') and (Identifier[2] = 'D') and (Identifier[3] = '0') and (Identifier[4] = '0') and (Identifier[5] = '1') then if (PdType = 2) or (PdType = 1) then
begin
result := impvd.NoOfSectors;
exit;
end;
end;
result := 0;
end;
{******************************************************************************}
{ }
{******************************************************************************}
function TMCDBurner.GetNextWritableAddress;
var
OrgFin: Boolean;
ti: Integer;
dt: Byte;
begin
fStartAddress := 0;
WaitForReady(10000, 500);
dt := DiscType;
OrgFin := FinalizeDisc;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -