From c2648ed72e94cbf70333c8d1225e0e936bb51665 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 9 Jul 2023 20:38:09 +0300 Subject: [PATCH] Debugger console file logging --- od-win32/win32.cpp | 5 +++++ od-win32/writelog.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 62fdb3bb..0e306c1c 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -134,6 +134,7 @@ static int noNtDelayExecution; extern FILE *debugfile; extern int console_logging; +extern TCHAR *conlogfile; OSVERSIONINFO osVersion; static SYSTEM_INFO SystemInfo; static int logging_started; @@ -6872,6 +6873,10 @@ static int parseargs(const TCHAR *argx, const TCHAR *np, const TCHAR *np2) forcedframelatency = getval (np); return 2; } + if (!_tcscmp(arg, _T("conlogfile"))) { + conlogfile = my_strdup(np); + return 2; + } #ifdef RETROPLATFORM if (!_tcscmp (arg, _T("rphost"))) { rp_param = my_strdup (np); diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index bf7b2435..8add362c 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -70,6 +70,8 @@ extern BOOL debuggerinitializing; extern int lof_store; static int console_input_linemode = -1; int always_flush_log = 0; +TCHAR *conlogfile = NULL; +static FILE *conlogfilehandle; #define WRITE_LOG_BUF_SIZE 4096 @@ -365,6 +367,15 @@ static void console_put (const TCHAR *buffer) openconsole (); writeconsole (buffer); } + if (conlogfile) { + if (!conlogfilehandle) { + conlogfilehandle = _tfopen(conlogfile, _T("w")); + } + if (conlogfilehandle) { + fputws(buffer, conlogfilehandle); + fflush(conlogfilehandle); + } + } } static int console_buf_len = 100000; -- 2.47.3