mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
store last used adjuster settings and use them for patching
might use them as gui defaults later
This commit is contained in:
17
Patch.py
17
Patch.py
@@ -12,17 +12,19 @@ from typing import Tuple, Optional
|
||||
import Utils
|
||||
from Rom import JAP10HASH, read_rom
|
||||
|
||||
base_rom_bytes = None
|
||||
|
||||
def get_base_rom_path(file_name: str = "") -> str:
|
||||
options = Utils.get_options()
|
||||
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)
|
||||
return file_name
|
||||
|
||||
def get_base_rom_bytes(file_name: str = "") -> bytes:
|
||||
global base_rom_bytes
|
||||
base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None)
|
||||
if not base_rom_bytes:
|
||||
options = Utils.get_options()
|
||||
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)
|
||||
file_name = get_base_rom_path(file_name)
|
||||
base_rom_bytes = bytes(read_rom(open(file_name, "rb")))
|
||||
|
||||
basemd5 = hashlib.md5()
|
||||
@@ -30,6 +32,7 @@ def get_base_rom_bytes(file_name: str = "") -> bytes:
|
||||
if JAP10HASH != basemd5.hexdigest():
|
||||
raise Exception('Supplied Base Rom does not match known MD5 for JAP(1.0) release. '
|
||||
'Get the correct game and version, then dump it')
|
||||
get_base_rom_bytes.base_rom_bytes = base_rom_bytes
|
||||
return base_rom_bytes
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user