diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/settings.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 18 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 27 | ||||
| -rw-r--r-- | src/yuzu/main.h | 7 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 19 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 6 |
6 files changed, 79 insertions, 0 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index ed6f42471..5bf1863e6 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -127,6 +127,8 @@ struct Values { | |||
| 127 | 127 | ||
| 128 | // Data Storage | 128 | // Data Storage |
| 129 | bool use_virtual_sd; | 129 | bool use_virtual_sd; |
| 130 | std::string nand_dir; | ||
| 131 | std::string sdmc_dir; | ||
| 130 | 132 | ||
| 131 | // Renderer | 133 | // Renderer |
| 132 | float resolution_factor; | 134 | float resolution_factor; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 60b6d6d44..c43e79e78 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -102,6 +102,20 @@ void Config::ReadValues() { | |||
| 102 | 102 | ||
| 103 | qt_config->beginGroup("Data Storage"); | 103 | qt_config->beginGroup("Data Storage"); |
| 104 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); | 104 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); |
| 105 | FileUtil::GetUserPath( | ||
| 106 | FileUtil::UserPath::NANDDir, | ||
| 107 | qt_config | ||
| 108 | ->value("nand_directory", | ||
| 109 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))) | ||
| 110 | .toString() | ||
| 111 | .toStdString()); | ||
| 112 | FileUtil::GetUserPath( | ||
| 113 | FileUtil::UserPath::SDMCDir, | ||
| 114 | qt_config | ||
| 115 | ->value("sdmc_directory", | ||
| 116 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))) | ||
| 117 | .toString() | ||
| 118 | .toStdString()); | ||
| 105 | qt_config->endGroup(); | 119 | qt_config->endGroup(); |
| 106 | 120 | ||
| 107 | qt_config->beginGroup("System"); | 121 | qt_config->beginGroup("System"); |
| @@ -222,6 +236,10 @@ void Config::SaveValues() { | |||
| 222 | 236 | ||
| 223 | qt_config->beginGroup("Data Storage"); | 237 | qt_config->beginGroup("Data Storage"); |
| 224 | qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); | 238 | qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); |
| 239 | qt_config->setValue("nand_directory", | ||
| 240 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))); | ||
| 241 | qt_config->setValue("sdmc_directory", | ||
| 242 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); | ||
| 225 | qt_config->endGroup(); | 243 | qt_config->endGroup(); |
| 226 | 244 | ||
| 227 | qt_config->beginGroup("System"); | 245 | qt_config->beginGroup("System"); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c6f170cd7..262e33487 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #define QT_NO_OPENGL | 13 | #define QT_NO_OPENGL |
| 14 | #include <QDesktopWidget> | 14 | #include <QDesktopWidget> |
| 15 | #include <QDialogButtonBox> | ||
| 15 | #include <QFileDialog> | 16 | #include <QFileDialog> |
| 16 | #include <QMessageBox> | 17 | #include <QMessageBox> |
| 17 | #include <QtGui> | 18 | #include <QtGui> |
| @@ -374,6 +375,10 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 374 | &GMainWindow::OnMenuInstallToNAND); | 375 | &GMainWindow::OnMenuInstallToNAND); |
| 375 | connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, | 376 | connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, |
| 376 | &GMainWindow::OnMenuSelectGameListRoot); | 377 | &GMainWindow::OnMenuSelectGameListRoot); |
| 378 | connect(ui.action_Select_NAND_Directory, &QAction::triggered, this, | ||
| 379 | [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::NAND); }); | ||
| 380 | connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this, | ||
| 381 | [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::SDMC); }); | ||
| 377 | connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); | 382 | connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); |
| 378 | 383 | ||
| 379 | // Emulation | 384 | // Emulation |
| @@ -889,6 +894,28 @@ void GMainWindow::OnMenuSelectGameListRoot() { | |||
| 889 | } | 894 | } |
| 890 | } | 895 | } |
| 891 | 896 | ||
| 897 | void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target) { | ||
| 898 | const auto res = QMessageBox::information( | ||
| 899 | this, tr("Changing Emulated Directory"), | ||
| 900 | tr("You are about to change the emulated %1 directory of the system. Please note " | ||
| 901 | "that this does not also move the contents of the previous directory to the " | ||
| 902 | "new one and you will have to do that yourself.") | ||
| 903 | .arg(target == EmulatedDirectoryTarget::SDMC ? tr("SD card") : tr("NAND")), | ||
| 904 | QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel}); | ||
| 905 | |||
| 906 | if (res == QMessageBox::Cancel) | ||
| 907 | return; | ||
| 908 | |||
| 909 | QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); | ||
| 910 | if (!dir_path.isEmpty()) { | ||
| 911 | FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir | ||
| 912 | : FileUtil::UserPath::NANDDir, | ||
| 913 | dir_path.toStdString()); | ||
| 914 | Service::FileSystem::CreateFactories(vfs); | ||
| 915 | game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); | ||
| 916 | } | ||
| 917 | } | ||
| 918 | |||
| 892 | void GMainWindow::OnMenuRecentFile() { | 919 | void GMainWindow::OnMenuRecentFile() { |
| 893 | QAction* action = qobject_cast<QAction*>(sender()); | 920 | QAction* action = qobject_cast<QAction*>(sender()); |
| 894 | assert(action); | 921 | assert(action); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 29bc6e004..089ea2445 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -35,6 +35,11 @@ namespace Tegra { | |||
| 35 | class DebugContext; | 35 | class DebugContext; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | enum class EmulatedDirectoryTarget { | ||
| 39 | NAND, | ||
| 40 | SDMC, | ||
| 41 | }; | ||
| 42 | |||
| 38 | class GMainWindow : public QMainWindow { | 43 | class GMainWindow : public QMainWindow { |
| 39 | Q_OBJECT | 44 | Q_OBJECT |
| 40 | 45 | ||
| @@ -140,6 +145,8 @@ private slots: | |||
| 140 | void OnMenuInstallToNAND(); | 145 | void OnMenuInstallToNAND(); |
| 141 | /// Called whenever a user selects the "File->Select Game List Root" menu item | 146 | /// Called whenever a user selects the "File->Select Game List Root" menu item |
| 142 | void OnMenuSelectGameListRoot(); | 147 | void OnMenuSelectGameListRoot(); |
| 148 | /// Called whenever a user select the "File->Select -- Directory" where -- is NAND or SD Card | ||
| 149 | void OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target); | ||
| 143 | void OnMenuRecentFile(); | 150 | void OnMenuRecentFile(); |
| 144 | void OnConfigure(); | 151 | void OnConfigure(); |
| 145 | void OnAbout(); | 152 | void OnAbout(); |
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index faa0c626a..3879d4813 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -65,6 +65,9 @@ | |||
| 65 | <addaction name="action_Select_Game_List_Root"/> | 65 | <addaction name="action_Select_Game_List_Root"/> |
| 66 | <addaction name="menu_recent_files"/> | 66 | <addaction name="menu_recent_files"/> |
| 67 | <addaction name="separator"/> | 67 | <addaction name="separator"/> |
| 68 | <addaction name="action_Select_NAND_Directory"/> | ||
| 69 | <addaction name="action_Select_SDMC_Directory"/> | ||
| 70 | <addaction name="separator"/> | ||
| 68 | <addaction name="action_Exit"/> | 71 | <addaction name="action_Exit"/> |
| 69 | </widget> | 72 | </widget> |
| 70 | <widget class="QMenu" name="menu_Emulation"> | 73 | <widget class="QMenu" name="menu_Emulation"> |
| @@ -204,6 +207,22 @@ | |||
| 204 | <string>Selects a folder to display in the game list</string> | 207 | <string>Selects a folder to display in the game list</string> |
| 205 | </property> | 208 | </property> |
| 206 | </action> | 209 | </action> |
| 210 | <action name="action_Select_NAND_Directory"> | ||
| 211 | <property name="text"> | ||
| 212 | <string>Select NAND Directory...</string> | ||
| 213 | </property> | ||
| 214 | <property name="toolTip"> | ||
| 215 | <string>Selects a folder to use as the root of the emulated NAND</string> | ||
| 216 | </property> | ||
| 217 | </action> | ||
| 218 | <action name="action_Select_SDMC_Directory"> | ||
| 219 | <property name="text"> | ||
| 220 | <string>Select SD Card Directory...</string> | ||
| 221 | </property> | ||
| 222 | <property name="toolTip"> | ||
| 223 | <string>Selects a folder to use as the root of the emulated SD card</string> | ||
| 224 | </property> | ||
| 225 | </action> | ||
| 207 | <action name="action_Fullscreen"> | 226 | <action name="action_Fullscreen"> |
| 208 | <property name="checkable"> | 227 | <property name="checkable"> |
| 209 | <bool>true</bool> | 228 | <bool>true</bool> |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index a95580152..f00b5a66b 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -114,6 +114,12 @@ void Config::ReadValues() { | |||
| 114 | // Data Storage | 114 | // Data Storage |
| 115 | Settings::values.use_virtual_sd = | 115 | Settings::values.use_virtual_sd = |
| 116 | sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); | 116 | sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); |
| 117 | FileUtil::GetUserPath(FileUtil::UserPath::NANDDir, | ||
| 118 | sdl2_config->Get("Data Storage", "nand_directory", | ||
| 119 | FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))); | ||
| 120 | FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir, | ||
| 121 | sdl2_config->Get("Data Storage", "nand_directory", | ||
| 122 | FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); | ||
| 117 | 123 | ||
| 118 | // System | 124 | // System |
| 119 | Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); | 125 | Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); |