GP2X Unzipping


Last edited by a moderator:
I'm looking for something i can use on the gp2x, i'm guessing such a lib exists as several emus support zip files.
 
I'm looking for something i can use on the gp2x, i'm guessing such a lib exists as several emus support zip files.
I don't have access to my GP2x at the moment, but isn't there zlib.so? /usr/include/zlib.h.
Yes, just had a look at the GPH toolchain dirs, the GP2x has libz.so, so ......../include/zlib.h

Otherwise, if you want to compile a command, then this may be useful, it has no dependencies and needs no libraries:
ftp://ftp.info-zip.org/pub/infozip/src/zip231.tar.gz

Edit: I mean has no dependencies and installs no libraries etc (sorry, was late).
 
Last edited by a moderator:
Consider just shelling out and running tar with gzip or bzip2 decompression. It should just be emulated by busybox, so it won't even cause much extra memory usage if busybox is already loaded for something else.
 
.... mount?


Might sound wierd at first, but what I think you are trying to do is to get multiple resource files (pictures?) into a single file.

If you create a single large file, make a file system on that, and then mount it with (compressed) loopback then you can easly access your files in a normal mather, and no need to unpack to /tmp/ (which will run full at some point).

Not sure if the GP2x supports loopback devices by default...
 
Daid, that is purely awesome :) I might use this technique :)

If we had an ISO, we could stuff files into it and then mount it!
Just a raw iso, and then again iso9660 might not be included on gp2x's mount.

So, if we wanted to put the contents of myfile.iso in the current directory we could do this:
Code:
mkdir /tmp/somefolder
mount -o loop -t iso9660 ./myfile.iso /tmp/somefolder

Which would be represented in C/C++ like this:

Code:
system("mkdir /tmp/somefolder");
system("mount -o loop -t iso9660 ./myfile.iso /tmp/somefolder");

And if we wanted to use these files as if they were already in the dir we could do this:
Code:
chdir("/tmp/somefolder/");
Correct?

Wow. That would rock. Unfortantally, it could lead to drm-like features, perhaps by using ext3 images or something (Which would still not be very strong AT ALL). Luckily those of us who know and run linux as an everyday operating system probably have the mount command and all of the filesystems the gp2x mount has on our Linux box.
 
ext3 is far from DRM, but I agree extra mounted filesystems probably shouldn't be used for skins and things that are meant to be easily replaced.
 
craig, if this is for that project you told abit about, with having some stuff on the nand very compressed, for bundles or somesuch, i recommend that you compile the squashfs filesystem driver, it supports 2.4 too, and it offers very good compression.

a little example:
picodrive, solitaire2x, mamegp2x, sokobangp2x, supertux, thoser are in their compressed form 20mb.
uncompressed 52mb.

if we tar.bz2 it, we get 19mb.

squashfs does this to 20mb. same as the zip/rar it came in, but in a low-ressourcehungry mountable (granted, readonly) filesystem. this is clearly a good choice :D

test.ubercompressed: 12mb (tradesecret, dont ask :))
test.tar.bz2: 19mb
test.squashfs: 20mb
 
Back
Top