Merge pull request #1223 from DarkLordZach/custom-nand-sd-dirs

file_sys: Allow for custom NAND/SD directories
This commit is contained in:
bunnei
2018-09-04 11:54:22 -04:00
committed by GitHub
6 changed files with 79 additions and 0 deletions

View File

@ -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);