Changeset 120 for oup/current
- Timestamp:
- Mar 23, 2007, 1:59:01 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Helper/LevelDB.pas
r113 r120 1 {$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1} 2 {$MINSTACKSIZE $00004000} 3 {$MAXSTACKSIZE $00100000} 4 {$IMAGEBASE $00400000} 5 {$APPTYPE GUI} 6 {$WARN SYMBOL_DEPRECATED ON} 7 {$WARN SYMBOL_LIBRARY ON} 8 {$WARN SYMBOL_PLATFORM ON} 9 {$WARN SYMBOL_EXPERIMENTAL ON} 10 {$WARN UNIT_LIBRARY ON} 11 {$WARN UNIT_PLATFORM ON} 12 {$WARN UNIT_DEPRECATED ON} 13 {$WARN UNIT_EXPERIMENTAL ON} 14 {$WARN HRESULT_COMPAT ON} 15 {$WARN HIDING_MEMBER ON} 16 {$WARN HIDDEN_VIRTUAL ON} 17 {$WARN GARBAGE ON} 18 {$WARN BOUNDS_ERROR ON} 19 {$WARN ZERO_NIL_COMPAT ON} 20 {$WARN STRING_CONST_TRUNCED ON} 21 {$WARN FOR_LOOP_VAR_VARPAR ON} 22 {$WARN TYPED_CONST_VARPAR ON} 23 {$WARN ASG_TO_TYPED_CONST ON} 24 {$WARN CASE_LABEL_RANGE ON} 25 {$WARN FOR_VARIABLE ON} 26 {$WARN CONSTRUCTING_ABSTRACT ON} 27 {$WARN COMPARISON_FALSE ON} 28 {$WARN COMPARISON_TRUE ON} 29 {$WARN COMPARING_SIGNED_UNSIGNED ON} 30 {$WARN COMBINING_SIGNED_UNSIGNED ON} 31 {$WARN UNSUPPORTED_CONSTRUCT ON} 32 {$WARN FILE_OPEN ON} 33 {$WARN FILE_OPEN_UNITSRC ON} 34 {$WARN BAD_GLOBAL_SYMBOL ON} 35 {$WARN DUPLICATE_CTOR_DTOR ON} 36 {$WARN INVALID_DIRECTIVE ON} 37 {$WARN PACKAGE_NO_LINK ON} 38 {$WARN PACKAGED_THREADVAR ON} 39 {$WARN IMPLICIT_IMPORT ON} 40 {$WARN HPPEMIT_IGNORED ON} 41 {$WARN NO_RETVAL ON} 42 {$WARN USE_BEFORE_DEF ON} 43 {$WARN FOR_LOOP_VAR_UNDEF ON} 44 {$WARN UNIT_NAME_MISMATCH ON} 45 {$WARN NO_CFG_FILE_FOUND ON} 46 {$WARN IMPLICIT_VARIANTS ON} 47 {$WARN UNICODE_TO_LOCALE ON} 48 {$WARN LOCALE_TO_UNICODE ON} 49 {$WARN IMAGEBASE_MULTIPLE ON} 50 {$WARN SUSPICIOUS_TYPECAST ON} 51 {$WARN PRIVATE_PROPACCESSOR ON} 52 {$WARN UNSAFE_TYPE OFF} 53 {$WARN UNSAFE_CODE OFF} 54 {$WARN UNSAFE_CAST OFF} 55 {$WARN OPTION_TRUNCATED ON} 56 {$WARN WIDECHAR_REDUCED ON} 57 {$WARN DUPLICATES_IGNORED ON} 58 {$WARN UNIT_INIT_SEQ ON} 59 {$WARN LOCAL_PINVOKE ON} 60 {$WARN MESSAGE_DIRECTIVE ON} 1 61 unit LevelDB; 2 62 interface … … 79 139 ConRepMsg: TStatusMessages; 80 140 141 FileID: Integer; 142 81 143 Strings: TStrings; 82 144 i, j: Integer; 83 145 temps: String; 146 tempi: Integer; 147 tempb: Byte; 84 148 FileInfo: TFileInfo; 149 DatLinks: TDatLinkList; 150 RawLinks: TRawDataList; 85 151 86 152 DatFileStream, RawFileStream: TMemoryStream; … … 271 337 272 338 FileTime := Time; 273 for i:= 0 to DatHeader.Files - 1 do274 begin 275 FileInfo := Connection.GetFileInfo( i);339 for FileID := 0 to DatHeader.Files - 1 do 340 begin 341 FileInfo := Connection.GetFileInfo(FileID); 276 342 for j := 0 to 3 do 277 FilesHeader[ i].Extension[j] := FileInfo.Extension[4 - j];343 FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j]; 278 344 if FileInfo.Size > 0 then 279 345 begin 280 // DatLinks:=; 281 FilesHeader[i].DataAddr := Stream_Body.Size + 8; 346 FilesHeader[FileID].DataAddr := Stream_Body.Size + 8; 282 347 DatFileStream := TMemoryStream.Create; 283 Connection.LoadDatFile( i, DatFileStream);348 Connection.LoadDatFile(FileID, TStream(DatFileStream)); 284 349 DatFileStream.Seek(4, soFromBeginning); 285 350 DatFileStream.Write(LevelID, 4); 286 351 287 if (Pos(UpperCase(fileinfo.Extension), UpperCase(raws)) mod 4) = 1 then 352 DatLinks := Connection.GetDatLinks(FileID); 353 if Length(DatLinks) > 0 then 288 354 begin 289 rawlist := OniDataConnection.GetRawList(i); 290 if Length(rawlist) > 0 then 355 for i := 0 to High(DatLinks) do 291 356 begin 292 for j := 0 to High(rawlist) do 357 DatFileStream.Seek(DatLinks[i].SrcOffset, soFromBeginning); 358 if DatLinks[i].DestID < 0 then 359 tempi := 0 360 else 361 tempi := DatLinks[i].DestID * 256 + 1; 362 DatFileStream.Write(tempi, 4); 363 end; 364 end; 365 366 RawLinks := Connection.GetRawList(FileID); 367 if Length(RawLinks) > 0 then 368 begin 369 for i := 0 to High(RawLinks) do 370 begin 371 if RawLinks[i].RawSize > 0 then 293 372 begin 373 RawFileStream := TMemoryStream.Create; 374 if UpperCase(fileinfo.Extension) = 'TXMP' then 375 begin 376 DatFileStream.Seek($88, soFromBeginning); 377 DatFileStream.Read(tempb, 1); 378 if (tempb and $01) > 0 then 379 begin 380 OniImage.Load(Connection.ConnectionID, FileID); 381 if not OniImage.GetMipMappedImage(TStream(RawFileStream)) then 382 begin 383 ShowMessage('MipMapping-Error'); 384 RawFileStream.Seek(0, soFromBeginning); 385 tempb := tempb and $FE; 386 DatFileStream.Seek($88, soFromBeginning); 387 DatFileStream.Write(tempb, 1); 388 OniImage.Load(Connection.ConnectionID, FileID); 389 OniImage.GetAsData(TStream(RawFileStream)); 390 end else 391 begin 392 // Change of Depth($89), Storetype ($90) 393 DatFileStream.Seek($89, soFromBeginning); 394 DatFileStream.Read(tempb, 1); 395 396 DatFileStream.Seek($90, soFromBeginning); 397 DatFileStream.Read(tempb, 1); 398 Exit; 399 end; 400 end else 401 OniImage.GetAsData(TStream(RawFileStream)); 402 end else begin 403 Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, TStream(RawFileStream)); 404 end; 405 RawFileStream.Seek(0, soFromBeginning); 406 end else 407 RawLinks[i].RawAddr := 0; 408 end; 409 end; 410 411 { 294 412 if rawlist[j].raw_size > 0 then 295 413 begin … … 302 420 Data[$90] := $08; 303 421 Data[$89] := 32; 304 {if data[$90]<>OniImage.StoreType then begin422 (* if data[$90]<>OniImage.StoreType then begin 305 423 data[$90]:=OniImage.StoreType; 306 424 data[$89]:=(data[$89] and $CF) or $20; 307 425 end; 308 }end426 *) end 309 427 else 310 428 begin … … 331 449 Data[rawlist[j].src_offset + 2] := (rawlist[j].raw_addr shr 16) and $FF; 332 450 Data[rawlist[j].src_offset + 3] := (rawlist[j].raw_addr shr 24) and $FF; 333 end; 334 end; 335 end; 336 451 } 337 452 Stream_Body.Write(Data[0], Length(Data)); 338 453 //
Note:
See TracChangeset
for help on using the changeset viewer.