summaryrefslogtreecommitdiff
path: root/scripts/ereadertext.py
diff options
context:
space:
mode:
authorHáčky <hatschky@gmail.com>2014-11-27 07:15:45 +0000
committerHáčky <hatschky@gmail.com>2014-11-27 07:15:45 +0000
commit319ed6d0e0266f5f6174a5acd929914db8cfae1d (patch)
tree76408d9cadcbed1e702efa8c44f4cf5e364b0a4d /scripts/ereadertext.py
parent17853b802692237d98f96d1a80caf2019f71753e (diff)
Code cleanup; preparation for Japanese Battle eHEADmaster
Diffstat (limited to 'scripts/ereadertext.py')
-rw-r--r--scripts/ereadertext.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/ereadertext.py b/scripts/ereadertext.py
new file mode 100644
index 0000000..e2bd237
--- /dev/null
+++ b/scripts/ereadertext.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+import sys
+from asmquote import asmQuote
+
+region = sys.argv[3]
+
+out = open(sys.argv[2], 'w')
+
+with open(sys.argv[1], 'rb') as f:
+ for asm in f:
+ asms = asm.split('"')
+ command = asms[0].strip()
+ if command == "db":
+ # this is only for the American e-Reader; still need to deal with Japanese
+ asms[1] = asms[1].replace('\\0', '\x00')
+ asms[1] = asms[1].replace('\\n', '\n')
+ asms[1] = asms[1].replace('é', '\x7F')
+
+ out.write("db " + asmQuote(asms[1]) + "\n")
+ else:
+ out.write(asm)
+ if "macros.asm" in asm:
+ out.write("REGION EQU REGION_{0}\n".format(region))
+ out.write('REGION_NAME EQUS "{0}"\n'.format(region))
+
+f.closed \ No newline at end of file