expand rom auto_start to be customizable
This commit is contained in:
parent
0ba2405bbc
commit
2338d25b39
|
@ -11,6 +11,8 @@ import multiprocessing
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from random import randrange
|
from random import randrange
|
||||||
|
|
||||||
|
@ -378,7 +380,6 @@ SNES_ATTACHED = 3
|
||||||
def launch_qusb2snes(ctx: Context):
|
def launch_qusb2snes(ctx: Context):
|
||||||
qusb2snes_path = Utils.get_options()["general_options"]["qusb2snes"]
|
qusb2snes_path = Utils.get_options()["general_options"]["qusb2snes"]
|
||||||
|
|
||||||
import os
|
|
||||||
if not os.path.isfile(qusb2snes_path):
|
if not os.path.isfile(qusb2snes_path):
|
||||||
qusb2snes_path = Utils.local_path(qusb2snes_path)
|
qusb2snes_path = Utils.local_path(qusb2snes_path)
|
||||||
|
|
||||||
|
@ -1229,8 +1230,13 @@ async def game_watcher(ctx : Context):
|
||||||
|
|
||||||
|
|
||||||
async def run_game(romfile):
|
async def run_game(romfile):
|
||||||
import webbrowser
|
auto_start = Utils.get_options()["general_options"].get("rom_start", True)
|
||||||
webbrowser.open(romfile)
|
if auto_start is True:
|
||||||
|
import webbrowser
|
||||||
|
webbrowser.open(romfile)
|
||||||
|
elif os.path.isfile(auto_start):
|
||||||
|
subprocess.Popen([auto_start, romfile],
|
||||||
|
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
|
||||||
async def websocket_server(websocket: websockets.WebSocketServerProtocol, path, ctx: Context):
|
async def websocket_server(websocket: websockets.WebSocketServerProtocol, path, ctx: Context):
|
||||||
|
@ -1320,7 +1326,6 @@ async def main():
|
||||||
adjustedromfile, adjusted = Utils.get_adjuster_settings(romfile)
|
adjustedromfile, adjusted = Utils.get_adjuster_settings(romfile)
|
||||||
if adjusted:
|
if adjusted:
|
||||||
try:
|
try:
|
||||||
import os
|
|
||||||
os.replace(adjustedromfile, romfile)
|
os.replace(adjustedromfile, romfile)
|
||||||
adjustedromfile = romfile
|
adjustedromfile = romfile
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -125,11 +125,10 @@ if __name__ == "__main__":
|
||||||
if player_name:
|
if player_name:
|
||||||
for file in os.listdir(output_path):
|
for file in os.listdir(output_path):
|
||||||
if player_name in file:
|
if player_name in file:
|
||||||
import webbrowser
|
import MultiClient
|
||||||
|
import asyncio
|
||||||
|
|
||||||
romfilename = os.path.join(output_path, file)
|
asyncio.run(MultiClient.run_game(os.path.join(output_path, file)))
|
||||||
print(f"Launching ROM file {romfilename}")
|
|
||||||
webbrowser.open(romfilename)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if any((zip_roms, zip_multidata, zip_spoiler, zip_diffs)):
|
if any((zip_roms, zip_multidata, zip_spoiler, zip_diffs)):
|
||||||
|
|
|
@ -3,6 +3,10 @@ general_options:
|
||||||
rom_file: "Zelda no Densetsu - Kamigami no Triforce (Japan).sfc"
|
rom_file: "Zelda no Densetsu - Kamigami no Triforce (Japan).sfc"
|
||||||
# set this to your (Q)Usb2Snes location if you want the MultiClient to attempt an auto start, does nothing if not found
|
# set this to your (Q)Usb2Snes location if you want the MultiClient to attempt an auto start, does nothing if not found
|
||||||
qusb2snes: "QUsb2Snes\\QUsb2Snes.exe"
|
qusb2snes: "QUsb2Snes\\QUsb2Snes.exe"
|
||||||
|
# Set this to false to never autostart a rom (such as after patching)
|
||||||
|
# true for operating system default program
|
||||||
|
# alternatively, a path to a program to open the .sfc file with
|
||||||
|
rom_start: true
|
||||||
#options for MultiServer
|
#options for MultiServer
|
||||||
#null means nothing, for the server this means to default the value
|
#null means nothing, for the server this means to default the value
|
||||||
#these overwrite command line arguments!
|
#these overwrite command line arguments!
|
||||||
|
|
Loading…
Reference in New Issue