diff options
author | Pixel <Pixel> | 2002-09-27 12:17:57 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-09-27 12:17:57 +0000 |
commit | bfa5de7eccf4604ff8217f619e9685a09e80d545 (patch) | |
tree | a5be5de750ac611145f459a09bda902c3dbc1a70 /MegamanX5 | |
parent | 60c1003845035ad4cd0e9ea50862bad7626faf0e (diff) |
The week-without-the-network changes
Diffstat (limited to 'MegamanX5')
-rwxr-xr-x | MegamanX5/Makefile | 4 | ||||
-rw-r--r-- | MegamanX5/unarc.cpp | 40 |
2 files changed, 23 insertions, 21 deletions
diff --git a/MegamanX5/Makefile b/MegamanX5/Makefile index 74bec9e..831126c 100755 --- a/MegamanX5/Makefile +++ b/MegamanX5/Makefile @@ -2,12 +2,14 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I../includes CXX=g++ +LIBS=-lz +LDFLAGS=${LIBS} TARGET = unarc all: ${TARGET} -unarc: unarc.o ../includes/fileutils.h ../includes/generic.h Makefile +unarc: unarc.o ../includes/generic.h Makefile ${CXX} ${LDFLAGS} unarc.o ../generic/generic.a -o unarc clean: diff --git a/MegamanX5/unarc.cpp b/MegamanX5/unarc.cpp index c9ab2be..38a6522 100644 --- a/MegamanX5/unarc.cpp +++ b/MegamanX5/unarc.cpp @@ -1,40 +1,40 @@ #include <stdlib.h> #include "generic.h" -#include "fileutils.h" +#include "Input.h" +#include "Output.h" +#include "Main.h" -int main(int argc, char ** argv) { - FILE * f; +CODE_BEGINS +int startup() { + Handle * f, * o; int i = 0; - f = fopen(argv[1], "r"); + f = new Input(argv[1]); int offset = 0; while (1) { int sector, size; - fseek(f, offset, SEEK_SET); - fread(§or, 4, 1, f); - fread(&size, 4, 1, f); + f->seek(offset, SEEK_SET); + f->read(§or, 4); + f->read(&size, 4); offset += 8; if (!sector) break; - fseek(f, sector <<= 9, SEEK_SET); + f->seek(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); + String fname; + fname.set("unarc-%03i.out", i); + o = new Output(fname); + copy(f, o, size); + delete o; i++; - - free(buffer); } - exit(-1); + delete f; + + return -1; } +CODE_ENDS |