| 1 | unit Data; | 
 
 
 
 
 | 2 |  | 
 
 
 
 
 | 3 | interface | 
 
 
 
 
 | 4 |  | 
 
 
 
 
 | 5 | uses Classes, Graphics; | 
 
 
 
 
 | 6 |  | 
 
 
 
 
 | 7 | const | 
 
 
 
 
 | 8 | Version: String   = 'v0.33a'; | 
 
 
 
 
 | 9 | DBVersion: String = '0.3'; | 
 
 
 
 
 | 10 | CrLf: String[2]   = #13 + #10; | 
 
 
 
 
 | 11 |  | 
 
 
 
 
 | 12 | type | 
 
 
 
 
 | 13 | TData = array of Byte; | 
 
 
 
 
 | 14 |  | 
 
 
 
 
 | 15 | THeader = packed record | 
 
 
 
 
 | 16 | Ident:      array[0..$13] of Byte; | 
 
 
 
 
 | 17 | Files:      LongWord; | 
 
 
 
 
 | 18 | NamedFiles: LongWord; | 
 
 
 
 
 | 19 | Extensions: LongWord; | 
 
 
 
 
 | 20 | DataAddr:   LongWord; | 
 
 
 
 
 | 21 | DataSize:   LongWord; | 
 
 
 
 
 | 22 | NamesAddr:  LongWord; | 
 
 
 
 
 | 23 | NamesSize:  LongWord; | 
 
 
 
 
 | 24 | Ident2:     array[0..$F] of Byte; | 
 
 
 
 
 | 25 | end; | 
 
 
 
 
 | 26 | TFilesMap = array of packed record | 
 
 
 
 
 | 27 | Extension: array[0..$3] of Char; | 
 
 
 
 
 | 28 | DataAddr:  LongWord; | 
 
 
 
 
 | 29 | NameAddr:  LongWord; | 
 
 
 
 
 | 30 | FileSize:  LongWord; | 
 
 
 
 
 | 31 | FileType:  LongWord; | 
 
 
 
 
 | 32 | end; | 
 
 
 
 
 | 33 |  | 
 
 
 
 
 | 34 | TFileInfo = packed record | 
 
 
 
 
 | 35 | ID:      Integer; | 
 
 
 
 
 | 36 | FileName: String; | 
 
 
 
 
 | 37 | FileNameHex: String; | 
 
 
 
 
 | 38 | Extension: String[4]; | 
 
 
 
 
 | 39 | Name:    String; | 
 
 
 
 
 | 40 | Size:    LongWord; | 
 
 
 
 
 | 41 | FileType: LongWord; | 
 
 
 
 
 | 42 | DatAddr: LongWord; | 
 
 
 
 
 | 43 | opened:  Boolean; | 
 
 
 
 
 | 44 | end; | 
 
 
 
 
 | 45 | TFiles = array of TFileInfo; | 
 
 
 
 
 | 46 |  | 
 
 
 
 
 | 47 | TNamedFilesMap = array of packed record | 
 
 
 
 
 | 48 | FileNumber: LongWord; | 
 
 
 
 
 | 49 | blubb:      LongWord; | 
 
 
 
 
 | 50 | end; | 
 
 
 
 
 | 51 | TExtensionsMap = array of packed record | 
 
 
 
 
 | 52 | Ident:     array[0..$7] of Byte; | 
 
 
 
 
 | 53 | Extension: array[0..$3] of Char; | 
 
 
 
 
 | 54 | ExtCount:  LongWord; | 
 
 
 
 
 | 55 | end; | 
 
 
 
 
 | 56 |  | 
 
 
 
 
 | 57 | TLevelInfo = record | 
 
 
 
 
 | 58 | Ident: array[0..$13] of Byte; | 
 
 
 
 
 | 59 | LevelNumber: Byte; | 
 
 
 
 
 | 60 | end; | 
 
 
 
 
 | 61 |  | 
 
 
 
 
 | 62 | TAppSettings = record | 
 
 
 
 
 | 63 | DatPath:     String[250]; | 
 
 
 
 
 | 64 | ExtractPath: String[250]; | 
 
 
 
 
 | 65 | FilenumbersAsHex: Boolean; | 
 
 
 
 
 | 66 | CharSet:     TFontCharSet; | 
 
 
 
 
 | 67 | HideUnusedData: Boolean; | 
 
 
 
 
 | 68 | end; | 
 
 
 
 
 | 69 |  | 
 
 
 
 
 | 70 | TExportHandlers = record | 
 
 
 
 
 | 71 | Ext:     String[4]; | 
 
 
 
 
 | 72 | needed:  Boolean; | 
 
 
 
 
 | 73 | Handler: function(fileid: LongWord; filename: String; convert: Boolean): Integer; | 
 
 
 
 
 | 74 | end; | 
 
 
 
 
 | 75 |  | 
 
 
 
 
 | 76 | TStringArray = array of String; | 
 
 
 
 
 | 77 | TExtList     = array of record | 
 
 
 
 
 | 78 | Ext:   String; | 
 
 
 
 
 | 79 | Count: LongWord; | 
 
 
 
 
 | 80 | end; | 
 
 
 
 
 | 81 |  | 
 
 
 
 
 | 82 | TRawInfo = record | 
 
 
 
 
 | 83 | src_id:     LongWord; | 
 
 
 
 
 | 84 | src_offset: LongWord; | 
 
 
 
 
 | 85 | raw_addr:   LongWord; | 
 
 
 
 
 | 86 | raw_size:   LongWord; | 
 
 
 
 
 | 87 | loc_sep:    Boolean; | 
 
 
 
 
 | 88 | end; | 
 
 
 
 
 | 89 | TRawList = array of TRawInfo; | 
 
 
 
 
 | 90 |  | 
 
 
 
 
 | 91 | TDatLinks = array of record | 
 
 
 
 
 | 92 | Src_Offset: LongWord; | 
 
 
 
 
 | 93 | Target:     LongWord; | 
 
 
 
 
 | 94 | end; | 
 
 
 
 
 | 95 |  | 
 
 
 
 
 | 96 | TToolList = array of record | 
 
 
 
 
 | 97 | context: String; | 
 
 
 
 
 | 98 | name: String; | 
 
 
 
 
 | 99 | exts: String; | 
 
 
 
 
 | 100 | end; | 
 
 
 
 
 | 101 |  | 
 
 
 
 
 | 102 | var | 
 
 
 
 
 | 103 | { | 
 
 
 
 
 | 104 | opened_state:Byte=0; | 
 
 
 
 
 | 105 | dat_filename:String=''; | 
 
 
 
 
 | 106 | raw_filename:String=''; | 
 
 
 
 
 | 107 | dat_os_mac:Boolean=False; | 
 
 
 
 
 | 108 | dat_header:Theader; | 
 
 
 
 
 | 109 | dat_filesmap:Tfilesmap; | 
 
 
 
 
 | 110 | dat_files:Tfiles; | 
 
 
 
 
 | 111 | dat_namedfilesmap:Tnamedfilesmap; | 
 
 
 
 
 | 112 | dat_extensionsmap:Textensionsmap; | 
 
 
 
 
 | 113 | } | 
 
 
 
 
 | 114 | AppSettings:     TAppSettings; | 
 
 
 
 
 | 115 | AppSettingsFile: file of TAppSettings; | 
 
 
 
 
 | 116 | { | 
 
 
 
 
 | 117 | database_level:LongWord; | 
 
 
 
 
 | 118 | database_ident:Array[0..$13] of Byte; | 
 
 
 
 
 | 119 | } | 
 
 
 
 
 | 120 | const | 
 
 
 
 
 | 121 | {  header_ident1_pc:Array[0..$13] of Byte= | 
 
 
 
 
 | 122 | ($1F,$27,$DC,$33,$DF,$BC,$03,$00,$31,$33,$52,$56,$40,$00,$14,$00,$10,$00,$08,$00); | 
 
 
 
 
 | 123 | header_ident1_mac:Array[0..$13] of Byte= | 
 
 
 
 
 | 124 | ($61,$30,$C1,$23,$DF,$BC,$03,$00,$31,$33,$52,$56,$40,$00,$14,$00,$10,$00,$08,$00); | 
 
 
 
 
 | 125 | header_ident2:Array[0..$F] of Byte= | 
 
 
 
 
 | 126 | ($99,$CF,$40,$00,$90,$4F,$63,$00,$F4,$55,$5F,$00,$90,$4F,$63,$00); | 
 
 
 
 
 | 127 | } | 
 
 
 
 
 | 128 | export_noerror: Integer = 0; | 
 
 
 
 
 | 129 | export_nohandler: Integer = 1; | 
 
 
 
 
 | 130 | export_handlererror: Integer = 2; | 
 
 
 
 
 | 131 | export_error: Integer = 3; | 
 
 
 
 
 | 132 | { | 
 
 
 
 
 | 133 | opened_nothing:Byte=0; | 
 
 
 
 
 | 134 | opened_dat:Byte=1; | 
 
 
 
 
 | 135 | opened_db:Byte=2; | 
 
 
 
 
 | 136 | } | 
 
 
 
 
 | 137 | implementation | 
 
 
 
 
 | 138 |  | 
 
 
 
 
 | 139 | end. |