|
|
|
|
|
|
|
|
|
|
|
|
|
Re: STI File Structure (by Pipetz)[message #336161] |
Fri, 26 September 2014 03:11  | |
Flugente
|
 |
Messages:3539
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:
|

|
|
|