mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-27 21:49:22 -04:00
filter logs and use existing console
This commit is contained in:
parent
d5cf5f45c3
commit
dbf39567cf
2 changed files with 16 additions and 2 deletions
|
|
@ -87,6 +87,7 @@
|
|||
#include "common/literals.h"
|
||||
#include "common/logging/backend.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/logging/filter.h"
|
||||
#include "common/memory_detect.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/scope_exit.h"
|
||||
|
|
@ -342,6 +343,11 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||
if (i >= args.size() - 1 || args[i + 1].startsWith(QChar::fromLatin1('-'))) {
|
||||
continue;
|
||||
}
|
||||
UISettings::values.show_console = true;
|
||||
Debugger::ToggleConsole();
|
||||
Common::Log::Filter filter;
|
||||
filter.ParseFilterString("*:Warning");
|
||||
Common::Log::SetGlobalFilter(filter);
|
||||
i++;
|
||||
for (; i < args.size(); i++){
|
||||
QFileInfo currPath(args[i]);
|
||||
|
|
@ -362,6 +368,11 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||
if (i >= args.size() - 1 || args[i + 1].startsWith(QChar::fromLatin1('-'))) {
|
||||
continue;
|
||||
}
|
||||
UISettings::values.show_console = true;
|
||||
Debugger::ToggleConsole();
|
||||
Common::Log::Filter filter;
|
||||
filter.ParseFilterString("*:Warning");
|
||||
Common::Log::SetGlobalFilter(filter);
|
||||
i++;
|
||||
for (; i < args.size(); i++){
|
||||
QFileInfo currPath(args[i]);
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ void ToggleConsole() {
|
|||
#ifdef _WIN32
|
||||
FILE* temp;
|
||||
if (UISettings::values.show_console) {
|
||||
BOOL alloc_console_res = AllocConsole();
|
||||
DWORD last_error = 0;
|
||||
BOOL alloc_console_res = AttachConsole(ATTACH_PARENT_PROCESS);
|
||||
if (!alloc_console_res) {
|
||||
last_error = GetLastError();
|
||||
alloc_console_res = AllocConsole();
|
||||
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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue