diff options
author | shinyquagsire23 <mtinc2@gmail.com> | 2017-10-01 18:41:40 +0200 |
---|---|---|
committer | shinyquagsire23 <mtinc2@gmail.com> | 2017-10-01 18:54:02 +0200 |
commit | 4887d1859102234c594c3140c31217ff64791f37 (patch) | |
tree | 4da15e6e12f1ddd76fb7da5218b6a7ecfa1a129c /src/core/loader/ncch.cpp | |
parent | file_sys: add class for Title Metadata (TMD) (diff) | |
download | yuzu-4887d1859102234c594c3140c31217ff64791f37.tar yuzu-4887d1859102234c594c3140c31217ff64791f37.tar.gz yuzu-4887d1859102234c594c3140c31217ff64791f37.tar.bz2 yuzu-4887d1859102234c594c3140c31217ff64791f37.tar.lz yuzu-4887d1859102234c594c3140c31217ff64791f37.tar.xz yuzu-4887d1859102234c594c3140c31217ff64791f37.tar.zst yuzu-4887d1859102234c594c3140c31217ff64791f37.zip |
Diffstat (limited to 'src/core/loader/ncch.cpp')
-rw-r--r-- | src/core/loader/ncch.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 66bc5823d..52686e364 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -14,6 +14,7 @@ #include "core/core.h" #include "core/file_sys/archive_selfncch.h" #include "core/file_sys/ncch_container.h" +#include "core/file_sys/title_metadata.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/cfg/cfg.h" @@ -49,9 +50,19 @@ static std::string GetUpdateNCCHPath(u64_le program_id) { u32 high = static_cast<u32>((program_id | UPDATE_MASK) >> 32); u32 low = static_cast<u32>((program_id | UPDATE_MASK) & 0xFFFFFFFF); - return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/%08x/%08x/content/00000000.app", - FileUtil::GetUserPath(D_SDMC_IDX).c_str(), SYSTEM_ID, SDCARD_ID, - high, low); + // TODO(shinyquagsire23): Title database should be doing this path lookup + std::string content_path = Common::StringFromFormat( + "%sNintendo 3DS/%s/%s/title/%08x/%08x/content/", FileUtil::GetUserPath(D_SDMC_IDX).c_str(), + SYSTEM_ID, SDCARD_ID, high, low); + std::string tmd_path = content_path + "00000000.tmd"; + + u32 content_id = 0; + FileSys::TitleMetadata tmd(tmd_path); + if (tmd.Load() == ResultStatus::Success) { + content_id = tmd.GetBootContentID(); + } + + return Common::StringFromFormat("%s%08x.app", content_path.c_str(), content_id); } std::pair<boost::optional<u32>, ResultStatus> AppLoader_NCCH::LoadKernelSystemMode() { |