diff options
author | Pixel <Pixel> | 2002-06-23 12:49:24 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-06-23 12:49:24 +0000 |
commit | 7514019f385767caf7e68ae281d3a4befb7b4e8f (patch) | |
tree | 665e8ccd111ebdadd98a9bebb1813d639d65bfe1 /Xenogears/script-dec.cpp | |
parent | 54c77d2cb0f734615febdb3cb33548bf4cd6e953 (diff) |
Makefile arrangement...
Diffstat (limited to 'Xenogears/script-dec.cpp')
-rw-r--r-- | Xenogears/script-dec.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
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"); |