16122002, Thomas.Eder@nmi.at, Using the zziplib library with SDL


PREREQUISITES

  Tested versions:
    zziplib 0.10.66 (preview), SDL 1.2.5, Win32, MSVC6

  Homepages (download)
    zziplib.sourceforge.net (zziplib-0.10.66.tar.gz)
    www.libsdl.org (SDL-devel-1.2.5a-VC6.zip)

  Also you have to get zlib, I used 
    from SDL_image-1.2.2.zip in VisualC.zip:
      zlib.lib (12.7.1998, 34674 bytes)
      zlib.h   ( 9.7.1998, 41791 bytes, 1.1.3)
      zconf.h  ( 8.7.1998,  8089 bytes)

    from SDL_image-devel-1.2.2-VC6.zip:
      zlib.dll ( 5.4.2001, 53760 bytes, 1.1.3.1)

  Maybe you should get the latest version (currently 1.1.4) from
    http://gnuwin32.sourceforge.net/install.html
      (see notes at end of page!)


CREATING zzlib.dll/zzlib.lib

  Copy your versions of zlib.lib, zlib.h and zconf.h to the zzlib 
    directory.
  In MSVC (start zziplib.dsw)
    Add zlib.lib to the files for the zziplib_DLL project.
    Add ZLIB_DLL to the preprocessor definitions.

  Set the active project and the active configuration to create zziplib.dll 
  and zziplib.lib (I created and used the release version).


USING zzlib WITH SDL

  Include/add the following files to your SDL-Project
  (put them in proper directories, etc.):

  Header files:
    zconf.h
    zlib.h
    zzip.h
    zzip-conf.h
    zzip-io.h
    zziplib.h
    zzip-msvc.h
    zzip-stdint.h

  Libraries:
    zlib.lib
    zziplib.lib

  DLLs:
    zlib.dll
    zziplib.dll

  you may also want to use 
    SDL_rwops_zzip.c
    SDL_rwops_zzip.h


  For compiling it should be sufficient to use
    #include <zziplib.h> 
  in the files where you use zziplib-functions.


NOTE

  It is possible to use both original (unzipped) and zipped versions of files,
  and zziplib will take one of them (depending on the modes when calling 
  zziplib).

  But this didnt work for all of my original files, so I suggest using zipped
  files only (and remove the original unzipped files, so zziplib doesnt try to
  open the original version).


HINT

  When opening many files from a zip, its faster to open the zip-directory
  only once, and not for every file access. You may want to modify 
  SDL_rwops_zzip for this to get code like:


    SDL_Surface* image;
    SDL_RWops*   rw;
    SDL_Surface* temp1 = NULL;  //default > NULL > error
    SDL_Surface* temp2 = NULL;  //default > NULL > error

      //last param may be used for err return
    ZZIP_DIR* zzipdir = zzip_dir_open( "figures.zip", NULL ); 

    ZZIP_FILE* zfile = zzip_file_open(zzipdir, "f1.bmp", ZZIP_CASELESS);

    if (zfile)
    {
        rw = SDL_RWFromZZIP(zfile);  //modified version
        if (rw)
        {
            temp1 = IMG_Load_RW(rw, 0);
            SDL_FreeRW(rw);
        }
        int zret = zzip_file_close( zfile );
    }

    zfile = zzip_file_open(zzipdir, "f2.bmp", ZZIP_CASELESS);
    if (zfile)
    {
        rw = SDL_RWFromZZIP(zfile);  //modified version
        if (rw)
        {
            temp2 = IMG_Load_RW(rw, 0);
            SDL_FreeRW(rw);
        }
        int zret = zzip_file_close( zfile );
    }

    //.. etc

    zzip_dir_close( zzipdir );
