From a74d7a0e6b02b94f233806e6d9e710401d57820a Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:27:22 -0700 Subject: [PATCH] qt: Hide system titles with invisible or invalid SMDH data. (#6381) --- src/citra_qt/game_list_worker.cpp | 11 ++++++++++- src/core/loader/smdh.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/citra_qt/game_list_worker.cpp b/src/citra_qt/game_list_worker.cpp index 5f73a901c..15ed1e7ac 100644 --- a/src/citra_qt/game_list_worker.cpp +++ b/src/citra_qt/game_list_worker.cpp @@ -81,7 +81,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign 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(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 return true; } diff --git a/src/core/loader/smdh.h b/src/core/loader/smdh.h index 63626f732..831266982 100644 --- a/src/core/loader/smdh.h +++ b/src/core/loader/smdh.h @@ -72,6 +72,10 @@ struct SMDH { Taiwan = 6, }; + enum Flags { + Visible = 1 << 0, + }; + /** * Gets game icon from SMDH * @param large If true, returns large icon (48x48), otherwise returns small icon (24x24)