Jump to content
  • Advertisement
Sign in to follow this  
JJJohan

Zlib - compressing multiple files into one compressed file?

This topic is 3407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've spend quite a few hours looking for a bunch of zlib resources since I have no idea what to actually use.. Anyway, I downloaded zlib along with zlibtool.zip elsewhere, which basically lets me do this to compress and uncompress files:
#include "zlibengn.h"

#pragma comment(lib,"zdll.lib")

ZlibEngine z;

int main(int argc, char* argv[])
{
	z.compress( "zlib.h","zlib.h__");
	z.decompress( "zlib.h__", "test.h");
	return 0;
}
Now the question is, how would I go at compressing multiple files into one file, then obviously decompressing them all again in their original place? I tried using a folder which doesn't seem to work, and I don't arrays are working either. If I can't use zlibtools, then please be so kind to redirect me to what I need to use. I'd really like to use this method to store a hefty number of game resources into a single compress folder, then if needed uncompress them while the game loads etc. (or just load them while compressed if that's possible)

Share this post


Link to post
Share on other sites
Advertisement
I can't seem to find any way to compile physfs, seeing as it doesn't come with any sort of installation instructions :(. I just get spammed with 3 errors which I can't seem to figure out when I try to compile physfs.c


1>------ Build started: Project: physfs, Configuration: Debug Win32 ------
1>Compiling...
1>physfc.cpp
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(177) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(327) : warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(157) : see declaration of 'strncpy'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(560) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(566) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(567) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(79) : see declaration of 'strcat'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(626) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(650) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(79) : see declaration of 'strcat'
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(672) : error C2440: '=' : cannot convert from 'const char *' to 'char *'
1> Conversion loses qualifiers
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(675) : error C2440: '=' : cannot convert from 'const char *' to 'char *'
1> Conversion loses qualifiers
1>c:\users\jjjohan\documents\visual studio 2008\projects\physfs\physfs\physfc.cpp(1444) : error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>Build log was saved at "file://c:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\physfs\Debug\BuildLog.htm"
1>physfs - 3 error(s), 7 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Quote:
Original post by JJJohanI just get spammed with 3 errors which I can't seem to figure out when I try to compile physfs.c

Are you really compiling physfs.c file? Output from Visual Studio build log shows that you are compiling physfc.cpp file. What is this file? Why are you not using original physfs.c file?

Share this post


Link to post
Share on other sites
Now I'm just getting the following message when compiling the original physfs.c(whoops with the first time)

1>Linking...
1> Creating library C:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\Debug\physfs.lib and object C:\Users\JJJohan\Documents\Visual Studio 2008\Projects\physfs\Debug\physfs.exp
1>LINK : fatal error LNK1561: entry point must be defined


But other than that, even if I do manage to compile it, what am I supposed to do with it? There's very few details on usage anywhere.

Share this post


Link to post
Share on other sites
Hi,
as far as I know, zlib just compress only one file. So, the usual approach in the linux world is to pack the files with tar and then compressing the tar file.

http://www.zlib.net/zlib_how.html

Share this post


Link to post
Share on other sites
The PhysFS archive comes with a text file INSTALL.txt. Are you following the instructions on how to build it there? Also, a PhysFS tutorial is available on the PhysFS website. Funny enough, it's listed under the section labeled "Documentation".

Share this post


Link to post
Share on other sites
Thanks, I feel stupid for having missed that, I take back about the lack of documentation. I was rather stressed and had spend the entire previous day finding a suitable solution so I wasn't particularly relaxed in the morning.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!