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

Comparing oup/current/DataAccess/Access_OniArchive.pas (file contents):
Revision 148 by alloc, Sun Apr 1 16:37:25 2007 UTC vs.
Revision 192 by alloc, Thu May 24 17:48:18 2007 UTC

# Line 52 | Line 52 | type
52   implementation
53  
54   uses
55 <  SysUtils, StrUtils, Data, Functions, RawList, DatLinks;
55 >  SysUtils, StrUtils, Data, Functions, RawList, DatLinks, Math;
56  
57  
58   (*
# Line 559 | Line 559 | begin
559          Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
560            fmOpenReadWrite);
561        Fraw_file.Seek(raw_info.RawAddr, soFromBeginning);
562 <      Fraw_file.CopyFrom(Src, raw_info.RawSize);
562 >      Fraw_file.CopyFrom(Src, Min(raw_info.RawSize, Src.Size));
563        if UnloadWhenUnused then
564        begin
565          FRawOpened := False;
# Line 646 | Line 646 | begin
646   end;
647  
648   function TAccess_OniArchive.AppendRawFile(LocSep: Boolean; Src: TStream): Integer;
649 + const
650 +  EmptyBytes: Array[0..31] of Byte = (
651 +      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 );
652   begin
653    if not LocSep then
654    begin
655      if not FRawOpened then
656        Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'),
657          fmOpenReadWrite);
658 +    if (Fraw_file.Size mod 32) > 0 then
659 +      Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32));
660      Result := Fraw_file.Size;
661      Fraw_file.Seek(0, soFromEnd);
662      Fraw_file.CopyFrom(Src, Src.Size);
663 +    if (Fraw_file.Size mod 32) > 0 then
664 +      Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32));
665      if UnloadWhenUnused then
666      begin
667        FRawOpened := False;
# Line 668 | Line 675 | begin
675      if not FSepOpened then
676        Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'),
677          fmOpenReadWrite);
678 +    if (Fsep_file.Size mod 32) > 0 then
679 +      Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32));
680      Result := Fsep_file.Size;
681      Fsep_file.Seek(0, soFromEnd);
682      Fsep_file.CopyFrom(Src, Src.Size);
683 +    if (Fsep_file.Size mod 32) > 0 then
684 +      Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32));
685      if UnloadWhenUnused then
686      begin
687        FSepOpened := False;

Diff Legend

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