Well, after long hours of work on this code, it's finally finished. We now have a complete Archive abstract class and a PFSLoader class that implements it. The Archive class itself does nothing, but it provides the interface that all archived file loaders must implement. The PFSLoader class does the real work, and supports both S3D and EQG files fully (not that there's a difference between them).
Full source is available at
http://home.archshadow.com/~daeken/openeq/
The main.cpp file that follows takes 2 arguments, a PFS (s3d or eqg) filename and a filename within that. It prints the contents of the file inside the PFS up until the first null.
Code:
#include <stdio.h>
#include "archive.hpp"
#include "pfs.hpp"
int main(int argc, char **argv) {
Archive *archive;
unsigned char *buf;
int len;
archive = new PFSLoader();
archive->Open(fopen(argv[1], "rb"));
archive->GetFile(argv[2], &buf, &len);
printf("%s\n", buf);
}
This is also on the site as main.cpp for the time being, though I'll be changing that file as I develop, so I suggest you just use the one provided here.
Happy Hacking,
Lord Daeken M. BlackBlade
(Cody Brocious)