From 44bf93739d07ba65706464b4031d779a995ebbfd Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 8 Feb 2025 21:57:24 +1100 Subject: Check if debugger is attached and if it isn't then use normal printf --- qstd/plat.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/qstd/plat.c b/qstd/plat.c index b34e8cb..d1f15e7 100644 --- a/qstd/plat.c +++ b/qstd/plat.c @@ -128,8 +128,9 @@ uint64_t get_time(void) { #include #include -#include +#include #include +#include int imp_assert( int val, @@ -156,7 +157,10 @@ void print(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void print_err(const char* fmt, ...) { @@ -165,7 +169,10 @@ void print_err(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void print_war(const char* fmt, ...) { @@ -174,7 +181,10 @@ void print_war(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void pbreak(int code) { -- cgit v1.2.3-54-g00ecf