diff --git a/Gui.py b/Gui.py index d4750dd9..85839490 100755 --- a/Gui.py +++ b/Gui.py @@ -464,6 +464,12 @@ def guiMain(args=None): elif type(v) is dict: # use same settings for every player setattr(guiargs, k, {player: getattr(guiargs, k) for player in range(1, guiargs.multi + 1)}) try: + if not guiargs.suppress_rom: + if not os.path.exists(guiargs.rom): + raise FileNotFoundError(f"Could not find specified rom file {guiargs.rom}") + else: + import Patch + Patch.get_base_rom_bytes(guiargs.rom) # throws error on checksum fail if guiargs.count is not None: seed = guiargs.seed for _ in range(guiargs.count): diff --git a/Patch.py b/Patch.py index 2a8f0050..def899e8 100644 --- a/Patch.py +++ b/Patch.py @@ -3,7 +3,7 @@ import yaml import os import lzma import hashlib -from typing import Tuple +from typing import Tuple, Optional import Utils from Rom import JAP10HASH, read_rom @@ -11,11 +11,12 @@ from Rom import JAP10HASH, read_rom base_rom_bytes = None -def get_base_rom_bytes() -> bytes: +def get_base_rom_bytes(file_name: str = None) -> bytes: global base_rom_bytes if not base_rom_bytes: options = Utils.get_options() - file_name = options["general_options"]["rom_file"] + if not file_name: + file_name = options["general_options"]["rom_file"] if not os.path.exists(file_name): file_name = Utils.local_path(file_name) base_rom_bytes = bytes(read_rom(open(file_name, "rb")))