summaryrefslogtreecommitdiffstats
path: root/src/core/loader/xci.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-08 18:27:19 +0200
committerGitHub <noreply@github.com>2018-08-08 18:27:19 +0200
commitfd9da4232b2f989257630884511ba50e108ad703 (patch)
tree0073d61bfa93a8ab0681623bf00428a5731b8854 /src/core/loader/xci.cpp
parentMerge pull request #968 from lioncash/vec (diff)
parentconfigure_gamelist: Use explicit QVariant constructor (diff)
downloadyuzu-fd9da4232b2f989257630884511ba50e108ad703.tar
yuzu-fd9da4232b2f989257630884511ba50e108ad703.tar.gz
yuzu-fd9da4232b2f989257630884511ba50e108ad703.tar.bz2
yuzu-fd9da4232b2f989257630884511ba50e108ad703.tar.lz
yuzu-fd9da4232b2f989257630884511ba50e108ad703.tar.xz
yuzu-fd9da4232b2f989257630884511ba50e108ad703.tar.zst
yuzu-fd9da4232b2f989257630884511ba50e108ad703.zip
Diffstat (limited to 'src/core/loader/xci.cpp')
-rw-r--r--src/core/loader/xci.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index eb4dee2c2..d3fe24419 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -26,7 +26,25 @@ namespace Loader {
AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file)
: AppLoader(file), xci(std::make_unique<FileSys::XCI>(file)),
nca_loader(std::make_unique<AppLoader_NCA>(
- xci->GetNCAFileByType(FileSys::NCAContentType::Program))) {}
+ xci->GetNCAFileByType(FileSys::NCAContentType::Program))) {
+ if (xci->GetStatus() != ResultStatus::Success)
+ return;
+ const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control);
+ if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success)
+ return;
+ const auto romfs = FileSys::ExtractRomFS(control_nca->GetRomFS());
+ if (romfs == nullptr)
+ return;
+ for (const auto& language : FileSys::LANGUAGE_NAMES) {
+ icon_file = romfs->GetFile("icon_" + std::string(language) + ".dat");
+ if (icon_file != nullptr)
+ break;
+ }
+ const auto nacp_raw = romfs->GetFile("control.nacp");
+ if (nacp_raw == nullptr)
+ return;
+ nacp_file = std::make_shared<FileSys::NACP>(nacp_raw);
+}
AppLoader_XCI::~AppLoader_XCI() = default;
@@ -71,4 +89,17 @@ ResultStatus AppLoader_XCI::ReadProgramId(u64& out_program_id) {
return nca_loader->ReadProgramId(out_program_id);
}
+ResultStatus AppLoader_XCI::ReadIcon(std::vector<u8>& buffer) {
+ if (icon_file == nullptr)
+ return ResultStatus::ErrorInvalidFormat;
+ buffer = icon_file->ReadAllBytes();
+ return ResultStatus::Success;
+}
+
+ResultStatus AppLoader_XCI::ReadTitle(std::string& title) {
+ if (nacp_file == nullptr)
+ return ResultStatus::ErrorInvalidFormat;
+ title = nacp_file->GetApplicationName();
+ return ResultStatus::Success;
+}
} // namespace Loader