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

Comparing:
oup/rewrite/Global/RawList.pas (file contents), Revision 101 by alloc, Tue Feb 20 20:43:29 2007 UTC vs.
oup/current/Global/RawList.pas (file contents), Revision 128 by alloc, Wed Mar 28 00:57:53 2007 UTC

# Line 1 | Line 1
1   unit RawList;
2
2   interface
4
3   uses TypeDefs;
4  
5   type
# Line 17 | Line 15 | type
15      private
16        FRawListHandlers: TRawListHandlers;
17      public
18 +      property RawListHandlers: TRawListHandlers read FRawListHandlers;
19        procedure InsertRawListHandler(ext: String; needed: Boolean; handler: THandler);
20        function GetRawList(ConnectionID, FileID: Integer): TRawDataList;
21        function GetRawInfo(ConnectionID, FileID, DatOffset: Integer): TRawDataInfo;
# Line 30 | Line 29 | var
29   implementation
30  
31   uses
32 <  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils;
32 >  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils, Math;
33  
34  
35   function AGDB(ConnectionID, FileID: Integer): TRawDataList;
# Line 141 | Line 140 | function SUBT(ConnectionID, FileID: Inte
140   var
141    baselink, lastlink: Integer;
142    links: Integer;
144  j, k:  Integer;
145 //  Data:  TByteData;
143    Data:  TStream;
144   begin
145    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink);
# Line 314 | Line 311 | var
311    x, y:      Word;
312    storetype: Byte;
313    datasize:  Integer;
314 +  mipmap:    Byte;
315 +
316 +  function GetImgSize(w,h, storetype: Integer): Integer;
317 +  begin
318 +    case storetype of
319 +      0, 1, 2:
320 +        Result := w*h*2;
321 +      8:
322 +        Result := w*h*4;
323 +      9:
324 +        Result :=  Max(1, w div 4) * Max(1, h div 4) * 8;
325 +    else
326 +      Result := -1;
327 +    end;
328 +  end;
329 +
330   begin
331 +  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $88, SizeOf(mipmap), @mipmap);
332    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8C, SizeOf(x), @x);
333    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8E, SizeOf(y), @y);
334    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype);
335    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @link_pc);
336    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $A0, 4, @link_mac);
337 <  case storetype of
338 <    0, 1, 2:
339 <      datasize := x * y * 2;
340 <    8:
341 <      datasize := x * y * 4;
342 <    9:
343 <      datasize := x * y div 2;
337 >
338 >
339 >  datasize := GetImgSize(x, y, storetype);
340 >  if (mipmap and $01) > 0 then
341 >  begin
342 >    repeat
343 >      x    := Max(x div 2, 1);
344 >      y    := Max(y div 2, 1);
345 >      datasize := datasize + GetImgSize(x, y, storetype);
346 >    until (x = 1) and (y = 1);
347    end;
348 +
349    SetLength(Result, 1);
350    if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
351    begin

Diff Legend

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