From cbee971a2e8929924f63535d174637106620eae3 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 21 Jul 2002 11:52:56 +0000 Subject: Prlorf --- Makefile | 28 +++++++++---------- MegamanX5/Makefile | 4 +-- VP/Makefile | 16 +++++------ Xenogears/Makefile | 20 +++++++------- generic/Buffer.cpp | 2 +- generic/Exceptions.cpp | 2 +- generic/fileutils.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ generic/generic.cpp | 56 ++++++++++++++++++++++++++++++++++++++ includes/generic.h | 8 ++++++ lib/Makefile | 7 ++++- lib/fileutils.cpp | 74 -------------------------------------------------- lib/generic.cpp | 56 -------------------------------------- psxdev/Makefile | 7 ++++- 13 files changed, 186 insertions(+), 168 deletions(-) create mode 100644 generic/fileutils.cpp create mode 100644 generic/generic.cpp delete mode 100644 lib/fileutils.cpp delete mode 100644 lib/generic.cpp diff --git a/Makefile b/Makefile index b68b79b..04aaecb 100755 --- a/Makefile +++ b/Makefile @@ -12,29 +12,29 @@ all: subdirs ${TARGET} subdirs: for d in ${SUBDIRS} ; do make -C $$d || exit -1 ; done -lzss: lib/lzss.o includes/lzss.h lib/generic.o includes/generic.h includes/fileutils.h lib/fileutils.o lzss-main.o Makefile - ${CXX} ${LDFLAGS} -DLZSS_MAIN lib/lzss.o lib/generic.o lib/fileutils.o lzss-main.o -o lzss +lzss: includes/lzss.h includes/generic.h includes/fileutils.h lzss-main.o generic/generic.a lib/lib.a Makefile + ${CXX} ${LDFLAGS} -DLZSS_MAIN lzss-main.o lib/lib.a generic/generic.a -o lzss dlzss: lzss Makefile ln -fs lzss dlzss -yazedc: lib/yazedc.o lib/crctables lib/crctable.out yazedc-main.o Makefile - ${CXX} ${LDFLAGS} lib/yazedc.o yazedc-main.o -DMAIN -o yazedc +yazedc: yazedc-main.o lib/lib.a Makefile + ${CXX} ${LDFLAGS} yazedc-main.o lib/lib.a -DMAIN -o yazedc -cd-tool: cd-tool.o lib/cdutils.o includes/cdutils.h lib/fileutils.o includes/fileutils.h lib/generic.o includes/generic.h lib/yazedc.o includes/yazedc.h Makefile - ${CXX} ${LDFLAGAS} cd-tool.o lib/cdutils.o lib/fileutils.o lib/yazedc.o lib/generic.o -o cd-tool +cd-tool: includes/cdutils.h includes/fileutils.h includes/generic.h includes/yazedc.h cd-tool.o Makefile + ${CXX} ${LDFLAGAS} cd-tool.o lib/lib.a generic/generic.a -o cd-tool -dte-tool: lib/dteutils.o includes/generic.h lib/generic.o lib/fileutils.o includes/fileutils.h includes/dte.h dtemain.o Makefile - ${CXX} ${LDFLAGS} lib/dteutils.o lib/generic.o lib/fileutils.o dtemain.o -o dte-tool +dte-tool: includes/generic.h includes/fileutils.h includes/dte.h dtemain.o lib/lib.a generic/generic.a Makefile + ${CXX} ${LDFLAGS} dtemain.o lib/lib.a generic/generic.a -o dte-tool -str-player: str-player.o includes/generic.h lib/generic.o lib/fileutils.o includes/fileutils.h lib/cdutils.o includes/cdutils.h lib/yazedc.o includes/yazedc.h Makefile - ${CXX} ${LDFLAGS} str-player.o lib/generic.o lib/fileutils.o lib/cdutils.o lib/yazedc.o psxdev/bs.o psxdev/idctfst.o psxdev/jfdctint.o psxdev/vlc.o psxdev/xadecode.o -o str-player +str-player: str-player.o includes/generic.h includes/fileutils.h includes/cdutils.h includes/yazedc.h lib/lib.a generic/generic.a psxdev/psxdev.a Makefile + ${CXX} ${LDFLAGS} str-player.o psxdev/psxdev.a lib/lib.a generic/generic.a -o str-player -crypto-search: crypto-search.o includes/generic.h lib/generic.o lib/fileutils.o includes/fileutils.h Makefile - ${CXX} ${LDFLAGS} crypto-search.o lib/generic.o lib/fileutils.o -o crypto-search +crypto-search: crypto-search.o includes/generic.h includes/fileutils.h lib/lib.a generic/generic.a Makefile + ${CXX} ${LDFLAGS} crypto-search.o lib/lib.a generic/generic.a -o crypto-search -bgrep: bgrep.o includes/generic.h lib/generic.o includes/fileutils.h lib/fileutils.o Makefile - ${CXX} ${LDFLAGS} bgrep.o lib/generic.o lib/fileutils.o -o bgrep +bgrep: bgrep.o includes/generic.h includes/fileutils.h generic/generic.a Makefile + ${CXX} ${LDFLAGS} bgrep.o generic/generic.a -o bgrep clean: for d in ${SUBDIRS} ; do make -C $$d clean || exit -1 ; done diff --git a/MegamanX5/Makefile b/MegamanX5/Makefile index c655df9..74bec9e 100755 --- a/MegamanX5/Makefile +++ b/MegamanX5/Makefile @@ -7,8 +7,8 @@ TARGET = unarc all: ${TARGET} -unarc: unarc.o ../includes/fileutils.h ../lib/fileutils.cpp ../includes/generic.h ../lib/generic.cpp Makefile - ${CXX} ${LDFLAGS} unarc.o ../lib/fileutils.o ../lib/generic.o -o unarc +unarc: unarc.o ../includes/fileutils.h ../includes/generic.h Makefile + ${CXX} ${LDFLAGS} unarc.o ../generic/generic.a -o unarc clean: rm -f *.o ${TARGET} compil.c diff --git a/VP/Makefile b/VP/Makefile index 9cc267d..243d11b 100755 --- a/VP/Makefile +++ b/VP/Makefile @@ -7,17 +7,17 @@ TARGET = main_dump VP-CD1.sqr decomp-slz unarc search-script all: ${TARGET} -main_dump: main_dump.o ../lib/fileutils.o ../includes/fileutils.h ../lib/cdutils.o ../includes/cdutils.h ../lib/generic.o ../includes/generic.h Makefile - ${CXX} ${LDFLAGS} main_dump.o ../lib/yazedc.o ../lib/fileutils.o ../lib/cdutils.o ../lib/generic.o -o main_dump +main_dump: main_dump.o ../includes/fileutils.h ../includes/cdutils.h ../includes/generic.h ../lib/lib.a ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} main_dump.o ../lib/lib.a ../generic/generic.a -o main_dump -decomp-slz: decomp-slz.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h ../lib/lzss.o ../includes/lzss.h Makefile - ${CXX} ${LDFLAGS} decomp-slz.o ../lib/fileutils.o ../lib/generic.o ../lib/lzss.o -o decomp-slz +decomp-slz: decomp-slz.o ../includes/fileutils.h ../includes/generic.h ../includes/lzss.h Makefile + ${CXX} ${LDFLAGS} decomp-slz.o ../lib/lib.a ../generic/generic.a -o decomp-slz -unarc: unarc.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h Makefile - ${CXX} ${LDFLAGS} unarc.o ../lib/fileutils.o ../lib/generic.o -o unarc +unarc: unarc.o ../includes/fileutils.h ../includes/generic.h Makefile + ${CXX} ${LDFLAGS} unarc.o ../generic/generic.a -o unarc -search-script: search-script.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h Makefile - ${CXX} ${LDFLAGS} search-script.o ../lib/fileutils.o ../lib/generic.o -o search-script +search-script: search-script.o ../includes/fileutils.h ../includes/generic.h Makefile + ${CXX} ${LDFLAGS} search-script.o ../generic/generic.a -o search-script clean: rm -f *.o ${TARGET} diff --git a/Xenogears/Makefile b/Xenogears/Makefile index 339b9a2..65a1121 100755 --- a/Xenogears/Makefile +++ b/Xenogears/Makefile @@ -7,20 +7,20 @@ TARGET = reinsert main_dump Decrypt script-comp script-dec XenoCD1.sqr XenoCD2.s all: ${TARGET} -main_dump: main_dump.o ../lib/cdutils.o ../includes/cdutils.h ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h ../lib/yazedc.o ../includes/yazedc.h Makefile - ${CXX} ${LDFLAGS} main_dump.o ../lib/cdutils.o ../lib/fileutils.o ../lib/yazedc.o ../lib/generic.o -o main_dump +main_dump: main_dump.o ../includes/cdutils.h ../includes/fileutils.h ../includes/generic.h ../includes/yazedc.h ../lib/lib.a ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} main_dump.o ../lib/lib.a ../generic/generic.a -o main_dump -reinsert: reinsert.o ../lib/cdutils.o ../includes/cdutils.h ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h ../lib/yazedc.o ../includes/yazedc.h Makefile - ${CXX} ${LDFLAGS} reinsert.o ../lib/cdutils.o ../lib/fileutils.o ../lib/yazedc.o ../lib/generic.o -o reinsert +reinsert: reinsert.o ../includes/cdutils.h ../includes/fileutils.h ../includes/generic.h ../includes/yazedc.h ../lib/lib.a ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} reinsert.o ../lib/lib.a ../generic/generic.a -o reinsert -Decrypt: Decrypt.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h Makefile - ${CXX} ${LDFLAGS} Decrypt.o ../lib/fileutils.o ../lib/generic.o -o Decrypt +Decrypt: Decrypt.o ../includes/fileutils.h ../includes/generic.h ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} Decrypt.o ../generic/generic.a -o Decrypt -script-comp: script-comp.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h ../lib/lzss.o ../includes/lzss.h Makefile - ${CXX} ${LDFLAGS} script-comp.o ../lib/fileutils.o ../lib/generic.o ../lib/lzss.o -o script-comp +script-comp: script-comp.o ../includes/fileutils.h ../includes/generic.h ../includes/lzss.h ../lib/lib.a ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} script-comp.o ../lib/lib.a ../generic/generic.a -o script-comp -script-dec: script-dec.o ../lib/fileutils.o ../includes/fileutils.h ../lib/generic.o ../includes/generic.h ../lib/lzss.o ../includes/lzss.h Makefile - ${CXX} ${LDFLAGS} script-dec.o ../lib/fileutils.o ../lib/generic.o ../lib/lzss.o -o script-dec +script-dec: script-dec.o ../includes/fileutils.h ../includes/generic.h ../includes/lzss.h ../lib/lib.a ../generic/generic.a Makefile + ${CXX} ${LDFLAGS} script-dec.o ../lib/lib.a ../generic/generic.a -o script-dec clean: rm -f *.o ${TARGET} compil.c diff --git a/generic/Buffer.cpp b/generic/Buffer.cpp index edd70bc..940b0a8 100644 --- a/generic/Buffer.cpp +++ b/generic/Buffer.cpp @@ -1,6 +1,6 @@ #include #include "Buffer.h" -#include "General.h" +#include "generic.h" #ifdef HAVE_CONFIG_H #include "config.h" #else diff --git a/generic/Exceptions.cpp b/generic/Exceptions.cpp index b541235..564362e 100644 --- a/generic/Exceptions.cpp +++ b/generic/Exceptions.cpp @@ -5,7 +5,7 @@ #include #include "String.h" #include "Exceptions.h" -#include "General.h" +#include "generic.h" #ifdef HAVE_CONFIG_H #include "config.h" #else diff --git a/generic/fileutils.cpp b/generic/fileutils.cpp new file mode 100644 index 0000000..b04a414 --- /dev/null +++ b/generic/fileutils.cpp @@ -0,0 +1,74 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include "generic.h" + +unsigned long filesize(int f_iso) +{ + long curpos, length; + + curpos = lseek(f_iso, 0, SEEK_CUR); + length = lseek(f_iso, 0, SEEK_END); + lseek(f_iso, curpos, SEEK_SET); + return length; +} + +void copy(int s, int d, long size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = read(s, &c, 1); + if (r == 0) { + break; + } + write(d, &c, 1); + } +} + +unsigned long filesize(FILE * f_iso) +{ + long curpos, length; + + curpos = ftell(f_iso); + fseek(f_iso, 0, SEEK_END); + length = ftell(f_iso); + fseek(f_iso, curpos, SEEK_SET); + return length; +} + +void copy(FILE * s, FILE * d, long size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = fread(&c, 1, 1, s); + if (r == 0) { + break; + } + fwrite(&c, 1, 1, d); + } +} diff --git a/generic/generic.cpp b/generic/generic.cpp new file mode 100644 index 0000000..d165d27 --- /dev/null +++ b/generic/generic.cpp @@ -0,0 +1,56 @@ +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +char verbosity = 0; + +char * heads[] = {"EE", "--", "WW", "II"}; + +void printm(int level, char * m, ...) { + va_list ap; + + if (verbosity < level) { + return; + } + + if (level >= 0) { + fprintf(stderr, "(%s) ", heads[level]); + } + + va_start(ap, m); + vfprintf(stderr, m, ap); + va_end(ap); +} + +char ** split(char * s, char t) { + static char * p[100]; + int i; + + for (i = 1, p[0] = s; *s; s++) { + if (*s == t) { + *s = 0; + p[i++] = s + 1; + } + } + p[i] = 0; + + return p; +} diff --git a/includes/generic.h b/includes/generic.h index 04c91fa..5abb92b 100644 --- a/includes/generic.h +++ b/includes/generic.h @@ -77,4 +77,12 @@ extern char verbosity; void printm(int level, char * fmt, ...); char ** split(char * s, char t); +#ifndef MAX +#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) +#endif + +#ifndef MIN +#define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) +#endif + #endif diff --git a/lib/Makefile b/lib/Makefile index 5503701..9fbb4b3 100755 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,9 +3,14 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I../includes CXX=g++ -TARGET = cdutils.o dteutils.o fileutils.o generic.o lzss.o yazedc.o +OBJECTS = cdutils.o dteutils.o lzss.o yazedc.o +TARGET = lib.a all: ${TARGET} +lib.a: ${OBJECTS} + ar -r lib.a ${OBJECTS} + ranlib lib.a + clean: rm -f *.o ${TARGET} compil.c diff --git a/lib/fileutils.cpp b/lib/fileutils.cpp deleted file mode 100644 index b04a414..0000000 --- a/lib/fileutils.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include "generic.h" - -unsigned long filesize(int f_iso) -{ - long curpos, length; - - curpos = lseek(f_iso, 0, SEEK_CUR); - length = lseek(f_iso, 0, SEEK_END); - lseek(f_iso, curpos, SEEK_SET); - return length; -} - -void copy(int s, int d, long size) { - long i; - unsigned char c; - long r; - - for (i = 0; (i < size) || (size < 0); i++) { - r = read(s, &c, 1); - if (r == 0) { - break; - } - write(d, &c, 1); - } -} - -unsigned long filesize(FILE * f_iso) -{ - long curpos, length; - - curpos = ftell(f_iso); - fseek(f_iso, 0, SEEK_END); - length = ftell(f_iso); - fseek(f_iso, curpos, SEEK_SET); - return length; -} - -void copy(FILE * s, FILE * d, long size) { - long i; - unsigned char c; - long r; - - for (i = 0; (i < size) || (size < 0); i++) { - r = fread(&c, 1, 1, s); - if (r == 0) { - break; - } - fwrite(&c, 1, 1, d); - } -} diff --git a/lib/generic.cpp b/lib/generic.cpp deleted file mode 100644 index d165d27..0000000 --- a/lib/generic.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -char verbosity = 0; - -char * heads[] = {"EE", "--", "WW", "II"}; - -void printm(int level, char * m, ...) { - va_list ap; - - if (verbosity < level) { - return; - } - - if (level >= 0) { - fprintf(stderr, "(%s) ", heads[level]); - } - - va_start(ap, m); - vfprintf(stderr, m, ap); - va_end(ap); -} - -char ** split(char * s, char t) { - static char * p[100]; - int i; - - for (i = 1, p[0] = s; *s; s++) { - if (*s == t) { - *s = 0; - p[i++] = s + 1; - } - } - p[i] = 0; - - return p; -} diff --git a/psxdev/Makefile b/psxdev/Makefile index 0ddfc4f..bca0c5a 100644 --- a/psxdev/Makefile +++ b/psxdev/Makefile @@ -1,6 +1,7 @@ #!/usr/bin/make -f -TARGETS=xadecode.o bs.o idctfst.o jfdctint.o vlc.o +OBJECTS = xadecode.o bs.o idctfst.o jfdctint.o vlc.o +TARGETS = psxdev.a CC=gcc CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -I../includes @@ -9,6 +10,10 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -I../includes all: ${TARGETS} +psxdev.a: ${OBJECTS} + ar -r psxdev.a ${OBJECTS} + ranlib psxdev.a + bstoppm: xadecode.o bs.o idctfst.o jfdtint.o vlc.o bstoppm.o ${CC} ${LDFLAGS} xadecode.o bs.o idcfst.o jfdtint.o vlc.o bstoppm.o -o bstoppm -- cgit v1.2.3