qt: Hide system titles with invisible or invalid SMDH data. (#6381)

This commit is contained in:
Steveice10 2023-04-01 20:27:22 -07:00 committed by GitHub
parent 387cf15719
commit a74d7a0e6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -81,7 +81,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
loader->ReadIcon(smdh); loader->ReadIcon(smdh);
} }
if (!Loader::IsValidSMDH(smdh) && UISettings::values.game_list_hide_no_icon) { const auto system_title = ((program_id >> 32) & 0xFFFFFFFF) == 0x00040010;
if (Loader::IsValidSMDH(smdh)) {
if (system_title) {
auto smdh_struct = reinterpret_cast<Loader::SMDH*>(smdh.data());
if (!(smdh_struct->flags & Loader::SMDH::Flags::Visible)) {
// Skip system titles without the visible flag.
return true;
}
}
} else if (UISettings::values.game_list_hide_no_icon || system_title) {
// Skip this invalid entry // Skip this invalid entry
return true; return true;
} }

View file

@ -72,6 +72,10 @@ struct SMDH {
Taiwan = 6, Taiwan = 6,
}; };
enum Flags {
Visible = 1 << 0,
};
/** /**
* Gets game icon from SMDH * Gets game icon from SMDH
* @param large If true, returns large icon (48x48), otherwise returns small icon (24x24) * @param large If true, returns large icon (48x48), otherwise returns small icon (24x24)