From 4b85655d670c36b9c6b13fec8196e008de67e9ce Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 24 Jun 2002 08:19:36 +0000 Subject: Whoups... --- MegamanX5/Makefile | 15 +++++++++++++++ MegamanX5/unarc.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ str-util.cpp | 11 ++++++----- 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100755 MegamanX5/Makefile create mode 100644 MegamanX5/unarc.cpp 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 +#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(§or, 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); +} diff --git a/str-util.cpp b/str-util.cpp index b1a2f2d..6a5b5bf 100644 --- a/str-util.cpp +++ b/str-util.cpp @@ -70,6 +70,7 @@ void process_one_sector(FILE * f) { fread(sector, 2336, 1, f); h = (STR_Header *) ((Byte *) sector + 8); + printm(M_INFO, "SubHeader: FN = %x, CN = %x, SM = %x, CI = %x: ", sector[0], sector[1], sector[2], sector[3]); /* printm(M_BARE, "SubHeader FN : %x\n", sector[0]); printm(M_BARE, "SubHeader CN : %x\n", sector[1]); @@ -77,8 +78,8 @@ void process_one_sector(FILE * f) { printm(M_BARE, "SubHeader CI : %x\n", sector[3]); */ if ((sector[2] == 0x48) || (sector[2] == 0x42)) { -/* printm(M_BARE, "Video sector\n"); - printm(M_BARE, "Status : %04x\n", h->StSTATUS); + printm(M_BARE, "Video sector\n"); +/* printm(M_BARE, "Status : %04x\n", h->StSTATUS); printm(M_BARE, "Type : %04x\n", h->StTYPE); printm(M_BARE, "Sector Offset: %i\n", h->StSECTOR_OFFSET); printm(M_BARE, "Sector Size : %i\n", h->StSECTOR_SIZE); @@ -130,8 +131,8 @@ void process_one_sector(FILE * f) { int locked = 0; SoundSector * buffer = (SoundSector *) sector; -/* printm(M_BARE, "Audio sector\n"); - printm(M_BARE, "Frequency: %i\n", xahalfhz(buffer) ? 18900 : 37800); + printm(M_BARE, "Audio sector\n"); +/* printm(M_BARE, "Frequency: %i\n", xahalfhz(buffer) ? 18900 : 37800); printm(M_BARE, "Channels : %s\n", xastereo(buffer) ? "stereo" : "mono"); */ // fwrite(sector + 8, 1, 2324, stdout); @@ -177,7 +178,7 @@ void process_one_sector(FILE * f) { saveXaDecode(xachannel(buffer)); } else { -// printm(M_BARE, "Unknow sector\n"); + printm(M_BARE, "Unknow sector\n"); } // printm(M_BARE, "---------------------------------\n\n"); } -- cgit v1.2.3