diff options
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 @@ | |||
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/file_sys/archive_selfncch.h" | 15 | #include "core/file_sys/archive_selfncch.h" |
| 16 | #include "core/file_sys/ncch_container.h" | 16 | #include "core/file_sys/ncch_container.h" |
| 17 | #include "core/file_sys/title_metadata.h" | ||
| 17 | #include "core/hle/kernel/process.h" | 18 | #include "core/hle/kernel/process.h" |
| 18 | #include "core/hle/kernel/resource_limit.h" | 19 | #include "core/hle/kernel/resource_limit.h" |
| 19 | #include "core/hle/service/cfg/cfg.h" | 20 | #include "core/hle/service/cfg/cfg.h" |
| @@ -49,9 +50,19 @@ static std::string GetUpdateNCCHPath(u64_le program_id) { | |||
| 49 | u32 high = static_cast<u32>((program_id | UPDATE_MASK) >> 32); | 50 | u32 high = static_cast<u32>((program_id | UPDATE_MASK) >> 32); |
| 50 | u32 low = static_cast<u32>((program_id | UPDATE_MASK) & 0xFFFFFFFF); | 51 | u32 low = static_cast<u32>((program_id | UPDATE_MASK) & 0xFFFFFFFF); |
| 51 | 52 | ||
| 52 | return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/%08x/%08x/content/00000000.app", | 53 | // TODO(shinyquagsire23): Title database should be doing this path lookup |
| 53 | FileUtil::GetUserPath(D_SDMC_IDX).c_str(), SYSTEM_ID, SDCARD_ID, | 54 | std::string content_path = Common::StringFromFormat( |
| 54 | high, low); | 55 | "%sNintendo 3DS/%s/%s/title/%08x/%08x/content/", FileUtil::GetUserPath(D_SDMC_IDX).c_str(), |
| 56 | SYSTEM_ID, SDCARD_ID, high, low); | ||
| 57 | std::string tmd_path = content_path + "00000000.tmd"; | ||
| 58 | |||
| 59 | u32 content_id = 0; | ||
| 60 | FileSys::TitleMetadata tmd(tmd_path); | ||
| 61 | if (tmd.Load() == ResultStatus::Success) { | ||
| 62 | content_id = tmd.GetBootContentID(); | ||
| 63 | } | ||
| 64 | |||
| 65 | return Common::StringFromFormat("%s%08x.app", content_path.c_str(), content_id); | ||
| 55 | } | 66 | } |
| 56 | 67 | ||
| 57 | std::pair<boost::optional<u32>, ResultStatus> AppLoader_NCCH::LoadKernelSystemMode() { | 68 | std::pair<boost::optional<u32>, ResultStatus> AppLoader_NCCH::LoadKernelSystemMode() { |