Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Tools and Guides Repository (Archive) » STI File Structure (by Pipetz)
STI File Structure (by Pipetz)[message #222389] Sun, 21 June 2009 12:16 Go to next message
Shanga is currently offline Shanga

 
Messages:3482
Registered:January 2000
Location: Danubia
STСI (Sir-Tech's Crazy Image) file format.
by Pipetz

Original post:
http://66.196.80.202/babelfish/translate_url_content?.intl=de&lp=ru_en&trurl=http://forum.ja2.su/cgi-bin/yabb/YaBB.pl%3fboard%3dgravediggers;action%3ddisplay;num%3d1203667162

English source from:
http://ja2v113.pbworks.com/STCI-(STI)-format-description

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

[Updated on: Sun, 21 June 2009 12:18] by Moderator

Report message to a moderator

Captain
Re: STI File Structure (by Pipetz)[message #222390] Sun, 21 June 2009 12:20 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3482
Registered:January 2000
Location: Danubia
PS: Correct abbr of files is STI. STCI is a joke by our russian friends to include the Crazy factor and who can blame them...

Report message to a moderator

Captain
Re: STI File Structure (by Pipetz)[message #222411] Sun, 21 June 2009 15:54 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
Shanga
PS: Correct abbr of files is STI. STCI is a joke by our russian friends to include the Crazy factor and who can blame them...

Actually it is straight from the source code (imgfmt.h):
// Sir-Tech's Crazy Image (STCI) file format specifications.  Each file is composed of:
// 1    ImageFileHeader, uncompressed
// *    Palette (STCI_INDEXED, size = uiNumberOfColours * PALETTE_ELEMENT_SIZE), uncompressed
// *    SubRectInfo's (usNumberOfRects > 0, size = usNumberOfSubRects * sizeof(SubRectInfo) ), uncompressed
// *    Bytes of image data, possibly compressed

Report message to a moderator

Sergeant 1st Class
Re: STI File Structure (by Pipetz)[message #222414] Sun, 21 June 2009 16:18 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3482
Registered:January 2000
Location: Danubia
Mhahaha, no way... Thanks for pointing out man, who said you cannot laugh while reading source code?

Very Happy

Report message to a moderator

Captain
Re: STI File Structure (by Pipetz)[message #283871] Sat, 18 June 2011 23:52 Go to previous messageGo to next message
Zalpha is currently offline Zalpha

 
Messages:32
Registered:July 2009
Location: South Africa
No Message Body

Report message to a moderator

Private 1st Class
Re: STI File Structure (by Pipetz)[message #283873] Sat, 18 June 2011 23:58 Go to previous messageGo to next message
Logisteric

 
Messages:3199
Registered:December 2008
Location: B
if you had waited just three more days with your answer it would have been two years :placard:

welcome to the pit

Report message to a moderator

Captain
Re: STI File Structure (by Pipetz)[message #283893] Sun, 19 June 2011 07:30 Go to previous messageGo to next message
Zalpha is currently offline Zalpha

 
Messages:32
Registered:July 2009
Location: South Africa
~LoL~

Interesting that you noticed that... have been a member for awhile now but only visited to get my 1.13 fix... I want to try my hand at modding JA2 now. XD

Report message to a moderator

Private 1st Class
Re: STI File Structure (by Pipetz)[message #283911] Sun, 19 June 2011 11:48 Go to previous messageGo to next message
Logisteric

 
Messages:3199
Registered:December 2008
Location: B
i did not notice that - it would have been three years since the post you replied to (29/07/2009 is far off from two years on thursday)

Report message to a moderator

Captain
Re: STI File Structure (by Pipetz)[message #285399] Sat, 02 July 2011 22:28 Go to previous messageGo to next message
SharkD is currently offline SharkD

 
Messages:352
Registered:July 2003
If he had replied right when he joined you would have no reason for complaint. Wink

Report message to a moderator

Master Sergeant
Re: STI File Structure (by Pipetz)[message #302608] Sat, 31 March 2012 14:56 Go to previous messageGo to next message
Tox is currently offline Tox

 
Messages:249
Registered:February 2000
Location: www.webcodesign.de
Quote:
1 bit

Report message to a moderator

Sergeant 1st Class
JA2STI Creator
Re: STI File Structure (by Pipetz)[message #330289] Mon, 03 February 2014 12:43 Go to previous messageGo to next message
Tox is currently offline Tox

 
Messages:249
Registered:February 2000
Location: www.webcodesign.de
Shanga

...
34-44 bytes

Report message to a moderator

Sergeant 1st Class
JA2STI Creator
Re: STI File Structure (by Pipetz)[message #330947] Sat, 01 March 2014 16:34 Go to previous messageGo to next message
Tox is currently offline Tox

 
Messages:249
Registered:February 2000
Location: www.webcodesign.de
ok, first of all: the animation flag (bit 0 of the flags) seems to define whether the file contains app data (in case of STIs that are the animation headers). so far it looks like all files with this flag set have app data. which would then be the same as checking if uiAppDataSize is greater than 0, I believed. in fact some files do have an app data size of 0, but do contain app data.

one file puzzles me, though. IMP face #216 from the 4870 release has the "has app data" flag set, but has no actual app data. when I try using that face the game crashes as soon as I enter the tactic screen. is the STI corrupt or did I miss out on something? all other faces I tested didn't have the flag set.

and I couldn't find any purpose of the unused data blocks, maybe values other than 0 are simply remnants of earlier format versions. does anyone know if these have any meaning?

[Updated on: Sat, 01 March 2014 19:26] by Moderator

Report message to a moderator

Sergeant 1st Class
JA2STI Creator
Re: STI File Structure (by Pipetz)[message #336148] Thu, 25 September 2014 20:05 Go to previous messageGo to next message
Tox is currently offline Tox

 
Messages:249
Registered:February 2000
Location: www.webcodesign.de
Shanga

46-49 bytes

Report message to a moderator

Sergeant 1st Class
JA2STI Creator
Re: STI File Structure (by Pipetz)[message #336161] Fri, 26 September 2014 03:11 Go to previous message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Had a chat with Tox on this, we seem to make progress.

For the general public's entertainment, two gems I found in the code:

1. SirTech's STI format definition must have gone this way it seems:
  • Step 1: Before declaring STI format, clarify that the format msut be nicely aligned, and not exceed 64 bytes
  • Step 2: Directly under that, declare STI format. Make it not aligned. Size will be 68 bytes.
  • Step 3: ???
  • Step 4: Say 'Fuck this', put in #define STCI_HEADER_SIZE 64. Whenever you read or write STI format, do not use the size of the structure you just declared, but 64.
  • Step 5: Profit!!! :spend:
This will leave parts of the structure with bogus values. Also, this might lead to values being stored in variables that should be unused.

2. When reading the number of tiles in an animation, store that number in a variable that is too small, causing an overflow. Always do that. Whenever you use it, cause an overflow again, thereby restoring the old value.

I work with this game every day, but it still amazes me. :et5:

Report message to a moderator

Captain

Previous Topic: Create Custom Faces & Voices
Next Topic: Tips and requirements for creating new IMP voices.
Goto Forum:
  


Current Time: Fri Apr 19 02:11:47 GMT+3 2024

Total time taken to generate the page: 0.01518 seconds