diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cfc48a416..01a5d2552 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(sender()); assert(action); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 3d6ebe329..b85149f8e 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 item void 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.ui index faa0c626a..3879d4813 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -65,6 +65,9 @@ + + + @@ -204,6 +207,22 @@ Selects a folder to display in the game list + + + Select NAND Directory... + + + Selects a folder to use as the root of the emulated NAND + + + + + Select SD Card Directory... + + + Selects a folder to use as the root of the emulated SD card + + true