1
0
Fork 0

reduce the scope of the variables

This commit is contained in:
BreadFish64 2018-01-22 07:56:24 -06:00
parent 980923d351
commit 38c5ca68b2
1 changed files with 19 additions and 15 deletions

View File

@ -402,23 +402,27 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
u64 program_id = 0; u64 program_id = 0;
loader->ReadProgramId(program_id); loader->ReadProgramId(program_id);
std::vector<u8> update_smdh; std::vector<u8> update_smdh = [program_id]() -> std::vector<u8> {
std::string update_path; if (0x4000000000000 > program_id && program_id > 0x40000FFFFFFFF)
u64 update_id = 0; return {};
std::unique_ptr<Loader::AppLoader> update_loader = nullptr;
if (0x4000000000000 <= program_id && program_id <= 0x40000FFFFFFFF) { u64 update_id = program_id + 0xe00000000;
update_id = program_id + 0xe00000000; std::string update_path =
update_path =
Service::AM::GetTitleContentPath(Service::FS::MediaType::SDMC, update_id); Service::AM::GetTitleContentPath(Service::FS::MediaType::SDMC, update_id);
if (FileUtil::Exists(update_path)) {
update_loader = Loader::GetLoader(update_path); if (!FileUtil::Exists(update_path))
if (update_loader) { return {};
std::unique_ptr<Loader::AppLoader> update_loader = Loader::GetLoader(update_path);
if (!update_loader)
return {};
std::vector<u8> update_smdh;
update_loader->ReadIcon(update_smdh); update_loader->ReadIcon(update_smdh);
update_loader->ReadProgramId(update_id); update_loader->ReadProgramId(update_id);
} return update_smdh;
} }();
}
emit EntryReady({ emit EntryReady({
new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id, new GameListItemPath(QString::fromStdString(physical_name), smdh, program_id,