mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 01:26:34 +00:00
ncm: skeleton new commands
This commit is contained in:
parent
8859aefdd7
commit
f1e2f001cb
9 changed files with 77 additions and 23 deletions
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::ncm {
|
||||||
|
|
||||||
|
}
|
|
@ -50,6 +50,8 @@
|
||||||
AMS_SF_METHOD_INFO(C, H, 24, Result, FlushPlaceHolder, (), (), hos::Version_3_0_0) \
|
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<s64> out, ncm::PlaceHolderId placeholder_id), (out, placeholder_id), hos::Version_4_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 25, Result, GetSizeFromPlaceHolderId, (sf::Out<s64> 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, 26, Result, RepairInvalidFileAttribute, (), (), hos::Version_4_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 27, Result, GetRightsIdFromPlaceHolderIdWithCache, (sf::Out<ncm::RightsId> 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<ncm::RightsId> 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)
|
AMS_SF_DEFINE_INTERFACE(ams::ncm, IContentStorage, AMS_NCM_I_CONTENT_STORAGE_INTERFACE_INFO)
|
||||||
|
|
|
@ -897,4 +897,12 @@ namespace ams::ncm {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result ContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) {
|
||||||
|
return ncm::ResultInvalidOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ContentStorageImpl::ClearRegisteredPath() {
|
||||||
|
return ncm::ResultInvalidOperation();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,8 @@ namespace ams::ncm {
|
||||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
||||||
virtual Result RepairInvalidFileAttribute() 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 GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,8 @@ namespace ams::ncm {
|
||||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) = 0;
|
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) = 0;
|
||||||
virtual Result RepairInvalidFileAttribute() = 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 GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> 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<ContentStorageImplBase>);
|
static_assert(ncm::IsIContentStorage<ContentStorageImplBase>);
|
||||||
|
|
||||||
|
|
|
@ -61,31 +61,31 @@ namespace ams::ncm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
|
Result ReadOnlyContentStorageImpl::GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
Result ReadOnlyContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) {
|
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) {
|
Result ReadOnlyContentStorageImpl::Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::Delete(ContentId content_id) {
|
Result ReadOnlyContentStorageImpl::Delete(ContentId content_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::Has(sf::Out<bool> out, ContentId content_id) {
|
Result ReadOnlyContentStorageImpl::Has(sf::Out<bool> out, ContentId content_id) {
|
||||||
|
@ -134,23 +134,23 @@ namespace ams::ncm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::CleanupAllPlaceHolder() {
|
Result ReadOnlyContentStorageImpl::CleanupAllPlaceHolder() {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) {
|
Result ReadOnlyContentStorageImpl::ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetContentCount(sf::Out<s32> out_count) {
|
Result ReadOnlyContentStorageImpl::GetContentCount(sf::Out<s32> out_count) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) {
|
Result ReadOnlyContentStorageImpl::ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) {
|
Result ReadOnlyContentStorageImpl::GetSizeFromContentId(sf::Out<s64> 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) {
|
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) {
|
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) {
|
Result ReadOnlyContentStorageImpl::ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) {
|
||||||
|
@ -199,11 +199,11 @@ namespace ams::ncm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> 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) {
|
Result ReadOnlyContentStorageImpl::WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetFreeSpaceSize(sf::Out<s64> out_size) {
|
Result ReadOnlyContentStorageImpl::GetFreeSpaceSize(sf::Out<s64> out_size) {
|
||||||
|
@ -246,19 +246,27 @@ namespace ams::ncm {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::FlushPlaceHolder() {
|
Result ReadOnlyContentStorageImpl::FlushPlaceHolder() {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) {
|
Result ReadOnlyContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::RepairInvalidFileAttribute() {
|
Result ReadOnlyContentStorageImpl::RepairInvalidFileAttribute() {
|
||||||
return ncm::ResultWriteToReadOnlyContentStorage();
|
return ncm::ResultNotSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace ams::ncm {
|
||||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out, PlaceHolderId placeholder_id) override;
|
||||||
virtual Result RepairInvalidFileAttribute() 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 GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,14 @@ namespace ams::ncm {
|
||||||
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
|
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
|
||||||
return ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(this->srv), out, Convert(placeholder_id), Convert(cache_content_id));
|
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<RemoteContentStorageImpl>);
|
static_assert(ncm::IsIContentStorage<RemoteContentStorageImpl>);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::ncm {
|
||||||
R_DEFINE_ERROR_RESULT(InvalidInstallTaskState, 160);
|
R_DEFINE_ERROR_RESULT(InvalidInstallTaskState, 160);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidPlaceHolderFile, 170);
|
R_DEFINE_ERROR_RESULT(InvalidPlaceHolderFile, 170);
|
||||||
R_DEFINE_ERROR_RESULT(BufferInsufficient, 180);
|
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(NotEnoughInstallSpace, 200);
|
||||||
R_DEFINE_ERROR_RESULT(SystemUpdateNotFoundInPackage, 210);
|
R_DEFINE_ERROR_RESULT(SystemUpdateNotFoundInPackage, 210);
|
||||||
R_DEFINE_ERROR_RESULT(ContentInfoNotFound, 220);
|
R_DEFINE_ERROR_RESULT(ContentInfoNotFound, 220);
|
||||||
|
@ -69,6 +69,7 @@ namespace ams::ncm {
|
||||||
R_DEFINE_ERROR_RESULT(CreatePlaceHolderCancelled, 291);
|
R_DEFINE_ERROR_RESULT(CreatePlaceHolderCancelled, 291);
|
||||||
R_DEFINE_ERROR_RESULT(WritePlaceHolderCancelled, 292);
|
R_DEFINE_ERROR_RESULT(WritePlaceHolderCancelled, 292);
|
||||||
|
|
||||||
|
R_DEFINE_ERROR_RESULT(InvalidOperation, 8180);
|
||||||
R_DEFINE_ERROR_RANGE(InvalidArgument, 8181, 8191);
|
R_DEFINE_ERROR_RANGE(InvalidArgument, 8181, 8191);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidOffset, 8182);
|
R_DEFINE_ERROR_RESULT(InvalidOffset, 8182);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue