ncm: rights ids were added in 2.0.0

This commit is contained in:
Michael Scire 2020-07-08 16:02:47 -07:00
parent bffd553b80
commit 852c039f70
2 changed files with 18 additions and 16 deletions

View file

@ -142,28 +142,30 @@ namespace ams::ncm {
return this->interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset); return this->interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset);
} }
Result GetRightsId(ams::fs::RightsId *out_rights_id, PlaceHolderId placeholder_id) {
AMS_ASSERT(this->interface != nullptr);
AMS_ABORT_UNLESS(hos::GetVersion() < hos::Version_3_0_0);
return this->interface->GetRightsIdFromPlaceHolderIdDeprecated(out_rights_id, placeholder_id);
}
Result GetRightsId(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id) { Result GetRightsId(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id) {
AMS_ASSERT(this->interface != nullptr); AMS_ASSERT(this->interface != nullptr);
AMS_ABORT_UNLESS(hos::GetVersion() >= hos::Version_3_0_0);
return this->interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id);
}
Result GetRightsId(ams::fs::RightsId *out_rights_id, ContentId content_id) { auto vers = hos::GetVersion();
AMS_ASSERT(this->interface != nullptr); if (vers >= hos::Version_3_0_0) {
AMS_ABORT_UNLESS(hos::GetVersion() < hos::Version_3_0_0); return this->interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id);
return this->interface->GetRightsIdFromContentIdDeprecated(out_rights_id, content_id); } else {
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
*out_rights_id = {};
return this->interface->GetRightsIdFromPlaceHolderIdDeprecated(std::addressof(out_rights_id->id), placeholder_id);
}
} }
Result GetRightsId(ncm::RightsId *out_rights_id, ContentId content_id) { Result GetRightsId(ncm::RightsId *out_rights_id, ContentId content_id) {
AMS_ASSERT(this->interface != nullptr); AMS_ASSERT(this->interface != nullptr);
AMS_ABORT_UNLESS(hos::GetVersion() >= hos::Version_3_0_0);
auto vers = hos::GetVersion();
if (vers >= hos::Version_3_0_0) {
return this->interface->GetRightsIdFromContentId(out_rights_id, content_id); return this->interface->GetRightsIdFromContentId(out_rights_id, content_id);
} else {
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
*out_rights_id = {};
return this->interface->GetRightsIdFromContentIdDeprecated(std::addressof(out_rights_id->id), content_id);
}
} }
Result WriteContentForDebug(ContentId content_id, s64 offset, const void *buf, size_t size) { Result WriteContentForDebug(ContentId content_id, s64 offset, const void *buf, size_t size) {

View file

@ -593,7 +593,7 @@ namespace ams::ncm {
R_UNLESS(std::memcmp(hash, content_info->digest.data, crypto::Sha256Generator::HashSize) == 0, ncm::ResultInvalidContentHash()); R_UNLESS(std::memcmp(hash, content_info->digest.data, crypto::Sha256Generator::HashSize) == 0, ncm::ResultInvalidContentHash());
} }
if (!(this->config & InstallConfig_IgnoreTicket)) { if (hos::GetVersion() >= hos::Version_2_0_0 && !(this->config & InstallConfig_IgnoreTicket)) {
ncm::RightsId rights_id; ncm::RightsId rights_id;
{ {
/* Open the content storage and obtain the rights id. */ /* Open the content storage and obtain the rights id. */