From 9f8fbce35b08961b2780e90ac029bc68b88e4c3d Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 14 Jun 2018 12:16:56 -0400 Subject: Add support for main files in file picker --- src/yuzu/main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index aa9028399..2e525b5be 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -550,6 +550,8 @@ void GMainWindow::OnMenuLoadFile() { for (const auto& piece : game_list->supported_file_extensions) extensions += "*." + piece + " "; + extensions += "main "; + QString file_filter = tr("Switch Executable") + " (" + extensions + ")"; file_filter += ";;" + tr("All Files (*.*)"); -- cgit v1.2.3 From f969ddb54eb251539de82c00e083482b1cc309f4 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 14 Jun 2018 12:27:29 -0400 Subject: Add 'Load Folder' menu option --- src/yuzu/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2e525b5be..e2afe2131 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -278,6 +278,7 @@ void GMainWindow::ConnectWidgetEvents() { void GMainWindow::ConnectMenuEvents() { // File connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile); + connect(ui.action_Load_Folder, &QAction::triggered, this, &GMainWindow::OnMenuLoadFolder); connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, &GMainWindow::OnMenuSelectGameListRoot); connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); @@ -564,6 +565,15 @@ void GMainWindow::OnMenuLoadFile() { } } +void GMainWindow::OnMenuLoadFolder() { + QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory")); + + QStringList matchingMain = dir.entryList(QStringList() << "main", QDir::Files); + if (matchingMain.size() == 1) { + BootGame(matchingMain[0]); + } +} + void GMainWindow::OnMenuSelectGameListRoot() { QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); if (!dir_path.isEmpty()) { -- cgit v1.2.3 From acc8fe5a2a2d46c0f89642a9eccaedcea47c6c4f Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 14 Jun 2018 17:25:40 -0400 Subject: Bug fixes, testing, and review changes --- src/yuzu/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e2afe2131..97be548d7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include "common/common_paths.h" #include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" @@ -568,9 +569,12 @@ void GMainWindow::OnMenuLoadFile() { void GMainWindow::OnMenuLoadFolder() { QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory")); - QStringList matchingMain = dir.entryList(QStringList() << "main", QDir::Files); - if (matchingMain.size() == 1) { - BootGame(matchingMain[0]); + QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); + if (matching_main.size() == 1) { + BootGame(dir.path() + DIR_SEP + matching_main[0]); + } else { + QMessageBox::warning(this, tr("Invalid Directory Selected"), + tr("The directory you have selected does not contain a 'main' file.")); } } -- cgit v1.2.3