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 150 by alloc, Sun Apr 1 18:26:35 2007 UTC vs.
Revision 241 by alloc, Tue Jul 17 22:27:16 2007 UTC

# Line 24 | Line 24 | var
24   implementation
25   {$R *.dfm}
26   uses ABSMain, ABSDecUtil, Main,
27 <    ConnectionManager, TypeDefs, DataAccess, OniImgClass, Data, RawList;
27 >    ConnectionManager, TypeDefs, DataAccess, OniImgClass, Data, RawList,
28 >  Access_OniArchive;
29  
30   var
31    Converting:  Boolean = False;
# Line 202 | Line 203 | begin
203    Stream_Names := TMemoryStream.Create;
204    Stream_Dat   := TFileStream.Create(Target, fmCreate);
205    Stream_Raw   := TFileStream.Create(AnsiReplaceStr(Target, '.dat', '.raw'), fmCreate);
206 +  Stream_Raw.Write(EmptyBytes[0], 32);
207    if Connection.DataOS in [DOS_WINDEMO, DOS_MAC, DOS_MACBETA] then
208 +  begin
209      Stream_Sep := TFileStream.Create(AnsiReplaceStr(Target, '.dat', '.sep'), fmCreate);
210 +    Stream_Sep.Write(EmptyBytes[0], 32);
211 +  end;
212 +
213  
214    DoStep('Creating header');
215    progress.Position      := 0;
# Line 232 | Line 238 | begin
238    for i := 0 to High(DatHeader.OSIdent) do
239      case Connection.DataOS of
240        DOS_WIN: DatHeader.OSIdent[i] := HeaderOSIdentWin[i];
241 <      DOS_MAC: DatHeader.OSIdent[i] := HeaderOSIdentMac[i];
241 >      DOS_MAC, DOS_WINDEMO: DatHeader.OSIdent[i] := HeaderOSIdentMac[i];
242        DOS_MACBETA: DatHeader.OSIdent[i] := HeaderOSIdentMacBeta[i];
243      end;
244    for i := 0 to High(DatHeader.GlobalIdent) do
# Line 273 | Line 279 | begin
279      begin
280        case Connection.DataOS of
281          DOS_WIN:     ExtensionsHeader[i].Ident := FileTypes[j].IdentWin;
282 <        DOS_WINDEMO: ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
282 >        DOS_WINDEMO:
283 >            if FileTypes[j].Extension = 'SNDD' then
284 >              ExtensionsHeader[i].Ident := FileTypes[j].IdentWin
285 >            else
286 >              ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
287          DOS_MAC:     ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
288          DOS_MACBETA: ExtensionsHeader[i].Ident := FileTypes[j].IdentMac;
289        end;
# Line 358 | Line 368 | begin
368        begin
369          ShowMessage(
370              IntToStr(FileID) + '-' + FileInfo.Name + '.' + FileInfo.Extension + #13#10 +
371 <            IntToStr(Stream_Body.Size));
371 >            IntToStr(FileInfo.Size) + ' - 0x' + IntToHex(FileInfo.Size, 6) + ' - real: ' + IntToStr(DatFileStream.Size) + ' - 0x' + IntToHex(DatFileStream.Size, 6) + #13#10 +
372 >            IntToStr(Stream_Body.Size) + ' - 0x' + IntToHex(Stream_Body.Size, 6) );
373          Stream_Body.Write(EmptyBytes[0], 32 - (Stream_Body.Size mod 32));
374        end;
375      end
# Line 484 | Line 495 | const
495      begin
496        DeleteFile(target);
497      end;
498 < end;
498 >  end;
499  
500  
501  
# Line 582 | Line 593 | begin
593    Query.SQL.Text := 'CREATE INDEX idtargetid ON linkmap (target_id);';
594    Query.ExecSQL;
595    Query.SQL.Text :=
596 <    'CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, ' +
597 <    'src_link_offset INTEGER, sep BOOLEAN, size INTEGER, ' +
596 >    'CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, name STRING(32), src_id INTEGER, ' +
597 >    'src_link_offset INTEGER, sep BOOLEAN, type STRING(8), size INTEGER, ' +
598      'data BLOB BlobCompressionMode 9 BlobBlockSize 1024 BlobCompressionAlgorithm ZLib);';
599    //    Query.SQL.Text:='CREATE TABLE rawmap  ( id AUTOINC PRIMARY KEY, src_id INTEGER, src_link_offset INTEGER, size INTEGER, data BLOB BlobCompressionAlgorithm None );';
600    Query.ExecSQL;
601    Query.SQL.Text := 'CREATE INDEX idsrcid ON rawmap (src_id);';
602    Query.ExecSQL;
603 +  Query.SQL.Text := 'CREATE INDEX idtype ON rawmap (type);';
604 +  Query.ExecSQL;
605    Query.SQL.Text :=
606      'CREATE TABLE datfiles  ( id INTEGER PRIMARY KEY, extension CHAR(4), ' +
607      'name STRING(128), contenttype INTEGER, size INTEGER, ' +
# Line 625 | Line 638 | begin
638    DoStep('Writing .dat-fileslist');
639    Application.ProcessMessages;
640  
641 +  TAccess_OniArchive(Connection).UnloadWhenUnused := False;
642 +
643    FileTime := Time;
644    Database.StartTransaction;
645    for FileID := 0 to Connection.GetFileCount - 1 do
# Line 653 | Line 668 | begin
668              Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, tempdata);
669              mimecoder      := TStringFormat_MIME64.Create;
670              Query.SQL.Text :=
671 <              'INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES (' +
671 >              'INSERT INTO rawmap (name,src_id,src_link_offset,sep,type,size,data) VALUES (' +
672 >              '"' + RawLinks[i].Name + '", ' +
673                IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ',' +
674                BoolToStr(RawLinks[i].LocSep) + ', ' +
675 +              '"' + RawLinks[i].RawType + '", ' +
676                IntToStr(RawLinks[i].RawSize) + ', ' +
677                'MimeToBin("' + MimeCoder.StrTo(@tempdata[0], RawLinks[i].RawSize) + '") );';
678              Query.ExecSQL;
# Line 664 | Line 681 | begin
681            else
682            begin
683              Query.SQL.Text :=
684 <              'INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES (' +
684 >              'INSERT INTO rawmap (name,src_id,src_link_offset,sep,type,size) VALUES (' +
685 >              '"' + RawLinks[i].Name + '", ' +
686                IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ', ' +
687 <              BoolToStr(RawLinks[i].LocSep) + ', 0);';
687 >              BoolToStr(RawLinks[i].LocSep) + ', ' +
688 >              '"' + RawLinks[i].RawType + '", ' +
689 >              '0);';
690              Query.ExecSQL;
691            end;
692          end;
# Line 722 | Line 742 | begin
742    btn_abortok.Default := True;
743  
744    converting := False;
745 +  TAccess_OniArchive(Connection).UnloadWhenUnused := True;
746  
747    Query.Close;
748    Query.Free;

Diff Legend

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