summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2017-03-22 13:32:24 +0100
committerLéo Lam <leo@innovatetechnologi.es>2017-03-25 23:28:45 +0100
commitc1cd7d9c0ea54cc2d11b27ee9f207f04bbcd75cc (patch)
tree1d4cdd6de3f26213066949a12049da8a889b3369 /Source/Core
parent77b389bf997e3816f50b08d89ade9e347c002a19 (diff)
WX: Redirect stdout to console output
Thank Windows for its default console handling. This fixes std::cout not working on Windows.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/Main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 37bd1b63bd..91133a4e57 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -107,6 +107,16 @@ bool DolphinApp::OnInit()
wxHandleFatalExceptions(true);
#endif
+#ifdef _WIN32
+ const bool console_attached = AttachConsole(ATTACH_PARENT_PROCESS) != FALSE;
+ HANDLE stdout_handle = ::GetStdHandle(STD_OUTPUT_HANDLE);
+ if (console_attached && stdout_handle)
+ {
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ }
+#endif
+
ParseCommandLine();
std::lock_guard<std::mutex> lk(s_init_mutex);