def create_backend(debug_game_backend: bool, options): from randovania.interface_common.options import Options options = typing.cast(Options, options) logger.info("Preparing game backend...") if debug_game_backend: from randovania.gui.debug_backend_window import DebugBackendWindow backend = DebugBackendWindow() backend.show() else: try: from randovania.game_connection.dolphin_backend import DolphinBackend except ImportError: from randovania.gui.lib import common_qt_lib common_qt_lib.show_install_visual_cpp_redist() raise SystemExit(1) from randovania.game_connection.nintendont_backend import NintendontBackend from randovania.game_connection.backend_choice import GameBackendChoice logger.info("Loaded all game backends...") if options.game_backend == GameBackendChoice.NINTENDONT and options.nintendont_ip is not None: backend = NintendontBackend(options.nintendont_ip) else: backend = DolphinBackend() logger.info("Game backend configured: %s", type(backend)) return backend
def create_backend(debug_game_backend: bool): if debug_game_backend: from randovania.gui.debug_backend_window import DebugBackendWindow backend = DebugBackendWindow() backend.show() else: from randovania.game_connection.dolphin_backend import DolphinBackend backend = DolphinBackend() return backend
def create_backend(debug_game_backend: bool, options): from randovania.interface_common.options import Options options = typing.cast(Options, options) if debug_game_backend: from randovania.gui.debug_backend_window import DebugBackendWindow backend = DebugBackendWindow() backend.show() else: from randovania.game_connection.dolphin_backend import DolphinBackend from randovania.game_connection.nintendont_backend import NintendontBackend from randovania.game_connection.backend_choice import GameBackendChoice if options.game_backend == GameBackendChoice.NINTENDONT and options.nintendont_ip is not None: backend = NintendontBackend(options.nintendont_ip) else: backend = DolphinBackend() return backend
def run(args): QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) app = QApplication(sys.argv) preview: bool = getattr(args, "preview", False) os.environ['QT_API'] = "PySide2" import asyncqt loop = asyncqt.QEventLoop(app) asyncio.set_event_loop(loop) sys.excepthook = catch_exceptions app.game_connection = GameConnection() if getattr(args, "debug_game_backend", False): backend = DebugBackendWindow() backend.show() else: backend = DolphinBackend() app.game_connection.set_backend(backend) @asyncClose async def _on_last_window_closed(): await app.game_connection.stop() app.lastWindowClosed.connect(_on_last_window_closed, Qt.QueuedConnection) target_window = getattr(args, "window", None) if target_window == "data-editor": show_data_editor(app) elif target_window == "tracker": show_tracker(app) else: show_main_window(app, preview) with loop: loop.create_task(app.game_connection.start()) sys.exit(loop.run_forever())