diff options
Diffstat (limited to 'Xenogears/script-dec.cpp')
-rw-r--r-- | Xenogears/script-dec.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/Xenogears/script-dec.cpp b/Xenogears/script-dec.cpp index 55edb31..0285013 100644 --- a/Xenogears/script-dec.cpp +++ b/Xenogears/script-dec.cpp @@ -1,82 +1,82 @@ -#include <stdio.h> -#include <stdlib.h> -#include "lzss.h" -#include "BString.h" -#include "Input.h" -#include "Output.h" -#include "Main.h" - -CODE_BEGINS -public: -Appli() : lzss_o(new lzss()) {} -virtual ~Appli() { delete lzss_o; } -private: - -lzss * lzss_o; - -void process_one_file(Handle * f, int d, int n) { - String nom_du_fichier; - long script_position, true_length; - int i; - Handle * f_out; - - if (f->GetSize() == 24) return; - - nom_du_fichier.set("xeno_d%d/ROOMS/%04i", d, n); - MKDIR(nom_du_fichier.to_charp()); - - i = 7; -// for (i = 0; i < 9; i++) { -// printm(M_BARE, " Processing part %i\n", i); - nom_du_fichier.set("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 = new Output(nom_du_fichier); - f->seek(0x130 + i * 4); - f->read(&script_position, 4); - f->seek(0x10c + i * 4); - f->read(&true_length, 4); - f->seek(script_position); - lzss_o->lzss_decomp(f, f_out, true_length); -// if (i == 7) { -// fseek(f_out, 0, SEEK_SET); -// fread(&true_length, 4, 1, f_out); -// printm(M_BARE, " (seems to be the script number %i)\n", true_length); -// } - delete f_out; -// } -} - -virtual int startup() throw (GeneralException) -{ - Handle * f_script_comp; - int i; - int num = 0; - char nom_du_fichier[100]; - - for (i = 384; i < 1844; i = i + 2) { - printm(M_BARE, "CD 1 - File %d -> Script %d\n", i, num); - sprintf(nom_du_fichier, "xeno_d1/ROOMS/%04d.out", i); - f_script_comp = new Input(nom_du_fichier); - - process_one_file(f_script_comp, 1, num); - - delete f_script_comp; - num++; - } - - num = 0; - - for (i = 379; i < 1838; i = i + 2) { - printm(M_BARE, "CD 2 - File %d -> Script %d\n", i, num); - sprintf(nom_du_fichier, "xeno_d2/ROOMS/%04d.out", i); - f_script_comp = new Input(nom_du_fichier); - - process_one_file(f_script_comp, 2, num); - - delete f_script_comp; - num++; - } - printm(M_BARE, "Done !\n"); - return 0; -} -CODE_ENDS +#include <stdio.h>
+#include <stdlib.h>
+#include "lzss.h"
+#include "BString.h"
+#include "Input.h"
+#include "Output.h"
+#include "Main.h"
+
+CODE_BEGINS
+public:
+Appli() : lzss_o(new lzss()) {}
+virtual ~Appli() { delete lzss_o; }
+private:
+
+lzss * lzss_o;
+
+void process_one_file(Handle * f, int d, int n) {
+ String nom_du_fichier;
+ long script_position, true_length;
+ int i;
+ Handle * f_out;
+
+ if (f->GetSize() == 24) return;
+
+ nom_du_fichier.set("xeno_d%d/ROOMS/%04i", d, n);
+ MKDIR(nom_du_fichier.to_charp());
+
+ i = 7;
+// for (i = 0; i < 9; i++) {
+// printm(M_BARE, " Processing part %i\n", i);
+ nom_du_fichier.set("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 = new Output(nom_du_fichier);
+ f->seek(0x130 + i * 4);
+ f->read(&script_position, 4);
+ f->seek(0x10c + i * 4);
+ f->read(&true_length, 4);
+ f->seek(script_position);
+ lzss_o->lzss_decomp(f, f_out, true_length);
+// if (i == 7) {
+// fseek(f_out, 0, SEEK_SET);
+// fread(&true_length, 4, 1, f_out);
+// printm(M_BARE, " (seems to be the script number %i)\n", true_length);
+// }
+ delete f_out;
+// }
+}
+
+virtual int startup() throw (GeneralException)
+{
+ Handle * f_script_comp;
+ int i;
+ int num = 0;
+ char nom_du_fichier[100];
+
+ for (i = 384; i < 1844; i = i + 2) {
+ printm(M_BARE, "CD 1 - File %d -> Script %d\n", i, num);
+ sprintf(nom_du_fichier, "xeno_d1/ROOMS/%04d.out", i);
+ f_script_comp = new Input(nom_du_fichier);
+
+ process_one_file(f_script_comp, 1, num);
+
+ delete f_script_comp;
+ num++;
+ }
+
+ num = 0;
+
+ for (i = 379; i < 1838; i = i + 2) {
+ printm(M_BARE, "CD 2 - File %d -> Script %d\n", i, num);
+ sprintf(nom_du_fichier, "xeno_d2/ROOMS/%04d.out", i);
+ f_script_comp = new Input(nom_du_fichier);
+
+ process_one_file(f_script_comp, 2, num);
+
+ delete f_script_comp;
+ num++;
+ }
+ printm(M_BARE, "Done !\n");
+ return 0;
+}
+CODE_ENDS
|