| 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; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 312 |  | storetype: Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 313 |  | datasize:  Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 314 |  | mipmap:    Byte; | 
 
 
 
 
 
 
 
 
 
 
 | 315 | < | bpp:       Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 316 | < | minside:   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); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 336 |  | ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $A0, 4, @link_mac); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 337 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 338 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 339 | < | minside := 1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 327 | < | case storetype of | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 328 | < | 0, 1, 2: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 329 | < | bpp := 16; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 330 | < | 8: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 331 | < | bpp := 32; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 332 | < | 9: | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 333 | < | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 334 | < | bpp := 4; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 335 | < | minside := 4; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 336 | < | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 337 | < | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 338 | < |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 339 | < | datasize := (x * y * bpp) div 8; | 
 
 
 
 
 
 
 
 
 | 339 | > | datasize := GetImgSize(x, y, storetype); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 340 |  | if (mipmap and $01) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 341 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 342 |  | repeat | 
 
 
 
 
 
 
 
 
 
 
 | 343 | < | x    := x div 2; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 344 | < | y    := y div 2; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 345 | < | datasize := datasize + (x * y * bpp) div 8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 346 | < | until (x = minside) or (y = minside); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 347 | < | if storetype = 9 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 348 | < | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 349 | < | repeat | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 350 | < | x    := x div 2; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 351 | < | y    := y div 2; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 352 | < | datasize := datasize + (x * y * 16) div 8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 353 | < | until (x = 1) or (y = 1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 354 | < | end; | 
 
 
 
 
 
 
 
 
 | 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); |