forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Zip Extraction

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Ooblik



Joined: 10 Apr 2008
Posts: 38

PostPosted: Sun May 17, 2009 2:20 pm    Post subject: Zip Extraction Reply with quote

Anybody have a source code example on extracting zip files?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun May 17, 2009 3:32 pm    Post subject: Reply with quote

It's the same as on a PC. Just use zlib - it's part of the libraries in the toolchain for a reason.
>.>
Back to top
View user's profile Send private message AIM Address
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sun May 17, 2009 6:39 pm    Post subject: Reply with quote

Well you do need to but something around zlib which handles the zip format itself but yes not hard :)
Back to top
View user's profile Send private message
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Sun May 17, 2009 10:08 pm    Post subject: Reply with quote

A working implementation exists in JGE++'s source code:
http://code.google.com/p/wagic/source/browse/#svn/trunk/JGE/src/unzip
http://code.google.com/p/wagic/source/browse/trunk/JGE/src/JFileSystem.cpp

But as it's been said, there's nothing PSPecific about this
Back to top
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Mon May 18, 2009 1:18 am    Post subject: Reply with quote

i posted a library that was made using minizip that works on psp on my website kehon.izfree.com but not to sure how its doing now
Back to top
View user's profile Send private message MSN Messenger
Ooblik



Joined: 10 Apr 2008
Posts: 38

PostPosted: Tue May 19, 2009 6:32 pm    Post subject: Reply with quote

THANKS coolkehon your library still works perfectly!

Now I have a new problem:

Code:
...      if(unzGetCurrentFileInfo(zipFd, &curZipFileInfo, fNameBuf, sizeof(fNameBuf), NULL, 0, NULL, 0) == UNZ_OK) {
         if(curZipFileInfo.uncompressed_size > 0) {
            printf("Allocate %d Bytes for %s\n", (int)(curZipFileInfo.uncompressed_size)+1, fNameBuf);
            
            fileBuff = (char *)realloc(fileBuff, curZipFileInfo.uncompressed_size+1);...


This only allocates 4 bytes (int ?). How can I fix it? Sorry I'm new to dynamic memory allocation XD

I know this is probably some stupid little thing I'm just not thinking of...
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue May 19, 2009 8:23 pm    Post subject: Reply with quote

Is fileBuff used before? Is it null? Check the realloc return value. If fileBuff isn't already assigned to an allocated address then it has to be null for realloc to work.
Back to top
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Wed May 20, 2009 2:58 am    Post subject: Reply with quote

i did this once by accident it was a pointer problem dont rember if it was like this or what but i was writting a pointer instead of the data to the pointer or vice versa make sure you have all the info correct with pointers because the size of a pointer i believe is 4 bytes
Back to top
View user's profile Send private message MSN Messenger
Ooblik



Joined: 10 Apr 2008
Posts: 38

PostPosted: Wed May 20, 2009 11:17 am    Post subject: Reply with quote

coolkehon wrote:
i did this once by accident it was a pointer problem dont rember if it was like this or what but i was writting a pointer instead of the data to the pointer or vice versa make sure you have all the info correct with pointers because the size of a pointer i believe is 4 bytes


Yeah its allocating the size of the pointer int (4 bytes) not the value of the pointer represented as an integer... if that makes sense...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group