from struct import unpack as U import csv import sys big_endian = False def readint(f): if big_endian: return U(">i", f.read(4))[0] else: return U("iii", f.read(4 * 3)) else: a, b, c = U(" 3: big_endian = sys.argv[3] == "big" en_mapping = {} jp_mapping = {} with open(fp, "rb") as f: dumpy(f, en_mapping) with open(fp.replace("ENGLISH", "JAPANESE"), "rb") as f: dumpy(f, jp_mapping) from collections import defaultdict mappings = defaultdict(lambda: ["", ""]) for k, v in en_mapping.items(): mappings[k][0] = v for k, v in jp_mapping.items(): mappings[k][1] = v with open(fpo, "w", newline="", encoding="utf-8") as f: cw = csv.writer(f, dialect="excel-tab") for k in sorted(mappings.keys()): en_v, jp_v = mappings[k] cw.writerow([k, en_v, jp_v])