summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-06-14 12:02:32 -0400
committerGravatar Zach Hilman2018-06-14 12:02:32 -0400
commit94d27b171797c0ba211b169caeb6757b388c7490 (patch)
treed726bb793fe67ea953e0051d4bf113adc34cc406 /src
parentMerge pull request #560 from Subv/crash_widget (diff)
downloadyuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.gz
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.tar.xz
yuzu-94d27b171797c0ba211b169caeb6757b388c7490.zip
Recognize main files in game list
Diffstat (limited to 'src')
-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 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QApplication> 5#include <QApplication>
6#include <QDir>
6#include <QFileInfo> 7#include <QFileInfo>
7#include <QHeaderView> 8#include <QHeaderView>
8#include <QKeyEvent> 9#include <QKeyEvent>
@@ -363,6 +364,19 @@ static bool HasSupportedFileExtension(const std::string& file_name) {
363 return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive); 364 return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive);
364} 365}
365 366
367static bool IsExtractedNCAMain(const std::string& file_name) {
368 return QFileInfo(file_name.c_str()).fileName() == "main";
369}
370
371static QString FormatGameName(std::string physical_name) {
372 QFileInfo fileInfo(physical_name.c_str());
373 if (IsExtractedNCAMain(physical_name)) {
374 return fileInfo.dir().dirName();
375 } else {
376 return QString::fromStdString(physical_name);
377 }
378}
379
366void GameList::RefreshGameDirectory() { 380void GameList::RefreshGameDirectory() {
367 if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) { 381 if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
368 NGLOG_INFO(Frontend, "Change detected in the games directory. Reloading game list."); 382 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
380 return false; // Breaks the callback loop. 394 return false; // Breaks the callback loop.
381 395
382 bool is_dir = FileUtil::IsDirectory(physical_name); 396 bool is_dir = FileUtil::IsDirectory(physical_name);
383 if (!is_dir && HasSupportedFileExtension(physical_name)) { 397 if (!is_dir &&
398 (HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
384 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); 399 std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
385 if (!loader) 400 if (!loader)
386 return true; 401 return true;
@@ -392,7 +407,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
392 loader->ReadProgramId(program_id); 407 loader->ReadProgramId(program_id);
393 408
394 emit EntryReady({ 409 emit EntryReady({
395 new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id), 410 new GameListItemPath(FormatGameName(physical_name), smdh, program_id),
396 new GameListItem( 411 new GameListItem(
397 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), 412 QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
398 new GameListItemSize(FileUtil::GetSize(physical_name)), 413 new GameListItemSize(FileUtil::GetSize(physical_name)),