diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp index daaa448211..4bb9627e30 100644 --- a/src/citra_qt/configuration/configure_general.cpp +++ b/src/citra_qt/configuration/configure_general.cpp @@ -141,10 +141,12 @@ void ConfigureGeneral::ResetDefaults() { tr("Are you sure you want to reset your settings and close Citra?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); - if (answer == QMessageBox::No) + if (answer == QMessageBox::No) { return; + } FileUtil::Delete(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"); + FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "custom"); std::exit(0); } diff --git a/src/citra_qt/configuration/configure_per_game.cpp b/src/citra_qt/configuration/configure_per_game.cpp index 63421550c8..19760fba6c 100644 --- a/src/citra_qt/configuration/configure_per_game.cpp +++ b/src/citra_qt/configuration/configure_per_game.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -13,6 +14,7 @@ #include "citra_qt/configuration/configure_per_game.h" #include "citra_qt/configuration/configure_system.h" #include "citra_qt/util/util.h" +#include "common/file_util.h" #include "core/core.h" #include "core/loader/loader.h" #include "core/loader/smdh.h" @@ -51,11 +53,30 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString &ConfigurePerGame::HandleApplyButtonClicked); } + connect(ui->button_reset_per_game, &QPushButton::clicked, this, + &ConfigurePerGame::ResetDefaults); + LoadConfiguration(); } ConfigurePerGame::~ConfigurePerGame() = default; +void ConfigurePerGame::ResetDefaults() { + const auto config_file_name = title_id == 0 ? filename : fmt::format("{:016X}", title_id); + QMessageBox::StandardButton answer = QMessageBox::question( + this, tr("Citra"), tr("Are you sure you want to reset your settings for this game?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + + if (answer == QMessageBox::No) { + return; + } + + FileUtil::Delete(fmt::format("{}/custom/{}.ini", + FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir), + config_file_name)); + close(); +} + void ConfigurePerGame::ApplyConfiguration() { general_tab->ApplyConfiguration(); system_tab->ApplyConfiguration(); diff --git a/src/citra_qt/configuration/configure_per_game.h b/src/citra_qt/configuration/configure_per_game.h index 9b1b143068..3bc2564b4b 100644 --- a/src/citra_qt/configuration/configure_per_game.h +++ b/src/citra_qt/configuration/configure_per_game.h @@ -43,6 +43,9 @@ public: /// Save all button configurations to settings file void ApplyConfiguration(); + /// Reset the settings for this game + void ResetDefaults(); + private: void changeEvent(QEvent* event) override; void RetranslateUI(); diff --git a/src/citra_qt/configuration/configure_per_game.ui b/src/citra_qt/configuration/configure_per_game.ui index a193afd651..cd5de38c70 100644 --- a/src/citra_qt/configuration/configure_per_game.ui +++ b/src/citra_qt/configuration/configure_per_game.ui @@ -177,6 +177,13 @@ + + + + Reset Game Settings + + +