diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_host_content.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_host_content.hpp new file mode 100644 index 000000000..fdfe59fcc --- /dev/null +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_host_content.hpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2019-2020 Adubbz, Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include + +namespace ams::ncm { + +} diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_storage.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_storage.hpp index 232e48cee..5f1a848ce 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_storage.hpp @@ -50,6 +50,8 @@ AMS_SF_METHOD_INFO(C, H, 24, Result, FlushPlaceHolder, (), (), hos::Version_3_0_0) \ AMS_SF_METHOD_INFO(C, H, 25, Result, GetSizeFromPlaceHolderId, (sf::Out out, ncm::PlaceHolderId placeholder_id), (out, placeholder_id), hos::Version_4_0_0) \ AMS_SF_METHOD_INFO(C, H, 26, Result, RepairInvalidFileAttribute, (), (), hos::Version_4_0_0) \ - AMS_SF_METHOD_INFO(C, H, 27, Result, GetRightsIdFromPlaceHolderIdWithCache, (sf::Out out_rights_id, ncm::PlaceHolderId placeholder_id, ncm::ContentId cache_content_id), (out_rights_id, placeholder_id, cache_content_id), hos::Version_8_0_0) + AMS_SF_METHOD_INFO(C, H, 27, Result, GetRightsIdFromPlaceHolderIdWithCache, (sf::Out out_rights_id, ncm::PlaceHolderId placeholder_id, ncm::ContentId cache_content_id), (out_rights_id, placeholder_id, cache_content_id), hos::Version_8_0_0) \ + AMS_SF_METHOD_INFO(C, H, 28, Result, RegisterPath, (const ncm::ContentId &content_id, const ncm::Path &path), (content_id, path), hos::Version_13_0_0) \ + AMS_SF_METHOD_INFO(C, H, 29, Result, ClearRegisteredPath, (), (), hos::Version_13_0_0) AMS_SF_DEFINE_INTERFACE(ams::ncm, IContentStorage, AMS_NCM_I_CONTENT_STORAGE_INTERFACE_INFO) diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp index d79b98673..63cb1f30e 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp @@ -897,4 +897,12 @@ namespace ams::ncm { return ResultSuccess(); } + Result ContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) { + return ncm::ResultInvalidOperation(); + } + + Result ContentStorageImpl::ClearRegisteredPath() { + return ncm::ResultInvalidOperation(); + } + } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.hpp index bb823270d..7d321a5be 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.hpp @@ -100,6 +100,8 @@ namespace ams::ncm { virtual Result GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) override; virtual Result RepairInvalidFileAttribute() override; virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override; + virtual Result RegisterPath(const ContentId &content_id, const Path &path) override; + virtual Result ClearRegisteredPath() override; }; } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp index 0d44056e8..455c55582 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp @@ -75,6 +75,8 @@ namespace ams::ncm { virtual Result GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) = 0; virtual Result RepairInvalidFileAttribute() = 0; virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) = 0; + virtual Result RegisterPath(const ContentId &content_id, const Path &path) = 0; + virtual Result ClearRegisteredPath() = 0; }; static_assert(ncm::IsIContentStorage); diff --git a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp index 5e5b5a254..e44a5d620 100644 --- a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp @@ -61,31 +61,31 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::GeneratePlaceHolderId(sf::Out out) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::HasPlaceHolder(sf::Out out, PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::Register(PlaceHolderId placeholder_id, ContentId content_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::Delete(ContentId content_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::Has(sf::Out out, ContentId content_id) { @@ -134,23 +134,23 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::GetPlaceHolderPath(sf::Out out, PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::CleanupAllPlaceHolder() { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::ListPlaceHolder(sf::Out out_count, const sf::OutArray &out_buf) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetContentCount(sf::Out out_count) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::ListContentId(sf::Out out_count, const sf::OutArray &out_buf, s32 offset) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetSizeFromContentId(sf::Out out_size, ContentId content_id) { @@ -175,11 +175,11 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) { @@ -199,11 +199,11 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out out_rights_id, PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out out_rights_id, PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out out_rights_id, ContentId content_id) { @@ -232,7 +232,7 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetFreeSpaceSize(sf::Out out_size) { @@ -246,19 +246,27 @@ namespace ams::ncm { } Result ReadOnlyContentStorageImpl::FlushPlaceHolder() { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::RepairInvalidFileAttribute() { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) { - return ncm::ResultWriteToReadOnlyContentStorage(); + return ncm::ResultNotSupported(); + } + + Result ReadOnlyContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) { + return ncm::ResultInvalidOperation(); + } + + Result ReadOnlyContentStorageImpl::ClearRegisteredPath() { + return ncm::ResultInvalidOperation(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.hpp index 3461ce39e..f06db0516 100644 --- a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.hpp @@ -54,6 +54,8 @@ namespace ams::ncm { virtual Result GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) override; virtual Result RepairInvalidFileAttribute() override; virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override; + virtual Result RegisterPath(const ContentId &content_id, const Path &path) override; + virtual Result ClearRegisteredPath() override; }; } diff --git a/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp index 11889c492..9ac113fbe 100644 --- a/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp @@ -189,6 +189,14 @@ namespace ams::ncm { ::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer()); return ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(this->srv), out, Convert(placeholder_id), Convert(cache_content_id)); } + + Result RegisterPath(const ContentId &content_id, const Path &path) { + AMS_ABORT("TODO"); + } + + Result ClearRegisteredPath() { + AMS_ABORT("TODO"); + } }; static_assert(ncm::IsIContentStorage); diff --git a/libraries/libvapours/include/vapours/results/ncm_results.hpp b/libraries/libvapours/include/vapours/results/ncm_results.hpp index a1885b395..518df4d40 100644 --- a/libraries/libvapours/include/vapours/results/ncm_results.hpp +++ b/libraries/libvapours/include/vapours/results/ncm_results.hpp @@ -38,7 +38,7 @@ namespace ams::ncm { R_DEFINE_ERROR_RESULT(InvalidInstallTaskState, 160); R_DEFINE_ERROR_RESULT(InvalidPlaceHolderFile, 170); R_DEFINE_ERROR_RESULT(BufferInsufficient, 180); - R_DEFINE_ERROR_RESULT(WriteToReadOnlyContentStorage, 190); + R_DEFINE_ERROR_RESULT(NotSupported, 190); R_DEFINE_ERROR_RESULT(NotEnoughInstallSpace, 200); R_DEFINE_ERROR_RESULT(SystemUpdateNotFoundInPackage, 210); R_DEFINE_ERROR_RESULT(ContentInfoNotFound, 220); @@ -69,6 +69,7 @@ namespace ams::ncm { R_DEFINE_ERROR_RESULT(CreatePlaceHolderCancelled, 291); R_DEFINE_ERROR_RESULT(WritePlaceHolderCancelled, 292); + R_DEFINE_ERROR_RESULT(InvalidOperation, 8180); R_DEFINE_ERROR_RANGE(InvalidArgument, 8181, 8191); R_DEFINE_ERROR_RESULT(InvalidOffset, 8182);