Close the game's own console and bring its window to the front (#208, #521)

A game started from a frontend (Playnite, RetroBat, ES-DE) or a shortcut got a console beside it, and its window
opened behind other windows, out of reach without a mouse. Once the log file is open, the console is freed when no
other process shares it; a terminal launch keeps its output, and show_console = 1 keeps the console. The window is
raised at start, with AttachThreadInput when Windows refuses the foreground. rt_fatal writes only to the log, and a
console owned by the game closed with it anyway, so no error text is lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-03 20:09:23 +03:00
1 parent 3422952e85
commit d2fbe0a2b1
7 files changed
+52 -7

No files matched your search

+4
View File
@@ -546,6 +546,10 @@ int main(int argc, char **argv) {
if (cfg.seconds && mode) return usage(argv[0]);
log_open(!mode);
if (!mode) {
// A game launched by a frontend or a shortcut gets a console of its own that only gets in the way. The log is in
// a file by now; with no log file, or with show_console = 1, the console stays.
if (rt_log_path() && !cfg_bool("TOTK_SHOW_CONSOLE") && plat_console_release_if_owned())
rt_log("console: owned by the game alone, released (show_console = 1 keeps it)");
cfg.boot = cfg.seconds > 0; // --seconds starts the game like --boot, with its checkpoints
rt_boot();
return 0;