diff options
Diffstat (limited to 'Xenogears')
-rwxr-xr-x | Xenogears/Makefile | 36 | ||||
-rw-r--r-- | Xenogears/script-dec.cpp | 26 |
2 files changed, 25 insertions, 37 deletions
diff --git a/Xenogears/Makefile b/Xenogears/Makefile index e1768ae..3df895f 100755 --- a/Xenogears/Makefile +++ b/Xenogears/Makefile @@ -1,38 +1,26 @@ #!/usr/bin/make -f -CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 +CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 -I.. -pedantic -pedantic-errors -Werror CXX=g++ -TARGET = lzss dlzss yazedc cd-tool reinsert main_dump Decrypt script-comp script-dec enoCD1.sqr XenoCD2.sqr +TARGET = reinsert main_dump Decrypt script-comp script-dec XenoCD1.sqr XenoCD2.sqr all: ${TARGET} -lzss: lzss.cpp lzss.h generic.cpp generic.h fileutils.h fileutils.cpp - ${CXX} ${CPPFLAGS} ${LDFLAGS} -DLZSS_MAIN lzss.cpp generic.cpp fileutils.cpp -o lzss +main_dump: main_dump.o ../cdutils.o ../cdutils.h ../fileutils.o ../fileutils.h ../generic.o ../generic.h ../yazedc.o ../yazedc.h Makefile + ${CXX} ${LDFLAGS} main_dump.o ../cdutils.o ../fileutils.o ../yazedc.o ../generic.o -o main_dump -dlzss: lzss - ln -fs lzss dlzss +reinsert: reinsert.o ../cdutils.o ../cdutils.h ../fileutils.o ../fileutils.h ../generic.o ../generic.h ../yazedc.o ../yazedc.h Makefile + ${CXX} ${LDFLAGS} reinsert.o ../cdutils.o ../fileutils.o ../yazedc.o ../generic.o -o reinsert -yazedc: yazedc.cpp crctables crctable.out - ${CXX} ${CPPFLAGS} ${LDFLAGS} yazedc.cpp -DMAIN -o yazedc +Decrypt: Decrypt.o ../fileutils.o ../fileutils.h ../generic.o ../generic.h Makefile + ${CXX} ${LDFLAGS} Decrypt.o ../fileutils.o ../generic.o -o Decrypt -cd-tool: cd-tool.cpp cdutils.cpp cdutils.h fileutils.cpp fileutils.h generic.cpp generic.h yazedc.cpp yazedc.h - ${CXX} ${CPPFLAGS} ${LDFLAGAS} cd-tool.cpp cdutils.cpp fileutils.cpp yazedc.cpp generic.cpp -o cd-tool +script-comp: script-comp.o ../fileutils.o ../fileutils.h ../generic.o ../generic.h ../lzss.o ../lzss.h Makefile + ${CXX} ${LDFLAGS} script-comp.o ../fileutils.o ../generic.o ../lzss.o -o script-comp -main_dump: main_dump.cpp cdutils.cpp cdutils.h fileutils.cpp fileutils.h generic.cpp generic.h yazedc.cpp yazedc.h - ${CXX} ${CPPFLAGS} ${LDFLAGS} main_dump.cpp cdutils.cpp fileutils.cpp yazedc.cpp generic.cpp -o main_dump - -reinsert: reinsert.cpp cdutils.cpp cdutils.h fileutils.cpp fileutils.h generic.cpp generic.h yazedc.cpp yazedc.h - ${CXX} ${CPPFLAGS} ${LDFLAGS} reinsert.cpp cdutils.cpp fileutils.cpp yazedc.cpp generic.cpp -o reinsert - -Decrypt: Decrypt.cpp fileutils.cpp fileutils.h generic.cpp generic.h - ${CXX} ${CPPFLAGS} ${LDFLAGS} Decrypt.cpp fileutils.cpp generic.cpp -o Decrypt - -script-comp: script-comp.cpp fileutils.cpp fileutils.h generic.cpp generic.h lzss.cpp lzss.h - ${CXX} ${CPPFLAGS} ${LDFLAGS} script-comp.cpp fileutils.cpp generic.cpp lzss.cpp -o script-comp - -script-dec: script-dec.cpp fileutils.cpp fileutils.h generic.cpp generic.h lzss.cpp lzss.h - ${CXX} ${CPPFLAGS} ${LDFLAGS} script-dec.cpp fileutils.cpp generic.cpp lzss.cpp -o script-dec +script-dec: script-dec.o ../fileutils.o ../fileutils.h ../generic.o ../generic.h ../lzss.o ../lzss.h Makefile + ${CXX} ${LDFLAGS} script-dec.o ../fileutils.o ../generic.o ../lzss.o -o script-dec clean: rm -f *.o ${TARGET} compil.c diff --git a/Xenogears/script-dec.cpp b/Xenogears/script-dec.cpp index ff7b356..2a1b0f3 100644 --- a/Xenogears/script-dec.cpp +++ b/Xenogears/script-dec.cpp @@ -20,25 +20,25 @@ void process_one_file(FILE * f, int d, int n) { // fprintf(stderr, " Processing part %i\n", i); sprintf(nom_du_fichier, "xeno_d%d/ROOMS/%04i/script.comp", d, n); // sprintf(nom_du_fichier, "xeno_d%d/ROOMS/%04i/part-%i", d, n, i); - f_out = open(nom_du_fichier, O_WRONLY | O_TRUNC | O_CREAT, 00644); - lseek(f, 0x130 + i * 4, SEEK_SET); - read(f, &script_position, 4); - lseek(f, 0x10c + i * 4, SEEK_SET); - read(f, &true_length, 4); - lseek(f, script_position, SEEK_SET); - lz77_decomp(f, f_out, true_length); + f_out = fopen(nom_du_fichier, "w"); + fseek(f, 0x130 + i * 4, SEEK_SET); + fread(&script_position, 1, 4, f); + fseek(f, 0x10c + i * 4, SEEK_SET); + fread(&true_length, 1, 4, f); + fseek(f, script_position, SEEK_SET); + lzss_decomp(f, f_out, true_length); // if (i == 7) { // fseek(f_out, 0, SEEK_SET); // fread(&true_length, 4, 1, f_out); // fprintf(stderr, " (seems to be the script number %i)\n", true_length); // } - close(f_out); + fclose(f_out); // } } int main(void) { - int f_script_comp; + FILE * f_script_comp; int i; int num = 0; char nom_du_fichier[100]; @@ -46,11 +46,11 @@ int main(void) for (i = 384; i < 1844; i = i + 2) { fprintf(stderr, "CD 1 - File %d -> Script %d\n", i, num); sprintf(nom_du_fichier, "xeno_d1/ROOMS/%04d.out", i); - f_script_comp = open(nom_du_fichier, O_RDONLY); + f_script_comp = fopen(nom_du_fichier, "r"); process_one_file(f_script_comp, 1, num); - close(f_script_comp); + fclose(f_script_comp); num++; } @@ -59,11 +59,11 @@ int main(void) for (i = 379; i < 1838; i = i + 2) { fprintf(stderr, "CD 2 - File %d -> Script %d\n", i, num); sprintf(nom_du_fichier, "xeno_d2/ROOMS/%04d.out", i); - f_script_comp = open(nom_du_fichier, O_RDONLY); + f_script_comp = fopen(nom_du_fichier, "r"); process_one_file(f_script_comp, 2, num); - close(f_script_comp); + fclose(f_script_comp); num++; } fprintf(stderr, "Done !\n"); |