import struct import json import sys class BGIScript: def __init__(self, path: str): self.path = path with open(path, 'rb') as f: self.data = bytearray(f.read()) self.read_header() self.get_instr_end() def read_header(self): self.header_size = struct.unpack(' 2: json_f = sys.argv[2] scr = BGIScript(base) print(scr.header_size) print(scr.iPos) print(scr.last_pos) with open(json_f, "w", encoding="utf-8") as f: json.dump(scr.extract_values(), f, ensure_ascii=False, indent=2)