mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 02:27:33 +01:00
yuzu/game_list_worker: Don't retrieve the file type twice in AddFstEntriesToGameList()
Similarly, here we can avoid doing unnecessary work twice by retrieving the file type only once and comparing it against relevant operands, avoiding potential unnecessary object construction/destruction.
This commit is contained in:
parent
de095ded5c
commit
01bf329f63
@ -198,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);
|
||||
|
Loading…
Reference in New Issue
Block a user