From 52fb1bdc8d5b47425d7d6d71f7d073aab47360e6 Mon Sep 17 00:00:00 2001 From: btawaifi Date: Sun, 18 Oct 2026 00:44:52 +0300 Subject: [PATCH] Don't pause on lost focus in noninteractive runs The game pauses when its window loses focus. With in-game options on, that is governed by the Game.UnfocusedPause option (default on), and the legacy -no_unfocused_pause flag is ignored, as other legacy flags are. An unattended run started with -noninteractive therefore stopped as soon as another window was in front, for example when several test instances run side by side. -noninteractive means nobody is at the keyboard to resume the game, so pause_if_unfocused() now returns false for it. This covers all three focus paths (game_poll, game_pause, game_unpause). Interactive runs are unchanged. --- freespace2/freespace.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/freespace2/freespace.cpp b/freespace2/freespace.cpp index be6ddf71d60..5cfd17526bb 100644 --- a/freespace2/freespace.cpp +++ b/freespace2/freespace.cpp @@ -4753,6 +4753,11 @@ int game_check_key() bool pause_if_unfocused() { + // nobody is at the keyboard in a noninteractive run, so losing focus must not stop it + if (Cmdline_noninteractive) { + return false; + } + if (Using_in_game_options) { return UnfocusedPauseOption->getValue(); } else {