]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Serial log without generic logging: show only serial messages.
authorToni Wilen <twilen@winuae.net>
Sat, 25 Mar 2017 17:25:33 +0000 (19:25 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 25 Mar 2017 17:25:33 +0000 (19:25 +0200)
include/sysdeps.h
od-win32/serial_win32.cpp
od-win32/writelog.cpp

index f8d9218d1c613a444db6f8a5ae925fdf10574938..887b1733b5b58873d65ca8398ddd1e358ec60a01 100644 (file)
@@ -439,11 +439,13 @@ extern void mallocemu_free (void *ptr);
 #endif
 
 #if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 6
-extern void write_log (const TCHAR *, ...);
-extern void write_log (const char *, ...) __attribute__ ((format (printf, 1, 2)));
+extern void write_log(const TCHAR *, ...);
+extern void write_logx(const TCHAR *, ...);
+extern void write_log(const char *, ...) __attribute__ ((format (printf, 1, 2)));
 #else
-extern void write_log (const TCHAR *, ...);
-extern void write_log (const char *, ...);
+extern void write_log(const TCHAR *, ...);
+extern void write_logx(const TCHAR *, ...);
+extern void write_log(const char *, ...);
 #endif
 extern void write_dlog (const TCHAR *, ...);
 extern int read_log(void);
index 9a77eae575b800121bd7e436bfea089f507b4a15..1e9bfadaf4f48851d09d1855ae633ab50ebf8352 100644 (file)
@@ -227,6 +227,7 @@ void SERPER (uae_u16 w)
        if (log_sercon) {
                serial_period_hsyncs = 1;
                seriallog = 1;
+               write_logx(_T("\n"));
        }
 
        serial_period_hsync_counter = 0;
@@ -476,7 +477,7 @@ static void serdatcopy(void)
 
        if (seriallog) {
                gotlogwrite = true;
-               write_log(_T("%c"), docharlog(serdatshift_masked));
+               write_logx(_T("%c"), docharlog(serdatshift_masked));
        }
 
        if (serper == 372) {
index 70c503f035371d9c50877e1d5bfbf4df5cef4106..a6b679cb3c93e20a2dc8f06e7f2bcc2430609697 100644 (file)
@@ -68,6 +68,7 @@ int console_logging = 0;
 static int debugger_type = -1;
 extern BOOL debuggerinitializing;
 extern int lof_store;
+extern int seriallog;
 static int console_input_linemode = -1;
 int always_flush_log = 1;
 
@@ -550,6 +551,47 @@ void write_log (const char *format, ...)
        va_end (parms);
 }
 
+void write_logx(const TCHAR *format, ...)
+{
+       int count;
+       TCHAR buffer[WRITE_LOG_BUF_SIZE];
+       int bufsize = WRITE_LOG_BUF_SIZE;
+       TCHAR *bufp;
+       va_list parms;
+
+       if (!cs_init)
+               return;
+
+       EnterCriticalSection (&cs);
+       va_start (parms, format);
+       bufp = buffer;
+       for (;;) {
+               count = _vsntprintf (bufp, bufsize - 1, format, parms);
+               if (count < 0) {
+                       bufsize *= 10;
+                       if (bufp != buffer)
+                               xfree (bufp);
+                       bufp = xmalloc (TCHAR, bufsize);
+                       continue;
+               }
+               break;
+       }
+       bufp[bufsize - 1] = 0;
+       if (1) {
+               writeconsole (bufp);
+       }
+       if (debugfile) {
+               _ftprintf (debugfile, _T("%s"), bufp);
+       }
+       lfdetected = 0;
+       if (_tcslen (bufp) > 0 && bufp[_tcslen (bufp) - 1] == '\n')
+               lfdetected = 1;
+       va_end (parms);
+       if (bufp != buffer)
+               xfree (bufp);
+       LeaveCriticalSection (&cs);
+}
+
 void write_log (const TCHAR *format, ...)
 {
        int count;
@@ -558,6 +600,9 @@ void write_log (const TCHAR *format, ...)
        TCHAR *bufp;
        va_list parms;
 
+       if (!SHOW_CONSOLE && !console_logging && !debugfile)
+               return;
+
        if (!cs_init)
                return;