summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile16
-rwxr-xr-xVP/Makefile24
-rwxr-xr-xXenogears/Makefile36
-rw-r--r--Xenogears/script-dec.cpp26
-rw-r--r--generic.h6
-rw-r--r--str-util.cpp1
6 files changed, 43 insertions, 66 deletions
diff --git a/Makefile b/Makefile
index a8c788e..92c0745 100755
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror
CXX=g++
-SUBDIRS = psxdev
+SUBDIRS = psxdev Xenogears VP
TARGET = lzss dlzss cd-tool str-tool
all: subdirs ${TARGET}
@@ -11,25 +11,25 @@ all: subdirs ${TARGET}
subdirs:
for d in ${SUBDIRS} ; do make -C $$d ; done
-lzss: lzss.o lzss.h generic.o generic.h fileutils.h fileutils.o lzss-main.o
+lzss: lzss.o lzss.h generic.o generic.h fileutils.h fileutils.o lzss-main.o Makefile
${CXX} ${LDFLAGS} -DLZSS_MAIN lzss.o generic.o fileutils.o lzss-main.o -o lzss
-dlzss: lzss
+dlzss: lzss Makefile
ln -fs lzss dlzss
-yazedc: yazedc.o crctables crctable.out yazedc-main.o
+yazedc: yazedc.o crctables crctable.out yazedc-main.o Makefile
${CXX} ${LDFLAGS} yazedc.o yazedc-main.o -DMAIN -o yazedc
-cd-tool: cd-tool.o cdutils.o cdutils.h fileutils.o fileutils.h generic.o generic.h yazedc.o yazedc.h
+cd-tool: cd-tool.o cdutils.o cdutils.h fileutils.o fileutils.h generic.o generic.h yazedc.o yazedc.h Makefile
${CXX} ${LDFLAGAS} cd-tool.o cdutils.o fileutils.o yazedc.o generic.o -o cd-tool
-dte-tool: dteutils.o generic.h generic.o fileutils.o fileutils.h dtemain.o
+dte-tool: dteutils.o generic.h generic.o fileutils.o fileutils.h dtemain.o Makefile
${CXX} ${LDFLAGS} dteutils.o generic.o fileutils.o dtemain.o -o dte-tool
-str-tool: str-util.o generic.h generic.o fileutils.o fileutils.h cdutils.o cdutils.h yazedc.o yazedc.h
+str-tool: str-util.o generic.h generic.o fileutils.o fileutils.h cdutils.o cdutils.h yazedc.o yazedc.h Makefile
${CXX} ${LDFLAGS} str-util.o generic.o fileutils.o cdutils.o yazedc.o psxdev/bs.o psxdev/idctfst.o psxdev/jfdctint.o psxdev/vlc.o -o str-tool -lSDL
clean:
rm -f *.o ${TARGET} compil.c
- for d in ${SUBDIRS} ; do (cd $$d ; make clean) ; done
+ for d in ${SUBDIRS} ; do make -C $$d clean ; done
diff --git a/VP/Makefile b/VP/Makefile
index 2a6deba..890516b 100755
--- a/VP/Makefile
+++ b/VP/Makefile
@@ -1,31 +1,19 @@
#!/usr/bin/make -f
-CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror
+CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I..
CXX=g++
-TARGET = lzss dlzss yazedc cd-tool main_dump VP-CD1.sqr
+TARGET = main_dump VP-CD1.sqr
all: ${TARGET}
-main_dump: main_dump.cpp yazedc.cpp yazedc.h fileutils.cpp fileutils.h cdutils.cpp cdutils.h generic.cpp generic.h crctables crctable.out
- ${CXX} ${CPPFLAGS} ${LDFLAGS} main_dump.cpp yazedc.cpp fileutils.cpp cdutils.cpp generic.cpp -o main_dump
-
-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
-
-dlzss: lzss
- ln -fs lzss dlzss
-
-yazedc: yazedc.cpp crctables crctable.out
- ${CXX} ${CPPFLAGS} ${LDFLAGS} yazedc.cpp -DMAIN -o yazedc
-
-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
+main_dump: main_dump.o ../fileutils.o ../fileutils.h ../cdutils.o ../cdutils.h ../generic.o ../generic.h Makefile
+ ${CXX} ${LDFLAGS} main_dump.o ../yazedc.o ../fileutils.o ../cdutils.o ../generic.o -o main_dump
clean:
- rm -f *.o ${TARGET} compil.c
+ rm -f *.o ${TARGET}
-VP-CD1.sqr: VP-CD1.map
+VP-CD1.sqr: VP-CD1.map Makefile
./map2sqr < $< > $@
.map.sqr:
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");
diff --git a/generic.h b/generic.h
index ee9bb0e..b8ab95b 100644
--- a/generic.h
+++ b/generic.h
@@ -32,11 +32,11 @@
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)<(b)?(b):(a)
-/*
-#ifndef Uint32
+
+#ifndef SDL_VERSIONNUM
typedef unsigned long int Uint32;
#endif
-*/
+
#ifndef int32
typedef signed long int int32;
#endif
diff --git a/str-util.cpp b/str-util.cpp
index 67f20b1..33c7a6a 100644
--- a/str-util.cpp
+++ b/str-util.cpp
@@ -6,6 +6,7 @@
#include "fileutils.h"
#include "generic.h"
#include "cdutils.h"
+#include "psxdev/xadecode.h"
/*