summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/archive_ncch.cpp
diff options
context:
space:
mode:
authorshinyquagsire23 <mtinc2@gmail.com>2017-10-01 18:41:40 +0200
committershinyquagsire23 <mtinc2@gmail.com>2017-10-01 18:54:02 +0200
commit4887d1859102234c594c3140c31217ff64791f37 (patch)
tree4da15e6e12f1ddd76fb7da5218b6a7ecfa1a129c /src/core/file_sys/archive_ncch.cpp
parentfile_sys: add class for Title Metadata (TMD) (diff)
downloadyuzu-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/file_sys/archive_ncch.cpp')
-rw-r--r--src/core/file_sys/archive_ncch.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp
index 19e1eb981..e8c5be983 100644
--- a/src/core/file_sys/archive_ncch.cpp
+++ b/src/core/file_sys/archive_ncch.cpp
@@ -14,6 +14,7 @@
#include "core/file_sys/errors.h"
#include "core/file_sys/ivfc_archive.h"
#include "core/file_sys/ncch_container.h"
+#include "core/file_sys/title_metadata.h"
#include "core/hle/service/fs/archive.h"
#include "core/loader/loader.h"
@@ -27,8 +28,18 @@ static std::string GetNCCHContainerPath(const std::string& nand_directory) {
}
static std::string GetNCCHPath(const std::string& mount_point, u32 high, u32 low) {
- return Common::StringFromFormat("%s%08x/%08x/content/00000000.app", mount_point.c_str(), high,
- low);
+ u32 content_id = 0;
+
+ // TODO(shinyquagsire23): Title database should be doing this path lookup
+ std::string content_path =
+ Common::StringFromFormat("%s%08x/%08x/content/", mount_point.c_str(), high, low);
+ std::string tmd_path = content_path + "00000000.tmd";
+ TitleMetadata tmd(tmd_path);
+ if (tmd.Load() == Loader::ResultStatus::Success) {
+ content_id = tmd.GetBootContentID();
+ }
+
+ return Common::StringFromFormat("%s%08x.app", content_path.c_str(), content_id);
}
ArchiveFactory_NCCH::ArchiveFactory_NCCH(const std::string& nand_directory)