VERY experimental Nintendo Switch 2 emulator
C++
qt: Add UI options to change NAND/SD dirs
Zach Hilman38c021d0eda5
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cppindex cfc48a416f..01a5d25523 100644--- a/src/yuzu/main.cpp+++ b/src/yuzu/main.cpp@@ -372,6 +372,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(false); });+ connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this,+ [this] { OnMenuSelectEmulatedDirectory(true); });connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);// Emulation@@ -887,6 +891,16 @@ void GMainWindow::OnMenuSelectGameListRoot() {}}+void GMainWindow::OnMenuSelectEmulatedDirectory(bool is_sdmc) {+ QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));+ if (!dir_path.isEmpty()) {+ FileUtil::GetUserPath(is_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.hindex 3d6ebe329d..b85149f8e2 100644--- a/src/yuzu/main.h+++ b/src/yuzu/main.h@@ -137,6 +137,9 @@ private slots:void OnMenuInstallToNAND();/// Called whenever a user selects the "File->Select Game List Root" menu itemvoid OnMenuSelectGameListRoot();+ /// Called whenever a user select the "File->Select -- Directory" where -- is NAND or SD Card+ /// (false for nand, true for sdmc)+ void OnMenuSelectEmulatedDirectory(bool is_sdmc);void OnMenuRecentFile();void OnConfigure();void OnAbout();diff --git a/src/yuzu/main.ui b/src/yuzu/main.uiindex faa0c626a8..3879d48137 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>