diff --git a/Source/Core/Core/Config/UISettings.cpp b/Source/Core/Core/Config/UISettings.cpp index 881868433c..c15b19a601 100644 --- a/Source/Core/Core/Config/UISettings.cpp +++ b/Source/Core/Core/Config/UISettings.cpp @@ -15,5 +15,6 @@ const Info MAIN_USE_GAME_COVERS{{System::Main, "General", "UseGameCovers"} #endif const Info MAIN_FOCUSED_HOTKEYS{{System::Main, "General", "HotkeysRequireFocus"}, true}; const Info MAIN_RECURSIVE_ISO_PATHS{{System::Main, "General", "RecursiveISOPaths"}, false}; +const Info MAIN_CURRENT_STATE_PATH{{System::Main, "General", "CurrentStatePath"}, ""}; } // namespace Config diff --git a/Source/Core/Core/Config/UISettings.h b/Source/Core/Core/Config/UISettings.h index 4bcc0a0d71..79aec6ffda 100644 --- a/Source/Core/Core/Config/UISettings.h +++ b/Source/Core/Core/Config/UISettings.h @@ -19,5 +19,6 @@ extern const Info MAIN_USE_DISCORD_PRESENCE; extern const Info MAIN_USE_GAME_COVERS; extern const Info MAIN_FOCUSED_HOTKEYS; extern const Info MAIN_RECURSIVE_ISO_PATHS; +extern const Info MAIN_CURRENT_STATE_PATH; } // namespace Config diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 72b075f12b..ff028f5d37 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -45,6 +45,7 @@ #include "Core/Config/AchievementSettings.h" #include "Core/Config/MainSettings.h" #include "Core/Config/NetplaySettings.h" +#include "Core/Config/UISettings.h" #include "Core/Config/WiimoteSettings.h" #include "Core/Core.h" #include "Core/FreeLookManager.h" @@ -1404,18 +1405,24 @@ void MainWindow::ShowInfinityBase() void MainWindow::StateLoad() { - QString path = - DolphinFileDialog::getOpenFileName(this, tr("Select a File"), QDir::currentPath(), - tr("All Save States (*.sav *.s##);; All Files (*)")); + QString dialog_path = (Config::Get(Config::MAIN_CURRENT_STATE_PATH).empty()) ? + QDir::currentPath() : + QString::fromStdString(Config::Get(Config::MAIN_CURRENT_STATE_PATH)); + QString path = DolphinFileDialog::getOpenFileName( + this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)")); + Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString()); if (!path.isEmpty()) State::LoadAs(path.toStdString()); } void MainWindow::StateSave() { - QString path = - DolphinFileDialog::getSaveFileName(this, tr("Select a File"), QDir::currentPath(), - tr("All Save States (*.sav *.s##);; All Files (*)")); + QString dialog_path = (Config::Get(Config::MAIN_CURRENT_STATE_PATH).empty()) ? + QDir::currentPath() : + QString::fromStdString(Config::Get(Config::MAIN_CURRENT_STATE_PATH)); + QString path = DolphinFileDialog::getSaveFileName( + this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)")); + Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString()); if (!path.isEmpty()) State::SaveAs(path.toStdString()); }