|
|
|
|
|
|
|
|
|
|
|
Re: STI File Structure (by Pipetz)[message #330947]
|
Sat, 01 March 2014 16:34
|
|
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 #336161]
|
Fri, 26 September 2014 03:11
|
|
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
|
|
|
|