diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index e131968890..85d3f638ff 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -22,6 +22,7 @@ #include "Timer.h" #include "Thread.h" #include "FileUtil.h" +#include "../Core/Config.h" #ifdef __SYMBIAN32__ #include #endif @@ -36,6 +37,8 @@ const char *hleCurrentThreadName = NULL; void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char* fmt, ...) { + if(!g_Config.bEnableLogging) return; + va_list args; va_start(args, fmt); if (LogManager::GetInstance()) diff --git a/Core/Config.cpp b/Core/Config.cpp index 520002dd73..d37af0a3a2 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -50,6 +50,7 @@ void Config::Load(const char *iniFileName) bSpeedLimit = false; general->Get("FirstRun", &bFirstRun, true); general->Get("NewUI", &bNewUI, false); + general->Get("EnableLogging", &bEnableLogging, true); general->Get("AutoLoadLast", &bAutoLoadLast, false); general->Get("AutoRun", &bAutoRun, true); general->Get("Browse", &bBrowse, false); @@ -192,7 +193,7 @@ void Config::Save() bFirstRun = false; general->Set("FirstRun", bFirstRun); general->Set("NewUI", bNewUI); - + general->Set("EnableLogging", bEnableLogging); general->Set("AutoLoadLast", bAutoLoadLast); general->Set("AutoRun", bAutoRun); general->Set("Browse", bBrowse); diff --git a/Core/Config.h b/Core/Config.h index 614c42fba0..de86905455 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -50,6 +50,7 @@ public: bool bNewUI; // "Hidden" setting, does not get saved to ini file. int iNumWorkerThreads; bool bScreenshotsAsPNG; + bool bEnableLogging; // Another "hidden" setting. // Core bool bIgnoreBadMemAccess; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index bcbc795624..b27765aa23 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -291,7 +291,10 @@ void GlobalSettingsScreen::CreateViews() { LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->Add(new ItemHeader("General")); list->Add(new CheckBox(&g_Config.bNewUI, gs->T("Enable New UI"))); - list->Add(new CheckBox(&enableReports_, gs->T("Enable Error Reporting"))); + list->Add(new CheckBox(&g_Config.bEnableLogging, gs->T("Enable Logging"))); + if(g_Config.bEnableLogging) + // No reason to show this if we're not logging at all, but it doesn't draw until one exits and re-enters the settings. + list->Add(new CheckBox(&enableReports_, gs->T("Enable Error Reporting"))); list->Add(new CheckBox(&g_Config.bEnableCheats, gs->T("Enable Cheats"))); list->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, gs->T("Screenshots as PNG"))); list->Add(new Choice(gs->T("Control Mapping")))->OnClick.Handle(this, &GlobalSettingsScreen::OnControlMapping); @@ -339,7 +342,6 @@ void DeveloperToolsScreen::CreateViews() { LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->Add(new ItemHeader(g->T("General"))); list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); - list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack); } diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 0cd747e60f..7e22a9b783 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -769,8 +769,15 @@ void DeveloperScreen::render() { bool reportingEnabled = Reporting::IsEnabled(); const static std::string reportHostOfficial = "report.ppsspp.org"; - if (UICheckBox(GEN_ID, x, y += stride, d->T("Report","Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) { - g_Config.sReportHost = reportingEnabled ? reportHostOfficial : ""; + + UICheckBox(GEN_ID, x, y += stride, d->T("EnableLogging", "Enable Logging"), ALIGN_TOPLEFT, &g_Config.bEnableLogging); + if(g_Config.bEnableLogging) { + if (UICheckBox(GEN_ID, x, y += stride, d->T("Report","Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) { + g_Config.sReportHost = reportingEnabled ? reportHostOfficial : ""; + } + } + else { + g_Config.sReportHost = reportingEnabled ? reportHostOfficial : ""; // Shouldn't be necessary, but just including it for safety.. } UICheckBox(GEN_ID, x, y += stride, d->T("New UI"), ALIGN_TOPLEFT, &g_Config.bNewUI); diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 6ee22231fd..98d0ef489c 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -963,7 +963,9 @@ namespace MainWindow memoryWindow[0]->Show(true); break; case ID_DEBUG_LOG: - LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); + if(g_Config.bEnableLogging) + LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); + //else LogManager::GetInstance()->GetConsoleListener()->Close(); break; case ID_OPTIONS_IGNOREILLEGALREADS: @@ -1304,6 +1306,9 @@ namespace MainWindow EnableMenuItem(menu,ID_TOGGLE_PAUSE, !menuEnable); EnableMenuItem(menu,ID_EMULATION_STOP, !menuEnable); EnableMenuItem(menu,ID_EMULATION_RESET, !menuEnable); + EnableMenuItem(menu, ID_DEBUG_LOG, g_Config.bEnableLogging ? MF_ENABLED : MF_GRAYED); + if(!g_Config.bEnableLogging && !LogManager::GetInstance()->GetConsoleListener()->Hidden()) + LogManager::GetInstance()->GetConsoleListener()->Show(false); } // Message handler for about box.