libstrat: make build with new ncm/fs api changes (sysmodules probably fail to build)
This commit is contained in:
@@ -37,7 +37,7 @@ namespace ams::ncm {
|
||||
char path[MaxPackagePathLength];
|
||||
R_TRY(ConvertToFsCommonPath(path, sizeof(path), package_root_path, entry.name));
|
||||
|
||||
R_RETURN(ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(out, path));
|
||||
R_RETURN(ncm::TryReadContentMetaPath(out, path, ncm::ReadContentMetaPathWithoutExtendedDataOrDigest));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
@@ -108,7 +108,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Read the content meta path, and build. */
|
||||
ncm::AutoBuffer package_meta;
|
||||
if (R_SUCCEEDED(ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(std::addressof(package_meta), path.str))) {
|
||||
if (R_SUCCEEDED(ncm::TryReadContentMetaPath(std::addressof(package_meta), path.str, ncm::ReadContentMetaPathWithoutExtendedDataOrDigest))) {
|
||||
/* Get the size of the content. */
|
||||
s64 size;
|
||||
R_TRY(storage->GetSize(std::addressof(size), content_id));
|
||||
|
||||
@@ -275,11 +275,11 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContentMetaDatabaseImpl::GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) {
|
||||
Result ContentMetaDatabaseImpl::GetPatchContentMetaId(sf::Out<u64> out_patch_id, const ContentMetaKey &key) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Only applications can have patches. */
|
||||
R_UNLESS(key.type == ContentMetaType::Application, ncm::ResultInvalidContentMetaKey());
|
||||
R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey());
|
||||
|
||||
/* Obtain the content meta for the key. */
|
||||
const void *meta;
|
||||
@@ -290,7 +290,17 @@ namespace ams::ncm {
|
||||
ContentMetaReader reader(meta, meta_size);
|
||||
|
||||
/* Obtain the patch id. */
|
||||
out_patch_id.SetValue(reader.GetExtendedHeader<ApplicationMetaExtendedHeader>()->patch_id);
|
||||
switch (key.type) {
|
||||
case ContentMetaType::Application:
|
||||
out_patch_id.SetValue(reader.GetExtendedHeader<ApplicationMetaExtendedHeader>()->patch_id.value);
|
||||
break;
|
||||
case ContentMetaType::Patch:
|
||||
R_UNLESS(reader.GetExtendedHeaderSize() == sizeof(AddOnContentMetaExtendedHeader), ncm::ResultInvalidAddOnContentMetaExtendedHeader());
|
||||
out_patch_id.SetValue(reader.GetExtendedHeader<AddOnContentMetaExtendedHeader>()->data_patch_id.value);
|
||||
break;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::ncm {
|
||||
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) override;
|
||||
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) override;
|
||||
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) override;
|
||||
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) override;
|
||||
virtual Result GetPatchContentMetaId(sf::Out<u64> out_patch_id, const ContentMetaKey &key) override;
|
||||
virtual Result DisableForcibly() override;
|
||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) override;
|
||||
virtual Result Commit() override;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ams::ncm {
|
||||
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) = 0;
|
||||
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) = 0;
|
||||
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
||||
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) = 0;
|
||||
virtual Result GetPatchContentMetaId(sf::Out<u64> out_patch_id, const ContentMetaKey &key) = 0;
|
||||
virtual Result DisableForcibly() = 0;
|
||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) = 0;
|
||||
virtual Result Commit() = 0;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace ams::ncm {
|
||||
|
||||
namespace {
|
||||
|
||||
Result MountContentMetaByRemoteFileSystemProxy(const char *mount_name, const char *path) {
|
||||
R_RETURN(fs::MountContent(mount_name, path, fs::ContentType_Meta));
|
||||
Result MountContentMetaByRemoteFileSystemProxy(const char *mount_name, const char *path, fs::ContentAttributes attr) {
|
||||
R_RETURN(fs::MountContent(mount_name, path, attr, fs::ContentType_Meta));
|
||||
}
|
||||
|
||||
constinit MountContentMetaFunction g_mount_content_meta_func = MountContentMetaByRemoteFileSystemProxy;
|
||||
@@ -30,8 +30,8 @@ namespace ams::ncm {
|
||||
|
||||
namespace impl {
|
||||
|
||||
Result MountContentMetaImpl(const char *mount_name, const char *path) {
|
||||
R_RETURN(g_mount_content_meta_func(mount_name, path));
|
||||
Result MountContentMetaImpl(const char *mount_name, const char *path, fs::ContentAttributes attr) {
|
||||
R_RETURN(g_mount_content_meta_func(mount_name, path, attr));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,10 +40,10 @@ namespace ams::ncm {
|
||||
return impl::PathView(name).HasSuffix(".cnmt");
|
||||
}
|
||||
|
||||
Result ReadContentMetaPathAlongWithExtendedDataAndDigest(AutoBuffer *out, const char *path) {
|
||||
Result ReadContentMetaPathAlongWithExtendedDataAndDigest(AutoBuffer *out, const char *path, fs::ContentAttributes attr) {
|
||||
/* Mount the content. */
|
||||
auto mount_name = impl::CreateUniqueMountName();
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, path));
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, path, attr));
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name.str); };
|
||||
|
||||
/* Open the root directory. */
|
||||
@@ -89,15 +89,15 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultContentMetaNotFound());
|
||||
}
|
||||
|
||||
Result ReadContentMetaPathAlongWithExtendedDataAndDigestSuppressingFsAbort(AutoBuffer *out, const char *path) {
|
||||
Result ReadContentMetaPathAlongWithExtendedDataAndDigestSuppressingFsAbort(AutoBuffer *out, const char *path, fs::ContentAttributes attr) {
|
||||
fs::ScopedAutoAbortDisabler aad;
|
||||
R_RETURN(ReadContentMetaPathAlongWithExtendedDataAndDigest(out, path));
|
||||
R_RETURN(ReadContentMetaPathAlongWithExtendedDataAndDigest(out, path, attr));
|
||||
}
|
||||
|
||||
Result ReadContentMetaPathWithoutExtendedDataOrDigest(AutoBuffer *out, const char *path) {
|
||||
Result ReadContentMetaPathWithoutExtendedDataOrDigest(AutoBuffer *out, const char *path, fs::ContentAttributes attr) {
|
||||
/* Mount the content. */
|
||||
auto mount_name = impl::CreateUniqueMountName();
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, path));
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, path, attr));
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name.str); };
|
||||
|
||||
/* Open the root directory. */
|
||||
@@ -157,14 +157,44 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultContentMetaNotFound());
|
||||
}
|
||||
|
||||
Result ReadContentMetaPathWithoutExtendedDataOrDigestSuppressingFsAbort(AutoBuffer *out, const char *path) {
|
||||
Result ReadContentMetaPathWithoutExtendedDataOrDigestSuppressingFsAbort(AutoBuffer *out, const char *path, fs::ContentAttributes attr) {
|
||||
fs::ScopedAutoAbortDisabler aad;
|
||||
R_RETURN(ReadContentMetaPathAlongWithExtendedDataAndDigest(out, path));
|
||||
R_RETURN(ReadContentMetaPathAlongWithExtendedDataAndDigest(out, path, attr));
|
||||
}
|
||||
|
||||
Result ReadVariationContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const Path &path, FirmwareVariationId firmware_variation_id) {
|
||||
Result TryReadContentMetaPath(fs::ContentAttributes *out_attr, AutoBuffer *out, const char *path, ReadContentMetaPathFunction func) {
|
||||
/* Try with attributes = none. */
|
||||
fs::ContentAttributes attr = fs::ContentAttributes_None;
|
||||
R_TRY_CATCH(func(out, path, attr)) {
|
||||
R_CATCH(fs::ResultNcaHeaderSignature1VerificationFailed) {
|
||||
/* On signature failure, try with attributes = all. */
|
||||
attr = fs::ContentAttributes_All;
|
||||
R_TRY(func(out, path, attr));
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
/* Set output attributes. */
|
||||
*out_attr = attr;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result TryReadContentMetaPath(AutoBuffer *out, const char *path, ReadContentMetaPathFunction func) {
|
||||
/* Try with attributes = none. */
|
||||
fs::ContentAttributes attr = fs::ContentAttributes_None;
|
||||
R_TRY_CATCH(func(out, path, attr)) {
|
||||
R_CATCH(fs::ResultNcaHeaderSignature1VerificationFailed) {
|
||||
/* On signature failure, try with attributes = all. */
|
||||
attr = fs::ContentAttributes_All;
|
||||
R_TRY(func(out, path, attr));
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ReadVariationContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const Path &path, fs::ContentAttributes attr, FirmwareVariationId firmware_variation_id) {
|
||||
AutoBuffer meta;
|
||||
R_TRY(ReadContentMetaPathAlongWithExtendedDataAndDigestSuppressingFsAbort(std::addressof(meta), path.str));
|
||||
R_TRY(ReadContentMetaPathAlongWithExtendedDataAndDigestSuppressingFsAbort(std::addressof(meta), path.str, attr));
|
||||
|
||||
/* Create a reader for the content meta. */
|
||||
PackagedContentMetaReader reader(meta.Get(), meta.GetSize());
|
||||
|
||||
@@ -714,14 +714,18 @@ namespace ams::ncm {
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
/* Obtain the regular rights id for the placeholder id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(this->GetRightsIdFromPlaceHolderId(std::addressof(rights_id), placeholder_id));
|
||||
R_TRY(this->GetRightsIdFromPlaceHolderIdDeprecated2(std::addressof(rights_id), placeholder_id));
|
||||
|
||||
/* Output the fs rights id. */
|
||||
out_rights_id.SetValue(rights_id.id);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
R_RETURN(this->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Get the placeholder path. */
|
||||
@@ -729,20 +733,24 @@ namespace ams::ncm {
|
||||
R_TRY(this->GetPlaceHolderPath(std::addressof(path), placeholder_id));
|
||||
|
||||
/* Get the rights id for the placeholder id. */
|
||||
R_RETURN(GetRightsId(out_rights_id.GetPointer(), path));
|
||||
R_RETURN(GetRightsId(out_rights_id.GetPointer(), path, attr));
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
/* Obtain the regular rights id for the content id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(this->GetRightsIdFromContentId(std::addressof(rights_id), content_id));
|
||||
R_TRY(this->GetRightsIdFromContentIdDeprecated2(std::addressof(rights_id), content_id));
|
||||
|
||||
/* Output the fs rights id. */
|
||||
out_rights_id.SetValue(rights_id.id);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
Result ContentStorageImpl::GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
R_RETURN(this->GetRightsIdFromContentId(out_rights_id, content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Attempt to obtain the rights id from the cache. */
|
||||
@@ -756,7 +764,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Obtain the rights id for the content. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), path));
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), path, attr));
|
||||
|
||||
/* Store the rights id to the cache. */
|
||||
m_rights_id_cache->Store(content_id, rights_id);
|
||||
@@ -875,7 +883,11 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
R_RETURN(this->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Attempt to find the rights id in the cache. */
|
||||
@@ -893,7 +905,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Get the rights id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), common_path));
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), common_path, attr));
|
||||
m_rights_id_cache->Store(cache_content_id, rights_id);
|
||||
|
||||
/* Set output. */
|
||||
|
||||
@@ -91,16 +91,19 @@ namespace ams::ncm {
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) override;
|
||||
virtual Result ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) override;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) override;
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) override;
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) override;
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) override;
|
||||
virtual Result FlushPlaceHolder() override;
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
||||
virtual Result RepairInvalidFileAttribute() override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) override;
|
||||
virtual Result RegisterPath(const ContentId &content_id, const Path &path) override;
|
||||
virtual Result ClearRegisteredPath() override;
|
||||
};
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path) {
|
||||
static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path, fs::ContentAttributes attr) {
|
||||
if (hos::GetVersion() >= hos::Version_3_0_0) {
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), std::addressof(out_rights_id->key_generation), path.str));
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), std::addressof(out_rights_id->key_generation), path.str, attr));
|
||||
} else {
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str));
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str, attr));
|
||||
out_rights_id->key_generation = 0;
|
||||
}
|
||||
R_SUCCEED();
|
||||
@@ -65,16 +65,19 @@ namespace ams::ncm {
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) = 0;
|
||||
virtual Result ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) = 0;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) = 0;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) = 0;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) = 0;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) = 0;
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) = 0;
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) = 0;
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) = 0;
|
||||
virtual Result FlushPlaceHolder() = 0;
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result RepairInvalidFileAttribute() = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) = 0;
|
||||
virtual Result RegisterPath(const ContentId &content_id, const Path &path) = 0;
|
||||
virtual Result ClearRegisteredPath() = 0;
|
||||
};
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace ams::ncm {
|
||||
this->Finalize();
|
||||
}
|
||||
|
||||
Result Initialize(const char *content_path, bool suppress_fs_auto_abort) {
|
||||
Result Initialize(const char *content_path, fs::ContentAttributes attr, bool suppress_fs_auto_abort) {
|
||||
/* Set whether we should suppress fs aborts. */
|
||||
m_suppress_fs_auto_abort = suppress_fs_auto_abort;
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Mount the content. */
|
||||
auto mount_name = impl::CreateUniqueMountName();
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, content_path));
|
||||
R_TRY(impl::MountContentMetaImpl(mount_name.str, content_path, attr));
|
||||
|
||||
/* Set our mount name. */
|
||||
m_mount_name.emplace(mount_name.str);
|
||||
|
||||
@@ -45,6 +45,6 @@ namespace ams::ncm::impl {
|
||||
MountName CreateUniqueMountName();
|
||||
RootDirectoryPath GetRootDirectoryPath(const MountName &mount_name);
|
||||
|
||||
Result MountContentMetaImpl(const char *mount_name, const char *path);
|
||||
Result MountContentMetaImpl(const char *mount_name, const char *path, fs::ContentAttributes attr);
|
||||
|
||||
}
|
||||
|
||||
@@ -129,22 +129,31 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, attr);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
/* Obtain the regular rights id for the content id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(this->GetRightsIdFromContentId(std::addressof(rights_id), content_id));
|
||||
R_TRY(this->GetRightsIdFromContentIdDeprecated2(std::addressof(rights_id), content_id));
|
||||
|
||||
/* Output the fs rights id. */
|
||||
out_rights_id.SetValue(rights_id.id);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
Result HostContentStorageImpl::GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
R_RETURN(this->GetRightsIdFromContentId(out_rights_id, content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Get the content path. */
|
||||
@@ -153,7 +162,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Acquire the rights id for the content. */
|
||||
RightsId rights_id;
|
||||
R_TRY_CATCH(GetRightsId(std::addressof(rights_id), path)) {
|
||||
R_TRY_CATCH(GetRightsId(std::addressof(rights_id), path, attr)) {
|
||||
/* The content is absent, output a blank rights id. */
|
||||
R_CATCH(fs::ResultTargetNotFound) {
|
||||
out_rights_id.SetValue({});
|
||||
@@ -194,11 +203,16 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id, attr);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result HostContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) {
|
||||
AMS_ABORT_UNLESS(spl::IsDevelopment());
|
||||
R_RETURN(m_registered_content->RegisterPath(content_id, path));
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path) {
|
||||
static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path, fs::ContentAttributes attr) {
|
||||
if (hos::GetVersion() >= hos::Version_3_0_0) {
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), std::addressof(out_rights_id->key_generation), path.str));
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), std::addressof(out_rights_id->key_generation), path.str, attr));
|
||||
} else {
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str));
|
||||
R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str, attr));
|
||||
out_rights_id->key_generation = 0;
|
||||
}
|
||||
R_SUCCEED();
|
||||
@@ -62,16 +62,19 @@ namespace ams::ncm {
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size);
|
||||
virtual Result ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset);
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id);
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id);
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id);
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr);
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id);
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id);
|
||||
virtual Result GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id);
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr);
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data);
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size);
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size);
|
||||
virtual Result FlushPlaceHolder();
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id);
|
||||
virtual Result RepairInvalidFileAttribute();
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id);
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id);
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr);
|
||||
virtual Result RegisterPath(const ContentId &content_id, const Path &path);
|
||||
virtual Result ClearRegisteredPath();
|
||||
};
|
||||
|
||||
@@ -592,7 +592,7 @@ namespace ams::ncm {
|
||||
/* Open the content storage and obtain the rights id. */
|
||||
ncm::ContentStorage storage;
|
||||
R_TRY(OpenContentStorage(std::addressof(storage), content_info->storage_id));
|
||||
R_TRY(storage.GetRightsId(std::addressof(rights_id), content_info->placeholder_id));
|
||||
R_TRY(storage.GetRightsId(std::addressof(rights_id), content_info->placeholder_id, content_info->GetContentAttributes()));
|
||||
}
|
||||
|
||||
/* Install a ticket if necessary. */
|
||||
@@ -827,10 +827,13 @@ namespace ams::ncm {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get the content info. */
|
||||
const auto *content_info = reader.GetContentInfo(ContentType::Meta);
|
||||
|
||||
/* List content meta infos. */
|
||||
std::unique_ptr<ContentMetaInfo[]> content_meta_infos;
|
||||
s32 num_content_meta_infos;
|
||||
R_TRY(this->ReadContentMetaInfoList(std::addressof(num_content_meta_infos), std::addressof(content_meta_infos), reader.GetKey()));
|
||||
R_TRY(this->ReadContentMetaInfoList(std::addressof(num_content_meta_infos), std::addressof(content_meta_infos), reader.GetKey(), content_info->GetContentAttributes()));
|
||||
|
||||
/* Iterate over content meta infos. */
|
||||
for (s32 j = 0; j < num_content_meta_infos; j++) {
|
||||
@@ -870,10 +873,13 @@ namespace ams::ncm {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get the content info. */
|
||||
const auto *content_info = reader.GetContentInfo(ContentType::Meta);
|
||||
|
||||
/* List content meta infos. */
|
||||
std::unique_ptr<ContentMetaInfo[]> content_meta_infos;
|
||||
s32 num_content_meta_infos;
|
||||
R_TRY(this->ReadContentMetaInfoList(std::addressof(num_content_meta_infos), std::addressof(content_meta_infos), reader.GetKey()));
|
||||
R_TRY(this->ReadContentMetaInfoList(std::addressof(num_content_meta_infos), std::addressof(content_meta_infos), reader.GetKey(), content_info->GetContentAttributes()));
|
||||
|
||||
/* Iterate over content meta infos. */
|
||||
for (s32 j = 0; j < num_content_meta_infos; j++) {
|
||||
@@ -989,8 +995,9 @@ namespace ams::ncm {
|
||||
}
|
||||
|
||||
Result InstallTaskBase::GetInstallContentMetaDataFromPath(AutoBuffer *out, const Path &path, const InstallContentInfo &content_info, util::optional<u32> source_version) {
|
||||
fs::ContentAttributes attr;
|
||||
AutoBuffer meta;
|
||||
R_TRY(ReadContentMetaPathWithoutExtendedDataOrDigestSuppressingFsAbort(std::addressof(meta), path.str));
|
||||
R_TRY(TryReadContentMetaPath(std::addressof(attr), std::addressof(meta), path.str, ReadContentMetaPathWithoutExtendedDataOrDigestSuppressingFsAbort));
|
||||
|
||||
/* Create a reader. */
|
||||
PackagedContentMetaReader reader(meta.Get(), meta.GetSize());
|
||||
@@ -1005,7 +1012,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Create a mapper. */
|
||||
auto mapper = MultiCacheReadonlyMapper<4>(Span<u8>(buffers[0], sizeof(buffers[0])), Span<u8>(buffers[1], sizeof(buffers[1])));
|
||||
R_TRY(mapper.Initialize(path.str, true));
|
||||
R_TRY(mapper.Initialize(path.str, static_cast<fs::ContentAttributes>(static_cast<u8>(attr) & fs::ContentAttributes_All), true));
|
||||
|
||||
/* Create an accessor. */
|
||||
auto accessor = PatchMetaExtendedDataAccessor{std::addressof(mapper)};
|
||||
@@ -1153,7 +1160,7 @@ namespace ams::ncm {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result InstallTaskBase::ReadContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const ContentMetaKey &key) {
|
||||
Result InstallTaskBase::ReadContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const ContentMetaKey &key, fs::ContentAttributes attr) {
|
||||
/* Get the install content meta info. */
|
||||
InstallContentMetaInfo install_content_meta_info;
|
||||
R_TRY(this->GetInstallContentMetaInfo(std::addressof(install_content_meta_info), key));
|
||||
@@ -1173,7 +1180,7 @@ namespace ams::ncm {
|
||||
content_storage.GetPlaceHolderPath(std::addressof(path), placeholder_id);
|
||||
|
||||
/* Read the variation list. */
|
||||
R_TRY(ReadVariationContentMetaInfoList(out_count, out_meta_infos, path, m_firmware_variation_id));
|
||||
R_TRY(ReadVariationContentMetaInfoList(out_count, out_meta_infos, path, attr, m_firmware_variation_id));
|
||||
|
||||
/* Delete the placeholder. */
|
||||
content_storage.DeletePlaceHolder(placeholder_id);
|
||||
@@ -1377,7 +1384,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Get the rights id. */
|
||||
RightsId rights_id;
|
||||
R_TRY(content_storage.GetRightsId(std::addressof(rights_id), content_info->GetPlaceHolderId()));
|
||||
R_TRY(content_storage.GetRightsId(std::addressof(rights_id), content_info->GetPlaceHolderId(), content_info->GetContentAttributes()));
|
||||
|
||||
/* Skip empty rights ids. */
|
||||
if (rights_id.id == fs::InvalidRightsId) {
|
||||
|
||||
@@ -216,22 +216,31 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, attr);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
/* Obtain the regular rights id for the content id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(this->GetRightsIdFromContentId(std::addressof(rights_id), content_id));
|
||||
R_TRY(this->GetRightsIdFromContentIdDeprecated2(std::addressof(rights_id), content_id));
|
||||
|
||||
/* Output the fs rights id. */
|
||||
out_rights_id.SetValue(rights_id.id);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
R_RETURN(this->GetRightsIdFromContentId(out_rights_id, content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) {
|
||||
R_TRY(this->EnsureEnabled());
|
||||
|
||||
/* Get the content path. */
|
||||
@@ -240,7 +249,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Get the rights id. */
|
||||
ncm::RightsId rights_id;
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), path));
|
||||
R_TRY(GetRightsId(std::addressof(rights_id), path, attr));
|
||||
out_rights_id.SetValue(rights_id);
|
||||
|
||||
R_SUCCEED();
|
||||
@@ -274,11 +283,16 @@ namespace ams::ncm {
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) {
|
||||
AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id, attr);
|
||||
R_THROW(ncm::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ReadOnlyContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) {
|
||||
AMS_UNUSED(content_id, path);
|
||||
R_THROW(ncm::ResultInvalidOperation());
|
||||
|
||||
@@ -44,16 +44,19 @@ namespace ams::ncm {
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) override;
|
||||
virtual Result ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) override;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override;
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) override;
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) override;
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) override;
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) override;
|
||||
virtual Result FlushPlaceHolder() override;
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
||||
virtual Result RepairInvalidFileAttribute() override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override;
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) override;
|
||||
virtual Result RegisterPath(const ContentId &content_id, const Path &path) override;
|
||||
virtual Result ClearRegisteredPath() override;
|
||||
};
|
||||
|
||||
@@ -120,8 +120,8 @@ namespace ams::ncm {
|
||||
R_RETURN(ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(m_srv), out_version.GetPointer(), Convert(key)));
|
||||
}
|
||||
|
||||
Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) {
|
||||
R_RETURN(ncmContentMetaDatabaseGetPatchId(std::addressof(m_srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key)));
|
||||
Result GetPatchContentMetaId(sf::Out<u64> out_patch_id, const ContentMetaKey &key) {
|
||||
R_RETURN(ncmContentMetaDatabaseGetPatchContentMetaId(std::addressof(m_srv), out_patch_id.GetPointer(), Convert(key)));
|
||||
}
|
||||
|
||||
Result DisableForcibly() {
|
||||
|
||||
@@ -56,6 +56,10 @@ namespace ams::ncm {
|
||||
static_assert(sizeof(ContentId) == sizeof(::NcmContentId));
|
||||
return reinterpret_cast<const ::NcmContentId *>(std::addressof(c));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ::FsContentAttributes Convert(fs::ContentAttributes attr) {
|
||||
return static_cast<::FsContentAttributes>(static_cast<u8>(attr));
|
||||
}
|
||||
public:
|
||||
Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
|
||||
R_RETURN(ncmContentStorageGeneratePlaceHolderId(std::addressof(m_srv), Convert(out.GetPointer())));
|
||||
@@ -137,16 +141,20 @@ namespace ams::ncm {
|
||||
|
||||
Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(m_srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(m_srv), std::addressof(rights_id), Convert(placeholder_id), Convert(fs::ContentAttributes_None)));
|
||||
|
||||
static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id));
|
||||
std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer()));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
Result GetRightsIdFromPlaceHolderIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
R_RETURN(this->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, fs::ContentAttributes attr) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(m_srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(m_srv), std::addressof(rights_id), Convert(placeholder_id), Convert(attr)));
|
||||
|
||||
static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id));
|
||||
std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer()));
|
||||
@@ -155,16 +163,20 @@ namespace ams::ncm {
|
||||
|
||||
Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(m_srv), std::addressof(rights_id), Convert(content_id)));
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(m_srv), std::addressof(rights_id), Convert(content_id), Convert(fs::ContentAttributes_None)));
|
||||
|
||||
static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id));
|
||||
std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer()));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
Result GetRightsIdFromContentIdDeprecated2(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
R_RETURN(this->GetRightsIdFromContentId(out_rights_id, content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id, fs::ContentAttributes attr) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(m_srv), std::addressof(rights_id), Convert(content_id)));
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(m_srv), std::addressof(rights_id), Convert(content_id), Convert(attr)));
|
||||
|
||||
static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id));
|
||||
std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer()));
|
||||
@@ -195,10 +207,14 @@ namespace ams::ncm {
|
||||
R_RETURN(ncmContentStorageRepairInvalidFileAttribute(std::addressof(m_srv)));
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
Result GetRightsIdFromPlaceHolderIdWithCacheDeprecated(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
R_RETURN(this->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id, fs::ContentAttributes_None));
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id, fs::ContentAttributes attr) {
|
||||
static_assert(sizeof(::NcmRightsId) == sizeof(ncm::RightsId));
|
||||
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
|
||||
R_RETURN(ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(m_srv), out, Convert(placeholder_id), Convert(cache_content_id)));
|
||||
R_RETURN(ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(m_srv), out, Convert(placeholder_id), Convert(cache_content_id), Convert(attr)));
|
||||
}
|
||||
|
||||
Result RegisterPath(const ContentId &content_id, const Path &path) {
|
||||
|
||||
Reference in New Issue
Block a user