| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

STCI (STI) format description

Page history last edited by PBworks 12 years, 8 months ago

STСI (Sir-Tech's Crazy Image) file format.

 

STСI format is used to store graphical objects of Jagged Alliance 2 game. Every STCI file can hold one or more images. Images are stored using either 16-bit (16bppRGB565) or 8-bit (8bppIndexed) format. 16-bit file holds just one noncompressed image. The most of them are in LOADSCREENS folder.

 

 

Header (64 bytes, STCIHeader structure).

 

STCIHeader structure is described in Standard Gaming Platform\imgfmt.h.

 

1-4 bytes – character string “STCI”, the format identifier.

5-8 bytes – initial size of the image in bytes. For files with multiple images there is large senseless number.

9-12 bytes – image size in bytes after compression.

13-16 bytes – number of the transparent color in the palette, always 0. Used only for 8-bit files.

17-20 bytes – flags.

1 bit – always 0, unknown purpose (STCI_TRANSPARENT).

2 bit – always 0, unknown purpose (STCI_ALPHA).

3 bit – 1 tells if file is the 16-bit file (STCI_RGB).

4 bit – 1 tells if file is the 8-bit file (STCI_INDEXED).

5 bit – 1 if ZLIB compression algorithm used (STCI_ZLIB_COMPRESSED).

6 bit – 1 if ETRLE compression algorithm used (STCI_ETRLE_COMPRESSED).

7-32 bits – 0, not used.

It seems to be that flags always equals to 4, 40 or 41.

4 – for 16-bit files.

40 – for 8-bit non-animated files (single image).

41 – for 8-bit animated files (multiple images).

21-22 bytes – height of the image in pixels. Used in 16-bit files only.

23-24 bytes – width of the image in pixels. Used in 16-bit files only.

 

Values of the next 20 bytes depend on encoding algorithm.

 

25-44 bytes for 16-bit files:

 

25-28 bytes – red color mask. Seems to always equal to 63488

(00000000 00000000 11111000 00000000).

29-32 bytes – green color mask. Seems to always equal to 2016

(00000000 00000000 00000111 11100000).

33-36 bytes – blue color mask. Seems to always equal to 31

(00000000 00000000 00000000 00011111).

37-40 bytes – alpha-channel mask. Seems to always equal to 0.

41 byte – red color depth. Seems to always equal to 5.

42 byte – green color depth. Seems to always equal to 6.

43 byte – blue color depth. Seems to always equal to 5.

44 byte – alpha-channel depth. Seems to always equal to 0.

Colors depth and mask values correspond to 16bppRGB565 encoding algorithm.

 

25-44 bytes for 8-bit files:

 

25-28 bytes – number of colors in a palette, seems to be always 256.

29-30 bytes – number of images in the file.

31 byte – red color depth. It seems to be always 8.

32 byte – green color depth. It seems to be always 8.

33 byte – blue color depth. It seems to be always 8.

34-44 bytes – not used.

Algorithm used for encoding 8-bit files – 8bppIndexed with 24-bit palette for 256 colors.

 

45 byte – color depth. Number of bits for one pixel. 8 for 8-bit files and 16 for 16-bit files.

46-49 bytes – size of Application Data in bytes. Other than 0 only for animated files. It seems to be equaled to number of images multiplied on 16.

49-64 bytes – not used.

 

There is a possibility that such type of STCI file exists where 46-48 bytes are not used, os the size of the application data shifts 3 bytes. Maybe it depends on localization. In .NET StiEditor such byte order is used.

 

 

Images.

 

In 16-bit files after header and to the end of file there are image data encoded in 16bppRGB565 format.

In 8-bit files after header there are 256*3 = 768 bytes of palette.

After palette there are image headers of total size (number of images) x 16 bytes.

 

 

Image header (16 bytes, STCISubImage structure).

 

 

STCISubImage structure is described in Standard Gaming Platform\imgfmt.h.

 

1-4 bytes – shift in bytes from the beginning of images data to beginning of the current image data. 0 for the first image. Size of the first image for the second and so on.

5-8 bytes – image data size in bytes.

9-10 bytes – horizontal image shift in pixels.

11-12 bytes – vertical image shift in pixels.

13-14 bytes – image height in pixels.

15-16 bytes – image width in pixels.

 

There are images data after image headers. Every byte corresponds to ordinal number (index) of pixel’s color in palette. Image data are compressed using ETRLE compression algorithm (see below). It seems to be that ZLIB compression is not used.

Non-animated 8-bit files are finished here.

 

Animated files have additional Application Data. Size – (number of images) x 16. Content follows:

 

For images which are the beginning of new foreshortening (direction):

1-8 bytes – 0, unknown purpose.

9 byte – equals to number of images in current direction.

10 byte – 2, unknown purpose.

11-16 bytes – 0, unknown purpose.

 

For images which are not the beginning of new direction:

1-16 bytes – 0, unknown purpose.

 

 

ETRLE compression algorithm.

ETRLE abbreviation meaning is unknown. Last three letters most likely mean Run-Length Encoding.

 

Compressed sequence consist of multiple subsequences of transparent and non-transparent bytes (SirTech have transparent color as zero).

Every subsequence on transparent bytes is replaced by one byte with highest bit set to 1. Lower 7 bits hold number of transparent bytes. If sequence of transparent bytes is longer than 127, then new byte for transparent bytes encoding used and so on.

One service byte used before subsequence of non-transparent bytes. Its highest bit is set to 0. Lower 7 bits hold number of non-transparent byte in subsequence. If non-transparent bytes subsequence exceeds 127, new service byte is used and so on.

Every row has zero byte on its end.

Comments (0)

You don't have permission to comment on this page.