From: Toni Wilen Date: Sun, 9 Jul 2023 17:38:09 +0000 (+0300) Subject: Debugger console file logging X-Git-Tag: 5.1.0~155 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c2648ed72e94cbf70333c8d1225e0e936bb51665;p=francis%2Fwinuae.git Debugger console file logging --- 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;