Browse Source

Reverted PrintLine() to use printf() to allow seeing the tools' intermediate output in the MSVC output window.
Make sure that minidump code is only compiled in on MSVC.

Lasse Öörni 13 years ago
parent
commit
e10da28c4b

+ 1 - 1
Engine/Core/MiniDump.cpp

@@ -23,7 +23,7 @@
 
 #include "Precompiled.h"
 
-#ifdef ENABLE_MINIDUMPS
+#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
 
 #include "ProcessUtils.h"
 

+ 1 - 1
Engine/Core/MiniDump.h

@@ -23,7 +23,7 @@
 
 #pragma once
 
-#ifdef ENABLE_MINIDUMPS
+#if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS)
 /// Write a minidump. Needs to be called from within a structured exception handler.
 int WriteMiniDump(const char* applicationName, void* exceptionPointers);
 #endif

+ 10 - 5
Engine/Core/ProcessUtils.cpp

@@ -108,7 +108,7 @@ void ErrorDialog(const String& title, const String& message)
 
 void ErrorExit(const String& message, int exitCode)
 {
-    PrintRaw(message);
+    PrintLine(message);
     exit(exitCode);
 }
 
@@ -136,7 +136,7 @@ void OpenConsoleWindow()
     #endif
 }
 
-void PrintRaw(const String& str)
+void PrintUnicode(const String& str)
 {
     #ifdef WIN32
     HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -150,9 +150,14 @@ void PrintRaw(const String& str)
     #endif
 }
 
+void PrintUnicodeLine(const String& str)
+{
+    PrintUnicode(str + '\n');
+}
+
 void PrintLine(const String& str)
 {
-    PrintRaw(str + '\n');
+    printf("%s\n", str.CString());
 }
 
 const Vector<String>& ParseArguments(const String& cmdLine)
@@ -263,14 +268,14 @@ String GetConsoleInput()
             {
                 if (c == '\b')
                 {
-                    PrintRaw("\b \b");
+                    PrintUnicode("\b \b");
                     int length = currentLine.LengthUTF8();
                     if (length)
                         currentLine = currentLine.SubstringUTF8(0, length - 1);
                 }
                 else if (c == '\r')
                 {
-                    PrintRaw("\n");
+                    PrintUnicode("\n");
                     ret = currentLine;
                     currentLine.Clear();
                     return ret;

+ 5 - 3
Engine/Core/ProcessUtils.h

@@ -35,9 +35,11 @@ void ErrorDialog(const String& title, const String& message);
 void ErrorExit(const String& message, int exitCode = 1);
 /// Open a console window.
 void OpenConsoleWindow();
-/// Print to the console without adding a newline.
-void PrintRaw(const String& str);
-/// Print to the console. A newline will be added automatically.
+/// Print Unicode text to the console. Will not be printed to the MSVC output window.
+void PrintUnicode(const String& str);
+/// Print Unicode text to the console with a newline appended. Will not be printed to the MSVC output window.
+void PrintUnicodeLine(const String& str);
+/// Print ASCII text to the console with a newline appended. Uses printf() to allow printing into the MSVC output window.
 void PrintLine(const String& str);
 /// Parse arguments from the command line.
 const Vector<String>& ParseArguments(const String& cmdLine);

+ 2 - 2
Engine/IO/Log.cpp

@@ -92,7 +92,7 @@ void Log::Write(int level, const String& message)
     String dateTimeString = String(dateTime).Replaced("\n", "");
     String formattedMessage = "[" + dateTimeString + "] " + levelPrefixes[level] + ": " + message;
     
-    PrintLine(formattedMessage);
+    PrintUnicodeLine(formattedMessage);
     
     if (logFile_)
         logFile_->WriteLine(formattedMessage);
@@ -115,7 +115,7 @@ void Log::WriteRaw(const String& message)
     inWrite_ = true;
     lastMessage_ = message;
     
-    PrintRaw(message);
+    PrintUnicode(message);
     
     if (logFile_)
     {

+ 4 - 2
Urho3D/Urho3D.cpp

@@ -49,12 +49,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, in
     
     ParseArguments(GetCommandLineW());
     
-    #if defined(ENABLE_MINIDUMPS) && !defined(_DEBUG)
+    #if defined(_MSC_VER) && defined(ENABLE_MINIDUMPS) && !defined(_DEBUG)
     __try
     {
         Run();
     }
-    __except(WriteMiniDump("Urho3D", GetExceptionInformation())) {}
+    __except(WriteMiniDump("Urho3D", GetExceptionInformation()))
+    {
+    }
     #else
     Run();
     #endif