diff --git a/README.md b/README.md index 23c6d51..763fab4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,18 @@ A simple GB emulator. * Disable/enable BG, Window and Sprite layers * Convenient Python test harness using hashes to validate +## Screenshots + +![Bionic Commando](/images/bionic.png) +![Donkey Kong](/images/dk.png) +![Kirby's Dreamland 2](/images/kirby2.png) +![Mole Mania](/images/mole.png) +![Mario's Picross](/images/picross.png) +![Trip World](/images/trip.png) +![Wario Land](/images/wario.png) +![Game Boy Wars](/images/wars.png) +![Is That a Demo in Your Pocket?](/images/pocket.png) + ## Building Requires [CMake](https://cmake.org) and diff --git a/images/bionic.png b/images/bionic.png new file mode 100644 index 0000000..65e1924 Binary files /dev/null and b/images/bionic.png differ diff --git a/images/dk.png b/images/dk.png new file mode 100644 index 0000000..34418df Binary files /dev/null and b/images/dk.png differ diff --git a/images/kirby2.png b/images/kirby2.png new file mode 100644 index 0000000..124c57a Binary files /dev/null and b/images/kirby2.png differ diff --git a/images/mole.png b/images/mole.png new file mode 100644 index 0000000..1f7608c Binary files /dev/null and b/images/mole.png differ diff --git a/images/picross.png b/images/picross.png new file mode 100644 index 0000000..fdc5bfb Binary files /dev/null and b/images/picross.png differ diff --git a/images/pocket.png b/images/pocket.png new file mode 100644 index 0000000..37b8bd6 Binary files /dev/null and b/images/pocket.png differ diff --git a/images/trip.png b/images/trip.png new file mode 100644 index 0000000..8009441 Binary files /dev/null and b/images/trip.png differ diff --git a/images/wario.png b/images/wario.png new file mode 100644 index 0000000..9676bb4 Binary files /dev/null and b/images/wario.png differ diff --git a/images/wars.png b/images/wars.png new file mode 100644 index 0000000..dfda0d2 Binary files /dev/null and b/images/wars.png differ diff --git a/scripts/anim.py b/scripts/anim.py index cea3a96..0f64b8b 100755 --- a/scripts/anim.py +++ b/scripts/anim.py @@ -17,8 +17,9 @@ import common OUT_ANIM_DIR = os.path.join(common.OUT_DIR, 'anim') - -DEFAULT_FRAMES = 2400 +OUT_SCREENSHOT_DIR = os.path.join(common.OUT_DIR, 'screenshot') +DEFAULT_ANIM_FRAMES = 2400 +DEFAULT_SCREENSHOT_FRAMES = 300 CONTROLLER_INPUT_FILE = os.path.join(common.SCRIPT_DIR, 'input_move_right.txt') @@ -30,6 +31,13 @@ def ChangeDir(new_dir, path): return os.path.join(new_dir, os.path.basename(path)) +def MakeDir(dir_name): + try: + os.makedirs(dir_name) + except OSError as e: + print(e) + + def ConvertPPMstoMP4(tempdir, src): srcs = ChangeExt(src, '.%08d.ppm') dst = ChangeDir(OUT_ANIM_DIR, ChangeExt(src, '.mp4')) @@ -43,16 +51,21 @@ def ConvertPPMstoMP4(tempdir, src): dst) -def Run(rom): +def Run(rom, options): start_time = time.time() tempdir = None try: tempdir = tempfile.mkdtemp(prefix='rom_anims') - default_img = ChangeDir(tempdir, ChangeExt(rom, '.ppm')) try: - common.RunTester(rom, DEFAULT_FRAMES, default_img, - controller_input=CONTROLLER_INPUT_FILE, animate=True) - ConvertPPMstoMP4(tempdir, default_img) + if options.screenshot: + default_img = ChangeDir(OUT_SCREENSHOT_DIR, ChangeExt(rom, '.ppm')) + common.RunTester(rom, DEFAULT_SCREENSHOT_FRAMES, default_img, + controller_input=CONTROLLER_INPUT_FILE) + else: + default_img = ChangeDir(tempdir, ChangeExt(rom, '.ppm')) + common.RunTester(rom, DEFAULT_ANIM_FRAMES, default_img, + controller_input=CONTROLLER_INPUT_FILE, animate=True) + ConvertPPMstoMP4(tempdir, default_img) except common.Error as e: print(str(e)) finally: @@ -70,6 +83,8 @@ def main(args): 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) @@ -81,15 +96,13 @@ def main(args): print(rom) return 0 - try: - os.makedirs(OUT_ANIM_DIR) - except OSError as e: - print(e) + 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,)) for rom in roms] + results = [pool.apply_async(Run, (rom, options)) for rom in roms] started = 0 completed = 0 while results: