--- oup/rewrite/Global/RawList.pas 2007/02/21 00:29:27 105 +++ oup/current/Global/RawList.pas 2007/03/28 00:57:53 128 @@ -1,7 +1,5 @@ unit RawList; - interface - uses TypeDefs; type @@ -31,7 +29,7 @@ var implementation uses - Template, ConnectionManager, Access_OniArchive, Classes, SysUtils; + Template, ConnectionManager, Access_OniArchive, Classes, SysUtils, Math; function AGDB(ConnectionID, FileID: Integer): TRawDataList; @@ -142,8 +140,6 @@ function SUBT(ConnectionID, FileID: Inte var baselink, lastlink: Integer; links: Integer; - j, k: Integer; -// Data: TByteData; Data: TStream; begin ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink); @@ -315,20 +311,41 @@ var x, y: Word; storetype: Byte; datasize: Integer; + mipmap: Byte; + + function GetImgSize(w,h, storetype: Integer): Integer; + begin + case storetype of + 0, 1, 2: + Result := w*h*2; + 8: + Result := w*h*4; + 9: + Result := Max(1, w div 4) * Max(1, h div 4) * 8; + else + Result := -1; + end; + end; + begin + ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $88, SizeOf(mipmap), @mipmap); ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8C, SizeOf(x), @x); ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8E, SizeOf(y), @y); ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype); ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @link_pc); ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $A0, 4, @link_mac); - case storetype of - 0, 1, 2: - datasize := x * y * 2; - 8: - datasize := x * y * 4; - 9: - datasize := x * y div 2; + + + datasize := GetImgSize(x, y, storetype); + if (mipmap and $01) > 0 then + begin + repeat + x := Max(x div 2, 1); + y := Max(y div 2, 1); + datasize := datasize + GetImgSize(x, y, storetype); + until (x = 1) and (y = 1); end; + SetLength(Result, 1); if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then begin