def run_rom(rom): pyboy = PyBoy(rom, window_type="dummy") pyboy.set_emulation_speed(0) t = time.time() result = "" while not pyboy.tick(): b = pyboy._serial() if b != "": result += b t = time.time() if pyboy._is_cpu_stuck(): break for _ in range(10): pyboy.tick() pyboy.stop(save=False) result += pyboy._serial( ) # Getting the absolute last. Some times the tests says "Failed X tests". if result == "": n = 0 while True: char = pyboy.get_memory_value(0xA004 + n) if char != 0: result += chr(char) n += 1 if n > 250: break return result
def run_rom(args): rom, frame_limit = args pyboy = PyBoy(rom, window_type="dummy", window_scale=1, bootrom_file=utils.boot_rom, disable_input=True) pyboy.set_emulation_speed(0) serial_output = "" t = time.time() result = None frame_count = 0 while not pyboy.tick(): b = pyboy._serial() if b != "": serial_output += b t = time.time() if "Passed" in serial_output: result = ("Passed") break elif "Failed" in serial_output: result = (serial_output) break if frame_limit == -1 and time.time() - t > timeout: result = ("Timeout:\n" + serial_output) break elif frame_count == frame_limit: result = ("Frame limit reached:\n" + serial_output) break frame_count += 1 pyboy.stop(save=False) return result