1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
WARNING:
The following instructions are outdated.
They refer back to 16. Dezember 2002 with zziplib version 0.10.66.
Most things refer to MSVC which have a different README
(and there are msvc project files being shipped along)
The rest is mainly an example program that you can use as a
boilerplate in your souce code - may be just copy and use.
---------------------------------------------------------------------
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 );
|