diff options
author | bunnei <bunneidev@gmail.com> | 2018-12-08 00:15:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-08 00:15:30 +0100 |
commit | f85134021f77e573c1a5f5602940e414a9ab45de (patch) | |
tree | 4c2f3d4c0872646bc74d9280bdbea0d737cda463 | |
parent | Merge pull request #1868 from lioncash/config (diff) | |
parent | yuzu/game_list_worker: Don't retrieve the file type twice in AddFstEntriesToGameList() (diff) | |
download | yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar.gz yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar.bz2 yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar.lz yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar.xz yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.tar.zst yuzu-f85134021f77e573c1a5f5602940e414a9ab45de.zip |
-rw-r--r-- | src/core/loader/deconstructed_rom_directory.h | 2 | ||||
-rw-r--r-- | src/core/loader/elf.h | 2 | ||||
-rw-r--r-- | src/core/loader/loader.h | 2 | ||||
-rw-r--r-- | src/core/loader/nax.cpp | 2 | ||||
-rw-r--r-- | src/core/loader/nax.h | 2 | ||||
-rw-r--r-- | src/core/loader/nca.h | 2 | ||||
-rw-r--r-- | src/core/loader/nro.h | 2 | ||||
-rw-r--r-- | src/core/loader/nso.h | 2 | ||||
-rw-r--r-- | src/core/loader/nsp.h | 2 | ||||
-rw-r--r-- | src/core/loader/xci.h | 2 | ||||
-rw-r--r-- | src/yuzu/game_list_worker.cpp | 24 |
11 files changed, 25 insertions, 19 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.h b/src/core/loader/deconstructed_rom_directory.h index d109ed2b5..1615cb5a8 100644 --- a/src/core/loader/deconstructed_rom_directory.h +++ b/src/core/loader/deconstructed_rom_directory.h @@ -33,7 +33,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 6af76441c..a2d33021c 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h @@ -22,7 +22,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 7686634bf..5390ab9ee 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -131,7 +131,7 @@ public: * Returns the type of this file * @return FileType corresponding to the loaded file */ - virtual FileType GetFileType() = 0; + virtual FileType GetFileType() const = 0; /** * Load the application and return the created Process instance diff --git a/src/core/loader/nax.cpp b/src/core/loader/nax.cpp index 42f4a777b..a093e3d36 100644 --- a/src/core/loader/nax.cpp +++ b/src/core/loader/nax.cpp @@ -37,7 +37,7 @@ FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) { return IdentifyTypeImpl(nax); } -FileType AppLoader_NAX::GetFileType() { +FileType AppLoader_NAX::GetFileType() const { return IdentifyTypeImpl(*nax); } diff --git a/src/core/loader/nax.h b/src/core/loader/nax.h index b4d93bd01..0a97511b8 100644 --- a/src/core/loader/nax.h +++ b/src/core/loader/nax.h @@ -31,7 +31,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override; + FileType GetFileType() const override; ResultStatus Load(Kernel::Process& process) override; diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h index 95d9b73a1..cbbe701d2 100644 --- a/src/core/loader/nca.h +++ b/src/core/loader/nca.h @@ -29,7 +29,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/nro.h b/src/core/loader/nro.h index 6deff3a51..013d629c0 100644 --- a/src/core/loader/nro.h +++ b/src/core/loader/nro.h @@ -33,7 +33,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 0c1defbb6..135b6ea5a 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h @@ -37,7 +37,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h index db91cd01e..9ed8a59cf 100644 --- a/src/core/loader/nsp.h +++ b/src/core/loader/nsp.h @@ -31,7 +31,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h index 46f8dfc9e..ded5bb88a 100644 --- a/src/core/loader/xci.h +++ b/src/core/loader/xci.h @@ -31,7 +31,7 @@ public: */ static FileType IdentifyType(const FileSys::VirtualFile& file); - FileType GetFileType() override { + FileType GetFileType() const override { return IdentifyType(file); } diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 9fd074223..20f5e8798 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -99,12 +99,14 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri compatibility = it->second.first; } + const auto file_type = loader.GetFileType(); + const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type)); + QList<QStandardItem*> list{ - new GameListItemPath( - FormatGameName(path), icon, QString::fromStdString(name), - QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id), + new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name), + file_type_string, program_id), new GameListItemCompat(compatibility), - new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))), + new GameListItem(file_type_string), new GameListItemSize(FileUtil::GetSize(path)), }; @@ -196,12 +198,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign const bool is_dir = FileUtil::IsDirectory(physical_name); if (!is_dir && (HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) { - std::unique_ptr<Loader::AppLoader> loader = - Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read)); - if (!loader || ((loader->GetFileType() == Loader::FileType::Unknown || - loader->GetFileType() == Loader::FileType::Error) && - !UISettings::values.show_unknown)) + auto loader = Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read)); + if (!loader) { return true; + } + + const auto file_type = loader->GetFileType(); + if ((file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) && + !UISettings::values.show_unknown) { + return true; + } std::vector<u8> icon; const auto res1 = loader->ReadIcon(icon); |