summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/settings.h2
-rw-r--r--src/yuzu/configuration/config.cpp18
-rw-r--r--src/yuzu/main.cpp27
-rw-r--r--src/yuzu/main.h7
-rw-r--r--src/yuzu/main.ui19
-rw-r--r--src/yuzu_cmd/config.cpp6
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 {
// Data Storage
bool use_virtual_sd;
+ std::string nand_dir;
+ std::string sdmc_dir;
// Renderer
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() {
qt_config->beginGroup("Data Storage");
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
+ FileUtil::GetUserPath(
+ FileUtil::UserPath::NANDDir,
+ qt_config
+ ->value("nand_directory",
+ QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)))
+ .toString()
+ .toStdString());
+ FileUtil::GetUserPath(
+ FileUtil::UserPath::SDMCDir,
+ qt_config
+ ->value("sdmc_directory",
+ QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)))
+ .toString()
+ .toStdString());
qt_config->endGroup();
qt_config->beginGroup("System");
@@ -222,6 +236,10 @@ void Config::SaveValues() {
qt_config->beginGroup("Data Storage");
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
+ qt_config->setValue("nand_directory",
+ QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
+ qt_config->setValue("sdmc_directory",
+ QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
qt_config->endGroup();
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 @@
#define QT_NO_OPENGL
#include <QDesktopWidget>
+#include <QDialogButtonBox>
#include <QFileDialog>
#include <QMessageBox>
#include <QtGui>
@@ -374,6 +375,10 @@ void GMainWindow::ConnectMenuEvents() {
&GMainWindow::OnMenuInstallToNAND);
connect(ui.action_Select_Game_List_Root, &QAction::triggered, this,
&GMainWindow::OnMenuSelectGameListRoot);
+ connect(ui.action_Select_NAND_Directory, &QAction::triggered, this,
+ [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::NAND); });
+ connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this,
+ [this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::SDMC); });
connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);
// Emulation
@@ -889,6 +894,28 @@ void GMainWindow::OnMenuSelectGameListRoot() {
}
}
+void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target) {
+ const auto res = QMessageBox::information(
+ this, tr("Changing Emulated Directory"),
+ tr("You are about to change the emulated %1 directory of the system. Please note "
+ "that this does not also move the contents of the previous directory to the "
+ "new one and you will have to do that yourself.")
+ .arg(target == EmulatedDirectoryTarget::SDMC ? tr("SD card") : tr("NAND")),
+ QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel});
+
+ if (res == QMessageBox::Cancel)
+ return;
+
+ QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
+ if (!dir_path.isEmpty()) {
+ FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir
+ : FileUtil::UserPath::NANDDir,
+ dir_path.toStdString());
+ Service::FileSystem::CreateFactories(vfs);
+ game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
+ }
+}
+
void GMainWindow::OnMenuRecentFile() {
QAction* action = qobject_cast<QAction*>(sender());
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 {
class DebugContext;
}
+enum class EmulatedDirectoryTarget {
+ NAND,
+ SDMC,
+};
+
class GMainWindow : public QMainWindow {
Q_OBJECT
@@ -140,6 +145,8 @@ private slots:
void OnMenuInstallToNAND();
/// Called whenever a user selects the "File->Select Game List Root" menu item
void OnMenuSelectGameListRoot();
+ /// Called whenever a user select the "File->Select -- Directory" where -- is NAND or SD Card
+ void OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target);
void OnMenuRecentFile();
void OnConfigure();
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 @@
<addaction name="action_Select_Game_List_Root"/>
<addaction name="menu_recent_files"/>
<addaction name="separator"/>
+ <addaction name="action_Select_NAND_Directory"/>
+ <addaction name="action_Select_SDMC_Directory"/>
+ <addaction name="separator"/>
<addaction name="action_Exit"/>
</widget>
<widget class="QMenu" name="menu_Emulation">
@@ -204,6 +207,22 @@
<string>Selects a folder to display in the game list</string>
</property>
</action>
+ <action name="action_Select_NAND_Directory">
+ <property name="text">
+ <string>Select NAND Directory...</string>
+ </property>
+ <property name="toolTip">
+ <string>Selects a folder to use as the root of the emulated NAND</string>
+ </property>
+ </action>
+ <action name="action_Select_SDMC_Directory">
+ <property name="text">
+ <string>Select SD Card Directory...</string>
+ </property>
+ <property name="toolTip">
+ <string>Selects a folder to use as the root of the emulated SD card</string>
+ </property>
+ </action>
<action name="action_Fullscreen">
<property name="checkable">
<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() {
// Data Storage
Settings::values.use_virtual_sd =
sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true);
+ FileUtil::GetUserPath(FileUtil::UserPath::NANDDir,
+ sdl2_config->Get("Data Storage", "nand_directory",
+ FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
+ FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir,
+ sdl2_config->Get("Data Storage", "nand_directory",
+ FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
// System
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);