diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index 1a75f1c21f..79a69e2317 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -520,9 +520,8 @@ IPCCommandResult ES::AddContentFinish(const IOCtlVRequest& request) m_addtitle_content_buffer.data(), decrypted_data.data()); std::string content_path; - if (content_info.type & 0x8000) + if (content_info.IsShared()) { - // Shared content. DiscIO::CSharedContent shared_content{Common::FROM_SESSION_ROOT}; content_path = shared_content.AddSharedContent(content_info.sha1.data()); } diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index 38e285285c..7e94798305 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -26,6 +26,11 @@ bool IsTitleType(u64 title_id, TitleType title_type) return static_cast(title_id >> 32) == static_cast(title_type); } +bool Content::IsShared() const +{ + return (type & 0x8000) != 0; +} + TMDReader::TMDReader(const std::vector& bytes) : m_bytes(bytes) { } diff --git a/Source/Core/Core/IOS/ES/Formats.h b/Source/Core/Core/IOS/ES/Formats.h index 297a18abda..268506bec3 100644 --- a/Source/Core/Core/IOS/ES/Formats.h +++ b/Source/Core/Core/IOS/ES/Formats.h @@ -61,6 +61,7 @@ static_assert(sizeof(TMDHeader) == 0x1e4, "TMDHeader has the wrong size"); struct Content { + bool IsShared() const; u32 id; u16 index; u16 type; diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 02a2462ab9..914e23191e 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -260,7 +260,7 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector& data_ap else { std::string filename; - if (content.type & 0x8000) // shared app + if (content.IsShared()) filename = shared_content.GetFilenameFromSHA1(content.sha1.data()); else filename = StringFromFormat("%s/%08x.app", m_Path.c_str(), content.id); @@ -317,7 +317,7 @@ void CNANDContentLoader::RemoveTitle() const // remove TMD? for (const auto& content : m_Content) { - if (!(content.m_metadata.type & 0x8000)) // skip shared apps + if (!content.m_metadata.IsShared()) { std::string path = StringFromFormat("%s/%08x.app", m_Path.c_str(), content.m_metadata.id); INFO_LOG(DISCIO, "Delete %s", path.c_str()); @@ -430,7 +430,7 @@ u64 CNANDContentManager::Install_WiiWAD(const std::string& filename) for (const auto& content : content_loader.GetContent()) { std::string app_filename; - if (content.m_metadata.type & 0x8000) // shared + if (content.m_metadata.IsShared()) app_filename = shared_content.AddSharedContent(content.m_metadata.sha1.data()); else app_filename = StringFromFormat("%s%08x.app", content_path.c_str(), content.m_metadata.id);