def main(args): parser = argparse.ArgumentParser() parser.add_argument('-C', '--dir', help='search for ROMs in dir') parser.add_argument('--rename', action='store_true') parser.add_argument('dat', help='dat-o-matic file') parser.add_argument('patterns', metavar='pattern', nargs='*', help='test patterns.') options = parser.parse_args(args) pattern_re = common.MakePatternRE(options.patterns) roms = common.GetMatchedRoms(pattern_re, options.dir) dat = ParseDat(options.dat) unverified_dir = os.path.join(common.ROM_DIR, 'unverified') if not os.path.isdir(unverified_dir): os.makedirs(unverified_dir) for rom in sorted(roms): h = HashFile(rom) if options.rename: if h in dat: rom_data = dat[h] MoveFile(rom, os.path.join(common.ROM_DIR, rom_data['name'])) else: MoveFile(rom, unverified_dir) else: if h not in dat: print(rom)
def main(args): parser = argparse.ArgumentParser() parser.add_argument('-e', '--exe', help='path to tester') parser.add_argument('--input', help='controller input file') parser.add_argument('-l', '--list', action='store_true', help='list matching ROMs') parser.add_argument('-j', '--num-processes', type=int, default=multiprocessing.cpu_count(), help='num processes.') parser.add_argument('-C', '--dir', help='search for ROMs in dir') parser.add_argument('--screenshot', action='store_true', help='Just grab screenshots') parser.add_argument('patterns', metavar='pattern', nargs='*', help='test patterns.') options = parser.parse_args(args) pattern_re = common.MakePatternRE(options.patterns) roms = common.GetMatchedRoms(pattern_re, options.dir) if options.list: for rom in roms: print(rom) return 0 MakeDir(OUT_ANIM_DIR) MakeDir(OUT_SCREENSHOT_DIR) start_time = time.time() pool = multiprocessing.Pool(options.num_processes) try: results = [pool.apply_async(Run, (rom, options)) for rom in roms] started = 0 completed = 0 while results: new_results = [] for result in results: if result.ready(): completed += 1 rom, duration = result.get(0) print('[%d/%d] %s (%.3fs)' % (completed, len(roms), rom, duration)) else: new_results.append(result) time.sleep(0.01) results = new_results pool.close() finally: pool.terminate() pool.join() duration = time.time() - start_time print('total time: %.3fs' % duration) return 0
def main(args): parser = argparse.ArgumentParser() parser.add_argument('patterns', metavar='pattern', nargs='*', help='test patterns.') parser.add_argument('-C', '--dir', help='search for ROMs in dir') options = parser.parse_args(args) pattern_re = common.MakePatternRE(options.patterns) roms = common.GetMatchedRoms(pattern_re, options.dir) cols = ('filename', 'title', 'cartridge_type', 'rom_size', 'ext_ram_size', 'cgb', 'sgb', 'start') rows = [cols] for rom in sorted(roms): for i, info in enumerate(RomInfo(rom)): title = info['title'] title = title[:title.find(b'\0')].decode('ascii', 'replace') filename = os.path.basename(rom) if i == 0 else ' *** ' rows.append((filename, '"%s"' % title, info['cartridge_type'], str(info['rom_size']), str(info['ext_ram_size']), info['cgb'], info['sgb'], info['start'])) max_cols = [0] * len(rows[0]) for row in rows: for col, item in enumerate(row): max_cols[col] = max(max_cols[col], len(item)) fmt = '%%-%ds' % max_cols[0] for col in range(1, len(max_cols)): fmt += ' %%%ds' % max_cols[col] rows.insert(1, tuple('_' * v for v in max_cols)) for row in rows: print(fmt % row)