summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-06-14 18:02:32 +0200
committerZach Hilman <zachhilman@gmail.com>2018-06-14 18:02:32 +0200
commit94d27b171797c0ba211b169caeb6757b388c7490 (patch)
treed726bb793fe67ea953e0051d4bf113adc34cc406
parentMerge pull request #560 from Subv/crash_widget (diff)
downloadyuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.gz
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.bz2
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.lz
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.xz
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.zst
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.zip
-rw-r--r--src/yuzu/game_list.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index bbd681eae..6b0f07757 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <QApplication>
+#include <QDir>
#include <QFileInfo>
#include <QHeaderView>
#include <QKeyEvent>
@@ -363,6 +364,19 @@ static bool HasSupportedFileExtension(const std::string& file_name) {
return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive);
}
+static bool IsExtractedNCAMain(const std::string& file_name) {
+ return QFileInfo(file_name.c_str()).fileName() == "main";
+}
+
+static QString FormatGameName(std::string physical_name) {
+ QFileInfo fileInfo(physical_name.c_str());
+ if (IsExtractedNCAMain(physical_name)) {
+ return fileInfo.dir().dirName();
+ } else {
+ return QString::fromStdString(physical_name);
+ }
+}
+
void GameList::RefreshGameDirectory() {
if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
NGLOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
@@ -380,7 +394,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
return false; // Breaks the callback loop.
bool is_dir = FileUtil::IsDirectory(physical_name);
- if (!is_dir && HasSupportedFileExtension(physical_name)) {
+ if (!is_dir &&
+ (HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
if (!loader)
return true;
@@ -392,7 +407,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
loader->ReadProgramId(program_id);
emit EntryReady({
- new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id),
+ new GameListItemPath(FormatGameName(physical_name), smdh, program_id),
new GameListItem(
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
new GameListItemSize(FileUtil::GetSize(physical_name)),