import sys, tempfile, glob sys.path.insert(0,'/data/emu/famicom-python-vs/scripts') from pathlib import Path from mesen_run import run_mesen LUA=r''' local frames, n = 0, 0 emu.addMemoryCallback(function(a, v) n = n + 1 if n <= 6 then emu.log(string.format("R %04X=%02X", a, v)) end end, emu.callbackType.read, 0x4016, 0x4017) emu.addEventCallback(function() frames = frames + 1 if frames == 300 then local b = emu.getScreenBuffer() local c, k = {}, 0 for i = 1, #b do if not c[b[i]] then c[b[i]] = true k = k + 1 end end emu.log("SIZE " .. #b .. " colours " .. k) emu.log("DONE") end end, emu.eventType.endFrame) ''' rom=Path(glob.glob(sys.argv[1])[0]) code,log,_=run_mesen(rom, lua=LUA.encode(), seconds=120, home=Path(tempfile.mkdtemp(dir='/data/emu/famicom-python-sweep/tmp')), until='DONE', for_comparison=True, oam_row_corruption=False) print([l for l in log.splitlines() if l[:2] in ('R ','SI')])