# SPDX-License-Identifier: MIT import pickle, sys, os sys.path.insert(0, "tests") os.environ["SEGACD_DISC"] = "runs/discs/Sonic CD (USA)/Sonic CD (USA).cue" from savestate_check import build_machine, disc_path, run_frame, _leaves, digest s, d = build_machine(disc_path()) for _ in range(int(sys.argv[1])): run_frame(s, d) c = pickle.loads(pickle.dumps((s, d), protocol=pickle.HIGHEST_PROTOCOL)) for f in range(int(sys.argv[2])): run_frame(s, d); run_frame(*c) a = _leaves((s, d)); b = _leaves(c) diff = [k for k in sorted(set(a) | set(b)) if a.get(k) != b.get(k)] print(f, len(a), len(diff), diff[:20], flush=True)