diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp index 98d06b5c52..f4652da86f 100644 --- a/Utilities/Log.cpp +++ b/Utilities/Log.cpp @@ -9,7 +9,7 @@ using namespace Log; -LogManager *gLogManager = nullptr; +std::unique_ptr g_log_manager; u32 LogMessage::size() const { @@ -224,6 +224,7 @@ void LogManager::addListener(std::shared_ptr listener) channel.addListener(listener); } } + void LogManager::removeListener(std::shared_ptr listener) { for (auto& channel : mChannels) @@ -234,12 +235,14 @@ void LogManager::removeListener(std::shared_ptr listener) LogManager& LogManager::getInstance() { - if (!gLogManager) + if (!g_log_manager) { - gLogManager = new LogManager(); + g_log_manager.reset(new LogManager()); } - return *gLogManager; + + return *g_log_manager; } + LogChannel &LogManager::getChannel(LogType type) { return mChannels[static_cast(type)]; @@ -252,9 +255,22 @@ void log_message(Log::LogType type, Log::LogSeverity sev, const char* text) void log_message(Log::LogType type, Log::LogSeverity sev, std::string text) { - //another msvc bug makes this not work, uncomment this and delete everything else in this function when it's fixed - //Log::LogManager::getInstance().log({logType, severity, text}) - - Log::LogMessage msg{ type, sev, std::move(text) }; - Log::LogManager::getInstance().log(msg); + if (g_log_manager) + { + // another msvc bug makes this not work, uncomment this when it's fixed + //g_log_manager->log({logType, severity, text}); + Log::LogMessage msg{ type, sev, std::move(text) }; + g_log_manager->log(msg); + } + else + { + rMessageBox(text, + sev == Notice ? "Notice" : + sev == Warning ? "Warning" : + sev == Success ? "Success" : + sev == Error ? "Error" : "Unknown", + sev == Notice ? rICON_INFORMATION : + sev == Warning ? rICON_EXCLAMATION : + sev == Error ? rICON_ERROR : rICON_INFORMATION); + } } diff --git a/Utilities/Thread.h b/Utilities/Thread.h index d41900a621..7de4c657cd 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -1,7 +1,5 @@ #pragma once -static std::thread::id main_thread; - class NamedThreadBase { std::string m_name; diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index f724cc3513..924647c1c8 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -122,9 +122,9 @@ MainFrame::MainFrame() SetMenuBar(menubar); // Panels + m_log_frame = new LogFrame(this); m_game_viewer = new GameViewer(this); m_debugger_frame = new DebuggerPanel(this); - m_log_frame = new LogFrame(this); AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE); AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM); diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 2af0677da0..20a5c9d01f 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -148,8 +148,6 @@ bool Rpcs3App::OnInit() const wxString executablePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()); wxSetWorkingDirectory(executablePath); - main_thread = std::this_thread::get_id(); - Ini.Load(); Emu.Init(); Emu.SetEmulatorPath(executablePath.ToStdString());