Skip to content

Commit

Permalink
BizHawkClient: Use local_path when autolaunching BizHawk with lua s…
Browse files Browse the repository at this point in the history
…cript (ArchipelagoMW#2526)

* BizHawkClient: Change autolaunch path to lua script to use local_path

* BizHawkClient: Remove unnecessary call to os.path.join and linting
  • Loading branch information
Zunawe authored Nov 28, 2023
1 parent ce2f931 commit 737686a
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions worlds/_bizhawk/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,30 @@ async def _run_game(rom: str):

if auto_start is True:
emuhawk_path = Utils.get_settings().bizhawkclient_options.emuhawk_path
subprocess.Popen([emuhawk_path, "--lua=data/lua/connector_bizhawk_generic.lua", os.path.realpath(rom)],
cwd=Utils.local_path("."),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocess.Popen(
[
emuhawk_path,
f"--lua={Utils.local_path('data', 'lua', 'connector_bizhawk_generic.lua')}",
os.path.realpath(rom),
],
cwd=Utils.local_path("."),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
elif isinstance(auto_start, str):
import shlex

subprocess.Popen([*shlex.split(auto_start), os.path.realpath(rom)],
cwd=Utils.local_path("."),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocess.Popen(
[
*shlex.split(auto_start),
os.path.realpath(rom)
],
cwd=Utils.local_path("."),
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)


async def _patch_and_run_game(patch_file: str):
Expand Down

0 comments on commit 737686a

Please sign in to comment.