ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Helper/LevelDB.pas
(Generate patch)

Comparing oup/current/Helper/LevelDB.pas (file contents):
Revision 120 by alloc, Fri Mar 23 00:59:01 2007 UTC vs.
Revision 129 by alloc, Wed Mar 28 01:12:22 2007 UTC

# Line 1 | Line 1
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   unit LevelDB;
2   interface
3   uses
# Line 371 | Line 311 | begin
311            if RawLinks[i].RawSize > 0 then
312            begin
313              RawFileStream := TMemoryStream.Create;
314 <            if UpperCase(fileinfo.Extension) = 'TXMP' then
314 >            Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, TStream(RawFileStream));
315 >            RawFileStream.Seek(0, soFromBeginning);
316 >            if RawLinks[i].LocSep then
317              begin
318 <              DatFileStream.Seek($88, soFromBeginning);
319 <              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));
318 >              RawLinks[i].RawAddr := Stream_Sep.Size;
319 >              Stream_sep.CopyFrom(RawFileStream, RawFileStream.Size);
320              end else begin
321 <              Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, TStream(RawFileStream));
321 >              RawLinks[i].RawAddr := Stream_Raw.Size;
322 >              Stream_Raw.CopyFrom(RawFileStream, RawFileStream.Size);
323              end;
405            RawFileStream.Seek(0, soFromBeginning);
324            end else
325              RawLinks[i].RawAddr := 0;
326 +          DatFileStream.Seek(RawLinks[i].SrcOffset, soFromBeginning);
327 +          DatFileStream.Write(RawLinks[i].RawAddr, 4);
328          end;
329        end;
330 <
331 < {
412 <            if rawlist[j].raw_size > 0 then
413 <            begin
414 <              if (UpperCase(fileinfo.Extension) = 'TXMP') and
415 <                ((Data[$88] and $01) > 0) then
416 <              begin
417 <                OniImage.LoadFromTXMP(Connection, i);
418 <                OniImage.GetMipMappedImage(rawdata);
419 <                rawlist[j].raw_size := OniImage.GetImageDataSize(True);
420 <                Data[$90] := $08;
421 <                Data[$89] := 32;
422 < (*                  if data[$90]<>OniImage.StoreType then begin
423 <                    data[$90]:=OniImage.StoreType;
424 <                    data[$89]:=(data[$89] and $CF) or $20;
425 <                  end;
426 < *)                end
427 <              else
428 <              begin
429 <                SetLength(rawdata, rawlist[j].raw_size);
430 <                OniDataConnection.LoadRawFile(i, rawlist[j].src_offset, @rawdata[0]);
431 <              end;
432 <              //                data[$88]:=data[$88] and $FE;
433 <
434 <              if rawlist[j].loc_sep then
435 <              begin
436 <                rawlist[j].raw_addr := Stream_Sep.Size;
437 <                Stream_Sep.Write(rawdata[0], Length(rawdata));
438 <              end
439 <              else
440 <              begin
441 <                rawlist[j].raw_addr := Stream_Raw.Size;
442 <                Stream_Raw.Write(rawdata[0], Length(rawdata));
443 <              end;
444 <            end
445 <            else
446 <              rawlist[j].raw_addr := 0;
447 <            Data[rawlist[j].src_offset + 0] := (rawlist[j].raw_addr) and $FF;
448 <            Data[rawlist[j].src_offset + 1] := (rawlist[j].raw_addr shr 8) and $FF;
449 <            Data[rawlist[j].src_offset + 2] := (rawlist[j].raw_addr shr 16) and $FF;
450 <            Data[rawlist[j].src_offset + 3] := (rawlist[j].raw_addr shr 24) and $FF;
451 < }
452 <      Stream_Body.Write(Data[0], Length(Data));
453 <      //
330 >      DatFileStream.Seek(0, soFromBeginning);
331 >      Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
332      end
333      else
334        FilesHeader[i].DataAddr := 0;
# Line 497 | Line 375 | begin
375    Stream_Body.Free;
376    Stream_Names.Free;
377    Stream_Raw.Free;
378 <  if OniDataConnection.OSisMac then
378 >
379 >  if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
380      Stream_Sep.Free;
381  
382    progress.Position      := progress.Max;
# Line 513 | Line 392 | begin
392  
393    converting := False;
394  
395 <  CloseDataConnection(DataConnections[conIndex]);
395 > //  CloseDataConnection(DataConnections[conIndex]);
396   end;
397  
398  
# Line 523 | Line 402 | procedure TForm_LevelDB.HandleFile;
402   var
403    i: Byte;
404   begin
405 <  for i := 1 to Length(ConvertHandlers) do
405 > {  for i := 1 to Length(ConvertHandlers) do
406      if UpperCase(ConvertHandlers[i].Ext) = UpperCase(ext) then
407        if ConvertHandlers[i].needed then
408        begin
# Line 532 | Line 411 | begin
411        end
412        else
413          Break;
414 < end;
414 > }end;
415  
416  
417  
418  
419   procedure TForm_LevelDB.CreateDatabase(Source, target: String);
420 + {
421   var
422    DataBase:    TABSDatabase;
423    Query:       TABSQuery;
# Line 569 | Line 449 | const
449      else
450        group_progress.Caption := 'Creating DB (FINISHED)';
451    end;
452 + }
453  
454   begin
455 <  if CreateDataConnection(Source, ODB_Dat) = nil then
455 > {  if CreateDataConnection(Source, ODB_Dat) = nil then
456    begin
457      ShowMessage('Could not connect to .dat-file');
458      Exit;
# Line 774 | Line 655 | begin
655    database.Free;
656  
657    CloseDataConnection(DataConnections[conIndex]);
658 + }
659   end;
660  
661  
662  
663  
664 < procedure TForm_LevelDB.stop_convert;
664 > procedure TForm_LevelDB.StopConvert;
665   begin
666 <  btn_abortok.Caption := '&Close';
666 > {  btn_abortok.Caption := '&Close';
667    btn_abortok.Default := True;
668    converting := False;
669    lbl_estimation.Caption := 'ABORTED';
# Line 792 | Line 674 | begin
674    begin
675      DeleteFile(loaded_filename);
676    end;
677 < end;
677 > }end;
678  
679  
680  
# Line 815 | Line 697 | end;
697  
698  
699  
700 <
700 > {
701   procedure InsertDatLinkToDB(fileid: LongWord; offset: LongWord);
702   var
703    link: LongWord;
# Line 1847 | Line 1729 | begin
1729    begin
1730    end;
1731   end;
1732 + }
1733  
1734  
1735 <
1853 <
1735 > {
1736   procedure InsertHandler(ext: String; needed: Boolean; handler: THandler);
1737   begin
1738    SetLength(ConvertHandlers, Length(ConvertHandlers) + 1);
# Line 1858 | Line 1740 | begin
1740    ConvertHandlers[High(ConvertHandlers)].needed  := needed;
1741    ConvertHandlers[High(ConvertHandlers)].handler := handler;
1742   end;
1743 <
1743 > }
1744   begin
1745 <  InsertHandler('ABNA', False, nil);
1745 > {  InsertHandler('ABNA', False, nil);
1746    //  InsertHandler('AGDB',True,AGDB);
1747    InsertHandler('AGDB', False, nil);
1748    InsertHandler('AGQC', False, nil);
# Line 1958 | Line 1840 | begin
1840    InsertHandler('WMM_', False, nil);
1841    InsertHandler('WMMB', True, WMMB);
1842    InsertHandler('WPGE', True, WPGE);
1843 < end.
1843 > }end.

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)