Files
PythonLib/bin_to_tbl.py
2023-09-06 03:34:22 -05:00

30 lines
619 B
Python

import json
big_ass_array = []
TBL_BIN_PATH = "./00014.bin"
with open(TBL_BIN_PATH, "rb") as f:
while cp := f.read(2):
cp = cp[::-1]
big_ass_array.append(cp.decode("cp932"))
data = dict()
for index in range(len(big_ass_array)):
btm = (index % 0xBB) + 0x40
if 0x5B < btm:
btm += 1
if 0x7E < btm:
btm += 1
top = (index // 0xBB) + 0x99
if 0x9F < top:
top += 0x40
character = btm | (top << 8)
data[f"{character:X}"] = big_ass_array[index]
with open("tbl.json", "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)