From fc53c8be242e5065f97a990c9d57c2bcdc4a7d5d Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 11 Jan 2025 15:37:58 -0500 Subject: [PATCH] I am sure I had fixed this once already, must have forgotten to copy over the code. Make Windows not rely on the DoomTTS.ps1 script. --- Toby Doom Launcher.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Toby Doom Launcher.py b/Toby Doom Launcher.py index b673275..7927696 100755 --- a/Toby Doom Launcher.py +++ b/Toby Doom Launcher.py @@ -1659,20 +1659,37 @@ class DoomLauncher(QMainWindow): try: if platform.system() == "Windows": configFile = Path.cwd() / 'TobyConfig.ini' - # For Windows, pipe directly to PowerShell running DoomTTS.ps1 + # For Windows, use unbuffered stdout for accessible_output2 cmdLine = [gzdoomPath, "-stdout", "-config", str(configFile), "-iwad", iwadPath, "-file"] + gameFiles if gameFlags: cmdLine.extend(gameFlags) - fullCmd = " ".join(cmdLine) + " | powershell -ExecutionPolicy Bypass -File DoomTTS.ps1" + # Use CREATE_NO_WINDOW flag to prevent console window + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = subprocess.SW_HIDE + process = subprocess.Popen( - fullCmd, + cmdLine, cwd=str(self.gamePath), - shell=True + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + bufsize=1, + text=True, + env=dict(os.environ, PYTHONUNBUFFERED="1"), + startupinfo=startupinfo ) - - # Monitor thread only for Windows + + # Start speech processing thread for Windows + speechThread = threading.Thread( + target=self.speechHandler.speak_thread, + args=(process,), + daemon=True + ) + speechThread.start() + + # Monitor thread monitorThread = threading.Thread( target=self.monitor_game_process, args=(process,),