UNIT Unit3_data;
INTERFACE
USES Classes;

CONST
  version:String='v0.15a';
  CrLf:String[2]=#13+#10;

TYPE
  Tdata=Array OF Byte;
  Theader=PACKED RECORD
    Ident:Array[0..$13] OF Byte;
    Files:LongWord;
    NamedFiles:LongWord;
    Extensions:LongWord;
    DataAddr:LongWord;
    DataSize:LongWord;
    NamesAddr:LongWord;
    NamesSize:LongWord;
    Ident2:Array[0..$F] OF Byte;
  END;
  Tfilesmap=Array OF PACKED RECORD
    Extension:Array[0..$3] OF Char;
    DataAddr:LongWord;
    NameAddr:LongWord;
    FileSize:LongWord;
    FileType:LongWord;
  END;
  Tfiles=Array OF PACKED RECORD
    FileName:String;
    Extension:String[4];
    Name:String;
    Size:LongWord;
    FileType:LongWord;
    DatAddr:LongWord;
  END;

  Tnamedfilesmap=Array OF PACKED RECORD
  	FileNumber:LongWord;
	  blubb:LongWord;
  END;
  Textensionsmap=Array OF PACKED RECORD
  	Ident:Array[0..$7] OF Byte;
	  Extension:Array[0..$3] OF Char;
  	ExtCount:LongWord;
  END;

  TAppSettings=RECORD
    DatPath:String[250];
    ExtractPath:String[250];
  END;

  TExportHandlers=RECORD
    Ext:String[4];
    needed:Boolean;
    Handler:Function(fileid:LongWord; convert:Boolean):Integer;
  END;

VAR
  dat_filename:String='';
  raw_filename:String='';
  dat_header:Theader;
  dat_filesmap:Tfilesmap;
  dat_files:Tfiles;
  dat_namedfilesmap:Tnamedfilesmap;
  dat_extensionsmap:Textensionsmap;
  AppSettings:TAppSettings;
  AppSettingsFile:File OF TAppSettings;

CONST
  header_ident1:Array[0..$13] OF Byte=
      ($1F,$27,$DC,$33,$DF,$BC,$03,$00,$31,$33,$52,$56,$40,$00,$14,$00,$10,$00,$08,$00);
  header_ident2:Array[0..$F] OF Byte=
      ($99,$CF,$40,$00,$90,$4F,$63,$00,$F4,$55,$5F,$00,$90,$4F,$63,$00);

  export_noerror:Integer=0;
  export_nohandler:Integer=1;
  export_handlererror:Integer=2;
  export_error:Integer=3;

IMPLEMENTATION

END.

