ALTTP/SNIC/BHC: Stop using Utils.get_settings() (#5239)

* LTTP/SNIC/BHC: Stop using Utils.get_settings()

* SNIClient: use Settings.sni_options
This commit is contained in:
josephwhite
2025-07-31 15:09:00 -04:00
committed by GitHub
parent 8a552e3639
commit 7abe7fe304
3 changed files with 8 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ from json import loads, dumps
from CommonClient import CommonContext, server_loop, ClientCommandProcessor, gui_enabled, get_base_parser from CommonClient import CommonContext, server_loop, ClientCommandProcessor, gui_enabled, get_base_parser
import Utils import Utils
from settings import Settings
from Utils import async_start from Utils import async_start
from MultiServer import mark_raw from MultiServer import mark_raw
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
@@ -285,7 +286,7 @@ class SNESState(enum.IntEnum):
def launch_sni() -> None: def launch_sni() -> None:
sni_path = Utils.get_settings()["sni_options"]["sni_path"] sni_path = Settings.sni_options.sni_path
if not os.path.isdir(sni_path): if not os.path.isdir(sni_path):
sni_path = Utils.local_path(sni_path) sni_path = Utils.local_path(sni_path)
@@ -668,8 +669,7 @@ async def game_watcher(ctx: SNIContext) -> None:
async def run_game(romfile: str) -> None: async def run_game(romfile: str) -> None:
auto_start = typing.cast(typing.Union[bool, str], auto_start = Settings.sni_options.snes_rom_start
Utils.get_settings()["sni_options"].get("snes_rom_start", True))
if auto_start is True: if auto_start is True:
import webbrowser import webbrowser
webbrowser.open(romfile) webbrowser.open(romfile)

View File

@@ -9,6 +9,7 @@ import enum
import subprocess import subprocess
from typing import Any from typing import Any
import settings
from CommonClient import CommonContext, ClientCommandProcessor, get_base_parser, server_loop, logger, gui_enabled from CommonClient import CommonContext, ClientCommandProcessor, get_base_parser, server_loop, logger, gui_enabled
import Patch import Patch
import Utils import Utils
@@ -304,10 +305,10 @@ async def _game_watcher(ctx: BizHawkClientContext):
async def _run_game(rom: str): async def _run_game(rom: str):
import os import os
auto_start = Utils.get_settings().bizhawkclient_options.rom_start auto_start = settings.get_settings().bizhawkclient_options.rom_start
if auto_start is True: if auto_start is True:
emuhawk_path = Utils.get_settings().bizhawkclient_options.emuhawk_path emuhawk_path = settings.get_settings().bizhawkclient_options.emuhawk_path
subprocess.Popen( subprocess.Popen(
[ [
emuhawk_path, emuhawk_path,

View File

@@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
import Utils import Utils
import settings
import worlds.Files import worlds.Files
LTTPJPN10HASH: str = "03a63945398191337e896e5771f77173" LTTPJPN10HASH: str = "03a63945398191337e896e5771f77173"
@@ -3023,7 +3024,7 @@ def get_base_rom_bytes(file_name: str = "") -> bytes:
def get_base_rom_path(file_name: str = "") -> str: def get_base_rom_path(file_name: str = "") -> str:
options = Utils.get_settings() options = settings.get_settings()
if not file_name: if not file_name:
file_name = options["lttp_options"]["rom_file"] file_name = options["lttp_options"]["rom_file"]
if not os.path.exists(file_name): if not os.path.exists(file_name):