summaryrefslogtreecommitdiff
path: root/MegamanX5/unarc.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-06-24 08:19:36 +0000
committerPixel <Pixel>2002-06-24 08:19:36 +0000
commit4b85655d670c36b9c6b13fec8196e008de67e9ce (patch)
tree7257573f7759f63323de75553c7f503b9d248060 /MegamanX5/unarc.cpp
parentd0f485b19a53ce3c7032066096305dbecba536fe (diff)
Whoups...
Diffstat (limited to 'MegamanX5/unarc.cpp')
-rw-r--r--MegamanX5/unarc.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/MegamanX5/unarc.cpp b/MegamanX5/unarc.cpp
new file mode 100644
index 0000000..c9ab2be
--- /dev/null
+++ b/MegamanX5/unarc.cpp
@@ -0,0 +1,40 @@
+#include <stdlib.h>
+#include "generic.h"
+#include "fileutils.h"
+
+int main(int argc, char ** argv) {
+ FILE * f;
+
+ int i = 0;
+
+ f = fopen(argv[1], "r");
+
+ int offset = 0;
+ while (1) {
+ int sector, size;
+ fseek(f, offset, SEEK_SET);
+ fread(&sector, 4, 1, f);
+ fread(&size, 4, 1, f);
+ offset += 8;
+
+ if (!sector)
+ break;
+
+ fseek(f, sector <<= 9, SEEK_SET);
+
+ char * buffer = (char *) malloc(size);
+
+ fread(buffer, 1, size, f);
+
+ char fname[64];
+ sprintf(fname, "unarc-%03i.out", i);
+ FILE * o = fopen(fname, "w");
+ fwrite(buffer, 1, size, o);
+ fclose(o);
+ i++;
+
+ free(buffer);
+ }
+
+ exit(-1);
+}