From bfa5de7eccf4604ff8217f619e9685a09e80d545 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 27 Sep 2002 12:17:57 +0000 Subject: The week-without-the-network changes --- MegamanX5/Makefile | 4 +++- MegamanX5/unarc.cpp | 40 ++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'MegamanX5') 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 #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 -- cgit v1.2.3