diff --git a/src/common/config.cpp b/src/common/config.cpp index e856c2f7e..016ba45d0 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -96,6 +96,7 @@ static bool isDebugDump = false; static bool isShaderDebug = false; static bool isSeparateLogFilesEnabled = false; static bool isFpsColor = true; +static bool logEnabled = true; // GUI static bool load_game_size = true; @@ -140,6 +141,10 @@ int* GetControllerCustomColor() { return controllerCustomColorRGB; } +bool getLoggingEnabled() { + return logEnabled; +} + void SetControllerCustomColor(int r, int b, int g) { controllerCustomColorRGB[0] = r; controllerCustomColorRGB[1] = b; @@ -313,6 +318,10 @@ bool fpsColor() { return isFpsColor; } +bool isLoggingEnabled() { + return logEnabled; +} + u32 vblankDiv() { return vblankDivider; } @@ -389,6 +398,10 @@ void setDebugDump(bool enable) { isDebugDump = enable; } +void setLoggingEnabled(bool enable) { + logEnabled = enable; +} + void setCollectShaderForDebug(bool enable) { isShaderDebug = enable; } @@ -738,6 +751,7 @@ void load(const std::filesystem::path& path) { toml::find_or(debug, "isSeparateLogFilesEnabled", isSeparateLogFilesEnabled); isShaderDebug = toml::find_or(debug, "CollectShader", isShaderDebug); isFpsColor = toml::find_or(debug, "FPSColor", isFpsColor); + logEnabled = toml::find_or(debug, "logEnabled", logEnabled); current_version = toml::find_or(debug, "ConfigVersion", current_version); } @@ -893,6 +907,7 @@ void save(const std::filesystem::path& path) { data["Debug"]["CollectShader"] = isShaderDebug; data["Debug"]["isSeparateLogFilesEnabled"] = isSeparateLogFilesEnabled; data["Debug"]["FPSColor"] = isFpsColor; + data["Debug"]["logEnabled"] = logEnabled; data["Debug"]["ConfigVersion"] = config_version; data["Keys"]["TrophyKey"] = trophyKey; @@ -1005,6 +1020,7 @@ void setDefaultValues() { isShaderDebug = false; isSeparateLogFilesEnabled = false; isFpsColor = true; + logEnabled = true; // GUI load_game_size = true; diff --git a/src/common/config.h b/src/common/config.h index e93c189fe..8a5db1dc9 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -111,6 +111,8 @@ std::string getDefaultControllerID(); void setDefaultControllerID(std::string id); bool getBackgroundControllerInput(); void setBackgroundControllerInput(bool enable); +bool getLoggingEnabled(); +void setLoggingEnabled(bool enable); // TODO bool GetLoadGameSizeEnabled(); diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index c16a5399a..2bb4c6a4a 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -191,7 +191,7 @@ public: } } - if (!filter.CheckMessage(log_class, log_level)) { + if (!filter.CheckMessage(log_class, log_level) || !Config::getLoggingEnabled()) { return; } diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index a52ee1ff3..e5b605f9c 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -428,6 +428,7 @@ SettingsDialog::SettingsDialog(std::shared_ptr gui_settings, ui->readbacksCheckBox->installEventFilter(this); ui->readbackLinearImagesCheckBox->installEventFilter(this); ui->separateLogFilesCheckbox->installEventFilter(this); + ui->enableLoggingCheckBox->installEventFilter(this); } } @@ -547,6 +548,7 @@ void SettingsDialog::LoadValuesFromConfig() { ui->collectShaderCheckBox->setChecked( toml::find_or(data, "Debug", "CollectShader", false)); ui->readbacksCheckBox->setChecked(toml::find_or(data, "GPU", "readbacks", false)); + ui->enableLoggingCheckBox->setChecked(toml::find_or(data, "Debug", "logEnabled", true)); ui->readbackLinearImagesCheckBox->setChecked( toml::find_or(data, "GPU", "readbackLinearImages", false)); ui->enableCompatibilityCheckBox->setChecked( @@ -774,7 +776,9 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) { } else if (elementName == "readbackLinearImagesCheckBox") { text = tr("Enable Readback Linear Images:\\nEnables async downloading of GPU modified linear images.\\nMight fix issues in some games."); } else if (elementName == "separateLogFilesCheckbox") { - text = tr("Separate Log Files:\\nWrites a separate logfile for each game.");} + text = tr("Separate Log Files:\\nWrites a separate logfile for each game."); + } else if (elementName == "enableLoggingCheckBox") { + text = tr("Enable Logging:\\nEnables logging.\\nDo not change this if you do not know what you're doing!\\nWhen asking for help, make sure this setting is ENABLED."); } // clang-format on ui->descriptionText->setText(text.replace("\\n", "\n")); } @@ -816,6 +820,7 @@ void SettingsDialog::UpdateSettings() { Config::setSideTrophy("bottom"); } m_gui_settings->SetValue(gui::gl_playBackgroundMusic, ui->playBGMCheckBox->isChecked()); + Config::setLoggingEnabled(ui->enableLoggingCheckBox->isChecked()); Config::setAllowHDR(ui->enableHDRCheckBox->isChecked()); Config::setLogType(logTypeMap.value(ui->logTypeComboBox->currentText()).toStdString()); Config::setMicDevice(ui->micComboBox->currentData().toString().toStdString()); diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index dbc771776..703c21815 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -59,7 +59,7 @@ - 0 + 6 @@ -73,8 +73,8 @@ 0 0 - 946 - 536 + 679 + 420 @@ -369,8 +369,8 @@ 0 0 - 400 - 68 + 149 + 69 @@ -538,8 +538,8 @@ 0 0 - 946 - 536 + 626 + 370 @@ -987,8 +987,8 @@ 0 0 - 946 - 536 + 553 + 244 @@ -1282,8 +1282,8 @@ 0 0 - 946 - 536 + 485 + 348 @@ -1524,8 +1524,8 @@ 0 0 - 946 - 536 + 515 + 228 @@ -1796,8 +1796,8 @@ 0 0 - 946 - 536 + 421 + 319 @@ -1938,8 +1938,8 @@ 0 0 - 946 - 536 + 944 + 537 @@ -2013,6 +2013,20 @@ Logger + + + + Enable Logging + + + + + + + Separate Log Files + + + @@ -2146,13 +2160,6 @@ - - - - Separate Log Files - - -