Initial support for disabling logging, to provide a possible boost in performance for games that spam the log like crazy.

This commit is contained in:
The Dax 2013-07-27 19:39:49 -04:00
parent 8602c276ca
commit 528d81151a
6 changed files with 25 additions and 6 deletions

View File

@ -22,6 +22,7 @@
#include "Timer.h"
#include "Thread.h"
#include "FileUtil.h"
#include "../Core/Config.h"
#ifdef __SYMBIAN32__
#include <e32debug.h>
#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())

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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.