summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/NANDContentLoader.cpp
diff options
context:
space:
mode:
authorLeo Lam <leolino.lam@gmail.com>2017-06-03 13:21:20 +0200
committerGitHub <noreply@github.com>2017-06-03 13:21:20 +0200
commit4af514bb3c65789b00e9c144eaf79aea4380b4fd (patch)
tree8dba078d3a11a7a6849152ea4a18f614b8a1571c /Source/Core/DiscIO/NANDContentLoader.cpp
parentccccb8463d43ef8ea74af738f85511cec553469c (diff)
parente38a66fe1b27c1898c357613aaba223c7d2b4ef9 (diff)
Merge pull request #5388 from leoetlino/optional
Add a std::optional and std::variant implementation
Diffstat (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp')
-rw-r--r--Source/Core/DiscIO/NANDContentLoader.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp
index e6aca0ce79..e9700ac1e2 100644
--- a/Source/Core/DiscIO/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/NANDContentLoader.cpp
@@ -94,7 +94,8 @@ bool CNANDContentDataBuffer::GetRange(u32 start, u32 size, u8* buffer)
return true;
}
-CNANDContentLoader::CNANDContentLoader(const std::string& content_name)
+CNANDContentLoader::CNANDContentLoader(const std::string& content_name, Common::FromWhichRoot from)
+ : m_root(from)
{
m_Valid = Initialize(content_name);
}
@@ -185,7 +186,7 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_ap
u32 data_app_offset = 0;
const std::vector<u8> title_key = m_ticket.GetTitleKey();
- IOS::ES::SharedContentMap shared_content{Common::FromWhichRoot::FROM_SESSION_ROOT};
+ IOS::ES::SharedContentMap shared_content{m_root};
for (size_t i = 0; i < contents.size(); ++i)
{
@@ -208,7 +209,7 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& data_ap
{
std::string filename;
if (content.IsShared())
- filename = shared_content.GetFilenameFromSHA1(content.sha1);
+ filename = *shared_content.GetFilenameFromSHA1(content.sha1);
else
filename = StringFromFormat("%s/%08x.app", m_Path.c_str(), content.id);
@@ -223,14 +224,15 @@ CNANDContentManager::~CNANDContentManager()
{
}
-const CNANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& content_path)
+const CNANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& content_path,
+ Common::FromWhichRoot from)
{
auto it = m_map.find(content_path);
if (it != m_map.end())
return *it->second;
return *m_map
- .emplace_hint(it, std::make_pair(content_path,
- std::make_unique<CNANDContentLoader>(content_path)))
+ .emplace_hint(it, std::make_pair(content_path, std::make_unique<CNANDContentLoader>(
+ content_path, from)))
->second;
}
@@ -238,7 +240,7 @@ const CNANDContentLoader& CNANDContentManager::GetNANDLoader(u64 title_id,
Common::FromWhichRoot from)
{
std::string path = Common::GetTitleContentPath(title_id, from);
- return GetNANDLoader(path);
+ return GetNANDLoader(path, from);
}
void CNANDContentManager::ClearCache()