From ebfdbbf479dcdde44c2fcc66e9a21b012fb4b50a Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sun, 12 Nov 2023 15:58:35 +0100 Subject: [PATCH] Log all Sys_Printf's when using -condebug --- Quake/console.c | 11 ++++------- Quake/sys_sdl_unix.c | 3 +++ Quake/sys_sdl_win.c | 4 ++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Quake/console.c b/Quake/console.c index 4783adf8c..36a771b14 100644 --- a/Quake/console.c +++ b/Quake/console.c @@ -82,8 +82,6 @@ double con_times[NUM_CON_TIMES]; // realtime time the line was generated int con_vislines; -qboolean con_debuglog = false; - qboolean con_initialized; @@ -716,6 +714,10 @@ static int log_fd = -1; // log file descriptor /* ================ Con_DebugLog + +Writes msg to log if -condebug was specified on the command line + +Note: msg is expected to be in UTF-8, not Quake charset ================ */ void Con_DebugLog(const char *msg) @@ -748,10 +750,6 @@ void Con_Printf (const char *fmt, ...) // also echo to debugging console Sys_Printf ("%s", msg); -// log all messages to file - if (con_debuglog) - Con_DebugLog(msg); - if (!con_initialized) return; @@ -1800,7 +1798,6 @@ void LOG_Init (quakeparms_t *parms) return; } - con_debuglog = true; Con_DebugLog (va("LOG started on: %s \n", session)); } diff --git a/Quake/sys_sdl_unix.c b/Quake/sys_sdl_unix.c index cad59d92b..16f98ca4c 100644 --- a/Quake/sys_sdl_unix.c +++ b/Quake/sys_sdl_unix.c @@ -715,6 +715,9 @@ void Sys_Printf (const char *fmt, ...) UTF8_FromQuake (u8text, sizeof (u8text), qtext); printf ("%s", u8text); + + // log all messages to file as well if -condebug was specified + Con_DebugLog (u8text); } void Sys_Quit (void) diff --git a/Quake/sys_sdl_win.c b/Quake/sys_sdl_win.c index 4d21b3a27..caec34646 100644 --- a/Quake/sys_sdl_win.c +++ b/Quake/sys_sdl_win.c @@ -912,6 +912,10 @@ void Sys_Printf (const char *fmt, ...) va_end (argptr); UTF8_FromQuake (u8text, sizeof (u8text), qtext); + + // log all messages to file as well if -condebug was specified + Con_DebugLog (u8text); + len = MultiByteToWideChar (CP_UTF8, 0, u8text, -1, wtext, countof (wtext)); if (!len) return;