diff options
Diffstat (limited to 'Xenogears')
-rw-r--r-- | Xenogears/script-comp.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/Xenogears/script-comp.cpp b/Xenogears/script-comp.cpp index 9f8520c..ca6fb09 100644 --- a/Xenogears/script-comp.cpp +++ b/Xenogears/script-comp.cpp @@ -12,12 +12,10 @@ private: lzss * lzss_o; -void process_one_file(Handle * f, Handle * d, int n) { +void process_one_file(Handle * f, Handle * d, Handle * f_part, int n) { String nom_du_fichier; char zeros[4] = {0, 0, 0, 0}, * datas; long script_position, true_length, delta, data_length; - Handle * f_part; - char tmpNm[256]; printm(M_BARE, " Copying header\n"); f->seek(0x14c); @@ -35,15 +33,11 @@ void process_one_file(Handle * f, Handle * d, int n) { f->read(datas, data_length); printm(M_BARE, " Processing script\n");
- char tmpNm[256];
- sprintf(tmpNm,"xeno_d1/ROOMS/%04d/script.comp",n); - nom_du_fichier = String(tmpNm); - f_part = new Input(nom_du_fichier); true_length = f_part->GetSize(); - script_position = d->tell();
- d->seek(0x14c); + script_position = d->tell();
+ d->seek(0x14c); d->write(&script_position, 4); d->seek(0x128); d->write(&true_length, 4); @@ -51,8 +45,6 @@ void process_one_file(Handle * f, Handle * d, int n) { lzss_o->lzss_comp(f_part, d, &delta); - delete f_part; - script_position = d->tell(); if ((true_length = (script_position & 3))) { d->write(zeros, 4 - true_length); @@ -63,7 +55,7 @@ void process_one_file(Handle * f, Handle * d, int n) { d->seek(0x150); d->write(&script_position, 4);
- d->seek(0,SEEK_END); + d->seek(0,SEEK_END); d->write(datas, data_length); free(datas); @@ -71,7 +63,7 @@ void process_one_file(Handle * f, Handle * d, int n) { virtual int startup() throw (GeneralException) { - Handle * f_script_comp, * f_new_script; + Handle * f_script_comp, * f_old_script, * f_new_script; int i; int num = 0; String nom_du_fichier; @@ -79,32 +71,37 @@ virtual int startup() throw (GeneralException) for (i = 384; i < 1844; i = i + 2) {
printm(M_BARE, "CD1 - File %d -> Script %d\n", i, num); nom_du_fichier.set("xeno_d1/ROOMS/%04d.out", i); - f_script_comp = new Input(nom_du_fichier); + f_old_script = new Input(nom_du_fichier); nom_du_fichier.set("xeno_d1/ROOMS/%04d.out-new", i); f_new_script = new Output(nom_du_fichier); + nom_du_fichier.set("xeno_d1/ROOMS/%04d/script.comp", num); + f_script_comp = new Input(nom_du_fichier); - process_one_file(f_script_comp, f_new_script, num); + process_one_file(f_old_script, f_new_script, f_script_comp, num); delete f_script_comp; delete f_new_script; + delete f_old_script; num++; } num = 0; - /* for (i = 379; i < 1838; i = i + 2) { printm(M_BARE, "CD2 - File %d -> Script %d\n", i, num); nom_du_fichier.set("xeno_d2/ROOMS/%04d.out", i); - f_script_comp = new Input(nom_du_fichier); + f_old_script = new Input(nom_du_fichier); nom_du_fichier.set("xeno_d2/ROOMS/%04d.out-new", i); f_new_script = new Output(nom_du_fichier); + nom_du_fichier.set("xeno_d2/ROOMS/%04d/script.comp", num); + f_script_comp = new Input(nom_du_fichier); - process_one_file(f_script_comp, f_new_script, num); + process_one_file(f_old_script, f_new_script, f_script_comp, num); delete f_script_comp; delete f_new_script; + delete f_old_script; num++; - }*/ + } printm(M_BARE, "Done !\n"); return 0; |