some gui checking
This commit is contained in:
parent
e9669a59c8
commit
9f27a60d90
6
Gui.py
6
Gui.py
|
@ -464,6 +464,12 @@ def guiMain(args=None):
|
||||||
elif type(v) is dict: # use same settings for every player
|
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)})
|
setattr(guiargs, k, {player: getattr(guiargs, k) for player in range(1, guiargs.multi + 1)})
|
||||||
try:
|
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:
|
if guiargs.count is not None:
|
||||||
seed = guiargs.seed
|
seed = guiargs.seed
|
||||||
for _ in range(guiargs.count):
|
for _ in range(guiargs.count):
|
||||||
|
|
7
Patch.py
7
Patch.py
|
@ -3,7 +3,7 @@ import yaml
|
||||||
import os
|
import os
|
||||||
import lzma
|
import lzma
|
||||||
import hashlib
|
import hashlib
|
||||||
from typing import Tuple
|
from typing import Tuple, Optional
|
||||||
|
|
||||||
import Utils
|
import Utils
|
||||||
from Rom import JAP10HASH, read_rom
|
from Rom import JAP10HASH, read_rom
|
||||||
|
@ -11,11 +11,12 @@ from Rom import JAP10HASH, read_rom
|
||||||
base_rom_bytes = None
|
base_rom_bytes = None
|
||||||
|
|
||||||
|
|
||||||
def get_base_rom_bytes() -> bytes:
|
def get_base_rom_bytes(file_name: str = None) -> bytes:
|
||||||
global base_rom_bytes
|
global base_rom_bytes
|
||||||
if not base_rom_bytes:
|
if not base_rom_bytes:
|
||||||
options = Utils.get_options()
|
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):
|
if not os.path.exists(file_name):
|
||||||
file_name = Utils.local_path(file_name)
|
file_name = Utils.local_path(file_name)
|
||||||
base_rom_bytes = bytes(read_rom(open(file_name, "rb")))
|
base_rom_bytes = bytes(read_rom(open(file_name, "rb")))
|
||||||
|
|
Loading…
Reference in New Issue