summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/game_list.cpp28
-rw-r--r--src/yuzu/main.cpp12
2 files changed, 15 insertions, 25 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(
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b7ce0248b..80a284513 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -592,8 +592,16 @@ void GMainWindow::BootGame(const QString& filename) {
std::string title_name;
const auto res = Core::System::GetInstance().GetGameName(title_name);
- if (res != Loader::ResultStatus::Success)
- title_name = FileUtil::GetFilename(filename.toStdString());
+ if (res != Loader::ResultStatus::Success) {
+ const u64 program_id = Core::System::GetInstance().CurrentProcess()->program_id;
+
+ const auto [nacp, icon_file] = FileSys::PatchManager(program_id).GetControlMetadata();
+ if (nacp != nullptr)
+ title_name = nacp->GetApplicationName();
+
+ if (title_name.empty())
+ title_name = FileUtil::GetFilename(filename.toStdString());
+ }
setWindowTitle(QString("yuzu %1| %4 | %2-%3")
.arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc,