included zlib ?

View previous topic View next topic Go down

included zlib ?

Post  drunknbass on Mon Jan 12, 2009 1:59 pm

is there a reason you use your own implementation of zlib and not use the included apple zlib?
the zlib you include in the engine obviously does archiving, does apples zlib not do the same?

drunknbass

Posts : 16
Join date : 2008-12-04

View user profile

Back to top Go down

Re: included zlib ?

Post  sio2interactive on Mon Jan 12, 2009 9:29 pm

Yes, basically it is the same however I've done some minor modifications on the buffer in order to speed up the decompression.
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: included zlib ?

Post  drunknbass on Tue Jan 13, 2009 3:17 pm

oh I see. I was under the assumption that the built in apple zlib could not handle zips of multiple files. I guess I was wrong.

drunknbass

Posts : 16
Join date : 2008-12-04

View user profile

Back to top Go down

Re: included zlib ?

Post  drunknbass on Tue Jan 13, 2009 9:01 pm

reason i ask is because i had other resources i thought i could package in a zip and copy to documents and decompress to tmp when i run my game.
i was just having a hard time understanding how sio2 resources are unpacked.. any info to point me in the right direction would be great!

drunknbass

Posts : 16
Join date : 2008-12-04

View user profile

Back to top Go down

Re: included zlib ?

Post  sio2interactive on Tue Jan 13, 2009 11:00 pm

Everything is done in memory... Nothing is touching the disk...

Basically what I do is this:

The zip file is open and I loop through all the files. For each file I extract the compressed stream, decompress in memory and send the uncompressed stream to the appropriate loader. Check the SIO2stream structure of SIO2 basically it operate like: fopen, fread, fseek etc... but its all done in memory...

Hope this help,

Cheers!
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 37
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: included zlib ?

Post  drunknbass on Tue Jan 13, 2009 11:15 pm

thx for the kickstart. I found some windows code online that uses the same unzip.c and h and I'm slowly working at it. So far it seems you open a zip and work through the files 1 by 1 almost like parsing nodes of XML. Also the code I found mallocs memory for the size of the uncompressed file. I wonder if there's a way to write from file to disk directly would putting it in memory first. Not sure but it might be required for the decompression. Working with limited memory usage on iPhone makes things so difficult.

drunknbass

Posts : 16
Join date : 2008-12-04

View user profile

Back to top Go down

Re: included zlib ?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum