So I'm trying to read the darkplaces/fs.c code but it's sort of hard to understand. The big thing that I don't get is where decompression happens. Does it happen all at once for each pk3, and then the decompressed pk3 is stored in RAM/virtual memory, or does decompression happen as-needed for each requested file? I suspect it's the latter. However what I don't get is where this happens, unless inflateInit2 decompresses files (but the zlib manual says it doesn't). You'd expect that fs.c would work in such a way such that when an already-decompressed file is requested, the address to its location in RAM would be provided, and if the file requested isn't already decompressed, then fs.c would decompress it and return its address. I don't see where this is going on. In fact, there's only one place in the Darkplaces engine where an actual inflate() call is made, and the function that contains it is only called once in cl_parse.c for decompressing files downloaded from a server. So can someone explain how fs.c handles decompressing files within pak3 files?