summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/game_list.cpp11
-rw-r--r--src/citra_qt/game_list.h2
-rw-r--r--src/citra_qt/main.cpp11
3 files changed, 20 insertions, 4 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp
index 09469f3c5..28e01d81a 100644
--- a/src/citra_qt/game_list.cpp
+++ b/src/citra_qt/game_list.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QFileInfo>
5#include <QHeaderView> 6#include <QHeaderView>
6#include <QMenu> 7#include <QMenu>
7#include <QThreadPool> 8#include <QThreadPool>
@@ -131,6 +132,14 @@ void GameList::LoadInterfaceLayout() {
131 item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); 132 item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder());
132} 133}
133 134
135const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "axf",
136 "cci", "cxi", "app"};
137
138static bool HasSupportedFileExtension(const std::string& file_name) {
139 QFileInfo file = QFileInfo(file_name.c_str());
140 return GameList::supported_file_extensions.contains(file.completeSuffix(), Qt::CaseInsensitive);
141}
142
134void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { 143void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
135 const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, 144 const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory,
136 const std::string& virtual_name) -> bool { 145 const std::string& virtual_name) -> bool {
@@ -139,7 +148,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
139 if (stop_processing) 148 if (stop_processing)
140 return false; // Breaks the callback loop. 149 return false; // Breaks the callback loop.
141 150
142 if (!FileUtil::IsDirectory(physical_name)) { 151 if (!FileUtil::IsDirectory(physical_name) && HasSupportedFileExtension(physical_name)) {
143 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); 152 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
144 if (!loader) 153 if (!loader)
145 return true; 154 return true;
diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h
index 1abf10051..e6b7eea0b 100644
--- a/src/citra_qt/game_list.h
+++ b/src/citra_qt/game_list.h
@@ -33,6 +33,8 @@ public:
33 void SaveInterfaceLayout(); 33 void SaveInterfaceLayout();
34 void LoadInterfaceLayout(); 34 void LoadInterfaceLayout();
35 35
36 static const QStringList supported_file_extensions;
37
36signals: 38signals:
37 void GameChosen(QString game_path); 39 void GameChosen(QString game_path);
38 void ShouldCancelWorker(); 40 void ShouldCancelWorker();
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index f765c0147..3c2e19344 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -466,9 +466,14 @@ void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
466} 466}
467 467
468void GMainWindow::OnMenuLoadFile() { 468void GMainWindow::OnMenuLoadFile() {
469 QString filename = 469 QString extensions;
470 QFileDialog::getOpenFileName(this, tr("Load File"), UISettings::values.roms_path, 470 for (const auto& piece : game_list->supported_file_extensions)
471 tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); 471 extensions += "*." + piece + " ";
472
473 QString file_filter = tr("3DS executable") + " (" + extensions + ")";
474
475 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
476 UISettings::values.roms_path, file_filter);
472 if (!filename.isEmpty()) { 477 if (!filename.isEmpty()) {
473 UISettings::values.roms_path = QFileInfo(filename).path(); 478 UISettings::values.roms_path = QFileInfo(filename).path();
474 479