summaryrefslogtreecommitdiff
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
parentd0f485b19a53ce3c7032066096305dbecba536fe (diff)
Whoups...
-rwxr-xr-xMegamanX5/Makefile15
-rw-r--r--MegamanX5/unarc.cpp40
-rw-r--r--str-util.cpp11
3 files changed, 61 insertions, 5 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);
+}
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");
}