sourcehold / sourcehold-maps

Reverse engineering the map file format of Stronghold
GNU General Public License v3.0
20 stars 3 forks source link

Unspecified size of a section #2

Closed gynt closed 4 years ago

gynt commented 5 years ago

A map file can be divided into sections that start with an integer that indicates its size, followed by a byte array of that size.

However, at the end of some sections, there is no indication of the size of the next section. We need that size specification because its size seems to differ across map files. For an example, see this line: https://github.com/sourcehold/sourcehold-maps/blob/master/map_structure.h#L100

gynt commented 5 years ago

I found the solution. There is a meta section that indicates all the sizes of the sections. It also indicates whether it is compressed or not.

I implemented an unpacker