From 7d0ac98a7c56d1fa2432c2257a27a5136d34f25e Mon Sep 17 00:00:00 2001 From: lennard <44114474+Dummerle@users.noreply.github.com> Date: Sun, 8 Jan 2023 21:02:58 +0100 Subject: [PATCH] Add a workaround for Fall Guys --- rare/game_launch_helper/__init__.py | 16 ++++++++++++++++ rare/game_launch_helper/console.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/rare/game_launch_helper/__init__.py b/rare/game_launch_helper/__init__.py index e7ed0224..7a2139b6 100644 --- a/rare/game_launch_helper/__init__.py +++ b/rare/game_launch_helper/__init__.py @@ -1,5 +1,7 @@ import json import logging +import platform +import subprocess import sys import time import traceback @@ -20,6 +22,10 @@ from .message_models import ErrorModel, Actions, FinishedModel, BaseModel, State logger = logging.getLogger("RareLauncher") +DETACHED_APP_NAMES = [ + "0a2d9f6403244d12969e11da6713137b" +] + class PreLaunchThread(QRunnable): class Signals(QObject): @@ -174,6 +180,14 @@ class GameProcessApp(RareApp): new_state=StateChangedModel.States.started ) )) + if self.app_name in DETACHED_APP_NAMES and platform.system() == "Windows": + self.game_process.deleteLater() + subprocess.Popen([args.executable] + args.args, cwd=args.cwd, + env={i: args.env.value(i) for i in args.env.keys()}) + if self.console: + self.console.log("Launching game detached") + self.stop() + return self.game_process.start(args.executable, args.args) def error_occurred(self, error_str: str): @@ -213,6 +227,8 @@ class GameProcessApp(RareApp): self.processEvents() if not self.console: self.exit() + else: + self.console.on_process_exit(self.app_name, 0) def start_game(args: Namespace): diff --git a/rare/game_launch_helper/console.py b/rare/game_launch_helper/console.py index bc9d9691..9ee5a8a0 100644 --- a/rare/game_launch_helper/console.py +++ b/rare/game_launch_helper/console.py @@ -162,7 +162,7 @@ class ConsoleEdit(QPlainTextEdit): self._cursor_output = self.textCursor() def log(self, text): - html = f"

{text}

" + html = f"

{text}

" self._cursor_output.insertHtml(html) self.scroll_to_last_line()