| |
| |
| |
|
|
| #ifdef _WIN32 |
| #include <windows.h> |
|
|
| #include <wincon.h> |
| #endif |
|
|
| #include "citra_qt/debugger/console.h" |
| #include "citra_qt/uisettings.h" |
| #include "common/logging/backend.h" |
|
|
| namespace Debugger { |
| void ToggleConsole() { |
| static bool console_shown = false; |
| if (console_shown == UISettings::values.show_console.GetValue()) { |
| return; |
| } else { |
| console_shown = UISettings::values.show_console.GetValue(); |
| } |
|
|
| using namespace Common::Log; |
| #ifdef _WIN32 |
| FILE* temp; |
| if (UISettings::values.show_console) { |
| if (AllocConsole()) { |
| |
| freopen_s(&temp, "CONIN$", "r", stdin); |
| freopen_s(&temp, "CONOUT$", "w", stdout); |
| freopen_s(&temp, "CONOUT$", "w", stderr); |
| SetColorConsoleBackendEnabled(true); |
| } |
| } else { |
| if (FreeConsole()) { |
| |
| |
| SetColorConsoleBackendEnabled(false); |
| freopen_s(&temp, "NUL", "r", stdin); |
| freopen_s(&temp, "NUL", "w", stdout); |
| freopen_s(&temp, "NUL", "w", stderr); |
| } |
| } |
| #else |
| SetColorConsoleBackendEnabled(UISettings::values.show_console.GetValue()); |
| #endif |
| } |
| } |
|
|