Add in-memory cache of archive files
We need to 'sensibly' handle how we load files from a compressed archive:
- TAR archives need a full scan to get the TOC, which means a full read and decompress into memory
- aircraft archives need some (but not all files) on sim start, and then will intermittently load further files (sounds, models, dialogs) during the run.
- scenery archives, depending on chunk size, will load all of a subdir (all BTGs and STGs and referenced models) once until unloaded.
This suggests we want to fully expand the archive into memory, but not keep it around 'once the loading is done', except with a special case for the current aircraft?
And of course it's much more efficient for the OS to read the file sequentially anyway, also for the decompressor in use.
So it feels like we should mount archives, fully decompress them to a memory pool (that's freeable), and then use a time-based freeing policy to avoid memory bloat.
We do also have use cases where the decompressed in-memory data could be adopted/moved by the using code (eg WAV loading), but generally this is not the case (eg PNGs, AC files)
Edited by James Turner