summaryrefslogtreecommitdiff
path: root/Xenogears
diff options
context:
space:
mode:
authorPixel <Pixel>2002-05-23 14:07:46 +0000
committerPixel <Pixel>2002-05-23 14:07:46 +0000
commitbdbd7e1296b98081794e0b185a0b8b677c811359 (patch)
tree18b17064b2b5026d3272ac573b6728fed418c476 /Xenogears
parent983358288de02d3bbf09a007f67d6f7d01bc2eff (diff)
Again FILE * removing... this is boring!
Diffstat (limited to 'Xenogears')
-rwxr-xr-xXenogears/Makefile5
-rw-r--r--Xenogears/reinsert.cpp21
2 files changed, 15 insertions, 11 deletions
diff --git a/Xenogears/Makefile b/Xenogears/Makefile
index 22d6392..14c48ff 100755
--- a/Xenogears/Makefile
+++ b/Xenogears/Makefile
@@ -3,7 +3,7 @@
CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686
CXX=g++
-TARGET = lz77 dlz77 yazedc cd-tool
+TARGET = lz77 dlz77 yazedc cd-tool reinsert
all: ${TARGET}
@@ -19,5 +19,8 @@ yazedc: yazedc.cpp crctables crctable.out
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
+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
+
clean:
rm -f *.o ${TARGET} compil.c
diff --git a/Xenogears/reinsert.cpp b/Xenogears/reinsert.cpp
index e58b871..d6e0a4c 100644
--- a/Xenogears/reinsert.cpp
+++ b/Xenogears/reinsert.cpp
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include "fileutils.h"
#include "cdutils.h"
#include "generic.h"
@@ -22,7 +23,7 @@ struct t_sequence {
int type;
};
-char *title, *iso_filename, *tbl_filename, *prefix, *in_filename;
+char *title, *iso_filename, *prefix, *in_filename;
unsigned long iso_size;
unsigned int nb_records, nb_seqs = 0;
struct t_sequence sequences[1000];
@@ -31,7 +32,7 @@ int slus_index = -1, force = 0;
long check_iso(int f_iso);
void write_files(int f_iso_r, int f_iso_w, int f_in, int fileindex);
-int process_def_file(int f_def);
+int process_def_file(int f_def);
unsigned char user_data[2352];
@@ -87,10 +88,16 @@ int main(int argc, char **argv)
printm(M_ERROR, "Unable to open the iso file \"%s\"...\n", iso_filename);
exit(-1);
}
+
+ if (lseek(f_iso_w, 0, SEEK_SET)) {
+ printm(M_ERROR, "Can't rewind the file\n");
+ exit(-1);
+ }
if (check_iso(f_iso_r)) {
printm(M_ERROR, "Invalid iso file for %s\n", title);
printm(M_ERROR, "===> Make sure you are using a Genuine iso file.\n");
+ exit(-1);
} else {
printm(M_INFO, "Genuine %s iso detected.\n", title);
}
@@ -112,11 +119,11 @@ int main(int argc, char **argv)
/*
* Ugly but working... for now
*/
-int process_def_file(int h_f_def)
+int process_def_file(int ff_def)
{
char t[1024], *p;
+ FILE * f_def = fdopen(ff_def, "r");
unsigned int n, sum = 0;
- FILE * f_def = fdopen(h_f_def, "r");
if ((p = strchr(fgets(t, 1024, f_def), '\n')) == NULL)
return 1;
@@ -131,12 +138,6 @@ int process_def_file(int h_f_def)
if ((p = strchr(fgets(t, 1024, f_def), '\n')) == NULL)
return 1;
*p = 0;
- printm(M_INFO, "Read index table filename: %s\n", t);
- tbl_filename = strdup(t);
-
- if ((p = strchr(fgets(t, 1024, f_def), '\n')) == NULL)
- return 1;
- *p = 0;
printm(M_INFO, "Read global directory prefix: %s\n", t);
prefix = strdup(t);