#!/usr/bin/env python3 """wadfix.py IN OUT: RollingBoulderMountain never ends (its final 'wait until v13 == 0' compares with 0.5).""" import struct, sys d = bytearray(open(sys.argv[1], 'rb').read()) pat = struct.pack('<6I', 0x1002f, 0xd0004, 0x44, 0x4e, 0xfffc0012, 0xb4) # freezeOffCamera 1; v13; pushShort 0; eq; jzYield -4; end i = d.find(pat) assert i >= 0 and d.find(pat, i + 1) < 0, 'pattern not unique' struct.pack_into('