Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » 4 extra bytes in STCIHeader structure
4 extra bytes in STCIHeader structure[message #137198] Mon, 30 April 2007 12:51 Go to next message
Trogdor is currently offline Trogdor
Messages:2
Registered:February 2007
I noticed that cUnused in STCIHeader has 4 extra bytes.
The only reason why STI files are loaded correctly is because after each read comes a correct seek.
Is there any reason to keep those 4 bytes as it seems that their only purpose is to make the structure bigger?

Report message to a moderator

Civilian
Re: 4 extra bytes in STCIHeader structure[message #137239] Mon, 30 April 2007 22:32 Go to previous messageGo to next message
Lesh 2 is currently offline Lesh 2

 
Messages:107
Registered:September 2006
Location: Izhevsk, Russia
This is a common practice to have some bytes reserved in data structures for future creativity. Later, if developer adds some data to structure, he simply reduces amount of reserved bytes, so structure does't change its size. Otherwise, he has to redo all that data (read in old format, convert/copy to new format in memory and save in new format). Reserved bytes can save a lot of time.

So you can use up to 4 bytes for your purposes.

Report message to a moderator

Sergeant
Re: 4 extra bytes in STCIHeader structure[message #137357] Wed, 02 May 2007 11:36 Go to previous messageGo to next message
Trogdor is currently offline Trogdor
Messages:2
Registered:February 2007
No, what I meant was that the structure exceeds the the header size in the sti files.
10 of the 14 cUnused bytes are present but the last 4 overlap with the palette data.

And STCI_HEADER_SIZE is 64 even thought the structure is actually 68 bytes with those 4 extra.

[Updated on: Wed, 02 May 2007 11:45] by Moderator

Report message to a moderator

Civilian
Re: 4 extra bytes in STCIHeader structure[message #137384] Wed, 02 May 2007 16:13 Go to previous messageGo to next message
defrog is currently offline defrog

 
Messages:234
Registered:March 2004
Location: Austria
without reading the source, it has been a while. It shouldn't be a problem if the unused is at the end of the struct and is really not used.

Only problem I could see is would be if the struct size was used to index into the file.

I could be possible that the struct was extended after the resource files were generated. If this comes out of the standard gaming platform headers, then you should remember this was not solely for this game...

Report message to a moderator

Sergeant 1st Class
Re: 4 extra bytes in STCIHeader structure[message #138748] Mon, 14 May 2007 14:37 Go to previous message
BasiC_101 is currently offline BasiC_101

 
Messages:27
Registered:September 2006
Location: South Africa

Cool

Report message to a moderator

Private 1st Class
Previous Topic: Somewhat far out, but... OGRE 3d engine + JA2?
Next Topic: Errors in compiling: JA25 source
Goto Forum:
  


Current Time: Sat Jun 13 03:01:41 GMT+3 2026

Total time taken to generate the page: 0.00665 seconds