Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Fix showing color console if debugger attached on windows. (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloMK7 authored Apr 22, 2024
1 parent d063f26 commit a8e601a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/citra_qt/debugger/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ void ToggleConsole() {
#ifdef _WIN32
FILE* temp;
if (UISettings::values.show_console) {
if (AllocConsole()) {
BOOL alloc_console_res = AllocConsole();
DWORD last_error = 0;
if (!alloc_console_res) {
last_error = GetLastError();
}
// If the windows debugger already opened a console, calling AllocConsole again
// will cause ERROR_ACCESS_DENIED. If that's the case assume a console is open.
if (alloc_console_res || last_error == ERROR_ACCESS_DENIED) {
// 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);
Expand Down

0 comments on commit a8e601a

Please sign in to comment.