EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   OpenEQ::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=609)
-   -   Finished Archive and PFSLoader classes (https://www.eqemulator.org/forums/showthread.php?t=17085)

daeken_bb 11-19-2004 01:45 PM

Finished Archive and PFSLoader classes
 
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)


All times are GMT -4. The time now is 07:34 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.