summaryrefslogtreecommitdiff
path: root/Xenogears/Translate.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-05-04 17:53:08 +0000
committerPixel <Pixel>2002-05-04 17:53:08 +0000
commit24fb33726eca4e8c5a88797adc9c17f4d541f543 (patch)
tree72b385bd9e880e699e43c7db3ba12817f0e8e45e /Xenogears/Translate.cpp
Initial revision
Diffstat (limited to 'Xenogears/Translate.cpp')
-rw-r--r--Xenogears/Translate.cpp256
1 files changed, 256 insertions, 0 deletions
diff --git a/Xenogears/Translate.cpp b/Xenogears/Translate.cpp
new file mode 100644
index 0000000..3f85437
--- /dev/null
+++ b/Xenogears/Translate.cpp
@@ -0,0 +1,256 @@
+#include <stdio.h>
+#include <string.h>
+
+void dump_text(FILE * f_source, FILE * f_cible)
+{
+ unsigned char val;
+ unsigned char temp1 = 0;
+ unsigned char temp2 = 0;
+
+ while (!feof(f_source)) {
+ val = 0;
+
+ fread((unsigned char *) &val, 1, 1, f_source);
+
+ if (val == 0x00) // "<Close>"
+ {
+// break;
+ fprintf(f_cible, "<EOF>\n");
+ } else if (val == 0x01) // "\n"
+ {
+ fprintf(f_cible, "\n");
+ } else if (val == 0x02) // "<New>"
+ {
+ fprintf(f_cible, "<New>\n");
+ } else if (val == 0x03) // "<Wait>"
+ {
+ fprintf(f_cible, "<Wait>");
+ } else if (val == 0x0F) // "<Delay X>
+ {
+ fread((unsigned char *) &temp1, 1, 1, f_source);
+ fread((unsigned char *) &temp2, 1, 1, f_source);
+ if (temp1 == 0) {
+ fprintf(f_cible, "<Delay %d>", temp2);
+ } else if (temp1 == 5) {
+ fprintf(f_cible, "<Gear %d>", temp2);
+ } else {
+ fprintf(f_cible, "<Opcode %d %d>", temp1, temp2);
+ }
+ } else if (val == 0x10) // " "
+ {
+ fprintf(f_cible, " ");
+ } else if (val == 0x11) // "+"
+ {
+ fprintf(f_cible, "+");
+ } else if (val == 0x12) // ","
+ {
+ fprintf(f_cible, ",");
+ } else if (val == 0x13) // "-"
+ {
+ fprintf(f_cible, "-");
+ } else if (val == 0x14) // "."
+ {
+ fprintf(f_cible, ".");
+ } else if (val == 0x15) // "/"
+ {
+ fprintf(f_cible, "/");
+ } else if ((val >= 0x16) && (val <= 0x1F)) // "0-9"
+ {
+ fprintf(f_cible, "%c", val + 0x1a);
+ } else if ((val >= 0x20) && (val <= 0x39)) // "A-Z"
+ {
+ fprintf(f_cible, "%c", val + 0x21);
+ } else if (val == 0x3A) // "["
+ {
+ fprintf(f_cible, "[");
+ } else if (val == 0x3B) // "]"
+ {
+ fprintf(f_cible, "]");
+ } else if (val == 0x3C) // "="
+ {
+ fprintf(f_cible, "=");
+ } else if ((val >= 0x3D) && (val <= 0x56)) // "a-z"
+ {
+ fprintf(f_cible, "%c", val + 0x24);
+ } else if (val == 0x57) // "!"
+ {
+ fprintf(f_cible, "!");
+ } else if (val == 0x58) // "\""
+ {
+ fprintf(f_cible, "\"");
+ } else if (val == 0x59) // "#"
+ {
+ fprintf(f_cible, "#");
+ } else if (val == 0x5A) // "%"
+ {
+ fprintf(f_cible, "%%");
+ } else if (val == 0x5B) // "&"
+ {
+ fprintf(f_cible, "&");
+ } else if (val == 0x5C) // "'"
+ {
+ fprintf(f_cible, "'");
+ } else if (val == 0x5D) // "("
+ {
+ fprintf(f_cible, "(");
+ } else if (val == 0x5E) // ")"
+ {
+ fprintf(f_cible, ")");
+ } else if (val == 0x5F) // ":"
+ {
+ fprintf(f_cible, ":");
+ } else if (val == 0x60) // "?"
+ {
+ fprintf(f_cible, "?");
+ } else if (val == 0x61) // "<0>"
+ {
+ fprintf(f_cible, "<0>");
+ } else if (val == 0x62) // "<1>"
+ {
+ fprintf(f_cible, "<1>");
+ } else if (val == 0x63) // "<2>"
+ {
+ fprintf(f_cible, "<2>");
+ } else if (val == 0x64) // "<3>"
+ {
+ fprintf(f_cible, "<3>");
+ } else if (val == 0x65) // "<4>"
+ {
+ fprintf(f_cible, "<4>");
+ } else if (val == 0x66) // "<5>"
+ {
+ fprintf(f_cible, "<5>");
+ } else if (val == 0x67) // "<6>"
+ {
+ fprintf(f_cible, "<6>");
+ } else if (val == 0x68) // "<7>"
+ {
+ fprintf(f_cible, "<7>");
+ } else if (val == 0x69) // "<8>"
+ {
+ fprintf(f_cible, "<8>");
+ } else if (val == 0x6A) // "<9>"
+ {
+ fprintf(f_cible, "<9>");
+ } else if (val == 0x6B) // "<%>"
+ {
+ fprintf(f_cible, "<%%>");
+ } else if (val == 0x6C) // "<&>"
+ {
+ fprintf(f_cible, "<&>");
+ } else if (val == 0x6D) // "*"
+ {
+ fprintf(f_cible, "*");
+ } else if (val == 0x6E) // "<C>"
+ {
+ fprintf(f_cible, "<C>");
+ } else if (val == 0x6F) // "<S>"
+ {
+ fprintf(f_cible, "<S>");
+ } else if (val == 0x70) // "<T>"
+ {
+ fprintf(f_cible, "<T>");
+ } else if (val == 0x71) // "<*>"
+ {
+ fprintf(f_cible, "<*>");
+ } else if (val == 0x72) // "<R>"
+ {
+ fprintf(f_cible, "<R>");
+ } else if (val == 0x73) // "<L>"
+ {
+ fprintf(f_cible, "<L>");
+ } else if (val == 0x74) // "<U>"
+ {
+ fprintf(f_cible, "<U>");
+ } else if (val == 0x75) // "<U>"
+ {
+ fprintf(f_cible, "<D>");
+ } else if (val == 0x76) // "<.>"
+ {
+ fprintf(f_cible, "<.>");
+ } else if (val == 0x77) // "<:>"
+ {
+ fprintf(f_cible, "<:>");
+ } else if (val == 0x79) // "</>"
+ {
+ fprintf(f_cible, "</>");
+ } else if (val == 0x7A) // "<..>"
+ {
+ fprintf(f_cible, "<..>");
+ } else if (val == 0x7B) // "<`>"
+ {
+ fprintf(f_cible, "<`>");
+ } else if (val == 0x7D) // "<+>"
+ {
+ fprintf(f_cible, "<+>");
+ } else if (val == 0x7E) // "<->"
+ {
+ fprintf(f_cible, "<->");
+ } else if (val == 0x7F) // "<X>"
+ {
+ fprintf(f_cible, "<X>");
+ } else if (val == 0x80) // "<[>"
+ {
+ fprintf(f_cible, "<[>");
+ } else if (val == 0x81) // "<]>"
+ {
+ fprintf(f_cible, "<]>");
+ } else if (val == 0x82) // "<%>"
+ {
+ fprintf(f_cible, "<%%>");
+ } else if (val == 0x83) // "<&>"
+ {
+ fprintf(f_cible, "<&>");
+ } else if (val == 0x84) // "<(>"
+ {
+ fprintf(f_cible, "<(>");
+ } else if (val == 0x85) // "<)>"
+ {
+ fprintf(f_cible, "<)>");
+ } else if (val == 0x86) // "<#>"
+ {
+ fprintf(f_cible, "<#>");
+ } else if (val == 0x87) // "`"
+ {
+ fprintf(f_cible, "`");
+ } else if (val == 0x88) // "°"
+ {
+ fprintf(f_cible, "°");
+ } else if (val == 0x89) // "<=>"
+ {
+ fprintf(f_cible, "<=>");
+ } else if (val == 0x8A) // "<?>"
+ {
+ fprintf(f_cible, "<?>");
+ } else if (val == 0x8B) // "<!>"
+ {
+ fprintf(f_cible, "<!>");
+ } else if (val == 0x8C) // "_"
+ {
+ fprintf(f_cible, "_");
+ } else if (val == 0x8D) // "~"
+ {
+ fprintf(f_cible, "~");
+ } else if (val == 0x8E) // "<...>"
+ {
+ fprintf(f_cible, "<...>");
+ } else if (val == 0x8F) // "<'>"
+ {
+ fprintf(f_cible, "<'>");
+ } else if (val == 0xFE) // "<Extra1 X>
+ {
+ fread((unsigned char *) &temp1, 1, 1, f_source);
+ fprintf(f_cible, "<Extra1 %d>", temp1);
+ } else if (val == 0xFF) // "<Extra2 X>
+ {
+ fread((unsigned char *) &temp1, 1, 1, f_source);
+ fprintf(f_cible, "<Extra2 %d>", temp1);
+ } else {
+ fprintf(f_cible, "<Bare %X>", val);
+ }
+ }
+}
+
+int main(void) {
+ dump_text(stdin, stdout);
+}