From eb1b5f588a079573b7ae9d285672bbf96c8b5fda Mon Sep 17 00:00:00 2001 From: BreadFish64 Date: Tue, 23 Jan 2018 21:32:27 -0600 Subject: [PATCH] only pass one smdh --- src/citra_qt/game_list.cpp | 25 +++++++++++-------------- src/citra_qt/game_list_p.h | 12 +++++------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 8c8def73f3..481fea616b 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -396,37 +396,34 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign if (!loader) return true; - std::vector smdh; - loader->ReadIcon(smdh); - u64 program_id = 0; loader->ReadProgramId(program_id); - std::vector update_smdh = [program_id]() -> std::vector { - if (0x4000000000000 > program_id && program_id > 0x40000FFFFFFFF) - return {}; + std::vector smdh = [program_id, &loader]() -> std::vector { + std::vector original_smdh; + loader->ReadIcon(original_smdh); - u64 update_id = program_id + 0xe00000000; - std::string update_path = - Service::AM::GetTitleContentPath(Service::FS::MediaType::SDMC, update_id); + if (0x4000000000000 > program_id && program_id > 0x40000FFFFFFFF) + return original_smdh; + + std::string update_path = Service::AM::GetTitleContentPath( + Service::FS::MediaType::SDMC, program_id + 0xe00000000); if (!FileUtil::Exists(update_path)) - return {}; + return original_smdh; std::unique_ptr update_loader = Loader::GetLoader(update_path); if (!update_loader) - return {}; + return original_smdh; std::vector update_smdh; update_loader->ReadIcon(update_smdh); - update_loader->ReadProgramId(update_id); return update_smdh; }(); emit EntryReady({ - new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id, - update_smdh), + new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id), new GameListItem( QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), new GameListItemSize(FileUtil::GetSize(physical_name)), diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index 7294831fff..6b68c65b20 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -72,22 +72,20 @@ public: static const int ProgramIdRole = Qt::UserRole + 3; GameListItemPath() : GameListItem() {} - GameListItemPath(const QString& game_path, const std::vector& smdh_data, u64 program_id, - const std::vector& update_smdh) + GameListItemPath(const QString& game_path, const std::vector& smdh_data, u64 program_id) : GameListItem() { setData(game_path, FullPathRole); setData(qulonglong(program_id), ProgramIdRole); Loader::SMDH smdh; - if (Loader::IsValidSMDH(update_smdh)) { - memcpy(&smdh, update_smdh.data(), sizeof(Loader::SMDH)); - } else if (Loader::IsValidSMDH(smdh_data)) { - memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH)); - } else { + if (!Loader::IsValidSMDH(smdh_data)) { // SMDH is not valid, set a default icon setData(GetDefaultIcon(true), Qt::DecorationRole); return; } + + memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH)); + // Get icon from SMDH setData(GetQPixmapFromSMDH(smdh, true), Qt::DecorationRole);