import sys desp = 0x2000 numBytes = 0x2000 firstByte = desp + 0x200 lastByte = desp + numBytes - 1 checksum1 = desp + 0x270 checksum2 = desp + 0x271 def calc_checksum(buffer): total = 0 for i in range(firstByte, lastByte + 1): if i not in (checksum1, checksum2): total += buffer[i] total += 3328 buffer[checksum1] = total % 256 buffer[checksum2] = (total >> 8) % 256 if len(sys.argv) != 3: print("Uso: python3 revert_armario.py save_in.srm save_out.srm") sys.exit(1) infile = sys.argv[1] outfile = sys.argv[2] with open(infile, "rb") as f: buf = bytearray(f.read()) # revertir el byte del armario buf[0x0295C] = 0x3B # recalcular checksum calc_checksum(buf) with open(outfile, "wb") as f: f.write(buf) print("Hecho. Guarda generado:", outfile)