This site is no longer active and is available for archival purposes only. Registration and login is disabled.

zLib and PAK files


zLib and PAK files

Postby Malmer » May 23, 2001 @ 7:59pm

Hello Guys!<br><br>Since you are all (well some of you) PQ developers I have a Q for you. We need some way of putting a lot of files into one file and read them from inside Argentum. My first though naturally is to do it the way Quake does, with zLib and some kind of PAK file. Could someone explain how to get it working? And do I need any special DLL's? What functions in zlib are the vital ones?<br><br>Dan, I know you know the answer to this. Please help me. We need it for the game. <br><br>Thanks!<br><br>// Fredrik<br><br>PS. I bet it is really easy, I just havn't put enough effort into it. Anyways, you have a couple of days to answer. I'm going away. DS.
All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Re: zLib and PAK files

Postby randall » May 23, 2001 @ 10:31pm

I just read a very descriptive article about the structure of the Quake PAK file, and the functions that work with it. Too bad I can't remember where it was.<br><br>I think it was a reference for developers to write a PAK explorer.<br><br>If I come across it again, I'll post a link to it.
User avatar
randall
pm Insider
 
Posts: 3426
Joined: Feb 23, 2001 @ 4:02pm
Location: Schnoogie


Re: zLib and PAK files

Postby Malmer » May 24, 2001 @ 3:49am

For me it isn't very important to have the best compression on earth or anything, or to have a ultra efficient storage system. I basically just want the files put into one file and have functions similiar to fread etc.<br><br>// Fredrik
All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Re: zLib and PAK files

Postby Moose or Chuck » May 24, 2001 @ 11:04am

talk to the guy that wrote PHexen, he had a really good compression scheme. It almost sped up the program when the .wad's were zipped. He used some kind of cache trick, which allowed frequently accessed parts of the file to  be cached. And i believe he made the file Random access instead of sequenstial.
Moose or Chuck
 


Re: zLib and PAK files

Postby Dan East » May 24, 2001 @ 11:09am

The pak format is pretty straightforward. There's a table at the beginning of the file containing an entry for each file, with it's name, filesize, and offset into the pak. Extracting is just a matter of seeking in by the offset and reading filesize bytes. I just use the gzip algorithms for reading if the pak has a .gz extension. The problem is that the pak / gz combo is very slow. Seeking in a gzipped file means reading / decompressing. If you seek to a location before the current file pointer, then gzip resets back to beginning and decompresses up to the desired seek location. This makes for very poor random file access. Terry Whiterod, of PocketHexen fame, came up with a much more effecient technique of gzipping pak / wad files. He offered me more information on his technique , but he never responded to my emails.<br>Zlib decompressing is really not that slow. It is just not cool when various segments of the file have to be decompressed hundreds of times over due to file seeking. If I never hear back from Terry I will pursue my own optimized gz/pak routines in a month or so.<br><br>It took some minor tweaking for the zlib source to build for Pocket PC, so you ought to just grab the zlib files out of the PQ source.<br><br>Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: zLib and PAK files

Postby Dan East » May 24, 2001 @ 11:10am

I hate it when people post the same thing I'm going to post while I'm typing it in. :)<br><br>Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: zLib and PAK files

Postby Moose or Chuck » May 24, 2001 @ 12:08pm

yep dan i know i was to fast for you :)
Moose or Chuck
 


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron