| 33 | 
   | 
     procedure LoadDatFilePart(FileID, Offset, Size: Integer; var Target: TStream); overload; override; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
     procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; override; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 36 | 
 + | 
     function GetDatLinks(FileID: Integer): TDatLinkList; override; | 
 
 
 
 
 
 
 
 
 | 37 | 
 + | 
     function GetDatLink(FileID, DatOffset: Integer): TDatLink; override; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
   | 
     function GetRawList(FileID: Integer): TRawDataList; override; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 | 
   | 
     function GetRawInfo(FileID, DatOffset: Integer): TRawDataInfo; override; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 40 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 | 54 | 
 < | 
   SysUtils, StrUtils, Data, Functions, RawList; | 
 
 
 
 
 
 
 
 
 
 | 54 | 
 > | 
   SysUtils, StrUtils, Data, Functions, RawList, DatLinks; | 
 
 
 
 
 
 
 
 
 
 
 
 | 55 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 56 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 57 | 
   | 
 (* | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 61 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 62 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 | 
   | 
 constructor TAccess_OniArchive.Create(DatFilename: String; ConnectionID: Integer; var Msg: TStatusMessages); | 
 
 
 
 
 
 
 
 
 
 | 62 | 
 – | 
 type | 
 
 
 
 
 
 
 
 
 
 | 63 | 
 – | 
   THeader = packed record | 
 
 
 
 
 
 
 
 
 
 | 64 | 
 – | 
     Ident:      array[0..$13] of Byte; | 
 
 
 
 
 
 
 
 
 
 | 65 | 
 – | 
     Files:      Integer; | 
 
 
 
 
 
 
 
 
 
 | 66 | 
 – | 
     NamedFiles: Integer; | 
 
 
 
 
 
 
 
 
 
 | 67 | 
 – | 
     Extensions: Integer; | 
 
 
 
 
 
 
 
 
 
 | 68 | 
 – | 
     DataAddr:   Integer; | 
 
 
 
 
 
 
 
 
 
 | 69 | 
 – | 
     DataSize:   Integer; | 
 
 
 
 
 
 
 
 
 
 | 70 | 
 – | 
     NamesAddr:  Integer; | 
 
 
 
 
 
 
 
 
 
 | 71 | 
 – | 
     NamesSize:  Integer; | 
 
 
 
 
 
 
 
 
 
 | 72 | 
 – | 
     Ident2:     array[0..$F] of Byte; | 
 
 
 
 
 
 
 
 
 
 | 73 | 
 – | 
   end; | 
 
 
 
 
 
 
 
 
 
 | 74 | 
 – | 
   TFilesMap = array of packed record | 
 
 
 
 
 
 
 
 
 
 | 75 | 
 – | 
     Extension: array[0..$3] of Char; | 
 
 
 
 
 
 
 
 
 
 | 76 | 
 – | 
     DataAddr:  Integer; | 
 
 
 
 
 
 
 
 
 
 | 77 | 
 – | 
     NameAddr:  Integer; | 
 
 
 
 
 
 
 
 
 
 | 78 | 
 – | 
     FileSize:  Integer; | 
 
 
 
 
 
 
 
 
 
 | 79 | 
 – | 
     FileType:  LongWord; | 
 
 
 
 
 
 
 
 
 
 | 80 | 
 – | 
   end; | 
 
 
 
 
 
 
 
 
 
 | 81 | 
 – | 
   TNamedFilesMap = array of packed record | 
 
 
 
 
 
 
 
 
 
 | 82 | 
 – | 
     FileNumber: Integer; | 
 
 
 
 
 
 
 
 
 
 | 83 | 
 – | 
     blubb:      Integer; | 
 
 
 
 
 
 
 
 
 
 | 84 | 
 – | 
   end; | 
 
 
 
 
 
 
 
 
 
 | 85 | 
 – | 
 const | 
 
 
 
 
 
 
 
 
 
 | 86 | 
 – | 
   header_ident1_pc: array[0..$13] of Byte = | 
 
 
 
 
 
 
 
 
 
 | 87 | 
 – | 
     ($1F, $27, $DC, $33, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00, | 
 
 
 
 
 
 
 
 
 
 | 88 | 
 – | 
     $14, $00, $10, $00, $08, $00); | 
 
 
 
 
 
 
 
 
 
 | 89 | 
 – | 
   header_ident1_mac: array[0..$13] of Byte = | 
 
 
 
 
 
 
 
 
 
 | 90 | 
 – | 
     ($61, $30, $C1, $23, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00, | 
 
 
 
 
 
 
 
 
 
 | 91 | 
 – | 
     $14, $00, $10, $00, $08, $00); | 
 
 
 
 
 
 
 
 
 
 | 92 | 
 – | 
   header_ident1_macbeta: array[0..$13] of Byte = | 
 
 
 
 
 
 
 
 
 
 | 93 | 
 – | 
     ($81, $11, $8D, $23, $DF, $BC, $03, $00, $31, $33, $52, $56, $40, $00, | 
 
 
 
 
 
 
 
 
 
 | 94 | 
 – | 
     $14, $00, $10, $00, $08, $00); | 
 
 
 
 
 
 
 
 
 
 | 95 | 
 – | 
   header_ident2: array[0..$F] of Byte = | 
 
 
 
 
 
 
 
 
 
 | 96 | 
 – | 
     ($99, $CF, $40, $00, $90, $4F, $63, $00, $F4, $55, $5F, $00, $90, $4F, $63, $00); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | 
   | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
   | 
   header_pc, header_mac, header_macbeta: Boolean; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
   | 
   header_pc  := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
   | 
   header_mac := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 85 | 
   | 
   header_macbeta := True; | 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
 < | 
   for i := 0 to High(Fdat_header.Ident) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
 > | 
   for i := 0 to High(Fdat_header.GlobalIdent) do | 
 
 
 
 
 
 | 87 | 
 > | 
     if Fdat_header.GlobalIdent[i] <> HeaderGlobalIdent[i] then | 
 
 
 
 
 
 | 88 | 
 > | 
     begin | 
 
 
 
 
 
 | 89 | 
 > | 
       Msg := SM_IncompatibleFile; | 
 
 
 
 
 
 | 90 | 
 > | 
       Exit; | 
 
 
 
 
 
 | 91 | 
 > | 
     end; | 
 
 
 
 
 
 | 92 | 
 > | 
  | 
 
 
 
 
 
 | 93 | 
 > | 
   for i := 0 to High(Fdat_header.OSIdent) do | 
 
 
 
 
 
 
 
 
 
 
 
 | 94 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 95 | 
 < | 
 //    FLevelInfo.Ident[i] := Fdat_header.Ident[i]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 122 | 
 < | 
     if Fdat_header.Ident[i] <> header_ident1_pc[i] then | 
 
 
 
 
 
 
 
 
 
 | 95 | 
 > | 
     if Fdat_header.OSIdent[i] <> HeaderOSIdentWin[i] then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 | 
   | 
       header_pc := False; | 
 
 
 
 
 
 
 
 
 
 
 
 | 97 | 
 < | 
     if Fdat_header.Ident[i] <> header_ident1_mac[i] then | 
 
 
 
 
 
 
 
 
 
 | 97 | 
 > | 
     if Fdat_header.OSIdent[i] <> HeaderOSIdentMac[i] then | 
 
 
 
 
 
 
 
 
 
 
 
 | 98 | 
   | 
       header_mac := False; | 
 
 
 
 
 
 
 
 
 
 
 
 | 99 | 
 < | 
     if Fdat_header.Ident[i] <> header_ident1_macbeta[i] then | 
 
 
 
 
 
 
 
 
 
 | 99 | 
 > | 
     if Fdat_header.OSIdent[i] <> HeaderOSIdentMacBeta[i] then | 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
       header_macbeta := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
   | 
   if not (header_pc xor header_mac xor header_macbeta) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 222 | 
   | 
       name := fields.Strings[2]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 223 | 
   | 
       extension := fields.Strings[0]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 224 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 | 225 | 
 + | 
     if SortType in [ST_ExtNameAsc, ST_ExtNameDesc] then | 
 
 
 
 
 
 
 
 
 | 226 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 227 | 
 + | 
       id := fields.Strings[2]; | 
 
 
 
 
 
 
 
 
 | 228 | 
 + | 
       name := fields.Strings[1]; | 
 
 
 
 
 
 
 
 
 | 229 | 
 + | 
       extension := fields.Strings[0]; | 
 
 
 
 
 
 
 
 
 | 230 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 231 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 232 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 233 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 241 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 242 | 
   | 
       if (NoEmptyFiles = False) or ((Fdat_files[i].FileType and $02) = 0) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 243 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 244 | 
 < | 
         if AppSettings.FilenumbersAsHex then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 266 | 
 < | 
           id := IntToHex(Fdat_files[i].ID, 4) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 267 | 
 < | 
         else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 268 | 
 < | 
           id := FormatNumber(Fdat_files[i].ID, 5, '0'); | 
 
 
 
 
 
 
 
 
 
 | 244 | 
 > | 
         id := FormatNumber(Fdat_files[i].ID, 5, '0'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 245 | 
   | 
         name := Fdat_files[i].Name; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 246 | 
   | 
         extension := Fdat_files[i].Extension; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 247 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 249 | 
   | 
           ST_IDAsc, ST_IDDesc:     list.Add(id + ';' + name + ';' + extension); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 250 | 
   | 
           ST_NameAsc, ST_NameDesc: list.Add(name + ';' + id + ';' + extension); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 251 | 
   | 
           ST_ExtAsc, ST_ExtDesc:   list.Add(extension + ';' + id + ';' + name); | 
 
 
 
 
 
 
 
 
 | 252 | 
 + | 
           ST_ExtNameAsc, ST_ExtNameDesc: list.Add(name + ';' + extension + ';' + id); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 253 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 254 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 255 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 256 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 257 | 
 < | 
   Result := TStringList.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 257 | 
 > | 
   if not Assigned(Result) then | 
 
 
 
 
 
 | 258 | 
 > | 
     Result := TStringList.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 | 259 | 
   | 
   if list.Count > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 260 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 261 | 
   | 
     fields := TStringList.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 | 262 | 
 < | 
     if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc] then | 
 
 
 
 
 
 
 
 
 
 | 262 | 
 > | 
     if SortType in [ST_IDAsc, ST_NameAsc, ST_ExtAsc, ST_ExtNameAsc] then | 
 
 
 
 
 
 
 
 
 
 
 
 | 263 | 
   | 
       for i := 0 to list.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 264 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 265 | 
   | 
         getfields; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 291 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 292 | 
   | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 293 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 294 | 
 < | 
   Result := TStringList.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 294 | 
 > | 
   if not Assigned(Result) then | 
 
 
 
 
 
 | 295 | 
 > | 
     Result := TStringList.Create; | 
 
 
 
 
 
 | 296 | 
 > | 
   if Result is TStringList then | 
 
 
 
 
 
 | 297 | 
 > | 
     TStringList(Result).Sorted := True; | 
 
 
 
 
 
 
 
 
 
 
 
 | 298 | 
   | 
   for i := 0 to Length(Fdat_extensionsmap) - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 299 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 300 | 
   | 
     with Fdat_extensionsmap[i] do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 399 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 400 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 401 | 
 + | 
 function TAccess_OniArchive.GetDatLink(FileID, DatOffset: Integer): TDatLink; | 
 
 
 
 
 
 
 
 
 | 402 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 403 | 
 + | 
   link: Integer; | 
 
 
 
 
 
 
 
 
 | 404 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 405 | 
 + | 
   Result := DatLinksManager.GetDatLink(FConnectionID, FileID, DatOffset); | 
 
 
 
 
 
 
 
 
 | 406 | 
 + | 
   LoadDatFilePart(fileid, Result.SrcOffset, 4, @link); | 
 
 
 
 
 
 
 
 
 | 407 | 
 + | 
   if link > 0 then | 
 
 
 
 
 
 
 
 
 | 408 | 
 + | 
     Result.DestID := link div 256 | 
 
 
 
 
 
 
 
 
 | 409 | 
 + | 
   else | 
 
 
 
 
 
 
 
 
 | 410 | 
 + | 
     Result.DestID := -1; | 
 
 
 
 
 
 
 
 
 | 411 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 | 412 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 413 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 414 | 
 + | 
 function TAccess_OniArchive.GetDatLinks(FileID: Integer): TDatLinkList; | 
 
 
 
 
 
 
 
 
 | 415 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 416 | 
 + | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 | 417 | 
 + | 
   link: Integer; | 
 
 
 
 
 
 
 
 
 | 418 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 419 | 
 + | 
   Result := DatLinksManager.GetDatLinks(FConnectionID, FileID); | 
 
 
 
 
 
 
 
 
 | 420 | 
 + | 
   if Length(Result) > 0 then | 
 
 
 
 
 
 
 
 
 | 421 | 
 + | 
   begin | 
 
 
 
 
 
 
 
 
 | 422 | 
 + | 
     for i := 0 to High(Result) do | 
 
 
 
 
 
 
 
 
 | 423 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 424 | 
 + | 
       LoadDatFilePart(fileid, Result[i].SrcOffset, 4, @link); | 
 
 
 
 
 
 
 
 
 | 425 | 
 + | 
       if link > 0 then | 
 
 
 
 
 
 
 
 
 | 426 | 
 + | 
         Result[i].DestID := link div 256 | 
 
 
 
 
 
 
 
 
 | 427 | 
 + | 
       else | 
 
 
 
 
 
 
 
 
 | 428 | 
 + | 
         Result[i].DestID := -1; | 
 
 
 
 
 
 
 
 
 | 429 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 430 | 
 + | 
   end; | 
 
 
 
 
 
 
 
 
 | 431 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 | 432 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 433 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 434 | 
   | 
 function TAccess_OniArchive.GetRawList(FileID: Integer): TRawDataList; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 435 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 436 | 
   | 
   Result := RawLists.GetRawList(FConnectionID, FileID); |