diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-05-26 21:29:15 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2017-06-03 12:36:24 +0200 |
| commit | 62d08e2d172a072d4547f26a6b2740658054fc93 (patch) | |
| tree | 7d87f12bfaa447e58b483ea119c74e551b7e7c8d /Source/Core/DiscIO/NANDContentLoader.cpp | |
| parent | 545006f6665407a5dc2cdebddcbb9e4a668a50ff (diff) | |
DiscIO: Fix the wrong NAND root being used
The whole NANDContentLoader stuff is truly awful and will be removed
as soon as possible.
For now, this fixes a bug that was exposed by std::optional::operator*.
Diffstat (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp')
| -rw-r--r-- | Source/Core/DiscIO/NANDContentLoader.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index b55efc413b..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) { @@ -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() |
