Since .apk
is just a fancy .zip
archive, we use the ZLib library by Jean-loup Gailly combined with the MiniZIP library to retrieve compressed files from it. The complete source code is about 500 kilobytes in size so we provide two files, libcompress.c
and libcompress.h
, which are easily integrated into any build process. Our goal is to implement the clArchiveMountPoint
which enumerates files in an archive, decompresses the data for the specific file, and creates a clMemFileMapper
to read its data. To do this, we need to introduce a helper class, clArchiveReader
, which reads and decompresses .zip
archives:
class clArchiveReader: public iIntrusiveCounter { private:
The private sFileInfo
structure is defined in the clArchiveReader
class and encapsulates a pack of useful file properties together with the pointer to compressed file data:
struct sFileInfo { /// offset to the file uint64 FOffset; /// uncompressed file size uint64 FSize; /// compressed...