mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
Add ES::Content::IsShared to avoid hardcoding 0x8000
This commit is contained in:
parent
3bd34008c9
commit
ac27aff9c8
@ -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());
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ bool IsTitleType(u64 title_id, TitleType title_type)
|
||||
return static_cast<u32>(title_id >> 32) == static_cast<u32>(title_type);
|
||||
}
|
||||
|
||||
bool Content::IsShared() const
|
||||
{
|
||||
return (type & 0x8000) != 0;
|
||||
}
|
||||
|
||||
TMDReader::TMDReader(const std::vector<u8>& bytes) : m_bytes(bytes)
|
||||
{
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -260,7 +260,7 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& 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);
|
||||
|
Loading…
Reference in New Issue
Block a user