From 5f46863a191a7e44f0f068cbbafcb4492378a892 Mon Sep 17 00:00:00 2001 From: deve Date: Mon, 14 Dec 2015 12:25:04 +0100 Subject: [PATCH] Display pop-up message when fatal error occured on windows. The reason to do it is that in release mode we don't receive any message in console. This causes that the game sometimes doesn't start and you have no idea why (for example missing supertuxkart.git file etc.). --- src/utils/log.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/utils/log.cpp b/src/utils/log.cpp index 86a1980d2..f77f0bcfc 100644 --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -197,7 +197,7 @@ void Log::printMessage(int level, const char *component, const char *format, OutputDebugString(szBuff); OutputDebugString("\r\n"); #endif - + if(m_file_stdout) { @@ -207,6 +207,25 @@ void Log::printMessage(int level, const char *component, const char *format, va_end(copy); } +#ifdef WIN32 + if (level >= LL_FATAL) + { + std::string message; + + char tmp[2048]; + sprintf(tmp, "[%s] %s: ", names[level], component); + message += tmp; + + VALIST out; + va_copy(out, args); + vsprintf(tmp, format, out); + message += tmp; + va_end(out); + + MessageBoxA(NULL, message.c_str(), "SuperTuxKart - Fatal error", MB_OK); + } +#endif + #endif } // printMessage