From df9c8bdfd9019a42ede7ea90198567ae499afac8 Mon Sep 17 00:00:00 2001
From: Narr the Reg <juangerman-13@hotmail.com>
Date: Thu, 16 Feb 2023 10:53:42 -0600
Subject: [PATCH] yuzu: Write to config file on important config changes

---
 src/yuzu/configuration/config.cpp | 1 +
 src/yuzu/game_list.cpp            | 1 +
 src/yuzu/game_list.h              | 1 +
 src/yuzu/main.cpp                 | 4 ++++
 4 files changed, 7 insertions(+)

diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 31209fb2e5..db68ed259d 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -1103,6 +1103,7 @@ void Config::SaveValues() {
     SaveRendererValues();
     SaveAudioValues();
     SaveSystemValues();
+    qt_config->sync();
 }
 
 void Config::SaveAudioValues() {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 22aa19c56d..c21828b1d0 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -870,6 +870,7 @@ void GameList::ToggleFavorite(u64 program_id) {
             tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true);
         }
     }
+    SaveConfig();
 }
 
 void GameList::AddFavorite(u64 program_id) {
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index f7ff93ed95..64e5af4c19 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -122,6 +122,7 @@ signals:
     void AddDirectory();
     void ShowList(bool show);
     void PopulatingCompleted();
+    void SaveConfig();
 
 private slots:
     void OnItemExpanded(const QModelIndex& item);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index a1c18ff90d..c2542c3bab 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1271,6 +1271,7 @@ void GMainWindow::ConnectWidgetEvents() {
     connect(game_list, &GameList::ShowList, this, &GMainWindow::OnGameListShowList);
     connect(game_list, &GameList::PopulatingCompleted,
             [this] { multiplayer_state->UpdateGameList(game_list->GetModel()); });
+    connect(game_list, &GameList::SaveConfig, this, &GMainWindow::OnSaveConfig);
 
     connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
             &GMainWindow::OnGameListOpenPerGameProperties);
@@ -2654,6 +2655,8 @@ void GMainWindow::OnGameListAddDirectory() {
     } else {
         LOG_WARNING(Frontend, "Selected directory is already in the game list");
     }
+
+    OnSaveConfig();
 }
 
 void GMainWindow::OnGameListShowList(bool show) {
@@ -3380,6 +3383,7 @@ void GMainWindow::OnConfigureTas() {
         return;
     } else if (result == QDialog::Accepted) {
         dialog.ApplyConfiguration();
+        OnSaveConfig();
     }
 }