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
1 changed files with 9 additions and 5 deletions
|
@ -198,12 +198,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
|
||||||
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
||||||
if (!is_dir &&
|
if (!is_dir &&
|
||||||
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
||||||
std::unique_ptr<Loader::AppLoader> loader =
|
auto loader = Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read));
|
||||||
Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read));
|
if (!loader) {
|
||||||
if (!loader || ((loader->GetFileType() == Loader::FileType::Unknown ||
|
|
||||||
loader->GetFileType() == Loader::FileType::Error) &&
|
|
||||||
!UISettings::values.show_unknown))
|
|
||||||
return true;
|
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;
|
std::vector<u8> icon;
|
||||||
const auto res1 = loader->ReadIcon(icon);
|
const auto res1 = loader->ReadIcon(icon);
|
||||||
|
|
Loading…
Reference in a new issue