Closed MangoFizz closed 3 years ago
Nice work.
The size value in the header is the uncompressed size. Invader compressed maps will always have this set correctly as it is used for decompression, however it is completely unreliable in regular format maps and it is often zeroed out. There are two reasons for this, one reason is to work around the max map size limitation as Halo checks this value rather than the actual size of the map, so if this value is set low you can load maps larger than the max size. The second reason is Halo leaks file descriptors when the map cache file size is over 128 MiB, so like bypassing the max size, setting the "size" in the header low will work around this bug too. When an invader-compressed map gets decompressed it zeroes the size field out so that is why it's not there.
The only reliable way to get the true size of a cache file is to check the file size on disk, same for getting the compressed size of an invader-compressed map.
Another thing to mention with maps in ram you have to account for raw data loaded from the resource maps too, so the actual memory buffer usage will be higher than just the regular uncompressed map size. IIRC Chimera already has a value for this somewhere you can use to display this correctly.
Done! Now I'm getting the map file size from the map loading stuff. I also added some additional fields for compressed maps and RAM buffer.
Looks good! Thanks!
Well, here is the command that @Vaporeon requested on #34
Edit 1: There is no file size on Invader maps header :(