summaryrefslogtreecommitdiff
path: root/r2
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-14 19:22:16 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-14 19:22:50 +0800
commit614e6b2e8971655e60f086a4237eb548a4c140d2 (patch)
tree4e7a5e0226a9dcd30c31515d62bba4124e8b799f /r2
parent72ce5c9c93b1bfa98ee8ea9affad7f607f9fa5c4 (diff)
downloadrich4-614e6b2e8971655e60f086a4237eb548a4c140d2.tar.xz
fill card table
Diffstat (limited to 'r2')
-rw-r--r--r2/print_cards_table.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/r2/print_cards_table.py b/r2/print_cards_table.py
new file mode 100644
index 0000000..83bcfa3
--- /dev/null
+++ b/r2/print_cards_table.py
@@ -0,0 +1,22 @@
+import r2pipe
+import opencc
+
+cc = opencc.OpenCC('t2s')
+r = r2pipe.open()
+data = r.cmdj("xj 240 @ 0x47fdf2")
+for i in range(0,30):
+ addr = data[i*8+0] + (data[i*8+1]<<8) + (data[i*8+2]<<16) + (data[i*8+3]<<24)
+ _4 = data[i*8+4]
+ _5 = data[i*8+5]
+ _6 = data[i*8+6]
+ _7 = data[i*8+7]
+ hexs = r.cmdj("xj 10 @ {}".format(addr))
+ hexstr = ""
+ cbytes = bytearray([])
+ for i in hexs:
+ if i == 0:
+ break
+ hexstr += f'\\x{i:02x}'
+ cbytes.append(i)
+ big5str = cc.convert(cbytes.decode(encoding='big5'))
+ print("{ " + f'"{hexstr}", {_4}, {_5}, {_6}, {_7}' + ' }, /* ' + big5str + ' */')