import struct from io import BytesIO import json from os.path import splitext def read_u32(f): return struct.unpack('> (8 - rshift)) def decrypt(data: bytes) -> BytesIO: pos = 0x10 shift = 4 decrypted = bytearray(data) while pos + 4 <= len(decrypted): data = decrypted[pos:pos+4] data[0] = rotate_left(data[0], shift) shift = (shift + 1) % 8 data = struct.unpack(' [] []") sys.exit(1) filename = sys.argv[1] output = sys.argv[2] if len(sys.argv) > 2 else splitext(filename)[0] + '.json' encoding = sys.argv[3] if len(sys.argv) > 3 else 'cp932' with open(filename, 'rb') as f: table = load_text_data(f, encoding) with open(output, 'w', encoding='utf-8') as f: json.dump(table, f, ensure_ascii=False, indent=4)