summaryrefslogtreecommitdiff
path: root/src/yuzu/game_list.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-09-03 18:57:52 -0400
committerZach Hilman <zachhilman@gmail.com>2018-09-04 16:25:10 -0400
commit23a16c1720ee522f6ac7d1f426a2d4a918ce41c9 (patch)
tree43a69cb7046a768760e5ae20eddfe3b53d3ca7f8 /src/yuzu/game_list.cpp
parent92e26df00f12de2e084ceb84d17ca79c5323a315 (diff)
patch_manager: Centralize Control-type NCA parsing
Diffstat (limited to 'src/yuzu/game_list.cpp')
-rw-r--r--src/yuzu/game_list.cpp28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 38c5071e3..a3b841684 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -486,29 +486,11 @@ void GameList::RefreshGameDirectory() {
static void GetMetadataFromControlNCA(const FileSys::PatchManager& patch_manager,
const std::shared_ptr<FileSys::NCA>& nca,
std::vector<u8>& icon, std::string& name) {
- const auto romfs = patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(),
- FileSys::ContentRecordType::Control);
- if (romfs == nullptr)
- return;
-
- const auto control_dir = FileSys::ExtractRomFS(romfs);
- if (control_dir == nullptr)
- return;
-
- const auto nacp_file = control_dir->GetFile("control.nacp");
- if (nacp_file == nullptr)
- return;
- FileSys::NACP nacp(nacp_file);
- name = nacp.GetApplicationName();
-
- FileSys::VirtualFile icon_file = nullptr;
- for (const auto& language : FileSys::LANGUAGE_NAMES) {
- icon_file = control_dir->GetFile("icon_" + std::string(language) + ".dat");
- if (icon_file != nullptr) {
- icon = icon_file->ReadAllBytes();
- break;
- }
- }
+ auto [nacp, icon_file] = patch_manager.ParseControlNCA(nca);
+ if (icon_file != nullptr)
+ icon = icon_file->ReadAllBytes();
+ if (nacp != nullptr)
+ name = nacp->GetApplicationName();
}
GameListWorker::GameListWorker(