diff options
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index b4e3ad964..1299338ac 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #include <thread> | ||
| 2 | |||
| 1 | #include <QtGui> | 3 | #include <QtGui> |
| 2 | #include <QDesktopWidget> | 4 | #include <QDesktopWidget> |
| 3 | #include <QFileDialog> | 5 | #include <QFileDialog> |
| @@ -5,8 +7,13 @@ | |||
| 5 | #include "main.hxx" | 7 | #include "main.hxx" |
| 6 | 8 | ||
| 7 | #include "common/common.h" | 9 | #include "common/common.h" |
| 10 | #include "common/logging/text_formatter.h" | ||
| 11 | #include "common/logging/log.h" | ||
| 12 | #include "common/logging/backend.h" | ||
| 13 | #include "common/logging/filter.h" | ||
| 8 | #include "common/platform.h" | 14 | #include "common/platform.h" |
| 9 | #include "common/log_manager.h" | 15 | #include "common/scope_exit.h" |
| 16 | |||
| 10 | #if EMU_PLATFORM == PLATFORM_LINUX | 17 | #if EMU_PLATFORM == PLATFORM_LINUX |
| 11 | #include <unistd.h> | 18 | #include <unistd.h> |
| 12 | #endif | 19 | #endif |
| @@ -33,18 +40,12 @@ | |||
| 33 | 40 | ||
| 34 | #include "version.h" | 41 | #include "version.h" |
| 35 | 42 | ||
| 36 | |||
| 37 | GMainWindow::GMainWindow() | 43 | GMainWindow::GMainWindow() |
| 38 | { | 44 | { |
| 39 | LogManager::Init(); | ||
| 40 | |||
| 41 | Pica::g_debug_context = Pica::DebugContext::Construct(); | 45 | Pica::g_debug_context = Pica::DebugContext::Construct(); |
| 42 | 46 | ||
| 43 | Config config; | 47 | Config config; |
| 44 | 48 | ||
| 45 | if (!Settings::values.enable_log) | ||
| 46 | LogManager::Shutdown(); | ||
| 47 | |||
| 48 | ui.setupUi(this); | 49 | ui.setupUi(this); |
| 49 | statusBar()->hide(); | 50 | statusBar()->hide(); |
| 50 | 51 | ||
| @@ -153,18 +154,18 @@ GMainWindow::~GMainWindow() | |||
| 153 | 154 | ||
| 154 | void GMainWindow::BootGame(std::string filename) | 155 | void GMainWindow::BootGame(std::string filename) |
| 155 | { | 156 | { |
| 156 | NOTICE_LOG(MASTER_LOG, "Citra starting...\n"); | 157 | LOG_INFO(Frontend, "Citra starting...\n"); |
| 157 | System::Init(render_window); | 158 | System::Init(render_window); |
| 158 | 159 | ||
| 159 | if (Core::Init()) { | 160 | if (Core::Init()) { |
| 160 | ERROR_LOG(MASTER_LOG, "Core initialization failed, exiting..."); | 161 | LOG_CRITICAL(Frontend, "Core initialization failed, exiting..."); |
| 161 | Core::Stop(); | 162 | Core::Stop(); |
| 162 | exit(1); | 163 | exit(1); |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | // Load a game or die... | 166 | // Load a game or die... |
| 166 | if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { | 167 | if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { |
| 167 | ERROR_LOG(BOOT, "Failed to load ROM!"); | 168 | LOG_CRITICAL(Frontend, "Failed to load ROM!"); |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | disasmWidget->Init(); | 171 | disasmWidget->Init(); |
| @@ -271,9 +272,21 @@ void GMainWindow::closeEvent(QCloseEvent* event) | |||
| 271 | 272 | ||
| 272 | int __cdecl main(int argc, char* argv[]) | 273 | int __cdecl main(int argc, char* argv[]) |
| 273 | { | 274 | { |
| 275 | std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); | ||
| 276 | Log::Filter log_filter(Log::Level::Info); | ||
| 277 | std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter); | ||
| 278 | SCOPE_EXIT({ | ||
| 279 | logger->Close(); | ||
| 280 | logging_thread.join(); | ||
| 281 | }); | ||
| 282 | |||
| 274 | QApplication::setAttribute(Qt::AA_X11InitThreads); | 283 | QApplication::setAttribute(Qt::AA_X11InitThreads); |
| 275 | QApplication app(argc, argv); | 284 | QApplication app(argc, argv); |
| 285 | |||
| 276 | GMainWindow main_window; | 286 | GMainWindow main_window; |
| 287 | // After settings have been loaded by GMainWindow, apply the filter | ||
| 288 | log_filter.ParseFilterString(Settings::values.log_filter); | ||
| 289 | |||
| 277 | main_window.show(); | 290 | main_window.show(); |
| 278 | return app.exec(); | 291 | return app.exec(); |
| 279 | } | 292 | } |