2
0
mirror of https://github.com/dpethes/rerogue.git synced 2025-06-07 18:58:32 +02:00

dat packer: check input files

This commit is contained in:
dpethes 2015-03-07 19:49:46 +01:00
parent b867d6891a
commit 2593c8559f
2 changed files with 12 additions and 3 deletions

View File

@ -6,10 +6,18 @@ uses
procedure UnpackData(const basedir: string);
var
dat: TRSDatFile;
fhdr, fdat: string;
begin
fhdr := basedir + 'DATA.HDR';
fdat := basedir + 'DATA.DAT';
if not FileExists(fhdr) or not FileExists(fdat) then begin
writeln('missing input files ', fhdr, ' or ', fdat);
exit;
end;
dat := TRSDatFile.Create;
dat.ReadHeader(basedir + 'DATA.HDR');
dat.ReadSections(basedir + 'DATA.DAT');
dat.ReadHeader(fhdr);
dat.ReadSections(fdat);
dat.WriteFilesToDirectory(basedir);
dat.Free;
end;
@ -29,6 +37,8 @@ var
begin
if Paramcount < 2 then begin
writeln ('usage: rs_repack [u|p] directory');
writeln ('u - unpack hdr&dat in directory');
writeln ('p - pack directories into hdr&dat');
halt;
end;
mode := ParamStr(1);

View File

@ -35,7 +35,6 @@ procedure SaveFile(const name: string; const buffer: pbyte; const buf_size: inte
var
f: file;
fname: string;
dups: integer;
begin
fname := name;
AssignFile(f, fname);