summaryrefslogtreecommitdiff
path: root/MegamanX5
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
parentd0f485b19a53ce3c7032066096305dbecba536fe (diff)
Whoups...
Diffstat (limited to 'MegamanX5')
-rwxr-xr-xMegamanX5/Makefile15
-rw-r--r--MegamanX5/unarc.cpp40
2 files changed, 55 insertions, 0 deletions
diff --git a/MegamanX5/Makefile b/MegamanX5/Makefile
new file mode 100755
index 0000000..80db8f8
--- /dev/null
+++ b/MegamanX5/Makefile
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+
+CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I..
+CXX=g++
+
+TARGET = unarc
+
+all: ${TARGET}
+
+unarc: unarc.o ../fileutils.h ../fileutils.cpp ../generic.h ../generic.cpp Makefile
+ ${CXX} ${LDFLAGS} unarc.o ../fileutils.o ../generic.o -o unarc
+
+clean:
+ rm -f *.o ${TARGET} compil.c
+
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);
+}