This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.


  Compressed Resource Manager
  Submitted by

This is a small utility for managing compressed resources on windows and linux. By replacing the fopen(), fread() etc. functions it allows an application already using these functions to access the compressed data transparently. When attempting any file operations, preference is given to uncompressed 'normal' files on disk, and then to the contents of compressed bundles. If a normal file is found the standard file functions are used, otherwise an entry from a bundle may be uncompressed and used from memory. Any number of compressed bundles can be used - at application startup a list of bundles and their contents is built automatically. One bundle kind of corresponds to one directory, and as such the location of the bundle in relation to the application's working directory is taken into account when deciding what the path of the files it contains will be. Replaced functions are: fopen, fclose, fread, fwrite, fseek, rewind, fgetpos, fsetpos, feof. The Windows FindFirstFile() method of iterating through a set of files matching a search pattern is also implemented transparently (on Windows). Using zlib, the file format for these bundles is one which I just made up, and doesn't support writing into these bundles (fwrite works as normal for normal files though), so it is mainly useful for a final distribution, patches or maybe obfuscating game assets. There is a utility for compressing and testing bundles, you can find a bit more info about usage and limitations at This code is free for whoever finds it useful to do what they please with.

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.