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 145 by alloc, Sun Apr 1 15:14:09 2007 UTC vs.
Revision 248 by alloc, Mon Nov 26 11:02:28 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 355 | Line 365 | begin
365        DatFileStream.Seek(0, soFromBeginning);
366        Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
367        if (Stream_Body.Size mod 32) > 0 then
368 +      begin
369 +        ShowMessage(
370 +            IntToStr(FileID) + '-' + FileInfo.Name + '.' + FileInfo.Extension + #13#10 +
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
376      else
377        FilesHeader[FileID].DataAddr := 0;
# Line 479 | Line 495 | const
495      begin
496        DeleteFile(target);
497      end;
498 < end;
498 >  end;
499  
500  
501  
# Line 577 | 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 648 | Line 666 | begin
666              Connection.LoadRawFile(FileID, RawLinks[i].SrcOffset, tempdata);
667              mimecoder      := TStringFormat_MIME64.Create;
668              Query.SQL.Text :=
669 <              'INSERT INTO rawmap (src_id,src_link_offset,sep,size,data) VALUES (' +
669 >              'INSERT INTO rawmap (name,src_id,src_link_offset,sep,type,size,data) VALUES (' +
670 >              '"' + RawLinks[i].Name + '", ' +
671                IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ',' +
672                BoolToStr(RawLinks[i].LocSep) + ', ' +
673 +              '"' + RawLinks[i].RawType + '", ' +
674                IntToStr(RawLinks[i].RawSize) + ', ' +
675                'MimeToBin("' + MimeCoder.StrTo(@tempdata[0], RawLinks[i].RawSize) + '") );';
676              Query.ExecSQL;
# Line 659 | Line 679 | begin
679            else
680            begin
681              Query.SQL.Text :=
682 <              'INSERT INTO rawmap (src_id,src_link_offset,sep,size) VALUES (' +
682 >              'INSERT INTO rawmap (name,src_id,src_link_offset,sep,type,size) VALUES (' +
683 >              '"' + RawLinks[i].Name + '", ' +
684                IntToStr(FileID) + ', ' + IntToStr(RawLinks[i].SrcOffset) + ', ' +
685 <              BoolToStr(RawLinks[i].LocSep) + ', 0);';
685 >              BoolToStr(RawLinks[i].LocSep) + ', ' +
686 >              '"' + RawLinks[i].RawType + '", ' +
687 >              '0);';
688              Query.ExecSQL;
689            end;
667          if ((i mod 100) = 0) and (FileID > 0) then
668          begin
669            Database.Commit(False);
670            Database.StartTransaction;
671          end;
690          end;
691        end;
692  

Diff Legend

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