committed by
bunnei
14 changed files with 408 additions and 22 deletions
-
3src/common/common_paths.h
-
13src/common/file_util.cpp
-
11src/common/file_util.h
-
155src/common/logging/backend.cpp
-
85src/common/logging/backend.h
-
10src/yuzu/CMakeLists.txt
-
3src/yuzu/configuration/config.cpp
-
22src/yuzu/configuration/configure_debug.cpp
-
41src/yuzu/configuration/configure_debug.ui
-
45src/yuzu/debugger/console.cpp
-
14src/yuzu/debugger/console.h
-
10src/yuzu/main.cpp
-
3src/yuzu/ui_settings.h
-
7src/yuzu_cmd/yuzu.cpp
@ -0,0 +1,45 @@ |
|||||
|
// Copyright 2018 yuzu Emulator Project
|
||||
|
// Licensed under GPLv2 or any later version
|
||||
|
// Refer to the license.txt file included.
|
||||
|
|
||||
|
#ifdef _WIN32
|
||||
|
#include <windows.h>
|
||||
|
|
||||
|
#include <wincon.h>
|
||||
|
#endif
|
||||
|
|
||||
|
#include "common/logging/backend.h"
|
||||
|
#include "yuzu/debugger/console.h"
|
||||
|
#include "yuzu/ui_settings.h"
|
||||
|
|
||||
|
namespace Debugger { |
||||
|
void ToggleConsole() { |
||||
|
#if defined(_WIN32) && !defined(_DEBUG)
|
||||
|
FILE* temp; |
||||
|
if (UISettings::values.show_console) { |
||||
|
if (AllocConsole()) { |
||||
|
// The first parameter for freopen_s is a out parameter, so we can just ignore it
|
||||
|
freopen_s(&temp, "CONIN$", "r", stdin); |
||||
|
freopen_s(&temp, "CONOUT$", "w", stdout); |
||||
|
freopen_s(&temp, "CONOUT$", "w", stderr); |
||||
|
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); |
||||
|
} |
||||
|
} else { |
||||
|
if (FreeConsole()) { |
||||
|
// In order to close the console, we have to also detach the streams on it.
|
||||
|
// Just redirect them to NUL if there is no console window
|
||||
|
Log::RemoveBackend(Log::ColorConsoleBackend::Name()); |
||||
|
freopen_s(&temp, "NUL", "r", stdin); |
||||
|
freopen_s(&temp, "NUL", "w", stdout); |
||||
|
freopen_s(&temp, "NUL", "w", stderr); |
||||
|
} |
||||
|
} |
||||
|
#else
|
||||
|
if (UISettings::values.show_console) { |
||||
|
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); |
||||
|
} else { |
||||
|
Log::RemoveBackend(Log::ColorConsoleBackend::Name()); |
||||
|
} |
||||
|
#endif
|
||||
|
} |
||||
|
} // namespace Debugger
|
||||
@ -0,0 +1,14 @@ |
|||||
|
// Copyright 2018 yuzu Emulator Project |
||||
|
// Licensed under GPLv2 or any later version |
||||
|
// Refer to the license.txt file included. |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
namespace Debugger { |
||||
|
|
||||
|
/** |
||||
|
* Uses the WINAPI to hide or show the stderr console. This function is a placeholder until we can |
||||
|
* get a real qt logging window which would work for all platforms. |
||||
|
*/ |
||||
|
void ToggleConsole(); |
||||
|
} // namespace Debugger |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue